HDFS-12366. Ozone: Refactor KSM metadata class names to avoid confusion. Contributed by Weiwei Yang.

This commit is contained in:
Anu Engineer 2017-08-29 13:57:51 -07:00 committed by Owen O'Malley
parent 7b3e7eb565
commit ca72c2342c
7 changed files with 27 additions and 27 deletions

View File

@ -39,15 +39,15 @@ public class BucketManagerImpl implements BucketManager {
LoggerFactory.getLogger(BucketManagerImpl.class);
/**
* MetadataManager is used for accessing KSM MetadataDB and ReadWriteLock.
* KSMMetadataManager is used for accessing KSM MetadataDB and ReadWriteLock.
*/
private final MetadataManager metadataManager;
private final KSMMetadataManager metadataManager;
/**
* Constructs BucketManager.
* @param metadataManager
*/
public BucketManagerImpl(MetadataManager metadataManager){
public BucketManagerImpl(KSMMetadataManager metadataManager){
this.metadataManager = metadataManager;
}

View File

@ -30,7 +30,7 @@ import java.util.concurrent.locks.Lock;
/**
* KSM metadata manager interface.
*/
public interface MetadataManager {
public interface KSMMetadataManager {
/**
* Start metadata manager.
*/

View File

@ -58,13 +58,13 @@ import static org.apache.hadoop.ozone.ksm.KSMConfigKeys
/**
* KSM metadata manager interface.
*/
public class MetadataManagerImpl implements MetadataManager {
public class KSMMetadataManagerImpl implements KSMMetadataManager {
private final MetadataStore store;
private final ReadWriteLock lock;
public MetadataManagerImpl(OzoneConfiguration conf) throws IOException {
public KSMMetadataManagerImpl(OzoneConfiguration conf) throws IOException {
File metaDir = OzoneUtils.getScmMetadirPath(conf);
final int cacheSize = conf.getInt(OZONE_KSM_DB_CACHE_SIZE_MB,
OZONE_KSM_DB_CACHE_SIZE_DEFAULT);

View File

@ -50,11 +50,11 @@ public class KeyManagerImpl implements KeyManager {
* A SCM block client, used to talk to SCM to allocate block during putKey.
*/
private final ScmBlockLocationProtocol scmBlockClient;
private final MetadataManager metadataManager;
private final KSMMetadataManager metadataManager;
private final long scmBlockSize;
public KeyManagerImpl(ScmBlockLocationProtocol scmBlockClient,
MetadataManager metadataManager, OzoneConfiguration conf) {
KSMMetadataManager metadataManager, OzoneConfiguration conf) {
this.scmBlockClient = scmBlockClient;
this.metadataManager = metadataManager;
this.scmBlockSize = conf.getLong(OZONE_SCM_BLOCK_SIZE_KEY,

View File

@ -78,7 +78,7 @@ public class KeySpaceManager extends ServiceRuntimeInfoImpl
private final RPC.Server ksmRpcServer;
private final InetSocketAddress ksmRpcAddress;
private final MetadataManager metadataManager;
private final KSMMetadataManager metadataManager;
private final VolumeManager volumeManager;
private final BucketManager bucketManager;
private final KeyManager keyManager;
@ -102,7 +102,7 @@ public class KeySpaceManager extends ServiceRuntimeInfoImpl
handlerCount);
ksmRpcAddress = OzoneClientUtils.updateRPCListenAddress(conf,
OZONE_KSM_ADDRESS_KEY, ksmNodeRpcAddr, ksmRpcServer);
metadataManager = new MetadataManagerImpl(conf);
metadataManager = new KSMMetadataManagerImpl(conf);
volumeManager = new VolumeManagerImpl(metadataManager, conf);
bucketManager = new BucketManagerImpl(metadataManager);
metrics = KSMMetrics.create();
@ -168,7 +168,7 @@ public class KeySpaceManager extends ServiceRuntimeInfoImpl
* Get metadata manager.
* @return metadata manager.
*/
public MetadataManager getMetadataManager() {
public KSMMetadataManager getMetadataManager() {
return metadataManager;
}

View File

@ -46,7 +46,7 @@ public class VolumeManagerImpl implements VolumeManager {
private static final Logger LOG =
LoggerFactory.getLogger(VolumeManagerImpl.class);
private final MetadataManager metadataManager;
private final KSMMetadataManager metadataManager;
private final int maxUserVolumeCount;
/**
@ -54,7 +54,7 @@ public class VolumeManagerImpl implements VolumeManager {
* @param conf - Ozone configuration.
* @throws IOException
*/
public VolumeManagerImpl(MetadataManager metadataManager,
public VolumeManagerImpl(KSMMetadataManager metadataManager,
OzoneConfiguration conf) throws IOException {
this.metadataManager = metadataManager;
this.maxUserVolumeCount = conf.getInt(OZONE_KSM_USER_MAX_VOLUME,

View File

@ -47,16 +47,16 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import static org.mockito.Mockito.any;
/**
* Tests BucketManagerImpl, mocks MetadataManager for testing.
* Tests BucketManagerImpl, mocks KSMMetadataManager for testing.
*/
@RunWith(MockitoJUnitRunner.class)
public class TestBucketManagerImpl {
@Rule
public ExpectedException thrown = ExpectedException.none();
private MetadataManager getMetadataManagerMock(String... volumesToCreate)
private KSMMetadataManager getMetadataManagerMock(String... volumesToCreate)
throws IOException {
MetadataManager metadataManager = Mockito.mock(MetadataManager.class);
KSMMetadataManager metadataManager = Mockito.mock(KSMMetadataManager.class);
Map<String, byte[]> metadataDB = new HashMap<>();
ReadWriteLock lock = new ReentrantReadWriteLock();
@ -133,7 +133,7 @@ public class TestBucketManagerImpl {
@Test
public void testCreateBucketWithoutVolume() throws IOException {
thrown.expectMessage("Volume doesn't exist");
MetadataManager metaMgr = getMetadataManagerMock();
KSMMetadataManager metaMgr = getMetadataManagerMock();
try {
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
@ -150,7 +150,7 @@ public class TestBucketManagerImpl {
@Test
public void testCreateBucket() throws IOException {
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
.setVolumeName("sampleVol")
@ -163,7 +163,7 @@ public class TestBucketManagerImpl {
@Test
public void testCreateAlreadyExistingBucket() throws IOException {
thrown.expectMessage("Bucket already exist");
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
try {
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
@ -183,7 +183,7 @@ public class TestBucketManagerImpl {
public void testGetBucketInfoForInvalidBucket() throws IOException {
thrown.expectMessage("Bucket not found");
try {
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
bucketManager.getBucketInfo("sampleVol", "bucketOne");
} catch(KSMException ksmEx) {
@ -195,7 +195,7 @@ public class TestBucketManagerImpl {
@Test
public void testGetBucketInfo() throws IOException {
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
.setVolumeName("sampleVol")
@ -215,7 +215,7 @@ public class TestBucketManagerImpl {
@Test
public void testSetBucketPropertyAddACL() throws IOException {
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
List<OzoneAcl> acls = new LinkedList<>();
OzoneAcl ozoneAcl = new OzoneAcl(OzoneAcl.OzoneACLType.USER,
"root", OzoneAcl.OzoneACLRights.READ);
@ -252,7 +252,7 @@ public class TestBucketManagerImpl {
@Test
public void testSetBucketPropertyRemoveACL() throws IOException {
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
List<OzoneAcl> acls = new LinkedList<>();
OzoneAcl aclOne = new OzoneAcl(OzoneAcl.OzoneACLType.USER,
"root", OzoneAcl.OzoneACLRights.READ);
@ -288,7 +288,7 @@ public class TestBucketManagerImpl {
@Test
public void testSetBucketPropertyChangeStorageType() throws IOException {
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
.setVolumeName("sampleVol")
@ -314,7 +314,7 @@ public class TestBucketManagerImpl {
@Test
public void testSetBucketPropertyChangeVersioning() throws IOException {
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
.setVolumeName("sampleVol")
@ -339,7 +339,7 @@ public class TestBucketManagerImpl {
@Test
public void testDeleteBucket() throws IOException {
thrown.expectMessage("Bucket not found");
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
for(int i = 0; i < 5; i++) {
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
@ -372,7 +372,7 @@ public class TestBucketManagerImpl {
@Test
public void testDeleteNonEmptyBucket() throws IOException {
thrown.expectMessage("Bucket is not empty");
MetadataManager metaMgr = getMetadataManagerMock("sampleVol");
KSMMetadataManager metaMgr = getMetadataManagerMock("sampleVol");
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
KsmBucketInfo bucketInfo = KsmBucketInfo.newBuilder()
.setVolumeName("sampleVol")