Skip to content

Commit 3dea96f

Browse files
author
wangguangshuo
committed
fix clang-tidy
1 parent 5b7341f commit 3dea96f

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/shell/command_helper.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,17 +2240,20 @@ inline bool get_storage_size_stat(shell_context *sc, app_storage_size_stat &st_s
22402240
if (counter_name != "disk.storage.sst(MB)")
22412241
continue;
22422242
auto find = pcs_by_appid.find(app_id_x);
2243-
if (find == pcs_by_appid.end()) // app id not found
2243+
if (find == pcs_by_appid.end()) { // app id not found
22442244
continue;
2245+
}
22452246
auto &pc = find->second[partition_index_x];
22462247

22472248
dsn::host_port primary;
22482249
GET_HOST_PORT(pc, primary, primary);
22492250

2250-
if (primary != nodes[i].hp) // not primary replica
2251+
if (primary != nodes[i].hp) { // not primary replica
22512252
continue;
2252-
if (pc.partition_flags != 0) // already calculated
2253+
}
2254+
if (pc.partition_flags != 0) { // already calculated
22532255
continue;
2256+
}
22542257
pc.partition_flags = 1;
22552258
int64_t app_partition_count = find->second.size();
22562259
auto st_it = st_stat.st_value_by_app

src/shell/commands/recovery.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ dsn::host_port diagnose_recommend(const dsn::replication::ddd_partition_info &pi
203203
// - choose the node with the largest last committed decree
204204
// - if last committed decree is the same, choose node with the largest ballot
205205

206-
dsn::host_port latest_node, secondary_node;
206+
dsn::host_port latest_node;
207+
dsn::host_port secondary_node;
207208
GET_HOST_PORT(latest, node, latest_node);
208209
GET_HOST_PORT(secondary, node, secondary_node);
209210

@@ -308,8 +309,9 @@ bool ddd_diagnose(command_executor *e, shell_context *sc, arguments args)
308309
std::vector<dsn::host_port> last_drops;
309310
GET_HOST_PORTS(pinfo.config, last_drops, last_drops);
310311

311-
dsn::host_port latest_dropped, secondary_latest_dropped;
312-
if (last_drops.size() > 0) {
312+
dsn::host_port latest_dropped;
313+
dsn::host_port secondary_latest_dropped;
314+
if (!last_drops.empty()) {
313315
latest_dropped = last_drops[last_drops.size() - 1];
314316
}
315317
if (last_drops.size() > 1) {
@@ -329,21 +331,23 @@ bool ddd_diagnose(command_executor *e, shell_context *sc, arguments args)
329331
<< "ballot(" << n.ballot << "), "
330332
<< "last_committed(" << n.last_committed_decree << "), "
331333
<< "last_prepared(" << n.last_prepared_decree << ")";
332-
if (node == latest_dropped)
334+
if (node == latest_dropped) {
333335
out << " <== the latest";
334-
else if (node == secondary_latest_dropped)
336+
} else if (node == secondary_latest_dropped) {
335337
out << " <== the secondary latest";
338+
}
336339
out << std::endl;
337340
}
338341
out << " ----" << std::endl;
339342
j = 0;
340343
for (const auto &r : last_drops) {
341344
out << " last_drops[" << j++ << "]: "
342345
<< "node(" << r.to_string() << ")";
343-
if (j == (int)last_drops.size() - 1)
346+
if (j == static_cast<int>(last_drops.size()) - 1) {
344347
out << " <== the secondary latest";
345-
else if (j == (int)last_drops.size())
348+
} else if (j == static_cast<int>(last_drops.size())) {
346349
out << " <== the latest";
350+
}
347351
out << std::endl;
348352
}
349353
out << " ----" << std::endl;

src/shell/commands/table_management.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,9 @@ bool app_disk(command_executor *e, shell_context *sc, arguments args)
398398
std::stringstream oss;
399399
oss << "[";
400400
for (int j = 0; j < secondaries.size(); j++) {
401-
if (j != 0)
401+
if (j != 0) {
402402
oss << ",";
403+
}
403404
bool found = false;
404405
double value = 0;
405406
auto f1 = disk_map.find(secondaries[j]);

0 commit comments

Comments
 (0)