Commit graph

247 commits

Author SHA1 Message Date
Martin Sumner
bfaed921e6 Split code for folders - introduce runner actor
Introduce a dedicated module for all the different fold types.  Also simplify the list of folders by deprecating those folds that should eb achieveable by fold_heads/fold_objects type folds but with smarter functions.

Makes sure that the fold functiosn also have better spec coverage, and are dialyzer checked.
2017-10-17 20:39:11 +01:00
Martin Sumner
0f5911ab70 Add unit test of archive files 2017-09-28 10:50:54 +01:00
Martin Sumner
3950942da3 Roll in fix for intermittently failing test
As descibed in https://github.com/martinsumner/leveled/issues/92

Only the first fix was made.

Just to eb safe - archiving means renaming to another file with a different extension.  Assumption is that renamed files cna be manually reaped if necessary.
2017-09-27 23:52:49 +01:00
Martin Sumner
eba21f49fa Make tests compatible with OTP 16
this required a switch to change the sync strategy based on rebar parameter.

However tests could be slow on macbook with OTP16 and sync - so timeouts added in unit tests, and ct tests sync_startegy changed to not sync for OTP16.
2017-09-15 15:10:04 +01:00
Heinz N. Gies
25389893cf Add compatibility for old and new random / rand functions 2017-08-01 11:24:12 +02:00
Heinz N. Gies
369bdece5f Cleanup dialyzer errrors in leveled_penciller 2017-07-31 19:39:40 +02:00
martinsumner
8da8722b9e Add temporary aae index
Pending ct tests.  The aae index should expire after limit_minutes and
be on an index which is rounded to unit_minutes.
2017-06-30 10:03:36 +01:00
martinsumner
32612dfe4a Yet another array type OTP16 issue 2017-06-01 21:39:01 +01:00
martinsumner
2738ee951c Add specs and docs for Penciller
Help the dialyzer
2017-05-22 18:09:12 +01:00
martinsumner
4d12dfe0ab Returning snapshots
If the clerk updates the manifest - it might not recognise changes to
the manifest made since the clerk took the manifest.  So the penciller
must merge its view of the snapshots back in to the updated manifest
2017-04-19 22:46:37 +01:00
Martin Sumner
fa9daf8696 Correct async fold
fold objects which snaps in the fold was implemented incorrectly - it
took information from the LedgeCache at the point of the request, not
at the point of the fold.  So the LedgerCache SQN may have been
surpassed in the Penciller by the time the fold was called.
2017-04-17 23:01:55 +01:00
Martin Sumner
e01efe02f6 Long snaphsot timeout increase
Increase this to 90 minutes.  The first time all the snapshots are
rebuilt it may take a long time, but they all get scheduled together -
and queued until concurrency limits allow it to be completed.

currently the snapshot is made on initialisation, and only released
when completed (which may be after the queue).  so the last couple of
snapshots were over-shooting the 1 hour.
2017-04-13 22:43:29 +01:00
Martin Sumner
4e9fa2a206 Timeout long-running snapshots
Add logic to timeout long-running snapshots.
2017-04-05 09:16:01 +01:00
martinsumner
878ec41ffa Merge remote-tracking branch 'refs/remotes/origin/mas-sstblockv2-i42' into mas-pushmem-i46
# Conflicts:
#	src/leveled_penciller.erl
2017-03-14 15:43:35 +00:00
martinsumner
c5bb150f97 Drop some logs
Not found to be interesting so far
2017-03-13 20:30:33 +00:00
martinsumner
f3e962c43a Add level to SST slow fetch log 2017-03-13 12:16:36 +00:00
martinsumner
62c3ba8b6f Passing ETS reference not tree
ETS reference gets converted to tree by Penciller
2017-03-13 11:54:46 +00:00
martinsumner
39a005a8d0 Try and be consistent in flilename format
i.e. ./filename.sst
2017-03-09 21:52:29 +00:00
martinsumner
4c59342600 Change SST reference to split filename
The manifest and the logs are bloated by having the full file path for
every filename in there - given the root path is constant.

Could also cause issues if the mount point is ever changed.
2017-03-09 21:23:09 +00:00
martinsumner
cd82bba6cd Use cache size - don't recalc length 2017-03-06 21:44:20 +00:00
martinsumner
9ad6969b0d Seed randomnes at Actor startup 2017-03-06 21:35:02 +00:00
martinsumner
87f2c5d7ae Merge remote-tracking branch 'origin/mas-2iphase2-i34' into mas-2iphase2-i34
# Conflicts:
#	src/leveled_log.erl
2017-03-06 18:44:22 +00:00
martinsumner
c92107e4b4 2i order of events
When running a load of mainly 2i queries, there is a huge cost in the
previous snapshot code.  The time taken to create a clone of the
Penciller (duplicating all the LoopState) varied between 1 and 200ms
depedning on the size of the LoopState.

