Skip to content

Added FaTE TStatus.SUBMITTED#2462

Merged
dlmarion merged 5 commits into
apache:mainfrom
dlmarion:fate_submitted_status
Feb 4, 2022
Merged

Added FaTE TStatus.SUBMITTED#2462
dlmarion merged 5 commits into
apache:mainfrom
dlmarion:fate_submitted_status

Conversation

@dlmarion

@dlmarion dlmarion commented Feb 3, 2022

Copy link
Copy Markdown
Contributor

When a FaTE transaction is created in the Manager its status is set
to IN_PROGRESS even though it's not actually running, it could be
waiting to run. The output from the fate print command will show
that the newly created transaction is IN_PROGRESS and could be
confusing to users. This change introduces the SUBMITTED state, which
is the state of the transaction after it has been created but before
it is executed.

When a FaTE transaction is created in the Manager its status is set
to IN_PROGRESS even though it's not actually running, it could be
waiting to run. The output from the `fate print` command will show
that the newly created transaction is IN_PROGRESS and could be
confusing to users. This change introduces the SUBMITTED state, which
is the state of the transaction after it has been created but before
it is executed.
@dlmarion dlmarion self-assigned this Feb 3, 2022

@ctubbsii ctubbsii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not really sure I understand the difference between the NEW state that already exists and your new SUBMITTED state.

Comment thread core/src/main/java/org/apache/accumulo/fate/Fate.java Outdated
Comment thread core/src/main/java/org/apache/accumulo/fate/ReadOnlyTStore.java Outdated
Comment thread core/src/main/java/org/apache/accumulo/fate/ZooStore.java Outdated
Comment thread test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java Outdated
Comment thread test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java Outdated
Comment thread test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java Outdated
Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
@dlmarion

dlmarion commented Feb 3, 2022

Copy link
Copy Markdown
Contributor Author

I'm not really sure I understand the difference between the NEW state that already exists and your new SUBMITTED state.

Prior to this change, when Fate.startTransaction was called to allocate a transaction id its state would be NEW. Then, when Fate.seedTransaction() was called to associate the Repo with the transaction id, the state would be changed to IN_PROGRESS. Fate.startTransaction would just serialize the Repo into ZooKeeper, it didn't actually run it.

With this change, there is an intermediate state (SUBMITTED).

Here's an excerpt from FateIT:

      long txid = fate.startTransaction();
      assertEquals(TStatus.NEW, getTxStatus(zk, txid));
      fate.seedTransaction(txid, new TestOperation(NS, TID), true);
      assertEquals(TStatus.SUBMITTED, getTxStatus(zk, txid));

@dlmarion dlmarion requested a review from ctubbsii February 3, 2022 20:38
@EdColeman

Copy link
Copy Markdown
Contributor

I took a quick look and confirmed that the metrics look okay - the TX state is added to the expected states.

Comment thread core/src/main/java/org/apache/accumulo/fate/AgeOffStore.java Outdated
Comment thread test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java Outdated
@ctubbsii ctubbsii dismissed their stale review February 3, 2022 22:00

No requested changes. Just a comment remaining.

@milleruntime

Copy link
Copy Markdown
Contributor

I just had a thought for an alternative approach. I am not sure if it is a better solution to adding the SUBMITTED state though. Would it be easier to change the code to set the state to NEW when the transaction is seeded? We know the transaction is new because it will have an ID so I am just wondering if we need an additional state.

@dlmarion

dlmarion commented Feb 4, 2022

Copy link
Copy Markdown
Contributor Author

So, currently the NEW fate transactions are aged off. If we moved NEW to mean SUBMITTED, then we would need another state to still exist so that they could be aged off. At that point, we're at the same place.

@milleruntime

Copy link
Copy Markdown
Contributor

So, currently the NEW fate transactions are aged off. If we moved NEW to mean SUBMITTED, then we would need another state to still exist so that they could be aged off. At that point, we're at the same place.

I was thinking to not store the TxD in ZK. It doesn't look like we are really doing anything between the creation and seeding.

@dlmarion

dlmarion commented Feb 4, 2022

Copy link
Copy Markdown
Contributor Author

I was thinking to not store the TxD in ZK. It doesn't look like we are really doing anything between the creation and seeding.

I'm not sure of the side effects of that approach, if any. Will need someone else with more FaTE knowledge to chime in.

@milleruntime

Copy link
Copy Markdown
Contributor

I was thinking to not store the TxD in ZK. It doesn't look like we are really doing anything between the creation and seeding.

I'm not sure of the side effects of that approach, if any. Will need someone else with more FaTE knowledge to chime in.

Yeah, I am not sure either. One side effect, which I think would be a good one, would be less TxIDs created in ZK. Currently the call to create the TxID is technically repeatable but it will create a lot of extra TxIDs in ZK and extra calls to ZK to age them off. The TxID is just a random number so its not like we are tracking it for other purposes, like we do with TableId.

@ctubbsii

ctubbsii commented Feb 4, 2022

Copy link
Copy Markdown
Member

The TxID is just a random number so its not like we are tracking it for other purposes, like we do with TableId.

Isn't storing it in ZK guaranteeing it's unique, though?

@milleruntime

Copy link
Copy Markdown
Contributor

The TxID is just a random number so its not like we are tracking it for other purposes, like we do with TableId.

Isn't storing it in ZK guaranteeing it's unique, though?

Yes

@dlmarion

dlmarion commented Feb 4, 2022

Copy link
Copy Markdown
Contributor Author

@milleruntime - are you good with this approach then considering the discussion?

@milleruntime

Copy link
Copy Markdown
Contributor

@milleruntime - are you good with this approach then considering the discussion?

Yeah I think this approach is fine. I wanted to look through the code closer but if its holding you up, feel free to merge.

store.setProperty(tid, DEBUG_PROP, repo.getDescription());

store.setStatus(tid, TStatus.IN_PROGRESS);
store.setStatus(tid, TStatus.SUBMITTED);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think there are some OPs that do work in the isReady() function so I wonder if changing when it gets set to IN_PROGRESS will affect them. I will see if I can find one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The BulkImport and Compact operations do things in the isReady() function. I don't know if it matters if the status is IN_PROGRESS or SUBMITTED though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also the ShutdownTServer operation

@milleruntime milleruntime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I can tell, moving the setting of the status, shouldn't affect the business logic in the operations. But we should probably do something about the operations that are doing stuff in the isReady() method since we can't assume this method is just checking things. It looks like the worst offenders are: BulkImport, Compact and the ShutdownTServer operations

@milleruntime

Copy link
Copy Markdown
Contributor

I created a follow on: #2466

@dlmarion dlmarion merged commit a80cf36 into apache:main Feb 4, 2022
@dlmarion dlmarion deleted the fate_submitted_status branch February 4, 2022 18:13
@ctubbsii ctubbsii added this to the 2.1.0 milestone Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants