Skip to content
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

ACCUMULO-4629 Add table option to fail when deletes seen. #598

Merged
merged 2 commits into from Aug 17, 2018

Conversation

keith-turner
Copy link
Contributor

This experimental option allows for tables that do not use
deletes to have fast seeks within the timestamp range.

+ " Valid actions are PROCESS and FAIL with PROCESS being the default. When set to "
+ "PROCESS, deletes will supress data. When set to FAIL, any deletes seen will cause an"
+ " exception. The purpose of FAIL is to support tables that never delete data and need "
+ "fast seeks within the timestamp range of a column."),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, should make the values lowercase like TABLE_FILE_COMPRESSION_TYPE... "Possible values: zstd, gz, snappy, lzo, none". I don't think we have any uppercase property values...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could make it case-insensitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is case insensitive. It calls toUpperCase when parsing it.

}
};
default:
throw new IllegalArgumentException("Unknown behavior " + behavior);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be an AssertionError instead of IllegalArgumentException, since this class is responsible for defining what Behaviors are available, it's clearly programmer error on our part if we fail to handle one... rather than an API constraint imposed on the caller. It doesn't matter that much, but sometimes I think it's helpful to treat errors differently than exceptions.

try {
scanner.forEach(e -> {});
Assert.fail();
} catch (RuntimeException e) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful to put a comment in the catch block to explain why it is expected. Also, a comment to the appropriate fail() param is helpful too, if a regression occurs.

I don't suppose we can get any more specific regarding the RTE type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code throws a RTE.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yuck.

DeletingIterator delIter = new DeletingIterator(source, false);
byte[] defaultVisibility, AccumuloConfiguration conf) throws IOException {
SortedKeyValueIterator<Key,Value> delIter = DeletingIterator.wrap(source, false,
DeletingIterator.getBehavior(conf));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a sanity check: is "conf" coming from the table configuration everywhere setupSystemScanIterators is called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so.

}
}

public static Behavior getBehavior(AccumuloConfiguration conf) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected this to appear on the ConfigurationTypeHelper class, with the other static methods that do the same kinds of thing. Putting it here makes sense in this case... but we might want to genericize this pattern of "enum" types with case-conversion and valueOf() lookup for generic enums there, and then this method's implementation becomes something like: return ConfigurationTypeHelper.getEnum(Property.TABLE_DELETE_BEHAVIOR, Behavior.class); or similar.

@@ -114,7 +116,8 @@
+ " strategy, not the old one. (Most commonly, this will be because you have"
+ " moved key material from one spot to another.) If you want to override"
+ " the recorded key strategy with the one in the configuration file, set"
+ " this property to true."),
+ " this property to true. When setting this to fail, also consider"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's in the wrong spot

This experimental option allows for tables that do not use
deletes to have fast seeks within the timestamp range.
@keith-turner keith-turner merged commit 72064e5 into apache:master Aug 17, 2018
@keith-turner keith-turner deleted the del-behavior branch August 17, 2018 20:12
@keith-turner keith-turner added v2.0.0 enhancement This issue describes a new feature, improvement, or optimization. labels Aug 17, 2018
@ctubbsii ctubbsii added this to Done in 2.0.0 Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue describes a new feature, improvement, or optimization.
Projects
No open projects
2.0.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants