| 500 | } |
| 501 | |
| 502 | uint32_t MetaIsolateActionGenerator::PickRandomTabletOfMetaNode( |
| 503 | const std::shared_ptr<Cluster>& cluster, uint32_t source_node_index) { |
| 504 | uint32_t tablet_num = cluster->tablets_per_node_[source_node_index].size(); |
| 505 | if (tablet_num < 2) { |
| 506 | return kInvalidTabletIndex; |
| 507 | } |
| 508 | |
| 509 | while (true) { |
| 510 | uint32_t rand = Random::Rand(0, tablet_num); |
| 511 | uint32_t tablet_index = cluster->tablets_per_node_[source_node_index][rand]; |
| 512 | if (!cluster->IsMetaTablet(tablet_index)) { |
| 513 | return tablet_index; |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | uint32_t MetaIsolateActionGenerator::PickLeastComplexLoadNode( |
| 519 | const std::shared_ptr<Cluster>& cluster, const std::vector<uint32_t>& sorted_node_index, |