This commit is contained in:
Viktor Lofgren 2023-01-09 18:45:04 +01:00
parent 0fa1c8c16a
commit 11b0d61efc
3 changed files with 23 additions and 1 deletions

View File

@ -129,13 +129,14 @@ public class IndexServicesFactory {
revIndexDoc.get(NEXT_PART).toPath());
converter.convert();
tryGc();
}
private void convertPriorityReverseIndex() throws IOException {
logger.info("Converting priority reverse index");
var longArray = LongArray.mmapRead(writerIndexFile.get(0).toPath());
var journalReader = new SearchIndexJournalReaderSingleFile(longArray, null, ReverseIndexPriorityParameters::filterPriorityRecord);
@ -146,6 +147,8 @@ public class IndexServicesFactory {
revPrioIndexDoc.get(NEXT_PART).toPath());
converter.convert();
tryGc();
}
private void convertForwardIndex() throws IOException {
@ -156,9 +159,23 @@ public class IndexServicesFactory {
fwdIndexDocId.get(NEXT_PART).toPath(),
fwdIndexDocData.get(NEXT_PART).toPath())
.convert();
tryGc();
}
public void tryGc() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
System.runFinalization();
System.gc();
}
public ReverseIndexReader getReverseIndexReader() throws IOException {
return new ReverseIndexReader(
revIndexWords.get(LIVE_PART).toPath(),

View File

@ -1,5 +1,6 @@
package nu.marginalia.wmsa.edge.index.postings.forward;
import com.upserve.uppend.blobs.NativeIO;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
import nu.marginalia.util.array.LongArray;
import nu.marginalia.wmsa.edge.index.postings.journal.reader.SearchIndexJournalReader;
@ -73,6 +74,9 @@ public class ForwardIndexConverter {
docFileData.force();
docsFileId.force();
docFileData.advice(NativeIO.Advice.DontNeed);
docsFileId.advice(NativeIO.Advice.DontNeed);
} catch (IOException ex) {
logger.error("Failed to convert", ex);
throw ex;

View File

@ -75,6 +75,7 @@ public class ReverseIndexConverter {
StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE))
{
logger.info("Creating Intermediate Docs File");
// Construct intermediate index
try (RandomWriteFunnel intermediateDocumentWriteFunnel = new RandomWriteFunnel(tmpFileDir, RWF_BIN_SIZE))
{