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
This commit is contained in:
MiniFrenchBread 2024-10-05 14:31:12 +08:00 committed by GitHub
parent 949462084a
commit ee4123418f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -483,10 +483,9 @@ impl LogSyncManager {
let store = self.store.clone();
let shard_config = store.flow().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;