[ https://issues.apache.org/jira/browse/HIVE-13966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15524596#comment-15524596 ]
Alan Gates commented on HIVE-13966: ----------------------------------- All of the calls to the notifiers look like: {code} for (MetaStoreEventListener transactionalListener : transactionalListeners) { if(transactionalListener instanceof TransactionalMetaStoreEventListener) { transactionalListener.onCreateDatabase(new CreateDatabaseEvent(db, true, this)); } } {code} So you're creating a new event for every listener. But the contents of these events are 90% final, so it's pretty much the same event for every listener. And as far as I can tell no one ever alters the contents of those events. In the AlterTableHandler case it's worse because after creating the event you're setting the environment, which is again the same for every event. Given that this is happening in the inner loop of the metastore operations and we want it to be as fast as possible it seems something like the following would be better: {code} CreateDatabaseEvent cde = null; for (MetaStoreEventListener transactionalListener : transactionalListeners) { if (cde == null) cde = new CreateDatabaseEvent(db, true, this); transactionalListener.onCreateDatabase(cde); } {code} Also, why are you checking the instance type every time? As per my previous comment I'm not sure we need a separate interface type, but if we do, just assume that's what they are in the for loop rather than assuming the more general and then doing an instanceof for the specific. Why did you add the renameTable operation to RawStore? That doesn't seem related to this. > DbNotificationListener: can loose DDL operation notifications > ------------------------------------------------------------- > > Key: HIVE-13966 > URL: https://issues.apache.org/jira/browse/HIVE-13966 > Project: Hive > Issue Type: Bug > Components: HCatalog > Reporter: Nachiket Vaidya > Assignee: Rahul Sharma > Priority: Critical > Attachments: HIVE-13966.1.patch, HIVE-13966.2.patch, HIVE-13966.pdf > > > The code for each API in HiveMetaStore.java is like this: > 1. openTransaction() > 2. -- operation-- > 3. commit() or rollback() based on result of the operation. > 4. add entry to notification log (unconditionally) > If the operation is failed (in step 2), we still add entry to notification > log. Found this issue in testing. > It is still ok as this is the case of false positive. > If the operation is successful and adding to notification log failed, the > user will get an MetaException. It will not rollback the operation, as it is > already committed. We need to handle this case so that we will not have false > negatives. -- This message was sent by Atlassian JIRA (v6.3.4#6332)