(array) Remove unused 'madvise' code and 3rd party dependency on 'uppend'

This wasn't actually hooked in anywhere.  Removing the dependency and code.  If it turns out we need madvise in the future, we'll re-introducde it.
This commit is contained in:
Viktor Lofgren 2024-01-22 12:56:45 +01:00
parent b91ea1d7ca
commit 6a1bfd6270
13 changed files with 2 additions and 92 deletions

View File

@ -19,8 +19,6 @@ dependencies {
implementation project(':code:common:model') implementation project(':code:common:model')
implementation project(':code:common:process') implementation project(':code:common:process')
implementation project(':third-party:uppend')
implementation libs.bundles.slf4j implementation libs.bundles.slf4j
implementation libs.prometheus implementation libs.prometheus

View File

@ -1,6 +1,5 @@
package nu.marginalia.index.forward; package nu.marginalia.index.forward;
import com.upserve.uppend.blobs.NativeIO;
import gnu.trove.map.hash.TLongIntHashMap; import gnu.trove.map.hash.TLongIntHashMap;
import nu.marginalia.array.LongArray; import nu.marginalia.array.LongArray;
import nu.marginalia.array.LongArrayFactory; import nu.marginalia.array.LongArrayFactory;
@ -65,12 +64,7 @@ public class ForwardIndexReader {
} }
private static LongArray loadData(Path dataFile) throws IOException { private static LongArray loadData(Path dataFile) throws IOException {
var data = LongArrayFactory.mmapForReadingShared(dataFile); return LongArrayFactory.mmapForReadingShared(dataFile);
// Total data is small, try to keep it in RAM for speed
data.advice(NativeIO.Advice.WillNeed);
return data;
} }
public long getDocMeta(long docId) { public long getDocMeta(long docId) {

View File

@ -10,8 +10,6 @@ java {
} }
dependencies { dependencies {
implementation project(':third-party:uppend')
implementation libs.bundles.slf4j implementation libs.bundles.slf4j
implementation libs.notnull implementation libs.notnull

View File

@ -1,6 +1,5 @@
package nu.marginalia.array; package nu.marginalia.array;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.algo.IntArrayBase; import nu.marginalia.array.algo.IntArrayBase;
import nu.marginalia.array.algo.IntArraySearch; import nu.marginalia.array.algo.IntArraySearch;
import nu.marginalia.array.algo.IntArraySort; import nu.marginalia.array.algo.IntArraySort;
@ -30,9 +29,5 @@ public interface IntArray extends IntArrayBase, IntArrayTransformations, IntArra
void force(); void force();
void advice(NativeIO.Advice advice) throws IOException;
void advice(NativeIO.Advice advice, long start, long end) throws IOException;
default void close() { } default void close() { }
} }

View File

@ -1,6 +1,5 @@
package nu.marginalia.array; package nu.marginalia.array;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.algo.LongArrayBase; import nu.marginalia.array.algo.LongArrayBase;
import nu.marginalia.array.algo.LongArraySearch; import nu.marginalia.array.algo.LongArraySearch;
import nu.marginalia.array.algo.LongArraySort; import nu.marginalia.array.algo.LongArraySort;
@ -8,7 +7,6 @@ import nu.marginalia.array.algo.LongArrayTransformations;
import nu.marginalia.array.delegate.ShiftedLongArray; import nu.marginalia.array.delegate.ShiftedLongArray;
import nu.marginalia.array.page.SegmentLongArray; import nu.marginalia.array.page.SegmentLongArray;
import java.io.IOException;
import java.lang.foreign.Arena; import java.lang.foreign.Arena;
@ -32,7 +30,4 @@ public interface LongArray extends LongArrayBase, LongArrayTransformations, Long
void force(); void force();
void close(); void close();
void advice(NativeIO.Advice advice) throws IOException;
void advice(NativeIO.Advice advice, long start, long end) throws IOException;
} }

View File

@ -1,6 +1,5 @@
package nu.marginalia.array.delegate; package nu.marginalia.array.delegate;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.ArrayRangeReference; import nu.marginalia.array.ArrayRangeReference;
import nu.marginalia.array.IntArray; import nu.marginalia.array.IntArray;
@ -51,14 +50,4 @@ public class ReferenceImplIntArrayDelegate implements IntArray {
delegate.force(); delegate.force();
} }
@Override
public void advice(NativeIO.Advice advice) throws IOException {
delegate.advice(advice);
}
@Override
public void advice(NativeIO.Advice advice, long start, long end) throws IOException {
delegate.advice(advice, start, end);
}
} }

View File

