-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-28465 Implementation of framework for time-based priority bucket-cache #5793
Conversation
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks good, I just think we need to add javadoc on public methods and explain properly when we will consider a file/block as cold/hot, specially when dealing with default tiering type.
long diff = currentTimestamp - maxTimestamp.getAsLong(); | ||
return diff <= hotDataAge; | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we return "true" by default? I.e., if not using DataTieringType.TIME_RANGE, this should consider all data as hot and let the LFU logic decide on the eviction right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic reaches that point only when the DataTieringType
is set to NONE
, indicating that data tiering is disabled. If data tiering is disabled, we should not consider that data as special by marking it as hot, correct? Instead, it should be considered as cold.
For example, if I set it to true, it means we are indicating that data is hot even when data tiering is disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, if I set it to true, it means we are indicating that data is hot even when data tiering is disabled.
Ok, I think there's a misunderstanding of concepts. Today, without this DataTiering thing, the behaviour is to cache everything and evict based on LFU (in other words, everything is hot). If I don't turn on DataTieringType.TIME_RANGE, I want things to keep working as today (cache everything and evict based on LFU). Maybe we can change the default name from NONE to ALL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with this implementation, it will function the same. For example, in eviction, we'll prioritize evicting the cold data files first, which are all the files that satisfy the condition (isDataTieringEnabled(file) && !isHotData(file)). Once I identify these files, I will proceed to evict them and then hand over control to the rest of the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I get your point. then we can eliminate isDataTieringEnabled methods, right? since we are considering everything as hot by default.
|
||
HStoreFile hStoreFile = getHStoreFile(hFilePath); | ||
if (hStoreFile == null) { | ||
throw new DataTieringException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than throwing exception, maybe just return false? I wonder if it would be possible that a compaction completed and moved the given file away just after we entered this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to throw the exception and let the caller decide what action to take based on the context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking in terms of responsibilities and cohesion. Who should know how to classify a block as hot or cold for a file that is not in the list of regions stores? Shouldn't this be done here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. should we change in other places as well?
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DataTieringManager.java
Show resolved
Hide resolved
|
||
try { | ||
Set<String> coldFilePaths = dataTieringManager.getColdDataFiles(allCachedBlocks); | ||
assertEquals(1, coldFilePaths.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should explain better why we only get 1 here, even though we say there are two non-hot files in the javadoc header.
Also, shouldn't we assert on the exact cold file, just to make sure our logic does mark the file we know is cold?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good idea. Maybe I write another test to stress on cold data
Sure, We'll add that. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
if (exception != null) { | ||
fail("Expected DataTieringException to be thrown"); | ||
} | ||
assertEquals(value, expectedResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: assertEquals(expectedResult, value);
if (exception != null) { | ||
fail("Expected DataTieringException to be thrown"); | ||
} | ||
assertEquals(value, expectedResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: assertEquals(expectedResult, value);
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
LTGM, can we just address latest spotless failure? |
That's because of the Javadoc in the |
🎊 +1 overall
This message was automatically generated. |
if (dataTieringType.equals(DataTieringType.TIME_RANGE)) { | ||
long hotDataAge = getDataTieringHotDataAge(configuration); | ||
|
||
HStoreFile hStoreFile = getHStoreFile(hFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getConfiguratin(hFilePath) already traverses through the regions to get to the HStore. We will do it again within getHStoreFile. We can slightly improve by avoiding duplicate traversal to get HStore.
One Option I can think is to getStore first.
HStore store = getStore(hFilePath); <= We traverse only once.
Then,
Configuration configuration = getConfiguration(store);
HStoreFile file = getHStoreFile(store);
With this, we only have regions traversal only once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it doesn't traverse through the regions. these are just map lookups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh ok, then it looks ok.
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@wchevreuil, it seems like most of the tests have passed, and any failures were due to flaky tests. |
…t-cache (#5793) Signed-off-by: Wellington Chevreuil <[email protected]>
…t-cache (#5793) Signed-off-by: Wellington Chevreuil <[email protected]>
…t-cache (#5793) Signed-off-by: Wellington Chevreuil <[email protected]>
…t-cache (#5793) Signed-off-by: Wellington Chevreuil <[email protected]>
…t-cache (apache#5793) Signed-off-by: Wellington Chevreuil <[email protected]>
…t-cache (#5793) Signed-off-by: Wellington Chevreuil <[email protected]>
…t-cache (apache#5793) Signed-off-by: Wellington Chevreuil <[email protected]> Change-Id: I22072f951ddfa8768e820952f63bbc2aa3cd5217
No description provided.