Skip to content

feat(config): let the engine control SystemConfig defaults - #45

Open
adsharma wants to merge 2 commits into
mainfrom
engine-controlled-defaults
Open

adsharma wants to merge 2 commits into
mainfrom
engine-controlled-defaults

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Follow-up to #44 (which simply flipped the default): instead of pinning a copy of every engine default in this binding, SystemConfig fields are now Option<T> defaulting to None = "use the engine default".

  • database.rs: Option fields, derived Default, builders wrap Some, forwarding maps None to the existing sentinels (numerics) and a new -1 tristate (booleans).
  • ffi.rs / lbug_rs.h / lbug_rs.cpp: boolean params become i64 tristate (-1 keeps engine default).
  • SYSTEM_CONFIG_FOR_TESTS runs on engine defaults except the small max_db_size.

Unset settings follow engine-side default changes automatically (e.g. LadybugDB/ladybug#1435 needs no binding change). Explicitly passed values behave exactly as before. cargo check passes.

This also retires two stale Rust-side defaults that disagreed with the engine: max_db_size (was 4 GiB, now engine default) and throw_on_wal_replay_failure (was true, now engine default false).

BREAKING CHANGE: SystemConfig fields changed from concrete types to Option<T>.

Stop pinning a copy of every engine default in this binding. SystemConfig
fields are now Option<T>, defaulting to None meaning "use the engine
default". Only explicitly set fields are forwarded: numerics via the
existing sentinels, booleans via a new -1/0/1 tristate in new_database.

Unset settings follow engine-side default changes automatically (e.g.
LadybugDB/ladybug#1435's enable_multi_writes flip needs no binding
change). Explicitly passed values behave exactly as before.

Note: this also retires two stale Rust-side defaults that disagreed with
the engine: max_db_size (was 4 GiB, now engine default) and
throw_on_wal_replay_failure (was true, now engine default false).

BREAKING CHANGE: SystemConfig fields changed from concrete types to
Option<T>; the new_database FFI booleans are now i64 tristates.
@adsharma adsharma changed the title feat!: let the engine control SystemConfig defaults feat(config): let the engine control SystemConfig defaults Oct 27, 2026
…tinel

The checksums test relied on the binding pinning
throw_on_wal_replay_failure=true; opt into throwing explicitly since
unset settings now follow the engine default (false).

Also fix a latent -1u comparison bug in new_database: -1u is a 32-bit
unsigned int, so comparing the uint64_t maxDBSize against it wrongly
treated UINT64_MAX (the keep-engine-default sentinel) as an explicit
value, failing with 'max db size should be a power of 2'. The old Rust
default (u32::MAX) accidentally matched the buggy comparison.
@adsharma

Copy link
Copy Markdown
Contributor Author

Fixed the two failures: (1) checksums test now opts into throwing explicitly; (2) fixed a latent -1u comparison bug in new_database (-1u is 32-bit, so UINT64_MAX was wrongly treated as an explicit max_db_size — the old Rust default of u32::MAX had accidentally masked this). Full local suite: 159 passed, 0 failed.

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