Loading kinetic-simulator/src/main/java/com/seagate/kinetic/simulator/internal/BatchOperationHandler.java +17 −8 Original line number Diff line number Diff line Loading @@ -245,16 +245,9 @@ public class BatchOperationHandler { ByteString requestDbVersion = requestKeyValue.getDbVersion(); ByteString storeDbVersion = null; ByteString key = requestKeyValue.getKey(); @SuppressWarnings("unchecked") KVValue storeKv = (KVValue) store.get(key); if (storeKv != null) { storeDbVersion = storeKv.getVersion(); } ByteString storeDbVersion = this.getDbVersion(key); logger.info("*********comparing version., storeV=" + storeDbVersion + "requestV=" + requestDbVersion); Loading @@ -264,6 +257,22 @@ public class BatchOperationHandler { logger.info("*********batch op version checked and passed ..."); } @SuppressWarnings("unchecked") private ByteString getDbVersion(ByteString key) { KVValue storeKv = null; ByteString storeDbVersion = null; try { storeKv = (KVValue) store.get(key); storeDbVersion = storeKv.getVersion(); } catch (Exception e) { ; } return storeDbVersion; } public synchronized boolean isClosed() { return this.isEndBatch; } Loading kinetic-test/src/test/java/com/seagate/kinetic/example/batchop/BatchOperationExample.java +5 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ public class BatchOperationExample implements CallbackHandler<Entry> { client.putForced(bar); // delete foo if existed client.deleteForced("foo".getBytes("UTF8")); logger.info("*** starting batch operation ..."); // start batch a new batch operation Loading @@ -74,9 +77,9 @@ public class BatchOperationExample implements CallbackHandler<Entry> { Entry foo = new Entry(); foo.setKey("foo".getBytes("UTF8")); foo.setValue("foo".getBytes("UTF8")); foo.getEntryMetadata().setVersion("5678".getBytes("UTF8")); // foo.getEntryMetadata().setVersion("5678".getBytes("UTF8")); batch.putForcedAsync(foo, this); batch.putAsync(foo, "5678".getBytes("UTF8"), this); // delete bar DeleteCbHandler dhandler = new DeleteCbHandler(); Loading Loading
kinetic-simulator/src/main/java/com/seagate/kinetic/simulator/internal/BatchOperationHandler.java +17 −8 Original line number Diff line number Diff line Loading @@ -245,16 +245,9 @@ public class BatchOperationHandler { ByteString requestDbVersion = requestKeyValue.getDbVersion(); ByteString storeDbVersion = null; ByteString key = requestKeyValue.getKey(); @SuppressWarnings("unchecked") KVValue storeKv = (KVValue) store.get(key); if (storeKv != null) { storeDbVersion = storeKv.getVersion(); } ByteString storeDbVersion = this.getDbVersion(key); logger.info("*********comparing version., storeV=" + storeDbVersion + "requestV=" + requestDbVersion); Loading @@ -264,6 +257,22 @@ public class BatchOperationHandler { logger.info("*********batch op version checked and passed ..."); } @SuppressWarnings("unchecked") private ByteString getDbVersion(ByteString key) { KVValue storeKv = null; ByteString storeDbVersion = null; try { storeKv = (KVValue) store.get(key); storeDbVersion = storeKv.getVersion(); } catch (Exception e) { ; } return storeDbVersion; } public synchronized boolean isClosed() { return this.isEndBatch; } Loading
kinetic-test/src/test/java/com/seagate/kinetic/example/batchop/BatchOperationExample.java +5 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ public class BatchOperationExample implements CallbackHandler<Entry> { client.putForced(bar); // delete foo if existed client.deleteForced("foo".getBytes("UTF8")); logger.info("*** starting batch operation ..."); // start batch a new batch operation Loading @@ -74,9 +77,9 @@ public class BatchOperationExample implements CallbackHandler<Entry> { Entry foo = new Entry(); foo.setKey("foo".getBytes("UTF8")); foo.setValue("foo".getBytes("UTF8")); foo.getEntryMetadata().setVersion("5678".getBytes("UTF8")); // foo.getEntryMetadata().setVersion("5678".getBytes("UTF8")); batch.putForcedAsync(foo, this); batch.putAsync(foo, "5678".getBytes("UTF8"), this); // delete bar DeleteCbHandler dhandler = new DeleteCbHandler(); Loading