Commit graph

302 commits

Author SHA1 Message Date
Matt Jaffee
56ba127210 set n based on array length instead of incrementing repeatedly 2017-05-30 16:09:02 -05:00
Todd Gruben
1c468fb38e bitmap container xor empty test 2017-05-30 15:07:10 -05:00
Todd Gruben
b5bd8433cc added empty and equivlence testing 2017-05-30 13:27:11 -05:00
Todd Gruben
7090ee4d7a @jaffee cleanup 2017-05-30 12:39:23 -05:00
Todd Gruben
498045f25a added copy optimization ; type check; and code cleanup 2017-05-30 11:18:05 -05:00
Todd Gruben
aa713e3832 add support for bit flip (negate) in roaring 2017-05-25 10:07:29 -05:00
Matt Jaffee
da961be614 rewrite intersectCountArrayBitmap for perf test 2017-05-24 12:38:50 -05:00
Todd Gruben
2182534cc7 added xor support to roaring 2017-05-22 16:51:53 -05:00
Matt Jaffee
e90e1455db remove branch and always count last container 2017-05-22 10:38:40 -05:00
Matt Jaffee
6b3b459659 add license to roaring_internal_test 2017-05-22 09:46:52 -05:00
Matt Jaffee
a5918d01d9 fix offset check to make sense 2017-05-19 17:09:22 -05:00
Matt Jaffee
c0ddbe0e3f fix bitmapCountRange and test
had been thinking that index 0 was the most significant bit, but based on the
bitmapAdd function, it must be the least significant bit
2017-05-19 15:18:07 -05:00
Matt Jaffee
fb4651cdb8 fix 3 separate bugs in bitmapCountRange
in order of the diff:

1. When the start and end of the range fall in the same word, special handling
is needed to "mask" off the beginning and end of the word simultaneously to
avoid counting bits at the beginning or end of the word that aren't in the
range.

2. `i++` is needed at the end of the first partial word to avoid counting this
word in the next block.

3. the shift amount for right shifts is 64 - (end % 64) rather than just end
% 64. If end is (e.g.) 68, then 68 - 64 is 4 and we are only interested in the
first 4 bits of the word, so we must right shift by 60 bits, not 4 bits.
2017-05-18 12:04:37 -05:00
Todd Gruben
fbae0f4d15 asm build options for non amd64 2017-05-15 11:31:41 -05:00
Damian Gryski
62d6edd1ca roaring: fix vet issues with the assembly code
assembly_amd64.s:3: [amd64] hasAsm: wrong argument size 0; expected $...-1
assembly_amd64.s:11: [amd64] POPCNTQ: wrong argument size 8; expected $...-16
assembly_amd64.s:12: [amd64] POPCNTQ: unknown variable x; offset 0 is memory+0(FP)
assembly_amd64.s:17: [amd64] BSFQ: wrong argument size 8; expected $...-16
assembly_amd64.s:18: [amd64] BSFQ: unknown variable x; offset 0 is memory+0(FP)
assembly_amd64.s:28: [amd64] popcntSliceAsm: invalid offset s+8(FP); expected s+0(FP), s_base+0(FP), s_len+8(FP), or s_cap+16(FP)
assembly_amd64.s:43: [amd64] popcntMaskSliceAsm: invalid offset s+8(FP); expected s+0(FP), s_base+0(FP), s_len+8(FP), or s_cap+16(FP)
assembly_amd64.s:63: [amd64] popcntAndSliceAsm: invalid offset s+8(FP); expected s+0(FP), s_base+0(FP), s_len+8(FP), or s_cap+16(FP)
assembly_amd64.s:82: [amd64] popcntOrSliceAsm: invalid offset s+8(FP); expected s+0(FP), s_base+0(FP), s_len+8(FP), or s_cap+16(FP)
assembly_amd64.s:101: [amd64] popcntXorSliceAsm: invalid offset s+8(FP); expected s+0(FP), s_base+0(FP), s_len+8(FP), or s_cap+16(FP)
2017-05-04 11:01:10 +02:00
Travis
ea4bf0a1d3
Fix roaring test: TestBitmap_Quick_Array1
When the random number generator was coming up 0,
then `a = []uint64{}`. This caused the bitmap `bm` to be empty.
In this case, `bm.Slice()` is a nil slice, while the expected
slice is an empty slice (i.e. they are not considered equal):
got: ([]uint64) <nil>
exp: ([]uint64) {}
2017-04-29 18:04:59 -05:00
Cody Soyland
3996b56b88 Apply Apache License 2.0 2017-04-28 14:22:03 -05:00
Travis
c3ed12c20e Refactor fragment.bitmap() so that it leverages bitmapCache and so that
it's no longer reponsible for updating the count cache.
This commit also helps SetBit/ClearBit performance by allowing them
to work against data from `bitmapCache` instead of loading bitmaps
from fragment.storage every time.
2017-03-06 11:06:22 -06:00
Todd Gruben
43ede4d9c8 WIP increase caching and topn adjustments 2017-02-21 09:28:01 -06:00
Todd Gruben
e62bd5fad5 WIP snapshot optimization 2017-02-16 15:43:27 -05:00
Travis
1e816b401c Adds Todd's performance improvements:
- Ingore asserts in fragment container.
- Only log queries that take longer than 90 seconds.

