diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java index b6ade601906..f309715608e 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java @@ -276,10 +276,28 @@ public class TestOzoneManager { Assert.assertTrue(volumeInfo.getVolumeName().equals(volumeName2)); // Make sure volume with _A suffix is successfully deleted. - exception.expect(IOException.class); - exception.expectMessage("Info Volume failed, error:VOLUME_NOT_FOUND"); - volumeArgs = new VolumeArgs(volumeName1, userArgs); - storageHandler.getVolumeInfo(volumeArgs); + try { + volumeArgs = new VolumeArgs(volumeName1, userArgs); + storageHandler.getVolumeInfo(volumeArgs); + Assert.fail("Volume is not deleted"); + } catch (IOException ex) { + Assert.assertEquals("Info Volume failed, error:VOLUME_NOT_FOUND", + ex.getMessage()); + } + //delete the _AA volume, too + storageHandler.deleteVolume(new VolumeArgs(volumeName2, userArgs)); + + //Make sure there is no volume information for the specific user + OMMetadataManager metadataManager = + cluster.getOzoneManager().getMetadataManager(); + + byte[] userKey = metadataManager.getUserKey(userName); + byte[] volumes = metadataManager.getUserTable().get(userKey); + + //that was the last volume of the user, shouldn't be any record here + Assert.assertNull(volumes); + + } // Create a volume and a bucket inside the volume, diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeManagerImpl.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeManagerImpl.java index 419b0aaf18c..cf25215da78 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeManagerImpl.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeManagerImpl.java @@ -110,7 +110,7 @@ public class VolumeManagerImpl implements VolumeManager { // Remove the volume from the list prevVolList.remove(volume); if (prevVolList.size() == 0) { - batch.delete(dbUserKey); + batch.delete(metadataManager.getUserTable().getHandle(), dbUserKey); } else { VolumeList newVolList = VolumeList.newBuilder() .addAllVolumeNames(prevVolList).build();