petersomogyi commented on code in PR #8128:
URL: https://github.com/apache/hbase/pull/8128#discussion_r3161345788
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DataTieringManager.java:
##########
@@ -347,4 +387,29 @@ private static boolean
isDataTieringFeatureEnabled(Configuration conf) {
public static void resetForTestingOnly() {
instance = null;
}
+
+ public Map<String, Pair<List<String>, Long>> getRegionColdDataSize() {
+ return regionColdDataSize;
+ }
+
+ /**
+ * Updates regionColdData size for the region containing the passed
compactedFiles.
+ */
+ public void updateRegionColdDataSize(String encodedRegionName,
+ Collection<HStoreFile> compactedFiles, Collection<HStoreFile> newFiles) {
+ regionColdDataSize.computeIfPresent(encodedRegionName, (k, v) -> {
+ for (HStoreFile file : compactedFiles) {
+ if (v.getFirst().contains(file.getPath().getName())) {
+ v.getFirst().remove(file.getPath().getName());
+ v.setSecond(v.getSecond() -
Bytes.toLong(file.getMetadataValue(FILE_SIZE)));
+ }
+ }
+ for (HStoreFile file : newFiles) {
+ // call isHotData to account for the new file size in
regionColdDataSize, if the new file is
+ // considered cold data as per data-tiering logic.
+ isHotData(file.getFileInfo().getHFileInfo(),
file.getFileInfo().getConf());
Review Comment:
I checked this part with Claude and it gave this answer:
> No — this is a single-thread deadlock. That's what makes it especially
insidious.
>
> One thread does this:
>
> 1. Enters computeIfPresent(regionName, lambda) — acquires the internal
bin lock
> 2. Inside the lambda, calls isHotData(...)
> 3. isHotData calls compute(regionName, lambda2) — tries to acquire the
same bin lock
> 4. The lock is non-reentrant, so the same thread blocks waiting on itself
>
> It's not a classic two-thread deadlock — it's a single thread trying to
re-acquire a lock it already holds, on a lock that doesn't support reentrancy.
The thread hangs forever.
>
> This will happen every time a compaction produces a new cold file in a
region that already has cold data tracked. That's a normal steady-state
scenario, not a rare race condition.
--
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]