Background
Design: WRITING-39975. Scope: WRITING-39974. Epic: SPM-4886.
A follower delete on a layered table may read the stable table to check whether the key exists. That read is slow and inflates standby lag. A new explicit cursor option lets the caller say it does not care whether the key existed, so the read can be skipped. The option replaces the earlier approach of giving overwrite an extra meaning on followers.
Change
Add a boolean cursor option blind_remove (default false) to WT_SESSION::open_cursor and WT_CURSOR::reconfigure. The option is marked undocumented so it does not appear in the public reference. Only layered tables support it for now.
- When true, WT_CURSOR::remove succeeds whether or not a record with the key exists. The key must still be set.
- All other remove errors are unchanged, for example WT_ROLLBACK on a write conflict and WT_PREPARE_CONFLICT on a prepare conflict.
- Only remove is affected. Search, insert, update and iteration on the same cursor are unchanged.
- A cursor keeps its setting until it is reconfigured or closed. WiredTiger never changes it on its own.
- When open_cursor returns a cursor from the session's cursor cache, the setting comes from the new open configuration. The setting from the cursor's earlier use is not kept.
- Opening a cursor with blind_remove=true on a table that does not support it fails with ENOTSUP. The error message names the option and the table. WT_CURSOR::reconfigure with blind_remove=true on such a cursor also fails with ENOTSUP.
This ticket adds the option, config parsing, validation and cursor-cache handling. The remove behaviour for followers and leaders is done in separate tickets.
Tests
Python tests in the same PR cover:
- Open and reconfigure with the option on and off.
- ENOTSUP on a non-layered table, for both open and reconfigure, with the table and option named in the message.
- Cursor-cache reuse takes the setting from the new open configuration and does not keep the earlier one.
- The setting is kept across operations until reconfigured or closed.
Acceptance criteria
- Option is accepted by open_cursor and reconfigure and is absent from the public documentation.
- ENOTSUP behaviour and cursor-cache behaviour match the design.
- New tests pass, and fail without the change.