|
@@ -14,7 +14,7 @@
|
|
|
* License for the specific language governing permissions and limitations under
|
|
|
* the License.
|
|
|
*/
|
|
|
-package org.apache.hadoop.ozone.ksm;
|
|
|
+package org.apache.hadoop.ozone.om;
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
@@ -29,11 +29,11 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
|
|
import org.apache.hadoop.ozone.OzoneConsts;
|
|
|
import org.apache.hadoop.ozone.common.BlockGroup;
|
|
|
import org.apache.hadoop.ozone.client.rest.OzoneException;
|
|
|
-import org.apache.hadoop.ozone.ksm.exceptions.KSMException;
|
|
|
+import org.apache.hadoop.ozone.om.exceptions.OMException;
|
|
|
import org.apache.hadoop.hdds.scm.server.SCMStorage;
|
|
|
-import org.apache.hadoop.ozone.ksm.helpers.ServiceInfo;
|
|
|
+import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
|
|
|
import org.apache.hadoop.ozone.protocol.proto
|
|
|
- .KeySpaceManagerProtocolProtos.ServicePort;
|
|
|
+ .OzoneManagerProtocolProtos.ServicePort;
|
|
|
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
|
|
|
import org.apache.hadoop.ozone.web.handlers.BucketArgs;
|
|
|
import org.apache.hadoop.ozone.web.handlers.KeyArgs;
|
|
@@ -50,7 +50,7 @@ import org.apache.hadoop.hdds.scm.ScmConfigKeys;
|
|
|
import org.apache.hadoop.hdds.scm.ScmInfo;
|
|
|
import org.apache.hadoop.test.GenericTestUtils;
|
|
|
import org.apache.hadoop.ozone.protocol.proto
|
|
|
- .KeySpaceManagerProtocolProtos.Status;
|
|
|
+ .OzoneManagerProtocolProtos.Status;
|
|
|
import org.apache.hadoop.ozone.web.handlers.ListArgs;
|
|
|
import org.apache.hadoop.ozone.web.response.ListBuckets;
|
|
|
import org.apache.hadoop.ozone.web.response.ListKeys;
|
|
@@ -74,7 +74,6 @@ import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.net.InetSocketAddress;
|
|
|
import java.text.ParseException;
|
|
|
-import java.util.HashSet;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.Map;
|
|
|
import java.util.Random;
|
|
@@ -86,22 +85,22 @@ import java.util.stream.Stream;
|
|
|
|
|
|
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS;
|
|
|
import static org.apache.hadoop.ozone.OzoneConsts.DELETING_KEY_PREFIX;
|
|
|
-import static org.apache.hadoop.ozone.ksm.KSMConfigKeys.OZONE_KSM_ADDRESS_KEY;
|
|
|
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
|
|
|
import static org.apache.hadoop.hdds.scm.ScmConfigKeys
|
|
|
.OZONE_SCM_CLIENT_ADDRESS_KEY;
|
|
|
|
|
|
/**
|
|
|
- * Test Key Space Manager operation in distributed handler scenario.
|
|
|
+ * Test Ozone Manager operation in distributed handler scenario.
|
|
|
*/
|
|
|
-public class TestKeySpaceManager {
|
|
|
+public class TestOzoneManager {
|
|
|
private static MiniOzoneCluster cluster = null;
|
|
|
private static StorageHandler storageHandler;
|
|
|
private static UserArgs userArgs;
|
|
|
- private static KSMMetrics ksmMetrics;
|
|
|
+ private static OMMetrics omMetrics;
|
|
|
private static OzoneConfiguration conf;
|
|
|
private static String clusterId;
|
|
|
private static String scmId;
|
|
|
- private static String ksmId;
|
|
|
+ private static String omId;
|
|
|
|
|
|
@Rule
|
|
|
public ExpectedException exception = ExpectedException.none();
|
|
@@ -119,20 +118,20 @@ public class TestKeySpaceManager {
|
|
|
conf = new OzoneConfiguration();
|
|
|
clusterId = UUID.randomUUID().toString();
|
|
|
scmId = UUID.randomUUID().toString();
|
|
|
- ksmId = UUID.randomUUID().toString();
|
|
|
+ omId = UUID.randomUUID().toString();
|
|
|
conf.set(OzoneConfigKeys.OZONE_HANDLER_TYPE_KEY,
|
|
|
OzoneConsts.OZONE_HANDLER_DISTRIBUTED);
|
|
|
conf.setInt(OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS, 2);
|
|
|
cluster = MiniOzoneCluster.newBuilder(conf)
|
|
|
.setClusterId(clusterId)
|
|
|
.setScmId(scmId)
|
|
|
- .setKsmId(ksmId)
|
|
|
+ .setOmId(omId)
|
|
|
.build();
|
|
|
cluster.waitForClusterToBeReady();
|
|
|
storageHandler = new ObjectStoreHandler(conf).getStorageHandler();
|
|
|
userArgs = new UserArgs(null, OzoneUtils.getRequestID(),
|
|
|
null, null, null, null);
|
|
|
- ksmMetrics = cluster.getKeySpaceManager().getMetrics();
|
|
|
+ omMetrics = cluster.getOzoneManager().getMetrics();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -148,7 +147,7 @@ public class TestKeySpaceManager {
|
|
|
// Create a volume and test its attribute after creating them
|
|
|
@Test(timeout = 60000)
|
|
|
public void testCreateVolume() throws IOException, OzoneException {
|
|
|
- long volumeCreateFailCount = ksmMetrics.getNumVolumeCreateFails();
|
|
|
+ long volumeCreateFailCount = omMetrics.getNumVolumeCreateFails();
|
|
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
|
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
@@ -163,14 +162,14 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertTrue(retVolumeinfo.getVolumeName().equals(volumeName));
|
|
|
Assert.assertTrue(retVolumeinfo.getOwner().getName().equals(userName));
|
|
|
Assert.assertEquals(volumeCreateFailCount,
|
|
|
- ksmMetrics.getNumVolumeCreateFails());
|
|
|
+ omMetrics.getNumVolumeCreateFails());
|
|
|
}
|
|
|
|
|
|
// Create a volume and modify the volume owner and then test its attributes
|
|
|
@Test(timeout = 60000)
|
|
|
public void testChangeVolumeOwner() throws IOException, OzoneException {
|
|
|
- long volumeCreateFailCount = ksmMetrics.getNumVolumeCreateFails();
|
|
|
- long volumeInfoFailCount = ksmMetrics.getNumVolumeInfoFails();
|
|
|
+ long volumeCreateFailCount = omMetrics.getNumVolumeCreateFails();
|
|
|
+ long volumeInfoFailCount = omMetrics.getNumVolumeInfoFails();
|
|
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
|
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
@@ -191,16 +190,16 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertFalse(retVolumeInfo.getOwner().getName().equals(userName));
|
|
|
Assert.assertTrue(retVolumeInfo.getOwner().getName().equals(newUserName));
|
|
|
Assert.assertEquals(volumeCreateFailCount,
|
|
|
- ksmMetrics.getNumVolumeCreateFails());
|
|
|
+ omMetrics.getNumVolumeCreateFails());
|
|
|
Assert.assertEquals(volumeInfoFailCount,
|
|
|
- ksmMetrics.getNumVolumeInfoFails());
|
|
|
+ omMetrics.getNumVolumeInfoFails());
|
|
|
}
|
|
|
|
|
|
// Create a volume and modify the volume owner and then test its attributes
|
|
|
@Test(timeout = 60000)
|
|
|
public void testChangeVolumeQuota() throws IOException, OzoneException {
|
|
|
- long numVolumeCreateFail = ksmMetrics.getNumVolumeCreateFails();
|
|
|
- long numVolumeInfoFail = ksmMetrics.getNumVolumeInfoFails();
|
|
|
+ long numVolumeCreateFail = omMetrics.getNumVolumeCreateFails();
|
|
|
+ long numVolumeInfoFail = omMetrics.getNumVolumeInfoFails();
|
|
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
|
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
@@ -237,15 +236,15 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertEquals(OzoneConsts.MAX_QUOTA_IN_BYTES,
|
|
|
retVolumeInfo.getQuota().sizeInBytes());
|
|
|
Assert.assertEquals(numVolumeCreateFail,
|
|
|
- ksmMetrics.getNumVolumeCreateFails());
|
|
|
+ omMetrics.getNumVolumeCreateFails());
|
|
|
Assert.assertEquals(numVolumeInfoFail,
|
|
|
- ksmMetrics.getNumVolumeInfoFails());
|
|
|
+ omMetrics.getNumVolumeInfoFails());
|
|
|
}
|
|
|
|
|
|
// Create a volume and then delete it and then check for deletion
|
|
|
@Test(timeout = 60000)
|
|
|
public void testDeleteVolume() throws IOException, OzoneException {
|
|
|
- long volumeCreateFailCount = ksmMetrics.getNumVolumeCreateFails();
|
|
|
+ long volumeCreateFailCount = omMetrics.getNumVolumeCreateFails();
|
|
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
|
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
@@ -270,7 +269,7 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertTrue(volumeInfo.getVolumeName().equals(volumeName1));
|
|
|
Assert.assertTrue(volumeInfo.getOwner().getName().equals(userName));
|
|
|
Assert.assertEquals(volumeCreateFailCount,
|
|
|
- ksmMetrics.getNumVolumeCreateFails());
|
|
|
+ omMetrics.getNumVolumeCreateFails());
|
|
|
|
|
|
// Volume with _A should be able to delete as it is empty.
|
|
|
storageHandler.deleteVolume(volumeArgs);
|
|
@@ -291,7 +290,7 @@ public class TestKeySpaceManager {
|
|
|
// then delete it and then check for deletion failure
|
|
|
@Test(timeout = 60000)
|
|
|
public void testFailedDeleteVolume() throws IOException, OzoneException {
|
|
|
- long numVolumeCreateFails = ksmMetrics.getNumVolumeCreateFails();
|
|
|
+ long numVolumeCreateFails = omMetrics.getNumVolumeCreateFails();
|
|
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
|
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
@@ -307,7 +306,7 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertTrue(retVolumeInfo.getVolumeName().equals(volumeName));
|
|
|
Assert.assertTrue(retVolumeInfo.getOwner().getName().equals(userName));
|
|
|
Assert.assertEquals(numVolumeCreateFails,
|
|
|
- ksmMetrics.getNumVolumeCreateFails());
|
|
|
+ omMetrics.getNumVolumeCreateFails());
|
|
|
|
|
|
BucketArgs bucketArgs = new BucketArgs(volumeName, bucketName, userArgs);
|
|
|
storageHandler.createBucket(bucketArgs);
|
|
@@ -366,15 +365,15 @@ public class TestKeySpaceManager {
|
|
|
OzoneAcl.OzoneACLRights.READ);
|
|
|
Assert.assertFalse(storageHandler.checkVolumeAccess(volumeName, worldAcl));
|
|
|
|
|
|
- Assert.assertEquals(0, ksmMetrics.getNumVolumeCheckAccessFails());
|
|
|
- Assert.assertEquals(0, ksmMetrics.getNumVolumeCreateFails());
|
|
|
+ Assert.assertEquals(0, omMetrics.getNumVolumeCheckAccessFails());
|
|
|
+ Assert.assertEquals(0, omMetrics.getNumVolumeCreateFails());
|
|
|
}
|
|
|
|
|
|
@Test(timeout = 60000)
|
|
|
public void testCreateBucket() throws IOException, OzoneException {
|
|
|
- long numVolumeCreateFail = ksmMetrics.getNumVolumeCreateFails();
|
|
|
- long numBucketCreateFail = ksmMetrics.getNumBucketCreateFails();
|
|
|
- long numBucketInfoFail = ksmMetrics.getNumBucketInfoFails();
|
|
|
+ long numVolumeCreateFail = omMetrics.getNumVolumeCreateFails();
|
|
|
+ long numBucketCreateFail = omMetrics.getNumBucketCreateFails();
|
|
|
+ long numBucketInfoFail = omMetrics.getNumBucketInfoFails();
|
|
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
|
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
@@ -394,11 +393,11 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertTrue(bucketInfo.getVolumeName().equals(volumeName));
|
|
|
Assert.assertTrue(bucketInfo.getBucketName().equals(bucketName));
|
|
|
Assert.assertEquals(numVolumeCreateFail,
|
|
|
- ksmMetrics.getNumVolumeCreateFails());
|
|
|
+ omMetrics.getNumVolumeCreateFails());
|
|
|
Assert.assertEquals(numBucketCreateFail,
|
|
|
- ksmMetrics.getNumBucketCreateFails());
|
|
|
+ omMetrics.getNumBucketCreateFails());
|
|
|
Assert.assertEquals(numBucketInfoFail,
|
|
|
- ksmMetrics.getNumBucketInfoFails());
|
|
|
+ omMetrics.getNumBucketInfoFails());
|
|
|
}
|
|
|
|
|
|
@Test(timeout = 60000)
|
|
@@ -479,7 +478,7 @@ public class TestKeySpaceManager {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Basic test of both putKey and getKey from KSM, as one can not be tested
|
|
|
+ * Basic test of both putKey and getKey from OM, as one can not be tested
|
|
|
* without the other.
|
|
|
*
|
|
|
* @throws IOException
|
|
@@ -492,8 +491,8 @@ public class TestKeySpaceManager {
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
|
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
|
|
|
String keyName = "key" + RandomStringUtils.randomNumeric(5);
|
|
|
- long numKeyAllocates = ksmMetrics.getNumKeyAllocates();
|
|
|
- long numKeyLookups = ksmMetrics.getNumKeyLookups();
|
|
|
+ long numKeyAllocates = omMetrics.getNumKeyAllocates();
|
|
|
+ long numKeyLookups = omMetrics.getNumKeyLookups();
|
|
|
|
|
|
VolumeArgs createVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
|
|
createVolumeArgs.setUserName(userName);
|
|
@@ -512,14 +511,14 @@ public class TestKeySpaceManager {
|
|
|
try (OutputStream stream = storageHandler.newKeyWriter(keyArgs)) {
|
|
|
stream.write(dataString.getBytes());
|
|
|
}
|
|
|
- Assert.assertEquals(1 + numKeyAllocates, ksmMetrics.getNumKeyAllocates());
|
|
|
+ Assert.assertEquals(1 + numKeyAllocates, omMetrics.getNumKeyAllocates());
|
|
|
|
|
|
byte[] data = new byte[dataString.length()];
|
|
|
try (InputStream in = storageHandler.newKeyReader(keyArgs)) {
|
|
|
in.read(data);
|
|
|
}
|
|
|
Assert.assertEquals(dataString, DFSUtil.bytes2String(data));
|
|
|
- Assert.assertEquals(1 + numKeyLookups, ksmMetrics.getNumKeyLookups());
|
|
|
+ Assert.assertEquals(1 + numKeyLookups, omMetrics.getNumKeyLookups());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -536,7 +535,7 @@ public class TestKeySpaceManager {
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
|
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
|
|
|
String keyName = "key" + RandomStringUtils.randomNumeric(5);
|
|
|
- long numKeyAllocateFails = ksmMetrics.getNumKeyAllocateFails();
|
|
|
+ long numKeyAllocateFails = omMetrics.getNumKeyAllocateFails();
|
|
|
|
|
|
VolumeArgs createVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
|
|
createVolumeArgs.setUserName(userName);
|
|
@@ -558,12 +557,12 @@ public class TestKeySpaceManager {
|
|
|
|
|
|
// We allow the key overwrite to be successful. Please note : Till
|
|
|
// HDFS-11922 is fixed this causes a data block leak on the data node side.
|
|
|
- // That is this overwrite only overwrites the keys on KSM. We need to
|
|
|
+ // That is this overwrite only overwrites the keys on OM. We need to
|
|
|
// garbage collect those blocks from datanode.
|
|
|
KeyArgs keyArgs2 = new KeyArgs(volumeName, bucketName, keyName, userArgs);
|
|
|
storageHandler.newKeyWriter(keyArgs2);
|
|
|
Assert
|
|
|
- .assertEquals(numKeyAllocateFails, ksmMetrics.getNumKeyAllocateFails());
|
|
|
+ .assertEquals(numKeyAllocateFails, omMetrics.getNumKeyAllocateFails());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -579,7 +578,7 @@ public class TestKeySpaceManager {
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
|
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
|
|
|
String keyName = "key" + RandomStringUtils.randomNumeric(5);
|
|
|
- long numKeyLookupFails = ksmMetrics.getNumKeyLookupFails();
|
|
|
+ long numKeyLookupFails = omMetrics.getNumKeyLookupFails();
|
|
|
|
|
|
VolumeArgs createVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
|
|
createVolumeArgs.setUserName(userName);
|
|
@@ -598,11 +597,11 @@ public class TestKeySpaceManager {
|
|
|
exception.expectMessage("KEY_NOT_FOUND");
|
|
|
storageHandler.newKeyReader(keyArgs);
|
|
|
Assert.assertEquals(1 + numKeyLookupFails,
|
|
|
- ksmMetrics.getNumKeyLookupFails());
|
|
|
+ omMetrics.getNumKeyLookupFails());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Test delete keys for ksm.
|
|
|
+ * Test delete keys for om.
|
|
|
*
|
|
|
* @throws IOException
|
|
|
* @throws OzoneException
|
|
@@ -614,8 +613,8 @@ public class TestKeySpaceManager {
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
|
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
|
|
|
String keyName = "key" + RandomStringUtils.randomNumeric(5);
|
|
|
- long numKeyDeletes = ksmMetrics.getNumKeyDeletes();
|
|
|
- long numKeyDeleteFails = ksmMetrics.getNumKeyDeletesFails();
|
|
|
+ long numKeyDeletes = omMetrics.getNumKeyDeletes();
|
|
|
+ long numKeyDeleteFails = omMetrics.getNumKeyDeletesFails();
|
|
|
|
|
|
VolumeArgs createVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
|
|
createVolumeArgs.setUserName(userName);
|
|
@@ -633,10 +632,10 @@ public class TestKeySpaceManager {
|
|
|
}
|
|
|
|
|
|
storageHandler.deleteKey(keyArgs);
|
|
|
- Assert.assertEquals(1 + numKeyDeletes, ksmMetrics.getNumKeyDeletes());
|
|
|
+ Assert.assertEquals(1 + numKeyDeletes, omMetrics.getNumKeyDeletes());
|
|
|
|
|
|
// Make sure the deleted key has been renamed.
|
|
|
- MetadataStore store = cluster.getKeySpaceManager().
|
|
|
+ MetadataStore store = cluster.getOzoneManager().
|
|
|
getMetadataManager().getStore();
|
|
|
List<Map.Entry<byte[], byte[]>> list = store.getRangeKVs(null, 10,
|
|
|
new MetadataKeyFilters.KeyPrefixFilter()
|
|
@@ -651,11 +650,11 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertTrue(ioe.getMessage().contains("KEY_NOT_FOUND"));
|
|
|
}
|
|
|
Assert.assertEquals(1 + numKeyDeleteFails,
|
|
|
- ksmMetrics.getNumKeyDeletesFails());
|
|
|
+ omMetrics.getNumKeyDeletesFails());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Test rename key for ksm.
|
|
|
+ * Test rename key for om.
|
|
|
*
|
|
|
* @throws IOException
|
|
|
* @throws OzoneException
|
|
@@ -667,8 +666,8 @@ public class TestKeySpaceManager {
|
|
|
String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
|
|
|
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
|
|
|
String keyName = "key" + RandomStringUtils.randomNumeric(5);
|
|
|
- long numKeyRenames = ksmMetrics.getNumKeyRenames();
|
|
|
- long numKeyRenameFails = ksmMetrics.getNumKeyRenameFails();
|
|
|
+ long numKeyRenames = omMetrics.getNumKeyRenames();
|
|
|
+ long numKeyRenameFails = omMetrics.getNumKeyRenameFails();
|
|
|
int testRenameFails = 0;
|
|
|
int testRenames = 0;
|
|
|
IOException ioe = null;
|
|
@@ -706,9 +705,9 @@ public class TestKeySpaceManager {
|
|
|
testRenames++;
|
|
|
storageHandler.renameKey(keyArgs, toKeyName);
|
|
|
Assert.assertEquals(numKeyRenames + testRenames,
|
|
|
- ksmMetrics.getNumKeyRenames());
|
|
|
+ omMetrics.getNumKeyRenames());
|
|
|
Assert.assertEquals(numKeyRenameFails + testRenameFails,
|
|
|
- ksmMetrics.getNumKeyRenameFails());
|
|
|
+ omMetrics.getNumKeyRenameFails());
|
|
|
|
|
|
// Try to get the key, should fail as it has been renamed
|
|
|
try {
|
|
@@ -764,9 +763,9 @@ public class TestKeySpaceManager {
|
|
|
Assert.assertTrue(ioe.getMessage().contains("Rename key failed, error"));
|
|
|
|
|
|
Assert.assertEquals(numKeyRenames + testRenames,
|
|
|
- ksmMetrics.getNumKeyRenames());
|
|
|
+ omMetrics.getNumKeyRenames());
|
|
|
Assert.assertEquals(numKeyRenameFails + testRenameFails,
|
|
|
- ksmMetrics.getNumKeyRenameFails());
|
|
|
+ omMetrics.getNumKeyRenameFails());
|
|
|
}
|
|
|
|
|
|
@Test(timeout = 60000)
|
|
@@ -1183,7 +1182,7 @@ public class TestKeySpaceManager {
|
|
|
*/
|
|
|
@Test
|
|
|
public void testGetScmInfo() throws IOException {
|
|
|
- ScmInfo info = cluster.getKeySpaceManager().getScmInfo();
|
|
|
+ ScmInfo info = cluster.getOzoneManager().getScmInfo();
|
|
|
Assert.assertEquals(clusterId, info.getClusterId());
|
|
|
Assert.assertEquals(scmId, info.getScmId());
|
|
|
}
|
|
@@ -1192,7 +1191,7 @@ public class TestKeySpaceManager {
|
|
|
@Test
|
|
|
public void testExpiredOpenKey() throws Exception {
|
|
|
BackgroundService openKeyCleanUpService = ((KeyManagerImpl)cluster
|
|
|
- .getKeySpaceManager().getKeyManager()).getOpenKeyCleanupService();
|
|
|
+ .getOzoneManager().getKeyManager()).getOpenKeyCleanupService();
|
|
|
|
|
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
|
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
|
@@ -1228,7 +1227,7 @@ public class TestKeySpaceManager {
|
|
|
|
|
|
// Now all k1-k4 should be in open state, so ExpiredOpenKeys should not
|
|
|
// contain these values.
|
|
|
- openKeys = cluster.getKeySpaceManager()
|
|
|
+ openKeys = cluster.getOzoneManager()
|
|
|
.getMetadataManager().getExpiredOpenKeys();
|
|
|
|
|
|
for (BlockGroup bg : openKeys) {
|
|
@@ -1239,7 +1238,7 @@ public class TestKeySpaceManager {
|
|
|
|
|
|
Thread.sleep(2000);
|
|
|
// Now all k1-k4 should be in ExpiredOpenKeys
|
|
|
- openKeys = cluster.getKeySpaceManager()
|
|
|
+ openKeys = cluster.getOzoneManager()
|
|
|
.getMetadataManager().getExpiredOpenKeys();
|
|
|
for (BlockGroup bg : openKeys) {
|
|
|
String[] subs = bg.getGroupID().split("/");
|
|
@@ -1258,7 +1257,7 @@ public class TestKeySpaceManager {
|
|
|
// now all k1-k4 should have been removed by the clean-up task, only k5
|
|
|
// should be present in ExpiredOpenKeys.
|
|
|
openKeys =
|
|
|
- cluster.getKeySpaceManager().getMetadataManager().getExpiredOpenKeys();
|
|
|
+ cluster.getOzoneManager().getMetadataManager().getExpiredOpenKeys();
|
|
|
System.out.println(openKeys);
|
|
|
boolean key5found = false;
|
|
|
Set<String> removed = Stream.of(
|
|
@@ -1276,68 +1275,68 @@ public class TestKeySpaceManager {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Tests the KSM Initialization.
|
|
|
+ * Tests the OM Initialization.
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@Test
|
|
|
- public void testKSMInitialization() throws IOException {
|
|
|
- // Read the version file info from KSM version file
|
|
|
- KSMStorage ksmStorage = cluster.getKeySpaceManager().getKsmStorage();
|
|
|
+ public void testOmInitialization() throws IOException {
|
|
|
+ // Read the version file info from OM version file
|
|
|
+ OMStorage omStorage = cluster.getOzoneManager().getOmStorage();
|
|
|
SCMStorage scmStorage = new SCMStorage(conf);
|
|
|
// asserts whether cluster Id and SCM ID are properly set in SCM Version
|
|
|
// file.
|
|
|
Assert.assertEquals(clusterId, scmStorage.getClusterID());
|
|
|
Assert.assertEquals(scmId, scmStorage.getScmId());
|
|
|
- // asserts whether KSM Id is properly set in KSM Version file.
|
|
|
- Assert.assertEquals(ksmId, ksmStorage.getKsmId());
|
|
|
- // asserts whether the SCM info is correct in KSM Version file.
|
|
|
- Assert.assertEquals(clusterId, ksmStorage.getClusterID());
|
|
|
- Assert.assertEquals(scmId, ksmStorage.getScmId());
|
|
|
+ // asserts whether OM Id is properly set in OM Version file.
|
|
|
+ Assert.assertEquals(omId, omStorage.getOmId());
|
|
|
+ // asserts whether the SCM info is correct in OM Version file.
|
|
|
+ Assert.assertEquals(clusterId, omStorage.getClusterID());
|
|
|
+ Assert.assertEquals(scmId, omStorage.getScmId());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Tests the KSM Initialization Failure.
|
|
|
+ * Tests the OM Initialization Failure.
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@Test
|
|
|
- public void testKSMInitializationFailure() throws Exception {
|
|
|
+ public void testOmInitializationFailure() throws Exception {
|
|
|
OzoneConfiguration config = new OzoneConfiguration();
|
|
|
final String path =
|
|
|
GenericTestUtils.getTempPath(UUID.randomUUID().toString());
|
|
|
- Path metaDirPath = Paths.get(path, "ksm-meta");
|
|
|
+ Path metaDirPath = Paths.get(path, "om-meta");
|
|
|
config.set(OzoneConfigKeys.OZONE_METADATA_DIRS, metaDirPath.toString());
|
|
|
config.setBoolean(OzoneConfigKeys.OZONE_ENABLED, true);
|
|
|
config.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "127.0.0.1:0");
|
|
|
config.set(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY,
|
|
|
conf.get(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY));
|
|
|
- exception.expect(KSMException.class);
|
|
|
- exception.expectMessage("KSM not initialized.");
|
|
|
- KeySpaceManager.createKSM(null, config);
|
|
|
- KSMStorage ksmStore = new KSMStorage(config);
|
|
|
- ksmStore.setClusterId("testClusterId");
|
|
|
- ksmStore.setScmId("testScmId");
|
|
|
+ exception.expect(OMException.class);
|
|
|
+ exception.expectMessage("OM not initialized.");
|
|
|
+ OzoneManager.createOm(null, config);
|
|
|
+ OMStorage omStore = new OMStorage(config);
|
|
|
+ omStore.setClusterId("testClusterId");
|
|
|
+ omStore.setScmId("testScmId");
|
|
|
// writes the version file properties
|
|
|
- ksmStore.initialize();
|
|
|
- exception.expect(KSMException.class);
|
|
|
+ omStore.initialize();
|
|
|
+ exception.expect(OMException.class);
|
|
|
exception.expectMessage("SCM version info mismatch.");
|
|
|
- KeySpaceManager.createKSM(null, conf);
|
|
|
+ OzoneManager.createOm(null, conf);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void testGetServiceList() throws IOException {
|
|
|
- long numGetServiceListCalls = ksmMetrics.getNumGetServiceLists();
|
|
|
- List<ServiceInfo> services = cluster.getKeySpaceManager().getServiceList();
|
|
|
+ long numGetServiceListCalls = omMetrics.getNumGetServiceLists();
|
|
|
+ List<ServiceInfo> services = cluster.getOzoneManager().getServiceList();
|
|
|
|
|
|
Assert.assertEquals(numGetServiceListCalls + 1,
|
|
|
- ksmMetrics.getNumGetServiceLists());
|
|
|
+ omMetrics.getNumGetServiceLists());
|
|
|
|
|
|
- ServiceInfo ksmInfo = services.stream().filter(
|
|
|
- a -> a.getNodeType().equals(HddsProtos.NodeType.KSM))
|
|
|
+ ServiceInfo omInfo = services.stream().filter(
|
|
|
+ a -> a.getNodeType().equals(HddsProtos.NodeType.OM))
|
|
|
.collect(Collectors.toList()).get(0);
|
|
|
- InetSocketAddress ksmAddress = new InetSocketAddress(ksmInfo.getHostname(),
|
|
|
- ksmInfo.getPort(ServicePort.Type.RPC));
|
|
|
+ InetSocketAddress omAddress = new InetSocketAddress(omInfo.getHostname(),
|
|
|
+ omInfo.getPort(ServicePort.Type.RPC));
|
|
|
Assert.assertEquals(NetUtils.createSocketAddr(
|
|
|
- conf.get(OZONE_KSM_ADDRESS_KEY)), ksmAddress);
|
|
|
+ conf.get(OZONE_OM_ADDRESS_KEY)), omAddress);
|
|
|
|
|
|
ServiceInfo scmInfo = services.stream().filter(
|
|
|
a -> a.getNodeType().equals(HddsProtos.NodeType.SCM))
|