tigerbeetle-node 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.client.node.sha256 +1 -0
- package/package.json +5 -3
- package/src/tigerbeetle/scripts/fuzz_loop.sh +1 -1
- package/src/tigerbeetle/scripts/pre-commit.sh +2 -2
- package/src/tigerbeetle/scripts/validate_docs.sh +17 -0
- package/src/tigerbeetle/src/benchmark.zig +25 -11
- package/src/tigerbeetle/src/c/tb_client/context.zig +248 -47
- package/src/tigerbeetle/src/c/tb_client/echo_client.zig +108 -0
- package/src/tigerbeetle/src/c/tb_client/packet.zig +2 -2
- package/src/tigerbeetle/src/c/tb_client/signal.zig +2 -4
- package/src/tigerbeetle/src/c/tb_client/thread.zig +17 -256
- package/src/tigerbeetle/src/c/tb_client.h +18 -4
- package/src/tigerbeetle/src/c/tb_client.zig +88 -26
- package/src/tigerbeetle/src/c/tb_client_header_test.zig +135 -0
- package/src/tigerbeetle/src/c/test.zig +371 -1
- package/src/tigerbeetle/src/cli.zig +90 -18
- package/src/tigerbeetle/src/config.zig +12 -4
- package/src/tigerbeetle/src/demo.zig +2 -1
- package/src/tigerbeetle/src/demo_01_create_accounts.zig +1 -1
- package/src/tigerbeetle/src/demo_03_create_transfers.zig +13 -0
- package/src/tigerbeetle/src/ewah.zig +11 -33
- package/src/tigerbeetle/src/ewah_benchmark.zig +8 -9
- package/src/tigerbeetle/src/lsm/README.md +97 -3
- package/src/tigerbeetle/src/lsm/compaction.zig +32 -7
- package/src/tigerbeetle/src/{eytzinger_benchmark.zig → lsm/eytzinger_benchmark.zig} +34 -21
- package/src/tigerbeetle/src/lsm/forest_fuzz.zig +34 -32
- package/src/tigerbeetle/src/lsm/grid.zig +39 -21
- package/src/tigerbeetle/src/lsm/groove.zig +1 -0
- package/src/tigerbeetle/src/lsm/k_way_merge.zig +3 -3
- package/src/tigerbeetle/src/lsm/level_iterator.zig +1 -1
- package/src/tigerbeetle/src/lsm/manifest.zig +13 -0
- package/src/tigerbeetle/src/lsm/manifest_level.zig +0 -49
- package/src/tigerbeetle/src/lsm/manifest_log.zig +173 -335
- package/src/tigerbeetle/src/lsm/manifest_log_fuzz.zig +665 -0
- package/src/tigerbeetle/src/lsm/node_pool.zig +4 -0
- package/src/tigerbeetle/src/lsm/posted_groove.zig +1 -0
- package/src/tigerbeetle/src/lsm/segmented_array.zig +24 -15
- package/src/tigerbeetle/src/lsm/table.zig +32 -20
- package/src/tigerbeetle/src/lsm/table_immutable.zig +1 -1
- package/src/tigerbeetle/src/lsm/table_iterator.zig +4 -5
- package/src/tigerbeetle/src/lsm/test.zig +13 -2
- package/src/tigerbeetle/src/lsm/tree.zig +45 -7
- package/src/tigerbeetle/src/lsm/tree_fuzz.zig +36 -32
- package/src/tigerbeetle/src/main.zig +69 -13
- package/src/tigerbeetle/src/message_bus.zig +18 -7
- package/src/tigerbeetle/src/message_pool.zig +8 -2
- package/src/tigerbeetle/src/ring_buffer.zig +7 -3
- package/src/tigerbeetle/src/simulator.zig +38 -11
- package/src/tigerbeetle/src/state_machine.zig +48 -23
- package/src/tigerbeetle/src/test/accounting/workload.zig +9 -5
- package/src/tigerbeetle/src/test/cluster.zig +15 -33
- package/src/tigerbeetle/src/test/conductor.zig +2 -1
- package/src/tigerbeetle/src/test/network.zig +45 -19
- package/src/tigerbeetle/src/test/packet_simulator.zig +40 -29
- package/src/tigerbeetle/src/test/state_checker.zig +5 -7
- package/src/tigerbeetle/src/test/storage.zig +453 -110
- package/src/tigerbeetle/src/test/storage_checker.zig +204 -0
- package/src/tigerbeetle/src/tigerbeetle.zig +1 -0
- package/src/tigerbeetle/src/unit_tests.zig +7 -1
- package/src/tigerbeetle/src/util.zig +97 -11
- package/src/tigerbeetle/src/vopr.zig +2 -1
- package/src/tigerbeetle/src/vsr/client.zig +8 -3
- package/src/tigerbeetle/src/vsr/journal.zig +280 -202
- package/src/tigerbeetle/src/vsr/replica.zig +169 -31
- package/src/tigerbeetle/src/vsr/superblock.zig +356 -629
- package/src/tigerbeetle/src/vsr/superblock_client_table.zig +7 -6
- package/src/tigerbeetle/src/vsr/superblock_free_set.zig +414 -151
- package/src/tigerbeetle/src/vsr/superblock_free_set_fuzz.zig +332 -0
- package/src/tigerbeetle/src/vsr/superblock_fuzz.zig +349 -0
- package/src/tigerbeetle/src/vsr/superblock_manifest.zig +44 -9
- package/src/tigerbeetle/src/vsr/superblock_quorums.zig +394 -0
- package/src/tigerbeetle/src/vsr/superblock_quorums_fuzz.zig +312 -0
- package/src/tigerbeetle/src/vsr.zig +19 -5
- package/src/tigerbeetle/src/benchmark_array_search.zig +0 -317
- package/src/tigerbeetle/src/benchmarks/perf.zig +0 -299
- package/src/tigerbeetle/src/vopr_hub/README.md +0 -58
- package/src/tigerbeetle/src/vopr_hub/SETUP.md +0 -199
- package/src/tigerbeetle/src/vopr_hub/go.mod +0 -3
- package/src/tigerbeetle/src/vopr_hub/main.go +0 -1022
- package/src/tigerbeetle/src/vopr_hub/scheduler/go.mod +0 -3
- package/src/tigerbeetle/src/vopr_hub/scheduler/main.go +0 -403
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-2021, Zig contributors
|
|
2
|
-
// Backported from https://github.com/ziglang/zig/blob/master/lib/std/os/linux.zig
|
|
3
|
-
// TODO Remove this file once we upgrade to Zig 0.9.0.
|
|
4
|
-
const std = @import("std");
|
|
5
|
-
const pid_t = std.os.linux.pid_t;
|
|
6
|
-
const fd_t = std.os.linux.fd_t;
|
|
7
|
-
|
|
8
|
-
pub fn perf_event_open(
|
|
9
|
-
attr: *perf_event_attr,
|
|
10
|
-
pid: pid_t,
|
|
11
|
-
cpu: i32,
|
|
12
|
-
group_fd: fd_t,
|
|
13
|
-
flags: usize,
|
|
14
|
-
) !fd_t {
|
|
15
|
-
const rc = perf_event_open_internal(attr, pid, cpu, group_fd, flags);
|
|
16
|
-
const errno = std.os.errno(rc);
|
|
17
|
-
if (errno != 0) {
|
|
18
|
-
std.log.err("perf_event_open_internal errno={}", .{errno});
|
|
19
|
-
return error.Unexpected;
|
|
20
|
-
}
|
|
21
|
-
return @intCast(fd_t, rc);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
fn perf_event_open_internal(
|
|
25
|
-
attr: *perf_event_attr,
|
|
26
|
-
pid: pid_t,
|
|
27
|
-
cpu: i32,
|
|
28
|
-
group_fd: fd_t,
|
|
29
|
-
flags: usize,
|
|
30
|
-
) usize {
|
|
31
|
-
return std.os.linux.syscall5(
|
|
32
|
-
.perf_event_open,
|
|
33
|
-
@ptrToInt(attr),
|
|
34
|
-
@bitCast(usize, @as(isize, pid)),
|
|
35
|
-
@bitCast(usize, @as(isize, cpu)),
|
|
36
|
-
@bitCast(usize, @as(isize, group_fd)),
|
|
37
|
-
flags,
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
pub const perf_event_attr = extern struct {
|
|
42
|
-
/// Major type: hardware/software/tracepoint/etc.
|
|
43
|
-
type: PERF.TYPE = undefined,
|
|
44
|
-
/// Size of the attr structure, for fwd/bwd compat.
|
|
45
|
-
size: u32 = @sizeOf(perf_event_attr),
|
|
46
|
-
/// Type specific configuration information.
|
|
47
|
-
config: u64 = 0,
|
|
48
|
-
|
|
49
|
-
sample_period_or_freq: u64 = 0,
|
|
50
|
-
sample_type: u64 = 0,
|
|
51
|
-
read_format: u64 = 0,
|
|
52
|
-
|
|
53
|
-
flags: packed struct {
|
|
54
|
-
/// off by default
|
|
55
|
-
disabled: bool = false,
|
|
56
|
-
/// children inherit it
|
|
57
|
-
inherit: bool = false,
|
|
58
|
-
/// must always be on PMU
|
|
59
|
-
pinned: bool = false,
|
|
60
|
-
/// only group on PMU
|
|
61
|
-
exclusive: bool = false,
|
|
62
|
-
/// don't count user
|
|
63
|
-
exclude_user: bool = false,
|
|
64
|
-
/// ditto kernel
|
|
65
|
-
exclude_kernel: bool = false,
|
|
66
|
-
/// ditto hypervisor
|
|
67
|
-
exclude_hv: bool = false,
|
|
68
|
-
/// don't count when idle
|
|
69
|
-
exclude_idle: bool = false,
|
|
70
|
-
/// include mmap data
|
|
71
|
-
mmap: bool = false,
|
|
72
|
-
/// include comm data
|
|
73
|
-
comm: bool = false,
|
|
74
|
-
/// use freq, not period
|
|
75
|
-
freq: bool = false,
|
|
76
|
-
/// per task counts
|
|
77
|
-
inherit_stat: bool = false,
|
|
78
|
-
/// next exec enables
|
|
79
|
-
enable_on_exec: bool = false,
|
|
80
|
-
/// trace fork/exit
|
|
81
|
-
task: bool = false,
|
|
82
|
-
/// wakeup_watermark
|
|
83
|
-
watermark: bool = false,
|
|
84
|
-
/// precise_ip:
|
|
85
|
-
///
|
|
86
|
-
/// 0 - SAMPLE_IP can have arbitrary skid
|
|
87
|
-
/// 1 - SAMPLE_IP must have constant skid
|
|
88
|
-
/// 2 - SAMPLE_IP requested to have 0 skid
|
|
89
|
-
/// 3 - SAMPLE_IP must have 0 skid
|
|
90
|
-
///
|
|
91
|
-
/// See also PERF_RECORD_MISC_EXACT_IP
|
|
92
|
-
/// skid constraint
|
|
93
|
-
precise_ip: u2 = 0,
|
|
94
|
-
/// non-exec mmap data
|
|
95
|
-
mmap_data: bool = false,
|
|
96
|
-
/// sample_type all events
|
|
97
|
-
sample_id_all: bool = false,
|
|
98
|
-
|
|
99
|
-
/// don't count in host
|
|
100
|
-
exclude_host: bool = false,
|
|
101
|
-
/// don't count in guest
|
|
102
|
-
exclude_guest: bool = false,
|
|
103
|
-
|
|
104
|
-
/// exclude kernel callchains
|
|
105
|
-
exclude_callchain_kernel: bool = false,
|
|
106
|
-
/// exclude user callchains
|
|
107
|
-
exclude_callchain_user: bool = false,
|
|
108
|
-
/// include mmap with inode data
|
|
109
|
-
mmap2: bool = false,
|
|
110
|
-
/// flag comm events that are due to an exec
|
|
111
|
-
comm_exec: bool = false,
|
|
112
|
-
/// use @clockid for time fields
|
|
113
|
-
use_clockid: bool = false,
|
|
114
|
-
/// context switch data
|
|
115
|
-
context_switch: bool = false,
|
|
116
|
-
/// Write ring buffer from end to beginning
|
|
117
|
-
write_backward: bool = false,
|
|
118
|
-
/// include namespaces data
|
|
119
|
-
namespaces: bool = false,
|
|
120
|
-
|
|
121
|
-
__reserved_1: u35 = 0,
|
|
122
|
-
} = .{},
|
|
123
|
-
/// wakeup every n events, or
|
|
124
|
-
/// bytes before wakeup
|
|
125
|
-
wakeup_events_or_watermark: u32 = 0,
|
|
126
|
-
|
|
127
|
-
bp_type: u32 = 0,
|
|
128
|
-
|
|
129
|
-
/// This field is also used for:
|
|
130
|
-
/// bp_addr
|
|
131
|
-
/// kprobe_func for perf_kprobe
|
|
132
|
-
/// uprobe_path for perf_uprobe
|
|
133
|
-
config1: u64 = 0,
|
|
134
|
-
/// This field is also used for:
|
|
135
|
-
/// bp_len
|
|
136
|
-
/// kprobe_addr when kprobe_func == null
|
|
137
|
-
/// probe_offset for perf_[k,u]probe
|
|
138
|
-
config2: u64 = 0,
|
|
139
|
-
|
|
140
|
-
/// enum perf_branch_sample_type
|
|
141
|
-
branch_sample_type: u64 = 0,
|
|
142
|
-
|
|
143
|
-
/// Defines set of user regs to dump on samples.
|
|
144
|
-
/// See asm/perf_regs.h for details.
|
|
145
|
-
sample_regs_user: u64 = 0,
|
|
146
|
-
|
|
147
|
-
/// Defines size of the user stack to dump on samples.
|
|
148
|
-
sample_stack_user: u32 = 0,
|
|
149
|
-
|
|
150
|
-
clockid: i32 = 0,
|
|
151
|
-
/// Defines set of regs to dump for each sample
|
|
152
|
-
/// state captured on:
|
|
153
|
-
/// - precise = 0: PMU interrupt
|
|
154
|
-
/// - precise > 0: sampled instruction
|
|
155
|
-
///
|
|
156
|
-
/// See asm/perf_regs.h for details.
|
|
157
|
-
sample_regs_intr: u64 = 0,
|
|
158
|
-
|
|
159
|
-
/// Wakeup watermark for AUX area
|
|
160
|
-
aux_watermark: u32 = 0,
|
|
161
|
-
sample_max_stack: u16 = 0,
|
|
162
|
-
/// Align to u64
|
|
163
|
-
__reserved_2: u16 = 0,
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
pub const PERF = struct {
|
|
167
|
-
pub const TYPE = enum(u32) {
|
|
168
|
-
HARDWARE,
|
|
169
|
-
SOFTWARE,
|
|
170
|
-
TRACEPOINT,
|
|
171
|
-
HW_CACHE,
|
|
172
|
-
RAW,
|
|
173
|
-
BREAKPOINT,
|
|
174
|
-
MAX,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
pub const COUNT = struct {
|
|
178
|
-
pub const HW = enum(u32) {
|
|
179
|
-
CPU_CYCLES,
|
|
180
|
-
INSTRUCTIONS,
|
|
181
|
-
CACHE_REFERENCES,
|
|
182
|
-
CACHE_MISSES,
|
|
183
|
-
BRANCH_INSTRUCTIONS,
|
|
184
|
-
BRANCH_MISSES,
|
|
185
|
-
BUS_CYCLES,
|
|
186
|
-
STALLED_CYCLES_FRONTEND,
|
|
187
|
-
STALLED_CYCLES_BACKEND,
|
|
188
|
-
REF_CPU_CYCLES,
|
|
189
|
-
MAX,
|
|
190
|
-
|
|
191
|
-
pub const CACHE = enum(u32) {
|
|
192
|
-
L1D,
|
|
193
|
-
L1I,
|
|
194
|
-
LL,
|
|
195
|
-
DTLB,
|
|
196
|
-
ITLB,
|
|
197
|
-
BPU,
|
|
198
|
-
NODE,
|
|
199
|
-
MAX,
|
|
200
|
-
|
|
201
|
-
pub const OP = enum(u32) {
|
|
202
|
-
READ,
|
|
203
|
-
WRITE,
|
|
204
|
-
PREFETCH,
|
|
205
|
-
MAX,
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
pub const RESULT = enum(u32) {
|
|
209
|
-
ACCESS,
|
|
210
|
-
MISS,
|
|
211
|
-
MAX,
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
pub const SW = enum(u32) {
|
|
217
|
-
CPU_CLOCK,
|
|
218
|
-
TASK_CLOCK,
|
|
219
|
-
PAGE_FAULTS,
|
|
220
|
-
CONTEXT_SWITCHES,
|
|
221
|
-
CPU_MIGRATIONS,
|
|
222
|
-
PAGE_FAULTS_MIN,
|
|
223
|
-
PAGE_FAULTS_MAJ,
|
|
224
|
-
ALIGNMENT_FAULTS,
|
|
225
|
-
EMULATION_FAULTS,
|
|
226
|
-
DUMMY,
|
|
227
|
-
BPF_OUTPUT,
|
|
228
|
-
MAX,
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
pub const SAMPLE = struct {
|
|
233
|
-
pub const IP = 1;
|
|
234
|
-
pub const TID = 2;
|
|
235
|
-
pub const TIME = 4;
|
|
236
|
-
pub const ADDR = 8;
|
|
237
|
-
pub const READ = 16;
|
|
238
|
-
pub const CALLCHAIN = 32;
|
|
239
|
-
pub const ID = 64;
|
|
240
|
-
pub const CPU = 128;
|
|
241
|
-
pub const PERIOD = 256;
|
|
242
|
-
pub const STREAM_ID = 512;
|
|
243
|
-
pub const RAW = 1024;
|
|
244
|
-
pub const BRANCH_STACK = 2048;
|
|
245
|
-
pub const REGS_USER = 4096;
|
|
246
|
-
pub const STACK_USER = 8192;
|
|
247
|
-
pub const WEIGHT = 16384;
|
|
248
|
-
pub const DATA_SRC = 32768;
|
|
249
|
-
pub const IDENTIFIER = 65536;
|
|
250
|
-
pub const TRANSACTION = 131072;
|
|
251
|
-
pub const REGS_INTR = 262144;
|
|
252
|
-
pub const PHYS_ADDR = 524288;
|
|
253
|
-
pub const MAX = 1048576;
|
|
254
|
-
|
|
255
|
-
pub const BRANCH = struct {
|
|
256
|
-
pub const USER = 1 << 0;
|
|
257
|
-
pub const KERNEL = 1 << 1;
|
|
258
|
-
pub const HV = 1 << 2;
|
|
259
|
-
pub const ANY = 1 << 3;
|
|
260
|
-
pub const ANY_CALL = 1 << 4;
|
|
261
|
-
pub const ANY_RETURN = 1 << 5;
|
|
262
|
-
pub const IND_CALL = 1 << 6;
|
|
263
|
-
pub const ABORT_TX = 1 << 7;
|
|
264
|
-
pub const IN_TX = 1 << 8;
|
|
265
|
-
pub const NO_TX = 1 << 9;
|
|
266
|
-
pub const COND = 1 << 10;
|
|
267
|
-
pub const CALL_STACK = 1 << 11;
|
|
268
|
-
pub const IND_JUMP = 1 << 12;
|
|
269
|
-
pub const CALL = 1 << 13;
|
|
270
|
-
pub const NO_FLAGS = 1 << 14;
|
|
271
|
-
pub const NO_CYCLES = 1 << 15;
|
|
272
|
-
pub const TYPE_SAVE = 1 << 16;
|
|
273
|
-
pub const MAX = 1 << 17;
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
pub const FLAG = struct {
|
|
278
|
-
pub const FD_NO_GROUP = 1 << 0;
|
|
279
|
-
pub const FD_OUTPUT = 1 << 1;
|
|
280
|
-
pub const PID_CGROUP = 1 << 2;
|
|
281
|
-
pub const FD_CLOEXEC = 1 << 3;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
pub const EVENT_IOC = struct {
|
|
285
|
-
pub const ENABLE = 9216;
|
|
286
|
-
pub const DISABLE = 9217;
|
|
287
|
-
pub const REFRESH = 9218;
|
|
288
|
-
pub const RESET = 9219;
|
|
289
|
-
pub const PERIOD = 1074275332;
|
|
290
|
-
pub const SET_OUTPUT = 9221;
|
|
291
|
-
pub const SET_FILTER = 1074275334;
|
|
292
|
-
pub const SET_BPF = 1074013192;
|
|
293
|
-
pub const PAUSE_OUTPUT = 1074013193;
|
|
294
|
-
pub const QUERY_BPF = 3221758986;
|
|
295
|
-
pub const MODIFY_ATTRIBUTES = 1074275339;
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
pub const IOC_FLAG_GROUP = 1;
|
|
299
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# The VOPR Hub
|
|
2
|
-
|
|
3
|
-
*The VOPR Hub collects the seeds for crash, liveness and correctness reports from the VOPR simulators running permanently in CI or on local dev machines. The VOPR Hub then checks out that commit, replays the seed locally in Debug mode, collects the logs, and automatically creates a GitHub issue, also deduplicating against existing issues if necessary.*
|
|
4
|
-
|
|
5
|
-
## The VOPR
|
|
6
|
-
|
|
7
|
-
*The Viewstamped Operation Replicator* provides deterministic simulation testing for TigerBeetle. It tests that clusters of TigerBeetle replicas and clients interact correctly according to TigerBeetle's Viewstamped Replication consensus protocol, even under the pressure of simulated network and storage faults.
|
|
8
|
-
|
|
9
|
-
The VOPR has an optional `--send` flag that enables it to send bug reports to the VOPR Hub. This flag can only be used when any local code changes have been committed and pushed. The reason for this is that for the hub to replay a failing seed it needs to run that seed on the same commit to get the same result.
|
|
10
|
-
|
|
11
|
-
If the VOPR discovers a failing seed it creates a bug report in the format of a fixed length byte array.
|
|
12
|
-
|
|
13
|
-
* 16 bytes contain the first half of a SHA256 hash of the remainder of the message, which is used both as a checksum, and to reject clearly misdirected or random network packets.
|
|
14
|
-
* 1 byte indicates the type of bug detected (correctness, liveness, or crash).
|
|
15
|
-
* 8 bytes are reserved for the seed.
|
|
16
|
-
* The final 20 bytes contain the hash of the git commit to which the seed applies.
|
|
17
|
-
|
|
18
|
-
## Hub Logic
|
|
19
|
-
|
|
20
|
-
The hub listens for bug reports sent by any VOPR via TCP.
|
|
21
|
-
|
|
22
|
-
### Setup
|
|
23
|
-
The VOPR Hub must run a VOPR in a separate tigerbeetle directory to prevent it from checking out a commit that could change the hub itself.
|
|
24
|
-
|
|
25
|
-
The VOPR which the hub runs must be run inside its own tigerbeetle directory in order to parse its output correctly.
|
|
26
|
-
|
|
27
|
-
To run the VOPR Hub, Zig must be installed and five environmental variables are required:
|
|
28
|
-
1. TIGERBEETLE_DIRECTORY the location of the VOPR's tigerbeetle directory
|
|
29
|
-
2. ISSUE_DIRECTORY where issues are stored on disk
|
|
30
|
-
3. DEVELOPER_TOKEN for access to GitHub
|
|
31
|
-
4. VOPR_HUB_ADDRESS for the IP address to listen on for incoming messages
|
|
32
|
-
5. REPOSITORY_URL to post the GitHub issue
|
|
33
|
-
|
|
34
|
-
### Validation
|
|
35
|
-
|
|
36
|
-
When the hub receives a message it first validates it immediately. Messages are expected to be exactly 45 bytes in length. The hub hashes the last 29 bytes of the message and ensures that the first half of the SHA256 hash matches the first 16 bytes of the message. If the hash is correct then the hub checks that the first byte (representing the bug type) is between 1 and 3. After the 64-bit unsigned seed, the remaining 20 bytes are the GitHub commit hash, which must all decode to valid hex characters.
|
|
37
|
-
|
|
38
|
-
Once validated, the message is decoded and added to a queue for processing.
|
|
39
|
-
|
|
40
|
-
### Replies to the VOPR
|
|
41
|
-
|
|
42
|
-
Once the message is determined to be valid then a reply of "1" is sent back to the VOPR and the connection is closed. If it's invalid, the connection is simply closed (following the principle of “Don't talk to strangers”) and no further processing is applied.
|
|
43
|
-
|
|
44
|
-
### Message Processing
|
|
45
|
-
|
|
46
|
-
When the hub replays a seed it will save the logs to disk. This way each issue can be tracked to see if it has already been submitted. For correctness bugs (bug 1) and liveness bugs (bug 2) the format of the file name is `bug_seed_commit`. Correctness and liveness bugs can be deduped immediately by checking for their file name on disk. Crash bugs (bug 3) do not include the seed in their file name but do have an additional field which is the hash of the stack trace of the issue (`bug_commit_stacktracehash`) since multiple seeds may all trip the same assertion, leading to the same stack trace. Therefore, crash bugs can only be deduped after the seed has been replayed and the logs have been generated.
|
|
47
|
-
|
|
48
|
-
If no duplicate issue has been found then the hub will replay the seed in `Debug` mode and capture the logs. In order to do this it must first checkout the correct git commit. This step requires that the reported commit is available in the `tigerbeetle` repository.
|
|
49
|
-
|
|
50
|
-
### Create an Issue
|
|
51
|
-
|
|
52
|
-
Once the simulation has completed, the stack trace is extracted and parsed to remove the local directory structure and any local memory addresses. This ensures that it is not only deterministic across machines, but also anonymized. Now the stack trace can be hashed and used to dedupe any crash bugs that may have already been reported. While crash bugs include a hash of the stack trace in their filename, to deduplicate assertion crashes for the same call graph, we do not do this for correctness bugs, since these are always detected by the same set of panics in the simulator, at the same call site, but there may be different causes for them.
|
|
53
|
-
|
|
54
|
-
A copy of the issue is written to disk and a GitHub issue is also automatically generated. The issue contains the bug type, seed, commit hash, parameters of the VOPR, stack trace (if there is one), and debug logs.
|
|
55
|
-
|
|
56
|
-
If the VOPR Hub replays a seed and it passes unexpectedly then, to err on the safe side, a GitHub issue will still be created with a warning explaining that the seed passed.
|
|
57
|
-
|
|
58
|
-
The VOPR Hub may only have up to 6 GitHub issues open at any time. These issues are identified by the `seed` label that is attached to them as they are created. If there are 6 open issues and the VOPR Hub finds an additional issue then it is simply logged locally on the machine.
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
# VOPR Server Setup
|
|
2
|
-
|
|
3
|
-
*The VOPR Server is a dedicated testing machine. It continually runs VOPR simulators (performing deterministic fuzz testing) as well as another program, called the VOPR Hub (that listens out for bug reports). When a VOPR finds a bug, it creates a report and sends it to the VOPR Hub. When a report comes in the hub has an additional, dedicated VOPR to use to rerun the test. The hub then automatically creates a GitHub issue with the collected debug logs and stack trace.*
|
|
4
|
-
|
|
5
|
-
*To ensure the latest code is always being tested, the VOPRs restart after running only a few seeds. Before restarting, the scheduler is responsible for fetching the latest code and checking out the relevant commit for that VOPR. At least one VOPR will always run on main. Other VOPRs can be assigned to test pull requests with the `vopr` label. The latest pull requests are always favored if there are too many to test.*
|
|
6
|
-
|
|
7
|
-
*Follow these instructions to set up the VOPR Hub, along with several full-time VOPRs.*
|
|
8
|
-
|
|
9
|
-
## Server Setup
|
|
10
|
-
|
|
11
|
-
Install Go:
|
|
12
|
-
```bash
|
|
13
|
-
sudo add-apt-repository ppa:longsleep/golang-backports
|
|
14
|
-
sudo apt update
|
|
15
|
-
sudo apt install golang-go
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Add two users, namely `voprrunner` and `voprhub`. This creates *separation of concerns* between the two functions of the server.
|
|
19
|
-
|
|
20
|
-
The `voprrunner` will continuously run the VOPR and send any bugs to the VOPR Hub.
|
|
21
|
-
|
|
22
|
-
This will require setting passwords for the respective users:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
sudo adduser voprhub
|
|
26
|
-
sudo adduser voprrunner
|
|
27
|
-
sudo usermod -aG sudo voprhub
|
|
28
|
-
sudo usermod -aG sudo voprrunner
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Set Up the VOPR Hub Component
|
|
32
|
-
|
|
33
|
-
Become the `voprhub` user:
|
|
34
|
-
```bash
|
|
35
|
-
su - voprhub
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Clone `tigerbeetle`:
|
|
39
|
-
```bash
|
|
40
|
-
git clone https://github.com/tigerbeetledb/tigerbeetle.git
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Install Zig:
|
|
44
|
-
```bash
|
|
45
|
-
cd ./tigerbeetle
|
|
46
|
-
./scripts/install_zig.sh
|
|
47
|
-
cd ../
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Create a second `tigerbeetle` directory here inside the hub directory which will run the VOPR Hub. The initial `tigerbeetle` directory will be needed to replay any seeds that the hub receives.
|
|
51
|
-
```bash
|
|
52
|
-
mkdir hub
|
|
53
|
-
cp -r tigerbeetle hub/tigerbeetle
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Create a `systemd` service unit file for the hub:
|
|
57
|
-
```bash
|
|
58
|
-
sudo nano /etc/systemd/system/voprhub.service
|
|
59
|
-
```
|
|
60
|
-
The file should contain the following (including an actual IP address and developer token with access to public repositories):
|
|
61
|
-
```
|
|
62
|
-
[Unit]
|
|
63
|
-
|
|
64
|
-
Description=Continously runs the VOPR Hub.
|
|
65
|
-
|
|
66
|
-
[Service]
|
|
67
|
-
|
|
68
|
-
User=voprhub
|
|
69
|
-
WorkingDirectory=/home/voprhub/hub/tigerbeetle/src/vopr_hub
|
|
70
|
-
Environment="REPOSITORY_URL=https://api.github.com/repos/tigerbeetledb/tigerbeetle"
|
|
71
|
-
Environment="TIGERBEETLE_DIRECTORY=/home/voprhub/tigerbeetle"
|
|
72
|
-
Environment="VOPR_HUB_ADDRESS=<address>"
|
|
73
|
-
Environment="ISSUE_DIRECTORY=/home/voprhub"
|
|
74
|
-
Environment="DEVELOPER_TOKEN=******"
|
|
75
|
-
ExecStart=go run main.go
|
|
76
|
-
Restart=on-success
|
|
77
|
-
|
|
78
|
-
[Install]
|
|
79
|
-
|
|
80
|
-
WantedBy=multi-user.target
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Start the VOPR Hub service:
|
|
84
|
-
```bash
|
|
85
|
-
systemctl start voprhub.service
|
|
86
|
-
# Check that we have liftoff.
|
|
87
|
-
systemctl status voprhub.service
|
|
88
|
-
# View logs e.g.
|
|
89
|
-
journalctl -f -n 100 -u voprhub.service
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Go back to the `root` user:
|
|
93
|
-
```bash
|
|
94
|
-
exit
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Set Up the VOPR Component
|
|
98
|
-
|
|
99
|
-
Become the `voprrunner` user:
|
|
100
|
-
```bash
|
|
101
|
-
su - voprrunner
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Create a script that will be used by the service to fetch the latest code and run the VOPR:
|
|
105
|
-
```bash
|
|
106
|
-
sudo nano vopr_runner.sh
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
The file should contain the following (including an actual IP address and developer token with access to public repositories):
|
|
110
|
-
```
|
|
111
|
-
#!/usr/bin/env bash
|
|
112
|
-
set -e
|
|
113
|
-
|
|
114
|
-
# Checkout the correct branch
|
|
115
|
-
export TIGERBEETLE_DIRECTORY="/home/voprrunner/tigerbeetle"
|
|
116
|
-
export REPOSITORY_URL="https://api.github.com/repos/tigerbeetledb/tigerbeetle"
|
|
117
|
-
export DEVELOPER_TOKEN="******"
|
|
118
|
-
export NUM_VOPRS="4"
|
|
119
|
-
export CURRENT_VOPR=$1
|
|
120
|
-
go run ./src/vopr_hub/scheduler/main.go
|
|
121
|
-
|
|
122
|
-
# Run the VOPR a few times before we go back to the top:
|
|
123
|
-
zig/zig run ./src/vopr.zig -- --send="<address>" --simulations=5
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Ensure the script is executable:
|
|
127
|
-
```bash
|
|
128
|
-
sudo chmod +x vopr_runner.sh
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Create four `tigerbeetle` directories here.
|
|
132
|
-
|
|
133
|
-
Note that the number of directories corresponds to the number of service instances that will run.
|
|
134
|
-
|
|
135
|
-
Ideally, this number should be increased/decreased to be two less than the number of CPU cores available. The simulators burn CPU, and so this allocation leaves a core available for the rest of the system, plus a core for the hub itself.
|
|
136
|
-
```bash
|
|
137
|
-
git clone https://github.com/tigerbeetledb/tigerbeetle.git
|
|
138
|
-
# Install Zig:
|
|
139
|
-
cd ./tigerbeetle
|
|
140
|
-
./scripts/install_zig.sh
|
|
141
|
-
cd ../
|
|
142
|
-
# Copy this directory to get four tigerbeetle directories.
|
|
143
|
-
cp -r tigerbeetle tigerbeetle0 # Repeat with incrementing values for the other instances. E.g. 1, 2,3.
|
|
144
|
-
# Now we can remove the original directory.
|
|
145
|
-
sudo rm -r tigerbeetle
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Create a `systemd` service unit file.
|
|
149
|
-
|
|
150
|
-
Naming the file `vopr@.service` means that it acts as a template that can reuse the same file to run different services that each target their own directories.
|
|
151
|
-
```bash
|
|
152
|
-
sudo nano /etc/systemd/system/vopr@.service
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
The file should contain the following:
|
|
156
|
-
```
|
|
157
|
-
[Unit]
|
|
158
|
-
Description=Continously runs the VOPR.
|
|
159
|
-
PartOf=vopr.target
|
|
160
|
-
|
|
161
|
-
[Service]
|
|
162
|
-
|
|
163
|
-
User=voprrunner
|
|
164
|
-
WorkingDirectory=/home/voprrunner/tigerbeetle%i
|
|
165
|
-
ExecStart=/home/voprrunner/vopr_runner.sh %i
|
|
166
|
-
Restart=on-success
|
|
167
|
-
|
|
168
|
-
[Install]
|
|
169
|
-
|
|
170
|
-
WantedBy=multi-user.target
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Create a target file to manage all instances, called `vopr.target`.
|
|
174
|
-
|
|
175
|
-
Dependencies must be listed under `Wants` instead of `Requires` because requiring the services will cause them all to restart whenever one terminates.
|
|
176
|
-
```bash
|
|
177
|
-
sudo nano /etc/systemd/system/vopr.target
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
The file should contain the following:
|
|
181
|
-
```
|
|
182
|
-
[Unit]
|
|
183
|
-
Description=Runs all VOPR services.
|
|
184
|
-
Wants=vopr@0.service vopr@1.service vopr@2.service vopr@3.service
|
|
185
|
-
|
|
186
|
-
[Install]
|
|
187
|
-
WantedBy=multi-user.target
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Start all services:
|
|
191
|
-
```bash
|
|
192
|
-
systemctl start vopr.target
|
|
193
|
-
# Check it's VOPR'izing:
|
|
194
|
-
systemctl status vopr.target
|
|
195
|
-
# Check that the individual VOPR'raptors have started up:
|
|
196
|
-
systemctl status vopr@0.service
|
|
197
|
-
# View logs e.g.
|
|
198
|
-
journalctl -f -n 100 -u vopr@0.service
|
|
199
|
-
```
|