diff --git a/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/DummyRawStoreFailEvent.java b/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/DummyRawStoreFailEvent.java index ff97522..7b8c4a7 100644 --- a/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/DummyRawStoreFailEvent.java +++ b/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/DummyRawStoreFailEvent.java @@ -859,7 +859,7 @@ public NotificationEventResponse getNextNotification(NotificationEventRequest rq } @Override - public void addNotificationEvent(NotificationEvent event) { + public void addNotificationEvent(NotificationEvent event) throws MetaException { objectStore.addNotificationEvent(event); } diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java index fdadf12..5cdbbfc 100644 --- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -9547,7 +9547,7 @@ public long getSleepInterval() { } @Override - public void addNotificationEvent(NotificationEvent entry) { + public void addNotificationEvent(NotificationEvent entry) throws MetaException { boolean commited = false; Query query = null; try { @@ -9571,8 +9571,9 @@ public void addNotificationEvent(NotificationEvent entry) { } pm.makePersistent(translateThriftToDb(entry)); commited = commitTransaction(); - } catch (Exception e) { - LOG.error("couldnot get lock for update", e); + } catch (MetaException e) { + LOG.error("Couldn't get lock for update", e); + throw e; } finally { rollbackAndCleanup(commited, query); } diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java index f350aa9..a78d51b 100644 --- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java +++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java @@ -1178,8 +1178,9 @@ AggrStats get_aggr_stats_for(String catName, String dbName, String tblName, /** * Add a notification entry. This should only be called from inside the metastore * @param event the notification to add + * @throws MetaException error accessing RDBMS */ - void addNotificationEvent(NotificationEvent event); + void addNotificationEvent(NotificationEvent event) throws MetaException; /** * Remove older notification events. diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java index d9356b8..5a8b564 100644 --- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java +++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java @@ -2018,7 +2018,7 @@ public NotificationEventResponse getNextNotification( } @Override - public void addNotificationEvent(NotificationEvent event) { + public void addNotificationEvent(NotificationEvent event) throws MetaException { rawStore.addNotificationEvent(event); } diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java index 8c3ada3..9d50b25 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java @@ -811,7 +811,7 @@ public NotificationEventResponse getNextNotification(NotificationEventRequest rq } @Override - public void addNotificationEvent(NotificationEvent event) { + public void addNotificationEvent(NotificationEvent event) throws MetaException { objectStore.addNotificationEvent(event); } diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java index f98e8de..7e15292 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java @@ -816,7 +816,7 @@ public NotificationEventResponse getNextNotification(NotificationEventRequest rq } @Override - public void addNotificationEvent(NotificationEvent event) { + public void addNotificationEvent(NotificationEvent event) throws MetaException { } diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java index 9912213..ac35882 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java @@ -519,7 +519,7 @@ public void testNonConfDatanucleusValueSet() { */ // TODO MS-SPLIT uncomment once we move EventMessage over @Test - public void testNotificationOps() throws InterruptedException { + public void testNotificationOps() throws InterruptedException, MetaException { final int NO_EVENT_ID = 0; final int FIRST_EVENT_ID = 1; final int SECOND_EVENT_ID = 2; @@ -571,7 +571,7 @@ public void testNotificationOps() throws InterruptedException { + " https://db.apache.org/derby/docs/10.10/devguide/cdevconcepts842385.html" ) @Test - public void testConcurrentAddNotifications() throws ExecutionException, InterruptedException { + public void testConcurrentAddNotifications() throws ExecutionException, InterruptedException, MetaException { final int NUM_THREADS = 10; CyclicBarrier cyclicBarrier = new CyclicBarrier(NUM_THREADS, @@ -620,10 +620,10 @@ public void testConcurrentAddNotifications() throws ExecutionException, Interrup try { cyclicBarrier.await(); - } catch (InterruptedException | BrokenBarrierException e) { + store.addNotificationEvent(dbEvent); + } catch (InterruptedException | BrokenBarrierException | MetaException e) { throw new RuntimeException(e); } - store.addNotificationEvent(dbEvent); System.out.println("FINISH NOTIFICATION"); }); }