-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
wtclient: add DeactivateTower and TerminateSession commands #8239
wtclient: add DeactivateTower and TerminateSession commands #8239
Conversation
1e7955d
to
4e2811f
Compare
4e2811f
to
d20b640
Compare
note to self to add a commit here which ensures that a tower is loaded as an active tower even if all the sessions we have for the tower are exhausted. |
@bitromortac: review reminder |
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.
Very nice! Many users will be very happy about these changes 🎉
As always, super nice commit structure and great unit test coverage! I wonder if we have any existing integration test cases around towers that we could add these new RPC calls 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.
Looks really great on first pass, awesome work 🚀! Will need to do a second pass to internalize the session/tower state changes better, might be useful to have documentation on that in some place.
d20b640
to
2ff3979
Compare
Important Auto Review SkippedAuto reviews are limited to the following labels: llm-review. Please add one of these labels to enable auto reviews. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
57e8fac
to
ed8f4da
Compare
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.
Thanks for the reviews @bitromortac & @guggero 🚀
I've updated accordingly and also added an itest as was suggested.
Will re-request once the CI is green
ed8f4da
to
242bc17
Compare
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.
Amazing work, LGTM 🎉
242bc17
to
9fd9bd2
Compare
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 is really close and very cool itest updates 🔥, I've got some final small questions.
This commit updates the DeleteCommittedUpdate DB method to delete all of a given session's committed updates instead of just one at a time. The reason for this is that in an upcoming commit, we will introduce a "Terminal" session state - once we have deleted a committed update for a session it should be considered "Terminal" and there is never a case where we would only want to delete one committed update and not the rest. So we want these two actions (deleting committed updates of a session and setting it's status to terminal) to be atomic.
This is added as a TLV record meaning that all the towers currently on disk that don't have this new field will be seen as Active.
And then only load active towers on client start up.
This new method sets the tower's status to inactive so that it is not loaded at startup as a candidate tower. We also ensure that a tower's status is set to active if the CreateTower is called when the tower already exists.
9fd9bd2
to
f16190c
Compare
This commit adds the DeactiateTower method to the wtclient.ClientManager interface along with its implementation. A test is also added for the new method.
Since we will now change this to mean that the session should not ever be activated again.
In this commit, we adjust the DeleteCommitmentUpdate method so that it marks a session as Terminal (if there are updates to delete) since once we have deleted a commitment update from a session - the session is no longer useable.
Load an active tower into memory regardless of whether or not it has any sessions.
This will be used in the itest added in an upcoming commit so that we can test the TerminateSession command.
f16190c
to
a3ccae9
Compare
Thanks @bitromortac 🙏 I think I've addressed all your comments |
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 🎉 awesome work!
The Issues
This PR addresses 2 main issues that exist today:
The Solutions:
Status
to a persistedTower
along with aDeactivateTower
method and command that a user can use. If a tower's status is "Inactive" then it wont be loaded on start-up and neither will any of its sessions.Side Effects:
Changing the session "Inactive" status to mean "terminal" means that any session currently in the "inactive" state will never be "active" again. I argue that this is ok since: 1) the session would only have been in the "inactive" state if a user manually requested "RemoveTower" for the corresponding tower meaning they were probably having issues with that tower anyways. 2) All tower clients are still altruistic meaning that this will not mean that they paid for sessions that they can no longer use.
Fixes: #8221 (step 2)
Fixes: #7949
Fixes: #6397
Replaces: #7545