From 6b06335b6e34287ee246a128e13f13a86d681337 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Fri, 6 Jan 2023 16:39:16 -0500 Subject: [PATCH] import: add logging to import cancellation In #94740, the backup/mvcc-range-tombstones roachtest failed because an import cancellation retried for opaque reasons. This patch adds more logging to potential retryable errors so the next time the thest fails, the logs will clearly state why. Epic: none Release note: none --- pkg/cmd/roachtest/tests/backup.go | 4 +++- pkg/sql/gcjob/table_garbage_collection.go | 1 + pkg/sql/importer/import_job.go | 1 + pkg/sql/revert.go | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/tests/backup.go b/pkg/cmd/roachtest/tests/backup.go index cccc163ccd25..f2c7557ff8da 100644 --- a/pkg/cmd/roachtest/tests/backup.go +++ b/pkg/cmd/roachtest/tests/backup.go @@ -1149,7 +1149,9 @@ func runBackupMVCCRangeTombstones(ctx context.Context, t test.Test, c cluster.Cl require.NoError(t, err) _, err = conn.Exec(`SET CLUSTER SETTING storage.mvcc.range_tombstones.enabled = 't'`) require.NoError(t, err) - + _, err = conn.Exec(`SET CLUSTER SETTING server.debug.default_vmodule = 'txn=2,sst_batcher=4, +revert=2'`) + require.NoError(t, err) // Wait for ranges to upreplicate. require.NoError(t, WaitFor3XReplication(ctx, t, conn)) diff --git a/pkg/sql/gcjob/table_garbage_collection.go b/pkg/sql/gcjob/table_garbage_collection.go index c57aafcb1edf..f567781036c5 100644 --- a/pkg/sql/gcjob/table_garbage_collection.go +++ b/pkg/sql/gcjob/table_garbage_collection.go @@ -258,6 +258,7 @@ func deleteAllSpanData( }) log.VEventf(ctx, 2, "delete range %s - %s", lastKey, endKey) if err := db.Run(ctx, &b); err != nil { + log.Errorf(ctx, "delete range %s - %s failed: %s", span.Key, span.EndKey, err.Error()) return errors.Wrapf(err, "delete range %s - %s", lastKey, endKey) } n = 0 diff --git a/pkg/sql/importer/import_job.go b/pkg/sql/importer/import_job.go index 4c686c5d7759..c2f0e3612ded 100644 --- a/pkg/sql/importer/import_job.go +++ b/pkg/sql/importer/import_job.go @@ -1394,6 +1394,7 @@ func (r *importResumer) OnFailOrCancel(ctx context.Context, execCtx interface{}, ctx context.Context, txn *kv.Txn, descsCol *descs.Collection, ) error { if err := r.dropTables(ctx, txn, descsCol, cfg); err != nil { + log.Errorf(ctx, "drop tables failed: %s", err.Error()) return err } diff --git a/pkg/sql/revert.go b/pkg/sql/revert.go index cc6391066ac1..3be7aab85b58 100644 --- a/pkg/sql/revert.go +++ b/pkg/sql/revert.go @@ -199,6 +199,7 @@ func DeleteTableWithPredicate( delRangeRequest) if err != nil { + log.Errorf(ctx, "delete range %s - %s failed: %s", span.Key, span.EndKey, err.String()) return errors.Wrapf(err.GoError(), "delete range %s - %s", span.Key, span.EndKey) } span = nil