gavinchou commented on code in PR #38811:
URL: https://github.com/apache/doris/pull/38811#discussion_r1703108399
##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -206,7 +202,11 @@ Status BlockFileCache::initialize() {
Status BlockFileCache::initialize_unlocked(std::lock_guard<std::mutex>&
cache_lock) {
DCHECK(!_is_initialized);
_is_initialized = true;
- _storage = std::make_unique<FSFileCacheStorage>();
+ if (is_in_memory()) {
Review Comment:
check the config::enable_in_memory_file_cache_storage instead of
introducing extra functions `is_in_memory()`
BlockFileCache should not know whether the storage is in-memory or not.
it is enough that the file cache storage knows what type it is.
##########
be/src/common/config.cpp:
##########
@@ -1018,6 +1018,8 @@ DEFINE_String(file_cache_path, "");
DEFINE_Int64(file_cache_each_block_size, "1048576"); // 1MB
DEFINE_Bool(clear_file_cache, "false");
+// cache segment files in memory instead of filesystem for no-disk/slow-disk
system
+DEFINE_Bool(use_in_memory_file_cache, "false");
Review Comment:
enable_in_memory_file_cache?
##########
be/src/io/cache/block_file_cache.h:
##########
@@ -68,6 +68,8 @@ class BlockFileCache {
/// Cache capacity in bytes.
[[nodiscard]] size_t capacity() const { return _capacity; }
+ bool is_in_memory() const { return _is_in_memory; }
Review Comment:
remove this function.
##########
be/src/io/cache/mem_file_cache_storage.h:
##########
@@ -0,0 +1,52 @@
+// 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.
+
+#pragma once
+
+#include <memory>
+#include <shared_mutex>
+#include <thread>
+
+#include "io/cache/file_cache_common.h"
+#include "io/cache/file_cache_storage.h"
+
+namespace doris::io {
+
+struct MemBlock {
+ std::shared_ptr<char> addr;
Review Comment:
why not just a std::string
--
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]