-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
This is most apparent when setting a timeout on the database object.
Db = erlfdb:open(),
ok = erlfdb:set_option(Db, timeout, <<(10000):8/little-signed-integer-unit:8>>),
erlfdb:transactional(Db, fun(Tx) ->
io:format("Last error: ~p~n", [erlfdb:get_last_error()]),
erlfdb:wait(erlfdb:get(Tx, <<"bar">>)),
erlfdb:set(Tx, <<"bar">>, <<"baz">>),
timer:sleep(5500)
end).Last error: undefined
Last error: 1007
** exception error: {erlfdb_error,1031}
in function erlfdb_nif:erlfdb_future_get/1
called as erlfdb_nif:erlfdb_future_get(#Ref<0.2097654348.3325689858.17165>)
in call from erlfdb:do_transaction/3 (/Users/jstimpson/dev/erlang/foundationdb-beam.erlfdb/src/erlfdb.erl, line 2104)
in call from erlfdb:do_transaction/3 (/Users/jstimpson/dev/erlang/foundationdb-beam.erlfdb/src/erlfdb.erl, line 2107)On commit, this transaction will internally fail with 1007 transaction_to_old and be retried. On the second attempt, it will fail with 1031 transaction_timed_out, which is not a retriable error, so that is raised to the caller.
The problem is that the caller cannot know that root cause of the failure was 1007 transaction_too_old, unless they instrument it with erlfdb:get_last_error(). Can erlfdb expose this information somehow?
Metadata
Metadata
Assignees
Labels
No labels