aboutsummaryrefslogtreecommitdiff
path: root/weed/storage
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage')
-rw-r--r--weed/storage/volume_loading.go3
-rw-r--r--weed/storage/volume_super_block.go4
2 files changed, 7 insertions, 0 deletions
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go
index db168a134..0f2a19bd1 100644
--- a/weed/storage/volume_loading.go
+++ b/weed/storage/volume_loading.go
@@ -59,6 +59,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
if alreadyHasSuperBlock {
e = v.readSuperBlock()
} else {
+ if !v.SuperBlock.Initialized() {
+ return fmt.Errorf("volume %s.dat not initialized", fileName)
+ }
e = v.maybeWriteSuperBlock()
}
if e == nil && alsoLoadIndex {
diff --git a/weed/storage/volume_super_block.go b/weed/storage/volume_super_block.go
index 414d55f68..e4dc985b0 100644
--- a/weed/storage/volume_super_block.go
+++ b/weed/storage/volume_super_block.go
@@ -71,6 +71,10 @@ func (s *SuperBlock) Bytes() []byte {
return header
}
+func (s *SuperBlock) Initialized() bool {
+ return s.ReplicaPlacement != nil && s.Ttl != nil
+}
+
func (v *Volume) maybeWriteSuperBlock() error {
mMap, exists := memory_map.FileMemoryMap[v.dataFile.Name()]