asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luo Chen (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: [ASTERIXDB-2162][STO] Ensure backward compatibility of compo...
Date Sun, 12 Nov 2017 21:58:04 GMT
Luo Chen has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2147

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
---
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, 27 insertions(+), 2 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/47/2147/1

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..ad83e32 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
@@ -20,9 +20,11 @@
 package org.apache.asterix.common.ioopcallbacks;
 
 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
{
 
@@ -43,6 +45,23 @@
 
     protected ILSMComponentIdGenerator getComponentIdGenerator() {
         assert ncCtx != null;
-        return idGeneratorFactory.getComponentIdGenerator(ncCtx);
+        if (idGeneratorFactory != null) {
+            return idGeneratorFactory.getComponentIdGenerator(ncCtx);
+        } else {
+            // 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() {
+
+                }
+
+                @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..1b990c8 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,11 @@
  */
 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: newchange
Gerrit-Change-Id: Ie61103b640c37729d43023b92b1245b8e2f4a264
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Luo Chen <cluo8@uci.edu>

Mime
View raw message