Skip to content

Commit a93d7cf

Browse files
committed
handle reinit deleted namespace with different partitions
1 parent b1bf2e5 commit a93d7cf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

node/namespace.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,20 @@ func (nsm *NamespaceMgr) InitNamespaceNode(conf *NamespaceConfig, raftID uint64,
337337
if err != nil {
338338
return nil, err
339339
}
340-
if _, ok := nsm.nsMetas[conf.BaseName]; !ok {
340+
if oldMeta, ok := nsm.nsMetas[conf.BaseName]; !ok {
341341
nsm.nsMetas[conf.BaseName] = NamespaceMeta{
342342
PartitionNum: conf.PartitionNum,
343343
}
344+
nodeLog.Infof("namespace meta init: %v", conf)
345+
} else {
346+
if oldMeta.PartitionNum != conf.PartitionNum {
347+
nodeLog.Errorf("namespace meta mismatch: %v, old: %v", conf, oldMeta)
348+
// update the meta if mismatch, it may happen if create the same namespace with different
349+
// config for old deleted namespace
350+
nsm.nsMetas[conf.BaseName] = NamespaceMeta{
351+
PartitionNum: conf.PartitionNum,
352+
}
353+
}
344354
}
345355

346356
n := &NamespaceNode{

0 commit comments

Comments
 (0)