Commit graph

9216 commits

Author SHA1 Message Date
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
tgruben
bfde4860c1
Merge pull request #2018 from molecula/fix-bad-defaults
[FB-1360] apply sane numbers when min/max 0 is provided
2022-04-12 16:15:11 -05:00
Todd Gruben
7588912c19 apply sane numbers when min/max 0 is provided 2022-04-12 15:47:14 -05:00
seebs
54a8754c33
Merge pull request #2001 from molecula/fb1290
[FB-1290] ApplyRewriter and friends
2022-04-12 14:35:22 -05:00
Seebs
cb99f88527 ClearRecords API change 2022-04-12 13:15:15 -05:00
Seebs
5d1db3a4f2 handle dirty correctly even if a page split happens 2022-04-12 13:04:55 -05:00
Seebs
6e90bfc9bc return early rather than just evaluating a rejection
The intent of these lines was "if there's no filter, return
immediately rather than doing operations".

But actually we didn't write that, so we were calling intersectionCallback
on empty filters, which didn't matter since it failed out quickly, but
it's still a waste of effort.

Except we shouldn't get to these anyway because ConsiderKey already
correctly rejected these cases. I think. But still.
2022-04-12 12:24:22 -05:00
Seebs
16fef7ffbd re-add the nextOffsets logic to BitmapBitmapTrimmer
In fact, we *do* want to skip ahead sometimes to the next thing, and
only call our callback for things that match our filter. I was thinking
that we needed to call the callback for all data regardless, because
what if you're writing to a mutex and adding new data.

But even if you're adding new data, it's still in the filter, because
it has to be, because we don't start out knowing there's no existing
data. So the mutex actually works fine.

So the rule for BitmapBitmapTrimmer is that your filter doesn't have
any meaning other than (1) it tells us which containers you need
to see, (2) we provide it to your callback function. Maybe you want
to subtract those. Maybe you want to add them. That's up to you to
decide.
2022-04-12 12:24:22 -05:00
Seebs
88a6a047d2 try to reduce seeking in ApplyRewriter a little
Slightly more careful thoughts about whether or not the cursor
is "dirty".
2022-04-12 12:24:22 -05:00
Seebs
919eb3f0e8 rework bulkImportMutex to use ApplyRewriter
Now that we have ApplyRewriter, it's a viable way to implement ImportMutex.
It can be slower on low-density writes, because it's checking more things
than it otherwise might -- the other filter form can skip ahead and only
check the containers it's modfying, in principle, while this one doesn't
know it can do that. (The decision as to how far to skip ahead has to
be made in the BitmapBitmapTrimmer, while it's the callback provided to
it that knows when it next has data to write.)

On the other hand, it's probably faster in some cases, and would be
more-faster if we could improve the cursor management a bit, and it's
skipping at least some seeking because it doesn't need to use
ImportPositions after reading the whole thing.
2022-04-12 12:24:22 -05:00
Seebs
852a8be45a use ApplyRewriter for ClearRecords
This uses the shiny new ApplyRewriter logic for ClearRecords,
mostly to verify that ApplyRewriter works at all.

This also implies separating the cache update code out from
importPositions so it can be used also by this.

We also use fragment.ClearRecords instead of the different clearFragment
code in executor.  The clearFragment implementation did not update TopN
caches and the like. Standardize it on the clearRecords implementation
which does.
2022-04-12 12:24:22 -05:00
Seebs
74ae1fd598 export and improve DifferenceInPlace
We don't need to manually copy each individual item and keep
checking for the second index being out of bounds for every
item, we know it can't change at this point, so we can just bump
it over. We want this operation because BitmapRewriter can
use it to simplify trimming in some cases.
2022-04-12 12:24:22 -05:00
Seebs
5148974602 trust cell.BitN a few more places
Found a couple of places where we were still not trusting this, but really
we're testing it a lot more carefully now.
2022-04-12 12:24:22 -05:00
Seebs
9acc7a6019 Drop unneeded locks
The filter and rewrite logic are unlocking and relocking but I don't
think they should. I think those locks were added early on during
testing of the filter stuff, but I don't think they should be needed,
and I've been unable to find a case where they were. I think probably
I had something where a ConsiderData function was trying to run a Tx.
2022-04-12 12:24:22 -05:00
Seebs
e67beb8766 create BitmapRewriter/ApplyRewriter, parallel to BitmapFilter
This in a parallel to ApplyFilter/BitmapFilter which allows writebacks
while it's running. It's a write operation, so it needs a write lock
on the Tx, and needs to create bitmaps if they don't already exist.
The semantics are a bit messy and need better documentation still.
2022-04-12 12:24:22 -05:00
Seebs
d972028858 implement RemakeContainerFrom and helper function for it
We frequently want to grab the set of values from a []uint64
that correspond to a given key, and make a container from them, but
sometimes we only want to do one of these. This implementation
lets us do that the same way every time, and do in-place
container creation without extra allocs.
2022-04-12 12:24:22 -05:00
Seebs
86088fd688 drop incorrect test
The test for bitmap-to-array succeeding doesn't work with roaringParanoia,
which *does* intentionally panic at that point. Possibly we should also
drop the corresponding logic that tries to prevent it from panicing,
since it won't work with the paranoia flag on anyway.
2022-04-12 12:24:22 -05:00
Ben Johnson
11a5178471
Merge pull request #2010 from molecula/fb-1229
[FB-1229] Shrink RBF freelist & truncate data file on checkpoint
2022-04-12 08:33:28 -06:00
Ben Johnson
7f05dc5848
Merge branch 'master' into fb-1229 2022-04-11 14:00:37 -06:00
Samir Patel
be17087a68
Merge pull request #2011 from molecula/paginate
[FB-1303] Iterate through group membership http response
2022-04-11 15:26:37 -04:00
Samir Patel
9e69ee3534
Merge branch 'master' into paginate 2022-04-11 14:53:31 -04:00
reesporte
9b5b7e80a6
Merge pull request #2012 from molecula/fb-1346
Implement ToRowser interface for DistinctTimestamp
2022-04-11 11:50:17 -05:00
Samir Patel
ef6decf63a update handler tests 2022-04-11 10:42:14 -05:00
Samir Patel
3cf34d7503 update TestChkAuthN 2022-04-11 10:42:14 -05:00
Samir Patel
bddccf6ead add http status check to authenticate 2022-04-11 10:42:14 -05:00
Samir Patel
eea6a40fe0 Iterate through group membership http response
Follows the nextLink in http response to iterate through
paginated group membership response in order to obtain all
groups that the user is a member of.

