Commit graph

534 commits

Author SHA1 Message Date
Seebs
7d15fc2f26 don't reduce errors with non-errors
if we got an error, we don't have to merge it. so either ctx.Err or
resp.err being non-nil means we shouldn't be reducing, but we still need
to grab the responses to make sure we waited for them all.
2021-02-26 14:26:02 -06:00
Seebs
29fddd40f6 mapper/mapReduce/worker: always wait for jobs to be finished
It's not enough to cancel jobs so their goroutines *will* exit; we have
to be certain that they *have exited* before we finish returning from,
e.g., mapReduce(), or a query can "complete" at a time when there are
still running goroutines accessing data that we're about to invalidate
when we terminate the Qcx.

A better solution would integrate this logic and control into the Qcx
and pass it through everything, rather than having the Qcx bypass
the mapper/mapperLocal and be passed into the mapFn/reduceFn via
closures. But a better solution would be a lot larger.
2021-02-26 12:47:02 -06:00
Travis
2bbe1fdde0
remove remaining references to "coordinator" 2021-02-23 17:23:09 -06:00
Kuba Podgórski
bfc24a1745 Check state in shardsByNode once stator is implemented 2021-02-17 16:02:28 +01:00
Travis
a7d4226326
only cancel() in mapper on a secondary, replica error
There is another case where cancelling here might be useful,
and that's if the query is on a primary node and the replication
factor is 1, meaning there are no secondary nodes to fail over to.
That case is handled here as well.
2021-02-16 16:29:49 -06:00
Travis
d27afc42f1
don't cancel the context if replicas should be attempted 2021-02-16 15:10:24 -06:00
Travis
8f0270acda
adjust openExistenceField() to check on disk first 2021-02-12 20:35:36 -06:00
Kuba Podgórski
2f35b51db8
Fix endpoint tests + change BitDepth type to uint64 2021-02-12 20:35:36 -06:00
Travis
5b237cae13
Merge branch 'master' into disco 2021-02-12 20:29:41 -06:00
Alan Bernstein
2773999190 Simplify response structs 2021-02-11 16:42:30 -06:00
Alan Bernstein
12462886a6 Shorten shard lists in error messages 2021-02-11 16:42:30 -06:00
tgruben
a61ed011fc
Revert "Update existence field on import-roaring requests" 2021-02-10 14:51:11 -06:00
Todd Gruben
e7f272f37f updates existence field on importroaring fixes issue (1411) 2021-02-10 12:43:27 -06:00
Travis
d192c1f24f
Merge branch 'master' into disco 2021-02-05 15:58:36 -06:00
Travis
855e1b35f5
more use of noder; remove c.nodes
disable some of the gossip logic

implement some of the stator logic
2021-01-31 23:42:49 -06:00
Nia
2961a69bd2
Merge branch 'master' into count-global 2021-01-29 11:14:02 -05:00
Nia
13db91379f
Merge branch 'master' into count-global 2021-01-29 10:57:46 -05:00
Alan Bernstein
4fba6bea82 Prevent nil pointer exception during Distinct key translation 2021-01-29 09:39:01 -06:00
Travis
1c0b926eae
Merge master into disco 2021-01-28 18:03:38 -06:00
Travis
48ac989e6a
Return zero-bit row (with Index/Field) instead of nil in executeDistinctShardSet 2021-01-26 15:47:28 -06:00
Travis
315cad679d
Return zero-bit row (with Index/Field) instead of nil in executeDistinctShardSet 2021-01-26 15:41:47 -06:00
Nia Weiss
ac09c11bad
Invoke precalls directly in count operations
This changes Count(Precall()) operations to execute the precall directly inside of the count operation, bypassing the transformation to a Precomputed() call.
Eliminating the Precomputed() step causes Count(Distinct()) to work properly on negative integers.
2021-01-26 12:44:03 -05:00
Nia Weiss
dde318ac8c
Move globally computed GroupBy rows calls into EmbeddedData
This fixes a bug where a globally computed Rows call would be computed with a subset of the shards.
2021-01-25 10:17:58 -05:00
Travis
2f66501160
finish implementing snap := ClusterSnapshot() 2021-01-24 23:22:32 -06:00
Travis
c9e6f17ae0
Merge branch 'master' into disco 2021-01-23 19:22:20 -06:00
nagamocha3000
16b5fbe40b
Merge branch 'master' into bnm-fix-1080 2021-01-21 17:37:08 +03:00
Seebs
932e84b681 handling aggregate types: add to protobuf, etc
We want to distinguish different *kinds* of GroupCounts, so we're
making the GroupCounts parent object track its type so we can keep that
correct.

