diff --git a/index/scorch/persister.go b/index/scorch/persister.go index e82e441e6..b90899f25 100644 --- a/index/scorch/persister.go +++ b/index/scorch/persister.go @@ -543,6 +543,13 @@ func prepareBoltSnapshot(snapshot *IndexSnapshot, tx *bolt.Tx, path string, } } + if snapshot.parent != nil { + val := make([]byte, 8) + bytesWritten := atomic.LoadUint64(&snapshot.parent.stats.TotBytesWrittenAtIndexTime) + binary.LittleEndian.PutUint64(val, bytesWritten) + internalBucket.Put(TotBytesWrittenKey, val) + } + var filenames []string newSegmentPaths := make(map[uint64]string) @@ -697,6 +704,7 @@ var boltMetaDataKey = []byte{'m'} var boltMetaDataSegmentTypeKey = []byte("type") var boltMetaDataSegmentVersionKey = []byte("version") var boltMetaDataTimeStamp = []byte("timeStamp") +var TotBytesWrittenKey = []byte("TotBytesWritten") func (s *Scorch) loadFromBolt() error { return s.rootBolt.View(func(tx *bolt.Tx) error {