-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Chunk not found
exception when trying to drop index
#977
Comments
Nitrite can be less strict when removing map from MVStore here: public void removeMap(String name) {
// why do `openMap` here? MVStore is totally capable of removing map by just name
MVMap<?, ?> mvMap = this.mvStore.openMap(name);
this.mvStore.removeMap(mvMap);
this.getCatalog().remove(name);
this.nitriteMapRegistry.remove(name);
} |
Hi @AngryGami did you try rebuilding index instead of dropping it, if you think the index is corrupted?
Inside the MVStore, it is opening the map by name anyway if it's not already opened. And |
I didn't, but I'm actually operating not on index, I'm trying to drop Repository/Collection (so internally it looks for indexes associated with it and drop them, and one of them apparently got corrupted and refuse get dropped). I don't really care about fixing the index - it doesn't make a lot of sense, I would prefer to drop collection and be done with it.
Well, I'm not sure it does open it internally. Here is the method for removing map by name: public void removeMap(String name) {
int id = getMapId(name);
if(id > 0) {
MVMap<?, ?> map = getMap(id);
if (map == null) {
map = openMap(name, MVStoreTool.getGenericMapBuilder());
}
removeMap(map);
}
} It only goes inside openMap method if getMap returns null and I hoped that map was already opened at this point somehow. |
That's what I said (Inside the MVStore, it is opening the map by name anyway if it's not already opened). If the map is already opened, Now back to the problem itself. As this kind of issue is almost impossible to reproduce, I need your help here in debugging it. Here is the branch which contains a slightly modified After cloning the repo branch to your local, just do a |
Thanks :) Unfortunately, I don't have the corrupted database file anymore. I had to continue with other tasks and deleted it. I was just thinking about a mechanism to recover from such issues when the app is in production. I'll try that branch with the fix if I encounter the problem again (I've seen this a couple of times already, so it's likely to happen again). As far as I understand, this happens because the app crashes for some other reason, and the database fails to fully write either data or metadata for some chunk. Therefore, the approach of opening a previous version should work. I was considering this myself, for example, by accessing the MVStore instance and calling |
I'm getting following exception when trying to drop index
I understand that my db is probably corrupted and I could just delete db file and start from scratch but I believe there must be less destructive way. I don't want to loose everything else in db just because one index is corrupted.
The text was updated successfully, but these errors were encountered: