Skip to content

Added REST and CLI tool to expose ManagedLedger metadata #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2017

Conversation

merlimat
Copy link
Contributor

Motivation

After enabling binary format for ManagedLedger metadata, we need a way to inspect
the metadata, parsing the binary protobuf format.

Modifications

Added REST, Java and CLI API to get the metadata dump. Any broker can answer the request, even if the ManagedLedger is not loaded at all.

New added command is:

$ bin/pulsar-admin persistent info-internal persistent://sample/standalone/ns1/my-topic

Output:

{
  "version": 8,
  "creationDate": "2017-03-13 21:00:56.594-0700",
  "modificationDate": "2017-03-13 23:14:20.308-0700",
  "ledgers": [
    {
      "ledgerId": 8
    }
  ],
  "cursors": {
    "sub": {
      "version": 8,
      "creationDate": "2017-03-13 21:00:56.844-0700",
      "modificationDate": "2017-03-13 23:15:21.236-0700",
      "cursorsLedgerId": -1,
      "markDelete": {
        "ledgerId": 8,
        "entryId": -1
      }
    }
  }
}

@merlimat merlimat added the type/feature The PR added a new feature or issue requested a new feature label Mar 14, 2017
@merlimat merlimat added this to the 1.17 milestone Mar 14, 2017
@merlimat merlimat self-assigned this Mar 14, 2017
@merlimat
Copy link
Contributor Author

This PR is the last piece missing to complete #281

@merlimat
Copy link
Contributor Author

Ping @saandrews @rdhabalia

@rdhabalia
Copy link
Contributor

yes, I will review it soon.


@Override
void run() throws PulsarAdminException {
String persistentTopic = validatePersistentTopic(params);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed here? Seems to be done inside getInternalInfo as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params is a list of string arguments. validatePersistentTopic() is being used for all the commands to extract the topic name and ensure there are no other trailing arguments.

Copy link
Contributor

@rdhabalia rdhabalia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just minor comments.

@@ -110,4 +110,10 @@
public void resetFailed(ManagedLedgerException exception, Object ctx);
}

public interface ManagedLedgerInfoCallback {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be as we have OpenLedgerCallback, should have GetLedgerInfoCallback with getLedgerInfoComplete()?

DestinationName ds = validateTopic(destination);
final CompletableFuture<JsonObject> future = new CompletableFuture<>();
asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internal-info"),
new InvocationCallback<String>() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if server serialize ManagedLedgerInfo into json then if pass InvocationCallback<ManagedLedgerInfo> here : is JAXB not able to parse it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for passing a JSONObject rather than a POJO is to avoid having the client depending on managed-ledger which is where the POJO is defined.

Copy link
Contributor

@rdhabalia rdhabalia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@merlimat merlimat merged commit 6710a7b into apache:master Mar 24, 2017
hrsakai pushed a commit to hrsakai/pulsar that referenced this pull request Dec 10, 2020
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
fix apache#289
upgrade pulsar dependency from `2.8.0-rc-202012200040` to `2.8.0-rc-202012242230`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature The PR added a new feature or issue requested a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants