gavinchou commented on code in PR #65658: URL: https://github.com/apache/doris/pull/65658#discussion_r3792368877
########## be/src/io/cache/cached_remote_file_reader_async_write.cpp: ########## @@ -0,0 +1,680 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include <bvar/bvar.h> +#include <glog/logging.h> + +#include <algorithm> +#include <cstring> +#include <memory> +#include <optional> +#include <utility> +#include <vector> + +#include "common/compiler_util.h" // IWYU pragma: keep +#include "common/config.h" +#include "cpp/sync_point.h" +#include "io/cache/async_cache_write_service.h" +#include "io/cache/block_file_cache.h" +#include "io/cache/cached_remote_file_reader.h" +#include "io/cache/inflight_write_buffer_index.h" +#include "io/io_common.h" +#include "runtime/runtime_profile.h" +#include "util/defer_op.h" +#include "util/time.h" + +namespace doris::io { + +// These counters are shared by the synchronous and asynchronous indirect-read paths, so their +// definitions remain in cached_remote_file_reader.cpp. +extern bvar::Adder<uint64_t> g_read_cache_indirect_num; +extern bvar::Adder<uint64_t> g_read_cache_indirect_bytes; +extern bvar::Adder<uint64_t> g_read_cache_indirect_total_bytes; +extern bvar::Adder<uint64_t> g_read_cache_self_heal_on_not_found; + +namespace { + +bvar::Adder<uint64_t> g_cached_remote_reader_probe_total("cached_remote_file_reader_probe_total"); Review Comment: add UNIT in the names add `count` or `bytes` to the exposed names ########## be/src/io/fs/packed_file_manager.cpp: ########## @@ -372,7 +372,7 @@ Status PackedFileManager::append_small_file(const std::string& path, const Slice // Async write data to file cache using small file path as cache key. // This ensures cache key matches the cleanup key in Rowset::clear_cache(), // allowing proper cache cleanup when stale rowsets are removed. - if (info.write_file_cache) { + if (info.write_file_cache && config::enable_file_cache_write_from_s3_file_writer) { Review Comment: if `enable_file_cache_write_from_s3_file_writer` is for testing only, we should no add a new config item for it. use a variable like `disable_xxx_for_test` and SYNC_POINT to change it. e.g. ``` bool disable_xxx_for_test = false; TEST_SYNCPOINT("disable_xxx_for_test", &disable_xxx_for_test); if (info.write_file_cache && !disable_xxx_for_test) { ... ``` ########## be/src/io/fs/s3_file_bufferpool.cpp: ########## @@ -171,7 +171,8 @@ void UploadFileBuffer::on_upload() { * write the content of the memory buffer to local file cache */ void UploadFileBuffer::upload_to_local_file_cache(bool is_cancelled) { - if (!config::enable_file_cache || _alloc_holder == nullptr) { + if (!config::enable_file_cache_write_from_s3_file_writer || !config::enable_file_cache || Review Comment: use test_sync_piont instead ########## be/src/io/cache/cached_remote_file_reader.cpp: ########## @@ -1280,6 +1292,7 @@ void CachedRemoteFileReader::prefetch_range(size_t offset, size_t size, const IO dryrun_ctx = *io_ctx; } dryrun_ctx.is_dryrun = true; + dryrun_ctx.cache_write_mode_override = CacheWriteMode::SYNC_WRITE; Review Comment: add some comment why it cannot be `async` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
