sanpwc commented on code in PR #1282:
URL: https://github.com/apache/ignite-3/pull/1282#discussion_r1009662348


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -969,18 +971,28 @@ public void stop() {
      */
     private void cleanUpTablesResources(Map<UUID, TableImpl> tables) {
         for (TableImpl table : tables.values()) {
-            try {
-                for (int p = 0; p < table.internalTable().partitions(); p++) {
-                    TablePartitionId replicationGroupId = new 
TablePartitionId(table.tableId(), p);
+            for (int p = 0; p < table.internalTable().partitions(); p++) {
+                TablePartitionId replicationGroupId = new 
TablePartitionId(table.tableId(), p);
 
+                try {
                     raftMgr.stopRaftGroup(replicationGroupId);
+                } catch (Exception e) {
+                    LOG.info("Unable to stop the raft group [tableName={}, 
partition={}]", e, table.name(), p);

Review Comment:
   I would favor to log only one record "Unable to stop table [name={} id={}]" 
with partition specific details in suppress exceptions instead of spamming to 
the log.
   And in order to hide all that suppress related logic to some inner method 
let's consider adding 
   ```
       public static void runAll(Stream<? extends Runnable> runnables) throws 
Exception {
           AtomicReference<Exception> ex = new AtomicReference<>();
   
           runnables.filter(Objects::nonNull).forEach(runnable -> {
               try {
                   runnable.run();
               } catch (Exception e) {
                   if (!ex.compareAndSet(null, e)) {
                       ex.get().addSuppressed(e);
                   }
               }
           });
   
           if (ex.get() != null) {
               throw ex.get();
           }
       } 
   ```
   along with combining two streams for 
   `raftMgr.stopRaftGroup(replicationGroupId);` and 
`replicaMgr.stopReplica(replicationGroupId);`



-- 
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]

Reply via email to