Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba16432

Browse files
Merge pull request #3753 from tigerbeetle/georg/commands-rename
vsr: rename repair commands
2 parents 5400b91 + 91418a9 commit ba16432

11 files changed

Lines changed: 198 additions & 200 deletions

File tree

docs/internals/sync.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ State sync is triggered when a replica receives a `view` message with a more adv
106106
checkpoint.
107107

108108
If a replica isn't making progress committing because a grid block or a prepare can't be repaired
109-
for some time, the replica proactively sends `request_view` to initiate the sync (see
109+
for some time, the replica proactively sends `get_view` to initiate the sync (see
110110
`repair_sync_timeout`).
111111

112112
### 5: Conclusion

docs/internals/vsr.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ Storage:
4040
| `commit` | primary | backup | [Normal](#protocol-normal) |
4141
| `exit_view` | replica | all replicas | [Start-View-Change](#protocol-start-view-change) |
4242
| `join_view` | replica | all replicas | [View-Change](#protocol-view-change) |
43-
| `view` | primary | backup | [Request/View](#protocol-request-view), [State Sync](./sync.md) |
44-
| `request_view` | backup | primary | [Request/View](#protocol-request-view) |
45-
| `request_headers` | replica | replica | [Repair Journal](#protocol-repair-journal) |
46-
| `request_prepare` | replica | replica | [Repair WAL](#protocol-repair-wal) |
47-
| `request_reply` | replica | replica | [Repair Client Replies](#protocol-repair-client-replies), [Sync Client Replies](#protocol-sync-client-replies) |
43+
| `view` | primary | backup | [Request/View](#protocol-request-view), [State Sync](./sync.md) |
44+
| `get_view` | backup | primary | [Request/View](#protocol-request-view) |
45+
| `get_headers` | replica | replica | [Repair Journal](#protocol-repair-journal) |
46+
| `get_prepare` | replica | replica | [Repair WAL](#protocol-repair-wal) |
47+
| `get_reply` | replica | replica | [Repair Client Replies](#protocol-repair-client-replies), [Sync Client Replies](#protocol-sync-client-replies) |
4848
| `headers` | replica | replica | [Repair Journal](#protocol-repair-journal) |
4949
| `eviction` | primary | client | [Client](#protocol-client) |
50-
| `request_blocks` | replica | replica | [Sync Forest](#protocol-sync-forest), [Repair Grid](#protocol-repair-grid) |
50+
| `get_blocks` | replica | replica | [Sync Forest](#protocol-sync-forest), [Repair Grid](#protocol-repair-grid) |
5151
| `block` | replica | replica | [Sync Forest](#protocol-sync-forest), [Repair Grid](#protocol-repair-grid) |
5252

5353
### Recovery
@@ -158,9 +158,9 @@ When the primary collects its JV quorum:
158158

159159
### Protocol: Request/View
160160

161-
#### `request_view`
161+
#### `get_view`
162162

163-
A backup sends a `command=request_view` to the primary of a view when any of the following occur:
163+
A backup sends a `command=get_view` to the primary of a view when any of the following occur:
164164

165165
- the backup learns about a newer view via a `command=commit` message, or
166166
- the backup learns about a newer view via a `command=prepare` message, or
@@ -170,7 +170,7 @@ A backup sends a `command=request_view` to the primary of a view when any of the
170170

171171
#### `view`
172172

173-
When a `status=normal` primary receives `command=request_view`, it replies with a `command=view`.
173+
When a `status=normal` primary receives `command=get_view`, it replies with a `command=view`.
174174
`command=view` includes:
175175
- The view's current suffix — the headers of the latest messages in the view.
176176
- The current checkpoint (see [State Sync](./sync.md)).
@@ -187,7 +187,7 @@ A `view` contains the following headers (which may overlap):
187187

188188
### Protocol: Repair Journal
189189

190-
`request_headers` and `headers` repair gaps or breaks in a replica's journal headers.
190+
`get_headers` and `headers` repair gaps or breaks in a replica's journal headers.
191191
Repaired headers are a prerequisite for [repairing prepares](#protocol-repair-wal).
192192

193193
Because the headers are repaired backwards (from the head) by hash-chaining, it is safe for both backups and transitioning primaries.
@@ -210,9 +210,9 @@ During repair, missing/damaged prepares are requested & repaired chronologically
210210
- improves the chances that older entries will be available, i.e. not yet overwritten
211211
- enables better pipelining of repair and commit.
212212

213-
In response to a `request_prepare`:
213+
In response to a `get_prepare`:
214214

215-
- Reply the `command=prepare` with the requested prepare, if available and valid.
215+
- Respond with the `command=prepare` message with the requested prepare, if available and valid.
216216
- Otherwise do not reply. (e.g. the corresponding slot in the WAL is corrupt)
217217

218218
Per [PAR's CTRL Protocol](https://www.usenix.org/system/files/conference/fast18/fast18-alagappan.pdf), we do not nack corrupt entries, since they _might_ be the prepare being requested.
@@ -226,9 +226,9 @@ The replica stores the latest reply to each active client.
226226

227227
During repair, corrupt client replies are requested & repaired.
228228

229-
In response to a `request_reply`:
229+
In response to a `get_reply`:
230230

231-
- Respond with the `command=reply` (the requested reply), if available and valid.
231+
- Respond with the `command=reply` message (the requested reply), if available and valid.
232232
- Otherwise do not reply.
233233

234234
### Protocol: Client
@@ -249,8 +249,8 @@ See also:
249249

250250
Grid repair is triggered when a replica discovers a corrupt (or missing) grid block.
251251

252-
1. The repairing replica sends a `command=request_blocks` to any other replica. The message body contains a list of block `address`/`checksum`s.
253-
2. Upon receiving a `command=request_blocks`, a replica reads its own grid to check for the requested blocks. For each matching block found, reply with the `command=block` message (the block itself).
252+
1. The repairing replica sends a `command=get_blocks` to any other replica. The message body contains a list of block `address`/`checksum`s.
253+
2. Upon receiving a `command=get_blocks`, a replica reads its own grid to check for the requested blocks. For each matching block found, reply with the `command=block` message (the block itself).
254254
3. Upon receiving a `command=block`, a replica writes the block to its grid, and resolves the reads that were blocked on it.
255255

256256
Note that _both sides_ of grid repair can run while the grid is being opened during replica startup.

src/clients/java/src/client.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ const ReflectionHelper = struct {
283283
var request_class: jni.JClass = null;
284284
var request_send_buffer_field_id: jni.JFieldID = null;
285285
var request_send_buffer_len_field_id: jni.JFieldID = null;
286-
var request_reply_buffer_field_id: jni.JFieldID = null;
286+
var reply_buffer_field_id: jni.JFieldID = null;
287287
var request_operation_method_id: jni.JMethodID = null;
288288
var request_end_request_method_id: jni.JMethodID = null;
289289

@@ -296,7 +296,7 @@ const ReflectionHelper = struct {
296296
assert(request_class == null);
297297
assert(request_send_buffer_field_id == null);
298298
assert(request_send_buffer_len_field_id == null);
299-
assert(request_reply_buffer_field_id == null);
299+
assert(reply_buffer_field_id == null);
300300
assert(request_operation_method_id == null);
301301
assert(request_end_request_method_id == null);
302302

@@ -337,7 +337,7 @@ const ReflectionHelper = struct {
337337
"sendBufferLen",
338338
"J",
339339
);
340-
request_reply_buffer_field_id = JNIHelper.find_field(
340+
reply_buffer_field_id = JNIHelper.find_field(
341341
env,
342342
request_class,
343343
"replyBuffer",
@@ -364,7 +364,7 @@ const ReflectionHelper = struct {
364364
assert(request_class != null);
365365
assert(request_send_buffer_field_id != null);
366366
assert(request_send_buffer_len_field_id != null);
367-
assert(request_reply_buffer_field_id != null);
367+
assert(reply_buffer_field_id != null);
368368
assert(request_operation_method_id != null);
369369
assert(request_end_request_method_id != null);
370370
}
@@ -382,7 +382,7 @@ const ReflectionHelper = struct {
382382
request_class = null;
383383
request_send_buffer_field_id = null;
384384
request_send_buffer_len_field_id = null;
385-
request_reply_buffer_field_id = null;
385+
reply_buffer_field_id = null;
386386
request_operation_method_id = null;
387387
request_end_request_method_id = null;
388388
}
@@ -492,7 +492,7 @@ const ReflectionHelper = struct {
492492
reply: []const u8,
493493
) void {
494494
assert(this_obj != null);
495-
assert(request_reply_buffer_field_id != null);
495+
assert(reply_buffer_field_id != null);
496496
assert(reply.len > 0);
497497

498498
const reply_buffer_obj = env.new_byte_array(
@@ -527,7 +527,7 @@ const ReflectionHelper = struct {
527527
// Setting the request with the reply.
528528
env.set_object_field(
529529
this_obj,
530-
request_reply_buffer_field_id,
530+
reply_buffer_field_id,
531531
reply_buffer_obj,
532532
);
533533
}

src/constants.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,20 +316,20 @@ comptime {
316316
assert(view_headers_max > view_change_headers_suffix_max);
317317
}
318318

319-
/// The maximum number of headers to include with a response to a command=request_headers message.
320-
pub const request_headers_max = @min(
319+
/// The maximum number of headers to include with a response to a command=get_headers message.
320+
pub const get_headers_max = @min(
321321
@divFloor(message_body_size_max, @sizeOf(vsr.Header)),
322322
64,
323323
);
324324

325325
comptime {
326-
assert(request_headers_max > 0);
326+
assert(get_headers_max > 0);
327327
}
328328

329-
/// The maximum number of block addresses/checksums requested by a single command=request_blocks.
329+
/// The maximum number of block addresses/checksums requested by a single command=get_blocks.
330330
pub const grid_repair_request_max = config.process.grid_repair_request_max;
331331

332-
/// The number of grid reads allocated to handle incoming command=request_blocks messages.
332+
/// The number of grid reads allocated to handle incoming command=get_blocks messages.
333333
pub const grid_repair_reads_max = config.process.grid_repair_reads_max;
334334

335335
/// Immediately after state sync we want access to all of the grid's write bandwidth to rapidly sync

src/message_pool.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ pub const MessagePool = struct {
119119
pub const ExitView = CommandMessageType(.exit_view);
120120
pub const JoinView = CommandMessageType(.join_view);
121121
pub const View = CommandMessageType(.view);
122-
pub const RequestView = CommandMessageType(.request_view);
123-
pub const RequestHeaders = CommandMessageType(.request_headers);
124-
pub const RequestPrepare = CommandMessageType(.request_prepare);
125-
pub const RequestReply = CommandMessageType(.request_reply);
122+
pub const GetView = CommandMessageType(.get_view);
123+
pub const GetHeaders = CommandMessageType(.get_headers);
124+
pub const GetPrepare = CommandMessageType(.get_prepare);
125+
pub const GetReply = CommandMessageType(.get_reply);
126126
pub const Headers = CommandMessageType(.headers);
127127
pub const Eviction = CommandMessageType(.eviction);
128-
pub const RequestBlocks = CommandMessageType(.request_blocks);
128+
pub const GetBlocks = CommandMessageType(.get_blocks);
129129
pub const Block = CommandMessageType(.block);
130130

131131
// TODO Avoid the extra level of indirection.

src/vsr.zig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,17 @@ pub const Command = enum(u8) {
246246

247247
exit_view = 10,
248248
join_view = 11,
249+
get_view = 13,
250+
251+
get_headers = 14,
252+
get_prepare = 15,
253+
get_reply = 16,
254+
get_blocks = 19,
249255

250-
request_view = 13,
251-
request_headers = 14,
252-
request_prepare = 15,
253-
request_reply = 16,
254256
headers = 17,
255257

256258
eviction = 18,
257259

258-
request_blocks = 19,
259260
block = 20,
260261

261262
view = 24,

src/vsr/journal.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub const write_ahead_log_zone_size = headers_size + prepares_size;
9797

9898
/// Limit on the number of repair reads.
9999
/// This keeps some reads available for commit path, so that an asymmetrically
100-
/// partitioned replica cannot starve the cluster with request_prepare messages.
100+
/// partitioned replica cannot starve the cluster with get_prepare messages.
101101
const reads_repair_count_max: u6 = constants.journal_iops_read_max - reads_commit_count_max;
102102
/// We need at most two reads on commit path: one for commit_journal, and one for
103103
/// primary_repair_pipeline_read.
@@ -280,7 +280,7 @@ pub fn JournalType(comptime Replica: type, comptime Storage: type) type {
280280
faulty: BitSet,
281281

282282
/// The checksum of the prepare in the corresponding slot.
283-
/// This is used to respond to `request_prepare` messages even when the slot is faulty.
283+
/// This is used to respond to `get_prepare` messages even when the slot is faulty.
284284
/// For example, the slot may be faulty because the redundant header is faulty.
285285
///
286286
/// The checksum will missing (`prepare_checksums[i]=0`, `prepare_inhabited[i]=false`) when:
@@ -886,8 +886,8 @@ pub fn JournalType(comptime Replica: type, comptime Storage: type) type {
886886
// * The prepare was rewritten since the read began.
887887
// * Misdirected read/write.
888888
// * The combination of:
889-
// * The primary is responding to a `request_prepare`.
890-
// * The `request_prepare` did not include a checksum.
889+
// * The primary is responding to a `get_prepare`.
890+
// * The `get_prepare` did not include a checksum.
891891
// * The requested op's slot is faulty, but the prepare is valid. Since the
892892
// prepare is valid, WAL recovery set `prepare_checksums[slot]`. But on
893893
// reading this entry it turns out not to have the right op.
@@ -1229,7 +1229,7 @@ pub fn JournalType(comptime Replica: type, comptime Storage: type) type {
12291229
/// eql The header and prepare are identical; no repair necessary.
12301230
/// nil Reserved; dirty/faulty are clear, no repair necessary.
12311231
/// fix Repair header using local intact prepare.
1232-
/// vsr Repair with VSR `request_prepare`.
1232+
/// vsr Repair with VSR `get_prepare`.
12331233
///
12341234
/// A "valid" header/prepare:
12351235
/// 1. has a valid checksum
@@ -1264,7 +1264,7 @@ pub fn JournalType(comptime Replica: type, comptime Storage: type) type {
12641264
.op_checkpoint = replica.op_checkpoint(),
12651265
});
12661266

1267-
// `prepare_checksums` improves the availability of `request_prepare` by being more
1267+
// `prepare_checksums` improves the availability of `get_prepare` by being more
12681268
// flexible than `headers` regarding the prepares it references. It may hold a
12691269
// prepare whose redundant header is broken, as long as the prepare itself is valid.
12701270
if (prepare != null and prepare.?.operation != .reserved) {
@@ -2358,7 +2358,7 @@ const RecoveryDecision = enum {
23582358
nil,
23592359
/// Use intact prepare to repair redundant header. Dirty/faulty are clear.
23602360
fix,
2361-
/// If replica_count>1 or standby: Repair with VSR `request_prepare`. Mark dirty, mark faulty.
2361+
/// If replica_count>1 or standby: Repair with VSR `get_prepare`. Mark dirty, mark faulty.
23622362
/// If replica_count=1 and !standby: Fail; cannot recover safely.
23632363
vsr,
23642364
/// The prepare is from the next checkpoint. Truncate, set to reserved, clear dirty/faulty.

0 commit comments

Comments
 (0)