Commit graph

92 commits

Author SHA1 Message Date
martinsumner
45f7fcb41a Datasync added for riak_sync strategy 2016-11-27 00:16:49 +00:00
martinsumner
196c807b5e Pass through sync_strategy
Allow to switch for Riak to use o_sync as the sync flag rather than sync
2016-11-25 17:41:08 +00:00
martinsumner
0f7e421371 Add destruction
Allow a store to be cleared out and destroyed
2016-11-21 12:34:40 +00:00
martinsumner
57727e74f9 D'oh 2016-11-18 17:14:01 +00:00
martinsumner
f5944f2466 Change test foler to return (Bucket, Key} as expeceted 2016-11-18 16:52:53 +00:00
martinsumner
6684e8e1d3 Refine query to accept fold functions
Need to be able to pass external fold functions into different queries,
to work as a Riak backend
2016-11-18 15:53:22 +00:00
martinsumner
630f802780 Inker Close nastiness
Try to stop some of the potential deadlocking around Inker close and
prove that snapshots at higher Manifest SQNs can be ignored
2016-11-14 19:34:11 +00:00
martinsumner
44738f7c75 Deferred Deletion of Journals
This allows for deleted journals to be retained for a period (the
waste_retnetion_period).  The idea being that a backup strategy can
ensure that all journals are backed up, even ones created and removed
from within a backup period - so that any restore pont is possible.

This is also a pre-cursor to removing some of the PromptDelete
complexity from the Inker Clerk - all compactions can prompt deletion as
deletion is now deferred.
2016-11-14 11:17:14 +00:00
martinsumner
37c23a5b38 Shift pause out of leveled
Leveled will now signal the need for a pause due to back-pressure, but
not actually pause itself.  The hope is that in a riak implementation
this pause can be managed by the put_fsm, and so not lock the store.
2016-11-07 10:27:38 +00:00
martinsumner
4583460328 Clean API of Riak-specific Methods
Clena the API of Riak specific methods, and also resolve timing issue in
simple_server unit test.  Previously this would end up with missing data
(and a lower sequence number after start) because of the penciller_clerk
timeout being relatively large in the context of this test.  Now the
timeout has bene reduced the L0 slot is cleared by the time of the
close.  To make sure an extra sleep has been added as a precaution to
avoid any intermittent issues.
2016-11-07 10:11:57 +00:00
martinsumner
479dc3ac80 Registering and releasing of Journal snapshots
Added a test of journal compaction with a registered snapshot and it
showed that the deleting of files did not correctly check the list of
registerd snapshots.  Corrected.
2016-11-04 15:56:57 +00:00
martinsumner
2f28ae86e4 Journal compaction test to cover deleted objects 2016-11-03 12:31:00 +00:00
martinsumner
8601e219d5 Revert test commenting
Commented out some tests - bring back in
2016-11-02 13:34:34 +00:00
martinsumner
a56ed18ba9 Test timing
Look to see if test timing related to intermittent failure
2016-11-02 13:27:16 +00:00
martinsumner
e7506c3c1f Startup work - baffled
Changes the stratup otpions to a prolist to make it easier to get
environment variables as default.

Tried application:start - and completely baffled as to how to get this
to work.
2016-11-02 12:58:27 +00:00
martinsumner
3b05874b8a Add initial timestamp support
Covered only by basic unit test at present.
2016-10-31 12:12:06 +00:00
martinsumner
4cffecf2ca Handle gen_server:cast slowness
There was some unpredictable performance in tests, that was related to
the amount of time it took the sft gen_server to accept a cast whihc
passed the levelzero_cache.

The response time looked to be broadly proportional to the size of the
cache - so it appeared to be an issue with passing the large object to
the process queue.

To avoid this, the penciller now instructs the SFT gen_server to
callback to the server for each tree in the cache in turn as it is
building the list from the cache.  Each of these requests should be
reltaively short, and the processing in-between should space out the
requests so the Pencille ris not blocked from answering queries when
pompting a L0 write.
2016-10-31 01:33:33 +00:00
martinsumner
311179964a Quality review
Minor test fix-up and quality changes
2016-10-30 22:06:44 +00:00
martinsumner
0e6ee486f8 Make tets less pointless
Journla compaction test wouldn't actually cause compaction
2016-10-30 20:14:11 +00:00
martinsumner
0e4632ee31 Test correction
In one test run the numbe rof files fluctuated but ended at zero.  The
ending at zero is the importnat thing.
2016-10-27 22:23:19 +01:00
martinsumner
c6ca973517 Penciller shutdown when empty
Stop the penciller from writing an empty file, when shutting down and
the L0 Cache is empty.

