Skip to content
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

[Issue 5902] Support to get managed ledger info of a partitioned topic #6532

Merged
merged 2 commits into from
Mar 18, 2020

Conversation

murong00
Copy link
Contributor

Motivation

Fixes #5902

If there is a partitioned topic with too many partitions, users need to get the internal-info one by one. If called internal-info on a partitioned topic, it fails as below:

$ bin/pulsar-admin topics info-internal persistent://public/default/test2
HTTP 400 Bad Request

Reason: HTTP 400 Bad Request

Modifications

Support to get all partitions internal-info of a partitioned topic, seems like below:

$ bin/pulsar-admin topics info-internal persistent://public/default/test2
{
  "version": 0,
  "partitions": {
    "persistent://public/default/test2-partition-1": {
      "version": 1,
      "creationDate": "2020-03-12T21:24:52.777+08:00",
      "modificationDate": "2020-03-12T21:25:50.85+08:00",
      "ledgers": [
        {
          "ledgerId": 16
        }
      ],
      "cursors": {
        "test2-sub": {
          "version": 0,
          "creationDate": "2020-03-12T21:25:51.178+08:00",
          "modificationDate": "2020-03-12T21:25:51.178+08:00",
          "cursorsLedgerId": 18,
          "markDelete": {
            "ledgerId": 16,
            "entryId": -1
          }
        }
      }
    },
    "persistent://public/default/test2-partition-0": {
      "version": 1,
      "creationDate": "2020-03-12T21:24:52.777+08:00",
      "modificationDate": "2020-03-12T21:25:50.952+08:00",
      "ledgers": [
        {
          "ledgerId": 17
        }
      ],
      "cursors": {
        "test2-sub": {
          "version": 0,
          "creationDate": "2020-03-12T21:25:51.177+08:00",
          "modificationDate": "2020-03-12T21:25:51.177+08:00",
          "cursorsLedgerId": 19,
          "markDelete": {
            "ledgerId": 17,
            "entryId": -1
          }
        }
      }
    }
  }
}

@murong00
Copy link
Contributor Author

/pulsarbot run-failure-checks

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

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

Looks good to me, just left a minor comment.


import java.util.Map;

public class PartitionedManagedLedgerInfo extends ManagedLedgerInfo {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to move it to the broker module since the mledger does not have any concepts about partition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@murong00
Copy link
Contributor Author

@codelipenghui Please help to review again, thanks.

@codelipenghui
Copy link
Contributor

/pulsarbot run-failure-checks

1 similar comment
@murong00
Copy link
Contributor Author

/pulsarbot run-failure-checks

@sijie sijie added the doc-required Your PR changes impact docs and you will update later. label Mar 18, 2020
@sijie sijie merged commit f59d611 into apache:master Mar 18, 2020
@Anonymitaet Anonymitaet removed the doc-required Your PR changes impact docs and you will update later. label Jun 10, 2020
@Anonymitaet
Copy link
Member

huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
apache#6532)

### Motivation

Fixes apache#5902

If there is a partitioned topic with too many partitions, users need to get the `internal-info` one by one. If called `internal-info` on a partitioned topic, it fails as below:

```
$ bin/pulsar-admin topics info-internal persistent://public/default/test2
HTTP 400 Bad Request

Reason: HTTP 400 Bad Request
```

### Modifications

Support to get all partitions `internal-info` of a partitioned topic, seems like below:

```
$ bin/pulsar-admin topics info-internal persistent://public/default/test2
{
  "version": 0,
  "partitions": {
    "persistent://public/default/test2-partition-1": {
      "version": 1,
      "creationDate": "2020-03-12T21:24:52.777+08:00",
      "modificationDate": "2020-03-12T21:25:50.85+08:00",
      "ledgers": [
        {
          "ledgerId": 16
        }
      ],
      "cursors": {
        "test2-sub": {
          "version": 0,
          "creationDate": "2020-03-12T21:25:51.178+08:00",
          "modificationDate": "2020-03-12T21:25:51.178+08:00",
          "cursorsLedgerId": 18,
          "markDelete": {
            "ledgerId": 16,
            "entryId": -1
          }
        }
      }
    },
    "persistent://public/default/test2-partition-0": {
      "version": 1,
      "creationDate": "2020-03-12T21:24:52.777+08:00",
      "modificationDate": "2020-03-12T21:25:50.952+08:00",
      "ledgers": [
        {
          "ledgerId": 17
        }
      ],
      "cursors": {
        "test2-sub": {
          "version": 0,
          "creationDate": "2020-03-12T21:25:51.177+08:00",
          "modificationDate": "2020-03-12T21:25:51.177+08:00",
          "cursorsLedgerId": 19,
          "markDelete": {
            "ledgerId": 17,
            "entryId": -1
          }
        }
      }
    }
  }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pulsar-broker][REST API] Support get all partitions internal-info of a partitioned topic
5 participants