Skip to content

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

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
erikgrinaker:loq-recovery-replicaid
Apr 27, 2022
Merged

kvserver/loqrecovery: persist new replica ID in RaftReplicaID#80470
craig[bot] merged 2 commits intocockroachdb:masterfrom
erikgrinaker:loq-recovery-replicaid

Conversation

@erikgrinaker
Copy link
Copy Markdown
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
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
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
@erikgrinaker erikgrinaker force-pushed the loq-recovery-replicaid branch from 0c98606 to 00e7fdf Compare April 27, 2022 08:33
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

bors r=aliher1911

@craig
Copy link
Copy Markdown
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