Skip to content

Commit a292d24

Browse files
committed
add checkpoint file
1 parent 713ce97 commit a292d24

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

go/logic/checkpoint.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package logic
2+
3+
import (
4+
"github.com/github/gh-ost/go/mysql"
5+
"github.com/github/gh-ost/go/sql"
6+
"time"
7+
)
8+
9+
// Checkpoint holds state necessary to resume a migration.
10+
type Checkpoint struct {
11+
Id int64
12+
Timestamp time.Time
13+
LastTrxCoords mysql.BinlogCoordinates
14+
IterationRangeMin *sql.ColumnValues
15+
IterationRangeMax *sql.ColumnValues
16+
Iteration int64
17+
}

go/logic/migrator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,7 @@ func (this *Migrator) onApplyEventStruct(eventStruct *applyEventStruct) error {
13941394
}
13951395

13961396
func (this *Migrator) Checkpoint(ctx context.Context) (*Checkpoint, error) {
1397+
// TODO: doesn't work if no DML events come in
13971398
coords := this.eventsStreamer.GetCurrentBinlogCoordinates()
13981399
this.applier.LastIterationRangeMutex.Lock()
13991400
if this.applier.LastIterationRangeMaxValues == nil || this.applier.LastIterationRangeMinValues == nil {

0 commit comments

Comments
 (0)