From e06091d13f8239165b91617bb4d507f30c17b246 Mon Sep 17 00:00:00 2001 From: Spencer Kimball Date: Fri, 16 Jan 2015 17:14:50 -0500 Subject: [PATCH] Respond to Ben's comments. --- storage/engine/keys.go | 2 +- storage/store_split_test.go | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/storage/engine/keys.go b/storage/engine/keys.go index 07e6a9830029..4bf5e785a2d6 100644 --- a/storage/engine/keys.go +++ b/storage/engine/keys.go @@ -62,7 +62,7 @@ func RaftLogKey(raftID int64, logIndex uint64) proto.Key { // RaftLogPrefix returns the system-local prefix shared by all entries in a Raft log. func RaftLogPrefix(raftID int64) proto.Key { - return MakeKey(KeyLocalRangeIDPrefix, encoding.EncodeInt(nil, raftID), KeyLocalRaftLogSuffix) + return MakeRangeIDKey(raftID, KeyLocalRaftLogSuffix, proto.Key{}) } // RaftStateKey returns a system-local key for a Raft HardState. diff --git a/storage/store_split_test.go b/storage/store_split_test.go index 59aabe95a618..95f41477ec7a 100644 --- a/storage/store_split_test.go +++ b/storage/store_split_test.go @@ -32,7 +32,6 @@ import ( "github.com/cockroachdb/cockroach/storage/engine" "github.com/cockroachdb/cockroach/util" "github.com/cockroachdb/cockroach/util/log" - gogoproto "github.com/gogo/protobuf/proto" ) func adminSplitArgs(key, splitKey []byte, raftID int64, storeID int32) (*proto.AdminSplitRequest, *proto.AdminSplitResponse) { @@ -405,15 +404,13 @@ func TestStoreRangeSplitOnConfigs(t *testing.T) { acctConfig := &proto.AcctConfig{} zoneConfig := &proto.ZoneConfig{} - // Write accounting configs for db1 & db2 and zone configs for db3 & db4. - for _, k := range []string{"db4", "db3", "db2", "db1"} { - prefix := engine.KeyConfigAccountingPrefix - var config gogoproto.Message = acctConfig - if k == "db3" || k == "db4" { - prefix = engine.KeyConfigZonePrefix - config = zoneConfig - } - store.DB().PreparePutProto(engine.MakeKey(prefix, proto.Key(k)), config) + // Write zone configs for db3 & db4. + for _, k := range []string{"db4", "db3"} { + store.DB().PreparePutProto(engine.MakeKey(engine.KeyConfigZonePrefix, proto.Key(k)), zoneConfig) + } + // Write accounting configs for db1 & db2. + for _, k := range []string{"db2", "db1"} { + store.DB().PreparePutProto(engine.MakeKey(engine.KeyConfigAccountingPrefix, proto.Key(k)), acctConfig) } if err := store.DB().Flush(); err != nil { t.Fatal(err)