Merge commit '963a544' from 'stabilization-f69489' to 'master'
Change-Id: Iedb57cd217d3115b94d13761d8779e81293003da
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
index 2b21ec1..b7ef0dc 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
@@ -197,7 +197,7 @@
}
@Override
- protected void configureLoggingLevel(Level level) {
+ public void configureLoggingLevel(Level level) {
super.configureLoggingLevel(level);
LoggingConfigUtil.defaultIfMissing(GlobalConfig.ASTERIX_LOGGER_NAME, level);
}
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
index 997090e..4213509 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
@@ -163,7 +163,7 @@
}
@Override
- protected void configureLoggingLevel(Level level) {
+ public void configureLoggingLevel(Level level) {
super.configureLoggingLevel(level);
LoggingConfigUtil.defaultIfMissing(GlobalConfig.ASTERIX_LOGGER_NAME, level);
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
index b8e1b43..a9c4d15 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
@@ -399,7 +400,7 @@
}
final char lowSurrogate = UTF8StringUtil.charAt(src, lowSurrogatePos);
final int lowSurrogateSize = UTF8StringUtil.charSize(src, lowSurrogatePos);
- os.write(new String(new char[] { highSurrogate, lowSurrogate }).getBytes());
+ os.write(new String(new char[] { highSurrogate, lowSurrogate }).getBytes(StandardCharsets.UTF_8));
return highSurrogateSize + lowSurrogateSize;
}
diff --git a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
index f721ae5..2a92c5d 100644
--- a/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
+++ b/asterixdb/asterix-server/src/test/resources/NCServiceExecutionIT/cc.conf
@@ -21,6 +21,7 @@
iodevices=../asterix-server/target/tmp/asterix_nc1/iodevice1,../asterix-server/target/tmp/asterix_nc1/iodevice2
nc.api.port=19004
#jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006
+jvm.args=-Dfile.encoding=iso-8859-1
[nc/asterix_nc2]
ncservice.port=9091
@@ -29,6 +30,7 @@
iodevices=../asterix-server/target/tmp/asterix_nc2/iodevice1,../asterix-server/target/tmp/asterix_nc2/iodevice2
nc.api.port=19005
#jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5007
+jvm.args=-Dfile.encoding=us-ascii
[nc]
address=127.0.0.1
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IApplication.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IApplication.java
index 1d22f85..bbc7163 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IApplication.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/IApplication.java
@@ -19,10 +19,12 @@
package org.apache.hyracks.api.application;
import org.apache.hyracks.api.config.IConfigManager;
+import org.apache.logging.log4j.Level;
import org.kohsuke.args4j.OptionHandlerFilter;
@SuppressWarnings("squid:S00112") // define and throw specific class of Exception
public interface IApplication {
+
void init(IServiceContext serviceCtx) throws Exception;
void start(String[] args) throws Exception;
@@ -38,4 +40,11 @@
default OptionHandlerFilter getUsageFilter() {
return OptionHandlerFilter.PUBLIC;
}
+
+ /**
+ * Configures the application loggers with the given level.
+ *
+ * @param level the logging level desired.
+ */
+ void configureLoggingLevel(Level level);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
index 46adda3..fbce29d 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
@@ -83,7 +83,8 @@
return null;
}
- protected void configureLoggingLevel(Level level) {
+ @Override
+ public void configureLoggingLevel(Level level) {
LoggingConfigUtil.defaultIfMissing(HyracksConstants.HYRACKS_LOGGER_NAME, level);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
index db7b533..882c396 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
@@ -101,7 +101,8 @@
return new DefaultDeviceResolver();
}
- protected void configureLoggingLevel(Level level) {
+ @Override
+ public void configureLoggingLevel(Level level) {
LoggingConfigUtil.defaultIfMissing(HyracksConstants.HYRACKS_LOGGER_NAME, level);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/pom.xml b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/pom.xml
index 294a79e..a9221a6 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/pom.xml
@@ -58,6 +58,10 @@
<artifactId>hyracks-storage-common</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java
index 5259856..7ba2050 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java
+++ b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java
@@ -25,6 +25,7 @@
import org.apache.hyracks.api.control.CcId;
import org.apache.hyracks.api.io.IFileDeviceResolver;
import org.apache.hyracks.api.job.resource.NodeCapacity;
+import org.apache.logging.log4j.Level;
public class TestNCApplication implements INCApplication {
@@ -82,6 +83,11 @@
}
@Override
+ public void configureLoggingLevel(Level level) {
+ // No-op
+ }
+
+ @Override
public IConfigManager getConfigManager() {
return configManager;
}
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
index 64881dc..58aa39e 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
@@ -143,6 +143,17 @@
ipcHandleMap.put(handle.getRemoteAddress(), handle);
}
+ synchronized void unregisterHandle(IPCHandle handle) {
+ final InetSocketAddress remoteAddress = handle.getRemoteAddress();
+ if (remoteAddress != null) {
+ final IPCHandle ipcHandle = ipcHandleMap.get(remoteAddress);
+ // remove only if in closed state to avoid removing a new handle that was created for the same destination
+ if (ipcHandle != null && ipcHandle.getState() == HandleState.CLOSED) {
+ ipcHandleMap.remove(remoteAddress);
+ }
+ }
+ }
+
synchronized void write(Message msg) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Enqueued message: " + msg);
@@ -434,7 +445,9 @@
if (key != null) {
final Object attachment = key.attachment();
if (attachment != null) {
- ((IPCHandle) attachment).close();
+ final IPCHandle handle = (IPCHandle) attachment;
+ handle.close();
+ unregisterHandle(handle);
}
key.cancel();
}
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
index 5d92960..25abfe1 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
@@ -169,7 +169,6 @@
final boolean error = message.getFlag() == Message.ERROR;
if (!error && state == HandleState.CONNECT_RECEIVED) {
remoteAddress = (InetSocketAddress) message.getPayload();
- system.getConnectionManager().registerHandle(this);
setState(HandleState.CONNECTED);
system.getConnectionManager().ack(this, message);
} else if (!error && state == HandleState.CONNECT_SENT) {
diff --git a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
index 2ac6f2b..a79d033 100644
--- a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
+++ b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/test/server/process/HyracksCCProcess.java
@@ -49,5 +49,6 @@
args.add("-Xmx1024m");
cList.addAll(args);
// cList.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005");
+ cList.add("-Dfile.encoding=us-ascii");
}
}