Disallow negative number of worker threads. - Fixed a bug thereby Quickstep command line now disallows negative number of worker threads. - If the user provides zero or fewer worker threads, we switch to the default number of worker threasd, instead of terminating the process.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/e5224a1d Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/e5224a1d Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/e5224a1d Branch: refs/heads/dist-exe-test-new Commit: e5224a1d64faacdd8516482aa2f0ab581755c00e Parents: 6bbdb4d Author: Harshad Deshmukh <hbdeshm...@apache.org> Authored: Thu Jun 30 11:04:29 2016 -0500 Committer: Zuyu Zhang <zu...@twitter.com> Committed: Fri Jul 29 16:42:10 2016 -0700 ---------------------------------------------------------------------- cli/QuickstepCli.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/e5224a1d/cli/QuickstepCli.cpp ---------------------------------------------------------------------- diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp index 3f99130..02a55a0 100644 --- a/cli/QuickstepCli.cpp +++ b/cli/QuickstepCli.cpp @@ -200,19 +200,18 @@ int main(int argc, char* argv[]) { // that we computed above, provided it did return a valid value. // TODO(jmp): May need to change this at some point to keep one thread // available for the OS if the hardware concurrency level is high. - const unsigned int real_num_workers = quickstep::FLAGS_num_workers != 0 - ? quickstep::FLAGS_num_workers - : (num_hw_threads != 0 ? - num_hw_threads - : 1); - - if (real_num_workers > 0) { - printf("Starting Quickstep with %d worker thread(s) and a %.2f GB buffer pool\n", - real_num_workers, - (static_cast<double>(quickstep::FLAGS_buffer_pool_slots) * quickstep::kSlotSizeBytes)/quickstep::kAGigaByte); - } else { - LOG(FATAL) << "Quickstep needs at least one worker thread to run"; + if (quickstep::FLAGS_num_workers <= 0) { + LOG(INFO) << "Quickstep expects at least one worker thread, switching to " + "the default number of worker threads"; } + const int real_num_workers = quickstep::FLAGS_num_workers > 0 + ? quickstep::FLAGS_num_workers + : (num_hw_threads != 0 ? num_hw_threads : 1); + + DCHECK_GT(real_num_workers, 0); + printf("Starting Quickstep with %d worker thread(s) and a %.2f GB buffer pool\n", + real_num_workers, + (static_cast<double>(quickstep::FLAGS_buffer_pool_slots) * quickstep::kSlotSizeBytes)/quickstep::kAGigaByte); #ifdef QUICKSTEP_HAVE_FILE_MANAGER_HDFS if (quickstep::FLAGS_use_hdfs) {