File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1087,24 +1087,30 @@ func (this *Migrator) iterateChunks() error {
1087
1087
log .Debugf ("No rows found in table. Rowcopy will be implicitly empty" )
1088
1088
return terminateRowIteration (nil )
1089
1089
}
1090
+
1091
+ var hasNoFurtherRangeFlag int64
1090
1092
// Iterate per chunk:
1091
1093
for {
1092
- if atomic .LoadInt64 (& this .rowCopyCompleteFlag ) == 1 {
1094
+ if atomic .LoadInt64 (& this .rowCopyCompleteFlag ) == 1 || atomic . LoadInt64 ( & hasNoFurtherRangeFlag ) == 1 {
1093
1095
// Done
1094
1096
// There's another such check down the line
1095
1097
return nil
1096
1098
}
1097
1099
copyRowsFunc := func () error {
1098
- if atomic .LoadInt64 (& this .rowCopyCompleteFlag ) == 1 {
1100
+ if atomic .LoadInt64 (& this .rowCopyCompleteFlag ) == 1 || atomic . LoadInt64 ( & hasNoFurtherRangeFlag ) == 1 {
1099
1101
// Done.
1100
1102
// There's another such check down the line
1101
1103
return nil
1102
1104
}
1105
+
1106
+ // When hasFurtherRange is false, original table might be write locked and CalculateNextIterationRangeEndValues would hangs forever
1107
+
1103
1108
hasFurtherRange , err := this .applier .CalculateNextIterationRangeEndValues ()
1104
1109
if err != nil {
1105
1110
return terminateRowIteration (err )
1106
1111
}
1107
1112
if ! hasFurtherRange {
1113
+ atomic .StoreInt64 (& hasNoFurtherRangeFlag , 1 )
1108
1114
return terminateRowIteration (nil )
1109
1115
}
1110
1116
// Copy task:
You can’t perform that action at this time.
0 commit comments