Skip to content

feat: protect parallel boundaries and improve Preset refresh reliability - #243

Merged
skyoo2003 merged 2 commits into
mainfrom
feat/parallel-overlap-preset-refresh
Sep 5, 2026
Merged

skyoo2003 merged 2 commits into
mainfrom
feat/parallel-overlap-preset-refresh

Conversation

@skyoo2003

Copy link
Copy Markdown
Owner

Description

Parallel searches can miss keywords spanning chunk boundaries, and a stale Preset reader currently waits behind a reload tied to the first caller's context. This change adds opt-in automatic boundary protection and lets each waiting request cancel independently.

  • Add ParallelOptions.AutoOverlap, using the loaded engine's longest keyword rune length to extend non-overlapping base chunks. Filter matches by their owned start positions, including keywords longer than ChunkSize; preserve parallel ordering, original rune positions, and one engine load per call. Copy caller options before normalization.
  • Share Preset reload jobs under the instance lifetime, canceling them when all waiters leave or the instance closes. Fetch and build outside the state lock, and reject obsolete snapshots using local generations after writes or invalidation. Failed reloads still return search errors.
  • Poll only the existing Redis version field and expose PresetReloadFailures and PresetPollFailures. Avoid restarting a slow reload on every poll. Update API snapshots, audit records, examples, operating guidance, and release notes.

Defaults and Redis schema remain unchanged. This is intended for the next minor release; no migration is required.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change
  • Documentation update
  • Refactoring (no functional changes)
  • Test update

Checklist

  • Tests pass (make test)
  • Vet (make vet)
  • Linting passes (make lint)
  • Build succeeds (make build)
  • Documentation updated
  • Changelog fragment added
  • Commit messages follow guidelines

Validation

  • Full core and server test and race suites; focused concurrency tests repeated under the race detector.
  • ASCII, Korean, emoji, overlapping suffixes, every boundary mode, and keywords longer than chunks compared with serial searches.
  • Controlled shared reload tests for one/all waiter cancellation, Close, snapshot failure, Add/Remove/Flush/invalidation conflicts, and slow reloads during polling.
  • Version-only polling, missed Pub/Sub recovery, backend timeout counters, warm-read and parallel-call Redis round-trip checks.
  • Actual Redis 8.10.1 and Valkey 8.0.4: integration and RTT tests with -race. Real Redis benchmark smoke run; timings are not claimed as performance comparisons.
  • All 23 documentation examples compile; public API audit covers 183 entries. The snapshot adds only three fields.

Polling remains disabled by default. Its interval is not a freshness guarantee during outages, and the retained previous engine is not a fallback for failed reload requests.

@github-actions github-actions Bot added documentation enhancement This issue is about improvement of project. go Pull requests that update Go code labels Sep 5, 2026
@skyoo2003
skyoo2003 merged commit 2920e80 into main Sep 5, 2026
11 checks passed
@skyoo2003
skyoo2003 deleted the feat/parallel-overlap-preset-refresh branch September 5, 2026 10:00
@skyoo2003 skyoo2003 mentioned this pull request Sep 6, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation enhancement This issue is about improvement of project. go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant