Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions pkg/cmd/roachtest/tests/copyfrom.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,7 @@ func runCopyFromCRDB(ctx context.Context, t test.Test, c cluster.Cluster, sf int
// Enable the verbose logging on relevant files to have better understanding
// in case the test fails.
startOpts.RoachprodOpts.ExtraArgs = append(startOpts.RoachprodOpts.ExtraArgs, "--vmodule=copy_from=2,insert=2")
// The roachtest frequently runs on overloaded instances and can timeout as
// a result. We've seen cases where the atomic COPY takes about 2 minutes to
// complete, so we set the closed TS and SQL liveness TTL to 5 minutes (to
// give enough safety gap, otherwise the closed TS system and lease system
// expireation might continuously push the COPY txn not allowing it ever to
// complete).
clusterSettings := install.MakeClusterSettings(install.ClusterSettingsOption{
"kv.closed_timestamp.target_duration": "300s",
"server.sqlliveness.ttl": "300s",
})
clusterSettings := install.MakeClusterSettings()
c.Start(ctx, t.L(), startOpts, clusterSettings, c.All())
initTest(ctx, t, c, sf)
db, err := c.ConnE(ctx, t.L(), 1)
Expand Down
10 changes: 8 additions & 2 deletions pkg/sql/colexec/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,15 @@ func (v *vectorInserter) Next() coldata.Batch {
}
colexecerror.ExpectedError(err)
}
log.VEventf(ctx, 2, "copy running batch, autocommit: %v, final: %v, numrows: %d", v.autoCommit, end == b.Length(), end-start)
// Similar to tableWriterBase.finalize, we examine whether it's likely
// that we'll be able to auto-commit. If it seems unlikely based on the
// deadlie, we won't auto-commit which might allow the connExecutor to
// get a fresh deadline before committing.
autoCommit := v.autoCommit && end == b.Length() &&
!v.flowCtx.Txn.DeadlineLikelySufficient()
log.VEventf(ctx, 2, "copy running batch, autocommit: %v, numrows: %d", autoCommit, end-start)
var err error
if v.autoCommit && end == b.Length() {
if autoCommit {
err = v.flowCtx.Txn.CommitInBatch(ctx, kvba.Batch)
} else {
err = v.flowCtx.Txn.Run(ctx, kvba.Batch)
Expand Down