Commit graph

8420 commits

Author SHA1 Message Date
Ben Johnson
3c082b7d2c
Merge pull request #1819 from molecula/rbf-check-empty-branch
[FB-1105] Add rbf check for empty branch pages
2021-12-20 14:01:10 -07:00
Ben Johnson
60f0008dec
Merge branch 'master' into rbf-check-empty-branch 2021-12-20 13:40:34 -07:00
Ben Johnson
6481b4eabe Add rbf check for empty branch pages 2021-12-20 13:24:34 -07:00
Matthew Jaffee
3de18a9f77
Merge pull request #1816 from molecula/fb-1105
[FB-1105] Fix RBF multi-level branch delete
2021-12-20 14:13:24 -06:00
Ben Johnson
5f8a281918 Fix RBF multi-level branch delete
This commit fixes a bug in RBF where deleting all the elements in
a bitmap that has a depth greater than 2 will cause the root bitmap
to be a branch page with a cell count of zero. This breaks an
assertion in `readBranchCell()` which causes a panic post-commit.

A new assertion has been added to prevent a branch page from being
written with a zero count in the future.
2021-12-20 12:52:14 -07:00
souhailanoor
7d0e0600d6
Merge pull request #1805 from molecula/fb1000
FB-1000: Ability to map user groups to cluster admin / index-level permissions
2021-12-20 13:07:13 -06:00
souhailanoor
55c67a9d1f
Merge branch 'master' into fb1000 2021-12-20 12:35:17 -06:00
seebs
88569789dd
Merge pull request #1817 from molecula/pages
rbf pages subcommand: don't panic on invalid page type
2021-12-20 12:30:57 -06:00
Seebs
977a699a98 don't panic on invalid page type
debugging tools shouldn't panic when they encounter bugs. insert
"you had one job" meme.
2021-12-20 10:58:41 -06:00
souhailanoor
e82088e086
Merge branch 'master' into fb1000 2021-12-19 11:38:08 -06:00
Souhaila Noor
c14bd08213 updated admin to be at the cluster level 2021-12-19 11:37:41 -06:00
Ben Johnson
06204bcf7b
Merge pull request #1809 from molecula/fb992
[FB-992] Implement RBF Async Checkpoint
2021-12-18 13:08:42 -07:00
Matthew Jaffee
7826c06eee use atomics for currentWorker to avoid race 2021-12-18 09:04:04 -06:00
Seebs
8974014d57 too tired to be writing code 2021-12-17 22:48:40 -06:00
Seebs
1439c316d3 read-only lock for check of shutdown 2021-12-17 22:25:01 -06:00
Seebs
9a2a8f964c fix silly typo in worker pool downscaling 2021-12-17 22:22:27 -06:00
Seebs
8f217ab099 scale down worker pool when it's large
if we have more than twice our starting worker pool, and have had no
tasks when checking the queue for multiple rounds, send a job telling
the system to retire a worker. eventually we'll get down to about 2x
the starting pool size if we stay idle.
2021-12-17 22:05:41 -06:00
Seebs
9945575bf1 create a new worker every so often if progress isn't happening
this is very approximate and may be a mess and may be unbounded, but
in practice i think it should be okay. if it's not we'll have an
adventure.
2021-12-17 21:57:38 -06:00
Seebs
41f6156bda don't use write Tx even when we're using the expensive logic for write Tx 2021-12-17 17:57:33 -06:00
Souhaila Noor
a606bd030a addressed reviewer's feedback 2021-12-17 16:46:07 -06:00
Souhaila Noor
f05f1d0de2 added more authz functionality 2021-12-17 15:51:37 -06:00
Matthew Jaffee
0799862266 move some locks, nbd 2021-12-17 15:09:25 -06:00
Matthew Jaffee
1fd872b126 less write locks in fragment.importRoaring/row 2021-12-17 15:09:25 -06:00
Ben Johnson
57ca5591a2 Unlock rbf.DB during WAL copy & fsync() 2021-12-17 15:09:25 -06:00
Seebs
47e098c3b1 simplify txWaiter
We don't need a condition variable for a thing with a single waiter
which waits only once, and a data structure which only one side ever
modifies. That's a closable channel.
2021-12-17 15:09:25 -06:00
Seebs
994cc03e88 fix locking and list management for afterCurrentTx
Two issues: First, there was a race condition because we were never
using the mutex for anything but the condvar broadcast, second, there
was no reason for the afterCurrentTx to need to maintain the list since
we already know where in the list we are when we are waking it up.

afterCurrentTx still wants to run with the db lock held, because
the degenerate case (no outstanding Tx) means that it will be running
with it held already. That's for another commit.
2021-12-17 15:09:25 -06:00
Seebs
5764d98f6d test fixes and order of operations on changing db.PageMap
We need to update db.PageMap after we write the db, but before
we truncate the WAL, so new transactions don't pick up the old
PageMap and then get a truncated WAL.

