Skip to content

Commit

Permalink
Fix map unique_ptr insert and revert Makefile
Browse files Browse the repository at this point in the history
A few other lint/test fixes.
  • Loading branch information
marc committed Jan 19, 2018
1 parent b76ba8c commit 20f0058
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,6 @@ GRPC_GATEWAY_GOOGLEAPIS_PATH := ./vendor/$(GRPC_GATEWAY_GOOGLEAPIS_PACKAGE)
PROTO_MAPPINGS :=
PROTO_MAPPINGS := $(PROTO_MAPPINGS)Mgoogle/api/annotations.proto=$(GRPC_GATEWAY_GOOGLEAPIS_PACKAGE)/google/api,
PROTO_MAPPINGS := $(PROTO_MAPPINGS)Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,
PROTO_MAPPINGS := $(PROTO_MAPPINGS)Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,

GW_SERVER_PROTOS := $(PKG_ROOT)/server/serverpb/admin.proto $(PKG_ROOT)/server/serverpb/status.proto $(PKG_ROOT)/server/serverpb/authentication.proto
GW_TS_PROTOS := $(PKG_ROOT)/ts/tspb/timeseries.proto
Expand Down
10 changes: 9 additions & 1 deletion c-deps/libroach/ccl/db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@

TEST(LibroachCCL, DBOpenHook) {
DBOptions db_opts;
db_opts.use_switching_env = false;

// Try an empty extra_options.
db_opts.extra_options = ToDBSlice("");
EXPECT_OK(DBOpenHook("", db_opts, nullptr));

// Try extra_options with bad data.
// Try without switching env enabled and bogus options. We should fail
// because encryption options without switching env is not allowed.
db_opts.extra_options = ToDBSlice("blah");
EXPECT_ERR(DBOpenHook("", db_opts, nullptr),
"on-disk version does not support encryption, but we found encryption flags");

db_opts.use_switching_env = true;
// Try with switching env but bogus encryption flags.
db_opts.extra_options = ToDBSlice("blah");
EXPECT_ERR(DBOpenHook("", db_opts, nullptr), "failed to parse extra options");
}
3 changes: 2 additions & 1 deletion c-deps/libroach/switching_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ SwitchingProvider::~SwitchingProvider() {}

rocksdb::Status SwitchingProvider::RegisterCipherStreamCreator(int env_level,
CipherStreamCreator* creator) {
auto res = creators_.insert(std::make_pair(env_level, creator));
auto res =
creators_.insert(std::make_pair(env_level, std::unique_ptr<CipherStreamCreator>(creator)));
if (res.second != true) {
return rocksdb::Status::InvalidArgument(
fmt::StringPrintf("double registration of cipher creator at env_level %d", env_level));
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/cmdccl/enc_utils/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f fileEntry) String() string {
if f.settings.EncryptionType != enginepbccl.EncryptionType_Plaintext {
ret += fmt.Sprintf(" keyID: %s\n nonce: % x\n counter: %d\n",
f.settings.KeyId,
[]byte(f.settings.Nonce),
f.settings.Nonce,
f.settings.Counter)
}
return ret
Expand Down Expand Up @@ -76,7 +76,7 @@ func loadFileRegistry() {
log.Infof(context.Background(), "file registry version: %s", reg.Version)
for name, entry := range reg.Files {
var encSettings enginepbccl.EncryptionSettings
settings := []byte(entry.EncryptionSettings)
settings := entry.EncryptionSettings
if err := protoutil.Unmarshal(settings, &encSettings); err != nil {
log.Fatalf(context.Background(), "could not unmarshal encryption setting for %s: %v", name, err)
}
Expand Down

0 comments on commit 20f0058

Please sign in to comment.