asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From luoc...@apache.org
Subject asterixdb git commit: [ASTERIXDB-2162][STO] Ensure backward compatibility of component id
Date Sat, 18 Nov 2017 06:29:56 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 7a1174022 -> 3c6dfc9da


[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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Ian Maxon <imaxon@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/3c6dfc9d
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/3c6dfc9d
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/3c6dfc9d

Branch: refs/heads/master
Commit: 3c6dfc9da137623c82323578e7f01fb085704568
Parents: 7a11740
Author: luochen01 <cluo8@uci.edu>
Authored: Thu Nov 16 17:35:56 2017 -0800
Committer: Luo Chen <cluo8@uci.edu>
Committed: Fri Nov 17 22:29:32 2017 -0800

----------------------------------------------------------------------
 ...tractLSMIndexIOOperationCallbackFactory.java | 31 ++++++++++++++++++--
 .../impls/AbstractLSMMemoryComponent.java       |  3 +-
 .../impls/LSMComponentIdGeneratorFactory.java   |  2 ++
 3 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/3c6dfc9d/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/ioopcallbacks/AbstractLSMIndexIOOperationCallbackFactory.java
----------------------------------------------------------------------
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 @@ public abstract class AbstractLSMIndexIOOperationCallbackFactory implements
ILSM
     }
 
     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;
+                    }
+                };
+            }
+        };
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/3c6dfc9d/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
----------------------------------------------------------------------
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 @@ public abstract class AbstractLSMMemoryComponent extends AbstractLSMComponent
im
 
     @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);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/3c6dfc9d/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentIdGeneratorFactory.java
----------------------------------------------------------------------
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 @@ import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentIdGeneratorFact
  */
 public class LSMComponentIdGeneratorFactory implements ILSMComponentIdGeneratorFactory {
 
+    private static final long serialVersionUID = 1L;
+
     @Override
     public ILSMComponentIdGenerator getComponentIdGenerator(INCServiceContext serviceCtx)
{
         return new LSMComponentIdGenerator();


Mime
View raw message