Skip to content

Commit

Permalink
Respond to Ben's comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Kimball committed Jan 16, 2015
1 parent 287f8f7 commit e06091d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion storage/engine/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 7 additions & 10 deletions storage/store_split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e06091d

Please sign in to comment.