Skip to content

Commit ba1a23d

Browse files
committed
Remove default constructor of ReadSettings
1 parent e5423b2 commit ba1a23d

33 files changed

+56
-49
lines changed

programs/disks/CommandCopy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CommandCopy final : public ICommand
5757
String relative_path_from = validatePathAndGetAsRelative(path_from);
5858
String relative_path_to = validatePathAndGetAsRelative(path_to);
5959

60-
disk_from->copyDirectoryContent(relative_path_from, disk_to, relative_path_to, /* read_settings= */ {}, /* write_settings= */ {}, /* cancellation_hook= */ {});
60+
disk_from->copyDirectoryContent(relative_path_from, disk_to, relative_path_to, /* read_settings= */ getReadSettings(), /* write_settings= */ {}, /* cancellation_hook= */ {});
6161
}
6262
};
6363
}

programs/static-files-disk-uploader/static-files-disk-uploader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void processFile(const fs::path & file_path, const fs::path & dst_path, bool tes
5858
}
5959
else
6060
{
61-
ReadSettings read_settings{};
61+
ReadSettings read_settings = getReadSettings();
6262
read_settings.local_fs_method = LocalFSReadMethod::pread;
6363
auto src_buf = createReadBufferFromFileBase(file_path, read_settings, fs::file_size(file_path));
6464
std::shared_ptr<WriteBuffer> dst_buf;

src/Backups/BackupFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class BackupFactory : boost::noncopyable
4242
bool allow_azure_native_copy = true;
4343
bool use_same_s3_credentials_for_base_backup = false;
4444
bool azure_attempt_to_create_container = true;
45-
ReadSettings read_settings;
45+
ReadSettings read_settings = getReadSettings();
4646
WriteSettings write_settings;
4747
};
4848

src/Backups/tests/gtest_backup_entries.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ class BackupEntriesTest : public ::testing::Test
7070

7171
static String getChecksum(const BackupEntryPtr & backup_entry)
7272
{
73-
return getHexUIntUppercase(backup_entry->getChecksum({}));
73+
return getHexUIntUppercase(backup_entry->getChecksum(getReadSettings()));
7474
}
7575

7676
static const constexpr std::string_view NO_CHECKSUM = "no checksum";
7777

7878
static String getPartialChecksum(const BackupEntryPtr & backup_entry, size_t prefix_length)
7979
{
80-
auto partial_checksum = backup_entry->getPartialChecksum(prefix_length, {});
80+
auto partial_checksum = backup_entry->getPartialChecksum(prefix_length, getReadSettings());
8181
if (!partial_checksum)
8282
return String{NO_CHECKSUM};
8383
return getHexUIntUppercase(*partial_checksum);
8484
}
8585

8686
static String readAll(const BackupEntryPtr & backup_entry)
8787
{
88-
auto in = backup_entry->getReadBuffer({});
88+
auto in = backup_entry->getReadBuffer(getReadSettings());
8989
String str;
9090
readStringUntilEOF(str, *in);
9191
return str;

src/Compression/getCompressionCodecForFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using Checksum = CityHash_v1_0_2::uint128;
1515

1616
CompressionCodecPtr getCompressionCodecForFile(const IDataPartStorage & data_part_storage, const String & relative_path)
1717
{
18-
auto read_buffer = data_part_storage.readFile(relative_path, {}, std::nullopt, std::nullopt);
18+
auto read_buffer = data_part_storage.readFile(relative_path, getReadSettings(), std::nullopt, std::nullopt);
1919
read_buffer->ignore(sizeof(Checksum));
2020

2121
UInt8 header_size = ICompressionCodec::getHeaderSize();

src/Coordination/KeeperCommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void moveFileBetweenDisks(
107107
"creating temporary file"))
108108
return;
109109

110-
if (!run_with_retries([&] { disk_from->copyFile(from_path, *disk_to, path_to, {}); }, "copying file"))
110+
if (!run_with_retries([&] { disk_from->copyFile(from_path, *disk_to, path_to, getReadSettings()); }, "copying file"))
111111
return;
112112

113113
if (!run_with_retries([&] { disk_to->removeFileIfExists(tmp_file_name); }, "removing temporary file"))

src/Coordination/KeeperSnapshotManagerS3.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ void KeeperSnapshotManagerS3::uploadSnapshotImpl(const SnapshotFileInfo & snapsh
173173

174174
LOG_INFO(log, "Will try to upload snapshot on {} to S3", snapshot_path);
175175

176-
auto snapshot_file = snapshot_disk->readFile(snapshot_path, getReadSettings());
176+
auto read_settings = getReadSettings();
177+
auto snapshot_file = snapshot_disk->readFile(snapshot_path, read_settings);
177178

178179
auto snapshot_name = fs::path(snapshot_path).filename().string();
179180
auto lock_file = fmt::format(".{}_LOCK", snapshot_name);
@@ -208,7 +209,7 @@ void KeeperSnapshotManagerS3::uploadSnapshotImpl(const SnapshotFileInfo & snapsh
208209
lock_file,
209210
"",
210211
request_settings_2,
211-
{}
212+
read_settings
212213
};
213214

214215
std::string read_uuid;

src/Coordination/KeeperStateManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void KeeperStateManager::save_state(const nuraft::srv_state & state)
339339
{
340340
auto buf = disk->writeFile(copy_lock_file);
341341
buf->finalize();
342-
disk->copyFile(server_state_file_name, *disk, old_path, ReadSettings{});
342+
disk->copyFile(server_state_file_name, *disk, old_path, getReadSettings());
343343
disk->removeFile(copy_lock_file);
344344
disk->removeFile(old_path);
345345
}

src/Coordination/Standalone/Context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ ThrottlerPtr Context::getLocalWriteThrottler() const
387387

388388
ReadSettings Context::getReadSettings() const
389389
{
390-
return ReadSettings{};
390+
return ReadSettings(*this);
391391
}
392392

393393
ResourceManagerPtr Context::getResourceManager() const

src/Disks/DiskLocal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ void DiskLocal::shutdown()
525525
std::optional<UInt32> DiskLocal::readDiskCheckerMagicNumber() const noexcept
526526
try
527527
{
528-
ReadSettings read_settings;
528+
ReadSettings read_settings = getReadSettings();
529529
/// Proper disk read checking requires direct io
530530
read_settings.direct_io_threshold = 1;
531531
auto buf = readFile(disk_checker_path, read_settings, {}, {});

0 commit comments

Comments
 (0)