featurebase/test
Seebs ceaf5c15d1
thread the holder through things, and improve snapshot queue logic
This is logically two separate things, but the individual changes
are thoroughly intertwined in the code.

The first change is a logical change to the design of the snapshot
queue, which is that it now adjusts the maxOpN the background scan
targets, allowing it to lower that value over time when things are
quiet. We do this because it turns out that on large data sets,
this can make a factor-of-four difference in memory usage!

So, in general, on a quiet system, each pass through the holder
aims for about 1/4 of the existing fragments to get snapshotted.
When there's more load, we adjust those values up.

We also make the snapshot queue a bit less chatty, to make testing
less annoying -- we only print stats if the queue enqueues at least
two snapshots, or skips any.

The second change is threading the holder through things. We've
always threaded the logger through, and then added the snapshot
queue, and some of the Inspect-related work led to wanting to
have a way to thread options through, so what if we just threaded
the holder itself through, and removed the direct copying around
of the logger, snapshot queue, and so on. Similarly, everything
can now use holder.PartitionN instead of having to get its own
copy of PartitionN handed out to each index.

This does imply ensuring that test cases always get a reasonable
default holder.

This is a precursor to adding additional information to the holder,
such as whether it's in a special read-only mode, which would imply
not modifying on-disk files. This is already semi-supported for
the specific case of the background snapshot queue and cache flushing,
which are attached to the (created in a previous commit) new
holder Activate method, instead of being automatic on holder Open.

The change to a snapshot queue can also cause races in tests, because
the fragment.Clean method's "sanity check" accesses a fragment without
a lock. Fix that. Since there's a couple of t.Fatalf(), but we need
to release the lock before closing, we use an anonymous function
with a defer to handle that. Whee!
2020-06-29 15:13:50 -04:00
..
cluster.go remove the last usages of test.NewExecutor and cleanup unused in test package 2018-07-01 07:31:31 -05:00
field.go thread the holder through things, and improve snapshot queue logic 2020-06-29 15:13:50 -04:00
handler.go remove the last usages of test.NewExecutor and cleanup unused in test package 2018-07-01 07:31:31 -05:00
holder.go support fragment sync for int and decimal fields 2020-03-13 12:15:54 -05:00
index.go thread the holder through things, and improve snapshot queue logic 2020-06-29 15:13:50 -04:00
logger.go lock BufferLogger for reads/writes 2019-11-12 12:15:13 -06:00
pilosa.go Provide option for adjusting node timeouts, set it for tests. 2020-06-08 12:10:40 -05:00
pilosa_test.go v2.0.0 2019-10-08 14:56:17 -06:00
transaction.go increase test deadlineSkew to 1s 2020-05-18 19:57:44 -05:00