Skip to content

Avoid temp dir creation at import time for DefaultOptions#179

Open
sfmqrb wants to merge 1 commit intolotusdblabs:mainfrom
sfmqrb:fix-177-lazy-temp-dirpath
Open

Avoid temp dir creation at import time for DefaultOptions#179
sfmqrb wants to merge 1 commit intolotusdblabs:mainfrom
sfmqrb:fix-177-lazy-temp-dirpath

Conversation

@sfmqrb
Copy link

@sfmqrb sfmqrb commented Feb 16, 2026

Summary

Fixes #177 by making temporary DB directory creation lazy.

Problem

DefaultOptions currently calls tempDBDir() during package initialization, which creates a new temp directory even if the caller never opens a DB.

Changes

  • DefaultOptions.DirPath is now initialized to an empty string.
  • validateOptions now lazily assigns tempDBDir() when DirPath is empty.
  • Updated TestDBOpen to verify that opening with empty DirPath succeeds and gets a generated directory.

Behavior after this PR

  • Importing lotusdb no longer creates temp directories.
  • A fresh temp dir is still automatically created when Open is called with no DirPath.

Validation

  • go test ./... passes locally in this environment.

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.

Defaults unconditionally create a temp directory during program init

1 participant