Adding this to protobuf, etc, then creates some weird behaviors
because sometimes we expect []GroupCount, and sometimes we expect
*GroupCounts. This implies changes to test cases. Also, the
changes to test cases imply that some test cases are probably now
wrong; for instance, they're expecting a "sum" column, equal to zero,
when no sum was requested.

We try to make the encoder handle a []*GroupCount gotten from another
node without panicing, and avoid breaking the semantics of the existing
messages, renumbering messages or components, etc.

Since a previous version, the `.Groups` member has been privatized,
and the `.Get()` convenience accessor has been renamed `.Groups()`
and is now used consistently in a way that should reduce the risk
of nil pointers causing crashes. Also, NewGroupCounts is used in
a couple more places.
2021-01-19 16:23:15 -06:00
Cody Soyland
4ebf6f6ff7 Customize serialization of []GroupCount based on aggregate type/presence 2021-01-19 12:10:56 -06:00
Travis
1d55e671a2
go mod tidy and linter
fix race

cleanup
2021-01-15 17:48:44 -06:00
nagamocha3000
b77f9e8a43 Add timeFragments rowIterator 2021-01-15 23:36:54 +03:00
Travis
9855f4d0a0
Merge branch 'travis-test-ci' into disco-try 2021-01-15 14:31:19 -06:00
Travis
ff2d235702
change all references to use subpackages: topology, net 2021-01-15 11:47:36 -06:00
Travis
bc13834343
disco/etcd work: fix lots of races, start all cluster nodes at once.
port mapper gives out ports from 63000-65000 for the tests

fix another race

http test uses port.MustGetPort

rbf: remove :0 port request

ocd happy

test fix for grpc listener address already in use

test/disco allocates BindGRPC port from the port mapper

dump stack on each GetPort

verify each port is usable right away

server/config.go has Config.Validate() now

panic if gossip port is 0. validate server.Config

fix another gossip port 0

builds

quiet, don't dump stack on each port alloc

builds

happy linter

even gossip fallback should not be zero but rather use the port mapper
2021-01-12 21:06:12 -06:00
Matt Jaffee
48552553dc
guard against NPE when setting precomputed data
If a precomputed call returns a nil Row result somehow, that could
cause a nil pointer exception when handling the result in
handlePreCall.

In this particular case, A Distinct call on a BSI field with a filter
which returned no results could return a SignedRow{} with nil *Rows
inside of it. This only manifested if there was data in a single shard
as otherwise the reduce logic created a SignedRow with empty *Row
objects rather than nil ones. Isn't that fun?

Extra fun: the reason the filter was returning no results was not
because it was actually empty, but because of another bug where
constructing the Distinct calls to compute the aggregate of a GroupBy
doesn't take into account that the group might include an integer
field which means that the call needs to be constructed
differently. That bug is not fixed in this commit, hence the tests are
still failing, but not panicking.
2021-01-08 15:03:49 -06:00
Cody Soyland
83ce30f1c4
Fix GroupBy Distinct aggregate on int field 2021-01-08 13:35:58 -06:00
Travis
4515a24e48
change all references to use subpackages: topology, net 2021-01-06 16:09:24 -06:00
Matt Jaffee
216e28a77e
add getSorter tests, fix bugs 2021-01-05 09:54:46 -06:00
Matt Jaffee
6dccb3d6be
remove (unused) sorting code related to fields, add comments 2021-01-03 08:34:53 -06:00
Matt Jaffee
6094663e7a
fix bug with "having" and "limit" in GroupBy
the limit could get applied before "having" in some cases which could
result in results being discarded which met the having condition while
results were kept which did not, ultimately resulting in GroupBy
falsely reporting fewer results than actually existed.
2021-01-01 21:56:59 -06:00
Matt Jaffee
ea539d8241
simplify groupby sorting and fix bugs
Back out support for sorting on fields (only count and aggregate
supported for now).

