xxubai commented on code in PR #3927:
URL: https://github.com/apache/amoro/pull/3927#discussion_r2981177176
##########
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:
Master-slave mode is not actually wired into `DefaultTableService`.
`AmoroServiceContainer` still constructs the service with the old 3-arg
constructor, so haContainer and bucketAssignStore stay null.
As a result, `use-master-slave-mode=true` enables part of the new logic, but
table loading/sync still falls back to the old path while `triggerTableAdded()`
stops creating in-memory runtimes.
This can leave newly created tables persisted but missing from
tableRuntimeMap, and later scans may repeatedly try to insert them again.
--
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]