Commit graph

9281 commits

Author SHA1 Message Date
Kasey Rodgers
f175b11b1a add s3 dump for plg 2022-06-10 13:30:55 -07:00
Kasey Rodgers
b545efc69c corrected artifact names in plg build stages 2022-06-10 08:23:04 -07:00
Kasey Rodgers
771976a195 make plg target uses go build instead of go install 2022-06-09 14:53:03 -07:00
Kasey Rodgers
37ec0874bc automate builds of single node featurebase for PLG 2022-06-09 13:29:47 -07:00
Kasey C. Rodgers
2ef39fdc9c
Fb1463 no cluster build (#2100)
* got single node working; refining error messaging and version info to follow

* better implementation that separates the build condition into etcd/enterprise_cluster.go and etcd/plg_cluster.go. go build will default to a clustering version and 'go build -tags plg' will build the non-clustering version

* added Makefile target for 'make plg'

* additional comments, CI/CD update

Co-authored-by: Kasey Rodgers <kaseyrodgers@Kaseys-MBP.attlocal.net>
2022-06-09 12:32:46 -07:00
Seebs
ff7900070c drop the bool from a map that's only using it to check presence
We only actually check presence/absence in this map, we never
set the value stored to false, and we assume in some places that
any value present is equivalent to true, so we might as well
use a map of struct{} and save the several whole bytes of memory.
2022-06-09 10:26:19 -05:00
Samir Patel
42f5d6eea3
[FB-1444] Add sentry.io for error and perf monitoring (#2099)
add sentry for error monitoring and performance tracking. Must call the init function to actually turn on the feature. This is expected to be used in the PLG binary and not the enterprise binary.
2022-06-06 18:29:32 -05:00
reesporte
eab6174388 make pql.Decimal.Value a private big.Int field
This ensures that we can't overflow when adding `pql.Decimal`s together. The
only place we can possibly overflow is when converting pql.Decimal to an Int64,
but that is a risk we have to take. Also, the only place we do this is in our
ToRowser. We could maybe change that to strings, so the presentation of data
doesn't indicate an overflow, but that is a later decision to make. It will
also involve fixing the generate-proto-grpc make command, because that's broken
rn.
2022-06-06 16:44:01 -05:00
reesporte
a0c9eec410 pql.Decimal for DecimalVal in ValCount&GroupCount
This way we can avoid annoying floating point rounding errors.

Check out FB-1359 for an example:
```
--- FAIL: TestExecutor_GroupByStrings (0.55s)
    --- FAIL: TestExecutor_GroupByStrings/3 (0.00s)
        executor_test.go:5433: unexpected result at 0:
             got:{Group:[generals.1.r1] Count:5 Agg:2775
DecimalAgg:27.749999999999996}
            want:{Group:[generals.1.r1] Count:5 Agg:2775 DecimalAgg:27.75}
```
2022-06-06 16:44:01 -05:00
reesporte
50787fd37a Add AddDecimal support to pql
This allows us to add two Decimals together as long
as the result doesn't overflow int64 either in value or in scale.
2022-06-06 16:44:01 -05:00
Samir Patel
3750fea632
add timestamp nils to nullIndices (#2095)
* add timestamp nils to nullIndices

* add test
2022-06-02 15:54:24 -05:00
souhailanoor
64a532b416
FB-1471: featurebase: added relevant details to error for value out of range (#2092)
* added relevant details to error
2022-06-02 14:53:10 -05:00
tgruben
a2f910ce35
[FB-1334] add batch support to clear a mutex on nil (#2091)
* mutex clear on nil support with test

* Update client/batch.go

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2022-06-01 17:37:03 -05:00
Bruce Baranowski
aa8057e9e4
CICD - Spot instances (#2087)
* spot instance test

* update outputs.tf to provide spot instances

* uptate outputs.tf data_node_ips

* propogate spot instance request tags to the instances
2022-05-31 17:25:09 -04:00
Bruce Baranowski
c0d56e13f2
Remove extra Cloudforlation tags (#2089) 2022-05-31 16:51:22 -04:00
Bruce Baranowski
8490be9fb0
CF tremor delete hotfix (#2088) 2022-05-31 15:35:40 -04:00
Matthew Jaffee
cc2230b4b8 don't encode 'base' in the field options json
it's not something that we can send to the server (it calculates base
off of min and max), and we don't need it in the json string in order
to use it client side when building import requests.
2022-05-29 09:03:27 -05:00
Matthew Jaffee
96f589ce24 add base to FieldOptions.String 2022-05-29 09:03:27 -05:00
Matthew Jaffee
98cb763499 don't use base for timestamp fields 2022-05-29 09:03:27 -05:00
Matthew Jaffee
d4820d872f decode int base from schema in client code
not having this breaks ingest when ingesting int-like fields with
nonzero bases (using the shard transactional endpoint)
2022-05-29 09:03:27 -05:00
Samir Patel
fb81e7a360
[FB-1462 FB-1393] Timestamp fix (#2082)
* serialize base and epoch into req

* fix and validate timestamp import

* refactor overflow check and test
2022-05-27 20:19:06 -05:00
Matthew Jaffee
9fb68b416c add doc comments 2022-05-27 11:25:17 -05:00
Matthew Jaffee
a815bba520 comment cleanup 2022-05-27 11:25:17 -05:00
Matthew Jaffee
90eb860b03 fix hardcoded containers per rowshard
There are 16 containers in a row in a shard with the default shard
width of 2^20, but since you can change the shard width at compile
time, everything should be computed off that.
2022-05-27 11:25:17 -05:00
Matthew Jaffee
a4b1af2add add TestImportRoaringSingleValued 2022-05-27 11:25:17 -05:00
Matthew Jaffee
5c6e668c07 fix issue where mutex clear bitmap wasn't properly set
specifically for shard transactional endpoint
2022-05-27 11:25:17 -05:00
Matthew Jaffee
d7718483bf fix bug where multiple ints in same batch could ingest union of ints
if the same ID is added multiple times with different values, only the
last value should get set. Without this change, if the multiple
records weren't immediately next to each other, all the bits from all
the values would get set.
2022-05-27 11:25:17 -05:00
Matthew Jaffee
991d3d7780 remove experimental RBF Viz stuff 2022-05-27 11:25:17 -05:00
Matthew Jaffee
e2d6610ae7 fix: rebuild rank cache for set imports (ImportRoaringShard)
the ranked cache must be fully rebuilt as the BitmapRewriter doesn't
have an easy way to track which rows had how many bits changed which
we would need to update the cache.

We also needed to add a Clear method to topn cache to completely
remove old values before the rebuild as otherwise they'd sit there and
pollute the cache after it was rebuilt.

This also includes fixing a strange idiosyncrasy where the _exists
field was a set field, but didn't have its type explicitly set. This
was causing it to have a ranked cache even though that option was
turned off. Hoping this doesn't have any weird follow-on effects... or
if it does the tests catch them.
2022-05-27 11:25:17 -05:00
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