terrytlu opened a new pull request, #8534:
URL: https://github.com/apache/hbase/pull/8534

   When truncate_preserve is executed on a table with overlapping regions 
(multiple regions sharing the same startKey), the procedure gets stuck 
indefinitely. During truncate, regions are cleaned and recreated at the same 
timestamp, producing regions with identical encodedNames (derived from 
tableName + startKey + regionId(timestamp)). The duplicate encodedNames cause 
race conditions in subsequent procedure steps (e.g. 
TRUNCATE_TABLE_CREATE_FS_LAYOUT or
   REGION_STATE_TRANSITION_CONFIRM_OPENED), and recovery requires manual 
metadata repair with HBCK2.
   
   Region overlaps are unavoidable in production (they can result from 
interrupted split operations). Instead of proceeding into an unrecoverable 
stuck state, this change adds a pre-check in the TRUNCATE_TABLE_PRE_OPERATION 
state: when preserveSplits=true, TruncateTableProcedure now detects duplicate 
startKey regions via checkRegionsStartKeyNoDuplicate() and fails the truncate 
with a clear HBaseIOException message, telling the operator to fix the region 
overlap first.
   
   Tests added in TestTruncateTableProcedure cover preserveSplits=true failing 
on duplicate/overlapping regions, and preserveSplits=false still succeeding 
(single new region, no encodedName collision).


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