You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2016/12/23 01:47:00 UTC
[31/50] [abbrv] incubator-atlas git commit: ATLAS-1160 Update Atlas
hive hook to read configuration from atlas-application.properties instead of
hive-site.xml (mneethiraj via kevalbhatt)
ATLAS-1160 Update Atlas hive hook to read configuration from atlas-application.properties instead of hive-site.xml (mneethiraj via kevalbhatt)
(cherry picked from commit 0596c9fc3edcd4fbf9dae5a0bedf31e99cabc930)
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/1eb5abf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/1eb5abf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/1eb5abf2
Branch: refs/heads/0.7-incubating
Commit: 1eb5abf214b4118462bc2a1358c62912a48f9847
Parents: 120e4b9
Author: kevalbhatt <kb...@apache.org>
Authored: Fri Sep 9 22:15:05 2016 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Thu Dec 22 15:28:10 2016 -0800
----------------------------------------------------------------------
.../org/apache/atlas/hive/hook/HiveHook.java | 51 +++++++++++---------
release-log.txt | 1 +
2 files changed, 28 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1eb5abf2/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
index 14359c5..fdd0199 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
@@ -97,7 +97,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
// wait time determines how long we wait before we exit the jvm on
// shutdown. Pending requests after that will not be sent.
private static final int WAIT_TIME = 3;
- private static ExecutorService executor;
+ private static ExecutorService executor = null;
private static final int minThreadsDefault = 1;
private static final int maxThreadsDefault = 5;
@@ -110,28 +110,32 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
try {
// initialize the async facility to process hook calls. We don't
// want to do this inline since it adds plenty of overhead for the query.
- int minThreads = atlasProperties.getInt(MIN_THREADS, minThreadsDefault);
- int maxThreads = atlasProperties.getInt(MAX_THREADS, maxThreadsDefault);
- long keepAliveTime = atlasProperties.getLong(KEEP_ALIVE_TIME, keepAliveTimeDefault);
- int queueSize = atlasProperties.getInt(QUEUE_SIZE, queueSizeDefault);
-
- executor = new ThreadPoolExecutor(minThreads, maxThreads, keepAliveTime, TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue<Runnable>(queueSize),
- new ThreadFactoryBuilder().setNameFormat("Atlas Logger %d").build());
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- try {
- executor.shutdown();
- executor.awaitTermination(WAIT_TIME, TimeUnit.SECONDS);
- executor = null;
- } catch (InterruptedException ie) {
- LOG.info("Interrupt received in shutdown.");
+ boolean isSync = atlasProperties.getBoolean(CONF_SYNC, Boolean.FALSE);
+
+ if(!isSync) {
+ int minThreads = atlasProperties.getInt(MIN_THREADS, minThreadsDefault);
+ int maxThreads = atlasProperties.getInt(MAX_THREADS, maxThreadsDefault);
+ long keepAliveTime = atlasProperties.getLong(KEEP_ALIVE_TIME, keepAliveTimeDefault);
+ int queueSize = atlasProperties.getInt(QUEUE_SIZE, queueSizeDefault);
+
+ executor = new ThreadPoolExecutor(minThreads, maxThreads, keepAliveTime, TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue<Runnable>(queueSize),
+ new ThreadFactoryBuilder().setNameFormat("Atlas Logger %d").build());
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ try {
+ executor.shutdown();
+ executor.awaitTermination(WAIT_TIME, TimeUnit.SECONDS);
+ executor = null;
+ } catch (InterruptedException ie) {
+ LOG.info("Interrupt received in shutdown.");
+ }
+ // shutdown client
}
- // shutdown client
- }
- });
+ });
+ }
setupOperationMap();
} catch (Exception e) {
@@ -174,8 +178,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
event.setQueryStartTime(hookContext.getQueryPlan().getQueryStartTime());
event.setQueryType(hookContext.getQueryPlan().getQueryPlan().getQueryType());
- boolean sync = conf.get(CONF_SYNC, "false").equals("true");
- if (sync) {
+ if (executor == null) {
fireAndForget(event);
} else {
executor.submit(new Runnable() {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1eb5abf2/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index ea4ce9b..61a15ad 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -31,6 +31,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES:
+ATLAS-1160 Update Atlas hive hook to read configuration from atlas-application.properties instead of hive-site.xml (mneethiraj via kevalbhatt)
ATLAS-1154 Errors in Eclipse with web.xml (davidrad via dkantor)
ATLAS-1147 UI: column name doesn't show up in schema tab for hive table (Kalyanikashikar via kevalbhatt)
ATLAS-772 Ordering of columns is not maintained in schema query response, where as hive table entity response maintains the ordering (sarath.kum4r@gmail.com via kevalbhatt)