Skip to content

Change timestamp directories to use subdirectories.#110

Merged
jrick merged 1 commit intodecred:masterfrom
jrick:emlink
Sep 15, 2025
Merged

Change timestamp directories to use subdirectories.#110
jrick merged 1 commit intodecred:masterfrom
jrick:emlink

Conversation

@jrick
Copy link
Member

@jrick jrick commented Sep 15, 2025

A directory to store a new leveldb database is created for each anchor, which occurs hourly. These directories were all rooted under the same directory. Eventually, this resulted in hitting the upper filesystem limit on the number of files or directories that can be contained within a single directory, causing dcrtimed to stop producing new anchors.

To fix this, we switch the directory format, itself a timestamp, from yyyymmdd.HHMMSS to yyyy-mm/dd/HHMMSS. A filesystem.Walk call is now used instead of os.ReadDir to read or iterate through the timestamp directories.

This requires a manual database migration. The dcrtime_dumpdb tool (built before this commit) can be used to dump the existing database to a JSON file, and dcrtime_dumpdb (built at this commit) to restore the data.

A directory to store a new leveldb database is created for each anchor, which
occurs hourly.  These directories were all rooted under the same directory.
Eventually, this resulted in hitting the upper filesystem limit on the number
of files or directories that can be contained within a single directory,
causing dcrtimed to stop producing new anchors.

To fix this, we switch the directory format, itself a timestamp, from
yyyymmdd.HHMMSS to yyyy-mm/dd/HHMMSS.  A filesystem.Walk call is now used
instead of os.ReadDir to read or iterate through the timestamp directories.

This requires a manual database migration.  The dcrtime_dumpdb tool (built
before this commit) can be used to dump the existing database to a JSON file,
and dcrtime_dumpdb (built at this commit) to restore the data.
@jrick jrick merged commit e35b14e into decred:master Sep 15, 2025
2 checks passed
@jrick jrick deleted the emlink branch September 15, 2025 17:35
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.

2 participants