Also parameter fiddle to see impact of the Penciller changes.
2016-10-27 21:40:43 +01:00
martinsumner
a00a123817 Recovery strategy testing
Test added for the "retain" recovery strategy.  This strategy makes sure
a full history of index changes is made so that if the Ledger is wiped
out, the Ledger cna be fully rebuilt from the Journal.

This exposed two journal compaction problems

- The BestRun selected did not have the source files correctly sorted in
order before compaction
-  The compaction process incorrectly dealt with the KeyDelta object
left after a compaction - i.e. compacting twice the same key caused that
key history to be lost.

These issues have now been corrected.
2016-10-27 00:57:19 +01:00
martinsumner
254183369e CDB - switch to gen_fsm
The CDB file management server has distinct states, and was growing case
logic to prevent certain messages from being handled in ceratin states,
and to handle different messages differently.  So this has now been
converted to a gen_fsm.

As part of resolving this, the space_clear_ondelete test has been
completed, and completing this revealed that the Penciller could not
cope with a change which emptied the ledger.  So a series of changes has
been handled to allow it to smoothly progress to an empty manifest.
2016-10-26 20:39:16 +01:00
martinsumner
0c331b9c30 Tests uncommented
Accidentally commented tests it pervious commit
2016-10-26 11:45:35 +01:00
martinsumner
2a47acc758 Rolback hash|no_hash and batch journal compaction
The no_hash option in CDB files became too hard to manage, in particular
the need to scan the whole file to find the last_key rather than cheat
and use the index.  It has been removed for now.

The writing to the journal during journal compaction has now been
enhanced by a mput option on the CDB file write - so it can write each
batch as one pwrite operation.
2016-10-26 11:39:27 +01:00
martinsumner
c78b5bca7d Basement Tombstones
Further progress towards the tidying up of basement tombstones in the
Ledger, with support added for key-listing to help with testing (and as
a potentially required feature).

The test is incomplete, but committing at this stage as the last commit
broke some tests (within the test code).

There are some outstanding questions about the handling of tombstones in
the Journal during compaction.  There exists a condition whereby values
could return if a recent journal is compacted and tombstones are removed
(as they are no longer present), but older journals have not been
compacted.  Now on stop/start - if the Ledger is wiped the removal of
the keys will be forgotten but the original PUTs would still remain.

The safest thing maybe to have rule that tombstones are never deleted
from the Inker's Journal - and accept the build-up of garbage.  Or there
could be an addition to the compaction process that checks back through
all the inker files to check that the Key of a tombstone is not present
in the past, before it is removed in the compaction.
2016-10-23 22:45:43 +01:00
martinsumner
b2089baa1e Correct tombstone handling
Prepare SFT files for handling tombstones correctly (without expiry
dates).

Also some work as it can be seen from tests that some SFT files ar enot
be cleared out correctly.  Pausing before trying t clear out the fles to
experiment and trial the possibility that there is a timing issue.
2016-10-21 15:21:37 +01:00
martinsumner
c431bf3b0a Broken snapshot test
The test confirming that deleting sft files wer eheld open whilst
snapshots were registered was actually broken.  This test has now been
fixed, as well as the logic in registring snapshots which had used
ledger_sqn mistakenly rather than manifest_sqn.
2016-10-21 11:38:30 +01:00
martinsumner
f16f71ae81 Revert ominshambles performance refactoring
To try and improve performance index entries had been removed from the
Ledger Cache, and a shadow list of the LedgerCache (in SQN order) was
kept to avoid gb_trees:to_list on push_mem.

This did not go well.  The issue was that ets does not deal with
duplicate keys in the list when inserting (it will only insert one, but
it is not clear which one).

This has been reverted back out.

