-
Notifications
You must be signed in to change notification settings - Fork 447
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
Adds FateOperation type #5218
base: main
Are you sure you want to change the base?
Adds FateOperation type #5218
Conversation
Adds `FateOperation` enum. This consolidates all fate operations under one type (those used in thrift and those passed directly to a Fate object (outside of thrift)). This avoids the use of String here. - Adds a `FateOperation` enum which includes all current fate operations - Renamed existing thrift type `FateOperation` to `TFateOperation` - `FateOperation` includes all `TFateOperation`s and fate operations performed outside of thrift (one example is `COMMIT_COMPACTION`) - `FateOperation` is now the type passed around instead of a String
Deleted OBSOLETE_TABLE_BULK_IMPORT from TFateOperation but forgot to rebuild the thrift files after
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.
Looks ok to me, but I'm not familiar with the serialization to have an opinion on the serialization changes that you made here.
TABLE_SPLIT, | ||
TABLE_TABLET_AVAILABILITY; | ||
|
||
public static FateOperation fromThrift(TFateOperation tFateOp) { |
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.
Not sure if you have a test for this or not, but it would be good to add one that verifies that every TFateOperation has a FateOperation value and vice-versa. This would help with identifying additions / deletions in future releases.
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.
They are not exactly the same. FateOperation has a few more types than TFateOperation. TFateOperation only includes the types used in thrift. Some operations are performed outside of thrift (for example see CompactionCoordinator.java).
Could probably still write some sort of test for this PR though.
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.
It might look a little redundant, but I wonder if FateOperation should be FateOperation(TFateOperation) with null
being an acceptable value. You could still write a test to ensure that all TFateOperations have an associated FateOperation.
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 agree a test would be good here, you could write something that iterates over TFateOperation values and verifies there's a matching value in FateOperation as @dlmarion mentioned. Because FateOperation is a super set this would catch any future additions to TFateOperation that were not properly added to FateOperation without having to change the test. There's probably not a good way to test the other way though.
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.
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 wonder if FateOperation should be FateOperation(TFateOperation) with null being an acceptable value
I think this is a good way to connect the two more explicitly. I added this and the test in 30e4753
@@ -58,7 +58,6 @@ enum FateOperation { | |||
TABLE_OFFLINE | |||
TABLE_MERGE | |||
TABLE_DELETE_RANGE | |||
OBSOLETE_TABLE_BULK_IMPORT |
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.
Was this BulkImportV1?
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 assume so, but not 100% sure. It is no longer used in the code, so it was safely removed.
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 think this was left here because thrift will send an integer corresponding to the enum over the wire for RPC calls. For example it will currently send 9 for TABLE_COMPACT. After this change it will send 8 for TABLE_COMPACT. Accumulo does not support RPC compatibility across major versions, however this change could cause misleading error message when using different versions of accumulo on each side of the RPC. Thrift supports specifying the integer directly in the IDL, we could leverage this to remove the enum and keep the integers stable.
enum FateOperation {
TABLE_CREATE = 0,
TABLE_CLONE = 1,
TABLE_DELETE = 2,
TABLE_RENAME = 3,
TABLE_ONLINE = 4,
TABLE_OFFLINE = 5,
TABLE_MERGE = 6,
TABLE_DELETE_RANGE = 7,
// 8 was bulk v1 that was removed
TABLE_COMPACT = 9,
TABLE_IMPORT = 10,
TABLE_EXPORT = 11,
TABLE_CANCEL_COMPACT = 12,
NAMESPACE_CREATE = 13,
NAMESPACE_DELETE = 14,
NAMESPACE_RENAME = 15,
TABLE_BULK_IMPORT2 = 16,
TABLE_TABLET_AVAILABILITY = 17,
TABLE_SPLIT = 18
}
Keeping the integers stable could make debugging usage of different version less confusing (it is not supported, but it happens).
After you mentioned this, I looked into my serialization changes again. I made these changes under the assumption that Strings are no longer used for any of the I'll revert these changes. |
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 generally looks pretty good to me but I am wondering if we should rename things from txName
to be something different like txOperation
. Now that the type is FateOperation
it might be more clear.
However, the schema still uses the old name of txname and inside the enum for TxInfo it's still called TX_NAME
as well so it would probably only be a good idea to change it if we renamed it everywhere to be consistent. Zookeeper specific code probably uses txname as well.
We don't have to rename it, but I figured I'd bring it up and it could also be a follow on too.
@cshannon - I considered the same and is what I was initially doing when first writing these changes (I think I was going with I also think it would be good to rename this. I can do that in a follow-on PR after this is merged in. |
@@ -58,7 +58,6 @@ enum FateOperation { | |||
TABLE_OFFLINE | |||
TABLE_MERGE | |||
TABLE_DELETE_RANGE | |||
OBSOLETE_TABLE_BULK_IMPORT |
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 think this was left here because thrift will send an integer corresponding to the enum over the wire for RPC calls. For example it will currently send 9 for TABLE_COMPACT. After this change it will send 8 for TABLE_COMPACT. Accumulo does not support RPC compatibility across major versions, however this change could cause misleading error message when using different versions of accumulo on each side of the RPC. Thrift supports specifying the integer directly in the IDL, we could leverage this to remove the enum and keep the integers stable.
enum FateOperation {
TABLE_CREATE = 0,
TABLE_CLONE = 1,
TABLE_DELETE = 2,
TABLE_RENAME = 3,
TABLE_ONLINE = 4,
TABLE_OFFLINE = 5,
TABLE_MERGE = 6,
TABLE_DELETE_RANGE = 7,
// 8 was bulk v1 that was removed
TABLE_COMPACT = 9,
TABLE_IMPORT = 10,
TABLE_EXPORT = 11,
TABLE_CANCEL_COMPACT = 12,
NAMESPACE_CREATE = 13,
NAMESPACE_DELETE = 14,
NAMESPACE_RENAME = 15,
TABLE_BULK_IMPORT2 = 16,
TABLE_TABLET_AVAILABILITY = 17,
TABLE_SPLIT = 18
}
Keeping the integers stable could make debugging usage of different version less confusing (it is not supported, but it happens).
Adds
FateOperation
enum. This consolidates all fate operations under one type (those used in thrift and those passed directly to a Fate object (outside of thrift)). This avoids the use of String here.FateOperation
enum which includes all current fate operationsFateOperation
toTFateOperation
FateOperation
includes allTFateOperation
s and fate operations performed outside of thrift (one example isCOMMIT_COMPACTION
)FateOperation
is now the type passed around instead of a StringI also verified that all FATE tests and all modified tests still pass and that sunny build passes
This is a prereq for #5130