Browse Source

wal: don't preallocate on old tail file

Code is only there to handle an edge case where the tail wasn't preallocated
already (e.g., via old etcd version or a crash). It also triggers tmpfs
corruption, so remove it.
Anthony Romano 9 years ago
parent
commit
5be39d2c84
1 changed files with 0 additions and 7 deletions
  1. 0 7
      wal/wal.go

+ 0 - 7
wal/wal.go

@@ -207,17 +207,10 @@ func openAtIndex(dirpath string, snap walpb.Snapshot, write bool) (*WAL, error)
 		// write reuses the file descriptors from read; don't close so
 		// write reuses the file descriptors from read; don't close so
 		// WAL can append without dropping the file lock
 		// WAL can append without dropping the file lock
 		w.readClose = nil
 		w.readClose = nil
-
 		if _, _, err := parseWalName(path.Base(w.tail().Name())); err != nil {
 		if _, _, err := parseWalName(path.Base(w.tail().Name())); err != nil {
 			closer()
 			closer()
 			return nil, err
 			return nil, err
 		}
 		}
-		// don't resize file for preallocation in case tail is corrupted
-		if err := fileutil.Preallocate(w.tail().File, segmentSizeBytes, false); err != nil {
-			closer()
-			plog.Errorf("failed to allocate space when creating new wal file (%v)", err)
-			return nil, err
-		}
 		w.fp = newFilePipeline(w.dir, segmentSizeBytes)
 		w.fp = newFilePipeline(w.dir, segmentSizeBytes)
 	}
 	}