use of alluxio.master.file.meta.MutableInodeFile in project alluxio by Alluxio.
the class InodeStoreTest method addRemoveAddList.
@Test
public void addRemoveAddList() {
writeInode(mRoot);
for (int i = 1; i < 10; i++) {
MutableInodeFile file = inodeFile(i, 0, "file" + i);
writeInode(file);
writeEdge(mRoot, file);
}
assertEquals(9, Iterables.size(mStore.getChildren(mRoot)));
for (Inode child : mStore.getChildren(mRoot)) {
MutableInode<?> childMut = mStore.getMutable(child.getId()).get();
removeParentEdge(childMut);
removeInode(childMut);
}
for (int i = 1; i < 10; i++) {
MutableInodeFile file = inodeFile(i, 0, "file" + i);
writeInode(file);
writeEdge(mRoot, file);
}
assertEquals(9, Iterables.size(mStore.getChildren(mRoot)));
}
use of alluxio.master.file.meta.MutableInodeFile in project alluxio by Alluxio.
the class CachingInodeStoreMockedBackingStoreTest method eviction.
@Test
public void eviction() {
for (int id = 100; id < 100 + CACHE_SIZE * 2; id++) {
MutableInodeFile child = MutableInodeFile.create(id, TEST_INODE_ID, "child" + id, 0, CreateFileContext.defaults());
mStore.writeNewInode(child);
mStore.addChild(TEST_INODE_ID, child);
}
for (int id = 100; id < 100 + CACHE_SIZE * 2; id++) {
assertTrue(mStore.getChild(TEST_INODE_DIR, "child" + id).isPresent());
}
verify(mBackingStore, Mockito.atLeastOnce()).getMutable(anyLong(), any(ReadOption.class));
}
use of alluxio.master.file.meta.MutableInodeFile in project alluxio by Alluxio.
the class CachingInodeStoreMockedBackingStoreTest method cacheGetChild.
@Test
public void cacheGetChild() {
MutableInodeFile child = MutableInodeFile.create(0, TEST_INODE_ID, "child", 0, CreateFileContext.defaults());
mStore.writeInode(child);
mStore.addChild(TEST_INODE_ID, child);
for (int i = 0; i < 10; i++) {
assertTrue(mStore.getChild(TEST_INODE_DIR, "child").isPresent());
}
verifyNoBackingStoreReads();
}
use of alluxio.master.file.meta.MutableInodeFile in project alluxio by Alluxio.
the class CachingInodeStoreMockedBackingStoreTest method cacheGetChildrenInodeLookups.
@Test
public void cacheGetChildrenInodeLookups() {
List<Inode> children = new ArrayList<>();
for (int id = 100; id < 110; id++) {
MutableInodeFile child = MutableInodeFile.create(id, TEST_INODE_ID, "child" + id, 0, CreateFileContext.defaults());
children.add(Inode.wrap(child));
mStore.writeNewInode(child);
mStore.addChild(TEST_INODE_ID, child);
}
assertEquals(10, Iterables.size(mStore.getChildren(TEST_INODE_DIR)));
verifyNoBackingStoreReads();
}
use of alluxio.master.file.meta.MutableInodeFile in project alluxio by Alluxio.
the class InodeStoreTest method batchWrite.
@Test
public void batchWrite() {
assumeTrue(mStore.supportsBatchWrite());
WriteBatch batch = mStore.createWriteBatch();
MutableInodeFile child = inodeFile(1, 0, "child");
batch.writeInode(child);
batch.addChild(mRoot.getId(), child.getName(), child.getId());
batch.commit();
assertEquals(Inode.wrap(child), mStore.get(child.getId()).get());
assertEquals(Inode.wrap(child), mStore.getChild(mRoot.getId(), child.getName()).get());
batch = mStore.createWriteBatch();
batch.removeInode(child.getId());
batch.removeChild(mRoot.getId(), child.getName());
batch.commit();
assertEquals(Optional.empty(), mStore.get(child.getId()));
assertEquals(Optional.empty(), mStore.getChild(mRoot.getId(), child.getName()));
}
Aggregations