Comments (5)
Thanks :)
First of all, I don't consider this a bug in Nitrite, just a lack of tools to gracefully handle situations like this (i.e., without clearing the entire database).
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 rollbackTo
on it.
from nitrite-java.
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);
}
from nitrite-java.
Hi @AngryGami did you try rebuilding index instead of dropping it, if you think the index is corrupted?
why do
openMap
here? MVStore is totally capable of removing map by just name
Inside the MVStore, it is opening the map by name anyway if it's not already opened. And openMap
has no overhead in Nitrite if the MV map is already opened.
from nitrite-java.
did you try rebuilding index instead of dropping it, if you think the index is corrupted?
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.
Inside the MVStore, it is opening the map by name anyway if it's not already opened. And openMap has no overhead in Nitrite if the MV map is already opened.
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.
from nitrite-java.
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, removeMap(String)
is calling removeMap(MVMap)
and if the map is not opened, it is first opened in removeMap(String)
and then call removeMap(MVMap)
. Essentially, you can't avoid the situation you are currently in even if removeMap(String)
is used.
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 NitriteMVStore
which tries to open the map with previous version if the db is corrupted. I am not sure if it will solve your issue, but as I said, I have no means to reproduce this issue and test the fix myself.
After cloning the repo branch to your local, just do a mvn clean install
(may be change the pom version before) and use it in your project and see if the fix resolves the issue.
from nitrite-java.
Related Issues (20)
- EntityConverter toDocument HOT 3
- KotlinXSerializationMapper decodes lists to be size 1 always HOT 1
- Invalid repository type for entity where all fields are nullable (with JacksonMapperModule) HOT 3
- Possibiltity to index a field with both text and non-unique/unique filter HOT 3
- Incorrect result when searching indexed column HOT 1
- Support JPMS HOT 6
- Feature request: method for retrieving all document ids in a collection faster HOT 1
- Search for _id always returns an iterator with an element HOT 2
- org.dizitart.no2.common.tuples.Pair cannot be cast to class java.lang.Comparable HOT 4
- @Indices is not neccessary to use, multiple @Index annotations on class are allowed HOT 1
- Repositories initialization logic not compatible with Kotlinx.serialization HOT 8
- bootstrap-3.3.7.min.js: 6 vulnerabilities (highest severity is: 6.1) HOT 1
- jquery.dataTables-1.10.12.min.js: 1 vulnerabilities (highest severity is: 6.1) HOT 1
- Chart-2.1.4.min.js: 1 vulnerabilities (highest severity is: 9.8) HOT 1
- bootstrap-3.3.6.min.js: 6 vulnerabilities (highest severity is: 6.1) HOT 1
- bug: Nitrite#getCollection sometimes fails HOT 3
- bug: migration from 3.x to 4.x with MVStore module fails HOT 2
- Tests fail on systems with non ENGLISH locale
- 4.3.0-SNAPSHOT no longer available HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nitrite-java.