Conversation
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
shlomi-noach
left a comment
There was a problem hiding this comment.
Please see comments/questions inline.
Overall everything here makes sense and seems like a pretty smooth integration; that is, it feels like the code changes belong here and play well with existing logic. Good work!
| AnalyzedInstanceKey InstanceKey | ||
| AnalyzedInstanceMasterKey InstanceKey | ||
| TabletType topodatapb.TabletType | ||
| MasterTimeStamp time.Time |
There was a problem hiding this comment.
What does this timestamp stand for?
There was a problem hiding this comment.
This was our first step towards a consensus protocol. Every newly elected master saves its timestamp. If the previous master did not get properly demoted (maybe it wasn't reachable), then we use the timestamp to resolve who the real master is.
I'm not happy that we currently rely on a timestamp because rogue clocks can mess things up. We should eventually move towards a system that doesn't depend on the clock.
| if !inst.IsBannedFromBeingCandidateReplica(replica) { | ||
| candidate = replica | ||
| } | ||
| } |
There was a problem hiding this comment.
a bit too much if-else-if-else. Can you please explain the logic in words?
There was a problem hiding this comment.
I've refactored this. LMK if the new code reads better.
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
| } | ||
| refreshTabletsUsing(func(instanceKey *inst.InstanceKey) { | ||
| _ = inst.InjectSeed(instanceKey) | ||
| }) |
There was a problem hiding this comment.
This should work well upon startup
| } | ||
|
|
||
| // RefreshTablets reloads the tablets from topo. | ||
| func RefreshTablets() { |
There was a problem hiding this comment.
What's the purpose/usage of this function?
There was a problem hiding this comment.
This is called from the main discovery loop. It polls for new/deleted tablets, and updates Orc accordingly.
There was a problem hiding this comment.
got it. Makes sense; one thing to note is that this causes a synchronous topology read on all tablets. Possibly this isn't what you wanted? Consider calling DiscoverInstance() instead, which will queue the instance for discovery, and avoid double-probing it within a pre configured timeslice.
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
| func RefreshTablets() { | ||
| refreshTabletsUsing(func(instanceKey *inst.InstanceKey) { | ||
| _, _ = inst.ReadTopologyInstance(instanceKey) | ||
| DiscoverInstance(*instanceKey) |
There was a problem hiding this comment.
🤞 let's see how this goes!
harshit-gangal
left a comment
There was a problem hiding this comment.
Code walkthrough and getting all the TODOs makes code read better.
This is a POC/MVP of some sort where Orchestrator runs as a vitess component. Features of this PR are described in #6612.
This is not production ready yet, but people can start playing with it. The code mostly works, but there are lots of TODOs, and tests have to be written.
This version does not handle semi-sync settings correctly.
High level
vitess_tablettable, and uses them as the authoritative source of mysql instances. For example, if a tablet record is deleted, the mysql instance is forgotten.vitess_tablettable and left joins on database_instance.Details
cluster_alias_overrideis not used because vitess is the authority here.SuggestedClusterAliasas the authoritative source. We'll need to eventually change this toClusterName. But there are places where the cluster name is inferred from the instance key.ChangeMasterToalways sets the credentials, with deprecatesChangeMasterCredentials.inst.BeginDowntimeof the dead master. In the case of vitess, we should wire it back to the cluster when it comes back up. But this downtime was preventing it.LockShardis sprayed in a few places, but it's not watertight yet.ChangeType(MASTER)on the tablet. If anything fails after this, this master status is used to authoritatively finish anything that was incomplete.MasterHasMasterhas been created, which is evaluated based on whether the tablet record is the master.electNewMasterfunction has been added to elect a brand new master if no previous master existed. This replaces the vitessInitShardMaster.