Commit graph

8713 commits

Author SHA1 Message Date
seebs
ffbf55ee40
Merge pull request #1860 from molecula/rbfPages
RBF page/cursor management improvements
2022-01-19 18:27:52 -06:00
Seebs
fb11895985 oops handle nil 2022-01-19 17:09:57 -06:00
Seebs
749dcd6970 retry on etcd timeout errors 2022-01-19 16:57:47 -06:00
Seebs
2dce518a24 retry other etcd ErrTimeout variants
etcd can return more detailed ErrTimeout variants in rare cases, and we
want to retry on those too.
2022-01-19 15:19:45 -06:00
Seebs
37507db4ac use array containers instead of individual bitwise adds
This affects TestTx_Remove, TestTx_DeallocateToFreeList, and
TestTx_RecreateBitmap, all of which were adding hundreds of thousands
of individual bits, or more, and all of which work just as well and
produce the same behavior using largeish containers.

This reduces race-detector-test runtime from about 20 minutes to
a couple.
2022-01-19 15:19:45 -06:00
Seebs
719a30e128 shorten MultiTx test
The MultiTx test runs for a fairly long time but doesn't add much
value running that much longer, and there's no reason it should take
more than half the time we spend on this entire directory.
2022-01-19 15:19:45 -06:00
Seebs
112abcb549 use stable cursor for freelist operations
The Cursor datatype is quite large, and allocating them constantly for
ops is extremely expensive. To avoid this, we create a single stable cursor
that lives in the DB, and can be used for freelist modifications. Since the
freelist is only ever modified once at a time, this should be safe. We also
don't fully zero it between operations, we just reset the relevant parts.
2022-01-19 15:19:45 -06:00
Seebs
adcd5adb02 improve the sync.Pool used for pages, avoid excess page allocations for WAL
Several changes. One is, we don't provide a `New` for pagePool, which
allows allocPage to check whether a page was returned, and thus, zero
pages which were found in the pool, or make new pages, but never zero
pages it just created with make. We then also make many more things
which were making pages use the pool.

Reuse the same page allocation for multiple header pages dumped into
the WAL; the bitmap header pages aren't stashed in our page map,
they're only written to the disk, so we don't need to make a new page
each time, we can just make one new page for the whole batch.

Internally in the pool, we pool pointers to [PageSize]byte, rather
than slices. sync.Pool needs pointer-like things. To store a pointer
to a slice, you have to heap-allocate the slice, also. So, instead
of heap-allocating copies of these slices, we just use pointers to
the raw data.
2022-01-19 15:19:45 -06:00
reese
49972939ec
Merge pull request #1876 from molecula/fb1166
fix bug where drop table wasn't being authorized
2022-01-19 14:26:04 -06:00
reesporte
61ef1aee4e fix older tests 2022-01-19 12:55:07 -06:00
reesporte
e7552a76a7 fix bug where drop table wasn't being authorized
also fixes bug in GetAuthorizedIndexList where perms weren't being properly compared
2022-01-19 12:08:05 -06:00
reese
8834d211af
Merge pull request #1872 from molecula/build-lattice-improvements
actually be able to generate-statik
2022-01-18 15:43:30 -06:00
reesporte
fdf7b4107a actually be able to generate-statik
these were the changes i had to make to be able to build lattice on my machine
2022-01-18 12:14:54 -06:00
Matthew Jaffee
50f798cb18
Merge pull request #1870 from molecula/gitlab-ci-parity
add race and shardwidth22 tests to gitlab
2022-01-17 20:43:57 -06:00
Matthew Jaffee
8b5fdf40fc
Merge branch 'master' into gitlab-ci-parity 2022-01-17 16:35:50 -06:00
Matthew Jaffee
22a60a19f8
Merge pull request #1869 from molecula/qol-tweak
clean up files generated by tests
2022-01-17 16:35:24 -06:00
Matthew Jaffee
a16fee5f88 set shardWidth properly in client
the shardwidth22 tests were broken client side, but we didn't realize
this because we weren't running the client side tests since moving the
client code into the main FB repo until recently (woops), and more
recently, we'd stopped running the shardwidth22 tests in the move to
Gitlab, so when we re-enabled them we finally noticed that they were
broken in the client.

