-
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
InitTablet should not update master alias on shard record #5316
InitTablet should not update master alias on shard record #5316
Conversation
…update shard master Signed-off-by: deepthi <deepthi@planetscale.com>
…arting with InitTablet Signed-off-by: deepthi <deepthi@planetscale.com>
applicable conditions vttablet InitTablet should check MasterTermStartTime and take over if necessary fix unit test setup to work with changes to InitTablet functions Signed-off-by: deepthi <deepthi@planetscale.com>
2a2e630
to
67d2921
Compare
…n-zero Signed-off-by: deepthi <deepthi@planetscale.com>
@@ -155,7 +184,8 @@ func TestInitMasterShardChecks(t *testing.T) { | |||
// (master2 needs to run InitTablet with -force, as it is the second | |||
// master in the same shard) | |||
master2 := NewFakeTablet(t, wr, "cell1", 1, topodatapb.TabletType_MASTER, db, ForceInitTablet()) | |||
if err := wr.InitShardMaster(ctx, master2.Tablet.Keyspace, master2.Tablet.Shard, master2.Tablet.Alias, false /*force*/, 10*time.Second); err == nil || !strings.Contains(err.Error(), "is not the only master in the shard") { | |||
|
|||
if err := wr.InitShardMaster(ctx, master2.Tablet.Keyspace, master2.Tablet.Shard, master2.Tablet.Alias, false /*force*/, 10*time.Second); err == nil || !strings.Contains(err.Error(), "is not the shard master") { |
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.
Why did this error change just now? I would have thought this test would have broken back when we made false masters demote themselves.
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.
ShardSync doesn't run until we start the tablet. So this test didn't change when that was implemented.
Now that we have changed InitTablet to not set MasterAlias on the shard, that value is nil, so the error has changed.
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.
I'm still worried this test is now no longer testing what it was meant to (detecting 2 masters in ISM). I think to keep the test an accurate simulation of 2 masters, we'd need to force the shard record to match one of the masters so ISM reaches the code that checks for 2 masters.
With that said, it may not be worth the effort to truly fix this test because 2 masters should not happen anymore anyway, and before long we want to do a whole overhaul of ISM. WDYT?
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
09e9f8b
to
f2b8269
Compare
@@ -155,7 +184,8 @@ func TestInitMasterShardChecks(t *testing.T) { | |||
// (master2 needs to run InitTablet with -force, as it is the second | |||
// master in the same shard) | |||
master2 := NewFakeTablet(t, wr, "cell1", 1, topodatapb.TabletType_MASTER, db, ForceInitTablet()) | |||
if err := wr.InitShardMaster(ctx, master2.Tablet.Keyspace, master2.Tablet.Shard, master2.Tablet.Alias, false /*force*/, 10*time.Second); err == nil || !strings.Contains(err.Error(), "is not the only master in the shard") { | |||
|
|||
if err := wr.InitShardMaster(ctx, master2.Tablet.Keyspace, master2.Tablet.Shard, master2.Tablet.Alias, false /*force*/, 10*time.Second); err == nil || !strings.Contains(err.Error(), "is not the shard master") { |
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.
I'm still worried this test is now no longer testing what it was meant to (detecting 2 masters in ISM). I think to keep the test an accurate simulation of 2 masters, we'd need to force the shard record to match one of the masters so ISM reaches the code that checks for 2 masters.
With that said, it may not be worth the effort to truly fix this test because 2 masters should not happen anymore anyway, and before long we want to do a whole overhaul of ISM. WDYT?
…that new tablet is returned only if there is no error Signed-off-by: deepthi <deepthi@planetscale.com>
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
NOTE: This PR is targeting the
reparent-refactor
feature branch, notmaster
.Signed-off-by: deepthi deepthi@planetscale.com