Skip to content

Commit 72fe9c8

Browse files
authored
Fixed wrong namespace path in leader (oxia-db#311)
1 parent 40046ae commit 72fe9c8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

server/internal_rpc_server.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func newInternalRpcServer(grpcProvider container.GrpcProvider, bindAddress strin
4949
assignmentDispatcher: assignmentDispatcher,
5050
healthServer: health.NewServer(),
5151
log: log.With().
52-
Str("component", "coordination-rpc-server").
52+
Str("component", "internal-rpc-server").
5353
Logger(),
5454
}
5555

@@ -100,7 +100,7 @@ func (s *internalRpcServer) NewTerm(c context.Context, req *proto.NewTermRequest
100100
log.Warn().Err(err).Msg("NewTerm failed: could not get follower controller")
101101
return nil, err
102102
}
103-
log.Warn().Err(err).Msg("Node is not follower, getting leader")
103+
log.Debug().Err(err).Msg("Node is not follower, getting leader")
104104

105105
// If we don't have a follower, fallback to checking the leader controller
106106
} else {
@@ -208,6 +208,7 @@ func (s *internalRpcServer) Replicate(srv proto.OxiaLogReplication_ReplicateServ
208208

209209
log := s.log.With().
210210
Int64("shard", shardId).
211+
Str("namespace", namespace).
211212
Str("peer", common.GetPeer(srv.Context())).
212213
Logger()
213214

@@ -245,11 +246,13 @@ func (s *internalRpcServer) SendSnapshot(srv proto.OxiaLogReplication_SendSnapsh
245246

246247
s.log.Info().
247248
Int64("shard", shardId).
249+
Str("namespace", namespace).
248250
Str("peer", common.GetPeer(srv.Context())).
249251
Msg("Received SendSnapshot request")
250252

251253
if follower, err := s.shardsDirector.GetOrCreateFollower(namespace, shardId); err != nil {
252254
s.log.Warn().Err(err).
255+
Str("namespace", namespace).
253256
Int64("shard", shardId).
254257
Str("peer", common.GetPeer(srv.Context())).
255258
Msg("SendSnapshot failed: could not get follower controller")
@@ -258,6 +261,7 @@ func (s *internalRpcServer) SendSnapshot(srv proto.OxiaLogReplication_SendSnapsh
258261
err2 := follower.SendSnapshot(srv)
259262
if err2 != nil {
260263
s.log.Warn().Err(err2).
264+
Str("namespace", namespace).
261265
Int64("shard", shardId).
262266
Str("peer", common.GetPeer(srv.Context())).
263267
Msg("SendSnapshot failed")

server/leader_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ func NewLeaderController(config Config, namespace string, shardId int64, rpcClie
143143
lc.ctx, lc.cancel = context.WithCancel(context.Background())
144144

145145
var err error
146-
if lc.wal, err = walFactory.NewWal(common.DefaultNamespace, shardId); err != nil {
146+
if lc.wal, err = walFactory.NewWal(namespace, shardId); err != nil {
147147
return nil, err
148148
}
149149

150-
lc.walTrimmer = wal.NewTrimmer(common.DefaultNamespace, shardId, lc.wal, config.WalRetentionTime, wal.DefaultCheckInterval,
150+
lc.walTrimmer = wal.NewTrimmer(namespace, shardId, lc.wal, config.WalRetentionTime, wal.DefaultCheckInterval,
151151
common.SystemClock, lc)
152152

153-
if lc.db, err = kv.NewDB(common.DefaultNamespace, shardId, kvFactory, config.NotificationsRetentionTime, common.SystemClock); err != nil {
153+
if lc.db, err = kv.NewDB(namespace, shardId, kvFactory, config.NotificationsRetentionTime, common.SystemClock); err != nil {
154154
return nil, err
155155
}
156156

0 commit comments

Comments
 (0)