Fixed cache bug

master
Andrea Cavalli 3 years ago
parent bf40dd7787
commit 4901f2fd4c
  1. 7
      src/main/java/it/cavallium/strangedb/database/references/DatabaseReferencesMetadataCache.java

@ -81,13 +81,14 @@ public class DatabaseReferencesMetadataCache {
if (closed) throw new IOException("Cache already closed!");
lock.writeLock().lock();
try {
Long2LongMap referencesBlocksToAdd = new Long2LongLinkedOpenHashMap(references, blockIds, 0.5f);
Long2ByteMap referencesCleanersToAdd = new Long2ByteLinkedOpenHashMap(references, cleanerIds, 0.5f);
for (int i = 0; i < references.length; i++) {
if (cleanerIds[i] == 0) {
throw new IOException("Null cleaner id");
referencesBlocksToAdd.remove(references[i]);
referencesCleanersToAdd.remove(references[i]);
}
}
Long2LongMap referencesBlocksToAdd = new Long2LongLinkedOpenHashMap(references, blockIds, 0.5f);
Long2ByteMap referencesCleanersToAdd = new Long2ByteLinkedOpenHashMap(references, cleanerIds, 0.5f);
references2Blocks.putAll(referencesBlocksToAdd);
referencesCleaners.putAll(referencesCleanersToAdd);
flush();

Loading…
Cancel
Save