Skip to content

Commit

Permalink
easy(indexer-alt): small clean-ups (#20564)
Browse files Browse the repository at this point in the history
## Description

- Row chunk size should default to `i16::MAX` if the field count is `0`.
- Fold the `if empty { ... }` check into the `debug_assert` so "nothing
gets left behind" when we're building for release (in reality the
compiler will probably not have a problem with compiling this out, but
it's good practice to fold the full condition into assert body).

## Test plan

CI

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
amnn authored Dec 18, 2024
1 parent 9b5ec79 commit d4d8d49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ impl<H: Handler> PendingCheckpoint<H> {
/// Whether there are values left to commit from this indexed checkpoint.
fn is_empty(&self) -> bool {
let empty = self.values.is_empty();
if empty {
debug_assert!(self.watermark.batch_rows == 0);
}
debug_assert!(!empty || self.watermark.batch_rows == 0);
empty
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ pub(crate) fn pipeline<H: Handler + Send + Sync + 'static>(
}

const fn max_chunk_rows<H: Handler>() -> usize {
// Handle division by zero
if H::Value::FIELD_COUNT == 0 {
return 0;
i16::MAX as usize
} else {
i16::MAX as usize / H::Value::FIELD_COUNT
}
i16::MAX as usize / H::Value::FIELD_COUNT
}

0 comments on commit d4d8d49

Please sign in to comment.