Compare commits

...

2 Commits

Author SHA1 Message Date
0g-peterzhb
8f8cd53758
Merge c8fbb13443 into ee4123418f 2024-10-05 14:31:30 +08:00
MiniFrenchBread
ee4123418f
fix: end_segment_index (#221)
Some checks are pending
abi-consistent-check / build-and-compare (push) Waiting to run
code-coverage / unittest-cov (push) Waiting to run
rust / check (push) Waiting to run
rust / test (push) Waiting to run
rust / lints (push) Waiting to run
functional-test / test (push) Waiting to run
* fix: end_segment_index
2024-10-05 14:31:12 +08:00

View File

@ -483,10 +483,9 @@ impl LogSyncManager {
let store = self.store.clone();
let shard_config = store.get_shard_config();
let start_segment_index = tx.start_entry_index as usize / PORA_CHUNK_SIZE;
let sector_size = bytes_to_chunks(tx.size as usize);
let end_segment_index = start_segment_index
+ ((sector_size + PORA_CHUNK_SIZE - 1) / PORA_CHUNK_SIZE)
- 1;
let end_segment_index =
(tx.start_entry_index as usize + bytes_to_chunks(tx.size as usize) - 1)
/ PORA_CHUNK_SIZE;
let mut can_finalize = false;
if end_segment_index < shard_config.shard_id {
can_finalize = true;