Commit graph

7297 commits

Author SHA1 Message Date
Ben Johnson
bc4ad866c6
Merge branch 'master' into timestamp-epoch 2021-04-14 09:56:25 -06:00
seebs
8d1b1f24f9
Merge pull request #1551 from seebs/heartbeat
etcd: overhaul interactions to use heartbeats and cache things only until something changes.
2021-04-14 10:49:57 -05:00
Kuba Podgórski
29fe5cabaa
Merge branch 'master' into heartbeat 2021-04-14 17:10:20 +02:00
seebs
ee629bfd6a
Merge pull request #1569 from ajnavarro/improvement/reduce-executor-test-execution-time
[CORE-438] Reduce executor tests execution time from 2:30 to 30s reusing clusters.
2021-04-14 09:58:59 -05:00
Ben Johnson
ea01f7e37c Switch timestamp field to use epoch instead of min/max 2021-04-14 08:46:37 -06:00
Antonio Navarro Perez
43c230039f Reduce executor tests execution time from 2:30 to 30s reusing clusters.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-04-14 11:30:02 +02:00
Seebs
7497d5fbe2 artificially increase heartbeat TTL for tests only
CI systems sometimes hiccup for five seconds, which causes heartbeat leases
to fail and breaks all sorts of things. As a workaround, update heartbeat
TTL for tests only. This might in turn cause different failures to do
with leader elections, but in theory those should be handled now?
2021-04-13 12:37:07 -05:00
Seebs
0638101d2a cluster state checking cleanups and fixes
A while back we started just polling the reported cluster state of one node
when starting a cluster for tests. This works fine if we're doing fresh
new etcd queries for every single operation -- but that's insanely
expensive, it turns out.

When we use the watcher, some nodes will report stale data for "a
while", where "a while" appears to be easily a couple dozen milliseconds.
This is probably irrelevant in most real-world cases, because the common
case (detecting a node going down) means that we have at least five
seconds after a node goes down before etcd notices the lease expiring,
and a few milliseconds more or less won't matter.

But we have tests that assume either that node 0 is always the
coordinator (wrong) or that waiting for node 0 to think the cluster
is up means that every node in the cluster thinks the cluster is up,
or at least that it means that the coordinator thinks the cluster is
up. We retried later operations but not the initial ones against
the coordinator.

In fact, we probably want to wait for the entire cluster to think
it's up before we start trying things on clusters.

We also replace the "CheckClusterState" function with the existing
AwaitState call, or a new AssertState which errors out since that's
the way we usually use AwaitState anyway.

In the AwaitPrimaryState function, which used to be
AwaitCoordinatorState in a different long-lost revision, we have
to delay until a primary node is available, or fail if one does
not become available, to avoid a panic. This probably shouldn't
happen anymore, because of the last change:

Also, rovide dummy topology.Node entries before metadata is read.

During initial startup, we want to be able to do things like determine
which node is the primary, even before we've read metadata from them.

To do this, we populate the node list with dummy entries that just have
the ID (the only part we need to sort our list), and a node state of
UNKNOWN.

This breaks the fancy logic for determining whether or not to update
the node data, because the initial status of UNKNOWN matches what we
get from SetMetadata giving us new data so we end up not realizing
that this was actually a meaningful change. But actually, that's
a pretty niche optimization; we usually only get state changes when
there's an actual change in state. The updates here are cheap
and only happen after a write (or on the first query) so it's not
worth making the logic a lot fancier to make it work, when we can
just do the simple thing and update any time the dirty flag is set.

We also standardize on a 50ms delay, because 1ms delays were
really expensive when each check was hitting etcd multiple times,
and 50ms is Usually Long Enough.
2021-04-13 12:37:07 -05:00
Seebs
d1752a7af7 switch to using a watcher to watch etcd changes
This is a significant overhaul! Quite a lot of things changed here.

Basically: Prior to this, every request for data from etcd implies
requesting the current live data from etcd, and then unpacking it or
extracting it in some way. This is expensive, which is why we have
a cache in front of it.

