diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-07-17 13:49:10 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-07-17 13:49:10 +0200 |
commit | ad6ad6579df67442563eb08131a74f8e1be71a3b (patch) | |
tree | 997ba60d58c9a00f4bf870d11e89b4b782225374 /searchcore | |
parent | dab95e8297ce1ddedcd64b57606ad03bfa36dce7 (diff) |
Reduce use of vespalib::unlink.
Diffstat (limited to 'searchcore')
5 files changed, 10 insertions, 11 deletions
diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index db2675a7779..1fc5c40a47a 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -15,9 +15,9 @@ #include <vespa/searchcore/proton/test/documentdb_config_builder.h> #include <vespa/searchcore/proton/test/transport_helper.h> #include <vespa/searchsummary/config/config-juniperrc.h> -#include <vespa/vespalib/io/fileutil.h> #include <vespa/config-bucketspaces.h> #include <vespa/vespalib/testkit/test_kit.h> +#include <filesystem> using namespace cloud::config::filedistribution; @@ -165,7 +165,7 @@ TEST_FF("requireThatConfigCanBeSerializedAndDeserialized", Transport(), Document TEST_FF("requireThatConfigCanBeLoadedWithoutExtraConfigsDataFile", Transport(), DocumentDBConfig::SP(makeBaseConfigSnapshot(f1.transport()))) { saveBaseConfigSnapshot(f1.transport(), *f2, 70); - EXPECT_FALSE(vespalib::unlink("out/config-70/extraconfigs.dat")); + EXPECT_FALSE(std::filesystem::remove(std::filesystem::path("out/config-70/extraconfigs.dat"))); DocumentDBConfig::SP esnap(makeEmptyConfigSnapshot()); { FileConfigManager cm(f1.transport(), "out", myId, "dummy"); diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 6e9d4be97aa..f88e89db25e 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -21,11 +21,11 @@ #include <vespa/searchlib/queryeval/simpleresult.h> #include <vespa/searchlib/queryeval/blueprint.h> #include <vespa/vespalib/gtest/gtest.h> -#include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <filesystem> #include <thread> #include <vespa/log/log.h> @@ -525,7 +525,7 @@ TEST(DocumentMetaStoreTest, gids_can_be_saved_and_loaded) EXPECT_EQ(numLids + 1, dms2.getNumDocs()); EXPECT_EQ(numLids - (3 - i), dms2.getNumUsedLids()); } - vespalib::unlink("documentmetastore2.dat"); + std::filesystem::remove(std::filesystem::path("documentmetastore2.dat")); } TEST(DocumentMetaStoreTest, bucket_used_bits_are_lbounded_at_load_time) @@ -551,7 +551,7 @@ TEST(DocumentMetaStoreTest, bucket_used_bits_are_lbounded_at_load_time) BucketId expected_bucket(storage::spi::BucketLimits::MinUsedBits, gid.convertToBucketId().getRawId()); assertGid(gid, lid, dms2, expected_bucket, Timestamp(1000)); - vespalib::unlink("documentmetastore2.dat"); + std::filesystem::remove(std::filesystem::path("documentmetastore2.dat")); } TEST(DocumentMetaStore, stats_are_updated) @@ -1915,8 +1915,8 @@ TEST(DocumentMetaStoreTest, document_sizes_are_saved) assertSize(dms4, 1, 1); assertSize(dms4, 2, 1); assertSize(dms4, 3, 1); - vespalib::unlink("documentmetastore3.dat"); - vespalib::unlink("documentmetastore4.dat"); + std::filesystem::remove(std::filesystem::path("documentmetastore3.dat")); + std::filesystem::remove(std::filesystem::path("documentmetastore4.dat")); } namespace { diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp index e25eb5c422c..c893bb6fe2b 100644 --- a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp @@ -5,7 +5,6 @@ #include <vespa/config/print/fileconfigwriter.h> #include <vespa/config/subscription/configsubscriber.hpp> #include <vespa/fastos/file.h> -#include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/time.h> #include <vespa/vespalib/util/resource_limits.h> #include <vespa/vespalib/util/size_literals.h> @@ -107,7 +106,7 @@ double measureDiskWriteSpeed(const vespalib::string &path, double elapsed = vespalib::to_s(after - before); diskWriteSpeed = diskWriteLen / elapsed / 1_Mi; } - vespalib::unlink(fileName); + std::filesystem::remove(std::filesystem::path(fileName)); return diskWriteSpeed; } diff --git a/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp b/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp index 704364dfb9b..51d6938b13b 100644 --- a/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp +++ b/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp @@ -39,7 +39,7 @@ bool isValidIndex(const string &index_dir) { } void invalidateIndex(const string &index_dir) { - vespalib::unlink(index_dir + "/serial.dat"); + std::filesystem::remove(std::filesystem::path(index_dir + "/serial.dat")); vespalib::File::sync(index_dir); } diff --git a/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp b/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp index 97afce79861..8e1940cdc08 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp @@ -159,7 +159,7 @@ IndexWriteUtilities::updateDiskIndexSchema(const vespalib::string &indexDir, } vespalib::string schemaTmpName = schemaName + ".tmp"; vespalib::string schemaOrigName = schemaName + ".orig"; - vespalib::unlink(schemaTmpName); + std::filesystem::remove(std::filesystem::path(schemaTmpName)); if (!newSchema->saveToFile(schemaTmpName)) { LOG(error, "Could not save schema to '%s'", schemaTmpName.c_str()); |