Rename constants

This commit is contained in:
Andrea Cavalli 2021-10-25 00:42:48 +02:00
parent 90aa7a2522
commit db9b1bb7fb
6 changed files with 13 additions and 13 deletions

View File

@ -30,7 +30,7 @@ public class LLTempLMDBEnv implements Closeable {
.setMapSize(TWENTY_GIBIBYTES) .setMapSize(TWENTY_GIBIBYTES)
.setMaxDbs(MAX_DATABASES); .setMaxDbs(MAX_DATABASES);
//env = envBuilder.open(tempDirectory.toFile(), MDB_NOLOCK, MDB_NOSYNC, MDB_NOTLS, MDB_NORDAHEAD, MDB_WRITEMAP); //env = envBuilder.open(tempDirectory.toFile(), MDB_NOLOCK, MDB_NOSYNC, MDB_NOTLS, MDB_NORDAHEAD, MDB_WRITEMAP);
env = envBuilder.open(tempDirectory.toFile(), MDB_NOTLS, MDB_WRITEMAP, MDB_NORDAHEAD); env = envBuilder.open(tempDirectory.toFile(), MDB_NOTLS, MDB_NOSYNC, MDB_NORDAHEAD, MDB_NOMETASYNC);
} }
public Env<ByteBuf> getEnv() { public Env<ByteBuf> getEnv() {

View File

@ -18,7 +18,7 @@ import org.lmdbjava.Txn;
public class LMDBArray<V> implements IArray<V>, Closeable { public class LMDBArray<V> implements IArray<V>, Closeable {
private static final boolean FORCE_SYNC = false; private static final boolean FORCE_SYNC = false;
private static final boolean FORCE_THREAD_LOCAL = true; private static final boolean DONT_MERGE_TXNS = true;
private static final AtomicLong NEXT_LMDB_ARRAY_ID = new AtomicLong(0); private static final AtomicLong NEXT_LMDB_ARRAY_ID = new AtomicLong(0);
@ -43,7 +43,7 @@ public class LMDBArray<V> implements IArray<V>, Closeable {
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.writing = true; this.writing = true;
if (FORCE_THREAD_LOCAL) { if (DONT_MERGE_TXNS) {
this.rwTxn = null; this.rwTxn = null;
} else { } else {
this.rwTxn = this.env.txnWrite(); this.rwTxn = this.env.txnWrite();
@ -91,7 +91,7 @@ public class LMDBArray<V> implements IArray<V>, Closeable {
} }
private void endMode() { private void endMode() {
if (FORCE_THREAD_LOCAL) { if (DONT_MERGE_TXNS) {
writing = true; writing = true;
if (readTxn != null) { if (readTxn != null) {
readTxn.commit(); readTxn.commit();

View File

@ -28,7 +28,7 @@ import reactor.util.function.Tuples;
public class LMDBPriorityQueue<T> implements PriorityQueue<T>, Reversable<ReversableResourceIterable<T>>, ReversableResourceIterable<T> { public class LMDBPriorityQueue<T> implements PriorityQueue<T>, Reversable<ReversableResourceIterable<T>>, ReversableResourceIterable<T> {
private static final boolean FORCE_SYNC = false; private static final boolean FORCE_SYNC = false;
private static final boolean FORCE_THREAD_LOCAL = true; private static final boolean DONT_MERGE_TXNS = true;
private static final AtomicLong NEXT_LMDB_QUEUE_ID = new AtomicLong(0); private static final AtomicLong NEXT_LMDB_QUEUE_ID = new AtomicLong(0);
private static final AtomicLong NEXT_ITEM_UID = new AtomicLong(0); private static final AtomicLong NEXT_ITEM_UID = new AtomicLong(0);
@ -56,7 +56,7 @@ public class LMDBPriorityQueue<T> implements PriorityQueue<T>, Reversable<Revers
this.writing = true; this.writing = true;
this.iterating = false; this.iterating = false;
if (FORCE_THREAD_LOCAL) { if (DONT_MERGE_TXNS) {
this.rwTxn = null; this.rwTxn = null;
} else { } else {
this.rwTxn = this.env.txnWrite(); this.rwTxn = this.env.txnWrite();
@ -129,7 +129,7 @@ public class LMDBPriorityQueue<T> implements PriorityQueue<T>, Reversable<Revers
} }
private void endMode() { private void endMode() {
if (FORCE_THREAD_LOCAL) { if (DONT_MERGE_TXNS) {
if (cur != null) { if (cur != null) {
cur.close(); cur.close();
cur = null; cur = null;

View File

@ -64,8 +64,14 @@ public class AdaptiveMultiSearcher implements MultiSearcher {
return scoredPaged.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer); return scoredPaged.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
} else { } else {
if ((queryParams.isSorted() && !queryParams.isSortedByScore())) { if ((queryParams.isSorted() && !queryParams.isSortedByScore())) {
if (queryParams.limitLong() < MAX_IN_MEMORY_SIZE) {
throw new UnsupportedOperationException("Allowed limit is " + MAX_IN_MEMORY_SIZE + " or greater");
}
return sortedScoredFull.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer); return sortedScoredFull.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
} else { } else {
if (queryParams.limitLong() < MAX_IN_MEMORY_SIZE) {
throw new UnsupportedOperationException("Allowed limit is " + MAX_IN_MEMORY_SIZE + " or greater");
}
return unsortedScoredFull.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer); return unsortedScoredFull.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
} }
} }

View File

@ -65,9 +65,6 @@ public class SortedScoredFullMultiSearcher implements MultiSearcher {
.fromCallable(() -> { .fromCallable(() -> {
LLUtils.ensureBlocking(); LLUtils.ensureBlocking();
var totalHitsThreshold = queryParams.getTotalHitsThresholdLong(); var totalHitsThreshold = queryParams.getTotalHitsThresholdLong();
if (queryParams.limitLong() < MAX_IN_MEMORY_SIZE) {
throw new UnsupportedOperationException("Allowed limit is " + MAX_IN_MEMORY_SIZE + " or greater");
}
return LMDBFullFieldDocCollector.createSharedManager(env, queryParams.sort(), queryParams.limitInt(), return LMDBFullFieldDocCollector.createSharedManager(env, queryParams.sort(), queryParams.limitInt(),
totalHitsThreshold); totalHitsThreshold);
}) })

View File

@ -69,9 +69,6 @@ public class UnsortedScoredFullMultiSearcher implements MultiSearcher {
return Mono return Mono
.fromCallable(() -> { .fromCallable(() -> {
LLUtils.ensureBlocking(); LLUtils.ensureBlocking();
if (queryParams.limitLong() < MAX_IN_MEMORY_SIZE) {
throw new UnsupportedOperationException("Allowed limit is " + MAX_IN_MEMORY_SIZE + " or greater");
}
var totalHitsThreshold = queryParams.getTotalHitsThresholdLong(); var totalHitsThreshold = queryParams.getTotalHitsThresholdLong();
return LMDBFullScoreDocCollector.createSharedManager(env, queryParams.limitLong(), totalHitsThreshold); return LMDBFullScoreDocCollector.createSharedManager(env, queryParams.limitLong(), totalHitsThreshold);
}) })