0
0
Fork 0
Commit Graph

29 Commits

Author SHA1 Message Date
Sreekanth Sivasankaran 980ce9ebb3 MB-28753 - document number "xxx" not found
err with update workload

Introducer was incorrectly updating the offsets slice
of segments, by considering only the live doc count
while computing the "running". This can result in
incorrectly computing the residing segment as well as
the local doc numbers while loading a document after
a search hit.
2018-03-19 12:11:37 +05:30
Marty Schoch 45e0e5c666 memoize the size of an entire index snapshot
by memoizing the size of index snapshots and their
constituent parts, we significantly reduce the amount
of time that the lock is held in the app_herder, when
calculating the total memory used
2018-03-15 17:25:05 -04:00
Steve Yen a5253bfe2b scorch persister goes through introducer to affect root
This change allows the introducer to become the only goroutine to
modify the root, which in turn allows the introducer to greatly reduce
its root lock holding surface area.
2018-03-02 16:14:28 -08:00
Steve Yen 1b661ef844 stats cleanup, renaming, gauges replaced with counters 2018-02-28 17:03:28 -08:00
Sreekanth Sivasankaran 4b742505aa adding stats for scorch 2018-02-28 15:31:55 +05:30
Steve Yen a32362ba2e MB-28403: scorch introduceMerge doesn't prealloc segments capacity
There's now multiple competing merge activities (file-merging and
in-memory merging during persistence), so the simple math to
precalculate capacity for the slice of segments in introduceMerge() no
longer works for all cases and might have negative capacity.

This change removes that (sometimes wrong) precalculation, and instead
depends on append() to grow the slice correctly.
2018-02-27 15:14:34 -08:00
Steve Yen 99ed127176 scorch zap merge optimize newDocNums lookup to outside of loop
And, also a "go fmt".
2018-02-26 14:23:55 -08:00
Sreekanth Sivasankaran 4109e327ff
Merge pull request #771 from sreekanth-cb/merge_handling_empty_seg_tasks
Fix for empty segment merge handling
2018-02-24 10:48:31 +05:30
Sreekanth Sivasankaran 683e195ac4 adding empty segment handling during introduction
cleaning up the segment live size check
2018-02-24 07:03:27 +05:30
Steve Yen c50d9b4023 scorch conditional merging during persistSnapshot()
As part of this change, there are nw helper methods --
persistSnapshotMaybeMerge() and persistSnapshotDirect().
2018-02-23 09:17:02 -08:00
Sreekanth Sivasankaran 606a270669 Fix for empty segment merge handling
Avoid creating new files with emtpy segments tasks
during the merge operation, skips the
incorrect appending of a newer segment during merge.
2018-02-15 16:44:20 +05:30
Steve Yen 34fd77709f scorch unlocks in introduceSegment's DocNumbers() error codepath 2018-01-20 17:17:16 -08:00
abhinavdangeti 111f0d0721 Updated Rollback APIs
New APIs:
+ RollbackPoints()
    - Retrieves the available list of rollback points: epoch+meta.
    - The application will need to check with the meta to decide
    on the rollback point.
+ Rollback()
    - API requires a rollback point identified by the first API.
    - Atomically & Durably rolls back the index to specified point,
    provided the specified rollback point is still available.
+ Unit test: TestIndexRollback
    - Writes a batch.
    - Sets the rollback point.
    - Writes second batch.
    - Rollback to previously decided point.
    - Ensure that data is as is before the second batch.
2018-01-04 13:21:58 -08:00
abhinavdangeti becd4677cd Adding num_items_introduced, num_items_persisted stats
+ Adding new entries to the stats struct of scorch.
+ These stats are atomically incremented upon every segment
  introduction, and upon successful persistence.
2017-12-28 14:07:44 -07:00
abhinavdangeti dcabc267a0 Wait for rollback'ed snapshot to persist 2017-12-27 10:06:29 -07:00
abhinavdangeti 679f1ce9c3 scorch APIs to support rollback
- PreviousPersistedSnapshot
- SnapshotRevert

