Luo Chen has submitted this change and it was merged. Change subject: [ASTERIXDB-2162][STO] Ensure backward compatibility of component id ......................................................................
[ASTERIXDB-2162][STO] Ensure backward compatibility of component id - user model changes: no - storage format changes: no - interface changes: no Details: - Ensure the compatibility of component id change on legacy dataset https://asterix-gerrit.ics.uci.edu/#/c/2125/. We use a default component id generator, which always return a missing component id for these datasets. Change-Id: Ie61103b640c37729d43023b92b1245b8e2f4a264 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2147 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> Reviewed-by: Ian Maxon <[email protected]> --- M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/ioopcallbacks/AbstractLSMIndexIOOperationCallbackFactory.java M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentIdGeneratorFactory.java 3 files changed, 33 insertions(+), 3 deletions(-) Approvals: Anon. E. Moose #1000171: No violations found Jenkins: Verified; No violations found; No violations found; Verified Michael Blow: Looks good to me, approved Ian Maxon: Looks good to me, approved diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/ioopcallbacks/AbstractLSMIndexIOOperationCallbackFactory.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/ioopcallbacks/AbstractLSMIndexIOOperationCallbackFactory.java index 16447fd..5dff7f4 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/ioopcallbacks/AbstractLSMIndexIOOperationCallbackFactory.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/ioopcallbacks/AbstractLSMIndexIOOperationCallbackFactory.java @@ -19,16 +19,20 @@ package org.apache.asterix.common.ioopcallbacks; +import java.io.ObjectStreamException; + import org.apache.hyracks.api.application.INCServiceContext; +import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentId; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentIdGenerator; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentIdGeneratorFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; +import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentId; public abstract class AbstractLSMIndexIOOperationCallbackFactory implements ILSMIOOperationCallbackFactory { private static final long serialVersionUID = 1L; - protected final ILSMComponentIdGeneratorFactory idGeneratorFactory; + protected ILSMComponentIdGeneratorFactory idGeneratorFactory; protected transient INCServiceContext ncCtx; @@ -42,7 +46,30 @@ } protected ILSMComponentIdGenerator getComponentIdGenerator() { - assert ncCtx != null; return idGeneratorFactory.getComponentIdGenerator(ncCtx); } + + private void readObjectNoData() throws ObjectStreamException { + idGeneratorFactory = new ILSMComponentIdGeneratorFactory() { + private static final long serialVersionUID = 1L; + + @Override + public ILSMComponentIdGenerator getComponentIdGenerator(INCServiceContext serviceCtx) { + // used for backward compatibility + // if idGeneratorFactory is not set for legacy lsm indexes, we return a default + // component id generator which always generates the missing component id. + return new ILSMComponentIdGenerator() { + @Override + public void refresh() { + // No op + } + + @Override + public ILSMComponentId getId() { + return LSMComponentId.MISSING_COMPONENT_ID; + } + }; + } + }; + } } diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java index 0378aae..6a186dc 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java @@ -272,7 +272,8 @@ @Override public void resetId(ILSMComponentId componentId) throws HyracksDataException { - if (this.componentId != null && this.componentId.compareTo(componentId) != IdCompareResult.LESS_THAN) { + if (this.componentId != null && !componentId.missing() // for backward compatibility + && this.componentId.compareTo(componentId) != IdCompareResult.LESS_THAN) { throw new IllegalStateException( "LSM memory component receives illegal id. Old id " + this.componentId + ", new id " + componentId); } diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentIdGeneratorFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentIdGeneratorFactory.java index c55ef19..728c90a 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentIdGeneratorFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentIdGeneratorFactory.java @@ -29,6 +29,8 @@ */ public class LSMComponentIdGeneratorFactory implements ILSMComponentIdGeneratorFactory { + private static final long serialVersionUID = 1L; + @Override public ILSMComponentIdGenerator getComponentIdGenerator(INCServiceContext serviceCtx) { return new LSMComponentIdGenerator(); -- To view, visit https://asterix-gerrit.ics.uci.edu/2147 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie61103b640c37729d43023b92b1245b8e2f4a264 Gerrit-PatchSet: 9 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Luo Chen <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Luo Chen <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