TODO:
- address the TODOs that make the asserts configurable.
2017-01-27 13:16:27 -06:00
Cody Soyland
5206461d51 Migrate from Umbel to Pilosa organization on Github 2016-11-28 15:21:11 -06:00
Ben Johnson
f23bb05e8d Clear empty containers, add assertions. 2016-11-03 13:42:46 -06:00
tgruben
709fbc4308 Merge pull request #130 from benbjohnson/check
Add pilosactl check.
2016-10-26 20:34:10 -05:00
Ben Johnson
3192897f55 Add pilosactl check. 2016-10-26 13:51:23 -06:00
Ben Johnson
feceaf429e Avoid array write if length is zero. 2016-10-26 13:47:37 -06:00
Todd Gruben
ad852fdbf1 cleaned up constant 2016-09-23 16:04:22 -05:00
Todd Gruben
5f65636199 fix roaring.Difference crash 2016-09-23 13:27:35 -05:00
Todd Gruben
6a8973f7c9 fix for intersect and updated tests 2016-09-22 16:47:39 -05:00
Ben Johnson
46bef724a5 Add import sorting command.
Introduces new `pilosactl sort` to sort import files by bit
position so they can be inserted faster. Also optimizes container
scanning and adds a `-buffer-size` flag to `import`.
2016-09-21 14:33:24 -06:00
Ben Johnson
cf4297a771 Optimize TopN() w/ source query.
This commit makes several changes to optimize the TopN() query:

- Reduce highbits() back from 24-bits to 16-bits.
- Reduce MaxArraySize back from 2^20 to 4096.
- Optimize bitmap count invalidation.
- Parallelize TopN() across nodes.
- Parallelize TopN() across slices.
2016-09-13 14:55:56 -06:00
Ben Johnson
39ed7de5c4 Optimize IntersectionCount for Array+Bitmap
Reworks the `roaring.intersectionCountArrayBitmap()` call to avoid
using an iterator. Performance of the included benchmark went from
2.5ms to 1.1ms.

Some of the issue with intersectionCount is the increased size of
bitmaps and slices and I need to do additional testing with various
sizes.
2016-09-07 10:13:31 -06:00
Ben Johnson
04c814141a Optimize bitmap with zero copy
Segments bitmaps by slice and changes `Fragment.Bitmap()` to return
bitmaps with segments which are offset ranges of mmapped bitmaps.
2016-08-25 13:30:25 -06:00
Ben Johnson
650e03cc79 add CountRange()
This commit adds `roaring.Bitmap.CountRange()` to return the number
of bits in a subrange of a bitmap. This significantly improves
server start time and is needed for upcoming zero copy bitmap
optimizations.
2016-08-15 16:03:25 -06:00
Ben Johnson
a063421467 serialize cache flush
This commit moves the cache flush to the `Index` and only serializes
a single fragment at a time.

