From d0644fec129f08c58f6df3a298e0a314f590a6d0 Mon Sep 17 00:00:00 2001 From: Steve Yen Date: Thu, 8 Feb 2018 12:17:19 -0800 Subject: [PATCH] scorch persistSnapshot comments update See also: https://github.com/blevesearch/bleve/issues/763 --- index/scorch/persister.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index/scorch/persister.go b/index/scorch/persister.go index 388c1405..7b1cd837 100644 --- a/index/scorch/persister.go +++ b/index/scorch/persister.go @@ -239,8 +239,13 @@ func (s *Scorch) persistSnapshot(snapshot *IndexSnapshot) error { } } - // only alter the root if we actually persisted a segment - // (sometimes its just a new snapshot, possibly with new internal values) + // we need to swap in a new root only when we've persisted 1 or + // more segments -- whereby the new root would have 1-for-1 + // replacements of in-memory segments with file-based segments + // + // other cases like updates to internal values only, and/or when + // there are only deletions, are already covered and persisted by + // the newly populated boltdb snapshotBucket above if len(newSegmentPaths) > 0 { // now try to open all the new snapshots newSegments := make(map[uint64]segment.Segment)