+ unit test
2017-12-19 10:53:08 -08:00
Steve Yen 34f5e2175f scorch fix persister for lost notifications on no-data batches
With the previous commit, there can be a scenario where batches that
had internal-updates-only can be rapidly introduced by the app, but
the persisted notifications on only the very last IndexSnapshot would
be fired.  The persisted notifications on the in-between batches might
be missed.

The solution was to track the persisted notification channels at a
higher Scorch struct level, instead of tracking the persisted channels
at the IndexSnapshot and SegmentSnapshot levels.

Also, the persister double-check looping was simplified, which avoids
a race where an introducer might incorrectly not notify the persister.
2017-12-17 12:30:05 -08:00
Steve Yen ecbb3d2df4 scorch handles non-updating batches better
This commit improves handling when an incoming batch has internal-data
updates only and no doc updates.  In this case, a nil segment instead
of an empty segment instance is used in the segmentIntroduction.  The
segmentIntroduction, that is, might now hold only internal-data
updates only.

To handle synchronous persistence, a new field that's a slice of
persisted notification channels is added to the IndexSnapshot struct,
which the persister goroutine will close as each IndexSnapshot is
persisted.

Also, as part of this change, instead of checking the unsafeBatch flag
in several places, we instead check for non-nil'ness of these
persisted chan's.
2017-12-17 08:51:23 -08:00
Marty Schoch 149a26b5c1 merge deletion and cacheddocs fixes discussed in meeting 2017-12-14 10:27:39 -05:00
Sreekanth Sivasankaran 1066ee7d22 DocumentVisitFieldTerms Scorch implementation level1 2017-12-14 12:38:29 +05:30
Steve Yen c0cc46a2be scorch cleanup of the rootBolt of old snapshots
A new global variable, NumSnapshotsToKeep, represents the default
number of old snapshots that each scorch instance should maintain -- 0
is the default.  Apps that need rollback'ability may want to increase
this value in early initialization.

The Scorch.eligibleForRemoval field tracks epoches which are safe to
delete from the rootBolt.  The eligibleForRemoval is appended to
whenever the ref-count on an IndexSnapshot drops to 0.

On startup, eligibleForRemoval is also initialized with any older
epoch's found in the rootBolt.

The newly introduced Scorch.removeOldSnapshots() method is called on
every cycle of the persisterLoop(), where it maintains the
eligibleForRemoval slice to under a size defined by the
NumSnapshotsToKeep.

A future commit will remove actual storage files in order to match the
"source of truth" information found in the rootBolt.
2017-12-13 15:53:31 -08:00
Steve Yen c13ff85aaf scorch ref-counting
Future commits will provide actual cleanup when ref-counts reach 0.
2017-12-13 14:48:07 -08:00
Marty Schoch 50471003dc basic refactoring of introducer to make it more readable 2017-12-13 16:30:39 -05:00
Marty Schoch f83c9f2a20 initial cut of merger that actually introduces changes 2017-12-13 13:41:03 -05:00
Marty Schoch adac4f41db initial version of scorch which persists index to disk 2017-12-06 18:33:47 -05:00
Marty Schoch 22ffc8940e update segment API to return error in key places 2017-12-04 18:06:06 -05:00
Marty Schoch b74cf4b081 add copyright header to all new files in scorch 2017-12-01 15:42:50 -05:00
Steve Yen 398dcb19b3 scorch introducer uses the roaring.Or(x, y) API
Instead of cloning an input bitmap, the roaring.Or(x, y)
implementation fills a brand new result bitmap, which should be allow
for more efficient packing and memory utilization.
2017-11-30 10:37:10 -08:00
Marty Schoch 23f6dc1cc6 working in-memory version 2017-11-29 11:33:35 -05:00