InitTablet should not update master alias on shard record#5316
InitTablet should not update master alias on shard record#5316deepthi merged 9 commits intovitessio:reparent-refactorfrom
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>
| 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.
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.
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.
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
| 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.
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>
NOTE: This PR is targeting the
reparent-refactorfeature branch, notmaster.Signed-off-by: deepthi deepthi@planetscale.com