felixhzhu opened a new pull request, #4258:
URL: https://github.com/apache/amoro/pull/4258

   ## What changes were proposed in this pull request?
   
   Fix duplicate process ID generation caused by multiple independent 
`SnowflakeIdGenerator` 
   instances in the same AMS JVM.
   
   ### Root Cause
   
   Two separate static `SnowflakeIdGenerator` instances existed:
   - `IcebergTableUtil.snowflakeIdGenerator` (for optimizing process IDs)
   - `TableProcessMeta.idGenerator` (for maintenance process IDs)
   
   Both used default `machineId = 0` and maintained independent `sequence` 
counters. 
   When both entered the same 10ms time window, they generated identical IDs, 
causing 
   PRIMARY KEY conflicts in the `table_process` table.
   
   ### Fix
   
   Consolidate to a single global singleton `SnowflakeIdGenerator.INSTANCE`, 
ensuring 
   the `synchronized` lock and `sequence` counter work correctly across all 
callers.
   
   ## How was this patch tested?
   
   - Verified singleton generates unique IDs under concurrent access
   - Confirmed no regression in optimizing and maintenance process flows
   
   


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