@@ -570,7 +570,8 @@ func (i *modifyColumnIter) rewriteTable(ctx *sql.Context, rwt sql.RewritableTabl
570570 return false , err
571571 }
572572
573- rowIter := sql .NewTableRowIter (ctx , rwt , partitions )
573+ var rowIter sql.RowIter = sql .NewTableRowIter (ctx , rwt , partitions )
574+ rowIter = withSafepointPeriodicallyIter (rowIter )
574575 for {
575576 r , err := rowIter .Next (ctx )
576577 if err == io .EOF {
@@ -1117,7 +1118,8 @@ func (c *createPkIter) rewriteTable(ctx *sql.Context, rwt sql.RewritableTable) e
11171118 return err
11181119 }
11191120
1120- rowIter := sql .NewTableRowIter (ctx , rwt , partitions )
1121+ var rowIter sql.RowIter = sql .NewTableRowIter (ctx , rwt , partitions )
1122+ rowIter = withSafepointPeriodicallyIter (rowIter )
11211123
11221124 for {
11231125 r , err := rowIter .Next (ctx )
@@ -1221,7 +1223,8 @@ func (d *dropPkIter) rewriteTable(ctx *sql.Context, rwt sql.RewritableTable) err
12211223 return err
12221224 }
12231225
1224- rowIter := sql .NewTableRowIter (ctx , rwt , partitions )
1226+ var rowIter sql.RowIter = sql .NewTableRowIter (ctx , rwt , partitions )
1227+ rowIter = withSafepointPeriodicallyIter (rowIter )
12251228
12261229 for {
12271230 r , err := rowIter .Next (ctx )
@@ -1329,6 +1332,7 @@ func (i *addColumnIter) UpdateRowsWithDefaults(ctx *sql.Context, table sql.Table
13291332 if err != nil {
13301333 return err
13311334 }
1335+ tableIter = withSafepointPeriodicallyIter (tableIter )
13321336
13331337 schema := updatable .Schema ()
13341338 idx := - 1
@@ -1430,7 +1434,8 @@ func (i *addColumnIter) rewriteTable(ctx *sql.Context, rwt sql.RewritableTable)
14301434 return false , err
14311435 }
14321436
1433- rowIter := sql .NewTableRowIter (ctx , rwt , partitions )
1437+ var rowIter sql.RowIter = sql .NewTableRowIter (ctx , rwt , partitions )
1438+ rowIter = withSafepointPeriodicallyIter (rowIter )
14341439
14351440 var val uint64
14361441 var autoTbl sql.AutoIncrementTable
@@ -1740,7 +1745,8 @@ func (i *dropColumnIter) rewriteTable(ctx *sql.Context, rwt sql.RewritableTable)
17401745 return false , err
17411746 }
17421747
1743- rowIter := sql .NewTableRowIter (ctx , rwt , partitions )
1748+ var rowIter sql.RowIter = sql .NewTableRowIter (ctx , rwt , partitions )
1749+ rowIter = withSafepointPeriodicallyIter (rowIter )
17441750
17451751 for {
17461752 r , err := rowIter .Next (ctx )
@@ -2252,7 +2258,8 @@ func buildIndex(ctx *sql.Context, n *plan.AlterIndex, ibt sql.IndexBuildingTable
22522258 return err
22532259 }
22542260
2255- rowIter := sql .NewTableRowIter (ctx , ibt , partitions )
2261+ var rowIter sql.RowIter = sql .NewTableRowIter (ctx , ibt , partitions )
2262+ rowIter = withSafepointPeriodicallyIter (rowIter )
22562263
22572264 // Our table scan needs to include projections for virtual columns if there are any
22582265 isVirtual := ibt .Schema ().HasVirtualColumns ()
@@ -2339,7 +2346,8 @@ func rewriteTableForIndexCreate(ctx *sql.Context, n *plan.AlterIndex, table sql.
23392346 return err
23402347 }
23412348
2342- rowIter := sql .NewTableRowIter (ctx , rwt , partitions )
2349+ var rowIter sql.RowIter = sql .NewTableRowIter (ctx , rwt , partitions )
2350+ rowIter = withSafepointPeriodicallyIter (rowIter )
23432351
23442352 isVirtual := table .Schema ().HasVirtualColumns ()
23452353 var projections []sql.Expression
0 commit comments