diff options
author | Tor Egge <Tor.Egge@yahooinc.com> | 2023-07-14 14:51:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-14 14:51:56 +0200 |
commit | 436572664dc53a4f03d79a424814c66b822643c1 (patch) | |
tree | 05028fcb57a3e4ed11a8ce0ed2f25e5fe5f586d0 /searchlib | |
parent | 7497b74e16ae7381e48243f89f2e8b0c80d7bf77 (diff) | |
parent | ccc0da2fddb3162e834e367e1bc18db748d33ec2 (diff) |
Merge pull request #27778 from vespa-engine/toregge/remove-most-of-search-filekit
Remove most of search::FileKit.
Diffstat (limited to 'searchlib')
4 files changed, 0 insertions, 99 deletions
diff --git a/searchlib/src/tests/diskindex/fusion/fusion_test.cpp b/searchlib/src/tests/diskindex/fusion/fusion_test.cpp index ca8eaa176a4..8acb39853e9 100644 --- a/searchlib/src/tests/diskindex/fusion/fusion_test.cpp +++ b/searchlib/src/tests/diskindex/fusion/fusion_test.cpp @@ -383,12 +383,6 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire fic.dump(ib); ib.close(); - vespalib::string tsName = dump2dir + "/.teststamp"; - using FileKit = search::FileKit; - ASSERT_TRUE(FileKit::createStamp(tsName)); - ASSERT_TRUE(FileKit::hasStamp(tsName)); - ASSERT_TRUE(FileKit::removeStamp(tsName)); - ASSERT_FALSE(FileKit::hasStamp(tsName)); vespalib::ThreadStackExecutor executor(4); do { diff --git a/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp b/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp index 24d790afe74..fb1fe98aa88 100644 --- a/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp @@ -482,10 +482,6 @@ FieldMerger::merge_field_start() return; } - if (FileKit::hasStamp(_field_dir + "/.mergeocc_done")) { - _state = State::MERGE_DONE; - return; - } std::filesystem::create_directory(std::filesystem::path(_field_dir)); LOG(debug, "merge_field for field %s dir %s", _field_name.c_str(), _field_dir.c_str()); @@ -507,10 +503,6 @@ FieldMerger::merge_field_finish() merge_postings_failed(); return; } - if (!FileKit::createStamp(_field_dir + "/.mergeocc_done")) { - _failed = true; - return; - } vespalib::File::sync(_field_dir); if (!clean_tmp_dirs()) { diff --git a/searchlib/src/vespa/searchlib/util/filekit.cpp b/searchlib/src/vespa/searchlib/util/filekit.cpp index 07eab9bb2be..4012ef00dae 100644 --- a/searchlib/src/vespa/searchlib/util/filekit.cpp +++ b/searchlib/src/vespa/searchlib/util/filekit.cpp @@ -9,87 +9,6 @@ LOG_SETUP(".filekit"); namespace search { -using vespalib::getLastErrorString; - -bool -FileKit::createStamp(const vespalib::string &name) -{ - FastOS_File stamp; - FastOS_StatInfo statInfo; - bool statres; - - statres = FastOS_File::Stat(name.c_str(), &statInfo); - - if (!statres && (statInfo._error != FastOS_StatInfo::FileNotFound)) { - LOG(error, "FATAL: Could not check stamp file %s: %s", - name.c_str(), getLastErrorString().c_str()); - return false; - } - if (statres && statInfo._size > 0) { - LOG(error, "FATAL: Stamp file not empty: %s", name.c_str()); - return false; - } - - if (!stamp.OpenWriteOnlyTruncate(name.c_str())) { - LOG(error, "FATAL: Could not create stamp file %s: %s", - name.c_str(), getLastErrorString().c_str()); - return false; - } - return true; -} - - -bool -FileKit::hasStamp(const vespalib::string &name) -{ - FastOS_StatInfo statInfo; - bool statres; - - statres = FastOS_File::Stat(name.c_str(), &statInfo); - - if (!statres && (statInfo._error != FastOS_StatInfo::FileNotFound)) { - LOG(error, "FATAL: Could not check stamp file %s: %s", - name.c_str(), getLastErrorString().c_str()); - return false; - } - return statres; -} - - -bool -FileKit::removeStamp(const vespalib::string &name) -{ - FastOS_StatInfo statInfo; - bool deleteres; - bool statres; - - statres = FastOS_File::Stat(name.c_str(), &statInfo); - - if (!statres && (statInfo._error != FastOS_StatInfo::FileNotFound)) { - LOG(error, "FATAL: Could not check stamp file %s: %s", - name.c_str(), getLastErrorString().c_str()); - return false; - } - if (statres && statInfo._size > 0) { - LOG(error, "FATAL: Stamp file not empty: %s", name.c_str()); - return false; - } - - do { - deleteres = FastOS_File::Delete(name.c_str()); - //FIX! errno - } while (!deleteres && errno == EINTR); - - if (!deleteres && - FastOS_File::GetLastError() != FastOS_File::ERR_ENOENT) { - LOG(error, "FATAL: Could not remove stamp file %s: %s", - name.c_str(), getLastErrorString().c_str()); - return false; - } - return true; -} - - vespalib::system_time FileKit::getModificationTime(const vespalib::string &name) { diff --git a/searchlib/src/vespa/searchlib/util/filekit.h b/searchlib/src/vespa/searchlib/util/filekit.h index 8c994ff5866..dbd6d2e5a2e 100644 --- a/searchlib/src/vespa/searchlib/util/filekit.h +++ b/searchlib/src/vespa/searchlib/util/filekit.h @@ -10,10 +10,6 @@ namespace search { class FileKit { public: - static bool createStamp(const vespalib::string &name); - static bool hasStamp(const vespalib::string &name); - static bool removeStamp(const vespalib::string &name); - /** * Returns the modification time of the given file/directory, * or time stamp 0 if stating of file/directory fails. |