Skip to content

Commit 92f687c

Browse files
craig[bot]marcnvb
committed
Merge #26044 #26048
26044: misc: fix encryption stats nits. r=mberhault a=mberhault Nothing major, followups to premature merge of #25850 Release note: None 26048: tpccbench: fix existing dataset fast-path r=nvanbenschoten a=nvanbenschoten This skewed with #24735, which changed the output of `information_schema` when connecting to an implicit database. Release note: None Co-authored-by: marc <marc@cockroachlabs.com> Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
3 parents 5a37fb2 + 93c6f2a + 01cb8d4 commit 92f687c

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

c-deps/libroach/ccl/db.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class CCLEnvStatsHandler : public EnvStatsHandler {
3939
enginepbccl::EncryptionStatus enc_status;
4040

4141
bool has_stats = false;
42-
if (this->store_key_manager_ != nullptr) {
42+
if (store_key_manager_ != nullptr) {
4343
has_stats = true;
4444
// Transfer ownership of new key info to status proto, this frees any previous value.
4545
enc_status.set_allocated_active_store_key(store_key_manager_->CurrentKeyInfo().release());
4646
}
4747

48-
if (this->data_key_manager_ != nullptr) {
48+
if (data_key_manager_ != nullptr) {
4949
has_stats = true;
5050
// Transfer ownership of new key info to status proto, this frees any previous value.
5151
enc_status.set_allocated_active_data_key(data_key_manager_->CurrentKeyInfo().release());

pkg/cmd/roachtest/tpcc.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ import (
2222
"strings"
2323
"time"
2424

25+
"github.com/lib/pq"
26+
"github.com/pkg/errors"
27+
28+
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
2529
"github.com/cockroachdb/cockroach/pkg/util/color"
2630
"github.com/cockroachdb/cockroach/pkg/util/search"
2731
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
28-
"github.com/pkg/errors"
2932
)
3033

3134
func registerTPCC(r *registry) {
@@ -138,15 +141,9 @@ func loadTPCCBench(
138141

139142
// Check if the dataset already exists and is already large enough to
140143
// accommodate this benchmarking. If so, we can skip the fixture RESTORE.
141-
var tableExists bool
142-
if err := db.QueryRowContext(ctx, `
143-
SELECT COUNT(*) > 0
144-
FROM INFORMATION_SCHEMA.TABLES
145-
WHERE TABLE_CATALOG = 'tpcc' AND TABLE_NAME = 'warehouse'`,
146-
).Scan(&tableExists); err != nil {
147-
return err
148-
}
149-
if tableExists {
144+
if _, err := db.ExecContext(ctx, `USE tpcc`); err == nil {
145+
c.l.printf("found existing tpcc database\n")
146+
150147
var curWarehouses int
151148
if err := db.QueryRowContext(ctx,
152149
`SELECT COUNT(*) FROM tpcc.warehouse`,
@@ -162,6 +159,9 @@ func loadTPCCBench(
162159
// before restoring.
163160
c.Wipe(ctx, roachNodes)
164161
c.Start(ctx, roachNodes)
162+
} else if pqErr, ok := err.(*pq.Error); !ok ||
163+
string(pqErr.Code) != pgerror.CodeInvalidCatalogNameError {
164+
return err
165165
}
166166

167167
// Load the corresponding fixture.

pkg/storage/engine/engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ type Stats struct {
348348

349349
// EnvStats is a set of RocksDB env stats, including encryption status.
350350
type EnvStats struct {
351-
// EncryptionStatus is a serialized enginepbccl/stats.proto::EncryptionStatus protobuf.
351+
// EncryptionStatus is a serialized enginepbccl/stats.proto::EncryptionStatus protobuf.
352352
EncryptionStatus []byte
353353
}
354354

0 commit comments

Comments
 (0)