adoroszlai commented on code in PR #10532:
URL: https://github.com/apache/ozone/pull/10532#discussion_r3434745054


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/persistence/ContainerHealthSchemaManager.java:
##########
@@ -205,28 +205,75 @@ public void replaceUnhealthyContainerRecordsAtomically(
 
   private int deleteScmStatesForContainers(DSLContext dslContext,
       List<Long> containerIds) {
+    if (containerIds.isEmpty()) {
+      return 0;
+    }
+
+    List<Long> sortedIds = containerIds.stream()
+        .distinct()
+        .sorted()
+        .collect(Collectors.toList());
+
     int totalDeleted = 0;
+    List<Long> inClauseBatch = new ArrayList<>(MAX_IN_CLAUSE_CHUNK_SIZE);
+
+    for (int i = 0; i < sortedIds.size(); ) {
+      int rangeStart = i;

Review Comment:
   I think we can reduce delete statement count by combining `BETWEEN` and `IN` 
clauses in the same query using `OR` logic.  Delay submitting the statement if 
number of items for `IN` reaches the limit or number of `BETWEEN` ranges 
reaches another (lower) threshold.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to