You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by sj...@apache.org on 2016/12/16 18:12:03 UTC
[17/23] asterixdb git commit: ASTERIXDB-1711: remove more mentions of
Asterix
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/AsterixThreadExecutor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/AsterixThreadExecutor.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/AsterixThreadExecutor.java
deleted file mode 100644
index befeb48..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/AsterixThreadExecutor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.api;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-
-public class AsterixThreadExecutor implements Executor {
- private final ExecutorService executorService;
-
- public AsterixThreadExecutor(ThreadFactory threadFactory) {
- executorService = Executors.newCachedThreadPool(threadFactory);
- }
-
- @Override
- public void execute(Runnable command) {
- executorService.execute(command);
- }
-
- public Future<? extends Object> submit(Callable<? extends Object> command) {
- return executorService.submit(command);
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAppRuntimeContext.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAppRuntimeContext.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAppRuntimeContext.java
new file mode 100644
index 0000000..7bc9421
--- /dev/null
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAppRuntimeContext.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.common.api;
+
+import java.io.IOException;
+import java.rmi.RemoteException;
+import java.util.concurrent.Executor;
+
+import org.apache.asterix.common.exceptions.ACIDException;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.library.ILibraryManager;
+import org.apache.asterix.common.replication.IRemoteRecoveryManager;
+import org.apache.asterix.common.replication.IReplicaResourcesManager;
+import org.apache.asterix.common.replication.IReplicationChannel;
+import org.apache.asterix.common.replication.IReplicationManager;
+import org.apache.asterix.common.transactions.ITransactionSubsystem;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.io.IIOManager;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker;
+import org.apache.hyracks.storage.common.buffercache.IBufferCache;
+import org.apache.hyracks.storage.common.file.IFileMapProvider;
+import org.apache.hyracks.storage.common.file.ILocalResourceRepository;
+import org.apache.hyracks.storage.common.file.IResourceIdFactory;
+
+public interface IAppRuntimeContext {
+
+ public IIOManager getIOManager();
+
+ public Executor getThreadExecutor();
+
+ public ITransactionSubsystem getTransactionSubsystem();
+
+ public boolean isShuttingdown();
+
+ public ILSMIOOperationScheduler getLSMIOScheduler();
+
+ public ILSMMergePolicyFactory getMetadataMergePolicyFactory();
+
+ public IBufferCache getBufferCache();
+
+ public IFileMapProvider getFileMapManager();
+
+ public ILocalResourceRepository getLocalResourceRepository();
+
+ public IDatasetLifecycleManager getDatasetLifecycleManager();
+
+ public IResourceIdFactory getResourceIdFactory();
+
+ public ILSMOperationTracker getLSMBTreeOperationTracker(int datasetID);
+
+ public void initialize(boolean initialRun) throws IOException, ACIDException, AsterixException;
+
+ public void setShuttingdown(boolean b);
+
+ public void deinitialize() throws HyracksDataException;
+
+ public double getBloomFilterFalsePositiveRate();
+
+ public Object getActiveManager();
+
+ public IRemoteRecoveryManager getRemoteRecoveryManager();
+
+ public IReplicaResourcesManager getReplicaResourcesManager();
+
+ public IReplicationManager getReplicationManager();
+
+ public IReplicationChannel getReplicationChannel();
+
+ public ILibraryManager getLibraryManager();
+
+ /**
+ * Exports the metadata node to the metadata RMI port.
+ *
+ * @throws RemoteException
+ */
+ public void exportMetadataNodeStub() throws RemoteException;
+
+ /**
+ * Initializes the metadata node and bootstraps the metadata.
+ *
+ * @param newUniverse
+ * @throws Exception
+ */
+ public void initializeMetadata(boolean newUniverse) throws Exception;
+
+ /**
+ * Unexports the metadata node from the RMI registry
+ *
+ * @throws RemoteException
+ */
+ public void unexportMetadataNodeStub() throws RemoteException;
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAsterixAppRuntimeContext.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAsterixAppRuntimeContext.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAsterixAppRuntimeContext.java
deleted file mode 100644
index c009152..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IAsterixAppRuntimeContext.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.api;
-
-import java.io.IOException;
-import java.rmi.RemoteException;
-import java.util.concurrent.Executor;
-
-import org.apache.asterix.common.exceptions.ACIDException;
-import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.common.library.ILibraryManager;
-import org.apache.asterix.common.replication.IRemoteRecoveryManager;
-import org.apache.asterix.common.replication.IReplicaResourcesManager;
-import org.apache.asterix.common.replication.IReplicationChannel;
-import org.apache.asterix.common.replication.IReplicationManager;
-import org.apache.asterix.common.transactions.ITransactionSubsystem;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.io.IIOManager;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker;
-import org.apache.hyracks.storage.common.buffercache.IBufferCache;
-import org.apache.hyracks.storage.common.file.IFileMapProvider;
-import org.apache.hyracks.storage.common.file.ILocalResourceRepository;
-import org.apache.hyracks.storage.common.file.IResourceIdFactory;
-
-public interface IAsterixAppRuntimeContext {
-
- public IIOManager getIOManager();
-
- public Executor getThreadExecutor();
-
- public ITransactionSubsystem getTransactionSubsystem();
-
- public boolean isShuttingdown();
-
- public ILSMIOOperationScheduler getLSMIOScheduler();
-
- public ILSMMergePolicyFactory getMetadataMergePolicyFactory();
-
- public IBufferCache getBufferCache();
-
- public IFileMapProvider getFileMapManager();
-
- public ILocalResourceRepository getLocalResourceRepository();
-
- public IDatasetLifecycleManager getDatasetLifecycleManager();
-
- public IResourceIdFactory getResourceIdFactory();
-
- public ILSMOperationTracker getLSMBTreeOperationTracker(int datasetID);
-
- public void initialize(boolean initialRun) throws IOException, ACIDException, AsterixException;
-
- public void setShuttingdown(boolean b);
-
- public void deinitialize() throws HyracksDataException;
-
- public double getBloomFilterFalsePositiveRate();
-
- public Object getActiveManager();
-
- public IRemoteRecoveryManager getRemoteRecoveryManager();
-
- public IReplicaResourcesManager getReplicaResourcesManager();
-
- public IReplicationManager getReplicationManager();
-
- public IReplicationChannel getReplicationChannel();
-
- public ILibraryManager getLibraryManager();
-
- /**
- * Exports the metadata node to the metadata RMI port.
- *
- * @throws RemoteException
- */
- public void exportMetadataNodeStub() throws RemoteException;
-
- /**
- * Initializes the metadata node and bootstraps the metadata.
- *
- * @param newUniverse
- * @throws Exception
- */
- public void initializeMetadata(boolean newUniverse) throws Exception;
-
- /**
- * Unexports the metadata node from the RMI registry
- *
- * @throws RemoteException
- */
- public void unexportMetadataNodeStub() throws RemoteException;
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ThreadExecutor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ThreadExecutor.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ThreadExecutor.java
new file mode 100644
index 0000000..4bc3d82
--- /dev/null
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ThreadExecutor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.common.api;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+
+public class ThreadExecutor implements Executor {
+ private final ExecutorService executorService;
+
+ public ThreadExecutor(ThreadFactory threadFactory) {
+ executorService = Executors.newCachedThreadPool(threadFactory);
+ }
+
+ @Override
+ public void execute(Runnable command) {
+ executorService.execute(command);
+ }
+
+ public Future<? extends Object> submit(Callable<? extends Object> command) {
+ return executorService.submit(command);
+ }
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractAsterixProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractAsterixProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractAsterixProperties.java
deleted file mode 100644
index a79fb89..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractAsterixProperties.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.UnaryOperator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public abstract class AbstractAsterixProperties {
- private static final Logger LOGGER = Logger.getLogger(AbstractAsterixProperties.class.getName());
- private static final List<AbstractAsterixProperties> IMPLS = Collections.synchronizedList(new ArrayList<>());
-
- protected final AsterixPropertiesAccessor accessor;
-
- public AbstractAsterixProperties(AsterixPropertiesAccessor accessor) {
- this.accessor = accessor;
- IMPLS.add(this);
- }
-
- public Map<String, Object> getProperties() {
- return getProperties(UnaryOperator.identity());
- }
-
- public Map<String, Object> getProperties(UnaryOperator<String> keyTransformer) {
- Map<String, Object> properties = new HashMap<>();
- for (Method m : getClass().getMethods()) {
- PropertyKey key = m.getAnnotation(PropertyKey.class);
- if (key != null) {
- try {
- properties.put(keyTransformer.apply(key.value()), m.invoke(this));
- } catch (Exception e) {
- LOGGER.log(Level.INFO, "Error accessing property: " + key.value(), e);
- }
- }
- }
- return properties;
- }
-
- @Retention(RetentionPolicy.RUNTIME)
- public @interface PropertyKey {
- String value();
- }
-
- public static List<AbstractAsterixProperties> getImplementations() {
- return Collections.unmodifiableList(IMPLS);
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
new file mode 100644
index 0000000..b6a960f
--- /dev/null
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.common.config;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.UnaryOperator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public abstract class AbstractProperties {
+ private static final Logger LOGGER = Logger.getLogger(AbstractProperties.class.getName());
+ private static final List<AbstractProperties> IMPLS = Collections.synchronizedList(new ArrayList<>());
+
+ protected final PropertiesAccessor accessor;
+
+ public AbstractProperties(PropertiesAccessor accessor) {
+ this.accessor = accessor;
+ IMPLS.add(this);
+ }
+
+ public Map<String, Object> getProperties() {
+ return getProperties(UnaryOperator.identity());
+ }
+
+ public Map<String, Object> getProperties(UnaryOperator<String> keyTransformer) {
+ Map<String, Object> properties = new HashMap<>();
+ for (Method m : getClass().getMethods()) {
+ PropertyKey key = m.getAnnotation(PropertyKey.class);
+ if (key != null) {
+ try {
+ properties.put(keyTransformer.apply(key.value()), m.invoke(this));
+ } catch (Exception e) {
+ LOGGER.log(Level.INFO, "Error accessing property: " + key.value(), e);
+ }
+ }
+ }
+ return properties;
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface PropertyKey {
+ String value();
+ }
+
+ public static List<AbstractProperties> getImplementations() {
+ return Collections.unmodifiableList(IMPLS);
+ }
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java
deleted file mode 100644
index 3ff4ac3..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.asterix.common.config;
-
-import java.util.Map;
-
-public class AsterixBuildProperties extends AbstractAsterixProperties {
-
- public AsterixBuildProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- public String getUserEmail() {
- return accessor.getProperty("git.build.user.email", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getBuildHost() {
- return accessor.getProperty("git.build.host", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getDirty() {
- return accessor.getProperty("git.dirty", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getRemoteOriginUrl() {
- return accessor.getProperty("git.remote.origin.url", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getClosestTagName() {
- return accessor.getProperty("git.closest.tag.name", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitIdDescribeShort() {
- return accessor.getProperty("git.commit.id.describe-short", "",
- PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitUserEmail() {
- return accessor.getProperty("git.commit.user.email", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitTime() {
- return accessor.getProperty("git.commit.time", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitMessage() {
- return accessor.getProperty("git.commit.message.full", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getBuildVersion() {
- return accessor.getProperty("git.build.version", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitMessageShort() {
- return accessor.getProperty("git.commit.message.short", "",
- PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getShortCommitId() {
- return accessor.getProperty("git.commit.id.abbrev", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getBranch() {
- return accessor.getProperty("git.branch", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getBuildUserName() {
- return accessor.getProperty("git.build.user.name", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getClosestTagCommitCount() {
- return accessor.getProperty("git.closest.tag.commit.count", "",
- PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitIdDescribe() {
- return accessor.getProperty("git.commit.id.describe", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitId() {
- return accessor.getProperty("git.commit.id", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getTags() {
- return accessor.getProperty("git.tags", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getBuildTime() {
- return accessor.getProperty("git.build.time", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCommitUserName() {
- return accessor.getProperty("git.commit.user.name", "", PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public Map<String, String> getAllProps() {
- return accessor.getBuildProperties();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixCompilerProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixCompilerProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixCompilerProperties.java
deleted file mode 100644
index af5124b..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixCompilerProperties.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import org.apache.hyracks.util.StorageUtil;
-
-import static org.apache.hyracks.util.StorageUtil.StorageUnit.KILOBYTE;
-import static org.apache.hyracks.util.StorageUtil.StorageUnit.MEGABYTE;
-
-public class AsterixCompilerProperties extends AbstractAsterixProperties {
- private static final String COMPILER_SORTMEMORY_KEY = "compiler.sortmemory";
- private static final long COMPILER_SORTMEMORY_DEFAULT = StorageUtil.getSizeInBytes(32, MEGABYTE);
-
- private static final String COMPILER_GROUPMEMORY_KEY = "compiler.groupmemory";
- private static final long COMPILER_GROUPMEMORY_DEFAULT = StorageUtil.getSizeInBytes(32, MEGABYTE);
-
- private static final String COMPILER_JOINMEMORY_KEY = "compiler.joinmemory";
- private static final long COMPILER_JOINMEMORY_DEFAULT = StorageUtil.getSizeInBytes(32, MEGABYTE);
-
- private static final String COMPILER_FRAMESIZE_KEY = "compiler.framesize";
- private static final int COMPILER_FRAMESIZE_DEFAULT = StorageUtil.getSizeInBytes(32, KILOBYTE);
-
- private static final String COMPILER_PREGELIX_HOME = "compiler.pregelix.home";
- private static final String COMPILER_PREGELIX_HOME_DEFAULT = "~/pregelix";
-
- public AsterixCompilerProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- @PropertyKey(COMPILER_SORTMEMORY_KEY)
- public long getSortMemorySize() {
- return accessor.getProperty(COMPILER_SORTMEMORY_KEY, COMPILER_SORTMEMORY_DEFAULT,
- PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-
- @PropertyKey(COMPILER_JOINMEMORY_KEY)
- public long getJoinMemorySize() {
- return accessor.getProperty(COMPILER_JOINMEMORY_KEY, COMPILER_JOINMEMORY_DEFAULT,
- PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-
- @PropertyKey(COMPILER_GROUPMEMORY_KEY)
- public long getGroupMemorySize() {
- return accessor.getProperty(COMPILER_GROUPMEMORY_KEY, COMPILER_GROUPMEMORY_DEFAULT,
- PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-
- @PropertyKey(COMPILER_FRAMESIZE_KEY)
- public int getFrameSize() {
- return accessor.getProperty(COMPILER_FRAMESIZE_KEY, COMPILER_FRAMESIZE_DEFAULT,
- PropertyInterpreters.getIntegerBytePropertyInterpreter());
- }
-
- @PropertyKey(COMPILER_PREGELIX_HOME)
- public String getPregelixHome() {
- return accessor.getProperty(COMPILER_PREGELIX_HOME, COMPILER_PREGELIX_HOME_DEFAULT,
- PropertyInterpreters.getStringPropertyInterpreter());
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtensionProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtensionProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtensionProperties.java
deleted file mode 100644
index e8f2bcc..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtensionProperties.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import java.util.List;
-
-public class AsterixExtensionProperties extends AbstractAsterixProperties {
-
- public AsterixExtensionProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- public List<AsterixExtension> getExtensions() {
- return accessor.getExtensions();
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java
deleted file mode 100644
index 15a1f39..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExternalProperties.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import java.util.logging.Level;
-
-public class AsterixExternalProperties extends AbstractAsterixProperties {
-
- private static final String EXTERNAL_WEBPORT_KEY = "web.port";
- private static final int EXTERNAL_WEBPORT_DEFAULT = 19001;
-
- private static final String EXTERNAL_SECONDARY_WEBPORT_KEY = "web.secondary.port";
- private static final int EXTERNAL_SECONDARY_WEBPORT_DEFAULT = 19005;
-
- private static final String QUERY_WEBPORT_KEY = "web.queryinterface.port";
- private static final int QUERY_WEBPORT_DEFAULT = 19006;
-
- private static final String EXTERNAL_LOGLEVEL_KEY = "log.level";
- private static final Level EXTERNAL_LOGLEVEL_DEFAULT = Level.WARNING;
-
- private static final String EXTERNAL_APISERVER_KEY = "api.port";
- private static final int EXTERNAL_APISERVER_DEFAULT = 19002;
-
- private static final String EXTERNAL_FEEDSERVER_KEY = "feed.port";
- private static final int EXTERNAL_FEEDSERVER_DEFAULT = 19003;
-
- private static final String EXTERNAL_CC_JAVA_OPTS_KEY = "cc.java.opts";
- private static final String EXTERNAL_CC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
-
- private static final String EXTERNAL_NC_JAVA_OPTS_KEY = "nc.java.opts";
- private static final String EXTERNAL_NC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
-
- private static final String EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER = "max.wait.active.cluster";
- private static final int EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER_DEFAULT = 60;
-
- private static final String EXTERNAL_PLOT_ACTIVATE = "plot.activate";
- private static final boolean EXTERNAL_PLOT_ACTIVATE_DEFAULT = false;
-
- public AsterixExternalProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- @PropertyKey(EXTERNAL_WEBPORT_KEY)
- public int getWebInterfacePort() {
- return accessor.getProperty(EXTERNAL_WEBPORT_KEY, EXTERNAL_WEBPORT_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(EXTERNAL_SECONDARY_WEBPORT_KEY)
- public int getSecondaryWebInterfacePort() {
- return accessor.getProperty(EXTERNAL_SECONDARY_WEBPORT_KEY, EXTERNAL_SECONDARY_WEBPORT_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(QUERY_WEBPORT_KEY)
- public int getQueryWebInterfacePort() {
- return accessor.getProperty(QUERY_WEBPORT_KEY, QUERY_WEBPORT_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(EXTERNAL_APISERVER_KEY)
- public int getAPIServerPort() {
- return accessor.getProperty(EXTERNAL_APISERVER_KEY, EXTERNAL_APISERVER_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(EXTERNAL_FEEDSERVER_KEY)
- public int getFeedServerPort() {
- return accessor.getProperty(EXTERNAL_FEEDSERVER_KEY, EXTERNAL_FEEDSERVER_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(EXTERNAL_LOGLEVEL_KEY)
- public Level getLogLevel() {
- return accessor.getProperty(EXTERNAL_LOGLEVEL_KEY, EXTERNAL_LOGLEVEL_DEFAULT,
- PropertyInterpreters.getLevelPropertyInterpreter());
- }
-
- public String getNCJavaParams() {
- return accessor.getProperty(EXTERNAL_NC_JAVA_OPTS_KEY, EXTERNAL_NC_JAVA_OPTS_DEFAULT,
- PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- public String getCCJavaParams() {
- return accessor.getProperty(EXTERNAL_CC_JAVA_OPTS_KEY, EXTERNAL_CC_JAVA_OPTS_DEFAULT,
- PropertyInterpreters.getStringPropertyInterpreter());
- }
-
- @PropertyKey(EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER)
- public int getMaxWaitClusterActive() {
- return accessor.getProperty(EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER, EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(EXTERNAL_PLOT_ACTIVATE)
- public Boolean getIsPlottingEnabled() {
- return accessor.getProperty(EXTERNAL_PLOT_ACTIVATE, EXTERNAL_PLOT_ACTIVATE_DEFAULT,
- PropertyInterpreters.getBooleanPropertyInterpreter());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixFeedProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixFeedProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixFeedProperties.java
deleted file mode 100644
index ff4d81e..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixFeedProperties.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import org.apache.hyracks.util.StorageUtil;
-
-import static org.apache.hyracks.util.StorageUtil.StorageUnit.MEGABYTE;
-
-public class AsterixFeedProperties extends AbstractAsterixProperties {
-
- private static final String FEED_CENTRAL_MANAGER_PORT_KEY = "feed.central.manager.port";
- private static final int FEED_CENTRAL_MANAGER_PORT_DEFAULT = 4500;
-
- private static final String FEED_MEMORY_GLOBALBUDGET_KEY = "feed.memory.global.budget";
- private static final long FEED_MEMORY_GLOBALBUDGET_DEFAULT = StorageUtil.getSizeInBytes(64, MEGABYTE);
- // i.e. 2048 frames (assuming 32768 as frame size)
-
- private static final String FEED_MEMORY_AVAILABLE_WAIT_TIMEOUT_KEY = "feed.memory.available.wait.timeout";
- private static final long FEED_MEMORY_AVAILABLE_WAIT_TIMEOUT_DEFAULT = 10; // 10 seconds
-
- private static final String FEED_PENDING_WORK_THRESHOLD_KEY = "feed.pending.work.threshold";
- private static final int FEED_PENDING_WORK_THRESHOLD_DEFAULT = 50;
-
- private static final String FEED_MAX_SUCCESSIVE_THRESHOLD_PERIOD_KEY = "feed.max.threshold.period";
- private static final int FEED_MAX_SUCCESSIVE_THRESHOLD_PERIOD_DEFAULT = 5;
-
- public AsterixFeedProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- @PropertyKey(FEED_MEMORY_GLOBALBUDGET_KEY)
- public long getMemoryComponentGlobalBudget() {
- return accessor.getProperty(FEED_MEMORY_GLOBALBUDGET_KEY, FEED_MEMORY_GLOBALBUDGET_DEFAULT,
- PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-
- @PropertyKey(FEED_MEMORY_AVAILABLE_WAIT_TIMEOUT_KEY)
- public long getMemoryAvailableWaitTimeout() {
- return accessor.getProperty(FEED_MEMORY_AVAILABLE_WAIT_TIMEOUT_KEY, FEED_MEMORY_AVAILABLE_WAIT_TIMEOUT_DEFAULT,
- PropertyInterpreters.getLongPropertyInterpreter());
- }
-
- /**
- * @return port at which the Central Feed Manager listens for control messages from local Feed Managers
- */
- @PropertyKey(FEED_CENTRAL_MANAGER_PORT_KEY)
- public int getFeedCentralManagerPort() {
- return accessor.getProperty(FEED_CENTRAL_MANAGER_PORT_KEY, FEED_CENTRAL_MANAGER_PORT_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- /**
- * @return maximum length of input queue before triggering corrective action
- */
- @PropertyKey(FEED_PENDING_WORK_THRESHOLD_KEY)
- public int getPendingWorkThreshold() {
- return accessor.getProperty(FEED_PENDING_WORK_THRESHOLD_KEY, FEED_PENDING_WORK_THRESHOLD_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(FEED_MAX_SUCCESSIVE_THRESHOLD_PERIOD_KEY)
- public int getMaxSuccessiveThresholdPeriod() {
- return accessor.getProperty(FEED_MAX_SUCCESSIVE_THRESHOLD_PERIOD_KEY,
- FEED_MAX_SUCCESSIVE_THRESHOLD_PERIOD_DEFAULT, PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java
deleted file mode 100644
index 3584f2b..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-
-import org.apache.asterix.common.cluster.ClusterPartition;
-
-public class AsterixMetadataProperties extends AbstractAsterixProperties {
-
- private static final String METADATA_REGISTRATION_TIMEOUT_KEY = "metadata.registration.timeout.secs";
- private static final long METADATA_REGISTRATION_TIMEOUT_DEFAULT = 60;
-
- private static final String METADATA_PORT_KEY = "metadata.port";
- private static final int METADATA_PORT_DEFAULT = 0;
-
- private static final String METADATA_CALLBACK_PORT_KEY = "metadata.callback.port";
- private static final int METADATA_CALLBACK_PORT_DEFAULT = 0;
-
- public AsterixMetadataProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- @PropertyKey("instance.name")
- public String getInstanceName() {
- return accessor.getInstanceName();
- }
-
- @PropertyKey("metadata.node")
- public String getMetadataNodeName() {
- return accessor.getMetadataNodeName();
- }
-
- @PropertyKey("metadata.partition")
- public ClusterPartition getMetadataPartition() {
- return accessor.getMetadataPartition();
- }
-
- @PropertyKey("node.stores")
- public Map<String, String[]> getStores() {
- return accessor.getStores();
- }
-
- public List<String> getNodeNames() {
- return accessor.getNodeNames();
- }
-
- public String getCoredumpPath(String nodeId) {
- return accessor.getCoredumpPath(nodeId);
- }
-
- @PropertyKey("core.dump.paths")
- public Map<String, String> getCoredumpPaths() {
- return accessor.getCoredumpConfig();
- }
-
- @PropertyKey("node.partitions")
- public Map<String, ClusterPartition[]> getNodePartitions() {
- return accessor.getNodePartitions();
- }
-
- @PropertyKey("cluster.partitions")
- public SortedMap<Integer, ClusterPartition> getClusterPartitions() {
- return accessor.getClusterPartitions();
- }
-
- @PropertyKey("transaction.log.dirs")
- public Map<String, String> getTransactionLogDirs() {
- return accessor.getTransactionLogDirs();
- }
-
- @PropertyKey(METADATA_REGISTRATION_TIMEOUT_KEY)
- public long getRegistrationTimeoutSecs() {
- return accessor.getProperty(METADATA_REGISTRATION_TIMEOUT_KEY, METADATA_REGISTRATION_TIMEOUT_DEFAULT,
- PropertyInterpreters.getLongPropertyInterpreter());
- }
-
- @PropertyKey(METADATA_PORT_KEY)
- public int getMetadataPort() {
- return accessor.getProperty(METADATA_PORT_KEY, METADATA_PORT_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(METADATA_CALLBACK_PORT_KEY)
- public int getMetadataCallbackPort() {
- return accessor.getProperty(METADATA_CALLBACK_PORT_KEY, METADATA_CALLBACK_PORT_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
deleted file mode 100644
index a12d802..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.asterix.common.cluster.ClusterPartition;
-import org.apache.asterix.common.configuration.AsterixConfiguration;
-import org.apache.asterix.common.configuration.Coredump;
-import org.apache.asterix.common.configuration.Extension;
-import org.apache.asterix.common.configuration.Property;
-import org.apache.asterix.common.configuration.Store;
-import org.apache.asterix.common.configuration.TransactionLogDir;
-import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.common.utils.ConfigUtil;
-import org.apache.commons.lang3.mutable.MutableInt;
-import org.apache.hyracks.algebricks.common.utils.Pair;
-import org.apache.hyracks.api.application.IApplicationConfig;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
-public class AsterixPropertiesAccessor {
- private static final Logger LOGGER = Logger.getLogger(AsterixPropertiesAccessor.class.getName());
-
- private static final AtomicReference<AsterixPropertiesAccessor> instanceHolder = new AtomicReference<>();
- private final String instanceName;
- private final String metadataNodeName;
- private final List<String> nodeNames = new ArrayList<>();;
- private final Map<String, String[]> stores = new HashMap<>();;
- private final Map<String, String> coredumpConfig = new HashMap<>();
-
- // This can be removed when asterix-configuration.xml is no longer required.
- private final Map<String, Property> asterixConfigurationParams;
- private final IApplicationConfig cfg;
- private final Map<String, String> transactionLogDirs = new HashMap<>();
- private final Map<String, String> asterixBuildProperties = new HashMap<>();
- private final Map<String, ClusterPartition[]> nodePartitionsMap;
- private final SortedMap<Integer, ClusterPartition> clusterPartitions = new TreeMap<>();
- // For extensions
- private final List<AsterixExtension> extensions;
-
- /**
- * Constructor which reads asterix-configuration.xml, the old way.
- *
- * @throws AsterixException
- * @throws IOException
- */
- private AsterixPropertiesAccessor() throws AsterixException, IOException {
- String fileName = System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY);
- if (fileName == null) {
- fileName = GlobalConfig.DEFAULT_CONFIG_FILE_NAME;
- }
- AsterixConfiguration asterixConfiguration = configure(fileName);
- cfg = null;
- instanceName = asterixConfiguration.getInstanceName();
- metadataNodeName = asterixConfiguration.getMetadataNode();
- List<Store> configuredStores = asterixConfiguration.getStore();
- nodePartitionsMap = new HashMap<>();
- int uniquePartitionId = 0;
- // Here we iterate through all <store> elements in asterix-configuration.xml.
- // For each one, we create an array of ClusterPartitions and store this array
- // in nodePartitionsMap, keyed by the node name. The array is the same length
- // as the comma-separated <storeDirs> child element, because Managix will have
- // arranged for that element to be populated with the full paths to each
- // partition directory (as formed by appending the <store> subdirectory to
- // each <iodevices> path from the user's original cluster.xml).
- for (Store store : configuredStores) {
- String trimmedStoreDirs = store.getStoreDirs().trim();
- String[] nodeStores = trimmedStoreDirs.split(",");
- ClusterPartition[] nodePartitions = new ClusterPartition[nodeStores.length];
- for (int i = 0; i < nodePartitions.length; i++) {
- ClusterPartition partition = new ClusterPartition(uniquePartitionId++, store.getNcId(), i);
- clusterPartitions.put(partition.getPartitionId(), partition);
- nodePartitions[i] = partition;
- }
- stores.put(store.getNcId(), nodeStores);
- nodePartitionsMap.put(store.getNcId(), nodePartitions);
- nodeNames.add(store.getNcId());
- }
-
- // Get extensions
- extensions = new ArrayList<>();
- if (asterixConfiguration.getExtensions() != null) {
- for (Extension ext : asterixConfiguration.getExtensions().getExtension()) {
- extensions.add(ConfigUtil.toAsterixExtension(ext));
- }
- }
-
- asterixConfigurationParams = new HashMap<>();
- for (Property p : asterixConfiguration.getProperty()) {
- asterixConfigurationParams.put(p.getName(), p);
- }
- for (Coredump cd : asterixConfiguration.getCoredump()) {
- coredumpConfig.put(cd.getNcId(), cd.getCoredumpPath());
- }
- for (TransactionLogDir txnLogDir : asterixConfiguration.getTransactionLogDir()) {
- transactionLogDirs.put(txnLogDir.getNcId(), txnLogDir.getTxnLogDirPath());
- }
- loadAsterixBuildProperties();
- }
-
- private AsterixConfiguration configure(String fileName) throws IOException, AsterixException {
- try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName)) {
- if (is != null) {
- return configure(is, fileName);
- }
- }
- try (FileInputStream is = new FileInputStream(fileName)) {
- return configure(is, fileName);
- } catch (FileNotFoundException fnf1) {
- LOGGER.warn("Failed to get configuration file " + fileName + " as FileInputStream. FileNotFoundException");
- LOGGER.warn("Attempting to get default configuration file " + GlobalConfig.DEFAULT_CONFIG_FILE_NAME
- + " as FileInputStream");
- try (FileInputStream fis = new FileInputStream(GlobalConfig.DEFAULT_CONFIG_FILE_NAME)) {
- return configure(fis, GlobalConfig.DEFAULT_CONFIG_FILE_NAME);
- } catch (FileNotFoundException fnf2) {
- fnf1.addSuppressed(fnf2);
- throw new AsterixException("Could not find configuration file " + fileName, fnf1);
- }
- }
- }
-
- private AsterixConfiguration configure(InputStream is, String fileName) throws AsterixException {
- try {
- JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
- Unmarshaller unmarshaller = ctx.createUnmarshaller();
- return (AsterixConfiguration) unmarshaller.unmarshal(is);
- } catch (JAXBException e) {
- throw new AsterixException("Failed to read configuration file " + fileName, e);
- }
- }
-
- /**
- * Constructor which wraps an IApplicationConfig.
- */
- private AsterixPropertiesAccessor(IApplicationConfig cfg) throws AsterixException {
- this.cfg = cfg;
- instanceName = cfg.getString(AsterixProperties.SECTION_ASTERIX, AsterixProperties.PROPERTY_INSTANCE_NAME,
- AsterixProperties.DEFAULT_INSTANCE_NAME);
- nodePartitionsMap = new HashMap<>();
- MutableInt uniquePartitionId = new MutableInt(0);
- extensions = new ArrayList<>();
- // Iterate through each configured NC.
- for (String section : cfg.getSections()) {
- if (section.startsWith(AsterixProperties.SECTION_PREFIX_NC)) {
- configureNc(section, uniquePartitionId);
- } else if (section.startsWith(AsterixProperties.SECTION_PREFIX_EXTENSION)) {
- String className = AsterixProperties.getSectionId(AsterixProperties.SECTION_PREFIX_EXTENSION, section);
- configureExtension(className, section);
- }
- }
- metadataNodeName = getProperty(AsterixProperties.PROPERTY_METADATA_NODE,
- nodeNames.isEmpty() ? "" : nodeNames.get(0), PropertyInterpreters.getStringPropertyInterpreter());
- asterixConfigurationParams = null;
- loadAsterixBuildProperties();
- }
-
- private void configureExtension(String className, String section) {
- Set<String> keys = cfg.getKeys(section);
- List<Pair<String, String>> kvs = new ArrayList<>();
- for (String key : keys) {
- String value = cfg.getString(section, key);
- kvs.add(new Pair<>(key, value));
- }
- extensions.add(new AsterixExtension(className, kvs));
- }
-
- private void configureNc(String section, MutableInt uniquePartitionId) {
- String ncId = AsterixProperties.getSectionId(AsterixProperties.SECTION_PREFIX_NC, section);
-
- // Now we assign the coredump and txnlog directories for this node.
- // QQQ Default values? Should they be specified here? Or should there
- // be a default.ini? Certainly wherever they are, they should be platform-dependent.
- coredumpConfig.put(ncId, cfg.getString(section, AsterixProperties.PROPERTY_COREDUMP_DIR,
- AsterixProperties.DEFAULT_COREDUMP_DIR));
- transactionLogDirs.put(ncId,
- cfg.getString(section, AsterixProperties.PROPERTY_TXN_LOG_DIR, AsterixProperties.DEFAULT_TXN_LOG_DIR));
-
- // Now we create an array of ClusterPartitions for all the partitions
- // on this NC.
- String[] iodevices = cfg.getString(section, AsterixProperties.PROPERTY_IO_DEV,
- AsterixProperties.DEFAULT_IO_DEV).split(",");
- String storageSubdir = cfg.getString(section, AsterixProperties.PROPERTY_STORAGE_DIR,
- AsterixProperties.DEFAULT_STORAGE_DIR);
- String[] nodeStores = new String[iodevices.length];
- ClusterPartition[] nodePartitions = new ClusterPartition[iodevices.length];
- for (int i = 0; i < nodePartitions.length; i++) {
- // Construct final storage path from iodevice dir + storage subdir.s
- nodeStores[i] = iodevices[i] + File.separator + storageSubdir;
- // Create ClusterPartition instances for this NC.
- ClusterPartition partition = new ClusterPartition(uniquePartitionId.getValue(), ncId, i);
- uniquePartitionId.increment();
- clusterPartitions.put(partition.getPartitionId(), partition);
- nodePartitions[i] = partition;
- }
- stores.put(ncId, nodeStores);
- nodePartitionsMap.put(ncId, nodePartitions);
- nodeNames.add(ncId);
- }
-
- private void loadAsterixBuildProperties() throws AsterixException {
- Properties gitProperties = new Properties();
- try {
- gitProperties.load(getClass().getClassLoader().getResourceAsStream("git.properties"));
- for (final String name : gitProperties.stringPropertyNames()) {
- asterixBuildProperties.put(name, gitProperties.getProperty(name));
- }
- } catch (IOException e) {
- throw new AsterixException(e);
- }
- }
-
- public String getMetadataNodeName() {
- return metadataNodeName;
- }
-
- public Map<String, String[]> getStores() {
- return stores;
- }
-
- public List<String> getNodeNames() {
- return nodeNames;
- }
-
- public String getCoredumpPath(String nodeId) {
- return coredumpConfig.get(nodeId);
- }
-
- public Map<String, String> getTransactionLogDirs() {
- return transactionLogDirs;
- }
-
- public Map<String, String> getCoredumpConfig() {
- return coredumpConfig;
- }
-
- public Map<String, String> getBuildProperties() {
- return asterixBuildProperties;
- }
-
- public <T> T getProperty(String property, T defaultValue, IPropertyInterpreter<T> interpreter) {
- String value;
- Property p = null;
- if (asterixConfigurationParams != null) {
- p = asterixConfigurationParams.get(property);
- value = (p == null) ? null : p.getValue();
- } else {
- value = cfg.getString("app", property);
- if (value == null) {
- value = cfg.getString("asterix", property);
- if (value != null) {
- LOGGER.warn("[asterix] config section deprecated and will be removed in a future release;" +
- " please update to [app] (found: " + property + ')');
- }
- }
- }
- if (value == null) {
- return defaultValue;
- }
- try {
- return interpreter.interpret(value);
- } catch (IllegalArgumentException e) {
- if (LOGGER.isEnabledFor(Level.ERROR)) {
- StringBuilder msg = new StringBuilder(
- "Invalid property value '" + value + "' for property '" + property + "'.\n");
- if (p != null) {
- msg.append("See the description: \n" + p.getDescription() + "\n");
- }
- msg.append("Default = " + defaultValue);
- LOGGER.error(msg.toString());
- }
- throw e;
- }
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public ClusterPartition getMetadataPartition() {
- // metadata partition is always the first partition on the metadata node
- return nodePartitionsMap.get(metadataNodeName)[0];
- }
-
- public Map<String, ClusterPartition[]> getNodePartitions() {
- return nodePartitionsMap;
- }
-
- public SortedMap<Integer, ClusterPartition> getClusterPartitions() {
- return clusterPartitions;
- }
-
- public List<AsterixExtension> getExtensions() {
- return extensions;
- }
-
- public static AsterixPropertiesAccessor getInstance(IApplicationConfig cfg) throws IOException, AsterixException {
- // Determine whether to use old-style asterix-configuration.xml or new-style configuration.
- // QQQ strip this out eventually
- // QQQ this is NOT a good way to determine whether the config is valid
- AsterixPropertiesAccessor propertiesAccessor;
- if (cfg != null && cfg.getString("cc", "cluster.address") != null) {
- propertiesAccessor = new AsterixPropertiesAccessor(cfg);
- } else {
- propertiesAccessor = new AsterixPropertiesAccessor();
- }
- if (!instanceHolder.compareAndSet(null, propertiesAccessor)) {
- propertiesAccessor = instanceHolder.get();
- }
- return propertiesAccessor;
- }
-
- public static AsterixPropertiesAccessor getInstance() throws IOException, AsterixException {
- return getInstance(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
deleted file mode 100644
index 0638091..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.asterix.common.replication.Replica;
-import org.apache.asterix.event.schema.cluster.Cluster;
-import org.apache.asterix.event.schema.cluster.Node;
-import org.apache.hyracks.util.StorageUtil;
-import org.apache.hyracks.util.StorageUtil.StorageUnit;
-
-public class AsterixReplicationProperties extends AbstractAsterixProperties {
-
- private static final Logger LOGGER = Logger.getLogger(AsterixReplicationProperties.class.getName());
-
-
- private static final int REPLICATION_DATAPORT_DEFAULT = 2000;
-
- private static final String REPLICATION_ENABLED_KEY = "replication.enabled";
-
- private static final String REPLICATION_FACTOR_KEY = "replication.factor";
- private static final int REPLICATION_FACTOR_DEFAULT = 1;
-
- private static final String REPLICATION_TIMEOUT_KEY = "replication.timeout";
- private static final int REPLICATION_TIME_OUT_DEFAULT = 15;
-
- private static final String REPLICATION_MAX_REMOTE_RECOVERY_ATTEMPTS_KEY =
- "replication.max.remote.recovery.attempts";
- private static final int MAX_REMOTE_RECOVERY_ATTEMPTS = 5;
-
- private static final String NODE_IP_ADDRESS_DEFAULT = "127.0.0.1";
-
- private static final String REPLICATION_LOG_BATCH_SIZE_KEY = "replication.log.batchsize";
- private static final int REPLICATION_LOG_BATCH_SIZE_DEFAULT = StorageUtil.getSizeInBytes(4, StorageUnit.KILOBYTE);
-
- private static final String REPLICATION_LOG_BUFFER_NUM_PAGES_KEY = "replication.log.buffer.numpages";
- private static final int REPLICATION_LOG_BUFFER_NUM_PAGES_DEFAULT = 8;
-
- private static final String REPLICATION_LOG_BUFFER_PAGE_SIZE_KEY = "replication.log.buffer.pagesize";
- private static final int REPLICATION_LOG_BUFFER_PAGE_SIZE_DEFAULT = StorageUtil.getSizeInBytes(128,
- StorageUnit.KILOBYTE);
-
- private final String nodeNamePrefix;
- private final Cluster cluster;
-
- public AsterixReplicationProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- this.cluster = ClusterProperties.INSTANCE.getCluster();
-
- if (cluster != null) {
- nodeNamePrefix = cluster.getInstanceName() + "_";
- } else {
- nodeNamePrefix = "";
- }
- }
-
- @PropertyKey(REPLICATION_ENABLED_KEY)
- public boolean isReplicationEnabled() {
- return ClusterProperties.INSTANCE.isReplicationEnabled();
- }
-
- public String getReplicaIPAddress(String nodeId) {
- if (cluster != null) {
- for (int i = 0; i < cluster.getNode().size(); i++) {
- Node node = cluster.getNode().get(i);
- if (getRealCluserNodeID(node.getId()).equals(nodeId)) {
- return node.getClusterIp();
- }
- }
- }
- return NODE_IP_ADDRESS_DEFAULT;
- }
-
- public int getDataReplicationPort(String nodeId) {
- if (cluster != null && cluster.getDataReplication() != null) {
- for (int i = 0; i < cluster.getNode().size(); i++) {
- Node node = cluster.getNode().get(i);
- if (getRealCluserNodeID(node.getId()).equals(nodeId)) {
- return node.getReplicationPort() != null ? node.getReplicationPort().intValue()
- : cluster.getDataReplication().getReplicationPort().intValue();
- }
- }
- }
- return REPLICATION_DATAPORT_DEFAULT;
- }
-
- public Set<Replica> getRemoteReplicas(String nodeId) {
- Set<Replica> remoteReplicas = new HashSet<>();;
-
- int numberOfRemoteReplicas = getReplicationFactor() - 1;
- //Using chained-declustering
- if (cluster != null) {
- int nodeIndex = -1;
- //find the node index in the cluster config
- for (int i = 0; i < cluster.getNode().size(); i++) {
- Node node = cluster.getNode().get(i);
- if (getRealCluserNodeID(node.getId()).equals(nodeId)) {
- nodeIndex = i;
- break;
- }
- }
-
- if (nodeIndex == -1) {
- LOGGER.log(Level.WARNING,
- "Could not find node " + getRealCluserNodeID(nodeId) + " in cluster configurations");
- return null;
- }
-
- //find nodes to the right of this node
- for (int i = nodeIndex + 1; i < cluster.getNode().size(); i++) {
- remoteReplicas.add(getReplicaByNodeIndex(i));
- if (remoteReplicas.size() == numberOfRemoteReplicas) {
- break;
- }
- }
-
- //if not all remote replicas have been found, start from the beginning
- if (remoteReplicas.size() != numberOfRemoteReplicas) {
- for (int i = 0; i < cluster.getNode().size(); i++) {
- remoteReplicas.add(getReplicaByNodeIndex(i));
- if (remoteReplicas.size() == numberOfRemoteReplicas) {
- break;
- }
- }
- }
- }
- return remoteReplicas;
- }
-
- private Replica getReplicaByNodeIndex(int nodeIndex) {
- Node node = cluster.getNode().get(nodeIndex);
- Node replicaNode = new Node();
- replicaNode.setId(getRealCluserNodeID(node.getId()));
- replicaNode.setClusterIp(node.getClusterIp());
- return new Replica(replicaNode);
- }
-
- public Replica getReplicaById(String nodeId) {
- int nodeIndex = -1;
- if (cluster != null) {
- for (int i = 0; i < cluster.getNode().size(); i++) {
- Node node = cluster.getNode().get(i);
-
- if (getRealCluserNodeID(node.getId()).equals(nodeId)) {
- nodeIndex = i;
- break;
- }
- }
- }
-
- if (nodeIndex < 0) {
- return null;
- }
-
- return getReplicaByNodeIndex(nodeIndex);
- }
-
- public Set<String> getRemoteReplicasIds(String nodeId) {
- Set<String> remoteReplicasIds = new HashSet<>();
- Set<Replica> remoteReplicas = getRemoteReplicas(nodeId);
-
- for (Replica replica : remoteReplicas) {
- remoteReplicasIds.add(replica.getId());
- }
-
- return remoteReplicasIds;
- }
-
- public String getRealCluserNodeID(String nodeId) {
- return nodeNamePrefix + nodeId;
- }
-
- public Set<String> getNodeReplicasIds(String nodeId) {
- Set<String> replicaIds = new HashSet<>();
- replicaIds.add(nodeId);
- replicaIds.addAll(getRemoteReplicasIds(nodeId));
- return replicaIds;
- }
-
- @PropertyKey(REPLICATION_FACTOR_KEY)
- public int getReplicationFactor() {
- if (cluster != null) {
- if (cluster.getDataReplication() == null || cluster.getDataReplication().getReplicationFactor() == null) {
- return REPLICATION_FACTOR_DEFAULT;
- }
- return cluster.getDataReplication().getReplicationFactor().intValue();
- }
- return REPLICATION_FACTOR_DEFAULT;
- }
-
- @PropertyKey(REPLICATION_TIMEOUT_KEY)
- public int getReplicationTimeOut() {
- if (cluster != null) {
- return cluster.getDataReplication().getReplicationTimeOut().intValue();
- }
- return REPLICATION_TIME_OUT_DEFAULT;
- }
-
- /**
- * @param nodeId
- * @return The set of nodes which replicate to this node, including the node itself
- */
- public Set<String> getNodeReplicationClients(String nodeId) {
- Set<String> clientReplicas = new HashSet<>();
- clientReplicas.add(nodeId);
-
- int clientsCount = getReplicationFactor();
-
- //Using chained-declustering backwards
- if (cluster != null) {
- int nodeIndex = -1;
- //find the node index in the cluster config
- for (int i = 0; i < cluster.getNode().size(); i++) {
- Node node = cluster.getNode().get(i);
- if (getRealCluserNodeID(node.getId()).equals(nodeId)) {
- nodeIndex = i;
- break;
- }
- }
-
- //find nodes to the left of this node
- for (int i = nodeIndex - 1; i >= 0; i--) {
- clientReplicas.add(getReplicaByNodeIndex(i).getId());
- if (clientReplicas.size() == clientsCount) {
- break;
- }
- }
-
- //if not all client replicas have been found, start from the end
- if (clientReplicas.size() != clientsCount) {
- for (int i = cluster.getNode().size() - 1; i >= 0; i--) {
- clientReplicas.add(getReplicaByNodeIndex(i).getId());
- if (clientReplicas.size() == clientsCount) {
- break;
- }
- }
- }
- }
- return clientReplicas;
- }
-
- @PropertyKey(REPLICATION_MAX_REMOTE_RECOVERY_ATTEMPTS_KEY)
- public int getMaxRemoteRecoveryAttempts() {
- return MAX_REMOTE_RECOVERY_ATTEMPTS;
- }
-
- @PropertyKey(REPLICATION_LOG_BUFFER_PAGE_SIZE_KEY)
- public int getLogBufferPageSize() {
- return accessor.getProperty(REPLICATION_LOG_BUFFER_PAGE_SIZE_KEY, REPLICATION_LOG_BUFFER_PAGE_SIZE_DEFAULT,
- PropertyInterpreters.getIntegerBytePropertyInterpreter());
- }
-
- @PropertyKey(REPLICATION_LOG_BUFFER_NUM_PAGES_KEY)
- public int getLogBufferNumOfPages() {
- return accessor.getProperty(REPLICATION_LOG_BUFFER_NUM_PAGES_KEY, REPLICATION_LOG_BUFFER_NUM_PAGES_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(REPLICATION_LOG_BATCH_SIZE_KEY)
- public int getLogBatchSize() {
- return accessor.getProperty(REPLICATION_LOG_BATCH_SIZE_KEY, REPLICATION_LOG_BATCH_SIZE_DEFAULT,
- PropertyInterpreters.getIntegerBytePropertyInterpreter());
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixStorageProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixStorageProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixStorageProperties.java
deleted file mode 100644
index daeb099..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixStorageProperties.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import org.apache.hyracks.storage.common.buffercache.IBufferCache;
-import org.apache.hyracks.util.StorageUtil;
-
-import static org.apache.hyracks.util.StorageUtil.StorageUnit.KILOBYTE;
-import static org.apache.hyracks.util.StorageUtil.StorageUnit.MEGABYTE;
-
-public class AsterixStorageProperties extends AbstractAsterixProperties {
-
- private static final String STORAGE_BUFFERCACHE_PAGESIZE_KEY = "storage.buffercache.pagesize";
- private static final int STORAGE_BUFFERCACHE_PAGESIZE_DEFAULT = StorageUtil.getSizeInBytes(128, KILOBYTE);
-
- private static final String STORAGE_BUFFERCACHE_SIZE_KEY = "storage.buffercache.size";
- private static final long STORAGE_BUFFERCACHE_SIZE_DEFAULT = StorageUtil.getSizeInBytes(512, MEGABYTE);
-
- private static final String STORAGE_BUFFERCACHE_MAXOPENFILES_KEY = "storage.buffercache.maxopenfiles";
- private static final int STORAGE_BUFFERCACHE_MAXOPENFILES_DEFAULT = Integer.MAX_VALUE;
-
- private static final String STORAGE_MEMORYCOMPONENT_PAGESIZE_KEY = "storage.memorycomponent.pagesize";
- private static final int STORAGE_MEMORYCOMPONENT_PAGESIZE_DEFAULT = StorageUtil.getSizeInBytes(128, KILOBYTE);
-
- private static final String STORAGE_MEMORYCOMPONENT_NUMPAGES_KEY = "storage.memorycomponent.numpages";
- private static final int STORAGE_MEMORYCOMPONENT_NUMPAGES_DEFAULT = 256; // ... so 32MB components
-
- private static final String STORAGE_METADATA_MEMORYCOMPONENT_NUMPAGES_KEY =
- "storage.metadata.memorycomponent.numpages";
- private static final int STORAGE_METADATA_MEMORYCOMPONENT_NUMPAGES_DEFAULT = 256; // ... so 32MB components
-
- private static final String STORAGE_MEMORYCOMPONENT_NUMCOMPONENTS_KEY = "storage.memorycomponent.numcomponents";
- private static final int STORAGE_MEMORYCOMPONENT_NUMCOMPONENTS_DEFAULT = 2; // 2 components
-
- private static final String STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_KEY = "storage.memorycomponent.globalbudget";
- private static final long STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_DEFAULT = StorageUtil.getSizeInBytes(512, MEGABYTE);
-
- private static final String STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_KEY =
- "storage.lsm.bloomfilter.falsepositiverate";
- private static final double STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_DEFAULT = 0.01;
-
- public AsterixStorageProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- @PropertyKey(STORAGE_BUFFERCACHE_PAGESIZE_KEY)
- public int getBufferCachePageSize() {
- return accessor.getProperty(STORAGE_BUFFERCACHE_PAGESIZE_KEY, STORAGE_BUFFERCACHE_PAGESIZE_DEFAULT,
- PropertyInterpreters.getIntegerBytePropertyInterpreter());
- }
-
- @PropertyKey(STORAGE_BUFFERCACHE_SIZE_KEY)
- public long getBufferCacheSize() {
- return accessor.getProperty(STORAGE_BUFFERCACHE_SIZE_KEY, STORAGE_BUFFERCACHE_SIZE_DEFAULT,
- PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-
- public int getBufferCacheNumPages() {
- return (int) (getBufferCacheSize() / (getBufferCachePageSize() + IBufferCache.RESERVED_HEADER_BYTES));
- }
-
- @PropertyKey(STORAGE_BUFFERCACHE_MAXOPENFILES_KEY)
- public int getBufferCacheMaxOpenFiles() {
- return accessor.getProperty(STORAGE_BUFFERCACHE_MAXOPENFILES_KEY, STORAGE_BUFFERCACHE_MAXOPENFILES_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(STORAGE_MEMORYCOMPONENT_PAGESIZE_KEY)
- public int getMemoryComponentPageSize() {
- return accessor.getProperty(STORAGE_MEMORYCOMPONENT_PAGESIZE_KEY, STORAGE_MEMORYCOMPONENT_PAGESIZE_DEFAULT,
- PropertyInterpreters.getIntegerBytePropertyInterpreter());
- }
-
- @PropertyKey(STORAGE_MEMORYCOMPONENT_NUMPAGES_KEY)
- public int getMemoryComponentNumPages() {
- return accessor.getProperty(STORAGE_MEMORYCOMPONENT_NUMPAGES_KEY, STORAGE_MEMORYCOMPONENT_NUMPAGES_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(STORAGE_METADATA_MEMORYCOMPONENT_NUMPAGES_KEY)
- public int getMetadataMemoryComponentNumPages() {
- return accessor.getProperty(STORAGE_METADATA_MEMORYCOMPONENT_NUMPAGES_KEY,
- STORAGE_METADATA_MEMORYCOMPONENT_NUMPAGES_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(STORAGE_MEMORYCOMPONENT_NUMCOMPONENTS_KEY)
- public int getMemoryComponentsNum() {
- return accessor.getProperty(STORAGE_MEMORYCOMPONENT_NUMCOMPONENTS_KEY,
- STORAGE_MEMORYCOMPONENT_NUMCOMPONENTS_DEFAULT, PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_KEY)
- public long getMemoryComponentGlobalBudget() {
- return accessor.getProperty(STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_KEY,
- STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_DEFAULT, PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-
- @PropertyKey(STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_KEY)
- public double getBloomFilterFalsePositiveRate() {
- return accessor.getProperty(STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_KEY,
- STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_DEFAULT, PropertyInterpreters.getDoublePropertyInterpreter());
- }
-}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f76d9c37/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixTransactionProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixTransactionProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixTransactionProperties.java
deleted file mode 100644
index 0480887..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixTransactionProperties.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.common.config;
-
-import static org.apache.hyracks.util.StorageUtil.StorageUnit.KILOBYTE;
-import static org.apache.hyracks.util.StorageUtil.StorageUnit.MEGABYTE;
-
-import java.util.Map;
-
-import org.apache.hyracks.util.StorageUtil;
-
-public class AsterixTransactionProperties extends AbstractAsterixProperties {
-
- private static final String TXN_LOG_BUFFER_NUMPAGES_KEY = "txn.log.buffer.numpages";
- private static final int TXN_LOG_BUFFER_NUMPAGES_DEFAULT = 8;
-
- private static final String TXN_LOG_BUFFER_PAGESIZE_KEY = "txn.log.buffer.pagesize";
- private static final int TXN_LOG_BUFFER_PAGESIZE_DEFAULT = StorageUtil.getSizeInBytes(128, KILOBYTE);
-
- public static final String TXN_LOG_PARTITIONSIZE_KEY = "txn.log.partitionsize";
- private static final long TXN_LOG_PARTITIONSIZE_DEFAULT = StorageUtil.getSizeInBytes(256L, MEGABYTE);
-
- private static final String TXN_LOG_CHECKPOINT_LSNTHRESHOLD_KEY = "txn.log.checkpoint.lsnthreshold";
- private static final int TXN_LOG_CHECKPOINT_LSNTHRESHOLD_DEFAULT = StorageUtil.getSizeInBytes(64, MEGABYTE);
-
- public static final String TXN_LOG_CHECKPOINT_POLLFREQUENCY_KEY = "txn.log.checkpoint.pollfrequency";
- private static final int TXN_LOG_CHECKPOINT_POLLFREQUENCY_DEFAULT = 120; // 120s
-
- private static final String TXN_LOG_CHECKPOINT_HISTORY_KEY = "txn.log.checkpoint.history";
- private static final int TXN_LOG_CHECKPOINT_HISTORY_DEFAULT = 0;
-
- private static final String TXN_LOCK_ESCALATIONTHRESHOLD_KEY = "txn.lock.escalationthreshold";
- private static final int TXN_LOCK_ESCALATIONTHRESHOLD_DEFAULT = 1000;
-
- private static final String TXN_LOCK_SHRINKTIMER_KEY = "txn.lock.shrinktimer";
- private static final int TXN_LOCK_SHRINKTIMER_DEFAULT = 5000; // 5s
-
- private static final String TXN_LOCK_TIMEOUT_WAITTHRESHOLD_KEY = "txn.lock.timeout.waitthreshold";
- private static final int TXN_LOCK_TIMEOUT_WAITTHRESHOLD_DEFAULT = 60000; // 60s
-
- private static final String TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_KEY = "txn.lock.timeout.sweepthreshold";
- private static final int TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_DEFAULT = 10000; // 10s
-
- private static final String TXN_COMMIT_PROFILER_REPORT_INTERVAL_KEY = "txn.commitprofiler.reportinterval";
- private static final int TXN_COMMIT_PROFILER_REPORT_INTERVAL_DEFAULT = 5; // 5 seconds
-
- private static final String TXN_JOB_RECOVERY_MEMORY_SIZE_KEY = "txn.job.recovery.memorysize";
- private static final long TXN_JOB_RECOVERY_MEMORY_SIZE_DEFAULT = StorageUtil.getSizeInBytes(64L, MEGABYTE);
-
- public AsterixTransactionProperties(AsterixPropertiesAccessor accessor) {
- super(accessor);
- }
-
- public String getLogDirectory(String nodeId) {
- return accessor.getTransactionLogDirs().get(nodeId);
- }
-
- public Map<String, String> getLogDirectories() {
- return accessor.getTransactionLogDirs();
- }
-
- @PropertyKey(TXN_LOG_BUFFER_NUMPAGES_KEY)
- public int getLogBufferNumPages() {
- return accessor.getProperty(TXN_LOG_BUFFER_NUMPAGES_KEY, TXN_LOG_BUFFER_NUMPAGES_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOG_BUFFER_PAGESIZE_KEY)
- public int getLogBufferPageSize() {
- return accessor.getProperty(TXN_LOG_BUFFER_PAGESIZE_KEY, TXN_LOG_BUFFER_PAGESIZE_DEFAULT,
- PropertyInterpreters.getIntegerBytePropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOG_PARTITIONSIZE_KEY)
- public long getLogPartitionSize() {
- return accessor.getProperty(TXN_LOG_PARTITIONSIZE_KEY, TXN_LOG_PARTITIONSIZE_DEFAULT,
- PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOG_CHECKPOINT_LSNTHRESHOLD_KEY)
- public int getCheckpointLSNThreshold() {
- return accessor.getProperty(TXN_LOG_CHECKPOINT_LSNTHRESHOLD_KEY, TXN_LOG_CHECKPOINT_LSNTHRESHOLD_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOG_CHECKPOINT_POLLFREQUENCY_KEY)
- public int getCheckpointPollFrequency() {
- return accessor.getProperty(TXN_LOG_CHECKPOINT_POLLFREQUENCY_KEY, TXN_LOG_CHECKPOINT_POLLFREQUENCY_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOG_CHECKPOINT_HISTORY_KEY)
- public int getCheckpointHistory() {
- return accessor.getProperty(TXN_LOG_CHECKPOINT_HISTORY_KEY, TXN_LOG_CHECKPOINT_HISTORY_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOCK_ESCALATIONTHRESHOLD_KEY)
- public int getEntityToDatasetLockEscalationThreshold() {
- return accessor.getProperty(TXN_LOCK_ESCALATIONTHRESHOLD_KEY, TXN_LOCK_ESCALATIONTHRESHOLD_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOCK_SHRINKTIMER_KEY)
- public int getLockManagerShrinkTimer() {
- return accessor.getProperty(TXN_LOCK_SHRINKTIMER_KEY, TXN_LOCK_SHRINKTIMER_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOCK_TIMEOUT_WAITTHRESHOLD_KEY)
- public int getTimeoutWaitThreshold() {
- return accessor.getProperty(TXN_LOCK_TIMEOUT_WAITTHRESHOLD_KEY, TXN_LOCK_TIMEOUT_WAITTHRESHOLD_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_KEY)
- public int getTimeoutSweepThreshold() {
- return accessor.getProperty(TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_KEY, TXN_LOCK_TIMEOUT_SWEEPTHRESHOLD_DEFAULT,
- PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_COMMIT_PROFILER_REPORT_INTERVAL_KEY)
- public int getCommitProfilerReportInterval() {
- return accessor.getProperty(TXN_COMMIT_PROFILER_REPORT_INTERVAL_KEY,
- TXN_COMMIT_PROFILER_REPORT_INTERVAL_DEFAULT, PropertyInterpreters.getIntegerPropertyInterpreter());
- }
-
- @PropertyKey(TXN_JOB_RECOVERY_MEMORY_SIZE_KEY)
- public long getJobRecoveryMemorySize() {
- return accessor.getProperty(TXN_JOB_RECOVERY_MEMORY_SIZE_KEY, TXN_JOB_RECOVERY_MEMORY_SIZE_DEFAULT,
- PropertyInterpreters.getLongBytePropertyInterpreter());
- }
-}