| 1268 | } |
| 1269 | |
| 1270 | CliStatus TabletDiff(const std::string& prefix_path, const std::string& table_name, |
| 1271 | const std::string& tablet_name) { |
| 1272 | std::string startkey; |
| 1273 | std::string endkey; |
| 1274 | std::string path; |
| 1275 | std::vector<std::string> record_diff; |
| 1276 | |
| 1277 | int ret = GetTabletKeyRange(prefix_path, table_name, tablet_name, startkey, endkey); |
| 1278 | if (ret != 0) { |
| 1279 | LOG(ERROR) << "tablet check fail:" << table_name << "/" << tablet_name; |
| 1280 | return CliStatus::kError; |
| 1281 | } |
| 1282 | |
| 1283 | path = table_name + "/" + tablet_name; |
| 1284 | auto it = g_map_bak.find(path); |
| 1285 | if (it != g_map_bak.end()) { |
| 1286 | if (startkey != it->second.first || endkey != it->second.second) { |
| 1287 | // find but keyrange not match |
| 1288 | // scan keyrange [startkey,endkey] <--> bak keyrange [it->second.first, it->second.second] |
| 1289 | record_diff.push_back(it->second.first); |
| 1290 | record_diff.push_back(it->second.second); |
| 1291 | std::cout << "tablet keyrange not match:" << path << " [" << startkey << "(" |
| 1292 | << DebugString(startkey) << ")," << endkey << "(" << DebugString(endkey) << ") ]" |
| 1293 | << "<---> [" << it->second.first << "(" << DebugString(it->second.first) << ")," |
| 1294 | << it->second.second << "(" << DebugString(it->second.second) << ") ]" << std::endl; |
| 1295 | } else { |
| 1296 | std::cout << "tablet no diff:" << table_name << "/" << tablet_name << " [" << startkey << "(" |
| 1297 | << DebugString(startkey) << ")," << endkey << "(" << DebugString(endkey) << ") ]" |
| 1298 | << std::endl; |
| 1299 | } |
| 1300 | } else { |
| 1301 | // not find |
| 1302 | std::cout << "tablet miss: " << path << " [" << startkey << "(" << DebugString(startkey) << ")," |
| 1303 | << endkey << "(" << DebugString(endkey) << ") ]" << std::endl; |
| 1304 | } |
| 1305 | return CliStatus::kOk; |
| 1306 | } |
| 1307 | |
| 1308 | CliStatus MetaInternalOp(const std::string& meta_server, common::ThreadPool* thread_pool, |
| 1309 | const std::string& op, const std::string& start_key, |
no test coverage detected