Author: gates
Date: Tue Feb 7 04:32:06 2012
New Revision: 1241347
URL: http://svn.apache.org/viewvc?rev=1241347&view=rev
Log:
HCATALOG-238. Absence of msgbus.topic.name should not be deemed as
notification-failure.
Modified:
incubator/hcatalog/branches/branch-0.3/CHANGES.txt
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/listener/NotificationListener.java
Modified: incubator/hcatalog/branches/branch-0.3/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.3/CHANGES.txt?rev=1241347&r1=1241346&r2=1241347&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.3/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.3/CHANGES.txt Tue Feb 7 04:32:06 2012
@@ -64,6 +64,8 @@ Release 0.3.0 (unreleased changes)
HCAT-63. RPM package integration with Hadoop (khorgath via hashutosh)
IMPROVEMENTS
+ HCAT-238. Absence of msgbus.topic.name should not be deemed as
notification-failure. (mithun via gates)
+
HCAT-246. Exception masked in HCatSplit class (avandana via toffer)
HCAT-211. Update tar ball installation documentation (vikram.dixit via
khorgath)
Modified:
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/listener/NotificationListener.java
URL:
http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/listener/NotificationListener.java?rev=1241347&r1=1241346&r2=1241347&view=diff
==============================================================================
---
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/listener/NotificationListener.java
(original)
+++
incubator/hcatalog/branches/branch-0.3/src/java/org/apache/hcatalog/listener/NotificationListener.java
Tue Feb 7 04:32:06 2012
@@ -91,16 +91,9 @@ public class NotificationListener extend
private static String getTopicName(Partition partition,
ListenerEvent partitionEvent) throws MetaException {
try {
- String topicName = partitionEvent.getHandler()
+ return partitionEvent.getHandler()
.get_table(partition.getDbName(),
partition.getTableName())
.getParameters().get(HCatConstants.HCAT_MSGBUS_TOPIC_NAME);
- if (topicName == null) {
- throw new MetaException(
- "Topic name not found in
metastore. Please do alter table set properties ("
- +
HCatConstants.HCAT_MSGBUS_TOPIC_NAME
- +
"=dbname.tablename) or whatever you want topic name to be.");
- }
- return topicName;
} catch (NoSuchObjectException e) {
throw new MetaException(e.toString());
}
@@ -115,7 +108,16 @@ public class NotificationListener extend
Partition partition = partitionEvent.getPartition();
String topicName = getTopicName(partition,
partitionEvent);
- send(partition, topicName,
HCatConstants.HCAT_ADD_PARTITION_EVENT);
+ if (topicName != null && !topicName.equals("")) {
+ send(partition, topicName,
HCatConstants.HCAT_ADD_PARTITION_EVENT);
+ }
+ else {
+ LOG.info("Topic name not found in metastore. Suppressing HCatalog
notification for " + partition.getDbName()
+ + "." + partition.getTableName()
+ + " To enable notifications for this table, please do alter table
set properties ("
+ + HCatConstants.HCAT_MSGBUS_TOPIC_NAME
+ + "=<dbname>.<tablename>) or whatever you want topic name to be.");
+ }
}
}
@@ -137,7 +139,16 @@ public class NotificationListener extend
sd.setParameters(new HashMap<String, String>());
sd.getSerdeInfo().setParameters(new HashMap<String,
String>());
String topicName = getTopicName(partition,
partitionEvent);
- send(partition, topicName,
HCatConstants.HCAT_DROP_PARTITION_EVENT);
+ if (topicName != null && !topicName.equals("")) {
+ send(partition, topicName,
HCatConstants.HCAT_DROP_PARTITION_EVENT);
+ }
+ else {
+ LOG.info("Topic name not found in metastore. Suppressing HCatalog
notification for " + partition.getDbName()
+ + "." + partition.getTableName()
+ + " To enable notifications for this table, please do alter table
set properties ("
+ + HCatConstants.HCAT_MSGBUS_TOPIC_NAME
+ + "=<dbname>.<tablename>) or whatever you want topic name to be.");
+ }
}
}