pulsarctl icon indicating copy to clipboard operation
pulsarctl copied to clipboard

fix: add id field to bookie socket address struct

Open nodece opened this issue 3 years ago • 6 comments

Signed-off-by: Zixuan Liu [email protected]

Fix #523

When get the ledger info by pulsarctl bookkeeper ledger get 0, this command returns the following body:

{
  "0": {
    "storeCtime": false,
    "hasPassword": false,
    "metadataFormatVersion": 3,
    "ensembleSize": 1,
    "writeQuorumSize": 1,
    "ackQuorumSize": 1,
    "length": 0,
    "lastEntryId": -1,
    "ctime": 1640766195984,
    "cToken": 4093019187836386319,
    "state": "OPEN",
    "digestType": "CRC32C",
    "allEnsembles": {
      "0": [
        {
          "port": 0,
          "hostname": ""
        }
      ]
    },
    "currentEnsemble": null,
    "password": "",
    "customMetadata": {
      "application": "cHVsc2Fy",
      "component": "bWFuYWdlZC1sZWRnZXI=",
      "pulsar/managed-ledger": "cHVsc2FyL2NsdXN0ZXItYS8xMjcuMC4wLjE6ODA4MS9wZXJzaXN0ZW50L19fY2hhbmdlX2V2ZW50cw=="
    }
  }
}

The allEnsembles.0.id and allEnsembles.0.hostname is nil value. In face, it should be non-nil value.

I checked the bk repo and found the https://github.com/apache/bookkeeper/pull/2404 changes this behavior, so add the id field with omitempty to bookie socket address struct for compatibility.

nodece avatar Dec 29 '21 08:12 nodece

It respects the latest bookkeeper rest api, looks good to me.

Shawyeok avatar Dec 29 '21 10:12 Shawyeok

@zymap Update the bk image will cause the test to fail, I will make a PR after this PR is merged into master.

nodece avatar Jan 04 '22 11:01 nodece

But we need a test to cover this, no?

zymap avatar Jan 05 '22 01:01 zymap

@zymap I can add a test to check the id field or host and port field exists.

nodece avatar Jan 05 '22 02:01 nodece

The tests which failed mean there have other commands that can't run with the latest bookkeeper, we need to update the bookkeeper to the latest to make sure other commands can run well with the latest bookkeeper. You can do this in another PR as well.

zymap avatar Jan 05 '22 02:01 zymap

@zymap Please take a look.

nodece avatar Jan 08 '22 16:01 nodece