Skip to content

Commit dd24c7f

Browse files
committed
[storage/journal/segmented/variable] fix test
1 parent 96040ad commit dd24c7f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

storage/src/journal/segmented/variable.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,12 @@ mod tests {
13651365
write_buffer: NZUsize!(1024),
13661366
};
13671367
let section = 1u64;
1368-
let item = 10u64;
1368+
let item = [10u8; 1021];
1369+
let item_record_size =
1370+
UInt(item.encode_size() as u32).encode_size() + item.encode_size();
1371+
// Leave one byte in the first page so the trailing bytes below cross the page
1372+
// boundary and repair must issue a physical resize.
1373+
assert_eq!(item_record_size, PAGE_SIZE.get() as usize - 1);
13691374

13701375
let mut journal = Journal::init(context.child("first"), cfg.clone())
13711376
.await
@@ -1381,7 +1386,7 @@ mod tests {
13811386
journal.sync(section).await.expect("Failed to sync journal");
13821387
drop(journal);
13831388

1384-
let journal = Journal::<_, u64>::init(context.child("second"), cfg)
1389+
let journal = Journal::init(context.child("second"), cfg)
13851390
.await
13861391
.expect("Failed to re-initialize journal");
13871392
*context.storage_fault_config().write() = deterministic::FaultConfig {
@@ -1402,6 +1407,7 @@ mod tests {
14021407
.expect("failed to replay valid item");
14031408
assert_eq!(first, (section, 0, item.encode_size() as u32, item));
14041409

1410+
// The trailing bytes cross the page boundary, so repair must issue a physical resize.
14051411
match stream.next().await {
14061412
Some(Err(_)) => {}
14071413
other => {

0 commit comments

Comments
 (0)