mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-30 11:45:42 +00:00
master: keep disk_id when registering volumes from incremental heartbeats (#10686)
The volume server names the directory index in every VolumeShortInformationMessage, but NewVolumeInfoFromShort dropped it, so volumes registered through the incremental new-volume path showed disk_id 0 at the master until a full report -- misreporting multi-dir servers in volume.list and the per-physical-disk topology views. Claude-Session: https://claude.ai/code/session_01QdTEEPbg4MtcoEGwqbgtZC
This commit is contained in:
@@ -67,6 +67,7 @@ func NewVolumeInfoFromShort(m *master_pb.VolumeShortInformationMessage) (vi Volu
|
||||
Id: needle.VolumeId(m.Id),
|
||||
Collection: internVolumeString(m.Collection),
|
||||
Version: needle.Version(m.Version),
|
||||
DiskId: m.DiskId,
|
||||
}
|
||||
rp, e := super_block.NewReplicaPlacementFromByte(byte(m.ReplicaPlacement))
|
||||
if e != nil {
|
||||
|
||||
@@ -3,6 +3,7 @@ package storage
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
|
||||
)
|
||||
|
||||
@@ -25,3 +26,17 @@ func TestSortVolumeInfos(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewVolumeInfoFromShortKeepsDiskId(t *testing.T) {
|
||||
vi, err := NewVolumeInfoFromShort(&master_pb.VolumeShortInformationMessage{
|
||||
Id: 7,
|
||||
Version: 3,
|
||||
DiskId: 3,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if vi.DiskId != 3 {
|
||||
t.Fatalf("DiskId = %d, want 3", vi.DiskId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user