summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--logd/src/apps/logd/main.cpp4
-rw-r--r--searchcore/src/apps/fdispatch/fdispatch.cpp3
-rw-r--r--searchcore/src/tests/proton/server/documentretriever_test.cpp38
-rw-r--r--slobrok/src/apps/slobrok/slobrok.cpp4
-rw-r--r--slobrok/src/vespa/slobrok/server/sbenv.cpp6
-rw-r--r--storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp4
-rw-r--r--storage/src/vespa/storage/persistence/mergehandler.cpp7
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanager.cpp3
8 files changed, 44 insertions, 25 deletions
diff --git a/logd/src/apps/logd/main.cpp b/logd/src/apps/logd/main.cpp
index 62f1e48b233..78e23d7464f 100644
--- a/logd/src/apps/logd/main.cpp
+++ b/logd/src/apps/logd/main.cpp
@@ -83,8 +83,8 @@ int main(int, char**)
LOG(error, "stopping on error: %s", ex.what());
EV_STOPPING("logdemon", "fatal error");
return 1;
- } catch (...) {
- LOG(error, "unknown exception");
+ } catch (std::exception & ex) {
+ LOG(error, "unknown exception: %s", ex.what());
EV_STOPPING("logdemon", "unknown error");
return 1;
}
diff --git a/searchcore/src/apps/fdispatch/fdispatch.cpp b/searchcore/src/apps/fdispatch/fdispatch.cpp
index cd3ef3b7550..0aa16260737 100644
--- a/searchcore/src/apps/fdispatch/fdispatch.cpp
+++ b/searchcore/src/apps/fdispatch/fdispatch.cpp
@@ -113,9 +113,6 @@ FastS_FDispatchApp::Main()
} catch (std::exception &e) {
LOG(error, "got exception during init: %s", e.what());
exitCode = 1;
- } catch (...) {
- LOG(error, "got exception during init");
- exitCode = 1;
}
LOG(debug, "Deleting fdispatch");
diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp
index f8ec0d20d33..abf595f87eb 100644
--- a/searchcore/src/tests/proton/server/documentretriever_test.cpp
+++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp
@@ -114,11 +114,24 @@ const int64_t static_zcurve_value = 1118035438880ll;
const int64_t dynamic_zcurve_value = 6145423666930817152ll;
struct MyDocumentStore : proton::test::DummyDocumentStore {
+ mutable std::unique_ptr<Document> _testDoc;
+
+ MyDocumentStore()
+ : proton::test::DummyDocumentStore(),
+ _testDoc()
+ {
+ }
+
+ ~MyDocumentStore() override;
+
virtual Document::UP read(DocumentIdT lid,
const DocumentTypeRepo &r) const override {
if (lid == 0) {
return Document::UP();
}
+ if (_testDoc) {
+ return std::move(_testDoc);
+ }
const DocumentType *doc_type = r.getDocumentType(doc_type_name);
Document::UP doc(new Document(*doc_type, doc_id));
ASSERT_TRUE(doc.get());
@@ -145,6 +158,8 @@ struct MyDocumentStore : proton::test::DummyDocumentStore {
}
};
+MyDocumentStore::~MyDocumentStore() = default;
+
document::DocumenttypesConfig getRepoConfig() {
const int32_t doc_type_id = 787121340;
@@ -317,6 +332,14 @@ struct Fixture {
dyn_wset_field_n, DataType::FLOAT, ct);
_retriever = std::make_unique<DocumentRetriever>(_dtName, repo, schema, meta_store, attr_manager, doc_store);
}
+
+ void clearAttributes(std::vector<vespalib::string> names) {
+ for (const auto &name : names) {
+ auto guard = *attr_manager.getAttribute(name);
+ guard->clearDoc(lid);
+ guard->commit();
+ }
+ }
};
TEST_F("require that document retriever can retrieve document meta data",
@@ -451,6 +474,21 @@ TEST_F("require that predicate attributes can be retrieved", Fixture) {
ASSERT_TRUE(predicate_value);
}
+TEST_F("require that zero values in multivalue attribute removes fields", Fixture)
+{
+ auto meta_data = f._retriever->getDocumentMetaData(doc_id);
+ auto doc = f._retriever->getDocument(meta_data.lid);
+ ASSERT_TRUE(doc);
+ const Document *docPtr = doc.get();
+ ASSERT_TRUE(doc->hasValue(dyn_arr_field_i));
+ ASSERT_TRUE(doc->hasValue(dyn_wset_field_i));
+ f.doc_store._testDoc = std::move(doc);
+ f.clearAttributes({ dyn_arr_field_i, dyn_wset_field_i });
+ doc = f._retriever->getDocument(meta_data.lid);
+ EXPECT_EQUAL(docPtr, doc.get());
+ ASSERT_FALSE(doc->hasValue(dyn_arr_field_i));
+ ASSERT_FALSE(doc->hasValue(dyn_wset_field_i));
+}
} // namespace
diff --git a/slobrok/src/apps/slobrok/slobrok.cpp b/slobrok/src/apps/slobrok/slobrok.cpp
index e69f2df53f0..0588c90d383 100644
--- a/slobrok/src/apps/slobrok/slobrok.cpp
+++ b/slobrok/src/apps/slobrok/slobrok.cpp
@@ -94,10 +94,6 @@ App::Main()
LOG(error, "unknown exception during construction : %s", e.what());
EV_STOPPING("slobrok", "unknown exception during construction");
return 2;
- } catch (...) {
- LOG(error, "unknown exception during construction");
- EV_STOPPING("slobrok", "unknown exception during construction");
- return 3;
}
mainobj.reset();
return res;
diff --git a/slobrok/src/vespa/slobrok/server/sbenv.cpp b/slobrok/src/vespa/slobrok/server/sbenv.cpp
index 163113de7b9..4e510b61e70 100644
--- a/slobrok/src/vespa/slobrok/server/sbenv.cpp
+++ b/slobrok/src/vespa/slobrok/server/sbenv.cpp
@@ -190,9 +190,9 @@ SBEnv::MainLoop()
LOG(error, "invalid config: %s", e.what());
EV_STOPPING("slobrok", "invalid config");
return 1;
- } catch (...) {
- LOG(error, "unknown exception while configuring");
- EV_STOPPING("slobrok", "unknown config exception");
+ } catch (std::exception &e) {
+ LOG(error, "Unexpected std::exception : %s", e.what());
+ EV_STOPPING("slobrok", "Unexpected std::exception");
return 1;
}
EV_STOPPING("slobrok", "clean shutdown");
diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp
index 483cffaf751..c7d8bf24e82 100644
--- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp
+++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp
@@ -258,10 +258,6 @@ StatusWebServer::handlePage(const framework::HttpUrlPath& urlpath, std::ostream&
HttpErrorWriter writer(out, "500 Internal Server Error");
writer << "<pre>" << e.what() << "</pre>";
pageExisted = true;
- } catch (...) {
- HttpErrorWriter writer(out, "500 Internal Server Error");
- writer << "Unknown exception";
- pageExisted = true;
}
if (pageExisted) {
LOG(spam, "Status finished request");
diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp
index 26cfb0e6566..1e9cc7c0cde 100644
--- a/storage/src/vespa/storage/persistence/mergehandler.cpp
+++ b/storage/src/vespa/storage/persistence/mergehandler.cpp
@@ -1361,11 +1361,8 @@ MergeHandler::handleGetBucketDiffReply(api::GetBucketDiffReply& reply,
} catch (std::exception& e) {
_env._fileStorHandler.clearMergeStatus(
bucket.getBucket(),
- api::ReturnCode(api::ReturnCode::INTERNAL_FAILURE,
- e.what()));
+ api::ReturnCode(api::ReturnCode::INTERNAL_FAILURE, e.what()));
throw;
- } catch (...) {
- assert(false);
}
if (clearState) {
@@ -1586,8 +1583,6 @@ MergeHandler::handleApplyBucketDiffReply(api::ApplyBucketDiffReply& reply,
api::ReturnCode(api::ReturnCode::INTERNAL_FAILURE,
e.what()));
throw;
- } catch (...) {
- assert(false);
}
if (clearState) {
diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
index 783bde40981..eee688b1fb2 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp
+++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
@@ -481,9 +481,6 @@ CommunicationManager::process(const std::shared_ptr<api::StorageMessage>& msg)
LOGBP(error, "When running command %s, caught exception %s. Discarding message",
msg->toString().c_str(), e.what());
_metrics.exceptionMessageProcessTime[msg->getLoadType()].addValue(startTime.getElapsedTimeAsDouble());
- } catch (...) {
- LOG(fatal, "Caught fatal exception in communication manager");
- throw;
}
}