-
Notifications
You must be signed in to change notification settings - Fork 188
*: rollback schema in the tracker; fix save table checkpoint in optimistic mode #625
Conversation
…ot supported now)
/run-all-tests |
@@ -438,6 +438,13 @@ func (p *Pessimist) handleInfoPut(ctx context.Context, infoCh <-chan pessimism.I | |||
lockID, synced, remain, err := p.lk.TrySync(info, p.taskSources(info.Task)) | |||
if err != nil { | |||
// TODO: add & update metrics. | |||
// FIXME: the following case is not supported automatically now, try to support it later. |
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.
"\"result\": true" 3 | ||
|
||
# NOTE: the lock may be locked for the next DDL, for details please see the following comments in `master/shardll/pessimist.go`, | ||
# `FIXME: the following case is not supported automatically now, try to support it later` |
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.
if point.rollback() { | ||
logger.Debug("try to rollback checkpoint", log.WrapStringerField("checkpoint", point)) | ||
from := point.MySQLLocation() | ||
if point.rollback(schemaTracker, schema) { |
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.
also see #629.
b.Lock() | ||
defer b.Unlock() | ||
b.location = b.flushedLocation | ||
if isSchemaChanged = b.ti != b.flushedTI; isSchemaChanged { | ||
b.location = b.flushedLocation.Clone() |
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.
also .Clone
.
/run-all-tests |
Codecov Report
@@ Coverage Diff @@
## master #625 +/- ##
================================================
+ Coverage 57.7114% 57.7381% +0.0266%
================================================
Files 202 202
Lines 20502 20496 -6
================================================
+ Hits 11832 11834 +2
+ Misses 7523 7516 -7
+ Partials 1147 1146 -1 |
@WangXiangUSTC @lichunzhu PTAL |
s.tctx.L().Info("save table checkpoint", zap.String("event", "query"), | ||
zap.String("schema", upSchema), zap.String("table", upTable), | ||
zap.Strings("ddls", needHandleDDLs), log.WrapStringerField("location", ec.currentLocation)) | ||
s.saveTablePoint(upSchema, upTable, ec.currentLocation.Clone()) |
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.
found a bug relative to #584.
|
||
log.L().Info("set FlushCheckpointStage", zap.String("failpoint", "FlushCheckpointStage"), zap.Int("stage", testInjector.flushCheckpointStage)) | ||
if testInjector.flushCheckpointStage == maxStage { | ||
testInjector.flushCheckpointStage = -1 // disable for following stages. |
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.
After set flushCheckpointStage
to -1, will flushCheckpointStage
increase to maxStage
later?
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.
No, So how about setting it to MaxInt?
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 understand it. I think -1 is just OK.
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.
Rest LGTM
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
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.
rest LGTM
syncer/checkpoint.go
Outdated
// if any of them are not equal, then we rollback them: | ||
// - set the one in the checkpoint but not flushed to the one flushed. | ||
// - set the one tracked to the one in the checkpoint by the caller of this method (both flushed and not flushed are the same now) | ||
if isSchemaChanged = trackedTi != b.ti || b.ti != b.flushedTI; isSchemaChanged { |
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.
how about adding some ()
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.
added in 846c6b5.
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
What problem does this PR solve?
fix #585.
What is changed and how it works?
rollback tracked schema when pausing/stopping.
Check List
Tests
Code changes
Side effects