No description
Find a file
Seebs b3a4e52a13 simplify, streamline, and possibly debug embedded etcd
The root problem this is attempting to address is sporadic
weird cases in which etcd mistakenly thinks it's down even when
it's up. I am not confident that this is addressed, but there's
a reasonable chance that it is, and I can't trigger it at the
moment, but it was always sporadic, so that doesn't prove much.

There's a lot going on here, and it comes into roughly three
categories.

First: Dropping unused/unneeded code. There's a lot of leftover
bits from the initial development and refactoring of this.

Second: Unifying and shuffling some of the design. We had
multiple interfaces which are functionally impossible to
usefully implement separately, so they're combined together,
and in some cases, moved.

Third: Streamlining logic and simplifying design choices.

This is combined into one commit because the changes are
thoroughly entertwined with each other and you can't usefully
break most of them out.

Also, a bunch of test coverage for most of these changes.

Big changes:

We merge the topology and disco packages.  The topology and disco
packages being separate creates a complicated tangle of problems
and dependencies.  The fundamental problem, approximately, is that
topology.Node has to track disco.NodeState.

There's three core interfaces interacting here:
	topology.Noder (maintains list of nodes)
	disco.Stator (maintains the state of a node)
	disco.Metadator (stores, possibly retrieves, node metadata)
But the node state mantained by the Noder *is* the set of node
metadata, plus state updates produced by Stators. The only actual
non-trivial and usable implementation of these interfaces is a single
thing which implements all three, and in which the implementations
share a single backend data source which they are all modifying.

But you can't move Noder into disco, because Noder has to refer
to topology.Node, but topology.Node refers to disco.

Solution: First, merge these two packages. Second, merge these
three interfaces, to provide a single interface which is more
clear about the fact that (metadator.)SetMetadata() and
(stator.)Started() are both changing the output we'll get from
(noder.)Nodes().

We rework the node state tracking.

We have this nodeStates map which is almost unused. Really, we
don't need it at all. Every node's state is either its last heartbeat
state or "Unknown", so we simplify this a bit. Also, we ensure that
the populateNodeStates function itself is yielding the sorted nodes
list, so we don't have to be as worried about possible later lookups
of sortedNodes happening outside a lock. We also add diagnostics
for deleting nodes from the metadata list (this should never happen),
and try to track heartbeat state more closely.

This is *probably* what fixes the underlying reported problem,
if anything did.

Still an open issue: Make heartbeat state changes aware of when
they're talking about *this* node and possibly not try to
mark it down? Except this may have a flaw: That would result in
each node disagreeing with other nodes in etcd about the state
of that node in the failure cases, and undermine the point of
using etcd to keep these states consistent.

We reduce the number of contexts and cancelfuncs in the etcd wrapper.

We create a shared context for the non-etcd.embed children of our
etcd wrapper, the heartbeat/keepalive and the node watcher, so we
can cancel that one context and cancel all of those at once, so
we don't need to separately track a function to call to cancel
the watch, AND be closing another channel. Also, our shutdown
now propagates automatically to the various etcd API calls we've
made for things like the node watcher and keepalive calls.

We still need to watch that channel in watchNodesOnce, though,
because apparently the watch doesn't yield an error even if the
context calling it is canceled. Whee.

This should reduce the risk of ending up in an inconsistent state,
and also the Close() function is probably idempotent now.

Smaller changes:

* Remove config-generators that existed to generate etcd
  configs but were used only for tests that no longer exist
  or make sense.
* Move the logic to generate etcd configs into the etcd
  package, instead of the "testing" subpackage. This allows
  us to write a self-contained config generator for
  clusters where the nodes know about each other, but do
  this just with etcd, not with full featurebase servers.
* Move the thing generating `fake:%d` socket names into
  the etcd package, which is the only place we use it.
  Also simplify it slightly.
* Don't panic on invalid URLs, report errors from them.
* At least try to use etcd's config.Validate functionality.
  It's underdocumented, so we're not sure what it will report,
  but at least if it does we'll get reports from it and
  know what they are?
