Log
For each vnode in the ring, there exists one log file.
Currently the log is used for 3 things:
  • Loading the state of objects into the materialiser on restart (done by replaying the log).
  • Resending lost updates to external DCs.
  • Reading an older version of an object than what is available in memory.
Each log entry is defined by the following records:
1
-type log_operation() :: #log_operation{}.
2
-record(log_operation, {
3
tx_id :: txid(),
4
op_type :: update
5
| prepare
6
| commit
7
| abort
8
| noop,
9
log_payload :: any_log_payload()
10
}).
11
12
13
-type any_log_payload() :: #update_log_payload{}
14
| #commit_log_payload{}
15
| #abort_log_payload{}
16
| #prepare_log_payload{}.
17
-type commit_log_payload() :: #commit_log_payload{}.
18
-type update_log_payload() :: #update_log_payload{}.
19
-type op_number() :: #op_number{}.
20
-type op_name() :: atom().
21
-type op_param() :: term().
22
-type op() :: {op_name(), op_param()}.
23
24
25
-record(commit_log_payload, {
26
commit_time :: dc_and_commit_time(),
27
snapshot_time :: snapshot_time()
28
}).
29
30
-record(update_log_payload, {
31
key :: key(),
32
bucket :: bucket(),
33
type :: type(),
34
op :: op()
35
}).
36
37
-record(abort_log_payload, {}).
38
39
-record(prepare_log_payload, {prepare_time :: non_neg_integer()}).
40
41
-record(op_number, {
42
node :: undefined | {node(), dcid()},
43
global :: undefined | non_neg_integer(),
44
local :: undefined | non_neg_integer()
45
}).
Copied!
Copy link