diff --git a/src/Disks/IO/CachedReadBufferFromRemoteFS.cpp b/src/Disks/IO/CachedReadBufferFromRemoteFS.cpp index 5be90ac9393..34cbc7a7e1b 100644 --- a/src/Disks/IO/CachedReadBufferFromRemoteFS.cpp +++ b/src/Disks/IO/CachedReadBufferFromRemoteFS.cpp @@ -72,10 +72,10 @@ void CachedReadBufferFromRemoteFS::appendFilesystemCacheLog( elem.read_type = FilesystemCacheLogElement::ReadType::READ_FROM_CACHE; break; case CachedReadBufferFromRemoteFS::ReadType::REMOTE_FS_READ_BYPASS_CACHE: - elem.read_type = FilesystemCacheLogElement::ReadType::READ_FROM_FS_AND_DOWNLOADED_TO_CACHE; + elem.read_type = FilesystemCacheLogElement::ReadType::READ_FROM_FS_BYPASSING_CACHE; break; case CachedReadBufferFromRemoteFS::ReadType::REMOTE_FS_READ_AND_PUT_IN_CACHE: - elem.read_type = FilesystemCacheLogElement::ReadType::READ_FROM_FS_BYPASSING_CACHE; + elem.read_type = FilesystemCacheLogElement::ReadType::READ_FROM_FS_AND_DOWNLOADED_TO_CACHE; break; } diff --git a/tests/queries/0_stateless/02240_system_remote_filesystem_cache_log.reference b/tests/queries/0_stateless/02240_system_remote_filesystem_cache_log.reference new file mode 100644 index 00000000000..05d899391ba --- /dev/null +++ b/tests/queries/0_stateless/02240_system_remote_filesystem_cache_log.reference @@ -0,0 +1,18 @@ +-- { echo } + +SYSTEM DROP FILESYSTEM CACHE; +SET enable_filesystem_cache_log=1; +SET enable_filesystem_cache_on_write_operations=0; +DROP TABLE IF EXISTS test; +DROP TABLE IF EXISTS system.filesystem_cache_log; +CREATE TABLE test (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='only_s3', min_bytes_for_wide_part = 10485760; +INSERT INTO test SELECT number, toString(number) FROM numbers(100000); +SELECT * FROM test FORMAT Null; +SYSTEM FLUSH LOGS; +SELECT file_segment_range, read_type FROM system.filesystem_cache_log WHERE read_type='READ_FROM_FS_AND_DOWNLOADED_TO_CACHE'; +(0,519) READ_FROM_FS_AND_DOWNLOADED_TO_CACHE +(0,808110) READ_FROM_FS_AND_DOWNLOADED_TO_CACHE +SELECT * FROM test FORMAT Null; +SYSTEM FLUSH LOGS; +SELECT file_segment_range, read_type FROM system.filesystem_cache_log WHERE read_type='READ_FROM_CACHE'; +(0,808110) READ_FROM_CACHE diff --git a/tests/queries/0_stateless/02240_system_remote_filesystem_cache_log.sql b/tests/queries/0_stateless/02240_system_remote_filesystem_cache_log.sql new file mode 100644 index 00000000000..59e164d6f9f --- /dev/null +++ b/tests/queries/0_stateless/02240_system_remote_filesystem_cache_log.sql @@ -0,0 +1,20 @@ +-- Tags: no-parallel, no-fasttest, no-s3-storage + +-- { echo } + +SYSTEM DROP FILESYSTEM CACHE; +SET enable_filesystem_cache_log=1; +SET enable_filesystem_cache_on_write_operations=0; + +DROP TABLE IF EXISTS test; +DROP TABLE IF EXISTS system.filesystem_cache_log; +CREATE TABLE test (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='s3_cache', min_bytes_for_wide_part = 10485760; +INSERT INTO test SELECT number, toString(number) FROM numbers(100000); + +SELECT * FROM test FORMAT Null; +SYSTEM FLUSH LOGS; +SELECT file_segment_range, read_type FROM system.filesystem_cache_log WHERE read_type='READ_FROM_FS_AND_DOWNLOADED_TO_CACHE'; + +SELECT * FROM test FORMAT Null; +SYSTEM FLUSH LOGS; +SELECT file_segment_range, read_type FROM system.filesystem_cache_log WHERE read_type='READ_FROM_CACHE';