diff --git a/server/kv/kv_pebble.go b/server/kv/kv_pebble.go index a79fc7e9..48322485 100644 --- a/server/kv/kv_pebble.go +++ b/server/kv/kv_pebble.go @@ -107,6 +107,9 @@ func (p *PebbleFactory) NewSnapshotLoader(namespace string, shardId int64) (Snap } func (p *PebbleFactory) getKVPath(namespace string, shard int64) string { + if namespace == "" { + log.Fatal().Int64("shard", shard).Msg("Missing namespace when getting KV path") + } return filepath.Join(p.dataDir, namespace, fmt.Sprint("shard-", shard)) } diff --git a/server/leader_controller.go b/server/leader_controller.go index 02babf11..a6e91956 100644 --- a/server/leader_controller.go +++ b/server/leader_controller.go @@ -497,6 +497,7 @@ func (lc *leaderController) truncateFollowerIfNeeded(follower string, followerHe } tr, err := lc.rpcClient.Truncate(follower, &proto.TruncateRequest{ + Namespace: lc.namespace, ShardId: lc.shardId, Term: lc.term, HeadEntryId: lastEntryInFollowerTerm, diff --git a/server/leader_controller_test.go b/server/leader_controller_test.go index c5c80998..46c4c88a 100644 --- a/server/leader_controller_test.go +++ b/server/leader_controller_test.go @@ -652,6 +652,7 @@ func TestLeaderController_AddFollower_Truncate(t *testing.T) { assert.NoError(t, err) trReq := <-rpcClient.truncateReqs + assert.Equal(t, common.DefaultNamespace, trReq.Namespace) assert.EqualValues(t, 6, trReq.Term) AssertProtoEqual(t, &proto.EntryId{Term: 5, Offset: 9}, trReq.HeadEntryId) assert.Equal(t, shard, trReq.ShardId)