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

kvserver/loqrecovery: persist new replica ID in RaftReplicaID #80470

Merged
merged 2 commits into from
Apr 27, 2022

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Apr 25, 2022

I'm not certain that this is the cause of #75133 (wasn't able to reproduce), but it seems plausible. I think it's something that we'd need to fix anyway, but I'm not familiar with all of the nuance here, so I'd appreciate careful reviews.

For reference, this was introduced in #75761.


cli: persist new replica ID in unsafe-remove-dead-replicas

The recently introduced local RaftReplicaIDKey was not updated when
unsafe-remove-dead-replicas changed the replica's ID. This could lead
to assertion failures.

Touches #75133.
Touches #79074.

Release note: None

kvserver/loqrecovery: persist new replica ID in RaftReplicaID

The recently introduced local RaftReplicaIDKey was not updated when
loss of quorum recovery changed the replica's ID. This could lead to
assertion failures.

Release note: None

The recently introduced local `RaftReplicaIDKey` was not updated when
`unsafe-remove-dead-replicas` changed the replica's ID. This could lead
to assertion failures.

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@aliher1911 aliher1911 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! 0 of 0 LGTMs obtained (waiting on @erikgrinaker, @sumeerbhola, and @tbg)


pkg/kv/kvserver/loqrecovery/recovery_env_test.go line 219 at r2 (raw file):

		if err := sl.SetHardState(ctx, eng, hardState); err != nil {
			t.Fatalf("failed to save raft hard state: %v", err)
		}

We need to add:

	if err := sl.SetRaftReplicaID(ctx, eng, localReplicaID); err != nil {
		t.Fatalf("failed to set raft replica ID: %v", err)
	}

so that we could have initial store in line with expectations and not have replicaID = 0 for unchanged replicas.
We can return that value from buildReplicaDescriptorFromTestData where all data is prepared based on test structs.

@tbg tbg removed their request for review April 27, 2022 05:47
The recently introduced local `RaftReplicaIDKey` was not updated when
loss of quorum recovery changed the replica's ID. This could lead to
assertion failures.

Release note: None
Copy link
Contributor Author

@erikgrinaker erikgrinaker 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! 0 of 0 LGTMs obtained (waiting on @aliher1911 and @sumeerbhola)


pkg/kv/kvserver/loqrecovery/recovery_env_test.go line 219 at r2 (raw file):

Previously, aliher1911 (Oleg) wrote…

We need to add:

	if err := sl.SetRaftReplicaID(ctx, eng, localReplicaID); err != nil {
		t.Fatalf("failed to set raft replica ID: %v", err)
	}

so that we could have initial store in line with expectations and not have replicaID = 0 for unchanged replicas.
We can return that value from buildReplicaDescriptorFromTestData where all data is prepared based on test structs.

Good call, done.

Copy link
Contributor

@aliher1911 aliher1911 left a comment

Choose a reason for hiding this comment

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

🕺 🎉

@erikgrinaker
Copy link
Contributor Author

bors r=aliher1911

@craig
Copy link
Contributor

craig bot commented Apr 27, 2022

Build succeeded:

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