wardlican commented on code in PR #3927:
URL: https://github.com/apache/amoro/pull/3927#discussion_r2985416563


##########
amoro-ams/src/main/java/org/apache/amoro/server/table/DefaultTableService.java:
##########
@@ -87,19 +94,46 @@ public class DefaultTableService extends PersistentBase 
implements TableService
   private final Configurations serverConfiguration;
   private final CatalogManager catalogManager;
   private final TableRuntimeFactory tableRuntimeFactory;
+  private final HighAvailabilityContainer haContainer;
+  private final BucketAssignStore bucketAssignStore;
+  private final boolean isMasterSlaveMode;
   private RuntimeHandlerChain headHandler;
   private ExecutorService tableExplorerExecutors;
 
+  // Master-slave mode related fields
+  private ScheduledExecutorService bucketTableSyncScheduler;
+  private volatile List<String> assignedBucketIds = new ArrayList<>();
+  private final long bucketTableSyncInterval;
+  // Lock for bucketId assignment to prevent concurrent assignment conflicts
+  private final Object bucketIdAssignmentLock = new Object();
+  // Local cache of bucketId assignments to track pending assignments before 
they're saved to DB
+  // This ensures concurrent table creation gets different bucketIds even 
before DB is updated
+  private final Map<String, Integer> pendingBucketIdCounts = new 
ConcurrentHashMap<>();
+
   public DefaultTableService(
       Configurations configuration,
       CatalogManager catalogManager,
       TableRuntimeFactory tableRuntimeFactory) {
+    this(configuration, catalogManager, tableRuntimeFactory, null, null);

Review Comment:
   Okay, I will optimize the implementation here to prevent this issue.



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