pulsarctl
pulsarctl copied to clipboard
fix: add id field to bookie socket address struct
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.
It respects the latest bookkeeper rest api, looks good to me.
@zymap Update the bk image will cause the test to fail, I will make a PR after this PR is merged into master.
But we need a test to cover this, no?
@zymap I can add a test to check the id field or host and port field exists.
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 Please take a look.