@@ -1901,10 +1901,6 @@ func (mgtr *Migrator) onApplyEventStruct(eventStruct *applyEventStruct) error {
19011901// It gets the binlog coordinates of the last received trx and waits until the
19021902// applier reaches that trx. At that point it's safe to resume from these coordinates.
19031903func (mgtr * Migrator ) Checkpoint (ctx context.Context ) (* Checkpoint , error ) {
1904- if mgtr .migrationContext .ParallelCopy {
1905- return mgtr .CheckpointV2 ()
1906- }
1907-
19081904 coords := mgtr .eventsStreamer .GetCurrentBinlogCoordinates ()
19091905 mgtr .applier .LastIterationRangeMutex .Lock ()
19101906 if mgtr .applier .LastIterationRangeMaxValues == nil || mgtr .applier .LastIterationRangeMinValues == nil {
@@ -1939,35 +1935,6 @@ func (mgtr *Migrator) Checkpoint(ctx context.Context) (*Checkpoint, error) {
19391935 }
19401936}
19411937
1942- // CheckpointV2 writes a checkpoint using the applier's current coordinates directly.
1943- // Unlike Checkpoint, it does not wait for the applier to catch up to the streamer —
1944- // CurrentCoordinates is always safe because it is only advanced after
1945- // a DML has been fully applied. This avoids the fixed timeout in the polling loop
1946- // and ensures the checkpoint is always written, even under write pressure.
1947- func (mgtr * Migrator ) CheckpointV2 () (* Checkpoint , error ) {
1948- mgtr .applier .LastIterationRangeMutex .Lock ()
1949- if mgtr .applier .LastIterationRangeMaxValues == nil || mgtr .applier .LastIterationRangeMinValues == nil {
1950- mgtr .applier .LastIterationRangeMutex .Unlock ()
1951- return nil , errors .New ("iteration range is empty, not checkpointing" )
1952- }
1953- mgtr .applier .CurrentCoordinatesMutex .Lock ()
1954- coords := mgtr .applier .CurrentCoordinates
1955- mgtr .applier .CurrentCoordinatesMutex .Unlock ()
1956- chk := & Checkpoint {
1957- Iteration : mgtr .migrationContext .GetIteration (),
1958- IterationRangeMin : mgtr .applier .LastIterationRangeMinValues .Clone (),
1959- IterationRangeMax : mgtr .applier .LastIterationRangeMaxValues .Clone (),
1960- LastTrxCoords : coords ,
1961- RowsCopied : atomic .LoadInt64 (& mgtr .migrationContext .TotalRowsCopied ),
1962- DMLApplied : atomic .LoadInt64 (& mgtr .migrationContext .TotalDMLEventsApplied ),
1963- }
1964- mgtr .applier .LastIterationRangeMutex .Unlock ()
1965-
1966- id , err := mgtr .applier .WriteCheckpoint (chk )
1967- chk .Id = id
1968- return chk , err
1969- }
1970-
19711938// CheckpointAfterCutOver writes a final checkpoint after the cutover completes successfully.
19721939func (mgtr * Migrator ) CheckpointAfterCutOver () (* Checkpoint , error ) {
19731940 if mgtr .lastLockProcessed == nil || mgtr .lastLockProcessed .coords .IsEmpty () {
0 commit comments