瀏覽代碼

AMBARI-20222. Hive View 2.0 LogAggregator prints lots of warning logs.(gauravn7)

Gaurav Nagar 8 年之前
父節點
當前提交
0a5e2b429f

+ 9 - 0
contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java

@@ -269,6 +269,7 @@ public class JdbcConnector extends HiveActor {
     isFailure = true;
     this.failure = failure;
     if (isAsync() && jobId.isPresent()) {
+      stopStatementExecutor();
       if(isCancelCalled) {
         processCancel();
         return;
@@ -281,8 +282,16 @@ public class JdbcConnector extends HiveActor {
     }
   }
 
+  private void stopStatementExecutor() {
+    if (statementExecutor != null) {
+      statementExecutor.tell(PoisonPill.getInstance(), ActorRef.noSender());
+      statementExecutor = null;
+    }
+  }
+
   private void processResult(Optional<ResultSet> resultSetOptional) {
     executing = false;
+    stopStatementExecutor();
 
     LOG.info("Finished processing SQL statements for Job id : {}", jobId.or("SYNC JOB"));
     if (isAsync() && jobId.isPresent()) {

+ 5 - 0
contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HiveViewImpl.java

@@ -23,9 +23,13 @@ import org.apache.ambari.view.ViewDefinition;
 import org.apache.ambari.view.ViewInstanceDefinition;
 import org.apache.ambari.view.hive20.utils.SharedObjectsFactory;
 import org.apache.ambari.view.utils.UserLocal;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 public class HiveViewImpl implements View {
+  private final Logger LOG = LoggerFactory.getLogger(getClass());
+
   @Override
   public void onDeploy(ViewDefinition definition) {
 
@@ -45,6 +49,7 @@ public class HiveViewImpl implements View {
   @Override
   public void onUpdate(ViewInstanceDefinition definition) {
     //drop all cached connection for instance
+    LOG.info("Settings updated for instance '" + definition.getInstanceName() + "'");
     UserLocal.dropInstanceCache(definition.getInstanceName());
     SharedObjectsFactory.dropInstanceCache(definition.getInstanceName());
     ConnectionSystem.getInstance().removeOperationControllerFromCache(definition.getInstanceName());

+ 10 - 0
contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java

@@ -272,6 +272,7 @@ public class JdbcConnector extends HiveActor {
     isFailure = true;
     this.failure = failure;
     if (isAsync() && jobId.isPresent()) {
+      stopStatementExecutor();
       if(isCancelCalled) {
         processCancel();
         return;
@@ -284,9 +285,18 @@ public class JdbcConnector extends HiveActor {
     }
   }
 
+  private void stopStatementExecutor() {
+    if (statementExecutor != null) {
+      statementExecutor.tell(PoisonPill.getInstance(), ActorRef.noSender());
+      statementExecutor = null;
+    }
+  }
+
   private void processResult(Optional<ResultSet> resultSetOptional) {
     executing = false;
 
+    stopStatementExecutor();
+
     LOG.info("Finished processing SQL statements for Job id : {}", jobId.or("SYNC JOB"));
     if (isAsync() && jobId.isPresent()) {
       updateJobStatus(jobId.get(), Job.JOB_STATE_FINISHED);