Skip to content

feat(config): add fetch_max_bytes and segment_max_records backup options - #140

Merged
sionsmith merged 4 commits into
mainfrom
feat/issue53-fetch-and-segment-options
Aug 11, 2026
Merged

feat(config): add fetch_max_bytes and segment_max_records backup options#140
sionsmith merged 4 commits into
mainfrom
feat/issue53-fetch-and-segment-options

Conversation

@sionsmith

Copy link
Copy Markdown
Contributor

First half of osodevops/strimzi-backup-operator#53 (Full Backup Config Options): the two options the reporter wants to tune do not exist in kafka-backup yet — their configs set them, and the config parser silently ignored them. This PR adds both options and makes silent-ignore impossible going forward. (The second half — a Strimzi-style spec.backup.config passthrough — lands in the operator.)

Added

  • backup.fetch_max_bytes — maximum bytes requested per Kafka Fetch. Previously fetches always requested min(segment_max_bytes, 16MB) with no independent knob. An explicit value wins over that default and is clamped to the protocol's i32 range.
  • backup.segment_max_records — rotate segments once they hold N records, alongside the existing segment_max_bytes / segment_max_interval_ms thresholds.
  • Unknown-key warnings — the config structs accept unknown fields, so a typo (or an option that doesn't exist, exactly what happened in issue feat: backup validation & compliance evidence suite #53/feat: Backup Validation & Compliance Evidence Suite #52 with fetch_max_bytes: 16777216 and segment_max_records: 2000000) was silently dropped while the user believed it was applied. All six CLI config-load paths now parse via Config::from_yaml_with_warnings (serde_ignored) and log each ignored key path:
    WARN Ignoring unknown config key `backup.fetch_max_bytez` — check for typos; see https://kafkabackup.com/reference/config-yaml
    

Version

0.16.0: BackupOptions and SegmentWriterConfig gained public fields, which is breaking for struct-literal construction of kafka-backup-core types — minor bump per the repo's semver policy. Also adds the missing 0.15.13 changelog entry.

Tests (TDD — written first, failed on main)

  • backup_options_parse_fetch_max_bytes_and_segment_max_records
  • config_from_yaml_with_warnings_reports_unknown_keys / ..._is_quiet_for_known_keys
  • rotates_at_max_segment_records (segment writer)
  • fetch_max_bytes_defaults_to_capped_segment_size, explicit_fetch_max_bytes_wins_over_segment_size, fetch_max_bytes_is_clamped_to_protocol_range (engine)

cargo fmt / clippy --all-targets -D warnings / full suite (248 core + CLI) pass.

🤖 Generated with Claude Code

sionsmith and others added 3 commits August 11, 2026 14:39
- backup.fetch_max_bytes decouples the Kafka Fetch request size from the
  segment size; previously fetches always requested
  min(segment_max_bytes, 16MB). Clamped to the protocol's i32 range.
- backup.segment_max_records rotates segments once they hold N records,
  in addition to the existing byte-size and interval thresholds.
- Warn on unknown config keys at load time. The config schema ignores
  unrecognized fields, so until now a typo (or an option that does not
  exist, e.g. fetch_max_bytes before this change) was silently dropped
  and users believed the option was applied. Every CLI command that
  loads a config now logs a warning naming the ignored key path.

Requested in osodevops/strimzi-backup-operator#53.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ction

- Strip serde_ignored's `?` layer segments so paths read
  `backup.fetch_max_bytez` instead of `backup.?.fetch_max_bytez`.
- Don't warn on the documented `logging` section: it is applied by the
  CLI layer (RUST_LOG / -v), not deserialized into core Config.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Segment writer: record count never triggers rotation when
  segment_max_records is unset (pre-v0.16.0 behavior preserved).
- Config: a pre-v0.16.0 YAML parses with identical semantics, None for
  the new options, and zero unknown-key warnings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sionsmith
sionsmith merged commit 1db01cc into main Aug 11, 2026
20 checks passed
@sionsmith
sionsmith deleted the feat/issue53-fetch-and-segment-options branch August 11, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant