added a consistency check for new queues

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6931 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 73f03e05ee
commit 986d4f34d9

@ -117,6 +117,10 @@ public class yacyNewsQueue {
}
public synchronized void push(final yacyNewsDB.Record entry) throws IOException, RowSpaceExceededException {
if (!queueStack.consistencyCheck()) {
Log.logSevere("yacyNewsQueue", "reset of table " + this.path);
queueStack.clear();
}
queueStack.addUnique(r2b(entry, true));
}

@ -315,6 +315,15 @@ public class Table implements ObjectIndex, Iterable<Row.Entry> {
return (((long)(rowdef.primaryKeyLength + 4)) * tableSize(f, rowdef.objectsize, true) * RowCollection.growfactorLarge100 / 100L);
}
public boolean consistencyCheck() {
try {
return file.size() == index.size();
} catch (IOException e) {
Log.logException(e);
return false;
}
}
public synchronized void addUnique(final Entry row) throws IOException, RowSpaceExceededException {
assert file.size() == index.size() : "file.size() = " + file.size() + ", index.size() = " + index.size();
assert table == null || table.size() == index.size() : "table.size() = " + table.size() + ", index.size() = " + index.size();

Loading…
Cancel
Save