mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-12 09:17:44 +02:00
reading/setting/reporting correct volume version
This commit is contained in:
1 parent
6c8810e4d2
commit
ab5e9727a9
5 files changed
+11
-7
No files matched your search
@@ -108,7 +108,7 @@ func (s *Store) loadExistingVolumes() {
|
||||
if s.volumes[vid] == nil {
|
||||
v := NewVolume(s.dir, vid, CopyNil)
|
||||
s.volumes[vid] = v
|
||||
log.Println("In dir", s.dir, "reads volume = ", vid, ", replicationType =", v.replicaType)
|
||||
log.Println("In dir", s.dir, "read volume =", vid, "replicationType =", v.replicaType, "version =", v.version,"size =", v.Size())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ func (s *Store) Status() []*VolumeInfo {
|
||||
var stats []*VolumeInfo
|
||||
for k, v := range s.volumes {
|
||||
s := new(VolumeInfo)
|
||||
s.Id, s.Size, s.RepType, s.FileCount, s.DeleteCount, s.DeletedByteCount = VolumeId(k), v.ContentSize(), v.replicaType, v.nm.fileCounter, v.nm.deletionCounter, v.nm.deletionByteCounter
|
||||
s.Id, s.Size, s.RepType, s.Version, s.FileCount, s.DeleteCount, s.DeletedByteCount = VolumeId(k), v.ContentSize(), v.replicaType, v.Version(), v.nm.fileCounter, v.nm.deletionCounter, v.nm.deletionByteCounter
|
||||
stats = append(stats, s)
|
||||
}
|
||||
return stats
|
||||
@@ -136,7 +136,7 @@ func (s *Store) Join() error {
|
||||
stats := new([]*VolumeInfo)
|
||||
for k, v := range s.volumes {
|
||||
s := new(VolumeInfo)
|
||||
s.Id, s.Size, s.RepType, s.FileCount, s.DeleteCount, s.DeletedByteCount = VolumeId(k), uint64(v.Size()), v.replicaType, v.nm.fileCounter, v.nm.deletionCounter, v.nm.deletionByteCounter
|
||||
s.Id, s.Size, s.RepType, s.Version, s.FileCount, s.DeleteCount, s.DeletedByteCount = VolumeId(k), uint64(v.Size()), v.replicaType, v.Version(), v.nm.fileCounter, v.nm.deletionCounter, v.nm.deletionByteCounter
|
||||
*stats = append(*stats, s)
|
||||
}
|
||||
bytes, _ := json.Marshal(stats)
|
||||
|
||||
@@ -53,6 +53,9 @@ func (v *Volume) load() error {
|
||||
v.nm = LoadNeedleMap(indexFile)
|
||||
return nil
|
||||
}
|
||||
func (v *Volume) Version() Version {
|
||||
return CurrentVersion
|
||||
}
|
||||
func (v *Volume) Size() int64 {
|
||||
v.accessLock.Lock()
|
||||
defer v.accessLock.Unlock()
|
||||
@@ -72,8 +75,9 @@ func (v *Volume) Close() {
|
||||
func (v *Volume) maybeWriteSuperBlock() {
|
||||
stat, _ := v.dataFile.Stat()
|
||||
if stat.Size() == 0 {
|
||||
v.version = CurrentVersion
|
||||
header := make([]byte, SuperBlockSize)
|
||||
header[0] = byte(CurrentVersion)
|
||||
header[0] = byte(v.version)
|
||||
header[1] = v.replicaType.Byte()
|
||||
v.dataFile.Write(header)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user