| 395 | } |
| 396 | |
| 397 | __attribute__((unused)) static void PrintTableInformation( |
| 398 | std::vector<::fedb::nameserver::TableInfo>& tables) { // NOLINT |
| 399 | if (tables.empty()) { |
| 400 | return; |
| 401 | } |
| 402 | ::fedb::nameserver::TableInfo table = tables[0]; |
| 403 | std::vector<std::string> row; |
| 404 | row.push_back("attribute"); |
| 405 | row.push_back("value"); |
| 406 | ::baidu::common::TPrinter tp(row.size(), FLAGS_max_col_display_length); |
| 407 | tp.AddRow(row); |
| 408 | ::fedb::common::TTLSt ttl_st; |
| 409 | std::string name = table.name(); |
| 410 | std::string replica_num = std::to_string(table.replica_num()); |
| 411 | std::string partition_num = std::to_string(table.partition_num()); |
| 412 | std::string compress_type = |
| 413 | ::fedb::type::CompressType_Name(table.compress_type()); |
| 414 | uint64_t record_cnt = 0; |
| 415 | uint64_t memused = 0; |
| 416 | uint64_t diskused = 0; |
| 417 | for (int idx = 0; idx < table.table_partition_size(); idx++) { |
| 418 | record_cnt += table.table_partition(idx).record_cnt(); |
| 419 | memused += table.table_partition(idx).record_byte_size(); |
| 420 | diskused += table.table_partition(idx).diskused(); |
| 421 | } |
| 422 | row.clear(); |
| 423 | row.push_back("name"); |
| 424 | row.push_back(name); |
| 425 | tp.AddRow(row); |
| 426 | row.clear(); |
| 427 | row.push_back("replica_num"); |
| 428 | row.push_back(replica_num); |
| 429 | tp.AddRow(row); |
| 430 | row.clear(); |
| 431 | row.push_back("partition_num"); |
| 432 | row.push_back(partition_num); |
| 433 | tp.AddRow(row); |
| 434 | row.clear(); |
| 435 | row.push_back("compress_type"); |
| 436 | row.push_back(compress_type); |
| 437 | tp.AddRow(row); |
| 438 | row.clear(); |
| 439 | row.push_back("record_cnt"); |
| 440 | row.push_back(std::to_string(record_cnt)); |
| 441 | tp.AddRow(row); |
| 442 | row.clear(); |
| 443 | row.push_back("memused"); |
| 444 | row.push_back(::fedb::base::HumanReadableString(memused)); |
| 445 | tp.AddRow(row); |
| 446 | row.clear(); |
| 447 | row.push_back("diskused"); |
| 448 | row.push_back(::fedb::base::HumanReadableString(diskused)); |
| 449 | tp.AddRow(row); |
| 450 | row.clear(); |
| 451 | row.push_back("format_version"); |
| 452 | row.push_back(std::to_string(table.format_version())); |
| 453 | tp.AddRow(row); |
| 454 | row.clear(); |
no test coverage detected