Skip to content

Commit

Permalink
improved lifecycle output log
Browse files Browse the repository at this point in the history
  • Loading branch information
hzliuxun committed Nov 2, 2017
1 parent c83b09b commit 928eb50
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public void onCreateDatabase(CreateDatabaseEvent dbEvent)
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(dbEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand All @@ -511,7 +511,7 @@ public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException {
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(dbEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand All @@ -534,7 +534,7 @@ public void onCreateTable(CreateTableEvent tableEvent) throws MetaException {
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(tableEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand All @@ -558,7 +558,7 @@ public void onDropTable(DropTableEvent tableEvent) throws MetaException {
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(tableEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand All @@ -585,7 +585,7 @@ public void onAlterTable(AlterTableEvent tableEvent) throws MetaException {
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(tableEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand Down Expand Up @@ -614,7 +614,7 @@ public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaExceptio
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(partitionEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand Down Expand Up @@ -643,7 +643,7 @@ public void onAlterPartition(AlterPartitionEvent partitionEvent) throws MetaExce
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(partitionEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand Down Expand Up @@ -674,7 +674,7 @@ public void onDropPartition(DropPartitionEvent partitionEvent) throws MetaExcept
return;
}
if (!MetaStoreEventListenerUtils.needSynchronize(partitionEvent)) {
LOGGER.info("Table lifecycle parameters is empty, it needs to be synchronized");
LOGGER.info("Table lifecycle parameters is not empty, No synchronization event.");
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package org.apache.ranger.binding.metastore;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.metastore.events.*;

import java.util.Map;

public class MetaStoreEventListenerUtils {
private static final Log LOGGER = LogFactory.getLog(MetaStoreEventListenerUtils.class);

static String PARAMETER_LIFECYCLE = "LIFECYCLE";

static public boolean needSynchronize(ListenerEvent listenerEvent) {
String lifecycleParam = "";
if (listenerEvent instanceof CreateDatabaseEvent) {
Expand Down Expand Up @@ -66,6 +71,7 @@ static public boolean needSynchronize(ListenerEvent listenerEvent) {
if (null == lifecycleParam || lifecycleParam.isEmpty()) {
return true;
} else {
LOGGER.info("lifecycleParam = " + lifecycleParam);
return false;
}
}
Expand Down

0 comments on commit 928eb50

Please sign in to comment.