use of alluxio.master.metastore.InodeStore.WriteBatch in project alluxio by Alluxio.
the class RocksInodeStoreTest method batchWrite.
@Test
public void batchWrite() throws IOException {
RocksInodeStore store = new RocksInodeStore(mFolder.newFolder().getAbsolutePath());
WriteBatch batch = store.createWriteBatch();
for (int i = 1; i < 20; i++) {
batch.writeInode(MutableInodeDirectory.create(i, 0, "dir" + i, CreateDirectoryContext.defaults()));
}
batch.commit();
for (int i = 1; i < 20; i++) {
assertEquals("dir" + i, store.get(i).get().getName());
}
}
use of alluxio.master.metastore.InodeStore.WriteBatch 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