Commit graph

1088 commits

Author SHA1 Message Date
Martin Sumner
234e0066e8 Mas i370 deletepending (#377)
Previously delete_confirmation was blocked on work_ongoing.

However, if the penciller has a work backlog, work_ongoing may be a recurring problem ... and some files, may remain undeleted long after their use - lifetimes for L0 fails in particular have seen to rise from 10-15s to 5m +.

Letting L0 files linger can have a significant impact on memory. In put-heavy tests (e.g. when testing riak-admin transfers) the memory footprint of a riak node has bene observed peaking more than 80% above normal levels, when compared to using this patch.

This PR allows for deletes to be confirmed even when there is work ongoing, by postponing the updating of the manifest until the manifest is next returned from the clerk.

Co-authored-by: Thomas Arts <thomas.arts@quviq.com>
2022-05-24 10:04:55 +01:00
Martin Sumner
f8485210ed
Mas i370 d31 sstmemory (#373)
* Don't use fetch_cache below the page_cache level

* Don't time fetches due to SQN checks

SQN checks are all background processes

* Hibernate on SQN check

SQN check in the penciller is used for journal (all object) folds, but mainly for journal compaction.  Use this to trigger hibernation where SST files stay quiet after the compaction check.

* Add catch for hibernate timeout

* Scale cache_size with level

Based on volume testing.  Relatively speaking, far higher value to be gained from caches at higher levels (lower numbered levels).  The cache at lower levels are proportionally much less efficient.  so cache more at higher levels, where there is value, and less at lower levels where there is more cost relative to value.

* OTP 24 fix to cherry-pick

* Make minimal change to previous setup

Making significant change appears to not have had the expected positive improvement - so a more minimal change is proposed.

The assumption is that the cache only really gets used for double reads in the write path (e.g. where the application reads before a write) - and so a large cache make minimal difference, but no cache still has a downside.

* Introduce new types

* Mas i370 d30 sstmemory (#374)


* Don't time fetches due to SQN checks

SQN checks are all background processes

* Hibernate on SQN check

SQN check in the penciller is used for journal (all object) folds, but mainly for journal compaction.  Use this to trigger hibernation where SST files stay quiet after the compaction check.

* Add catch for hibernate timeout

* Scale cache_size with level

Based on volume testing.  Relatively speaking, far higher value to be gained from caches at higher levels (lower numbered levels).  The cache at lower levels are proportionally much less efficient.  so cache more at higher levels, where there is value, and less at lower levels where there is more cost relative to value.

* Make minimal change to previous setup

Making significant change appears to not have had the expected positive improvement - so a more minimal change is proposed.

The assumption is that the cache only really gets used for double reads in the write path (e.g. where the application reads before a write) - and so a large cache make minimal difference, but no cache still has a downside.

* Introduce new types

* More memory management

Clear blockindex_cache on timeout, and manually GC on pclerk after work.

* Add further garbage collection prompt

After fetching level zero, significant change in references in the penciller memory, so prompt a garbage_collect() at this point.
2022-04-23 13:38:20 +01:00
Martin Sumner
75edb7293d Revert "Don't use fetch_cache below the page_cache level"
This reverts commit 656900e9ec.
2022-03-11 11:07:01 +00:00
Martin Sumner
5eae8e441f Revert "Don't time fetches due to SQN checks"
This reverts commit fb490b9af7.
2022-03-11 11:06:58 +00:00
Martin Sumner
2e0b20a071 Revert "Hibernate on SQN check"
This reverts commit eedd09a23d.
2022-03-11 11:06:51 +00:00
Martin Sumner
eedd09a23d Hibernate on SQN check
SQN check in the penciller is used for journal (all object) folds, but mainly for journal compaction.  Use this to trigger hibernation where SST files stay quiet after the compaction check.
2022-03-11 08:49:56 +00:00
Martin Sumner
fb490b9af7 Don't time fetches due to SQN checks
SQN checks are all background processes
2022-03-11 08:49:48 +00:00
Martin Sumner
656900e9ec Don't use fetch_cache below the page_cache level 2022-03-11 08:49:29 +00:00
Martin Sumner
8c4de27789 Fix spec for book_hotbackup/1
Returned function requires a backup path
2021-11-10 10:52:19 +00:00
Martin Sumner
82cc76c8c6 Tidy up some undefined functions in dialyzer specs (#368) 2021-11-05 09:16:34 +00:00
Martin Sumner
27cf6bef55
Mas i361 d31 (#365)
* Resolve hash 0 of confusion (#362)

* Resolve hash 0 of confusion

Ensure that a hash of 0 is not confused with an empty index entry (where both hash and position are 0).  For a genuine entry position must always be non-zero.

* Use little endian format directly

... instead of extracting in big_endian format then flipping (or flipping before writing)

* OTP 24 dialyzer fix in test
2021-10-27 14:04:08 +01:00
Martin Sumner
43ec9a4eab
Mas i363 d31 (#364)
* Reduce size of state on terminate (#363)

Otherwise large volume of keys will be written on failure of the process

* Add format_status to leveled_sst
2021-10-27 13:42:53 +01:00
Martin Sumner
beb8ba14a5
Handle a Filename not being present in pending_deletes (#357)
This may be due to a situation whereby a second confirm_delete has been sent before the sst_deleteconfirmed has been received from the first request.

Now this will now cause inert action rather than crashing.
2021-10-18 11:06:52 +01:00
Martin Sumner
70ebb62a61 Search the loader's mock cache .. (#354)
... in the correct direction - otherwise frequently updated objects may not be indexed correctly on reload.
2021-10-04 13:34:29 +01:00
Martin Sumner
4ec8d3e25c Commit selective_sync 2021-10-01 01:51:59 +01:00
Martin Sumner
4ec9d14019 Expose 8 arity-put
Required for selective sync
2021-09-30 22:10:19 +01:00
Martin Sumner
a0e9ac737c
Mas i340 doublel3 d31 (#347)
* Double size of L4 files

And double max efficient size of leveled_ebloom

* Revert penciller shape

But expand file size at L3

* More concise version

Following code review

* OTP 24 dialyzer fix

Bindings intended to match - so don't use underscore

* Allow eqc tests to work from `rebar3 as eqc shell`

Then `eqc:quickcheck(leveled_statemeqc:prop_db()).`

Plus markdown tidy
2021-08-23 17:18:45 +01:00
Martin Sumner
507bf63e22
Address issue with comment (#349)
https://github.com/martinsumner/leveled/issues/269
2021-08-10 13:11:09 +01:00
Martin Sumner
ec52b16cfd
Make deletion confirmation an async message (#344)
Currently a sync call is made from cdb to inker wen confirming deletion (checking no snapshots have an outstanding requirement to access the file), whereas an async call is made from sst to penciller to achieve the same thing.

Due to the potential of timeouts and crashes - the cdb/inker delete confirmation process is now based on async message passing, making it consistent with the sst/penciller delete confirmation process.
2021-07-27 17:06:07 +01:00
Martin Sumner
2cb87f3a6e
Develop 3.1 eqc (#339)
* Add EQC profile

Don't run EQC tests, unless specifically requested e.g. `./rebar3 as eqc eunit --module=leveled_eqc`

* Remove eqc_cover parse_transform

Causes a compilation issue with the assertException in leveled_runner

* Allow EQC test to compile

EQC only works on OTP 22 for now, but other tests should still work on OTP 22 and OTP 24

* Add more complex statem based eqc test

* Add check for eqc profile
2021-05-26 17:40:09 +01:00
Martin Sumner
ed0301e2cf
Mas i335 otp24 (#336)
* Address OTP24 warnings, ct and eunit paths

* Reorg to add OTP 24 support

* Update VOLUME.md

* Correct broken refs

* Update README.md

* CI on all main branches

Co-authored-by: Ulf Wiger <ulf@wiger.net>
2021-05-25 13:41:20 +01:00
Martin Sumner
d8be8d4ace Add lz4 dep 2021-03-02 14:21:13 +00:00
Martin Sumner
9157de680e Change refernces to loop state records
Resolve issue with OTP 22 performance https://github.com/martinsumner/leveled/issues/326 - by changing refernces to loop state.

The test perf_SUITE proves the issue.

OTP 22, without fixes:

Fold pre-close 41209 ms post-close 688 ms

OTP 22, with fixes:

Fold pre-close 401 ms post-close 317 ms
2021-01-11 10:39:34 +00:00
Martin Sumner
b8d71023a8 Allow lower penciller cache sizes to be enforced
It might be necessary to have a low penciller cache size.  however, currently the upper bound of that cache size can be very high, even when a low cache size is set.  This is due to the coin tossing done to prevent co-ordination of L0 persistence across parallel instances of leveled.

The aim here is reduce that upper bound, so that any environment having problems due to lack of memory or https://github.com/martinsumner/leveled/issues/326 can more stricly enforce a lower maximum in the penciller cache size
2020-12-22 12:34:01 +00:00
Martin Sumner
186e3868a9
Merge pull request #325 from martinsumner/mas-i321-checkactive
Mas i321 checkactive
2020-12-08 16:33:05 +00:00
Martin Sumner
eeeb7498c0 Review feedback
Also add types to try and help avoid further confusion
2020-12-04 19:40:28 +00:00
Martin Sumner
7bf67563ef
Update src/leveled_iclerk.erl
Co-authored-by: Thomas Arts <thomas.arts@quviq.com>
2020-12-04 14:31:47 +00:00
Martin Sumner
108527a8d9 is_active check within fold
Not within the fold fun of the leveled_runner.

This should avoid constantly having to re-merge and filter the penciller memory when running list_buckets and hitting inactive keys
2020-12-04 12:49:17 +00:00
Martin Sumner
f3f574de02 Switch to checking on get_kvrange
In production scale testing, placing te check_modified call on get_kvrange not get_slots made the performance difference.

It should help in get_lots as well, but unable to reliably get coverage in tests with this.  So for now, will leave off until a proper test can be constructed which demonstrates any benefits.
2020-12-03 13:37:22 +00:00
Martin Sumner
a210aa6846 Promote cache when scanning
When scanning over a leveled store with a helper (e.g. segment filter and last modified date range), applying the filter will speed up the query when the block index cache is available to get_slots.

If it is not available, previously the leveled_sst did not then promote the cache after it had accessed the underlying blocks.

Now the code does this, and also when the cache has all been added, it extracts the largest last modified date so that sst files older than the passed in date can be immediately dismissed
2020-12-02 13:29:50 +00:00
Martin Sumner
80e6920d6c Standardise retention decision
Use the same function to decide for both scoring and compaction - and avoid the situation where somethig is scored for cmpaction, but doesnt change (which was the case previously with tombstones that were still in the ledger).
2020-11-29 15:43:29 +00:00
Martin Sumner
00823584ec Improve the quality of score
Move the average towards the current score if not scoring each run.   Score from more keys to get a better score (as overheads of scoring are now better sorted by setting score_onein rather than by reducing the sample size).
2020-11-27 20:03:44 +00:00
Martin Sumner
bcc331da10 Set max limit of 24 hours on cached score 2020-11-27 13:56:47 +00:00
Martin Sumner
b4c79caf7a Allow for caching of compaction scores
Potentially reduce the overheads of scoring each file on every run.

The change also alters the default thresholds for compaction to favour longer runs (which will tend towards greater storage efficiency).
2020-11-27 02:35:27 +00:00
Martin Sumner
5bc137e4ef
Merge pull request #317 from martinsumner/mas-i1765-reducelog
Reduce logging
2020-08-05 19:42:22 +01:00
Martin Sumner
dd5b22a71e Reduce logging
Otherwise erlang.log with default settings my cycle too fast for a long indexer
2020-08-05 18:54:13 +01:00
Martin Sumner
37f006bba1
Merge pull request #315 from martinsumner/mas-i1765-reducelog
Mas i1765 reducelog
2020-07-23 14:14:04 +01:00
Martin Sumner
a6bd151d58 Use git tag for version 2020-07-23 14:03:21 +01:00
Martin Sumner
5cc281b73a Drop P0039 log to debug
Logging 80 times per second in some Riak tests
2020-07-23 14:00:59 +01:00
Martin Sumner
35167e3796
Update leveled.app.src
Bump version
2020-06-18 13:20:49 +01:00
Martin Sumner
4caefcf4aa Merge branch 'master' into develop-3.0 2020-04-09 12:23:42 +01:00
Martin Sumner
d05a5fdd46 Make grooming more accurate
Check more files to optimise grooming choices
2020-03-30 20:07:48 +01:00
Martin Sumner
9e56bfa947 Merge branch 'master' into mas-i311-mergeselector 2020-03-30 20:07:05 +01:00
Martin Sumner
9838e255d2 Address review comments
More efficient traversal of list to score.
2020-03-29 20:02:21 +01:00
Martin Sumner
28c88ef8b8 Typo 2020-03-27 20:09:03 +00:00
Martin Sumner
42eb5f56bc Merge branch 'master' into mas-i311-mergeselector 2020-03-27 17:11:18 +00:00
Martin Sumner
da97d65a23 Add grooming compactions
Make half of LSM-tree compactions grooming compactions i.e. compactions biased towards merging files with large numbers of tombstones.
2020-03-27 15:09:48 +00:00
Martin Sumner
aca945a171 Add counting of tombstones to new SST files
.. and that old-style SST files cna still be created, and opened, with a return of 'not_counted'
2020-03-27 10:20:10 +00:00
Martin Sumner
e175948378 Remove references ot 'skip' strategy
Now called `recovr`
2020-03-26 14:25:09 +00:00
Martin Sumner
4ef0f4006d Extend mergefile_selector for strategy
Strategy only applied below L1, and only random strategy supported
2020-03-26 14:18:57 +00:00