apache /
kudu /
2a4b48bc7cd8a236fdce841e15f1d48941be8af8 [tool] Add output format for 'table list' CLI tool.
The output format could be one of 'json', 'json_compact' or 'pretty'.
The default format is 'pretty'. With this patch, we can get the table
info more convenient for automatic processing in case of large-scale cluster.
The command with 'list_table_output' looks like:
`kudu table list <master_addresses> [-tables=<tables>] [-list_tablets] [-show_table_info] [-negotiation_timeout_ms=<ms>] [-timeout_ms=<ms>] [-list_table_output_format=<pretty|json|json_compact>]`
The 'pretty' format output looks like:
`
TestTableListPartition num_tablets:4 num_replicas:1 live_row_count:0
T 390c65375d13434393d7152690e80082 : HASH (key_hash0) PARTITION 0, RANGE (key_range) PARTITION 0 <= VALUES < 1
L 7b12b3459e2943a981d22aa70b915637 tserver1:7050
T 7cff0635ec7446f883b6b2ed9c4bf7be : HASH (key_hash0) PARTITION 0, RANGE (key_range) PARTITION 2 <= VALUES < 3
L 7b12b3459e2943a981d22aa70b915637 tserver1:7050
T 45c347f165a945bd9f54f60758bb8953 : HASH (key_hash0) PARTITION 1, RANGE (key_range) PARTITION 0 <= VALUES < 1
L 7b12b3459e2943a981d22aa70b915637 tserver1:7050
T 3eed6166dcfa4e1d94e4c1ceb3f4f6eb : HASH (key_hash0) PARTITION 1, RANGE (key_range) PARTITION 2 <= VALUES < 3
L 7b12b3459e2943a981d22aa70b915637 tserver1:7050
`
The 'json' format output looks like:
`
{
"tables": [
{
"name": "TestTableListPartition",
"num_tablets": 4,
"num_replicas": 1,
"live_row_count": 0,
"tablet_with_partition": [
{
"tablet_id": "9db571acf0ca42baac6a70664b787556",
"partition_info": "HASH (key_hash0) PARTITION 0, RANGE (key_range) PARTITION 0 <= VALUES < 1",
"replica_info": [
{
"role": "L",
"uuid": "f103342fc91245b18f098d34b4f422ac",
"host_port": "tserver1:7050"
}
]
},
{
"tablet_id": "131aef39a8624ff5a6c47799e0556b52",
"partition_info": "HASH (key_hash0) PARTITION 0, RANGE (key_range) PARTITION 2 <= VALUES < 3",
"replica_info": [
{
"role": "L",
"uuid": "f103342fc91245b18f098d34b4f422ac",
"host_port": "tserver1:7050"
}
]
},
{
"tablet_id": "dbaef222684040f5bec60e5cc36df7d6",
"partition_info": "HASH (key_hash0) PARTITION 1, RANGE (key_range) PARTITION 0 <= VALUES < 1",
"replica_info": [
{
"role": "L",
"uuid": "f103342fc91245b18f098d34b4f422ac",
"host_port": "tserver1:7050"
}
]
},
{
"tablet_id": "f09ca0749c2641e988c02e8436e655d3",
"partition_info": "HASH (key_hash0) PARTITION 1, RANGE (key_range) PARTITION 2 <= VALUES < 3",
"replica_info": [
{
"role": "L",
"uuid": "f103342fc91245b18f098d34b4f422ac",
"host_port": "tserver1:7050"
}
]
}
]
}
]
}
`
The 'json_compact' format output looks like:
`
{"tables":[{"name":"TestTableListPartition","num_tablets":4,"num_replicas":1,"live_row_count":0,"tablet_with_partition":[{"tablet_id":"5fc45322b2ec4cd0be050ea1814349e6","partition_info": "HASH (key_hash0) PARTITION 0, RANGE (key_range) PARTITION 0 <= VALUES < 1","replica_info":[{"role":"L","uuid":"e714a8155d5649a98a30af3ec3a6f0e5","host_port":"tserver1:7050"}]},{"tablet_id":"c4279b3929084c0697e2922d351ab369","partition_info": "HASH (key_hash0) PARTITION 0, RANGE (key_range) PARTITION 2 <= VALUES < 3","replica_info":[{"role":"L","uuid":"e714a8155d5649a98a30af3ec3a6f0e5","host_port":"tserver1:7050"}]},{"tablet_id":"b2603ff3eaad45dcb7f4906355183ba5","partition_info": "HASH (key_hash0) PARTITION 1, RANGE (key_range) PARTITION 0 <= VALUES < 1","replica_info":[{"role":"L","uuid":"e714a8155d5649a98a30af3ec3a6f0e5","host_port":"tserver1:7050"}]},{"tablet_id":"88c8e5bcd4f24ae2a8ac87a6ba9d9ec3","partition_info": "HASH (key_hash0) PARTITION 1, RANGE (key_range) PARTITION 2 <= VALUES < 3","replica_info":[{"role":"L","uuid":"e714a8155d5649a98a30af3ec3a6f0e5","host_port":"tserver1:7050"}]}]}]}
`
Change-Id: I3aaec73e18872fc93646e9c0ea675b578b0702f0
Reviewed-on: http://gerrit.cloudera.org:8080/18834
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <alexey@apache.org>
4 files changed