devmadhuu commented on code in PR #8070: URL: https://github.com/apache/ozone/pull/8070#discussion_r2002383800
########## hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/persistence/ContainerHealthSchemaManager.java: ########## @@ -123,7 +126,26 @@ public void insertUnhealthyContainerRecords(List<UnhealthyContainers> recs) { rec.getContainerState()); }); } - unhealthyContainersDao.insert(recs); + + try (Connection connection = containerSchemaDefinition.getDataSource().getConnection()) { + connection.setAutoCommit(false); // Turn off auto-commit for transactional control + for (UnhealthyContainers rec : recs) { + try { + unhealthyContainersDao.insert(rec); + } catch (DataAccessException dataAccessException) { + // Log the error and just update other fields of the existing record + // in case of ConstraintViolationException being actually thrown. + unhealthyContainersDao.update(rec); + LOG.error("Error while inserting unhealthy container record: {}", rec, Review Comment: I don't think, this will be helpful because ConstraintViolation comes when we get both containerId and containerState matches with same existing record, so if we log existing and current, it will log same. So no difference. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org