diff --git a/cmd/es-node/utils.go b/cmd/es-node/utils.go index e47c29e7..2334748d 100644 --- a/cmd/es-node/utils.go +++ b/cmd/es-node/utils.go @@ -170,7 +170,7 @@ func createDataFile(cfg *storage.StorageConfig, shardIdxList []uint64, datadir s df, err := es.Create(dataFile, startChunkId, chunkPerKv*cfg.KvEntriesPerShard, 0, cfg.KvSize, uint64(encodingType), cfg.Miner, cfg.ChunkSize) if err != nil { - log.Error("Creating data file", "error", err) + log.Error("Creating data file", "file", dataFile, "error", err) return nil, err } log.Info("Data file created", "shard", shardIdx, "file", dataFile, "kvIdxStart", df.KvIdxStart(), "kvIdxEnd", df.KvIdxEnd(), "miner", df.Miner()) diff --git a/ethstorage/data_file.go b/ethstorage/data_file.go index 3c27bdfb..95c9a523 100644 --- a/ethstorage/data_file.go +++ b/ethstorage/data_file.go @@ -90,12 +90,13 @@ func Create(filename string, chunkIdxStart, chunkIdxLen, epoch, maxKvSize, encod file, err := os.Create(filename) if err != nil { - return nil, err + return nil, fmt.Errorf("create file error: " + err.Error()) } + offset := int64((chunkSize + 32) * chunkIdxLen) // actual initialization is done when synchronize - err = fallocate.Fallocate(file, int64((chunkSize+32)*chunkIdxLen), int64(HEADER_SIZE)) + err = fallocate.Fallocate(file, offset, int64(HEADER_SIZE)) if err != nil { - return nil, err + return nil, fmt.Errorf("fallocate failed. offset=%d, error=%s", offset, err.Error()) } dataFile := &DataFile{ file: file,