@ -1,6 +1,5 @@
package nu.marginalia.array.delegate; package nu.marginalia.array.delegate;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.ArrayRangeReference; import nu.marginalia.array.ArrayRangeReference;
import nu.marginalia.array.LongArray; import nu.marginalia.array.LongArray;
@ -51,17 +50,6 @@ public class ReferenceImplLongArrayDelegate implements LongArray {
delegate.force(); delegate.force();
} }
@Override
public void advice(NativeIO.Advice advice) throws IOException {
delegate.advice(advice);
}
@Override
public void advice(NativeIO.Advice advice, long start, long end) throws IOException {
delegate.advice(advice, start, end);
}
@Override @Override
public void close() { public void close() {
delegate.close(); delegate.close();

View File

@ -1,6 +1,5 @@
package nu.marginalia.array.delegate; package nu.marginalia.array.delegate;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.ArrayRangeReference; import nu.marginalia.array.ArrayRangeReference;
import nu.marginalia.array.IntArray; import nu.marginalia.array.IntArray;
import nu.marginalia.array.algo.SortingContext; import nu.marginalia.array.algo.SortingContext;
@ -210,14 +209,4 @@ public class ShiftedIntArray implements IntArray {
delegate.force(); delegate.force();
} }
@Override
public void advice(NativeIO.Advice advice) throws IOException {
delegate.advice(advice, shift, shift + size());
}
@Override
public void advice(NativeIO.Advice advice, long start, long end) throws IOException {
delegate.advice(advice, start + shift, end + shift);
}
} }

View File

@ -1,6 +1,5 @@
package nu.marginalia.array.delegate; package nu.marginalia.array.delegate;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.ArrayRangeReference; import nu.marginalia.array.ArrayRangeReference;
import nu.marginalia.array.LongArray; import nu.marginalia.array.LongArray;
import nu.marginalia.array.algo.LongArraySearch; import nu.marginalia.array.algo.LongArraySearch;
@ -282,14 +281,4 @@ public class ShiftedLongArray implements LongArray {
delegate.force(); delegate.force();
} }
@Override
public void advice(NativeIO.Advice advice) throws IOException {
delegate.advice(advice, shift, shift + size());
}
@Override
public void advice(NativeIO.Advice advice, long start, long end) throws IOException {
delegate.advice(advice, start + shift, end + shift);
}
} }

View File

@ -1,9 +1,7 @@
package nu.marginalia.array.page; package nu.marginalia.array.page;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.ArrayRangeReference; import nu.marginalia.array.ArrayRangeReference;
import nu.marginalia.array.IntArray; import nu.marginalia.array.IntArray;
import nu.marginalia.array.IntArray;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
@ -11,7 +9,6 @@ import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment; import java.lang.foreign.MemorySegment;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.nio.LongBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.OpenOption; import java.nio.file.OpenOption;
@ -176,14 +173,4 @@ public class SegmentIntArray implements PartitionPage, IntArray {
} }
@Override
public void advice(NativeIO.Advice advice) throws IOException {
// NativeIO.madvise((MappedByteBuffer) byteBuffer, advice);
}
@Override
public void advice(NativeIO.Advice advice, long start, long end) throws IOException {
// NativeIO.madviseRange((MappedByteBuffer) byteBuffer, advice, (int) start, (int) (end-start));
}
} }

View File

@ -1,6 +1,5 @@
package nu.marginalia.array.page; package nu.marginalia.array.page;
import com.upserve.uppend.blobs.NativeIO;
import nu.marginalia.array.ArrayRangeReference; import nu.marginalia.array.ArrayRangeReference;
import nu.marginalia.array.LongArray; import nu.marginalia.array.LongArray;
@ -174,14 +173,4 @@ public class SegmentLongArray implements PartitionPage, LongArray {
} }
@Override
public void advice(NativeIO.Advice advice) throws IOException {
// NativeIO.madvise((MappedByteBuffer) byteBuffer, advice);
}
@Override
public void advice(NativeIO.Advice advice, long start, long end) throws IOException {
// NativeIO.madviseRange((MappedByteBuffer) byteBuffer, advice, (int) start, (int) (end-start));
}
} }

View File

@ -92,7 +92,6 @@ include 'third-party:porterstemmer'
include 'third-party:xz' include 'third-party:xz'
include 'third-party:symspell' include 'third-party:symspell'
include 'third-party:rdrpostagger' include 'third-party:rdrpostagger'
include 'third-party:uppend'
include 'third-party:openzim' include 'third-party:openzim'
include 'third-party:count-min-sketch' include 'third-party:count-min-sketch'
include 'third-party:monkey-patch-opennlp' include 'third-party:monkey-patch-opennlp'

View File

@ -8,10 +8,10 @@ or lack an artifact, or to override some default that is inappropriate for the t
### Modified ### Modified
* [RDRPosTagger](rdrpostagger/) - GPL3 * [RDRPosTagger](rdrpostagger/) - GPL3
* [PorterStemmer](porterstemmer/) - LGPL3 * [PorterStemmer](porterstemmer/) - LGPL3
* [Uppend](uppend/) - MIT
* [OpenZIM](openzim/) - GPL-2.0+ * [OpenZIM](openzim/) - GPL-2.0+
* [Commons Codec](commons-codec/) - Apache 2.0 * [Commons Codec](commons-codec/) - Apache 2.0
* [encylopedia.marginalia.nu](encyclopedia-marginalia-nu/) - GPL 2.0+ * [encylopedia.marginalia.nu](encyclopedia-marginalia-nu/) - GPL 2.0+
### Repackaged ### Repackaged
* [SymSpell](symspell/) - LGPL-3.0 * [SymSpell](symspell/) - LGPL-3.0
* [Count-Min-Sketch](count-min-sketch/) - Apache 2.0 * [Count-Min-Sketch](count-min-sketch/) - Apache 2.0