diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-06-21 09:19:20 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-06-21 09:23:37 +0000 |
commit | 23bb4a910a0c12b7204b3fb29deea43abd514007 (patch) | |
tree | 02bc26452489249af25815bbf18678a3c3c23465 | |
parent | c0c7d649f1340adc8e614db8f7156e89b7f95314 (diff) |
probe base directory
* this is mainly useful for the case where the filesystem
with our data is mounted read-only because the OS detected
that something was bad.
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/proton.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index ff5924fa6bc..00447fc9ba1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -149,8 +149,21 @@ const vespalib::string CUSTOM_COMPONENT_API_PATH = "/state/v1/custom/component"; VESPA_THREAD_STACK_TAG(proton_initialize_executor) VESPA_THREAD_STACK_TAG(proton_close_executor) +void ensureWritableDir(const vespalib::string &dirName) { + int pidnum = ::getpid(); + int secnum = ::time(0); + auto pidstr = std::to_string(pidnum); + auto secstr = std::to_string(secnum); + auto filename = dirName + "/tmp.file." + pidstr + "." + secstr; + vespalib::File probe(filename); + probe.open(vespalib::File::CREATE); + probe.write("probe\n", 6, 0); + probe.close(); + probe.unlink(); } +} // namespace <unnamed> + Proton::ProtonFileHeaderContext::ProtonFileHeaderContext(const vespalib::string &creator) : _hostName(), _creator(creator), @@ -278,6 +291,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) { assert( _initStarted && ! _initComplete ); const ProtonConfig &protonConfig = configSnapshot->getProtonConfig(); + ensureWritableDir(protonConfig.basedir); const HwInfo & hwInfo = configSnapshot->getHwInfo(); _hw_info = hwInfo; |