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-24456 : Create ImmutableScan and use it for CustomizedScanInfoBuilder #1818
Conversation
🎊 +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. |
🎊 +1 overall
This message was automatically generated. |
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java
Outdated
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java
Outdated
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java
Outdated
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java
Outdated
Show resolved
Hide resolved
@@ -164,7 +164,11 @@ public int getReplicaId() { | |||
* @param level IsolationLevel for this query | |||
*/ | |||
public Query setIsolationLevel(IsolationLevel level) { | |||
setAttribute(ISOLATION_LEVEL, level.toBytes()); | |||
if (this instanceof ImmutableScan) { |
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.
Why?
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.
Because while constructing ImmutableScan(Scan), it calls parent Scan(Scan), which calls super.setIsolationLevel() and here, it calls setAttribute() which is overridden by ImmutableScan and hence, it will fail. I know this is not good check, but we do need to directly call super.setAttribute()
, this.setAttribute()
goes to ImmutableScan's setAttribute()
.
if (cols != null && cols.size() > 0) { | ||
for (byte[] col : cols) { | ||
addColumn(fam, col); | ||
if (!(this instanceof ImmutableScan)) { |
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.
This is not a good practise... Cna we avoid this instanceof for testing a sub class in the parent class?
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 really tried for this but didn't find better solution. For any Immutable child class, it will have to call super constructor, and here in Scan constructor, it calls setter methods, so the control will go to child class's overridden setter methods, which will fail :(
🎊 +1 overall
This message was automatically generated. |
@Apache9 I found a way without updating |
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomizedScanInfoBuilder.java
Outdated
Show resolved
Hide resolved
💔 -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. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@Apache9 Please take a look when you get time. |
/** | ||
* Create Immutable instance of Scan | ||
*/ | ||
public ImmutableScan() { |
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.
When it is delegate model, better get the delegate via constructor arg always. Let the creator pass a new Scan() to this explicitly. Pls avoid this constructor.
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.
Sure, let me handle this.
* @throws IOException From parent constructor | ||
*/ | ||
public ImmutableScan(Scan scan) throws IOException { | ||
this.delegateScan = new Scan(scan); |
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.
As we are not exposing the original Scan directly, why to create a new Scan again here? No need
* | ||
* @param get Get to model Scan after | ||
*/ | ||
public ImmutableScan(Get get) { |
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.
As of now we dont have this constructor req right? If not better not add now. When there is a need, we can add. At the place where we create this ImmutableScan, already the Get would have been converted to scan
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@Apache9 @anoopsjohn I have done changes as per your latest suggestions. Please take a look. |
* @param scan Copy all values from Scan | ||
* @throws IOException From parent constructor | ||
*/ | ||
public ImmutableScan(Scan scan) throws IOException { |
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.
Now we dont have to keep this throws IOE at this constructor. So below catch stuff in CustomizedScanInfoBuilder also can be avoided.
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.
Ohh, what a miss :(
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
…uilder (#1818) Signed-off-by: Anoop Sam John <anoopsamjohn@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org>
…uilder (apache#1818) Signed-off-by: Anoop Sam John <anoopsamjohn@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org>
No description provided.