Also, checkpoint should not abort if there's txs -- that's okay now.
2021-12-17 15:09:25 -06:00
Seebs
29f5f6d7c2 copy things rows after getting them and before their finishers during writes
When a qcx is a write, every Tx under it closes immediately, thus
invalidating all returned data. Thus, if you do a Not() inside a Store(),
you're doing a difference on an existence row and some other row
call... and both of those rows were run, individually, as separate
transactions that got invalidated the moment they were fetched. Oops.
2021-12-17 15:09:25 -06:00
Ben Johnson
4279e2cb2d rebase fixes 2021-12-17 15:09:25 -06:00
Seebs
c3c02eabb0 almost but not quite support async checkpoint
This gets us to being able to run reads during a checkpoint, but
now we have to wait for new reads to end before we can release
the write lock, etc.

This is actually slightly slower, but if we could get ONE more step,
we could allow new writes during that phase, to a different WAL,
if we had a different WAL to write to.
2021-12-17 15:09:25 -06:00
Seebs
6d68e71933 make the checkpoint async 2021-12-17 15:09:25 -06:00
Seebs
806669fa0f make db able to fail out if it can't checkpoint, fix silly wrong-units error
PageMap uses "WALID", which is a WAL page ID relative to the "base" ID of the
WAL, rather than the wal page count you'd get just reading the file. So everything
it reports has a fixed offset at any given time. I think this may be left
over from a point where there were partial checkpoints. Anyway, the net
outcome is that each new transaction was getting different page IDs, but
the actual WAL pages did not always reflect that. Each checkpoint increases
the offset. This might imply that we can start having problems after
4 billion pages written even if most of them were redundant?

Anyway, with that fixed, this seems to work. I think.
2021-12-17 15:09:25 -06:00
Seebs
b8f59d922c checkpoint rework/refactoring: logger, async-ish checkpoint
Trying to make the checkpoint be asynchronous-at-all, and
also allowing it to log.
2021-12-17 15:09:25 -06:00
Seebs
a631e25dc5 refactor: removeTx responsible for getting/releasing its own lock
We change nothing substantive here, except that there's a window
between when a write transaction updates the root pages and when
it removes itself from the db tx list and possibly causes a checkpoint
where it's not holding the db lock.

The issue here is that we want to be able to *keep* the lock but
still return, so no one else can start transactions, but the specific
Rollback or Commit that removed the last outstanding transaction
doesn't block forever. This will, later, allow us to exercise
finer-grained control over when we allow transactions. This is
a separate commit so we can run the test suite against it, and
verify that this part in particular didn't break anything.
2021-12-17 15:09:25 -06:00
Seebs
5c889c72bd make test hit the lock harder
Discovered test was running slightly strange and spending an unreasonable
amount of time on rand.Intn(), possibly because we weren't caching the
value used as the loop condition. Tweaked that, also made the pool a
bit different. Now it takes ~50 seconds for benchtime 100x, and produces
a profile with a TON of time spent waiting on sleeps (expected) and
the condition variable for waiting on checkpoints (the thing we want
to measure, really).
2021-12-17 15:09:25 -06:00
Seebs
3ed4487ae2 scratch space for FB-992: create benchmark for checkpointing
Note also the commented-out debug printf in checkpoint, there as a
reference. This is interesting because it turns out that MOST of checkpoint
writes is not actually writing new pages in most cases.

The actual "pages in WAL : pages in map" ratio is typically around 30:1
apparently. This would likely be different in cases where we were
updating existing data, though.

This is scratch space to prep for an actual work. The final
results will likely be different.
2021-12-17 15:09:25 -06:00
souhailanoor
44b855d50b
Merge branch 'master' into fb1000 2021-12-17 11:46:25 -06:00
Souhaila Noor
2ca29e6018 addressed reviewer's comments and added more tests 2021-12-17 11:45:35 -06:00
reese
65ab92f364
Merge pull request #1811 from molecula/fb-1027
[fb-1027] ensure field bit depth is set when restoring shard
2021-12-16 08:54:34 -06:00
reesporte
c59ce837b3 ensure field bit depth is set when restoring shard
we have to manually set the cache value here bc it wont get set until the node is restarted otherwise
2021-12-15 16:09:45 -06:00
Souhaila Noor
484cbbcd09 fixed func name 2021-12-15 14:19:21 -06:00
souhailanoor
0c65485b0e
Merge branch 'master' into fb1000 2021-12-15 13:37:15 -06:00
Souhaila Noor
48913caafd renamed package to authz, inmplemented reviewer's feedback 2021-12-15 13:36:27 -06:00
Matthew Jaffee
600494c724
Merge pull request #1810 from molecula/sup-126
[SUP-126] Defer unlock & rollback during rbf.DB.Begin()
2021-12-15 08:39:24 -06:00
Ben Johnson
7141662c03 Defer unlock & rollback during rbf.DB.Begin() 2021-12-15 07:16:30 -07:00
souhailanoor
a8b198af99
Merge branch 'master' into fb1000 2021-12-13 14:15:09 -06:00
tgruben
a52eda0510
Merge pull request #1808 from molecula/sup120
[SUP-120] use higher level iterator in order to account for ops log
2021-12-13 13:51:29 -06:00
Todd Gruben
c25ab78b03 use higherlevel iterator in order to account for ops log 2021-12-13 13:10:16 -06:00
Souhaila Noor
3c8a7384ba added reviewer's suggestions 2021-12-13 13:05:35 -06:00
Souhaila Noor
32228bb134 updated go.mod 2021-12-13 10:48:40 -06:00