* Try to handle CompactRevision errors from watches more
  correctly -- after a CompactRevision, any future attempt
  to watch from a lower revision will necessarily fail, so
  we adjust our target revision up. We don't have good
  testing for this.
* Drop the Metadata() method (that used to be in Metadator)
  because nothing ever used it and it didn't make much sense
  to try.
* Convert SetMetadata from taking an arbitrary json blob
  to taking the only data that would ever be valid since
  we always use it to extract node information anyway.
* Drop several unused functions, unexport things only used
  internally.
* Replace Started() with SetState("STARTED"), allowing us
  to write tests that mess with states. We weren't really thinking
  carefully about state transitions sometimes and now it's much
  easier to do that thinking.
* Stop leaving stray localhost:2380 and localhost:2379 in
  our embed config. We still sometimes see peer requests from
  those and I honestly don't know why, but at least it should
  be rarer.
2022-07-21 11:42:35 -05:00
.github remove references to CONTRIBUTING and CHANGELOG 2021-11-19 11:22:15 -06:00
.gitlab Revert "increase time range for timestamp by using specified granularity" 2022-07-18 11:09:04 -05:00
api/client Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
authn [FB-1379] Create a featurebase subcommand to obtain an auth token (#2079) 2022-05-26 11:35:51 -05:00
authz Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
boltdb simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
client [FB-1587] crash would occur if missing nil-entry in batch (#2145) 2022-07-12 17:20:55 -05:00
cmd Revert "FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)" 2022-06-17 14:58:30 -05:00
ctl simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
debugstats add copyright notice back in 2021-12-10 11:01:04 -06:00
disco simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
encoding/proto simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
etcd simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
gcnotify Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
generator add copyright notice back in 2021-12-10 11:01:04 -06:00
gopsutil Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
hash Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
ingest Revert "increase time range for timestamp by using specified granularity" 2022-07-18 11:09:04 -05:00
ingest_testdata allow ingest API delete to work at all, add test for it 2022-04-01 09:48:51 -05:00
install remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
internal simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
lattice Remove most of the resize-related logic 2022-06-21 17:03:09 -05:00
logger [FB-1484] Sentry: fix middleware and CI test for PLG 2022-06-10 14:52:32 -05:00
lru fix some staticcheck issues 2021-12-03 09:31:45 -06:00
mock Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
monitor Add proper version info to sentry logs 2022-06-21 11:03:22 -05:00
net add copyright notice back in 2021-12-10 11:01:04 -06:00
pb indicate sign with a bool 2022-06-17 14:58:30 -05:00
pg remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
pql make Decimal proto definition backwards compatible 2022-06-17 14:58:30 -05:00
prometheus Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
proto Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
qa CICD: fix Cleanup_Build_Job inconsistent failures (#2098) 2022-06-14 11:49:25 -04:00
rbf avoid out-of-bounds panic in rbf 2022-06-10 15:29:06 -05:00
roaring FB-1548 - Added a fix for panic error that could happen when a view is opened by the ingest process but at the same time, was also deleted by TTL (#2147) 2022-07-18 17:35:34 -05:00
scripts remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
server simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
shardwidth Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
short_txkey remove a bunch of commented print statements and unecessary prints 2022-01-11 10:42:44 -06:00
sql fix parens around where clause bug (#2121) 2022-06-16 22:21:24 -05:00
sql2 Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
statik Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
stats only set bits after the holder is completely setup 2022-02-25 15:02:24 -06:00
statsd Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
storage remove a bunch of roaring backend stuff 2022-02-02 20:56:18 -06:00
syswrap add copyright notice back in 2021-12-10 11:01:04 -06:00
task implement a task pool 2022-02-14 09:56:19 -06:00
test simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
testdata FB-1378: Use IP whitelisting for ingest authentication and authorization (#2070) 2022-05-20 14:57:05 -05:00
testhook Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
toml add copyright notice back in 2021-12-10 11:01:04 -06:00
tracing Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
txkey remove a bunch of commented print statements and unecessary prints 2022-01-11 10:42:44 -06:00
vprint add copyright notice back in 2021-12-10 11:01:04 -06:00
.dockerignore Add new Docker build process and continuous delivery 2021-02-26 14:34:14 -06:00
.gitignore remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
.golangci.yml fix govet and gofmt errors in existing code 2021-10-29 13:14:27 -05:00
api.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
api_test.go fix few bugs regarding timestamp 2022-07-15 15:15:12 -05:00
apimethod_string.go Remove most of the resize-related logic 2022-06-21 17:03:09 -05:00
audit.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
audit_internal_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
audit_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
broadcast.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
bsi.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
bsi_test.go add copyright notice back in 2021-12-10 11:01:04 -06:00
cache.go comment cleanup 2022-05-27 11:25:17 -05:00
cache_test.go Periodically invalidate rank cache during bulk add 2022-02-15 08:25:45 -07:00
catcher.go create BitmapRewriter/ApplyRewriter, parallel to BitmapFilter 2022-04-12 12:24:22 -05:00
cluster.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
cluster_internal_test.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
cmd.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
const_amd64.go add copyright notice back in 2021-12-10 11:01:04 -06:00
const_other.go add copyright notice back in 2021-12-10 11:01:04 -06:00
dbshard.go drop the bool from a map that's only using it to check presence 2022-06-09 10:26:19 -05:00
dbshard_internal_test.go drop the bool from a map that's only using it to check presence 2022-06-09 10:26:19 -05:00
dbshard_test.go remove http subpackage and bring implementations into core 2022-02-03 21:04:04 -06:00
delete_test.go Add regression test for FB-1281 2022-03-24 15:20:57 -06:00
diagnostics.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
diagnostics_internal_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
doc.go add copyright notice back in 2021-12-10 11:01:04 -06:00
Dockerfile remove references to LICENSE and checks for it in source files 2021-11-19 10:38:06 -06:00
Dockerfile-clustertests remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
Dockerfile-clustertests-client remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
event.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
executor.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
executor_internal_test.go track closing status for index/field/view, shut down cache flush early 2022-03-18 14:41:44 -05:00
executor_test.go Changes to row queries with from/to options (#2152) 2022-07-20 15:10:41 -05:00
field.go Changes to row queries with from/to options (#2152) 2022-07-20 15:10:41 -05:00
field_internal_test.go Revert "FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)" 2022-06-17 14:58:30 -05:00
field_test.go Revert "increase time range for timestamp by using specified granularity" 2022-07-18 11:09:04 -05:00
filesystem.go add copyright notice back in 2021-12-10 11:01:04 -06:00
fragment.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
fragment_internal_test.go add TestImportRoaringSingleValued 2022-05-27 11:25:17 -05:00
gc.go add copyright notice back in 2021-12-10 11:01:04 -06:00
gid.go database per shard, HolderConfig, rbf bit-wise import speedups. 2020-09-04 13:00:33 -05:00
go.mod [FB-1444] Add sentry.io for error and perf monitoring (#2099) 2022-06-06 18:29:32 -05:00
go.sum [FB-1444] Add sentry.io for error and perf monitoring (#2099) 2022-06-06 18:29:32 -05:00
hack.go Change Ttl to TTL (#2038) 2022-04-27 11:20:39 -05:00
handler.go add doc comments 2022-05-27 11:25:17 -05:00
holder.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
holder_internal_test.go address reviewer's comments 2022-03-10 09:36:18 -06:00
holder_test.go change assignment of partitions to nodes 2022-04-27 17:21:47 -05:00
http_handler.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
http_handler_internal_test.go [FB-1444] Add sentry.io for error and perf monitoring (#2099) 2022-06-06 18:29:32 -05:00
http_handler_test.go FB-1505 - Fixes for PR: remove underscores from test names, rename TTLRemoval to ViewsRemoval 2022-06-30 16:58:57 -05:00
http_translator.go remove http subpackage and bring implementations into core 2022-02-03 21:04:04 -06:00
http_translator_test.go remove http subpackage and bring implementations into core 2022-02-03 21:04:04 -06:00
idalloc.go add copyright notice back in 2021-12-10 11:01:04 -06:00
idalloc_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
index.go FB-1505 - added ability to update NoStandardView and delete standard view 2022-06-30 16:58:57 -05:00
index_internal_test.go remove unused stuff and fix a bunch of random staticcheck issues 2022-02-07 15:10:10 -06:00
index_test.go Revert "FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)" 2022-06-17 14:58:30 -05:00
ingest_test.go allow ingest API delete to work at all, add test for it 2022-04-01 09:48:51 -05:00
internal_client.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
internal_client_test.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
iterator.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
iterator_internal_test.go add copyright notice back in 2021-12-10 11:01:04 -06:00
license.exceptions update license header check exceptions 2021-05-14 10:45:46 -04:00
like.go add copyright notice back in 2021-12-10 11:01:04 -06:00
like_test.go add copyright notice back in 2021-12-10 11:01:04 -06:00
main_test.go listen on localhost:0 instead of :0 2022-03-18 13:38:30 -05:00
Makefile Fb 1483 plg release (#2108) 2022-06-10 15:07:36 -07:00
metrics.go add copyright notice back in 2021-12-10 11:01:04 -06:00
nfpm.yaml FB-904: Add deb/rpm packaging of FeatureBase binary 2021-11-04 10:32:59 -06:00
NOTICE add config files for release 2021-11-19 01:26:18 +03:00
pilosa.go Remove most of the resize-related logic 2022-06-21 17:03:09 -05:00
pilosa_internal_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
pilosa_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
planner.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
planner_test.go track closing status for index/field/view, shut down cache flush early 2022-03-18 14:41:44 -05:00
pprof.go remove a bunch of roaring backend stuff 2022-02-02 20:56:18 -06:00
rbf.go create BitmapRewriter/ApplyRewriter, parallel to BitmapFilter 2022-04-12 12:24:22 -05:00
README.md add coverage, code quality badges 2022-03-30 10:07:23 -05:00
row.go remove string keys on delete to allow for reuse 2022-02-25 16:23:54 -06:00
row_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
serializer.go add copyright notice back in 2021-12-10 11:01:04 -06:00
server.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
server_internal_test.go improve Server WaitGroup concurrent usage 2022-02-25 15:02:21 -06:00
server_test.go FB-1505 - Fixes for PR: remove underscores from test names, rename TTLRemoval to ViewsRemoval 2022-06-30 16:58:57 -05:00
stattx.go create BitmapRewriter/ApplyRewriter, parallel to BitmapFilter 2022-04-12 12:24:22 -05:00
time.go FB-1456 - TTL - fixed views not returning correct results (#2062) 2022-05-16 15:26:13 -05:00
time_internal_test.go FB-1456 - TTL - fixed views not returning correct results (#2062) 2022-05-16 15:26:13 -05:00
tracker.go add copyright notice back in 2021-12-10 11:01:04 -06:00
tracker_test.go add copyright notice back in 2021-12-10 11:01:04 -06:00
transaction.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
transaction_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
translate.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
translator_test.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
tx.go create BitmapRewriter/ApplyRewriter, parallel to BitmapFilter 2022-04-12 12:24:22 -05:00
tx_internal_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
tx_test.go remove string keys on delete to allow for reuse 2022-02-25 16:23:54 -06:00
txfactory.go . 2022-03-11 06:20:07 -06:00
txfactory_internal_test.go remove a bunch of roaring backend stuff 2022-02-02 20:56:18 -06:00
util.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
util_test.go Revert "increase time range for timestamp by using specified granularity" 2022-07-18 11:09:04 -05:00
utils_internal_test.go simplify, streamline, and possibly debug embedded etcd 2022-07-21 11:42:35 -05:00
version.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
view.go FB-1548 - Added a fix for panic error that could happen when a view is opened by the ingest process but at the same time, was also deleted by TTL (#2147) 2022-07-18 17:35:34 -05:00
view_internal_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00

FeatureBase, a distributed bitmap index

Coverage SecurityRating Quality Gate Status

See our internal documentation, which includes all external documentation, plus many internal-only pages, listed under the "Internal" heading in the main navigation bar.

Follow along with the Sample Project to get a better understanding of FeatureBase's capabilities.