Anonymitaet commented on a change in pull request #10853:
URL: https://github.com/apache/pulsar/pull/10853#discussion_r647306197
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/PersistentTopics.java
##########
@@ -662,6 +662,35 @@ public PersistentOfflineTopicStats
getBacklog(@PathParam("property") String prop
return internalGetBacklog(authoritative);
}
+ @GET
+
@Path("/{property}/{cluster}/{namespace}/{topic}/ledger/{ledgerId}/entry/{entryId}/checkLedgerExists/{checkLedgerExists}/backlogSize")
+ @ApiOperation(value = "Calculate backlog size given a messageId.")
Review comment:
```suggestion
@ApiOperation(value = "Calculate backlog size by a message ID (in
bytes).")
```
Do you mean this?
##########
File path:
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java
##########
@@ -1596,6 +1596,36 @@ void createSubscription(String topic, String
subscriptionName, MessageId message
Map<BacklogQuota.BacklogQuotaType, BacklogQuota> getBacklogQuotaMap(String
topic, boolean applied)
throws PulsarAdminException;
+ /**
+ * Get backlog size by its messageId.
+ * @param topic
+ * Topic name
+ * @param ledgerId
+ * Ledger id
Review comment:
```suggestion
* Ledger ID
```
##########
File path:
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java
##########
@@ -1596,6 +1596,36 @@ void createSubscription(String topic, String
subscriptionName, MessageId message
Map<BacklogQuota.BacklogQuotaType, BacklogQuota> getBacklogQuotaMap(String
topic, boolean applied)
throws PulsarAdminException;
+ /**
+ * Get backlog size by its messageId.
+ * @param topic
+ * Topic name
+ * @param ledgerId
+ * Ledger id
+ * @param entryId
+ * Entry id
Review comment:
```suggestion
* Entry ID
```
##########
File path:
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java
##########
@@ -1596,6 +1596,36 @@ void createSubscription(String topic, String
subscriptionName, MessageId message
Map<BacklogQuota.BacklogQuotaType, BacklogQuota> getBacklogQuotaMap(String
topic, boolean applied)
throws PulsarAdminException;
+ /**
+ * Get backlog size by its messageId.
Review comment:
same
##########
File path:
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
##########
@@ -2279,4 +2279,27 @@ void run() throws PulsarAdminException {
private Topics getTopics() {
return getAdmin().topics();
}
+
+ @Parameters(commandDescription = "Calculate backlog size given a
messageId.")
Review comment:
same
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
##########
@@ -1458,6 +1458,37 @@ public PersistentOfflineTopicStats getBacklog(
return internalGetBacklog(authoritative);
}
+ @GET
+
@Path("/{tenant}/{namespace}/{topic}/ledger/{ledgerId}/entry/{entryId}/checkLedgerExists/{checkLedgerExists}/backlogSize")
+ @ApiOperation(value = "Calculate backlog size given a messageId.")
Review comment:
same
##########
File path:
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java
##########
@@ -1596,6 +1596,36 @@ void createSubscription(String topic, String
subscriptionName, MessageId message
Map<BacklogQuota.BacklogQuotaType, BacklogQuota> getBacklogQuotaMap(String
topic, boolean applied)
throws PulsarAdminException;
+ /**
+ * Get backlog size by its messageId.
+ * @param topic
+ * Topic name
+ * @param ledgerId
+ * Ledger id
+ * @param entryId
+ * Entry id
+ * @param checkLedgerExists
+ * checkLedgerExists
+ * @return the backlog size from
+ * @throws PulsarAdminException
+ * Unexpected error
+ */
+ Long getBacklogSizeByMessageId(String topic, long ledgerId, long entryId,
boolean checkLedgerExists) throws PulsarAdminException;
+
+ /**
+ * Get backlog size by its messageId Async.
Review comment:
```suggestion
* Get backlog size by a message ID asynchronously.
```
##########
File path:
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java
##########
@@ -1596,6 +1596,36 @@ void createSubscription(String topic, String
subscriptionName, MessageId message
Map<BacklogQuota.BacklogQuotaType, BacklogQuota> getBacklogQuotaMap(String
topic, boolean applied)
throws PulsarAdminException;
+ /**
+ * Get backlog size by its messageId.
+ * @param topic
+ * Topic name
+ * @param ledgerId
+ * Ledger id
+ * @param entryId
+ * Entry id
+ * @param checkLedgerExists
+ * checkLedgerExists
+ * @return the backlog size from
+ * @throws PulsarAdminException
+ * Unexpected error
+ */
+ Long getBacklogSizeByMessageId(String topic, long ledgerId, long entryId,
boolean checkLedgerExists) throws PulsarAdminException;
+
+ /**
+ * Get backlog size by its messageId Async.
+ * @param topic
+ * Topic name
+ * @param ledgerId
+ * Ledger id
+ * @param entryId
+ * Entry id
Review comment:
same
##########
File path:
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
##########
@@ -2279,4 +2279,27 @@ void run() throws PulsarAdminException {
private Topics getTopics() {
return getAdmin().topics();
}
+
+ @Parameters(commandDescription = "Calculate backlog size given a
messageId.")
+ private class GetBacklogSizeByMessageId extends CliCommand {
+ @Parameter(description = "persistent://tenant/namespace/topic",
required = true)
+ private java.util.List<String> params;
+
+ @Parameter(names = { "-l", "--ledgerId" },
+ description = "ledger id pointing to the desired ledger",
Review comment:
ID
##########
File path:
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
##########
@@ -2279,4 +2279,27 @@ void run() throws PulsarAdminException {
private Topics getTopics() {
return getAdmin().topics();
}
+
+ @Parameters(commandDescription = "Calculate backlog size given a
messageId.")
+ private class GetBacklogSizeByMessageId extends CliCommand {
+ @Parameter(description = "persistent://tenant/namespace/topic",
required = true)
+ private java.util.List<String> params;
+
+ @Parameter(names = { "-l", "--ledgerId" },
+ description = "ledger id pointing to the desired ledger",
+ required = true)
+ private long ledgerId;
+
+ @Parameter(names = { "-e", "--entryId" },
+ description = "entry id pointing to the desired entry",
Review comment:
ID
--
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:
[email protected]