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

feat(server): add debug information about running transactions #820

Merged
merged 1 commit into from
Feb 19, 2023

Conversation

romange
Copy link
Collaborator

@romange romange commented Feb 19, 2023

Specifically, provide a total length over all shards of pending txs. Also, provide number of "free" transactions pending in the queue - those that could progress immediately but do not because they are not first in the queue.

@romange romange requested a review from dranikpg February 19, 2023 13:21
Transaction* trx = std::get<Transaction*>(value);

IntentLock::Mode mode = trx->Mode();
KeyLockArgs lock_args = trx->GetLockArgs(sid);
Copy link
Contributor

Choose a reason for hiding this comment

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

GetLockArgs() returns the lock args for the current command. For a multi tx the current command is only the command that is currently executing.

So I guess a possible flow for multi commands is:

tx->StartMulti(all_keys); // this is where schedule happens

tx->SwitchMultiCmd();
tx->InitByArgs(ars_with_one_key); // but it was scheduled on a lot of keys

// inside cmd
tx->ScheduleSingleHop(); // thats where its blocked, and thats where you look at it, but its has data only for cmd

With LOCK_AHEAD mode, the only place this locking information is stored is inside MultiData. So you need one more helper function - scheduled keys - that'll return this info for multi and plain shard args for regular commands

dranikpg
dranikpg previously approved these changes Feb 19, 2023
Specifically, provide a total length over all shards of pending txs.
Also, provide number of "free" transactions pending in the queue -
those that could progress immediately but do not because
they are not first in the queue.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
@romange romange merged commit dd952c3 into main Feb 19, 2023
@romange romange deleted the EstimateTxLength branch February 19, 2023 19:20
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.

2 participants