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

rac2: indicate admitted updates from LogTracker #130200

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

pav-kv
Copy link
Collaborator

@pav-kv pav-kv commented Sep 5, 2024

This PR makes LogTracker return a bit indicating when the Admitted vector has changed. The admitted vector is considered "changed" when its leader term goes up (and the admitted indices either stay intact or regress), or the term stays intact but the admitted index at any priority goes up.

Part of #129508

@pav-kv pav-kv requested a review from a team as a code owner September 5, 2024 23:42
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, 3 of 3 files at r2, 2 of 2 files at r3.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @pav-kv)


pkg/kv/kvserver/kvflowcontrol/rac2/log_tracker.go line 195 at r1 (raw file):

	waiting := l.waiting[pri]
	// There is nothing to admit, or it's a stale admission.
	if len(waiting) == 0 || at.Index < waiting[0].Index {

Was the fact that it was only comparing the indices the bug?
Can you add a test to catch this.


pkg/kv/kvserver/kvflowcontrol/rac2/log_tracker.go line 184 at r2 (raw file):

	l.stable = stable.Index
	// The admitted index at a priority has advanced if its queue was empty or
	// leading the stable index by more than one.

An example would help the reader here.
Say stable index was 5 before this call.
Then if the marks[0].Index is 6 then we can't advance past 5 even is stable index advances to a higher value, say 7.
But if marks[0].Index is 7 or higher we can advance to marks[0].Index-1 which is > the stable index.


pkg/kv/kvserver/kvflowcontrol/rac2/log_tracker.go line 220 at r2 (raw file):

	}
	// At least one waiting entry can be admitted. The corresponding admitted
	// index is bumped iff the first entry in the queue was the "bottleneck".

Something like the following would help
// The minimum we could advance to prior to this call was waiting[0].Index-1. If that was < l.stable, we were being held back by this entry. So the condition can be stated as waitig[0].Index-1 < l.stable, or waiting[0].Index <= l.stable.

Copy link
Collaborator Author

@pav-kv pav-kv left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @sumeerbhola)


pkg/kv/kvserver/kvflowcontrol/rac2/log_tracker.go line 195 at r1 (raw file):

Previously, sumeerbhola wrote…

Was the fact that it was only comparing the indices the bug?
Can you add a test to catch this.

Done.


pkg/kv/kvserver/kvflowcontrol/rac2/log_tracker.go line 184 at r2 (raw file):

Previously, sumeerbhola wrote…

An example would help the reader here.
Say stable index was 5 before this call.
Then if the marks[0].Index is 6 then we can't advance past 5 even is stable index advances to a higher value, say 7.
But if marks[0].Index is 7 or higher we can advance to marks[0].Index-1 which is > the stable index.

Done.


pkg/kv/kvserver/kvflowcontrol/rac2/log_tracker.go line 220 at r2 (raw file):

Previously, sumeerbhola wrote…

Something like the following would help
// The minimum we could advance to prior to this call was waiting[0].Index-1. If that was < l.stable, we were being held back by this entry. So the condition can be stated as waitig[0].Index-1 < l.stable, or waiting[0].Index <= l.stable.

Done.

@pav-kv pav-kv force-pushed the admitted-changed-bit branch 2 times, most recently from 36fc50f to 6a680ac Compare September 6, 2024 02:47
Epic: none
Release note: none
@pav-kv
Copy link
Collaborator Author

pav-kv commented Sep 6, 2024

TFTR!

bors r=sumeerbhola

@craig craig bot merged commit 950a090 into cockroachdb:master Sep 6, 2024
20 checks passed
@pav-kv pav-kv deleted the admitted-changed-bit branch September 6, 2024 03:19
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.

3 participants