Pass resource partition id to IModificationOperationCallback
- Pass resource partition id to IModificationOperationCallback
to include it in txn logs.
- New cluster event NODE_SHUTTING_DOWN for graceful shutdown.
- Remove unnecessary replication STOP operation.
Change-Id: Iddd566ea97512c1dbd2217befdc2bb8822e77763
Reviewed-on: https://asterix-gerrit.ics.uci.edu/589
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
diff --git a/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IClusterLifecycleListener.java b/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IClusterLifecycleListener.java
index 6af2a9b..733382b 100644
--- a/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IClusterLifecycleListener.java
+++ b/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IClusterLifecycleListener.java
@@ -26,6 +26,12 @@
*/
public interface IClusterLifecycleListener {
+ public enum ClusterEventType {
+ NODE_JOIN,
+ NODE_FAILURE,
+ NODE_SHUTTING_DOWN //node shutting down gracefully
+ }
+
/**
* @param nodeId
* A unique identifier of a Node Controller
diff --git a/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/replication/IReplicationJob.java b/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/replication/IReplicationJob.java
index 1948f4bf..cbe6d1a 100644
--- a/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/replication/IReplicationJob.java
+++ b/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/replication/IReplicationJob.java
@@ -29,8 +29,7 @@
public enum ReplicationOperation {
REPLICATE,
- DELETE,
- STOP
+ DELETE
}
public enum ReplicationExecutionType {
diff --git a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IIndexDataflowHelper.java b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IIndexDataflowHelper.java
index 4357770..b39e532 100644
--- a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IIndexDataflowHelper.java
+++ b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IIndexDataflowHelper.java
@@ -46,4 +46,9 @@
public IHyracksTaskContext getTaskContext();
public String getResourcePath();
+
+ /**
+ * @return The resource unique storage partition id
+ */
+ public int getResourcePartition();
}
diff --git a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IModificationOperationCallbackFactory.java b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IModificationOperationCallbackFactory.java
index 120d880..8d618c8 100644
--- a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IModificationOperationCallbackFactory.java
+++ b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/api/IModificationOperationCallbackFactory.java
@@ -25,5 +25,5 @@
public interface IModificationOperationCallbackFactory extends Serializable {
public IModificationOperationCallback createModificationOperationCallback(String resourcePath, long resourceId,
- Object resource, IHyracksTaskContext ctx) throws HyracksDataException;
+ int resourcePartition, Object resource, IHyracksTaskContext ctx) throws HyracksDataException;
}
diff --git a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
index bb4f8a1..3f3d114 100644
--- a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
+++ b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
@@ -45,6 +45,7 @@
protected final boolean durable;
protected IIndex index;
protected final String resourcePath;
+ protected final int resourcePartition;
public IndexDataflowHelper(IIndexOperatorDescriptor opDesc, final IHyracksTaskContext ctx, int partition,
boolean durable) {
@@ -57,6 +58,7 @@
this.file = IndexFileNameUtil.getIndexAbsoluteFileRef(opDesc, partition, ctx.getIOManager());
this.resourcePath = file.getFile().getPath();
this.durable = durable;
+ this.resourcePartition = opDesc.getFileSplitProvider().getFileSplits()[partition].getPartition();
}
protected abstract IIndex createIndexInstance() throws HyracksDataException;
@@ -88,7 +90,6 @@
resourceID = resourceIdFactory.createId();
ILocalResourceFactory localResourceFactory = opDesc.getLocalResourceFactoryProvider()
.getLocalResourceFactory();
- int resourcePartition = opDesc.getFileSplitProvider().getFileSplits()[partition].getPartition();
String resourceName = opDesc.getFileSplitProvider().getFileSplits()[partition].getLocalFile().getFile()
.getPath();
localResourceRepository.insert(localResourceFactory.createLocalResource(resourceID, resourceName,
@@ -160,4 +161,9 @@
public String getResourcePath() {
return resourcePath;
}
-}
+
+ @Override
+ public int getResourcePartition() {
+ return resourcePartition;
+ }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexInsertUpdateDeleteOperatorNodePushable.java b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexInsertUpdateDeleteOperatorNodePushable.java
index 6736420..cf44305 100644
--- a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexInsertUpdateDeleteOperatorNodePushable.java
+++ b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexInsertUpdateDeleteOperatorNodePushable.java
@@ -77,7 +77,8 @@
try {
writer.open();
modCallback = opDesc.getModificationOpCallbackFactory().createModificationOperationCallback(
- indexHelper.getResourcePath(), indexHelper.getResourceID(), index, ctx);
+ indexHelper.getResourcePath(), indexHelper.getResourceID(), indexHelper.getResourcePartition(),
+ index, ctx);
indexAccessor = index.createAccessor(modCallback, NoOpOperationCallback.INSTANCE);
ITupleFilterFactory tupleFilterFactory = opDesc.getTupleFilterFactory();
if (tupleFilterFactory != null) {
diff --git a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
index 17f9265..b42e619 100644
--- a/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
+++ b/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
@@ -29,9 +29,9 @@
* Dummy NoOp callback factory used primarily for testing. Always returns the {@link NoOpOperationCallback} instance.
* Implemented as an enum to preserve singleton model while being serializable
*/
-public enum NoOpOperationCallbackFactory implements ISearchOperationCallbackFactory,
- IModificationOperationCallbackFactory {
- INSTANCE;
+public enum NoOpOperationCallbackFactory
+ implements ISearchOperationCallbackFactory,IModificationOperationCallbackFactory {
+ INSTANCE;
@Override
public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx) {
@@ -40,7 +40,7 @@
@Override
public IModificationOperationCallback createModificationOperationCallback(String resourcePath, long resourceId,
- Object resource, IHyracksTaskContext ctx) throws HyracksDataException {
+ int resourcePartition, Object resource, IHyracksTaskContext ctx) throws HyracksDataException {
return NoOpOperationCallback.INSTANCE;
}
}