diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2018-06-12 12:50:28 +0200 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2018-06-12 13:51:45 +0200 |
commit | 016e584f0ad5a071e13d75eb8ad5ddb46b8c54f5 (patch) | |
tree | 869d4e4a4c4b8a9f9ef691b2980009017dece9e6 /storage | |
parent | 22796dddd3dc025018093783328ac87535ffecd9 (diff) |
use LOG_ABORT not just abort()
* abort() has the unfortunate effect that nothing is seen in the log,
just an event (which is usually not displayed); so ops people don't
see that the program is crashing at all.
* LOG_ABORT("message") will log an error with the message (and the file
and line) before calling abort(), so it's easy to see what happened.
* add or move <vespa/log/log.h> include and LOG_SETUP lines before
LOG_ABORT is used (or included).
Diffstat (limited to 'storage')
10 files changed, 20 insertions, 13 deletions
diff --git a/storage/src/tests/bucketdb/judymultimaptest.cpp b/storage/src/tests/bucketdb/judymultimaptest.cpp index db368ac83b5..28504e3abed 100644 --- a/storage/src/tests/bucketdb/judymultimaptest.cpp +++ b/storage/src/tests/bucketdb/judymultimaptest.cpp @@ -1,5 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/log/log.h> +LOG_SETUP(".judy_multi_map_test"); #include <vespa/storage/bucketdb/judymultimap.h> #include <vespa/storage/bucketdb/judymultimap.hpp> #include <vespa/vdstestlib/cppunit/macros.h> diff --git a/storage/src/tests/bucketdb/lockablemaptest.cpp b/storage/src/tests/bucketdb/lockablemaptest.cpp index 6f36e0be711..46928ee51ae 100644 --- a/storage/src/tests/bucketdb/lockablemaptest.cpp +++ b/storage/src/tests/bucketdb/lockablemaptest.cpp @@ -1,5 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/log/log.h> +LOG_SETUP(".lockable_map_test"); #include <vespa/vespalib/util/document_runnable.h> #include <vespa/storage/bucketdb/judymultimap.h> #include <vespa/storage/bucketdb/judymultimap.hpp> diff --git a/storage/src/vespa/storage/bucketdb/judymultimap.hpp b/storage/src/vespa/storage/bucketdb/judymultimap.hpp index 06d553d38bc..81a58582073 100644 --- a/storage/src/vespa/storage/bucketdb/judymultimap.hpp +++ b/storage/src/vespa/storage/bucketdb/judymultimap.hpp @@ -2,6 +2,7 @@ #pragma once #include "judymultimap.h" +#include <vespa/log/log.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/array.hpp> #include <set> @@ -150,7 +151,7 @@ JudyMultiMap<T0, T1, T2, T3>::operator[](key_type key) case 1: return _values1[getIndex(it.value())]; case 2: return _values2[getIndex(it.value())]; case 3: return _values3[getIndex(it.value())]; - default: assert(false); + default: LOG_ABORT("should not be reached"); } return T0(); // Avoid warning of no return } @@ -290,7 +291,7 @@ JudyMultiMap<T0, T1, T2, T3>::ConstIterator::operator*() const _iterator.key(), _parent->_values3[getIndex(_iterator.value())]); default: assert(false); - abort(); + LOG_ABORT("should not be reached"); } } diff --git a/storage/src/vespa/storage/bucketdb/storbucketdb.cpp b/storage/src/vespa/storage/bucketdb/storbucketdb.cpp index 81d07319358..83787bde55f 100644 --- a/storage/src/vespa/storage/bucketdb/storbucketdb.cpp +++ b/storage/src/vespa/storage/bucketdb/storbucketdb.cpp @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "storbucketdb.h" +#include <vespa/log/log.h> +LOG_SETUP(".storage.bucketdb.stor_bucket_db"); #include "judymultimap.hpp" namespace storage { diff --git a/storage/src/vespa/storage/bucketmover/bucketmover.cpp b/storage/src/vespa/storage/bucketmover/bucketmover.cpp index b47b3b59b4f..822cb0b16ae 100644 --- a/storage/src/vespa/storage/bucketmover/bucketmover.cpp +++ b/storage/src/vespa/storage/bucketmover/bucketmover.cpp @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bucketmover.h" +#include <vespa/log/bufferedlogger.h> +LOG_SETUP(".bucketmover"); #include "htmltable.h" #include <vespa/storage/config/config-stor-server.h> #include <vespa/storage/common/bucketmessages.h> @@ -12,9 +14,6 @@ #include <vespa/document/bucket/fixed_bucket_spaces.h> #include <thread> -#include <vespa/log/bufferedlogger.h> -LOG_SETUP(".bucketmover"); - namespace storage::bucketmover { BucketMover::BucketMover(const config::ConfigUri & configUri, diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.cpp b/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.cpp index c158b499ebb..d8b7ee81ba7 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.cpp +++ b/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.cpp @@ -5,6 +5,9 @@ #include <vespa/storage/distributor/operationstarter.h> #include <vespa/storage/distributor/operations/idealstate/idealstateoperation.h> +#include <vespa/log/log.h> +LOG_SETUP(".storage.distributor.maintenance.maintenance_scheduler"); + namespace storage::distributor { MaintenanceScheduler::MaintenanceScheduler( @@ -84,7 +87,7 @@ MaintenanceScheduler::convertToOperationPriority(MaintenancePriority::Priority p return OperationStarter::Priority(0); default: assert(false); - abort(); + LOG_ABORT("should not be reached"); } } diff --git a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.cpp b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.cpp index ba1ce957a0f..f2c5c7cf981 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.cpp +++ b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.cpp @@ -12,7 +12,7 @@ void RealAppKiller::kill() { LOG(info, "Aborting the server to dump core, as we're " "most likely deadlocked and want a core file " "to view the stack traces."); - abort(); + LOG_ABORT("should not be reached"); } } // storage diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index 06dfc073f61..a01881b6fbe 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -419,8 +419,7 @@ namespace { return static_cast<const api::RemoveCommand&>(msg).getDocumentId(); break; default: - assert(false); - abort(); + LOG_ABORT("should not be reached"); } } uint32_t findCommonBits(document::BucketId a, document::BucketId b) { @@ -544,7 +543,7 @@ FileStorHandlerImpl::remapMessage(api::StorageMessage& msg, const document::Buck } else { LOG(debug, "Did not remap %s with bucket %s from bucket %s", cmd.toString().c_str(), cmd.getBucketId().toString().c_str(), source.toString().c_str()); - assert(false); + LOG_ABORT("should not be reached"); } break; } diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp index b4c7d1e3e80..01a84177e43 100644 --- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp +++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp @@ -40,8 +40,7 @@ namespace { case SchedulingOptions::CONTINUE: return "Continuing any existing run"; default: - assert(false); - abort(); + LOG_ABORT("should not be reached"); } } } diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp index a15b1b98d63..370f1c85241 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp +++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp @@ -1211,7 +1211,7 @@ MergeThrottler::handleOutdatedMerges(const api::SetSystemStateCommand& cmd) markActiveMergesAsAborted(minimumVersion); } catch (std::exception& e) { LOG(error, "Received exception during merge aborting: %s", e.what()); - abort(); + LOG_ABORT("should not be reached"); } // Rendezvous released on scope exit |