You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "pankaj72981 (via GitHub)" <gi...@apache.org> on 2026/03/03 14:51:34 UTC

[PR] HBASE-29955 HMaster getting aborted due to NPE while creating snapshot for invalid table name [hbase]

pankaj72981 opened a new pull request, #7848:
URL: https://github.com/apache/hbase/pull/7848

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29955 HMaster getting aborted due to NPE while creating snapshot for invalid table name [hbase]

Posted by "pankaj72981 (via GitHub)" <gi...@apache.org>.
pankaj72981 merged PR #7848:
URL: https://github.com/apache/hbase/pull/7848


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29955 HMaster getting aborted due to NPE while creating snapshot for invalid table name [hbase]

Posted by "guluo2016 (via GitHub)" <gi...@apache.org>.
guluo2016 commented on PR #7848:
URL: https://github.com/apache/hbase/pull/7848#issuecomment-4005738617

   I manually ran the failed test case, and it passed.
   ```bash
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.478 s -- in org.apache.hadoop.hbase.io.hfile.bucket.TestPrefetchWithBucketCache
   [INFO]
   [INFO] Results:
   [INFO]
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   [INFO]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29955 HMaster getting aborted due to NPE while creating snapshot for invalid table name [hbase]

Posted by "guluo2016 (via GitHub)" <gi...@apache.org>.
guluo2016 commented on code in PR #7848:
URL: https://github.com/apache/hbase/pull/7848#discussion_r2882914471


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/client/SnapshotWithAclTestBase.java:
##########
@@ -314,4 +323,39 @@ public void testDeleteSnapshot() throws Exception {
       TEST_UTIL.getAdmin().listSnapshots(Pattern.compile(testSnapshotName));
     assertEquals(0, snapshotsAfterDelete.size());
   }
+
+  @Test
+  public void testCreateSnapshotWithNonExistingTable() throws Exception {
+    final TableName tableName = name.getTableName();
+    String snapshotName = tableName.getNameAsString() + "snap1";
+
+    try {
+      try {
+        // Create snapshot without creating table
+        TEST_UTIL.getAdmin().snapshot(snapshotName, tableName);
+        fail("Snapshot operation should fail, table doesn't exist");
+      } catch (Exception e) {
+        assertTrue(e instanceof SnapshotCreationException);
+      }

Review Comment:
   This code can be simplified as follows:
   ```java
   // Create snapshot without creating table
   assertThrows("Snapshot operation should fail, table doesn't exist",
     SnapshotCreationException.class, () -> TEST_UTIL.getAdmin().snapshot(snapshotName, tableName));
   ```
   And I noticed other test cases in this file also use `assertThrows`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29955 HMaster getting aborted due to NPE while creating snapshot for invalid table name [hbase]

Posted by "pankaj72981 (via GitHub)" <gi...@apache.org>.
pankaj72981 commented on code in PR #7848:
URL: https://github.com/apache/hbase/pull/7848#discussion_r2888657212


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/client/SnapshotWithAclTestBase.java:
##########
@@ -314,4 +323,39 @@ public void testDeleteSnapshot() throws Exception {
       TEST_UTIL.getAdmin().listSnapshots(Pattern.compile(testSnapshotName));
     assertEquals(0, snapshotsAfterDelete.size());
   }
+
+  @Test
+  public void testCreateSnapshotWithNonExistingTable() throws Exception {
+    final TableName tableName = name.getTableName();
+    String snapshotName = tableName.getNameAsString() + "snap1";
+
+    try {
+      try {
+        // Create snapshot without creating table
+        TEST_UTIL.getAdmin().snapshot(snapshotName, tableName);
+        fail("Snapshot operation should fail, table doesn't exist");
+      } catch (Exception e) {
+        assertTrue(e instanceof SnapshotCreationException);
+      }

Review Comment:
   Thanks @guluo2016  for the suggestion, have updated the PR. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org