skip reindex if average fill ratio over 90%
This commit is contained in:
@@ -586,8 +586,21 @@ public class PersistentMap<K, V> implements AutoCloseable {
|
|||||||
|
|
||||||
public synchronized void reindex() throws IOException {
|
public synchronized void reindex() throws IOException {
|
||||||
final long start = System.nanoTime();
|
final long start = System.nanoTime();
|
||||||
final AtomicLong countValues = new AtomicLong();
|
|
||||||
final PersistentMapStats previousStats = stats();
|
final PersistentMapStats previousStats = stats();
|
||||||
|
|
||||||
|
if (previousStats.getAverageFill() > 0.9) {
|
||||||
|
LOGGER.info("skip reindexing because average fill ratio is > 0.9 file: {}, version: {} stats: \n{}", path,
|
||||||
|
version, previousStats);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previousStats.getInnerNodes() < 1) {
|
||||||
|
LOGGER.info("skip reindexing because no inner nodes file: {}, version: {} stats: \n{}", path, version,
|
||||||
|
previousStats);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final AtomicLong countValues = new AtomicLong();
|
||||||
LOGGER.info("start reindexing file: {}, version: {}", path, version);
|
LOGGER.info("start reindexing file: {}, version: {}", path, version);
|
||||||
final Path newFile = path.getParent().resolve(path.getFileName() + ".tmp");
|
final Path newFile = path.getParent().resolve(path.getFileName() + ".tmp");
|
||||||
|
|
||||||
@@ -706,7 +719,7 @@ public class PersistentMap<K, V> implements AutoCloseable {
|
|||||||
try {
|
try {
|
||||||
if (version < 1) {
|
if (version < 1) {
|
||||||
reindex();
|
reindex();
|
||||||
} else if (false) {
|
} else if (true) {
|
||||||
final String reindexProperty = System.getProperty("pdb.reindex", "false");
|
final String reindexProperty = System.getProperty("pdb.reindex", "false");
|
||||||
if (!isNew && (reindexProperty.equals("true")
|
if (!isNew && (reindexProperty.equals("true")
|
||||||
|| path.getParent().getFileName().toString().equals(reindexProperty))) {
|
|| path.getParent().getFileName().toString().equals(reindexProperty))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user