-
Notifications
You must be signed in to change notification settings - Fork 454
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
Globally Unique FATE Transaction Ids - Part 1 #4191
Globally Unique FATE Transaction Ids - Part 1 #4191
Conversation
A WIP for apache#4044. The end goal is to have the stronger type FateId replace the current representation of a transaction id (which is just a long). This was brought about from the addition of the AccumuloStore class - there are now two fate instance types associated with a transaction - META (for ZooStore) or USER (for AccumuloStore). FateId is a new class which includes the FateInstanceType and the transaction id. Current changes: - FateTxId replaced with new class FateId - Started with changes in ReadOnlyFateStore and resolved the issues in other classes extending from changing this class. Still left TODO: - There are still related problems from the classes I have changed: I have not yet finished going down the entire chain of issues - Need to change Fate and the associated issues with changing this class - Need to change Repo and the associated issues with changing this class - More changes TBD
In ReadOnlyFateStore will need to change the following to
|
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.
These changes look good so far. Based on what you have done so far do you think it would be possible to break this work in multiple PRs?
@@ -82,7 +85,9 @@ protected Stream<FateIdStatus> getTransactions() { | |||
scanner.setRange(new Range()); | |||
TxColumnFamily.STATUS_COLUMN.fetch(scanner); | |||
return scanner.stream().onClose(scanner::close).map(e -> { | |||
return new FateIdStatus(parseTid(e.getKey().getRow().toString())) { | |||
FateId fateId = | |||
FateId.from("FATE:" + fateInstanceType + ":" + e.getKey().getRow().toString()); |
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.
Could have a FateId.from(FateInstanceType it, String hexId)
method and do the following
FateId.from("FATE:" + fateInstanceType + ":" + e.getKey().getRow().toString()); | |
FateId.from(fateInstanceType, e.getKey().getRow().toString()); |
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.
Yes, good suggestion
Ah okay. Yeah wasn't too sure exactly how I should go about changing this method. Will make suggested change. |
Yes, this is my thinking of how it could be broken up:
However, I'm not sure if this is the best way or if these PRs standalone would actually pass all the git checks/not break the project. Not sure how interlinked everything is. |
Will be deleted later on when it can be safely deleted (after all uses of FateTxId have been replaced by FateId)
* @return a new FateId object | ||
*/ | ||
public static FateId from(FateInstanceType type, String hexTid) { | ||
Pattern hexPattern = Pattern.compile("^[0-9a-fA-F]+$"); |
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 can be moved to a static private field so that we can cache the compiled pattern and avoid the expense of creating it each time. Java patterns are thread
- New fromThrift() method in FateId. - Fate now uses FateId and resolved issues stemming from these changes. - AdminUtil and Admin do not have FateId fully incorporated yet. Deferred for now. Marked "TODO DEFERRED - ISSUE 4044" in code. Need issue apache#4168 completed first. - Resolved all compile errors.
Update:
|
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.
These changes look good
|
||
String txName = (String) txStore.getTransactionInfo(Fate.TxInfo.TX_NAME); | ||
|
||
List<String> hlocks = heldLocks.remove(tid); | ||
// TODO DEFERRED - ISSUE 4044 |
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 have been using a more specific TODO in the elasticity branch, could use it here
// TODO DEFERRED - ISSUE 4044 | |
// ELASTICITY_TODO DEFERRED - ISSUE 4044 |
@@ -237,8 +236,8 @@ private void blockIfHadoopShutdown(long tid, Exception e) { | |||
} | |||
|
|||
private void transitionToFailed(FateTxStore<T> txStore, Exception e) { | |||
String tidStr = FateTxId.formatTid(txStore.getID()); | |||
final String msg = "Failed to execute Repo " + tidStr; | |||
FateId fateId = txStore.getID(); |
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.
Could inline this, it was only there to avoid duplicating the FateTxId.formatTid(...)
code.
- Inline statement in Fate - Changed comment about deferral in AdminUtil
PR for #4044. The end goal is to have the stronger type FateId replace the current representation of a transaction id (which is just a long). This was brought about from the addition of the AccumuloStore class - there are now two fate instance types associated with a transaction - META (for ZooStore) or USER (for AccumuloStore). FateId is a new class which includes the FateInstanceType and the transaction id.
TODO:
This PR is ready for review and potentially to be merged. Will need at least another PR for the rest of the changes.