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 3c334fa..abf67a8 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 @@ -866,7 +866,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 0d2da7a..7490243 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 @@ -9697,7 +9697,7 @@ public long getSleepInterval() { } @Override - public void addNotificationEvent(NotificationEvent entry) { + public void addNotificationEvent(NotificationEvent entry) throws MetaException { boolean commited = false; Query query = null; try { @@ -9721,8 +9721,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 c8905c8..d019941 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 @@ -1195,8 +1195,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 1da9798..a526019 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 @@ -2026,7 +2026,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 8e195d0..c482d28 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 @@ -818,7 +818,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 85eb6d5..d253005 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 @@ -823,7 +823,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 5d5bc76..833e2bd 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 @@ -765,7 +765,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; @@ -817,7 +817,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, @@ -866,10 +866,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"); }); }