Also, checks cache to make sure we don't add empty groups
to the cache.
2022-04-11 10:42:14 -05:00
reesporte
66def7678c Implement ToRowser interface for DistinctTimestamp
Because the ToRowser interface was not implemented for DistinctTimestamp, there was
a error when using the GRPC endpoint to call Distinct(All(), field=ts). Implementing
the ToRowser interface for DistinctTimestamp solves that problem.

Related to SUP-210: WebUI, Python - Distinct() does not work for Timestamp field
2022-04-11 10:38:37 -05:00
tgruben
4a155eba88
Merge pull request #2014 from molecula/expose-etcd-ttl
[FB-1347] expose etcd ttl timeout period
2022-04-11 10:33:20 -05:00
tgruben
45d4d0bcfd
Merge branch 'master' into expose-etcd-ttl 2022-04-11 09:51:59 -05:00
seebs
8284306d5f
Merge pull request #2009 from molecula/fb1342
[FB-1342] handle time quantums better in GroupBy
2022-04-11 09:47:19 -05:00
Ben Johnson
fe7c97afa0 Fix size/PageSize calculation to be int64. 2022-04-11 08:26:00 -06:00
Ben Johnson
3b8ce696bd Shrink RBF freelist & truncate data file on checkpoint 2022-04-11 08:21:44 -06:00
Todd Gruben
74ab06f5d3 expose etcd ttl timeout period 2022-04-11 08:58:39 -05:00
Seebs
9f2b888c4f standardize and correct time range handling
If you're wondering how something that simple gets a commit
message this long, sit down, because you are in for a ride.

The Row, Rows, TopK, and GroupBy(Rows...) commands had three
different sets of semantics for from/to ranges. We unify these.
Sounds easy, right?

The original purpose of this was to address a bug in GroupBy
where, if you had multiple queries only one of which used time,
we could end up silently returning no results because we tried to
do a time query against a non-time field. This was easy to
fix; just move a boolean flag from outside a loop to inside
the loop so it resets to false on each pass.

In the process of trying to test that, I discovered that
specifying `from=...` without `to=...` in a Rows in a GroupBy
didn't work. Searching around, I discovered that we had three
different answers:

	GroupBy, TopK: unspecified 'to=' is 0
	Row: unspecified to is tomorrow
	Rows: unspecified to is the max time quantum in the field

(A time value of 0 is apparently interpreted as January 1st,
0001.) Note that "GroupBy" is really referring to a Rows()
command in a GroupBy, it's just that this uses completely different
code (because it has to be computing rows potentially matching or
restricted to a filter, or provide the rows it generated so
they can be used to filter something else).

So we fixed that, and made a field method for finding the min/max
values (as done in a Rows command that *isn't* in a GroupBy),
and tried to use that with viewsByTimeRange. Then I tried to write
documentation for this, but the documentation was unclear, and
I tried to clear it up. Which caused me to discover that these
four different places ALSO differed in when or whether they'd
replace a broad query with "just the standard view".

So. Round two of the fix: We create a `field.viewsByTimeRange`,
which tries to fall back to a standard view when one exists
and the specified range covers everything, and treats zero
values as non-restrictive, but also picks a narrow range that
is actually related to the range of dates in the field. This
matters because viewsByTimeRange generates the entire set of
views it would need *even if those views don't exist*.

We drop one test that was testing Rows specifically to verify
that, if you omitted To, we acted as though you'd specified a date
two days in the future. That behavior is not now intended, so
we drop the test that tries to verify it.

Thing that might make this better: Figuring out a way to generate the
list of views more cheaply. Right now, we're redoing all the view
computation, including producing a sorted list of view names, for
every shard. This is excessive, but hard to fix.

In particular, there is no trivial way to generate a sorting such
that you can take slices of it and have them be the right slices,
because we want to skip smaller time quanta when an entire larger
parent quantum is included. e.g., if we're including all of
April 2022, we don't want to include any of the days for April of
2022, but if we're doing up through April 15th, we want to include
the first 15 days of April, but NOT include the whole-month quantum.
And so on. Fixing this cleanly is hard and would require a
significant design effort.
2022-04-08 14:19:36 -05:00
Kasey C. Rodgers
aaa7051c21
Merge pull request #2013 from molecula/fb1309
fix the spots where gitlab thinks we're using hard-coded passwords
2022-04-08 12:35:52 -04:00
Kasey C. Rodgers
d47f3975c9
Merge branch 'master' into fb1309 2022-04-08 09:02:42 -07:00
kcrodgers24
3816a7fad4 fix the spots where gitlab thinks we're using hard-coded passwords 2022-04-07 12:22:45 -04:00