The ETS parameters have been changed to [set, private].  It is not used
as an iterator, and is no longer passed out of the process (the
memtable_copy is sent instead).  This also avoids the tab2list function
being called.
2016-10-19 00:10:48 +01:00
martinsumner
3e475f46e8 Support for 2i query part1
Added basic support for 2i query.  This involved some refactoring of the
test code to share functions between suites.

There is sill a need for a Part 2 as no tests currently cover removal of
index entries.
2016-10-18 01:59:18 +01:00
Russell Brown
59ea46120e Fix include target 2016-10-17 14:24:32 +01:00
martinsumner
e3ce372f31 Delete
Add functionality to delete keys.  No tombstone reaping yet.
2016-10-16 15:41:09 +01:00
martinsumner
ed17e44f52 Improve test coverage
Some additional tests following previous refactoring for abstraction,
primarily to make manifest print safer an dprove co-existence of Riak
and non-Riak objects.
2016-10-14 22:58:01 +01:00
martinsumner
7eb5a16899 Supporting Tags - Improving abstraction between Riak and non-Riak workloads
The object tag "o" which was taken from eleveldb has been an extended to
allow for specific functions to be triggered for different object types,
in particular when extracting metadata for stroing in the Ledger.

There is now a riak tag (o_rkv@v1), and in theory other tags can be
added and used, as long as their is an appropriate set of functions in
the leveled_codec.
2016-10-14 18:43:16 +01:00
martinsumner
de54a28328 Load and Count test
This test exposed two bugs:
- Yet another set of off-by-one errors (really stupidly scanning the
Manifest from Level 1 not Level 0)
- The return of an old issue related to scanning the journal on load
whereby we fail to go back to the previous file before the current SQN
2016-10-13 17:51:47 +01:00
martinsumner
938cc0fc16 Re-add tests
Oops - committed with tests commented out
2016-10-12 17:35:32 +01:00
martinsumner
0a08867280 Iterator support
Add iterator support, used initially only for retrieving bucket
statistics.

The iterator is supported by exporting a function, and when the function
is claled it will take a snapshot of the ledger, run the iterator and
hten close the snapshot.

This required a numbe rof underlying changes, in particular to get key
comparison to work as "expected".  The code had previously misunderstood
how comparison worked between Erlang terms, and in particular did not
account for tuple length being compared first by size of the tuple (and
not just by each element in order).
2016-10-12 17:12:49 +01:00
martinsumner
4a8a2c1555 Code reduction refactor
An attempt to refactor out more complex code.

The Penciller clerk and Penciller have been re-shaped so that there
relationship is much simpler, and also to make sure that they shut down
much more neatly when the clerk is busy to avoid crashdumps in ct tests.

The CDB now has a binary_mode - so that we don't do binary_to_term twice
... although this may have made things slower ??!!?  Perhaps the
is_binary check now required on read is an overhead.  Perhaps it is some
other mystery.

There is now a more effiicient fetching of the size on pcl_load now as
well.
2016-10-08 22:15:48 +01:00
martinsumner
2055f8ed3f Add more complex snapshot test
This exposed another off-by-one error on startup.

This commit also includes an unsafe change to reply early from a rolling
CDB file (with lots of objects writing the hash table can take too
long).  This is bad, but will be resolved through a refactor of the
manifest writing:  essentially we deferred writing of the manifest
update which was an unnecessary performance optimisation.  If instead we
wait on this, the process is made substantially simpler, and it is safer
to perform the roll of the complete CDB journal asynchronously.  If the
manifest update takes too long, an append-only log may be used instead.
2016-10-07 10:04:48 +01:00
martinsumner
ad5aebe93e Further work on system tests
Another issue exposed with laziness in the using an incomplete ledger
when checking for presence during compaction.
2016-10-05 18:28:31 +01:00
martinsumner
d903f184fd Add initial end-to-end common tests
These tests highlighted some logical issues when scanning over databases
on startup, so fixes are wrapped in here.
2016-10-05 09:54:53 +01:00
martinsumner
507428bd0b Add initial system test
Add some initial system tests.  This highlighted issues:
- That files deleted by compaction would be left orphaned and not close,
and would not in fact delete (now deleted by closure only)
- There was an issue on stratup that the first few keys in each journal
would not be re-loaded into the ledger
2016-10-03 23:34:28 +01:00