All this change does is takes the shardWidth value from the core
featurebase package instead of using a hardcoded value in the client package.
2022-01-17 10:57:01 -06:00
Matthew Jaffee
da03e3fad2 add race and shardwidth22 to Gitlab CI, cleanup
our coverage reporting was a bit wonky and had files coming from both
test and test-future... made everything come from future
2022-01-17 10:12:40 -06:00
Matthew Jaffee
e297a6775d have simulacradata tests clean up generated files 2022-01-17 09:39:28 -06:00
reese
80f9ddaa02
Merge pull request #1868 from molecula/security-logging
FB1109: authn/z audit logging
2022-01-15 12:43:32 -06:00
reesporte
04a51a7819 remove shadowed ok
thanks golangci-lint
2022-01-15 12:25:09 -06:00
reesporte
50f9b0d1b6 Merge branch 'master' into security-logging 2022-01-15 12:21:38 -06:00
reesporte
7644922406 adds logging to all network requests
addresses ticket FB-1109:
when auth is turned on, we log:
- source ip (if available)
- user-agent
- user id
- user name
- query string
- request endpoint

also adds some minor tweaks and comments  to chkAuthZ flow
2022-01-15 12:21:27 -06:00
Matthew Jaffee
231a395138
Merge pull request #1867 from molecula/external-lookup-gitlab
get external-lookup tests running in Gitlab CI
2022-01-15 08:13:10 -06:00
Matthew Jaffee
d5bd031451 better error reporting if delete fails 2022-01-14 21:09:16 -06:00
Matthew Jaffee
a08560d01e get external-lookup tests running in Gitlab CI
I was going to write a docker-compose thing for this to run postgres
alongside the Go tests, but then saw that Gilab has this handy-dandy
notion of a service, so used that.
2022-01-14 21:09:16 -06:00
reese
f9c7ff3629
Merge pull request #1866 from molecula/fb1130
[fb-1130]: filter http response and lockdown endpoints
2022-01-14 17:45:51 -06:00
reesporte
3fdf4e2d8b Merge branch 'master' into fb1130 2022-01-14 16:06:45 -06:00
reesporte
baf02748be filter http response and lockdown endpoints
- fixes required permissions on some http endpoints
- filters http endpoints:
    - /ui/usage
    - /schema
    - /schema/details
- filter GRPC show tables, fields
- allow admins to do anything
2022-01-14 16:05:54 -06:00
Matthew Jaffee
34c64fbaba
Merge pull request #1865 from molecula/wrapping-etcd-retry
add wrapping to differentiate etcd errors
2022-01-14 15:58:56 -06:00
Matthew Jaffee
555d185929 add wrapping to differentiate etcd errors
we had a CI job fail in an interesting way, but can't tell if the
etcd retrying stuff is working, so adding in this wrapping so we can
better differentiate the errors if we see it again.

Job is here: https://gitlab.com/molecula/featurebase/-/jobs/1977060827

Failure is:

```
=== RUN   TestClusterStuff
    cluster_test.go:36: creating index: against http://pilosa2:10101/index/testidx 404 Not Found: 'creating index: sending CreateIndex message: executing request: against http://pilosa3:10101/internal/cluster/message 500 Internal Server Error: 'processing message: getting index: testidx: etcdserver: request timed out
        ''
--- FAIL: TestClusterStuff (8.85s)
```
2022-01-14 14:01:37 -06:00
reese
605da1e074
Merge pull request #1861 from molecula/bearer-conversion-squashed
[fb-998] [fb-1131] [fb-1129] addresses multiple authn/z tickets
2022-01-14 13:52:24 -06:00
reesporte
89567b791b Merge branch 'master' into bearer-conversion-squashed 2022-01-14 12:34:22 -06:00
Matthew Jaffee
b2afe7ad3b
Merge pull request #1863 from molecula/moar-cicd-clustertests
add clustertests to gitlab CI
2022-01-14 12:32:40 -06:00
reesporte
9f37cf7b48 Merge branch 'master' into bearer-conversion-squashed 2022-01-14 12:32:06 -06:00
reesporte
cf2410fea6 addresses multiple authn/z tickets
* fb-998 - authn/z enabled in handlers (kitchen-sink ticket)
    - authorization is enabled through the use of a bearer token (using header "Authorization")
    - authorization may occur through the use of an "Authorization" header or "molecula-chip" cookie
    - ui is updated for changes to handler
