lucperkins commented on a change in pull request #1865: CLI for offload
URL: https://github.com/apache/incubator-pulsar/pull/1865#discussion_r191881259
 
 

 ##########
 File path: 
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
 ##########
 @@ -614,6 +618,93 @@ void run() throws PulsarAdminException {
         }
     }
 
+    static MessageId 
findFirstLedgerWithinThreshold(List<PersistentTopicInternalStats.LedgerInfo> 
ledgers,
+                                                    long sizeThreshold) {
+        long suffixSize = 0L;
+
+        ledgers = Lists.reverse(ledgers);
+        for (PersistentTopicInternalStats.LedgerInfo l : ledgers) {
+            suffixSize += l.size;
+            if (suffixSize >= sizeThreshold) {
+                return new MessageIdImpl(l.ledgerId, 0L, -1);
+            }
+        }
+        return null;
+    }
+
+    @Parameters(commandDescription = "Trigger offload data from a topic to 
long term storage")
 
 Review comment:
   "Trigger offload of data from a topic to long-term storage"

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


With regards,
Apache Git Services

Reply via email to