Skip to content

Commit

Permalink
Merge #72725
Browse files Browse the repository at this point in the history
72725: cli: remove mention of RocksDB r=tbg a=erikgrinaker

This removes any reference to RocksDB in the `debug` CLI code, using
Pebble instead.

Release note: None

Co-authored-by: Erik Grinaker <[email protected]>
  • Loading branch information
craig[bot] and erikgrinaker committed Nov 15, 2021
2 parents 3aeb375 + 33f0658 commit db2d016
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions pkg/ccl/cliccl/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ AES128_CTR:be235... # AES-128 encryption with store key ID
}

// Add commands to the root debug command.
// We can't add them to the lists of commands (eg: DebugCmdsForRocksDB) as cli init() is called before us.
// We can't add them to the lists of commands (eg: DebugCmdsForPebble) as cli init() is called before us.
cli.DebugCmd.AddCommand(encryptionStatusCmd)
cli.DebugCmd.AddCommand(encryptionActiveKeyCmd)

Expand All @@ -91,7 +91,7 @@ AES128_CTR:be235... # AES-128 encryption with store key ID
"print active store key ID and exit")

// Add encryption flag to all OSS debug commands that want it.
for _, cmd := range cli.DebugCmdsForRocksDB {
for _, cmd := range cli.DebugCmdsForPebble {
// storeEncryptionSpecs is in start.go.
cli.VarFlag(cmd.Flags(), &storeEncryptionSpecs, cliflagsccl.EnterpriseEncryption)
}
Expand All @@ -102,10 +102,10 @@ AES128_CTR:be235... # AES-128 encryption with store key ID
cli.VarFlag(cli.DebugPebbleCmd.PersistentFlags(),
&storeEncryptionSpecs, cliflagsccl.EnterpriseEncryption)

cli.PopulateRocksDBConfigHook = fillEncryptionOptionsForStore
cli.PopulateStorageConfigHook = fillEncryptionOptionsForStore
}

// fillEncryptionOptionsForStore fills the RocksDBConfig fields
// fillEncryptionOptionsForStore fills the StorageConfig fields
// based on the --enterprise-encryption flag value.
func fillEncryptionOptionsForStore(cfg *base.StorageConfig) error {
opts, err := baseccl.EncryptionOptionsForStore(cfg.Dir, storeEncryptionSpecs)
Expand Down Expand Up @@ -294,7 +294,7 @@ func runEncryptionActiveKey(cmd *cobra.Command, args []string) error {
return nil
}

// getActiveEncryptionkey opens the file registry directly, bypassing rocksdb.
// getActiveEncryptionkey opens the file registry directly, bypassing Pebble.
// This allows looking up the active encryption key ID without knowing it.
func getActiveEncryptionkey(dir string) (string, string, error) {
registryFile := filepath.Join(dir, fileRegistryFilename)
Expand Down
24 changes: 12 additions & 12 deletions pkg/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ Create a ballast file to fill the store directory up to a given amount
RunE: runDebugBallast,
}

// PopulateRocksDBConfigHook is a callback set by CCL code.
// It populates any needed fields in the RocksDBConfig.
// PopulateStorageConfigHook is a callback set by CCL code.
// It populates any needed fields in the StorageConfig.
// It must do nothing in OSS code.
var PopulateRocksDBConfigHook func(*base.StorageConfig) error
var PopulateStorageConfigHook func(*base.StorageConfig) error

func parsePositiveInt(arg string) (int64, error) {
i, err := strconv.ParseInt(arg, 10, 64)
Expand Down Expand Up @@ -145,7 +145,7 @@ func (opts OpenEngineOptions) configOptions() []storage.ConfigOption {
return cfgOpts
}

// OpenExistingStore opens the rocksdb engine rooted at 'dir'.
// OpenExistingStore opens the Pebble engine rooted at 'dir'.
// If 'readOnly' is true, opens the store in read-only mode.
func OpenExistingStore(dir string, stopper *stop.Stopper, readOnly bool) (storage.Engine, error) {
return OpenEngine(dir, stopper, OpenEngineOptions{ReadOnly: readOnly, MustExist: true})
Expand All @@ -163,7 +163,7 @@ func OpenEngine(dir string, stopper *stop.Stopper, opts OpenEngineOptions) (stor
storage.MaxOpenFiles(int(maxOpenFiles)),
storage.CacheSize(server.DefaultCacheSize),
storage.Settings(serverCfg.Settings),
storage.Hook(PopulateRocksDBConfigHook),
storage.Hook(PopulateStorageConfigHook),
storage.CombineOptions(opts.configOptions()...))
if err != nil {
return nil, err
Expand Down Expand Up @@ -1501,10 +1501,10 @@ func runDebugIntentCount(cmd *cobra.Command, args []string) error {
return nil
}

// DebugCmdsForRocksDB lists debug commands that access rocksdb through the engine
// DebugCmdsForPebble lists debug commands that access Pebble through the engine
// and need encryption flags (injected by CCL code).
// Note: do NOT include commands that just call rocksdb code without setting up an engine.
var DebugCmdsForRocksDB = []*cobra.Command{
// Note: do NOT include commands that just call Pebble code without setting up an engine.
var DebugCmdsForPebble = []*cobra.Command{
debugCheckStoreCmd,
debugCompactCmd,
debugGCCmd,
Expand All @@ -1517,7 +1517,7 @@ var DebugCmdsForRocksDB = []*cobra.Command{
}

// All other debug commands go here.
var debugCmds = append(DebugCmdsForRocksDB,
var debugCmds = append(DebugCmdsForPebble,
debugBallastCmd,
debugCheckLogConfigCmd,
debugDecodeKeyCmd,
Expand Down Expand Up @@ -1597,7 +1597,7 @@ func init() {
return lockValueFormatter{value: value}
}

// To be able to read Cockroach-written RocksDB manifests/SSTables, comparator
// To be able to read Cockroach-written Pebble manifests/SSTables, comparator
// and merger functions must be specified to pebble that match the ones used
// to write those files.
pebbleTool := tool.New(tool.Mergers(storage.MVCCMerger),
Expand Down Expand Up @@ -1690,8 +1690,8 @@ func pebbleCryptoInitializer() error {
Dir: serverCfg.Stores.Specs[0].Path,
}

if PopulateRocksDBConfigHook != nil {
if err := PopulateRocksDBConfigHook(&storageConfig); err != nil {
if PopulateStorageConfigHook != nil {
if err := PopulateStorageConfigHook(&storageConfig); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func TestRemoveDeadReplicas(t *testing.T) {
t.Fatal(err)
}

// At this point the intent has been written to rocksdb but this
// At this point the intent has been written to Pebble but this
// write was not synced (only the raft log append was synced). We
// need to force another sync, but we're far from the storage
// layer here so the easiest thing to do is simply perform a
Expand Down

0 comments on commit db2d016

Please sign in to comment.