We don't need to do that! We can use a Watch, which notifies us
of changes as changes happen. However, there's some challenges and
difficulties along the way, and there's a couple of other changes
which are included here because it's a pain to try to separate them
out.

1. We require a logger to be provided to create our internal Etcd
wrapper. We then use that logger, instead of `fmt.Printf`. This makes
debugging messages work better, and also diagnostics, and so on.

2. The internal client that we are reusing can enter a failed state
after a leader election, in which case we have to recreate the client
to have a working client. We add a new internal-use method,
`retryClient`, which wraps a function which takes an etcd client
and returns an error, and checks for leader-election type errors
and retries creating the client when they happen. That last bit
has not been successfully tested because it's actually really hard
to trigger this now. (Because it was related in part to the
amount of etcd traffic we were producing, which is reduced.)

3. The general swap over from looking things up to unpacking things
as they come in, then returning those already-unpacked things when
we get requests.

With this change, *many tests will fail*. That is addressed by
a separate commit which addresses the secondary problem, which is
that some of our test harness code was relying on the assumption
that if any node in a cluster thinks the cluster is up, every node
will. That was usually true when we were doing everything as
expensive fully-synchronized cluster checks, but becomes significantly
less reliably true in real-world cases where nodes are also
going down sometimes, or nodes are going up and down unexpectedly.
2021-04-13 12:37:07 -05:00
Seebs
fd8a19278c add TestMain wrapper in ctl
The TestMain wrapper gets us the fancy testhook stuff tracking whether we're
deallocating things as expected, and we probably want that.
2021-04-13 12:37:07 -05:00
Seebs
6b1cd1e43b drop etcd-with-cache option
The new etcd implementation has internal caching-like behavior which is
much more reliable (it doesn't use a TTL, it just updates when there's updates
to process) so we don't need this cache.
2021-04-13 12:37:07 -05:00
Ben Johnson
6616b0d6f0
Merge pull request #1570 from molecula/extract-timestamp
Fix timestamp Extract()
2021-04-13 11:18:19 -06:00
Ben Johnson
7863a97add
Merge branch 'master' into extract-timestamp 2021-04-13 10:36:31 -06:00
Alan Bernstein
a0992e0393
Merge pull request #1573 from alanbernstein/logger-prefixes-again
CORE-72 Add log prefix levels
2021-04-12 22:57:42 -05:00
Alan Bernstein
ce4ed1d81d Apply review suggestion
typo fix

Co-authored-by: Travis Turner <travis@pilosa.com>
2021-04-12 22:25:26 -05:00
Alan Bernstein
54ff05c266 Apply review suggestion
typo fix

