Skip to content

Commit 88d0cfd

Browse files
committed
v2
1 parent 42b5f36 commit 88d0cfd

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

be/src/io/cache/file_block.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@ FileBlock::State FileBlock::wait() {
226226
}
227227

228228
if (_download_state == State::DOWNLOADING) {
229-
#if !defined(BE_TEST)
230229
DCHECK(_downloader_id != 0 && _downloader_id != get_caller_id());
231-
#endif
232230
_cv.wait_for(block_lock, std::chrono::milliseconds(config::block_cache_wait_timeout_ms));
233231
}
234232

be/src/io/tools/s3_writer_tool.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int main(int argc, char* argv[]) {
2727

2828
std::string bucket = "gavin-test-hk-1308700295";
2929
// prefix, in key
30-
std::string key = "/dx_micro_bench/test25/aaaaaa";
30+
std::string key = "dx_micro_bench/test25/aaaaaa";
3131
size_t data_size = std::stoull(argv[3]); // 数据大小(字节)
3232

3333
// 生成随机数据
@@ -65,6 +65,7 @@ int main(int argc, char* argv[]) {
6565
// 写入数据到 S3
6666
{
6767
doris::io::FileWriterOptions options;
68+
options.write_file_cache = true;
6869
auto writer = std::make_unique<doris::io::S3FileWriter>(client, bucket, key, &options);
6970

7071
doris::Slice slice(data.data(), data.size());
@@ -84,17 +85,20 @@ int main(int argc, char* argv[]) {
8485
std::cout << "Data written to S3 successfully." << std::endl;
8586
}
8687

88+
std::this_thread::sleep_for(std::chrono::seconds(1));
89+
8790
// 使用 CachedRemoteFileReader 读取数据进行验证
8891
{
8992
// 创建读取选项
9093
doris::io::FileReaderOptions reader_opts;
9194
reader_opts.cache_type = doris::io::FileCachePolicy::FILE_BLOCK_CACHE;
92-
reader_opts.is_doris_table = false; // 非 Doris 表数据
93-
reader_opts.cache_base_path = "/mnt/disk2/dengxin/file_cache";
95+
reader_opts.is_doris_table = true; // 非 Doris 表数据
96+
// reader_opts.cache_base_path = "/mnt/disk2/dengxin/file_cache";
9497

9598
// 创建基础的 S3FileReader
9699
doris::io::FileDescription fd;
97-
fd.path = doris::io::Path("s3://" + bucket + key);
100+
std::cout << "read = s3://" + bucket + "/" + key << std::endl;
101+
fd.path = doris::io::Path("s3://" + bucket + "/" + key);
98102
doris::io::FileSystemProperties fs_props;
99103
fs_props.system_type = doris::TFileType::FILE_S3;
100104

@@ -126,9 +130,6 @@ int main(int argc, char* argv[]) {
126130
return 1;
127131
}
128132

129-
// 创建 CachedRemoteFileReader
130-
auto cached_reader = std::make_shared<doris::io::CachedRemoteFileReader>(s3_reader, reader_opts);
131-
132133
// 准备读取缓冲区
133134
std::string read_buffer;
134135
read_buffer.resize(data.size());
@@ -141,7 +142,7 @@ int main(int argc, char* argv[]) {
141142

142143
// 读取数据
143144
size_t bytes_read = 0;
144-
doris::Status read_status = cached_reader->read_at(0, read_slice, &bytes_read, &io_ctx);
145+
doris::Status read_status = s3_reader->read_at(0, read_slice, &bytes_read, &io_ctx);
145146

146147
if (!read_status.ok()) {
147148
std::cerr << "Error reading from S3: " << read_status.to_string() << std::endl;

be/src/runtime/exec_env_init.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ void ExecEnv::init_file_cache_microbench_env() {
686686
LOG(INFO) << "p=" << p.path;
687687
}
688688
LOG(INFO) << "end....";
689-
689+
_file_cache_open_fd_cache = std::make_unique<io::FDCache>();
690690
}
691691
#endif
692692
// TODO(zhiqiang): Need refactor all thread pool. Each thread pool must have a Stop method.

0 commit comments

Comments
 (0)