diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-18 11:10:59 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-19 14:15:48 +0000 |
commit | 3d547ac70592fe56a6ddb37021c38bb3ed275733 (patch) | |
tree | 0d2c1d6f8553ed06b19bc95745d4d7979c0657ea | |
parent | b7b7a61213ffbe9dc07f5a48d0aa3fb8c45a39e1 (diff) |
Do not carry exceptions in header files
18 files changed, 59 insertions, 73 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp index 3c6cb26e5e9..89bfd5e9165 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp @@ -10,6 +10,7 @@ #include <vespa/searchlib/attribute/interlock.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> #include <vespa/vespalib/stllike/hash_map.hpp> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".proton.attribute.attributemanager"); @@ -44,9 +45,7 @@ AttributeManager::internalAddAttribute(const vespalib::string &name, void AttributeManager::addAttribute(const AttributeWrap &attribute) { - LOG(debug, - "Adding attribute vector '%s'", - attribute->getBaseFileName().c_str()); + LOG(debug, "Adding attribute vector '%s'", attribute->getBaseFileName().c_str()); _attributes[attribute->getName()] = attribute; assert(attribute->getInterlock() == _interlock); if ( ! attribute.isExtra() ) { @@ -91,12 +90,8 @@ AttributeManager::transferExistingAttributes(const AttributeManager &currMgr, for (const auto &aspec : newSpec.getAttributes()) { AttributeVector::SP av = currMgr.findAttribute(aspec.getName()); if (av.get() != NULL) { // transfer attribute - LOG(debug, - "Transferring attribute vector '%s' with %u docs and " - "serial number %" PRIu64 " from current manager", - av->getName().c_str(), - av->getNumDocs(), - av->getStatus().getLastSyncToken()); + LOG(debug, "Transferring attribute vector '%s' with %u docs and serial number %lu from current manager", + av->getName().c_str(), av->getNumDocs(), av->getStatus().getLastSyncToken()); addAttribute(av); } else { toBeAdded.push_back(aspec); @@ -118,12 +113,8 @@ AttributeManager::flushRemovedAttributes(const AttributeManager &currMgr, vespalib::Executor::Task::UP flushTask = flushable->initFlush(newSpec.getCurrentSerialNum()); if (flushTask.get() != NULL) { - LOG(debug, - "Flushing removed attribute vector '%s' with %u docs " - "and serial number %" PRIu64, - kv.first.c_str(), - kv.second->getNumDocs(), - kv.second->getStatus().getLastSyncToken()); + LOG(debug, "Flushing removed attribute vector '%s' with %u docs and serial number %lu", + kv.first.c_str(), kv.second->getNumDocs(), kv.second->getStatus().getLastSyncToken()); flushTask->run(); } } @@ -136,10 +127,8 @@ AttributeManager::addNewAttributes(const Spec &newSpec, IAttributeInitializerRegistry &initializerRegistry) { for (const auto &aspec : toBeAdded) { - LOG(debug, "Creating initializer for attribute vector '%s': docIdLimit=%u, serialNumber=%" PRIu64, - aspec.getName().c_str(), - newSpec.getDocIdLimit(), - newSpec.getCurrentSerialNum()); + LOG(debug, "Creating initializer for attribute vector '%s': docIdLimit=%u, serialNumber=%lu", + aspec.getName().c_str(), newSpec.getDocIdLimit(), newSpec.getCurrentSerialNum()); AttributeInitializer::UP initializer = std::make_unique<AttributeInitializer>(_baseDir, _documentSubDbName, aspec.getName(), diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp index f0e38cba9bf..f7413813074 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp @@ -1,22 +1,20 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentmetastoreinitializer.h" #include "documentmetastore.h" #include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/util/exceptions.h> using search::GrowStrategy; using search::IndexMetaInfo; using vespalib::IllegalStateException; using proton::initializer::InitializerTask; +using vespalib::make_string; -namespace proton -{ - -namespace documentmetastore -{ +namespace proton { +namespace documentmetastore { DocumentMetaStoreInitializer:: DocumentMetaStoreInitializer(const vespalib::string baseDir, @@ -27,9 +25,13 @@ DocumentMetaStoreInitializer(const vespalib::string baseDir, _subDbName(subDbName), _docTypeName(docTypeName), _dms(dms) -{ -} +{ } +namespace { +vespalib::string failedMsg(const char * msg) { + return make_string("Failed to load document meta store for document type '%s' from disk", msg); +} +} void DocumentMetaStoreInitializer::run() @@ -39,23 +41,15 @@ DocumentMetaStoreInitializer::run() if (info.load()) { IndexMetaInfo::Snapshot snap = info.getBestSnapshot(); if (snap.valid) { - vespalib::string attrFileName = _baseDir + "/" + - snap.dirName + "/" + - name; + vespalib::string attrFileName = _baseDir + "/" + snap.dirName + "/" + name; _dms->setBaseFileName(attrFileName); assert(_dms->hasLoadData()); fastos::TimeStamp startTime = fastos::ClockSystem::now(); EventLogger::loadDocumentMetaStoreStart(_subDbName); if (!_dms->load()) { - throw IllegalStateException(vespalib::make_string( - "Failed to load" - " document meta store " - "for document " - "type '%s' from disk", - _docTypeName.c_str())); + throw IllegalStateException(failedMsg(_docTypeName.c_str())); } else { - _dms->commit(snap.syncToken, - snap.syncToken); + _dms->commit(snap.syncToken, snap.syncToken); } fastos::TimeStamp endTime = fastos::ClockSystem::now(); int64_t elapsedTimeMs = (endTime - startTime).ms(); diff --git a/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp b/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp index 39cf5517eeb..7efd3b0e0dc 100644 --- a/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/data_directory_upgrader.cpp @@ -4,6 +4,7 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/exceptions.h> #include <algorithm> #include <iostream> #include <sys/stat.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 86a2f3460ee..97c438dbd09 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentdb.h" #include "combiningfeedview.h" #include "configvalidator.h" @@ -9,10 +8,12 @@ #include "idocumentdbowner.h" #include "lid_space_compaction_handler.h" #include "maintenance_jobs_injector.h" -#include <vespa/searchcore/proton/metrics/metricswireservice.h> #include "searchcontext.h" #include "summaryadapter.h" #include "tlcproxy.h" +#include "commit_and_wait_document_retriever.h" +#include "documentdbconfigscout.h" +#include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchcore/proton/common/schemautil.h> @@ -37,10 +38,9 @@ #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/util/jsonwriter.h> #include <sstream> -#include "documentdbconfigscout.h" -#include "commit_and_wait_document_retriever.h" -#include <vespa/log/log.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> LOG_SETUP(".proton.server.documentdb"); diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index 1fe64739d2d..2575d2edf84 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -12,6 +12,7 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/tensor/default_tensor_engine.h> +#include <vespa/vespalib/util/exceptions.h> using vespa::config::search::AttributesConfig; using vespa::config::search::RankProfilesConfig; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index c89db63024c..cc35d7649ce 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -21,6 +21,8 @@ #include <vespa/searchlib/util/fileheadertk.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> +#include <vespa/vespalib/util/exceptions.h> + #include <vespa/log/log.h> LOG_SETUP(".proton.server.storeonlydocsubdb"); @@ -227,10 +229,8 @@ StoreOnlyDocSubDB::setupDocumentMetaStore(DocumentMetaStoreInitializerResult::SP addDocumentMetaStore(dms.get(), _flushedDocumentMetaStoreSerialNum); _metaStoreCtx.reset(new DocumentMetaStoreContext(dms)); - LOG(debug, - "Added document meta store '%s'" - " with flushed serial num %" PRIu64, - name.c_str(), _flushedDocumentMetaStoreSerialNum); + LOG(debug, "Added document meta store '%s' with flushed serial num %lu", + name.c_str(), _flushedDocumentMetaStoreSerialNum); _dms = dms; _dmsFlushTarget.reset(new DocumentMetaStoreFlushTarget(dms, _tlsSyncer, diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp index 0f8b2b0518a..31ac8f67afe 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp @@ -7,6 +7,7 @@ #include "attributefile.h" #include "interlock.h" #include <vespa/vespalib/stllike/hash_map.hpp> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.attributemanager"); diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index c3a2a794ff0..2432851c481 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -17,6 +17,7 @@ #include <vespa/document/update/mapvalueupdate.h> #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/searchlib/query/query.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.attribute.attributevector"); diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion.cpp b/searchlib/src/vespa/searchlib/diskindex/fusion.cpp index 894dc45472f..2421e46f528 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fusion.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Copyright (C) 2003 Fast Search & Transfer ASA -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> #include "fusion.h" +#include "fieldreader.h" +#include "fieldwriter.h" +#include "dictionarywordreader.h" #include <vespa/vespalib/util/stringfmt.h> #include <vespa/searchlib/common/fslimits.h> - #include <vespa/searchlib/util/filekit.h> #include <vespa/searchlib/util/dirtraverse.h> #include <vespa/vespalib/io/fileutil.h> @@ -14,10 +14,9 @@ #include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/searchlib/index/postinglistparams.h> #include <vespa/searchlib/util/postingpriorityqueue.h> -#include "fieldreader.h" -#include "fieldwriter.h" -#include "dictionarywordreader.h" +#include <vespa/vespalib/util/error.h> +#include <vespa/log/log.h> LOG_SETUP(".diskindex.fusion"); using search::FileKit; diff --git a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp index bf688b4766c..888bfcff1e4 100644 --- a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp @@ -7,6 +7,7 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/searchlib/diskindex/fieldwriter.h> #include <vespa/vespalib/util/array.hpp> +#include <vespa/vespalib/util/error.h> #include <vespa/log/log.h> LOG_SETUP(".diskindex.indexbuilder"); diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index b9a9ea57a9e..cc904ef82a7 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp @@ -1,18 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/transactionlog/translogserver.h> +#include "translogserver.h" #include <fstream> -#include <vespa/vespalib/util/vstringfmt.h> #include <vespa/vespalib/util/stringfmt.h> #include <stdexcept> #include <vespa/log/log.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/util/exceptions.h> LOG_SETUP(".transactionlog.server"); using vespalib::make_string; using vespalib::stringref; -using vespalib::make_vespa_string; using vespalib::IllegalArgumentException; using search::common::FileHeaderContext; @@ -414,13 +412,13 @@ void TransLogServer::deleteDomain(FRT_RPCRequest *req) domainDir << it->first << std::endl; } } catch (const std::exception & e) { - msg = make_vespa_string("Failed deleting %s domain. Exception = %s", domainName, e.what()); + msg = make_string("Failed deleting %s domain. Exception = %s", domainName, e.what()); retval = -1; LOG(warning, "%s", msg.c_str()); } } else { retval = -2; - msg = vespalib::make_vespa_string("Domain '%s' is open. Can not delete open domains.", domainName); + msg = vespalib::make_string("Domain '%s' is open. Can not delete open domains.", domainName); LOG(warning, "%s", msg.c_str()); } ret.AddInt32(retval); diff --git a/storage/src/vespa/storage/common/hostreporter/kernelmetrictool.cpp b/storage/src/vespa/storage/common/hostreporter/kernelmetrictool.cpp index 8bf345de9a8..8051541559e 100644 --- a/storage/src/vespa/storage/common/hostreporter/kernelmetrictool.cpp +++ b/storage/src/vespa/storage/common/hostreporter/kernelmetrictool.cpp @@ -1,10 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "kernelmetrictool.h" #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/exceptions.h> #include <cctype> namespace storage { diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp index f0ba1027afa..3ae28d140bb 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.cpp +++ b/storage/src/vespa/storage/storageserver/statemanager.cpp @@ -12,10 +12,11 @@ #include <sys/types.h> #include <unistd.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/stllike/asciistream.h> -#include <vespa/log/log.h> +#include <vespa/log/log.h> LOG_SETUP(".state.manager"); namespace storage { diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index cf63c8ef1d1..061194ec99f 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -26,8 +26,9 @@ #include <vespa/vsm/vsm/docsumfilter.h> #include <vespa/vsm/vsm/vsm-adapter.h> #include <vespa/vespalib/objects/nbostream.h> -#include <vespa/log/log.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> LOG_SETUP(".visitor.instance.searchvisitor"); namespace storage { diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp index 4b15d0c1bf1..192dcf7c413 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.cpp +++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp @@ -1,19 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/io/fileutil.h> +#include "fileutil.h" #include <errno.h> -#include <vespa/log/log.h> -#include <iostream> -#include <sstream> +#include <ostream> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/error.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/fastos/file.h> +#include <vespa/log/log.h> LOG_SETUP(".vespalib.io.fileutil"); namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/io/fileutil.h b/vespalib/src/vespa/vespalib/io/fileutil.h index 706bed0f0ec..52d0e9b3cd6 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.h +++ b/vespalib/src/vespa/vespalib/io/fileutil.h @@ -30,7 +30,8 @@ #include <unistd.h> #include <string> #include <memory> -#include <vespa/vespalib/util/exceptions.h> +#include <vector> +#include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/util/memory.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/text/utf8.cpp b/vespalib/src/vespa/vespalib/text/utf8.cpp index 686e52c6dcd..6fba50825af 100644 --- a/vespalib/src/vespa/vespalib/text/utf8.cpp +++ b/vespalib/src/vespa/vespalib/text/utf8.cpp @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <assert.h> #include "utf8.h" -#include <vespa/vespalib/util/vstringfmt.h> +#include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/exceptions.h> +#include <assert.h> #include <vespa/log/log.h> LOG_SETUP(".vespalib.utf8"); @@ -12,7 +12,7 @@ namespace vespalib { void Utf8::throwX(const char *msg, unsigned int number) { - vespalib::string what = make_vespa_string("%s: \\x%02X", msg, number); + vespalib::string what = make_string("%s: \\x%02X", msg, number); throw IllegalArgumentException(what); } diff --git a/vespalib/src/vespa/vespalib/text/utf8.h b/vespalib/src/vespa/vespalib/text/utf8.h index ea2468d0b86..c8357749d30 100644 --- a/vespalib/src/vespa/vespalib/text/utf8.h +++ b/vespalib/src/vespa/vespalib/text/utf8.h @@ -4,7 +4,6 @@ #pragma once #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/exceptions.h> namespace vespalib { |