diff --git a/pkg/ccl/storageccl/BUILD.bazel b/pkg/ccl/storageccl/BUILD.bazel index eeaa687b4431..835fbac3e3e6 100644 --- a/pkg/ccl/storageccl/BUILD.bazel +++ b/pkg/ccl/storageccl/BUILD.bazel @@ -15,6 +15,7 @@ go_library( deps = [ "//pkg/base", "//pkg/ccl/storageccl/engineccl", + "//pkg/clusterversion", "//pkg/keys", "//pkg/kv", "//pkg/kv/bulk", diff --git a/pkg/ccl/storageccl/export.go b/pkg/ccl/storageccl/export.go index 9f2d3e4d7e93..df09a06d5a39 100644 --- a/pkg/ccl/storageccl/export.go +++ b/pkg/ccl/storageccl/export.go @@ -15,6 +15,7 @@ import ( "fmt" "github.com/cockroachdb/cockroach/pkg/base" + "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/result" @@ -186,8 +187,12 @@ func evalExport( } if args.Encryption != nil { - // TODO(dt): cluster version gate use EncryptFileChunked. - data, err = EncryptFile(data, args.Encryption.Key) + // NonVotingReplicas was minted after chunked encryption reader merged. + if cArgs.EvalCtx.ClusterSettings().Version.IsActive(ctx, clusterversion.NonVotingReplicas) { + data, err = EncryptFileChunked(data, args.Encryption.Key) + } else { + data, err = EncryptFile(data, args.Encryption.Key) + } if err != nil { return result.Result{}, err }