Source:
public int loadTable(String namespace, String tablename, int numItems, int batchSize, int itemSize) { verifyNamespaceAndTablename(namespace, tablename); CorfuStore store = new CorfuStore(runtime); try { TableOptions.TableOptionsBuilder<Object, Object> optionsBuilder = TableOptions.builder(); if (diskPath != null) { optionsBuilder.persistentDataPath(Paths.get(diskPath)); } final Table<TableName, TableName, CorfuStoreMetadata.Timestamp> table = store.openTable( namespace, tablename, TableName.class, TableName.class, CorfuStoreMetadata.Timestamp.class, optionsBuilder.build()); byte[] array = new byte[itemSize]; new Random().nextBytes(array); TableName dummyVal = TableName.newBuilder().setNamespace(namespace+tablename) .setTableName(new String(array, StandardCharsets.UTF_16)).build(); log.info("WARNING: Loading items of size in batchSized transactions into {}${}", numItems, itemSize, batchSize, namespace, tablename); int itemsRemaining = numItems; while (itemsRemaining > 0) { log.info("loadTable: Items left {}", itemsRemaining); TxnContext tx = store.txn(namespace); for (int j = batchSize; j > 0 && itemsRemaining > 0; j--, itemsRemaining--) { TableName dummyKey = TableName.newBuilder() .setNamespace(Integer.toString(itemsRemaining)) .setTableName(Integer.toString(j)).build(); CorfuStoreMetadata.Timestamp ts = CorfuStoreMetadata.Timestamp.newBuilder() .setEpoch(0) .setSequence(System.currentTimeMillis()) .build(); tx.putRecord(table, dummyKey, dummyVal, ts); } tx.commit(); } } catch (Exception e) { log.error("loadTable: failed.", namespace, tablename, numItems, batchSize, e); } return (int)(Math.ceil((double)numItems/batchSize)); }

Target:
public int loadTable(String namespace, String tablename, int numItems, int batchSize, int itemSize) { verifyNamespaceAndTablename(namespace, tablename); CorfuStoreShim store = new CorfuStoreShim(runtime); try { TableOptions.TableOptionsBuilder<Object, Object> optionsBuilder = TableOptions.builder(); if (diskPath != null) { optionsBuilder.persistentDataPath(Paths.get(diskPath)); } final Table<TableName, TableName, ManagedMetadata> table = store.openTable( namespace, tablename, TableName.class, TableName.class, ManagedMetadata.class, optionsBuilder.build()); byte[] array = new byte[itemSize]; new Random().nextBytes(array); TableName dummyVal = TableName.newBuilder().setNamespace(namespace+tablename) .setTableName(new String(array, StandardCharsets.UTF_16)).build(); log.info("WARNING: Loading items of size in batchSized transactions into {}${}", numItems, itemSize, batchSize, namespace, tablename); int itemsRemaining = numItems; while (itemsRemaining > 0) { TxnContextShim tx = store.txn(namespace); for (int j = batchSize; j > 0 && itemsRemaining > 0; j--, itemsRemaining--) { TableName dummyKey = TableName.newBuilder() .setNamespace(Integer.toString(itemsRemaining)) .setTableName(Integer.toString(j)).build(); tx.putRecord(table, dummyKey, dummyVal, ManagedMetadata.getDefaultInstance()); } long address = tx.commit(); log.info("loadTable: Txn at address {}. Items now left {}", address, itemsRemaining); } } catch (Exception e) { log.error("loadTable: failed.", namespace, tablename, numItems, batchSize, e); } return (int)(Math.ceil((double)numItems/batchSize)); }