helifu has posted comments on this change. ( http://gerrit.cloudera.org:8080/13733 )
Change subject: KUDU-2851: modify table scan and copy tools to surface errors ...................................................................... Patch Set 7: (1 comment) http://gerrit.cloudera.org:8080/#/c/13733/7/src/kudu/tools/table_scanner.cc File src/kudu/tools/table_scanner.cc: http://gerrit.cloudera.org:8080/#/c/13733/7/src/kudu/tools/table_scanner.cc@468 PS7, Line 468: : Status scan_status = Status::OK(); : : for (auto token : tokens) { : Stopwatch sw(Stopwatch::THIS_THREAD); : sw.start(); : : KuduScanner* scanner_ptr; : scan_status = token->IntoKuduScanner(&scanner_ptr); : RETURN_NOT_OK(scan_status); : : unique_ptr<KuduScanner> scanner(scanner_ptr); : scan_status = scanner->Open(); : RETURN_NOT_OK(scan_status); : : uint64_t count = 0; : while (scanner->HasMoreRows()) { : KuduScanBatch batch; : scan_status = scanner->NextBatch(&batch); : RETURN_NOT_OK(scan_status); : count += batch.NumRows(); : total_count_.IncrementBy(batch.NumRows()); : cb(batch); : } : : sw.stop(); : if (out_) { : MutexLock l(output_lock_); : *out_ << "T " << token->tablet().id() << " scanned count " << count : << " cost " << sw.elapsed().wall_seconds() << " seconds" << endl; : } : } : : return scan_status; A quick browse on this file, and I suggest to give up the local variable 'scan_status' since it's not necessary.^_^ For example: ----------------------------------------- for (auto token : tokens) { Stopwatch sw(Stopwatch::THIS_THREAD); sw.start(); KuduScanner* scanner_ptr; RETURN_NOT_OK(token->IntoKuduScanner(&scanner_ptr)); unique_ptr<KuduScanner> scanner(scanner_ptr); RETURN_NOT_OK(scanner->Open()); uint64_t count = 0; while (scanner->HasMoreRows()) { KuduScanBatch batch; RETURN_NOT_OK(scanner->NextBatch(&batch)); count += batch.NumRows(); total_count_.IncrementBy(batch.NumRows()); cb(batch); } sw.stop(); if (out_) { MutexLock l(output_lock_); *out_ << "T " << token->tablet().id() << " scanned count " << count << " cost " << sw.elapsed().wall_seconds() << " seconds" << endl; } } return Status::OK(); -- To view, visit http://gerrit.cloudera.org:8080/13733 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ic45da537b8bacfa9625010536ea82da9a6e76100 Gerrit-Change-Number: 13733 Gerrit-PatchSet: 7 Gerrit-Owner: Hannah Nguyen <hannah.ngu...@cloudera.com> Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com> Gerrit-Reviewer: Hannah Nguyen <hannah.ngu...@cloudera.com> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Tidy Bot (241) Gerrit-Reviewer: helifu <hzhel...@corp.netease.com> Gerrit-Comment-Date: Thu, 27 Jun 2019 01:31:09 +0000 Gerrit-HasComments: Yes