Skip to content

docs: add Lua script preloading documentation for kvrocks#511

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
docs/lua-script-preloading-8bb7a2fb9f14b115
Draft

docs: add Lua script preloading documentation for kvrocks#511
github-actions[bot] wants to merge 1 commit into
mainfrom
docs/lua-script-preloading-8bb7a2fb9f14b115

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Documentation Update

This PR adds comprehensive documentation for the Lua script preloading feature introduced in PR #510 (fix/kvrocks-noscript-and-install-bundle).

Changes

1. docs/07-storage-kvrocks.md - Added "Lua scripts" section

  • Explains the two critical Lua scripts: claimMoveScript and tokenBucketScript
  • Documents script preloading via PreloadScripts() at startup
  • Explains kvrocks compatibility: different NOSCRIPT error format
  • Describes automatic EVAL fallback for transparent error recovery

2. docs/10-operations.md - Added "Startup" section

  • Documents the 4-step API initialization process
  • Emphasizes Lua script preloading as a critical startup step
  • Explains why preloading is necessary for kvrocks
  • Clarifies the fallback mechanism and error recovery

3. docs/28-troubleshooting.md - Added 2 new troubleshooting sections

  • Section 1: "API fails to start with 'preload repository scripts' error"
    • Symptoms, causes, and resolution steps
    • Guidance on KVRocks memory and configuration
  • Section 2: "Tasks fail with 'NOSCRIPT' errors"
    • Explains automatic fallback behavior
    • Recovery steps if issues persist
    • Memory management best practices

All subsequent troubleshooting sections have been renumbered accordingly (now 3-12).

Rationale

The Lua script preloading feature is critical for kvrocks compatibility. codeQ uses Lua scripts for atomic operations in hot paths (task claiming, rate limiting). kvrocks returns NOSCRIPT errors in a different format than standard Redis, so preloading ensures scripts are cached at startup. The automatic fallback to EVAL provides transparent error recovery if scripts are evicted from memory.

This documentation:

  • Helps operators understand startup errors
  • Guides troubleshooting of NOSCRIPT issues
  • Explains the kvrocks compatibility layer
  • Provides best practices for memory management

Quality Assurance

  • ✅ Documentation follows Diátaxis (Explanation + Reference)
  • ✅ Consistent with existing documentation style
  • ✅ Progressive disclosure: high-level first, details second
  • ✅ All cross-references verified (e.g., file names, function names)
  • ✅ Troubleshooting sections include causes, symptoms, and resolution steps

AI generated by Update Docs

- Add 'Lua scripts' section to docs/07-storage-kvrocks.md explaining script preloading, fallback mechanisms, and kvrocks compatibility
- Add 'Startup' section to docs/10-operations.md documenting script preloading during API initialization
- Add troubleshooting sections to docs/28-troubleshooting.md:
  - Section 1: 'preload repository scripts' startup errors
  - Section 2: NOSCRIPT error troubleshooting and fallback behavior
  - Renumber subsequent sections (3-12)

These changes document PR #510 (fix/kvrocks-noscript-and-install-bundle) which preloads Lua scripts at startup to ensure kvrocks compatibility and includes automatic fallback to EVAL if scripts are not found.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants