Skip to content

Commit

Permalink
GH-455 Disable delete bitmap when not required
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed Mar 1, 2024
1 parent e42e7f6 commit c760e93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.the_qa_company.qendpoint.store;

import com.the_qa_company.qendpoint.core.compact.bitmap.MultiLayerBitmapWrapper;
import com.the_qa_company.qendpoint.core.enums.TripleComponentOrder;
import com.the_qa_company.qendpoint.store.exception.EndpointTimeoutException;
import com.the_qa_company.qendpoint.utils.BitArrayDisk;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.common.iteration.IndexReportingIterator;
import org.eclipse.rdf4j.model.IRI;
Expand Down Expand Up @@ -52,16 +54,11 @@ public boolean hasNext() {
// iterate over the result of hdt
while (iterator.hasNext()) {
TripleID tripleID = iterator.next();
long index;
if (endpoint.isDeleteDisabled()) {
index = -1;
} else {
index = iterator.getLastTriplePosition();
}
TripleComponentOrder order = iterator.isLastTriplePositionBoundToOrder() ? iterator.getOrder()
: TripleComponentOrder.SPO;
if (endpoint.isDeleteDisabled() || !endpoint.getDeleteBitMap(order)
.access(tripleID.isQuad() ? tripleID.getGraph() - 1 : 0, index)) {
MultiLayerBitmapWrapper.MultiLayerModBitmapWrapper dbm = endpoint.getDeleteBitMap(order);
if (endpoint.isDeleteDisabled() || dbm.<BitArrayDisk>getHandle().getMaxNumBits() == 0
|| !dbm.access(tripleID.isQuad() ? tripleID.getGraph() - 1 : 0, iterator.getLastTriplePosition())) {
Resource subject = endpoint.getHdtConverter().idToSubjectHDTResource(tripleID.getSubject());
IRI predicate = endpoint.getHdtConverter().idToPredicateHDTResource(tripleID.getPredicate());
Value object = endpoint.getHdtConverter().idToObjectHDTResource(tripleID.getObject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,11 @@ public String printInfo() {
+ (inMemory ? ", inMemory: true" : "\nfile: " + output.getFile().getAbsolutePath())
+ (allBits <= 20 ? "\nbits: " + toString(true) : "");
}

/**
* @return the maximum bit of this bitmap
*/
public long getMaxNumBits() {
return numbits;
}
}

0 comments on commit c760e93

Please sign in to comment.