Co-authored-by: Travis Turner <travis@pilosa.com>
2021-04-12 22:25:26 -05:00
Alan Bernstein
177c27dc31 Switch to new logger in client code (go-pilosa) 2021-04-12 22:25:13 -05:00
Alan Bernstein
285d0a0af8 Add log prefix levels 2021-04-12 20:33:39 -05:00
tgruben
ebbb196a23
Merge pull request #1560 from tgruben/delete
[CORE-245] added pql delete function
2021-04-12 16:47:40 -05:00
tgruben
83eb82f271
Merge pull request #5 from seebs/delete
Delete hackery
2021-04-12 16:22:26 -05:00
Seebs
2833365aae reuse the findExisting filter between fields, drop separate hack for existence
The existence field wasn't working because runs were broken for filters in
RBF. Fixing that allows us to simplify the logic. Also, we reuse the
findExisting filter because the filter's cached collection of containers
can be reused between things, allowing us to reduce allocations when
there's a lot of views.
2021-04-12 16:14:45 -05:00
Seebs
269837414e rbf/intoContainer: ensure correct N, avoid recounting
The remake container logic (used to avoid allocating extra containers while
applying filters) relied on roaring recomputing N, which it did for bitmaps
but didn't do for runs. Fix this both ways; it would now do that for runs,
but also we add "with explicit N" variants and use those since we have a
correct count already, and don't need it. This means fewer popcounts on
bitmaps, and working at all on runs.
2021-04-12 16:13:16 -05:00
Ben Johnson
2864a851ab Fix timestamp Extract() 2021-04-12 13:58:46 -06:00
tgruben
84c269bfc0
Update delete_test.go 2021-04-12 13:38:58 -05:00
tgruben
2d85918f43
Merge branch 'master' into delete 2021-04-09 14:31:40 -05:00
Samir Patel
da749cc757
Merge pull request #1563 from 54mir/timestamp-in-orm
Replicate timefield functionality in pilosaclient
2021-04-09 13:36:39 -05:00
tgruben
b6c80969a1
Merge branch 'master' into timestamp-in-orm 2021-04-09 12:51:36 -05:00
tgruben
f6632bcaca
Merge branch 'master' into delete 2021-04-09 12:51:03 -05:00
Ben Johnson
eb119d2d35
Merge pull request #1568 from molecula/fix-int-fk
Remove integer fk error check
2021-04-09 11:50:41 -06:00
tgruben
3bc4309a96
Merge branch 'master' into delete 2021-04-09 12:41:31 -05:00
tgruben
12748d75d3
Merge branch 'master' into timestamp-in-orm 2021-04-09 12:41:12 -05:00
Ben Johnson
fbd713d435
Merge branch 'master' into fix-int-fk 2021-04-09 11:28:07 -06:00
Ben Johnson
84f9fde25a
Merge pull request #1567 from molecula/import-timestamp-values
Fix timestamp value import
2021-04-09 11:28:01 -06:00
Ben Johnson
e1909661d5 Remove integer fk error check 2021-04-09 11:01:28 -06:00
Ben Johnson
5defbe3ef2 Fix timestamp value import 2021-04-09 10:56:25 -06:00
tgruben
a60c70b2a5
Merge branch 'master' into delete 2021-04-09 10:26:30 -05:00
tgruben
4b484f41f2
Merge branch 'master' into timestamp-in-orm 2021-04-09 10:20:46 -05:00
Ben Johnson
8802856120
Merge pull request #1564 from molecula/timestamp-fixes
Fix timestamp field issues
2021-04-09 09:01:30 -06:00
Ben Johnson
485c1c888b
Merge branch 'master' into timestamp-fixes 2021-04-09 08:31:55 -06:00
Nia
95dd262bb3
Merge pull request #1559 from niaow/id-alloc-desync-structured-error
[CORE-386] Change ID allocation to return a structured error on offset desync
2021-04-09 10:28:26 -04:00
Ben Johnson
d70eb737cb Fix timestamp field issues 2021-04-09 08:26:12 -06:00
Nia
6140fc9d4c
Merge branch 'master' into id-alloc-desync-structured-error 2021-04-09 09:16:25 -04:00
Todd Gruben
ac7a8c3dd5 validate existence 2021-04-09 07:24:43 -05:00
Kuba Podgórski
6caae41432
Merge pull request #1565 from kuba--/fix-panic
Fix panic on field not found on /import
2021-04-09 14:01:07 +02:00
Kuba Podgórski
c021b873d5 Fix panic on field not found on /import 2021-04-09 13:38:39 +02:00
Samir Patel
b1d1ac0cae
Merge branch 'master' into timestamp-in-orm 2021-04-08 13:40:14 -05:00
Samir
83932041a5 Replicate timefield functionality in pilosaclient 2021-04-08 13:21:49 -05:00
tgruben
784c78e313
Merge branch 'master' into delete 2021-04-08 10:05:31 -05:00
Nia
dbf9b14963
Merge pull request #1562 from niaow/update-before-install
Update the package database before installing dependencies in CI
2021-04-08 10:46:47 -04:00
Todd Gruben
dcd6c649e8 skip blue-green on delete test 2021-04-08 09:37:34 -05:00