For 2i queries, most of that LoopState was then being thrown away after
running the query against the levelzero_cache.  This was taking < 1ms on
average.  It would be better to avoid the o(100)ms of CPU  burning and
block for o(1)ms - so th eorder of events have been changed ot filter
first so only the small part of the LoopState actually required is
copied to the clone.
2017-03-06 18:42:32 +00:00
Martin Sumner
c1dc92720c Random, random, random
well random had me foxed.  As the clone was short-lived process it only
called random once - and so always got the same answer.

random has to be seeded to give different answers when called once from
a process - so this is now seeded in leveed_log
2017-03-06 13:51:38 +00:00
martinsumner
eb6f668fcd Use log at random
Easy way to sample frequent things - especially when they'r ein ocverag
equeries
2017-03-06 10:34:56 +00:00
martinsumner
5c2f05858d Alter logging to help understand performance factors
Change logging of the snapshots to better understand performance
2017-03-06 10:17:51 +00:00
martinsumner
b01f7d23df Add pre-filter for 2i queries 2017-03-02 17:49:43 +00:00
martinsumner
35b6e16590 Clear dialyzer warnings 2017-02-27 20:23:36 +00:00
martinsumner
4e6c22d7e6 Dumb test
Can't test for slow not_present outside of simple unit test ... will be
very rare event
2017-02-26 21:48:04 +00:00
martinsumner
41e5686a66 Test coverage - missing 1% 2017-02-26 20:52:40 +00:00
martinsumner
793977b76c Prevent double work ongoing
This was the cause of the pclerk crash.  The concurrent work would lead
to the attempt to re-fetch the prompted deletions after they had been
deleted.
2017-02-09 23:41:28 +00:00
martinsumner
ed96d0ca7a Change so that type of cache is parameterised
The Tree doesn't seem to be better than the skiplist.  Get ready to make
this switchable
2017-01-21 11:38:26 +00:00
martinsumner
3d99036093 Switch the LM1 cache to be a tree
Use a tree of lists not a skiplist
2017-01-20 16:36:20 +00:00
martinsumner
7086717765 Rename to pmanifest
There may be a seperate imanifest in the future
2017-01-17 14:11:50 +00:00
martinsumner
c99c50ce6e Fix-up message exchange on confirm delete 2017-01-17 11:18:58 +00:00
martinsumner
9832ecc369 Manifest now back to a simple list
This has refactored code with the implementation of the manifest
isolated in to a seperate module, and the pure async relationship
between penciller and their clerk.  However, the manifest is just a
simple list at each level.
2017-01-17 10:12:15 +00:00
Martin Sumner
f868be8086 Change Penciller to Clerk handoff
correct the previous change to make sure that deletes are not confirmed
when work is outstanding, but also make sure that the clerk only ever
casts the Penciller so no deadlocks can ensue.
2017-01-15 00:52:43 +00:00
martinsumner
0c01a90f96 Manifest SQN at startup
An L0 file outside the Manifest will be written at a Manifest SQN one
higher - so need to look at stratup for one at one higher
2017-01-14 22:31:45 +00:00
martinsumner
7b0b3e9b83 Add logging of Manifest SQN at startup 2017-01-14 22:26:26 +00:00
martinsumner
ea171cb13b Attempt to stop race - between level zero and ongoing merge 2017-01-14 22:03:57 +00:00
martinsumner
8f0a096dd2 More work on timeout 2017-01-14 20:57:43 +00:00
martinsumner
86af99e511 Set timeout correctly 2017-01-14 20:19:08 +00:00
martinsumner
13c81f0ed1 Basic working
Some basic tests working - but still outstanding issues.
2017-01-14 19:41:09 +00:00
martinsumner
76bdd83346 Manifest refactor - STILL BROKEN
Some working tests now, but sitll broken
2017-01-14 16:36:05 +00:00
martinsumner
0204a23a58 Refactor - STILL BROKEN
Will at least compile, but in need of a massive eunit rewrite and
associated debug to get back to a potentially verifiable state again
2017-01-13 18:23:57 +00:00
martinsumner
08641e05cf Manifest changes - BROKEN
Going to abandond this branch for now.  The change is beoming
excessively time consuming, and it is not clear that a smaller change
might not achieve more of the objectives.

All this is broken - but perhaps could get picke dup another day.
2017-01-12 13:48:43 +00:00
martinsumner
83be8041f0 Update comments to reflect changes 2017-01-06 10:09:15 +00:00
martinsumner
5a88565c08 Switch to binary index in pmem
Remove the ets index in pmem and use a binary index instead.  This may
be slower, but avoids the bulk upload to ets, and means that matches
know of position (so only skiplists with a match need be tried).

Also stops the discrepancy between snapshots and non-snapshots - as
previously the snapshots were always slowed by not having access to the
ETS table.
2017-01-05 21:58:33 +00:00
martinsumner
e6270d288f Half-way to ets for Bookie mem
A half-way implementation with use of ETS as the bookie's memory
2017-01-05 17:00:12 +00:00
martinsumner
2f8ff640a9 Test coverage
Add some furthe runit tests to improve test coverage
2017-01-04 21:36:59 +00:00