Skip to content

Commit e5f856a

Browse files
committed
sql/rowexec: ddl_iters.go: PR feedback.
1 parent 65efdf6 commit e5f856a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sql/rowexec/ddl_iters.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,6 @@ func (b *BaseBuilder) executeCreateCheck(ctx *sql.Context, c *plan.CreateCheck)
18551855
if err != nil {
18561856
return err
18571857
}
1858-
rowIter = withSafepointPeriodicallyIter(rowIter)
18591858

18601859
for {
18611860
row, err := rowIter.Next(ctx)

sql/rowexec/dml_iters.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,19 @@ func withSafepointPeriodicallyIter(child sql.RowIter) *safepointPeriodicallyIter
638638
return &safepointPeriodicallyIter{child: child}
639639
}
640640

641+
// A wrapper iterator which calls sql.SessionCommandSafepoint on the
642+
// ctx.Session periodically while returning rows through calls to
643+
// |Next|.
644+
//
645+
// Should be used to wrap any iterators which are involved in
646+
// long-running write operations and which are exhausted or iterated
647+
// by other iterators in the iterator tree, such as accumulatorIter.
648+
//
649+
// This iterator makes the assumption that a safepoint, from the
650+
// Engine's perspective, can be established at any moment we are
651+
// within a Next() call. This is generally true given the Engine's
652+
// lack of concurrency on a given Session, but if something like
653+
// Exchange node came back, this would not necessarily be true.
641654
type safepointPeriodicallyIter struct {
642655
child sql.RowIter
643656
n int

0 commit comments

Comments
 (0)