-
Notifications
You must be signed in to change notification settings - Fork 462
Make several TableOpsImpl methods atomic #5540
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
base: main
Are you sure you want to change the base?
Make several TableOpsImpl methods atomic #5540
Conversation
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
Outdated
Show resolved
Hide resolved
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.
LGTM, code is also quite a bit more succinct now
} | ||
|
||
@Override | ||
public void clearSamplerConfiguration(String tableName) | ||
throws AccumuloException, TableNotFoundException, AccumuloSecurityException { | ||
throws AccumuloException, AccumuloSecurityException { |
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 would this no longer throw TableNotFoundException? That seems odd.
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.
Nothing in this method throws TableNotFoundException
anymore I guess. In the old code, clearSamplerOptions()
threw it when it called getProperties()
but all of that has been replaced with the modifyProperties()
block which does not throw TableNotFoundException
.
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 would expect modifyProperties to throw TableNotFoundException. At least, some error should happen if the table doesn't exist... I'm not sure what error that is. But, I think this PR should wait until we figure that out, because this changes the behavior, and we shouldn't change the API behavior for the case when the table doesn't exist.
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.
So it turns out some of the TableOps methods wrap TableNotFoundException in AccumuloException. Created #5595 to add a bit of clarity for those methods. I am not sure why some methods do this. It seems like it would be better to just throw it directly (might avoid confusion like this scenario).
Anyways, I dont think this is a blocker for this PR.
@ctubbsii I added a new helper 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.
The strategy to re-throw a TNFE by unwrapping the exception wrapped in modifyProperties is okay, but the implementation is not working as intended, since you're looking up the table ID. After that is fixed, this could probably be merged.
However, this is still just a hack, because modifyProperties doesn't throw TNFE when it should. A possible better solution is to deprecate it, and create a replacement method, mutateProperties that has the correct exception throwing behavior. So, instead of adding more unwrapping... you remove some of the existing wrapping that is happening in the first place. This would actually go well with the parameter name, which is "mapMutator", which works better with a method named "mutate" rather than "modify".
The problem with creating a new method is that we tend to avoid doing that in bugfix releases, because it violates semver. However, the spirit of semver is to avoid breaking user code. Although this would add a new method, I think that the only code that would break is subclasses, but nobody else is likely to be subclassing the TableOperations interface. So, maybe it is tolerable to add this in a bugfix? If not, your strategy is fine for 2.1 We can fix it the way I'm suggesting in 4.0, and add a deprecation to the old method in a 3.1.
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Christopher Tubbs <[email protected]>
Yea, definitely a hack and should just exist temporarily until we properly fix things.
Right now the changes in this PR are made against 4.0. Are you suggesting that we make these changes against 2.1 too? |
Fixes #5494
This PR replaces places were multiple calls to set or remove properties were being done with a single modify properties block to make things atomic. The affected methods are: