Skip to content

fix: skip writes in IncrementAccessCount and LogOp when read-only#33

Merged
Grivn merged 1 commit into
mnemon-dev:masterfrom
VivianBalakrishnan:master
May 21, 2026
Merged

fix: skip writes in IncrementAccessCount and LogOp when read-only#33
Grivn merged 1 commit into
mnemon-dev:masterfrom
VivianBalakrishnan:master

Conversation

@Grivn
Copy link
Copy Markdown
Member

@Grivn Grivn commented May 21, 2026

What

This PR preserves the read-only state on DB opened via OpenReadOnly, and makes IncrementAccessCount and LogOp no-op when the database is read-only.

Why

search and recall are read commands, but they currently still try to update access counts and write oplog entries. Under --readonly, those writes produce unnecessary warnings and violate the expected read-only behavior.

Fixes #30.

Validation

  • CI passed: build-and-test (1.24)
  • go test ./...

DB opened with OpenReadOnly now sets readOnly=true on the struct.
IncrementAccessCount and LogOp both return early when readOnly, preventing
spurious stderr warnings when mnemon is used against a read-only mount.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Grivn Grivn merged commit de011af into mnemon-dev:master May 21, 2026
1 check passed
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.

Track read-only fix from VivianBalakrishnan fork

2 participants