Commit graph

9252 commits

Author SHA1 Message Date
Matthew Jaffee
772496b440 "all bitmap" multi-field, single-shard ingest
This adds a shard-based import endpoint which takes bitmap data for
all field types and imports data for the whole shard transactionally.

It uses the BitmapRewriter interface to try to intelligently allow for
setting and clearing bits simultaneously without multiple writes which
is especially helpful when ingesting into int-like fields, but also
allows clear-and-then-set behavior for set fields.
2022-05-27 11:25:17 -05:00
reesporte
964f14a3a1
If the field doesn't exist return ErrFieldNotFound (#2081)
This way we don't return seemingly valid data for calls on non-existent fields. See
also [FB-237](https://molecula.atlassian.net/browse/FB-237).
2022-05-26 16:45:10 -05:00
reesporte
8ba81643d2
[FB-1379] Create a featurebase subcommand to obtain an auth token (#2079)
* Add CleanOAuthConfig endpoint

We will use this to get the OAuthConfig information, without the client secret, from
FeatureBase without having to have access to the config file. This will be useful
for the auth-token subcommand.

* Add string manipulation utility functions

Go doesn't have native support for these kind of things, so I added this to make it
easier to do string reversal, and replacing the first string encountered from the
end of the string to the front.

* Add auth-token subcommand

This is for work on [FB-1379](https://molecula.atlassian.net/browse/FB-1379).

We need this new auth-token subcommand to allow users to get access and refresh
tokens without having to login to featurebase via the UI. This commit adds that
functionality.

* error on oauth endpoint if auth isn't on

* https as default scheme in cmd, not internalclient
2022-05-26 11:35:51 -05:00
reesporte
2d937728fa
remove vestigial print statement (#2080) 2022-05-26 09:33:43 -05:00
Matthew Jaffee
8e5ab106dc
FB-1459 ugly first cut at supportings Rows(in=[...]) (#2066)
* ugly first cut at supportings Rows(in=[...])

need tests, better handling of various combinations of arguments and
error cases

* explicitly error when other arguments passed with 'in' to Rows

* first cut at supporting Rows(in=[...])

'in' is explicitly not supported with any other arguments (except the
field of course), and will error. It works both as a standalone Rows
call and in GroupBy.

* bitmapfilter require ordered rowids

* remove log message

Co-authored-by: Todd Gruben <todd@molecula.com>
2022-05-25 11:57:59 -05:00
reesporte
d9b13eebc8
Recognize semi-colon separated cookies too (#2078)
This fixes a bug where the frontend UI sends GRPC cookies via a single semi-colon
separated string, which our new token parsing algorithm did not recognize as valid.
Now we account for that special case, at the small expense of greater overall
computational complexity.
2022-05-24 21:45:33 -05:00
hphamMolecula
ba44bc86f6
FB-1403 - fixed TTL to not allowed negative values (#2076)
* FB-1403 - fixed TTL to not allowed negative values

* FB-1403 - TTL - fixed comment

* FB-1403 - TTL - added comments for unit test, removed extra if statement, removed extra unit test
2022-05-23 18:35:57 -05:00
Bruce Baranowski
e3aff58632
Smoketest cleanup (#2077)
* added after_script

* changed after_script to a stage

* add shell tag

* Add pipeline prefix

* cleanup-list-test

* use unique jobid instead of random string

* remove dangling resources

* Spot instance test

* Revert "Spot instance test"

This reverts commit f722734b4dc04609918c29445dd4e739a3a1bd77.

* spot test

* Revert "spot test"

This reverts commit f35cc088db09b408e4f3b37a4b419a6126e52b43.

* manual trigger & cleanup test

* Finish cleanup script

* string wrapping

* typo fix

* final cleanup

* change nonexist test

* silent grep

* utilize query feature

* cleanup only test

* cleanup only test

* No skipping stages

* modify to pipieline-

* add --region
2022-05-23 16:37:42 -04:00
reesporte
60e6900c2e
Add refresh token header/cookie (#2071)
* Add refresh token header/cookie

As part of work on automatic refreshing of access tokens in the grafana plugin
(FB-1377), we will now accept a refresh token in the "X-Molecula-Refresh-Token"
header or the "refresh-molecula-chip" cookie.

This refresh token will be used if the access token is expired. To achieve this,
there was a lot of plumbing that had to be done. Here is a list of some of it:

* Added lots of constants for the new values.
* Removed token cache, since we will be keeping state on the clients.
* We now only refresh tokens when they are expired, which is more inline with the
  OAuth spec.
* Refactored SetGRPCMetadata to be simpler to read.
* Refactored AddAuthToken.
* Update failing tests.
* We now don't split GRPC cookies on ";". Not sure why we did that before tbh.

I also added TODOs to add the refresh token to other subcommands. This is out of
scope for my current ticket, but it would be nice to have in the future.

* remove unnecessary context from Authenticate

* Add comments on why we check both cases for headers

It's because some GRPC clients lowercase metadata names. I've run into issues with
this enough that I think it's worth the extra checks. We prefer lowercase though,
because that's "standard".

* Fix test that broke during rebase
2022-05-20 16:12:27 -05:00
souhailanoor
3986e202bf
FB-1378: Use IP whitelisting for ingest authentication and authorization (#2070)
* Use IP whitelisting for ingest
For ingest, use configured IPs to authenticate the requests.
Auth-token will no longer be used for requests from ingest consumers.
If IP in request is in configured IPs, authenticate and authorize as an admin.
If IP in request is not in configured IPs, proceed with the standard authentication/authorization using ADD.

* need to remove port from client IP

* addressed review comments
2022-05-20 14:57:05 -05:00
Matthew Jaffee
62971f55dd return error in Batch.doImport if there is one
swallowing this error was a mistake... caller would not know that
ingest failed and might incorrectly report success
upstream (e.g. committing offsets to Kafka)
2022-05-19 16:26:46 -05:00
Fletcher Haynes
dc20f8c689
Make gauntlet manual (#2073)
* Changed several gauntlet tests to be manual due to cost emergency

* Made perf_able manual

Co-authored-by: Fletcher Haynes <fletcher.haynes@molecula.com>
2022-05-19 12:52:56 -07:00
Fletcher Haynes
8eaa5c0a43
Changed several gauntlet tests to be manual due to cost emergency (#2072)
Co-authored-by: Fletcher Haynes <fletcher.haynes@molecula.com>
2022-05-19 12:24:39 -07:00
reesporte
f4e221e4f0
make race tests not run if it doesn't build (#2068) 2022-05-18 16:23:36 -05:00
Samir Patel
43a61d87b2
return HTTP status code: 400 (Bad Request) when ingest values are (#2047)
out of range. Previously internal server error was returned.

This is to allow for ingest to continue while logging bad values
instead of stopping ingest as we do when there is a server error.
2022-05-17 14:26:10 -05:00
Seebs
d63d2492b9 clear the reference to a tx from the freelistCursor
We've been seeing weird retention of Tx that shouldn't still be open, and
one possible explanation is that, until a Tx actually uses the freelist
cursor (either to allocate a page or to release it back to the freelist),
the freelistCursor statically stored in the Db object continues to have a
pointer to the previous Tx which used it, which allows a Tx, and thus its
dirty page map, to be retained forever.

I previously thought this should also nil out the page maps in the Tx, but
the more I think about it, the less I think that's a good idea. The actual
lifespan of a committed Tx should be quite short. If it *does* stick around,
it's beneficial to us as debuggers to see those large maps of dirty pages
sticking around. So after thinking about it a lot I decided not to do
that.

Similarly, when closing out a container filter (whether a filter or
a rewriter), zero out the Cursor, Tx, and filter and rewriter functions.
(We don't have to worry about the cursor's Tx, because the cursor gets
closed, which zeros its Tx and returns the cursor to the cursor pool,
too.) This likely matters a lot less, as the filters in the pool
get garbage collected "soon", but it still reduces the amount of
stuff being retained.
2022-05-17 10:32:47 -05:00
reesporte
5e1df3f30a
[fb-1377] SetGRPCMetadata should always set the cookie, whether there was a cookie there to begin with or not (#2065)
* make CookieName an exported constant

* fix SetGRPCMetadata

this will actually set the grpc metadata even if there are no cookies in the
metadata already.

* gofmt yourself
2022-05-16 17:07:02 -05:00
hphamMolecula
39006396db
FB-1456 - TTL - fixed views not returning correct results (#2062)
* FB- 1456 - TTL - fixed views not returning correct results when least precise quantum are deleted

* FB-1456 - TTL - PR - fixed comment

* FB-1456 - TTL - changed getQuantum to getLowestGranularityQuantum since we only care about the least precise quantum that is available

* FB-1456 - TTL - removed unit test used for debug

* FB-1456 - TTL - fixed comments

* [FB-1435] BSI Base Fix (#2056)

* add bsi base back to int value

* test bsi base/min/max for IntFields

motivated by bsi base not being added back to values
in extract calls when min was a positive integer.

* FB-1456 - TTL - fixed comments

Co-authored-by: Samir Patel <48686912+54mir@users.noreply.github.com>
2022-05-16 15:26:13 -05:00
Samir Patel
68e72c2ce0
[FB-1435] BSI Base Fix (#2056)
* add bsi base back to int value

* test bsi base/min/max for IntFields

motivated by bsi base not being added back to values
in extract calls when min was a positive integer.
2022-05-13 09:33:53 -04:00
tgruben
09b4eed348
[FB-1388] Add optional support for continuous profiling in datadog (#2037)
Enable ability to use DataDog continuous profiling
2022-05-12 12:33:46 -05:00
hphamMolecula
94e772e6ec
FB-1403 - TTL - Added check for upper bound date (#2053)
* FB-1403 - TTL - Changed TTL to check for the end date of view time

* FB-1403 - TTL - clean up unit tests
2022-05-11 13:57:29 -05:00
tgruben
dd139cd48d
[FB-1398] Mainline etcd (#2049)
* use mainline etcd-io dependencies, not forks

this commit does lots of things around clustering with goal of increasing stability.

- upgrades from molecula/etcd to go.etcd.io/etcd@v3.5.4
- upgrades from seebs/bbolt to go.etcd.io/bbolt@v1.3.6
- update tests to use unix sockets for etcd cluster communication
    - this is what etcd uses for a lot of internal testing, so if their devs think
      it's a valid test, we can probably accept that
- cleanup etcd node-watcher shutdown process

Co-authored-by: tgruben <tgruben@gmail.com>

* moved random query to another repo

it had weird dependency issues with upgrading to mainline etcd bc of the vegeta dep
so we removed it bc no one really uses it anyway

we got this error message:
```
github.com/molecula/featurebase/v3/cmd/random-query imports
	github.com/tsenart/vegeta/v12/lib tested by
	github.com/tsenart/vegeta/v12/lib.test imports
	github.com/streadway/quantile tested by
	github.com/streadway/quantile.test imports
	.: "." is relative, but relative import paths are not supported in module mode
```

* add cleanup to EtcdUnixSocket test util

Co-authored-by: reesporte <reesedporter@gmail.com>
2022-05-11 09:49:48 -05:00
souhailanoor
ffed9531fc
FB-1253: Fixes for scheduled test (#2048)
* fix for changes in utilCluster

* fixes for samsung and backup-restore gauntlets
2022-05-06 12:00:04 -05:00
souhailanoor
b82375bca2
Tremor delete test scripts (#1974)
- terraform scripts to set up cluster
- cloud-formation scripts to set up cluster
- set up ingest node with kafka server and datagen
- set up second ingest node with molecula-consumer-kafka-static
- set up datadog in all nodes (ingest + featurebase)
- set up script to execute different queries
- only run delete test on schedule
2022-05-05 10:25:35 -05:00
Matthew Jaffee
a093099a8c dont default to standard view for some time range queries
previously, we would use the standard view if the query seemed to
cover all the views we had, or if we didn't seem to have any time
views. This is unintuitive if some views have been deleted (which
comes up a lot more often with TTL!). It's also unintuitive if you
know you haven't set any data w/ a timestamp and your query that
specifies a time range returns any data.
2022-05-04 11:04:38 -05:00
Matthew Jaffee
0d50bd2890 implement ability to update TTL on time fields 2022-05-04 11:04:38 -05:00
Matthew Jaffee
e0e01f9f65 expose --header-timeout option on featurebase backup 2022-04-29 16:37:40 -05:00
Matthew Jaffee
c554adb70a convert executor.shutdown to channel to avoid data race
Here was the race:
https://gitlab.com/molecula/featurebase/-/jobs/2391959728
2022-04-28 14:09:32 -05:00
Matthew Jaffee
cb4f23fc98 translate data: only redirect to UNKNOWN node if there is no STARTED
caveat: this will always redirect to the first UNKNOWN
node... possibly we would want to select randomly or have the ability
to retry different nodes.
2022-04-28 14:09:32 -05:00
Matthew Jaffee
f7651e3a26 update tests to reflect recent changes around allowing things when
nodes are UNKNOWN
2022-04-28 14:09:32 -05:00
Matthew Jaffee
364888086b allow reading translation from nodes in UNKNOWN state 2022-04-28 14:09:32 -05:00
Matthew Jaffee
02663d0282 when calculating what nodes can process a shard allow UNKNOWN state
we have an issue where nodes get into UNKNOWN state rather frequently
during periods of high load when they aren't actually down. We want to
allow queries in this situation rather than giving a "shard
unavailable" message.
2022-04-28 14:09:32 -05:00
Matthew Jaffee
dee46d4423 add PartitionToNodeAssignment as a new option
We default to the jmp-hash method which we had previously, and allow a
user to set the "modulus" option which uses a simple mod operation to
ensure an even spread of partitions across nodes.

I think that ideally we would have new indexes uses modulus and
existing indexes use jmp-hash which implies supporting this
configuration on a per-index basis.

If we don't do per index, we should probably run the whole test suite
both ways.
2022-04-27 17:21:47 -05:00
Matthew Jaffee
24af93e7d8 change assignment of partitions to nodes
we change this to use a simple modulus to ensure maximally even
assignment of partitions to nodes rather than the hash thing we were
doing previously which may have helped minimize data movement when
adding nodes, though I'm not even sure of that.

The logic was duplicated in a few places, so we've also condensed
that. For now, we're skipping tests which have baked in assumptions
about which node a partition will end up on as we expect them to fail
until they are updated.
2022-04-27 17:21:47 -05:00
Travis Turner
7ccc845aac
Change Ttl to TTL (#2038)
* Change Ttl to TTL

Following go convention, acronyms should have a consistent case.
See
[Initialisms](https://github.com/golang/go/wiki/CodeReviewComments#initialisms)

This commit changes some public-facing methods, so any code importing
this package and using these methods will need to be updated.

* rewrite Ttl -> TTL

Co-authored-by: reesporte <reesedporter@gmail.com>
2022-04-27 11:20:39 -05:00
rachithrr
eba7927b56
FB-1387: Grafana Empty Variable Select (#2032)
Fixed the issue where deselecting variables didn't work on quries like
groupby and extract.
The empty variables list returns All() when the variables are empty.
2022-04-26 12:39:28 -05:00
reesporte
0e37e04f47
check for context deadline exceeded in retry client (#2033)
you can get a context deadline exceeded from clientv3 if there's heavy load and the
etcd server sends a grpc code DeadlineExceeded. this causes the etcd client to not
retry connecting and then you end up with nodes that can't recover.

Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: seebs <seebs@molecula.com>

Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: seebs <seebs@molecula.com>
2022-04-25 14:23:27 -05:00
Ben Johnson
8702fac11d
Improve RBF documentation (#2034) 2022-04-25 09:13:54 -05:00
Bruce Baranowski
19613a3048
Mitigate 1 instance of potential integer overflow 2022-04-19 11:06:25 -04:00
reesporte
a8c1b93610
Add Max(timestamp) tests to smoke-test (#2025)
* Add Max(timestamp) tests to smoke-test

run a Max() call on a timestamp field twice, and make sure the results are the same

* chmod +x
2022-04-18 15:33:20 -05:00
reesporte
03df1ba6ad
remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
reesporte
e2bf96731f
Merge pull request #2015 from molecula/union-distinct-ts-better
save space when union-ing DistinctTimestamps
2022-04-14 11:11:36 -05:00
reesporte
96df2700fd save space when union-ing DistinctTimestamps
By using an empty struct, we reduce memory usage by
up to 16 bytes (the size of a timestamp string)
2022-04-14 10:31:56 -05:00
reesporte
f5c3c44411
Merge pull request #2019 from molecula/sup-218
[SUP-218, FB-1356] Pass auth info through context as needed, setup auth smoke testing infrastructure
2022-04-14 10:07:54 -05:00
reesporte
f224e64bc3 setup auth cluster infra
also add test for sup218

Co-authored-by: rachithrr <rachith.ramaswamy@molecula.com>
Co-authored-by: bruce-b-molecula <bruce.baranowski@molecula.com>
2022-04-14 09:37:52 -05:00
reesporte
ea33a2b976 fix broken test 2022-04-14 09:37:33 -05:00
reesporte
1060520fa7 add better error messaging for if the test is empty 2022-04-14 09:37:33 -05:00
reesporte
bff9128c9b properly thread the ctx through so we can pass Auth around 2022-04-14 09:37:32 -05:00
seebs
e530193e80
Merge pull request #2017 from molecula/fb1358
[FB-1358] gracefully handle invalid indexes in joins
2022-04-13 12:48:36 -05:00
Seebs
727c2ed724 gracefully handle invalid indexes in joins
If a join is requested against an index that doesn't exist, we
should report that as an error rather than panicing.
2022-04-13 11:44:58 -05:00