Fix bug where default return of "true" caused sort to be unstable. (If
they are equal, Less should return false)

Fix bug where limit was being applied before sorting.

Fix bug where offset was not actually allowed to be an argument to
GroupBy (weird! guess we weren't testing that very well)

Apply "having" after calculating Count(Distinct) aggregate so that
having can apply to that.

Switch to stable sort to make testing easier.
2020-12-31 14:42:03 -06:00
Matt Jaffee
5fdae74812
draft of sorting groupby results 2020-12-31 14:41:52 -06:00
Matt Jaffee
16fd6a7edd
add tests for GroupBy(Distinct), fix various problems
We execute the aggregate Distinct calls after the GroupBy is complete,
and we need these to act like non-remote calls in that they forward to
all nodes, but like remote calls in that they bypass key
translation. Added a "PreTranslated" flag to the QueryRequest to
achieve this.

Discovered an issue where a nil *Row in EmbeddedData would cause a
panic in the protobuf serialization. Changed the encoding code we
control to never pass a nil *Row.

Got fed up with lack of context on errors and added wrapping to all
calls under executor.executeCall as well as a few other places.

Handled a situation where not having data on a shard for a particular
field could cause a query to error instead of just treating that
fragment as being empty. (see the switch in executeDistinctShardSet)

Stopped GroupBy from executing the Count(Distinct) aggregate on Remote
calls.

Fixed a longstanding issue where errors retrieved from remote query
calls had a garbage character at the front due to treating a protobuf
payload as an error message instead of decoding it. (see
http/client.go)
2020-12-30 08:13:41 -06:00
Cody Soyland
f099a90264
Modify aggregate distinct logic and add tests
Use execute instead of directly using executeCount
Address code review feedback (add additional filters if provided)
Add basic tests
2020-12-30 08:12:09 -06:00
Cody Soyland
b435e9d793
Add Distinct call as GroupBy aggregate 2020-12-30 08:12:08 -06:00
Matt Jaffee
790bea147f
make view and fragment not found errors constant
based on code review feedback
2020-12-28 15:59:49 -06:00
Matt Jaffee
757c8a86b5
add comments, simplify tests, move ToCSV code
generally, address code review feedback
2020-12-28 15:22:31 -06:00
Matt Jaffee
27ca9dab36
don't hide error getting sign bitmap 2020-12-28 11:14:04 -06:00
Matt Jaffee
446950979a
fix potential nil dereference in SignedRow.ToRows
This used to be possible to hit, but I think now that Distinct on a
set field returns a *Row rather than a SignedRow it isn't an issue. (I
wasn't able to trigger it in the tests). Adding the fix anyway as it
seems safer than not.

The rest of the changes are test infrastructure to make it easy to
call GRPC queries and verify the results as CSV.
2020-12-28 11:00:46 -06:00
Matt Jaffee
1372bafe02
fix bugs where row index and field weren't always being propagated
I used a "paranoia" check to find these, but then realized the check
had a ton of false positives and doing it properly wasn't going to be
straightforward. I'm leaving the paranoia stuff in unless there are
objections, because I've wanted it before and not had it.

I also removed a log line that is very verbose and I don't think helps
anyone.
2020-12-23 19:08:10 -06:00
Matt Jaffee
6ff6fa7bb8
fix comments/capitalization 2020-12-23 14:44:18 -06:00