Also included in this commit is the `inspect` command for the
`pilsoactl` binary. This provides insight into pilosa data files.
2016-08-05 14:58:37 -06:00
Ben Johnson
36cd2c84c1 optimize union() & difference()
This commit moves the `Union()` and `Difference()` operations into
the `roaring` package to improve performance.
2016-06-28 14:29:37 -06:00
Ben Johnson
a8feb985e1 roaring: change bit split to 40/24
This commit changes the `roaring.Bitmap` to use a 40/24 split in
the high and low bits. This change also requires the low bits
to use `uint32` instead of `uint16`.
2016-06-20 20:37:05 -06:00
Ben Johnson
89286ac23a optimize intersect()
This commit moves bitmap intersection into the `roaring` package
in order to reduce allocations.

Benchmarks against real world datasets show a speed improvement of
353%. Previously, intersection operated at approximately 5.6M
bits/sec against two 60K bit bitmaps with 30% overlap. The new
intersection operates at approximately 20M bits/sec.
2016-06-14 15:19:21 -06:00
Todd Gruben
dab399e328 added logging on import;crashing bug on sync on empty fragment 2016-06-07 15:25:37 -05:00
Ben Johnson
08659c350b optimize intersection count
This commit moves the computation of the intersection count to
the `roaring` package so that no allocations are required. The
implementation operates at the roaring container level and has
specialized functions for array-array, array-bitmap, and
bitmap-bitmap container pairs.
2016-06-02 16:03:21 -06:00
Todd Gruben
9c5b4829e5 patched in assembly routines for reference 2016-05-27 11:15:14 -05:00
Ben Johnson
722d697228 refactor in-memory bitmap storage
This commit changes the underlying storage for `Bitmap` from a
red-black tree to a roaring bitmap. It also removes bitmaps from
the cache and only stores the bitmap count.
2016-05-24 15:01:49 -06:00
Ben Johnson
de698aa03e consensus block merge
This commit refactors the anti-entropy system to fetch data from
all replicated blocks and only set/clear bits which deviate from
the consensus between all blocks.

An example of this is if 3 nodes had the following bits set for
a single bitmap:

	Node A: 1 2 3
	Node B:   2   4
	Node C: 1 2   4

Then only bits which are set on a majority will be set. In this
case bits 1, 2, & 4 are set but 3 only exists on a single node.

The node performing the merge would then determine the following
set/clear diffs for each node:

	Node A: clear(3), set(4)
	Node B: set(1)
	Node C: none

Once the merge is performed and all nodes receive their diff
instructions then the nodes will be in sync:

	Node A: 1 2 4
	Node B: 1 2 4
	Node C: 1 2 4

There still exists situations where bits can be reset. If Node A
is up and Node B & C are down then Node A's bits will be reset
once B & C come back online. We should add write consistency
settings for incoming writes so that we can ensure that a quorum
is written to before returning a success. This is outside the
scope of this commit though.
2016-05-06 16:19:10 -06:00
Todd Gruben
ee95aec91c check for iterator overflow 2016-04-26 14:41:37 -05:00
Ben Johnson
8f4d7d50c3 active anti-entropy
This commit adds active anti-entropy via a merkle tree structure.
2016-04-12 19:48:32 -06:00
Ben Johnson
569bafdc7d add bulk call support to the query endpoint
This commit changes the `pql.Query` so that it can accept one or more
top-level calls instead of only one.

The query request format change because a query with a single call is
still valid. However, the result format now returns a `results` field
that has one result for each top-level call. The `profiles` field is
still the same, however, it combines all profiles from all bitmap
responses into one return so that there's not duplicate attributes.

Fixes #59
2016-03-08 14:34:37 -07:00
Todd Gruben
0d620aae61 align more with go idioms 2016-02-24 15:02:24 -06:00
Todd Gruben
9fc6a39d65 adjust SetBit/ClearBit to releably report bit change 2016-02-24 14:00:41 -06:00
Ben Johnson
039ca1d91b fix roaring array append
This commit fixes a bug where appends to an array container did
not cause it to roll over to a bitmap container when it reached
the max array size.
2016-01-09 12:27:20 -07:00
Ben Johnson
bc11f36862 support uint64 in roaring bitmaps
This commit refactors the roaring bitmaps to use uint64 values
instead of uint32 values. This is required for the size of
values we need in pilosa.

This change is not backwards compatible with the previous data
format so any existing data directories need to be removed before
using this code.
2016-01-07 13:43:57 -07:00