* fb-1131 - protect grpc endpoints
    - GRPC endpoints now check authorization if auth is enabled
* fb-1129 - inter-node communication
    - the following endpoints use the secretKey for authentication:
        - /internal/cluster/message: POST
        - /internal/translate/data: GET, POST

* added test to api_test.go (TestAuth_MultiNode) testing various auth/permissions stuff on a multi-node cluster

not included:
    - fb-1130 - filter response of endpoints
    - fb-1109 - improved audit logging

@jaffee [are you not entertained](https://www.youtube.com/watch?v=mutgotxrcqg)

Co-authored-by: souhailanoor <90720110+souhailanoor@users.noreply.github.com>
Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: kcrodgers24 <49999391+kcrodgers24@users.noreply.github.com>
2022-01-14 12:31:32 -06:00
Matthew Jaffee
2f30bcda45 add clustertests to gitlab CI
had to install some dependencies and things on the runner which are
detailed in a comment.
2022-01-14 11:05:41 -06:00
pokeeffe-molecula
f6c458b093
Merge pull request #1862 from molecula/cicd-smoketest
Now with working integration testting
2022-01-13 15:27:17 -06:00
pokeeffe-molecula
0b9d108626
Merge branch 'master' into cicd-smoketest 2022-01-13 14:52:24 -06:00
pokeeffe-molecula
dcc295b25d fixed broken shell script 2022-01-13 14:24:44 -06:00
Matthew Jaffee
5048c8712f
Merge pull request #1859 from molecula/fieldView
[SUP-132] track field directly in view to prevent deadlocks
2022-01-13 13:50:33 -06:00
pokeeffe-molecula
ff16924a0a fixed path typo 2022-01-13 13:31:41 -06:00
Matthew Jaffee
dad244e0d3 skip sometimes-failing test of experimental code
this is killing us in CI for no good reason
2022-01-13 13:16:57 -06:00
Seebs
6fba8aba8b track field directly in view to prevent deadlocks
The central reason this exists:

**sync.RWMutex can block read locks even when no write lock is yet held.**

If a write lock is *requested*, this can block future read locks. In
particular, this means that recursive read locks are unsafe. But there's
additional problems.

The specific case that bit us involves not two, but *three* things
running at once.

Thing #1: executor doing AvailableShards. This RLocks the index, and
then each field, and then each view. To complete, it must be able to
obtain a read lock on each view in turn.

Thing #2: DeleteField. This Locks the index. Even if it is stuck
waiting for the lock (which it will be until AvailableShards completes),
it can prevent *additional* RLocks of the index.

Thing #3: CreateFragment. This Locks a view, then RLocks the index in
order to look up a field.

CreateFragment can't proceed until DeleteField completes. DeleteField
can't proceed until AvailableShards completes. And AvailableShards
can't proceed until CreateFragment completes.

Solution: Cache the *Field in the view, so we don't need a read lock
on the field or index to complete a CreateFragment.
2022-01-13 13:16:57 -06:00
pokeeffe-molecula
f4d28b840a stop gauntlet from running every build 2022-01-13 13:00:02 -06:00
pokeeffe-molecula
da3cabe642 Merge branch 'master' into cicd-smoketest 2022-01-13 12:57:42 -06:00
pokeeffe-molecula
04a2df3036 added basic integration tests 2022-01-13 12:57:26 -06:00
Matthew Jaffee
4a1e53421e
Merge pull request #1858 from molecula/retryEtcd
[SUP-130] handle ErrTimeout in etcd embed "retryClient"
2022-01-13 12:54:10 -06:00
Seebs
84adefe6a5 handle ErrTimeout in etcd embed "retryClient"
This tries to be more correct/careful about retries (checking against
the actual exported errors from etcdserver, not just the string
representations), and also supports retrying on timeouts, not just
on client changes. It can also retry more than once, mostly in case
we hit one of each of those.

For timeout errors, we mostly use the fact that it's a timeout to
give us a reasonable backoff, but then delay a fraction of a second
longer just to give it a moment to recover if the ErrTimeout is
masking something else that took longer.
2022-01-13 11:47:57 -06:00
Bruce Baranowski
c60bed21c3
Merge pull request #1840 from molecula/IO-47
added tags to sg terraform
2022-01-12 19:18:04 -05:00