Commit Graph

17 Commits

Author SHA1 Message Date
Fabian Reinartz eb8c9759fc Properly balance k-way operations 2017-06-13 08:25:13 +02:00
Goutham Veeramachaneni 2fa647f50b Fix missing postings in Merge and Intersect (#77)
* Test for a previous implematation of Intersect

Before we were moving the postings list everytime we create a new
chained `intersectPostings`. That was causing some postings to be
skipped. This test fails on the older version.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>

* Advance on Seek only when valid.

Issue:
Before in mergedPostings and others we advance everytime we `Seek`,
which causes issues with `Intersect`.

Take the case, where we have a mergedPostings = m merging, a: {10, 20, 30} and
b: {15, 25, 35}. Everytime we `Seek`, we do a.Seek and b.Seek.

Now if we Intersect m with {21, 22, 23, 30}, we would do Seek({21,22,23}) which
would advance a and b beyond 30.

Fix:
Now we advance only when the seeking value is greater than the current
value, as the definition specifies.

Also, posting 0 will not be a valid posting and will be used to signal
finished or un-initialized PostingsList.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>

* Add test for Merge+Intersect edgecase.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>

* Add comments to trivial tests.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-05-12 09:44:41 +02:00
Tomasz Elendt d7ad9d2679 Fix various postings implementations
* newIntersectPostings and newMergePostings should not advance passed
  postings automatically.
* listPostings and bigEndianPostings should not panic with index out
  of range when At() is called before Next()/Seek().
* Seek() call should advance listPostings/bigEndianPostings.
2017-04-24 23:07:06 +02:00
Fabian Reinartz a5322c50fc Merge pull request #36 from Gouthamve/tests
Tests For Querier and Postings
2017-04-24 10:50:59 +02:00
Fabian Reinartz 778103b450 Add liecence file and headers 2017-04-10 20:59:45 +02:00
Goutham Veeramachaneni f8a8b77976
postings: Fix bad test and revert changed logic
A bad test was introduced a couple of commits ago which also made
changes to pass the bad test. Fixed the test and revert the changes.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-04-09 17:20:39 +05:30
Goutham Veeramachaneni 329dc1fa6c
Add Tests For mergedPostings.Seek
* Renamed mergedPostings to make it consistent across the repo
* Fixed bug with Seek
* Added Tests for Seek

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-04-08 20:42:29 +05:30
Goutham Veeramachaneni 7b94a4e17d
Rename bytePostings To bigEndianPostings
* To be more specific about the contents of the byte slice.
2017-03-27 14:04:42 +05:30
Goutham Veeramachaneni efb0dfe1be
Implement Postings Iterator Over Bytes
Closes fabxc/tsdb#18
2017-03-26 23:40:12 +05:30
Fabian Reinartz 1c80c33e72 Fix bug of unsorted postings lists being created
The former approach created unordered postings list by either
map iteration of new series being unsorted (fixable) or concurrent
writers creating new series interleaved.

We switch back to generating ephemeral references for a single batch.
Newly created series have to be re-set upon the next insert.
2017-01-13 16:22:20 +01:00
Fabian Reinartz c7f5590a71 Ensure order of postings when adding new series 2017-01-13 15:25:11 +01:00
Fabian Reinartz 62b8ded0a5 Rename iterator value getters to At() 2017-01-02 13:33:06 +01:00
Fabian Reinartz 1e1a37b15b Remove double-reference in chunk hashmap 2016-12-31 10:19:02 +01:00
Fabian Reinartz 286293802b Add merge postings 2016-12-28 11:02:19 +01:00
Fabian Reinartz ab7fbc05ad Zero timestamp as base, use binary search list postings 2016-12-28 08:50:20 +01:00
Fabian Reinartz dd72b52098 Add postings intersection 2016-12-27 11:32:10 +01:00
Fabian Reinartz 2a825f6c28 Consolidate mem index into HeadBlock 2016-12-22 01:12:28 +01:00