Repository: asterixdb Updated Branches: refs/heads/master 54384a377 -> f86a25b86
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/kill_cc_and_nc.sh ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/kill_cc_and_nc.sh b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/kill_cc_and_nc.sh new file mode 100755 index 0000000..4b876be --- /dev/null +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/kill_cc_and_nc.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +ps -ef | awk '/java.*org\.apache\.hyracks\.control\.[cn]c\.[CN]CDriver/ {print $2}' | xargs -n 1 kill -9 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_delete.sh ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_delete.sh b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_delete.sh new file mode 100755 index 0000000..eb1c01e --- /dev/null +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_delete.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +$MANAGIX_HOME/bin/managix stop -n asterix; +$MANAGIX_HOME/bin/managix delete -n asterix; + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_start.sh ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_start.sh b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_start.sh new file mode 100755 index 0000000..2fb80ce --- /dev/null +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_filtered/stop_and_start.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +$MANAGIX_HOME/bin/managix stop -n asterix; +$MANAGIX_HOME/bin/managix start -n asterix; + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/create_and_start.sh ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/create_and_start.sh b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/create_and_start.sh new file mode 100755 index 0000000..789914b --- /dev/null +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/create_and_start.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +$MANAGIX_HOME/bin/managix create -n asterix -c $MANAGIX_HOME/clusters/local/local.xml; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/kill_cc_and_nc.sh ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/kill_cc_and_nc.sh b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/kill_cc_and_nc.sh new file mode 100755 index 0000000..4b876be --- /dev/null +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/kill_cc_and_nc.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +ps -ef | awk '/java.*org\.apache\.hyracks\.control\.[cn]c\.[CN]CDriver/ {print $2}' | xargs -n 1 kill -9 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_delete.sh ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_delete.sh b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_delete.sh new file mode 100755 index 0000000..eb1c01e --- /dev/null +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_delete.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +$MANAGIX_HOME/bin/managix stop -n asterix; +$MANAGIX_HOME/bin/managix delete -n asterix; + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_start.sh ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_start.sh b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_start.sh new file mode 100755 index 0000000..2fb80ce --- /dev/null +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/scripts/recover_after_abort/primary_plus_rtree_index_insert_and_delete_filtered/stop_and_start.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +$MANAGIX_HOME/bin/managix stop -n asterix; +$MANAGIX_HOME/bin/managix start -n asterix; + http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/asterixdb/asterix-installer/src/test/resources/transactionts/testsuite.xml ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/resources/transactionts/testsuite.xml b/asterixdb/asterix-installer/src/test/resources/transactionts/testsuite.xml index f039708..92ae1bd 100644 --- a/asterixdb/asterix-installer/src/test/resources/transactionts/testsuite.xml +++ b/asterixdb/asterix-installer/src/test/resources/transactionts/testsuite.xml @@ -92,6 +92,48 @@ </test-case> <test-case FilePath="recover_after_abort"> + <compilation-unit name="primary_index_only_filtered"> + <output-dir compare="Text">primary_index_only_filtered</output-dir> + </compilation-unit> + </test-case> + + <test-case FilePath="recover_after_abort"> + <compilation-unit name="primary_plus_default_secondary_index_filtered"> + <output-dir compare="Text">primary_plus_default_secondary_index_filtered</output-dir> + </compilation-unit> + </test-case> + + <test-case FilePath="recover_after_abort"> + <compilation-unit name="primary_plus_rtree_index_filtered"> + <output-dir compare="Text">primary_plus_rtree_index_filtered</output-dir> + </compilation-unit> + </test-case> + + <test-case FilePath="recover_after_abort"> + <compilation-unit name="primary_plus_rtree_index_insert_and_delete_filtered"> + <output-dir compare="Text">primary_plus_rtree_index_insert_and_delete_filtered</output-dir> + </compilation-unit> + </test-case> + + <test-case FilePath="recover_after_abort"> + <compilation-unit name="primary_plus_keyword_secondary_index_filtered"> + <output-dir compare="Text">primary_plus_keyword_secondary_index_filtered</output-dir> + </compilation-unit> + </test-case> + + <test-case FilePath="recover_after_abort"> + <compilation-unit name="primary_plus_ngram_index"> + <output-dir compare="Text">primary_plus_ngram_index_filtered</output-dir> + </compilation-unit> + </test-case> + + <test-case FilePath="recover_after_abort"> + <compilation-unit name="primary_plus_multiple_secondary_indices"> + <output-dir compare="Text">primary_plus_multiple_secondary_indices_filtered</output-dir> + </compilation-unit> + </test-case> + + <test-case FilePath="recover_after_abort"> <compilation-unit name="temp_primary_index_only"> <output-dir compare="Text">primary_index_only</output-dir> <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException</expected-error> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java index ce35fbf..f781a88 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java @@ -299,7 +299,7 @@ public class BTree extends AbstractTreeIndex { } // fall-through case SUFFICIENT_CONTIGUOUS_SPACE: { - ctx.getModificationCallback().found(null, tuple); + foundModCallback(ctx, null, tuple); ctx.getLeafFrame().insert(tuple, targetTupleIndex); ctx.getSplitKey().reset(); break; @@ -307,7 +307,7 @@ public class BTree extends AbstractTreeIndex { case SUFFICIENT_SPACE: { int finalIndex = ctx.getLeafFrame().compact() ? ctx.getLeafFrame().findInsertTupleIndex(tuple) : targetTupleIndex; - ctx.getModificationCallback().found(null, tuple); + foundModCallback(ctx, null, tuple); ctx.getLeafFrame().insert(tuple, finalIndex); ctx.getSplitKey().reset(); break; @@ -316,7 +316,7 @@ public class BTree extends AbstractTreeIndex { // Try compressing the page first and see if there is space available. if (ctx.getLeafFrame().compress() && ctx.getLeafFrame().hasSpaceInsert(tuple) == FrameOpSpaceStatus.SUFFICIENT_CONTIGUOUS_SPACE) { - ctx.getModificationCallback().found(null, tuple); + foundModCallback(ctx, null, tuple); ctx.getLeafFrame().insert(tuple, ctx.getLeafFrame().findInsertTupleIndex(tuple)); ctx.getSplitKey().reset(); } else { @@ -359,10 +359,10 @@ public class BTree extends AbstractTreeIndex { // Perform an update (delete + insert) if the updateTupleIndex != -1 if (updateTupleIndex != -1) { ITupleReference beforeTuple = ctx.getLeafFrame().getMatchingKeyTuple(tuple, updateTupleIndex); - ctx.getModificationCallback().found(beforeTuple, tuple); + foundModCallback(ctx, beforeTuple, tuple); ctx.getLeafFrame().delete(tuple, updateTupleIndex); } else { - ctx.getModificationCallback().found(null, tuple); + foundModCallback(ctx, null, tuple); } ctx.getLeafFrame().split(rightFrame, tuple, ctx.getSplitKey(), ctx, bufferCache); @@ -395,7 +395,7 @@ public class BTree extends AbstractTreeIndex { boolean restartOp = false; switch (spaceStatus) { case SUFFICIENT_INPLACE_SPACE: { - ctx.getModificationCallback().found(beforeTuple, tuple); + foundModCallback(ctx, beforeTuple, tuple); ctx.getLeafFrame().update(tuple, oldTupleIndex, true); ctx.getSplitKey().reset(); break; @@ -404,7 +404,7 @@ public class BTree extends AbstractTreeIndex { // TODO: avoid repeated calculation of tuple size // TODO: in-place update on expand // Delete the old tuple, compact the frame, and insert the new tuple. - ctx.getModificationCallback().found(beforeTuple, tuple); + foundModCallback(ctx, beforeTuple, tuple); ctx.getLeafFrame().delete(tuple, oldTupleIndex); ctx.getLeafFrame().compact(); ctx.getLeafFrame().ensureCapacity(bufferCache, tuple, ctx); @@ -414,14 +414,14 @@ public class BTree extends AbstractTreeIndex { break; } case SUFFICIENT_CONTIGUOUS_SPACE: { - ctx.getModificationCallback().found(beforeTuple, tuple); + foundModCallback(ctx, beforeTuple, tuple); ctx.getLeafFrame().update(tuple, oldTupleIndex, false); ctx.getSplitKey().reset(); break; } case SUFFICIENT_SPACE: { // Delete the old tuple, compact the frame, and insert the new tuple. - ctx.getModificationCallback().found(beforeTuple, tuple); + foundModCallback(ctx, beforeTuple, tuple); ctx.getLeafFrame().delete(tuple, oldTupleIndex); ctx.getLeafFrame().compact(); int targetTupleIndex = ctx.getLeafFrame().findInsertTupleIndex(tuple); @@ -754,6 +754,12 @@ public class BTree extends AbstractTreeIndex { modificationCallback, searchCallback); } + private BTreeOpContext createOpContext(IIndexAccessor accessor, IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback, int[] logTupleFields) { + return new BTreeOpContext(accessor, leafFrameFactory, interiorFrameFactory, freePageManager, cmpFactories, + modificationCallback, searchCallback, logTupleFields); + } + @SuppressWarnings("rawtypes") public String printTree(IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame, ISerializerDeserializer[] keySerdes) throws Exception { @@ -814,6 +820,11 @@ public class BTree extends AbstractTreeIndex { return new BTreeAccessor(this, modificationCallback, searchCallback); } + public ITreeIndexAccessor createAccessor(IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback, int[] logTupleFields) { + return new BTreeAccessor(this, modificationCallback, searchCallback, logTupleFields); + } + // TODO: Class should be private. But currently we need to expose the // setOpContext() API to the LSM Tree for it to work correctly. @@ -833,6 +844,12 @@ public class BTree extends AbstractTreeIndex { this.ctx = btree.createOpContext(this, modificationCalback, searchCallback); } + public BTreeAccessor(BTree btree, IModificationOperationCallback modificationCalback, + ISearchOperationCallback searchCallback, int[] logTupleFields) { + this.btree = btree; + this.ctx = btree.createOpContext(this, modificationCalback, searchCallback, logTupleFields); + } + public void reset(BTree btree, IModificationOperationCallback modificationCallback, ISearchOperationCallback searchCallback) { this.btree = btree; @@ -1220,4 +1237,14 @@ public class BTree extends AbstractTreeIndex { public int getNumOfFilterFields() { return 0; } + + private void foundModCallback(BTreeOpContext ctx, ITupleReference before, ITupleReference after) + throws HyracksDataException { + if (ctx.getTupleWithNonIndexFields() == null) { + ctx.getModificationCallback().found(before, after); + } else { + ctx.getModificationCallback().found(before, ctx.getTupleWithNonIndexFields()); + } + } + } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java index bf163ea..cb82936 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java @@ -38,6 +38,7 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory; import org.apache.hyracks.storage.am.common.api.ITreeIndexMetadataFrame; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; +import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference; import org.apache.hyracks.storage.common.IIndexAccessor; import org.apache.hyracks.storage.common.IModificationOperationCallback; import org.apache.hyracks.storage.common.ISearchOperationCallback; @@ -55,6 +56,7 @@ public class BTreeOpContext implements IIndexOperationContext, IExtraPageBlockHe private final IBTreeInteriorFrame interiorFrame; private final IPageManager freePageManager; private final ITreeIndexMetadataFrame metaFrame; + private PermutingTupleReference tupleWithNonIndexFields; // Optional, for filtered LSM Index transaction support private ITreeIndexFrameFactory leafFrameFactory; private IBTreeLeafFrame leafFrame; private IndexOperation op; @@ -111,6 +113,15 @@ public class BTreeOpContext implements IIndexOperationContext, IExtraPageBlockHe this.interiorFrameTuple = getInteriorFrame().createTupleReference(); } + public BTreeOpContext(IIndexAccessor accessor, ITreeIndexFrameFactory leafFrameFactory, + ITreeIndexFrameFactory interiorFrameFactory, IPageManager freePageManager, + IBinaryComparatorFactory[] cmpFactories, IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback, int[] nonIndexFields) { + this(accessor, leafFrameFactory, interiorFrameFactory, freePageManager, cmpFactories, modificationCallback, + searchCallback); + this.tupleWithNonIndexFields = new PermutingTupleReference(nonIndexFields); + } + @Override public void reset() { if (pageLsns != null) { @@ -364,4 +375,12 @@ public class BTreeOpContext implements IIndexOperationContext, IExtraPageBlockHe public void setLeafFrameFactory(ITreeIndexFrameFactory leafFrameFactory) { this.leafFrameFactory = leafFrameFactory; } + + public ITupleReference getTupleWithNonIndexFields() { + return tupleWithNonIndexFields; + } + + public void resetNonIndexFieldsTuple(ITupleReference newValue) { + tupleWithNonIndexFields.reset(newValue); + } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java index d241dc6..88f58d1 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java @@ -199,6 +199,7 @@ public class LSMBTree extends AbstractLSMIndex implements ITreeIndex { if (ctx.getIndexTuple() != null) { ctx.getIndexTuple().reset(tuple); indexTuple = ctx.getIndexTuple(); + ctx.getCurrentMutableBTreeAccessor().getOpContext().resetNonIndexFieldsTuple(tuple); } else { indexTuple = tuple; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java index 77a8aeb..86502a7 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java @@ -82,8 +82,14 @@ public final class LSMBTreeOpContext extends AbstractLSMIndexOperationContext { for (int i = 0; i < mutableComponents.size(); i++) { LSMBTreeMemoryComponent mutableComponent = (LSMBTreeMemoryComponent) mutableComponents.get(i); mutableBTrees[i] = mutableComponent.getBTree(); - mutableBTreeAccessors[i] = (BTree.BTreeAccessor) mutableBTrees[i].createAccessor(modificationCallback, - NoOpOperationCallback.INSTANCE); + if (allFields != null) { + mutableBTreeAccessors[i] = (BTree.BTreeAccessor) mutableBTrees[i].createAccessor(modificationCallback, + NoOpOperationCallback.INSTANCE, allFields); + } else { + + mutableBTreeAccessors[i] = (BTree.BTreeAccessor) mutableBTrees[i].createAccessor(modificationCallback, + NoOpOperationCallback.INSTANCE); + } mutableBTreeOpCtxs[i] = mutableBTreeAccessors[i].getOpContext(); } this.insertLeafFrameFactory = insertLeafFrameFactory; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java index 19d09af..065d465 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java @@ -38,6 +38,7 @@ public abstract class AbstractLSMIndexOperationContext implements ILSMIndexOpera protected final PermutingTupleReference indexTuple; protected final MultiComparator filterCmp; protected final PermutingTupleReference filterTuple; + protected final int[] allFields; protected final List<ILSMComponent> componentHolder; protected final List<ILSMDiskComponent> componentsToBeMerged; protected final List<ILSMDiskComponent> componentsToBeReplicated; @@ -59,10 +60,18 @@ public abstract class AbstractLSMIndexOperationContext implements ILSMIndexOpera indexTuple = new PermutingTupleReference(treeFields); filterCmp = MultiComparator.create(filterCmpFactories); filterTuple = new PermutingTupleReference(filterFields); + allFields = new int[treeFields.length + filterFields.length]; + for (int i = 0; i < treeFields.length; i++) { + allFields[i] = treeFields[i]; + } + for (int i = treeFields.length; i < treeFields.length + filterFields.length; i++) { + allFields[i] = filterFields[i - treeFields.length]; + } } else { indexTuple = null; filterCmp = null; filterTuple = null; + allFields = null; } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java index 023fb19..f611f93 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java @@ -218,12 +218,13 @@ public class LSMInvertedIndex extends AbstractLSMIndex implements IInvertedIndex if (ctx.getIndexTuple() != null) { ctx.getIndexTuple().reset(tuple); indexTuple = ctx.getIndexTuple(); + ((InMemoryInvertedIndexAccessor)(ctx.getCurrentMutableInvIndexAccessors())).resetLogTuple(tuple); } else { indexTuple = tuple; } - ctx.getModificationCallback().before(indexTuple); - ctx.getModificationCallback().found(null, indexTuple); + ctx.getModificationCallback().before(tuple); + ctx.getModificationCallback().found(null, tuple); switch (ctx.getOperation()) { case INSERT: // Insert into the in-memory inverted index. http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java index 29f98b4..c725501 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java @@ -28,6 +28,8 @@ import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference; import org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent; import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndexOperationContext; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexAccessor; +import org.apache.hyracks.storage.am.lsm.invertedindex.inmemory.InMemoryInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.inmemory.InMemoryInvertedIndexAccessor; import org.apache.hyracks.storage.common.IIndexAccessor; import org.apache.hyracks.storage.common.IModificationOperationCallback; import org.apache.hyracks.storage.common.ISearchOperationCallback; @@ -55,8 +57,14 @@ public class LSMInvertedIndexOpContext extends AbstractLSMIndexOperationContext for (int i = 0; i < mutableComponents.size(); i++) { LSMInvertedIndexMemoryComponent mutableComponent = (LSMInvertedIndexMemoryComponent) mutableComponents.get(i); - mutableInvIndexAccessors[i] = (IInvertedIndexAccessor) mutableComponent.getInvIndex() - .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE); + if (allFields != null) { + mutableInvIndexAccessors[i] = (IInvertedIndexAccessor) ((InMemoryInvertedIndex) mutableComponent + .getInvIndex()).createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE, + allFields); + } else { + mutableInvIndexAccessors[i] = (IInvertedIndexAccessor) mutableComponent.getInvIndex() + .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE); + } deletedKeysBTreeAccessors[i] = mutableComponent.getDeletedKeysBTree() .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java index 959adcf..498f6f5 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java @@ -173,6 +173,12 @@ public class InMemoryInvertedIndex implements IInPlaceInvertedIndex { new InMemoryInvertedIndexOpContext(btree, tokenCmpFactories, tokenizerFactory)); } + public IIndexAccessor createAccessor(IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback, int[] nonIndexFields) throws HyracksDataException { + return new InMemoryInvertedIndexAccessor(this, + new InMemoryInvertedIndexOpContext(btree, tokenCmpFactories, tokenizerFactory), nonIndexFields); + } + @Override public IBufferCache getBufferCache() { return btree.getBufferCache(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java index f4b67e3..2e0511c 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java @@ -55,6 +55,15 @@ public class InMemoryInvertedIndexAccessor implements IInvertedIndexAccessor { NoOpOperationCallback.INSTANCE); } + public InMemoryInvertedIndexAccessor(InMemoryInvertedIndex index, IIndexOperationContext opCtx, + int[] nonIndexFields) throws HyracksDataException { + this.opCtx = opCtx; + this.index = index; + this.searcher = createSearcher(); + this.btreeAccessor = (BTreeAccessor) index.getBTree().createAccessor(NoOpOperationCallback.INSTANCE, + NoOpOperationCallback.INSTANCE, nonIndexFields); + } + @Override public void insert(ITupleReference tuple) throws HyracksDataException { opCtx.setOperation(IndexOperation.INSERT); @@ -116,4 +125,9 @@ public class InMemoryInvertedIndexAccessor implements IInvertedIndexAccessor { protected IInvertedIndexSearcher createSearcher() throws HyracksDataException { return new TOccurrenceSearcher(hyracksCtx, index); } + + public void resetLogTuple(ITupleReference newTuple) { + btreeAccessor.getOpContext().resetNonIndexFieldsTuple(newTuple); + } + } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java index 78d59a1..e615bf0 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java @@ -95,6 +95,14 @@ public class PartitionedInMemoryInvertedIndex extends InMemoryInvertedIndex impl } @Override + public IIndexAccessor createAccessor(IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback, int[] nonIndexFields) throws HyracksDataException { + return new PartitionedInMemoryInvertedIndexAccessor(this, + new PartitionedInMemoryInvertedIndexOpContext(btree, tokenCmpFactories, tokenizerFactory), + nonIndexFields); + } + + @Override public boolean openInvertedListPartitionCursors(IInvertedIndexSearcher searcher, IIndexOperationContext ictx, short numTokensLowerBound, short numTokensUpperBound, InvertedListPartitions invListPartitions, List<IInvertedListCursor> cursorsOrderedByTokens) throws HyracksDataException { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexAccessor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexAccessor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexAccessor.java index 47b4a0c..a4537a9 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexAccessor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexAccessor.java @@ -31,6 +31,11 @@ public class PartitionedInMemoryInvertedIndexAccessor extends InMemoryInvertedIn super(index, opCtx); } + public PartitionedInMemoryInvertedIndexAccessor(InMemoryInvertedIndex index, IIndexOperationContext opCtx, + int[] nonIndexFields) throws HyracksDataException { + super(index, opCtx, nonIndexFields); + } + protected IInvertedIndexSearcher createSearcher() throws HyracksDataException { return new PartitionedTOccurrenceSearcher(hyracksCtx, index); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java index 4f29c89..88a3285 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java @@ -230,12 +230,13 @@ public abstract class AbstractLSMRTree extends AbstractLSMIndex implements ITree if (ctx.getIndexTuple() != null) { ctx.getIndexTuple().reset(tuple); indexTuple = ctx.getIndexTuple(); + ctx.getCurrentMutableRTreeAccessor().getOpContext().resetNonIndexFieldsTuple(tuple); } else { indexTuple = tuple; } ctx.getModificationCallback().before(indexTuple); - ctx.getModificationCallback().found(null, indexTuple); + ctx.getModificationCallback().found(null, tuple); if (ctx.getOperation() == IndexOperation.INSERT) { ctx.getCurrentMutableRTreeAccessor().insert(indexTuple); } else { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java index 0f291df..445b5b5 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java @@ -382,6 +382,7 @@ public class LSMRTree extends AbstractLSMRTree { if (ctx.getIndexTuple() != null) { ctx.getIndexTuple().reset(tuple); indexTuple = ctx.getIndexTuple(); + ctx.getCurrentMutableRTreeAccessor().getOpContext().resetNonIndexFieldsTuple(tuple); } else { indexTuple = tuple; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java index a66fa62..670406e 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java @@ -61,8 +61,13 @@ public final class LSMRTreeOpContext extends AbstractLSMIndexOperationContext { btreeOpContexts = new BTreeOpContext[mutableComponents.size()]; for (int i = 0; i < mutableComponents.size(); i++) { LSMRTreeMemoryComponent mutableComponent = (LSMRTreeMemoryComponent) mutableComponents.get(i); - mutableRTreeAccessors[i] = (RTree.RTreeAccessor) mutableComponent.getRTree() - .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE); + if (allFields != null) { + mutableRTreeAccessors[i] = (RTree.RTreeAccessor) mutableComponent.getRTree() + .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE, allFields); + } else { + mutableRTreeAccessors[i] = (RTree.RTreeAccessor) mutableComponent.getRTree() + .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE); + } mutableBTreeAccessors[i] = (BTree.BTreeAccessor) mutableComponent.getBTree() .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java index d00bff5..81917ee 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java @@ -30,6 +30,7 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor; import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent.LSMComponentType; +import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexOperationContext; import org.apache.hyracks.storage.am.lsm.common.impls.LSMIndexSearchCursor; import org.apache.hyracks.storage.am.rtree.api.IRTreeInteriorFrame; @@ -202,6 +203,23 @@ public class LSMRTreeWithAntiMatterTuplesSearchCursor extends LSMIndexSearchCurs } @Override + public ITupleReference getFilterMinTuple() { + ILSMComponentFilter filter = operationalComponents.get( + currentCursor < numMutableComponents ? currentCursor : outputElement.getCursorIndex() + currentCursor) + .getLSMComponentFilter(); + return filter == null ? null : filter.getMinTuple(); + } + + @Override + public ITupleReference getFilterMaxTuple() { + ILSMComponentFilter filter = operationalComponents.get( + currentCursor < numMutableComponents ? currentCursor : outputElement.getCursorIndex() + currentCursor) + .getLSMComponentFilter(); + return filter == null ? null : filter.getMaxTuple(); + } + + + @Override public void next() throws HyracksDataException { foundNext = false; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java index 1750067..9a39630 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java @@ -156,6 +156,12 @@ public class RTree extends AbstractTreeIndex { modificationCallback); } + private RTreeOpContext createOpContext(IModificationOperationCallback modificationCallback, int[] nonIndexFields) { + return new RTreeOpContext((IRTreeLeafFrame) leafFrameFactory.createFrame(), + (IRTreeInteriorFrame) interiorFrameFactory.createFrame(), freePageManager, cmpFactories, + modificationCallback, nonIndexFields); + } + private ICachedPage findLeaf(RTreeOpContext ctx) throws HyracksDataException { int pageId = rootPage; boolean writeLatched = false; @@ -298,7 +304,7 @@ public class RTree extends AbstractTreeIndex { if (!isLeaf) { ctx.getInteriorFrame().insert(tuple, -1); } else { - ctx.getModificationCallback().found(null, tuple); + foundModCallback(ctx, null, tuple); ctx.getLeafFrame().insert(tuple, -1); } succeeded = true; @@ -323,7 +329,7 @@ public class RTree extends AbstractTreeIndex { ctx.getInteriorFrame().insert(tuple, -1); } else { ctx.getLeafFrame().compact(); - ctx.getModificationCallback().found(null, tuple); + foundModCallback(ctx, null, tuple); ctx.getLeafFrame().insert(tuple, -1); } succeeded = true; @@ -361,7 +367,7 @@ public class RTree extends AbstractTreeIndex { rightFrame.setPage(rightNode); rightFrame.initBuffer((byte) 0); rightFrame.setRightPage(ctx.getInteriorFrame().getRightPage()); - ctx.getModificationCallback().found(null, tuple); + foundModCallback(ctx, null, tuple); ctx.getLeafFrame().split(rightFrame, tuple, ctx.getSplitKey(), ctx, bufferCache); ctx.getLeafFrame().setRightPage(rightPageId); } @@ -755,6 +761,11 @@ public class RTree extends AbstractTreeIndex { return new RTreeAccessor(this, modificationCallback, searchCallback); } + public ITreeIndexAccessor createAccessor(IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback, int[] nonIndexFields) { + return new RTreeAccessor(this, modificationCallback, searchCallback, nonIndexFields); + } + public class RTreeAccessor implements ITreeIndexAccessor { private RTree rtree; private RTreeOpContext ctx; @@ -765,6 +776,12 @@ public class RTree extends AbstractTreeIndex { this.ctx = rtree.createOpContext(modificationCallback); } + public RTreeAccessor(RTree rtree, IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback, int[] nonIndexFields) { + this.rtree = rtree; + this.ctx = rtree.createOpContext(modificationCallback, nonIndexFields); + } + public void reset(RTree rtree, IModificationOperationCallback modificationCallback) { this.rtree = rtree; ctx.setModificationCallback(modificationCallback); @@ -1100,4 +1117,13 @@ public class RTree extends AbstractTreeIndex { public int getNumOfFilterFields() { return 0; } + + private void foundModCallback(RTreeOpContext ctx, ITupleReference before, ITupleReference after) + throws HyracksDataException { + if (ctx.getTupleWithNonIndexFields() != null) { + ctx.getModificationCallback().found(before, ctx.getTupleWithNonIndexFields()); + } else { + ctx.getModificationCallback().found(before, after); + } + } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f86a25b8/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java index 9ceae20..dc2e83b 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java @@ -30,6 +30,7 @@ import org.apache.hyracks.storage.am.common.api.IPageManager; import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor; import org.apache.hyracks.storage.am.common.api.ITreeIndexMetadataFrame; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; +import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference; import org.apache.hyracks.storage.am.rtree.api.IRTreeInteriorFrame; import org.apache.hyracks.storage.am.rtree.api.IRTreeLeafFrame; import org.apache.hyracks.storage.common.IModificationOperationCallback; @@ -60,6 +61,8 @@ public class RTreeOpContext implements IIndexOperationContext, IExtraPageBlockHe private IModificationOperationCallback modificationCallback; + private PermutingTupleReference tupleWithNonIndexFields; + public RTreeOpContext(IRTreeLeafFrame leafFrame, IRTreeInteriorFrame interiorFrame, IPageManager freePageManager, IBinaryComparatorFactory[] cmpFactories, IModificationOperationCallback modificationCallback) { @@ -79,6 +82,13 @@ public class RTreeOpContext implements IIndexOperationContext, IExtraPageBlockHe LSNUpdates = new ArrayList<>(); } + public RTreeOpContext(IRTreeLeafFrame leafFrame, IRTreeInteriorFrame interiorFrame, IPageManager freePageManager, + IBinaryComparatorFactory[] cmpFactories, IModificationOperationCallback modificationCallback, + int[] nonIndexFields) { + this(leafFrame, interiorFrame, freePageManager, cmpFactories, modificationCallback); + tupleWithNonIndexFields = new PermutingTupleReference(nonIndexFields); + } + public ITupleReference getTuple() { return tuple; } @@ -189,4 +199,12 @@ public class RTreeOpContext implements IIndexOperationContext, IExtraPageBlockHe public RTreeCursorInitialState getCursorInitialState() { return cursorInitialState; } + + public ITupleReference getTupleWithNonIndexFields() { + return tupleWithNonIndexFields; + } + + public void resetNonIndexFieldsTuple(ITupleReference newValue) { + tupleWithNonIndexFields.reset(newValue); + } }
