Skip to content

tm revamp: remove calls to refreshTablet#6263

Merged
sougou merged 6 commits intovitessio:masterfrom
planetscale:ss-tm-norefresh
Jun 10, 2020
Merged

tm revamp: remove calls to refreshTablet#6263
sougou merged 6 commits intovitessio:masterfrom
planetscale:ss-tm-norefresh

Conversation

@sougou
Copy link
Copy Markdown
Contributor

@sougou sougou commented Jun 3, 2020

Most calls to refreshTablet have been replaced by updateState. This reverses the order in which the tablet record is updated. In the new scenario, we update the internal state of tabletmanager first, and then update the tablet record. If the update fails, we start a thread that keeps retrying until the update succeeds.

This change also removes most calls to UpdateTabletFields. These are places that used to update the tablet record and then invoke refreshTablet.

The rest of the code that reacts to change, like changeCallback, are still unchanged. We'll clean them up in subsequent PRs.

@sougou sougou requested review from deepthi and enisoc June 3, 2020 03:39
@sougou sougou force-pushed the ss-tm-norefresh branch from e11a4eb to fd187f1 Compare June 6, 2020 02:24
sougou added 5 commits June 5, 2020 19:49
Calls to topo.UpdateTabletFields is mostly confined to within
the tabletmanager. The few left-overs are for tests and utils.
There are still the old-style vtctl commands that can update
the tablet record. For now, I've marked them as deprecated.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
This change removes refreshTablet from startup functions.
Also, InitTablet has been changed to only update the topo.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
All internal usage of refreshTablet has been replaced with
updateState, which eventually calls publishState.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Sometimes updateState may fail due to context expired. Change
the logic to retry immediately with batchCtx if the original
attempt failed with the request ctx.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
@sougou sougou force-pushed the ss-tm-norefresh branch from fd187f1 to 5ea4b4d Compare June 6, 2020 02:49
_isBackupRunning bool

pubMu sync.Mutex
// _tablet has the Tablet record we last read from the topology server.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

comment should match field name.

// tablet's timestamp is ahead of the topo's timestamp.
agent.setMasterTermStartTime(agentMasterTermStartTime)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need an else part for non-master types (to set the MasterTermStartTime to 0/nil).

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Copy link
Copy Markdown
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

LGTM

@sougou sougou merged commit 2036988 into vitessio:master Jun 10, 2020
@sougou sougou deleted the ss-tm-norefresh branch June 10, 2020 01:15
@deepthi deepthi added this to the v7.0 milestone Jul 17, 2020
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.

2 participants