avijayanhwx commented on a change in pull request #1033: HDDS-1391 : Add 
ability in OM to serve delta updates through an API.
URL: https://github.com/apache/hadoop/pull/1033#discussion_r307536807
 
 

 ##########
 File path: 
hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/RDBStore.java
 ##########
 @@ -327,6 +329,44 @@ public CodecRegistry getCodecRegistry() {
     return codecRegistry;
   }
 
+  @Override
+  public DBUpdatesWrapper getUpdatesSince(long sequenceNumber)
+      throws SequenceNumberNotFoundException {
+
+    DBUpdatesWrapper dbUpdatesWrapper = new DBUpdatesWrapper();
+    try {
+      TransactionLogIterator transactionLogIterator =
+          db.getUpdatesSince(sequenceNumber);
+
+      boolean flag = true;
+
+      while (transactionLogIterator.isValid()) {
+        TransactionLogIterator.BatchResult result =
+            transactionLogIterator.getBatch();
+        long currSequenceNumber = result.sequenceNumber();
+        if (flag && currSequenceNumber > 1 + sequenceNumber) {
+          throw new SequenceNumberNotFoundException("Unable to read data from" 
+
+              " RocksDB wal to get delta updates. It may have already been" +
+              "flushed to SSTs.");
+        }
+        flag = false;
+        if (currSequenceNumber == sequenceNumber) {
+          transactionLogIterator.next();
+          continue;
+        }
+        WriteBatch writeBatch = result.writeBatch();
+        byte[] writeBatchData = writeBatch.data();
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to