-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to compact leveldb to repo fsck #3927
Comments
Will it be possible to run fsck to compact while the daemon is running (online) in another terminal? (In my steady-state use case, the daemon is running in one terminal to serve webcam files, and another terminal adds new files every hour, which can occasionally call fsck to compact since the online daemon doesn't seem to do it.) |
In my experience, the low priority compaction didn't happen and my add script failed. I need to remove the uncertainty of "maybe will compact." That's why I asked, can another script do fsck compact while the daemon is running online? |
That depends on how @kevina implements it. If it isn't much of an issue, I think it should be possible to do it online. |
It should be possible to call CompactRange with other go route are accessing the database, although it might block them until it finishes (it seams to get a write lock). https://github.com/syndtr/goleveldb/blob/master/leveldb/db_write.go#L388 If it should be implemented with the daemon running then perhaps adding as part of In any case the main problem is exposing the underlying LevelDB to do this cleanly go-ds-leveldb will likely need to be modified. |
Related to the original problem but not this issue, I am concerned on why auto compaction was not triggered. Is these really something that runs in the background and needs the process to run for a while in order to trigger, or is something about our usage causing it to not trigger, there are a bunch of parameters controlling compaction and perhaps they need to be adjusted for our use case. Or perhaps the problem is fixed in the latest version of leveldb (we haven't upgraded in a while). @whyrusleeping thoughts. |
Really not sure the exact circumstances that led to the compaction not being run, It was likely compounding failures of some sort. |
@whyrusleeping you seam to know a little more than I do, does the ipfs daemon some how trigger compaction? Is it a background thread in leveldb that does the compaction and won't run if you only use leveldb for short periods of time? |
@kevina its a background thread in leveldb that triggers the compaction normally |
@whyrusleeping for the |
@kevina Yeah, thats probably the right way to do it. |
@kevina still planning on working on this? |
Yeah. I kind of forget about these little tasks. |
I looked into it and implementing this will be non-trivial. The first problem will be to get to the underlying datastore, this is possible, but only after calling type datastore struct {
DB *leveldb.DB
} The second problem would be to discover the datastores that need compacting. ref: https://github.com/ipfs/go-ds-leveldb/blob/4f27fe0c470cb3762d7a242bcf2f8d151e3da7dd/datastore.go |
See #3763 for context.
The text was updated successfully, but these errors were encountered: