-
-
Notifications
You must be signed in to change notification settings - Fork 56
Destroy() creates directory on Windows #30
Comments
@vweevers Great find! |
I just had a quick look and this is in the upstream code. |
Current master looks identical |
Found the cause. There's a
rocksdb/deps/leveldb/leveldb-rocksdb/db/db_impl.cc Lines 6205 to 6206 in fc844eb
rocksdb/deps/leveldb/leveldb-rocksdb/db/db_impl.cc Lines 144 to 150 in fc844eb
rocksdb/deps/leveldb/leveldb-rocksdb/db/auto_roll_logger.cc Lines 170 to 173 in fc844eb
rocksdb/deps/leveldb/leveldb-rocksdb/port/win/win_logger.cc Lines 31 to 52 in fc844eb
|
Open questions:
|
Afaik, everything under
No idea.
Maybe we could through options (guessing). There's #13 that @MeirionHughes created. Might be related. |
@vweevers What does the |
Yeah, info, warnings and errors it seems. |
Sheesh. That's a tonne of i/o enabled by default. |
Oh, no, I didn't check which log levels are enabled by default. |
Also I can't find an option to completely disable the log, but there is an option to change its path: rocksdb/deps/leveldb/leveldb-rocksdb/db/auto_roll_logger.cc Lines 147 to 148 in fc844eb
|
Gawd. Logging should never be enabled by default 🙄 |
Hmm, but what about the caller of |
Was about to post an issue about it but if you have questions you need to use facebook lol. |
We could implement our own noop-logger and pass it to rocksdb via the options. |
See also facebook/rocksdb#494. |
I can't believe there's no option for turning off the logging completely. It seems you can only tune the log level which is not what we want. |
We could also have a fork of the whole project, with logging disabled 😀 |
One the one hand I think trying to close the One the other hand something tells me that it might be difficult to get this right since all form of logging basically can take place anywhere in the code base. So the real fix is probably implementing our own no-op logger. However, if we do that, this would change behavior and we should release a new major. |
Agree. Disabling logging not only fixes the destroy issue, but also, well, gets rid of the logging 😸 It should be an option though (defaulting to disabled). And since this diverges from leveldown, we should also copy leveldown's API docs to here, and document the additional option(s). How would it look like in JS-land? levelup(rocksdb(location), { log: true }) Or make it a loglevel, adding levelup(rocksdb(location), { loglevel: 'none' }) // our default
levelup(rocksdb(location), { loglevel: 'info' })
levelup(rocksdb(location), { loglevel: 'warning' }) // etc Assuming there is such an option. I couldn't figure out if it's a build-time or runtime option. |
the docs kind of imply it isn't just a "log" file though; it serves as a "backup" of the in-memory recent-commits before they are flushed to the main storage file. If there is a crash before the data is written, then the log file will be used to "reconstruct" the missing data. Remove that and you potentially lose data when/if you crash. |
@MeirionHughes I think (but could use confirmation) these are two different things. Here are the rocksdb file types: rocksdb/deps/leveldb/leveldb-rocksdb/db/filename.h Lines 31 to 42 in fc844eb
I think you're talking about |
ah ok; just double-checking. :P |
@vweevers Some research It seems that rocksdb/deps/leveldb/leveldb-rocksdb/db/db_impl.cc Lines 6205 to 6208 in fc844eb
It has a member So this answers when the logger object dies. It in turn does |
That means that a simple |
So the problem we have is that I think |
That's probably the best fix! |
I'll try that out in a bit :) |
I also made some logging in c++ land just to see when the Just FYI. |
OK doing And I wanted to write a unit test, but we also have this: Lines 27 to 33 in fc844eb
Which still passes. So if the parent directory doesn't exist @ralphtheninja does leveldown have the same behavior? |
👍
I don't know. You would have to test this. |
Scratch that, I made a mistake testing it. leveldown is different, doesn't throw in either case. |
Repro:
Here's the relevant C++, comments mine:
The
DeleteDir
fails (silently) with:The text was updated successfully, but these errors were encountered: