Skip to content

Commit

Permalink
Need to sync before checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinMendelGleason committed Sep 28, 2019
1 parent 89b03bd commit aa412d5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/config-template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ server_worker_options([]).

http_options([]).

% this number can never be less than 4 or bad things will happen.
max_journal_queue_length(30).

:- set_prolog_flag(stack_limit, 2_147_483_648).
Expand Down
4 changes: 3 additions & 1 deletion library/api.pl
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@
'vio:message' : M,
'vio:type' : T,
'vio:literal' : O}]},
[status(400)]).
[status(400)]).
customise_error(http_reply(method_not_allowed(JSON))) :-
reply_json(JSON,[status(405)]).
customise_error(http_reply(not_found(JSON))) :-
reply_json(JSON,[status(404)]).
customise_error(http_reply(authorize(JSON))) :-
Expand Down
11 changes: 7 additions & 4 deletions library/triplestore.pl
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@
( retract_graph(Collection,Database_Name),
hdt_transform_journals(Collection,Database_Name),
get_truncated_queue(Collection,Database_Name,Queue),
config:max_journal_queue_length(Max_Length),
length(Queue,Queue_Length),
( Queue_Length > Max_Length
sync_queue(Collection,Database_Name, Queue),
(
config:max_journal_queue_length(Max_Length),
length(Queue,Queue_Length),
Queue_Length > Max_Length
% slightly terrifying recursion here...
-> checkpoint(Collection,Database_Name)
; sync_queue(Collection,Database_Name, Queue))
; true)
-> true
% in case anything failed, retract the graph
; retract_graph(Collection,Database_Name),
Expand Down

0 comments on commit aa412d5

Please sign in to comment.