Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement](cloud) clarify codes and make TTL expiration work after abnormal cache type transition #40226

Merged
merged 10 commits into from
Sep 12, 2024

Conversation

freemandealer
Copy link
Contributor

@freemandealer freemandealer commented Sep 1, 2024

current TTL embeds the expiration time and type into filename and path. Maintaining both is buggy for lack of atomicity. I simplify this by using only expiration time to infer the type so that we need only expiration time.

Proposed changes

Issue Number: close #xxx

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@freemandealer freemandealer changed the title [wip][enhancement](cloud) Fix cache type transition [wip][enhancement](cloud) clarify codes and make TTL expiration work after abnormal cache type transition Sep 2, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@apache apache deleted a comment from github-actions bot Sep 2, 2024
@apache apache deleted a comment from github-actions bot Sep 2, 2024
@apache apache deleted a comment from github-actions bot Sep 2, 2024
RETURN_IF_ERROR(fs->open_file(file, &file_reader));
Status s = fs->open_file(file, &file_reader);
if (!s.ok()) {
if (key.meta.type == FileCacheType::TTL) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return first to reduce indention.

Suggested change
if (key.meta.type == FileCacheType::TTL) {
if (key.meta.type != FileCacheType::TTL) return s;

@apache apache deleted a comment from github-actions bot Sep 2, 2024
@apache apache deleted a comment from github-actions bot Sep 2, 2024
@apache apache deleted a comment from github-actions bot Sep 2, 2024

Status read_file_cache_version(std::string* buffer) const;

Status parse_filename_suffix_to_cache_type(const std::shared_ptr<LocalFileSystem>& fs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add UT for this function

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -227,7 +286,7 @@ std::string FSFileCacheStorage::get_path_in_local_cache(const UInt128Wrapper& va
}
}

Status FSFileCacheStorage::rebuild_data_structure() const {
Status FSFileCacheStorage::upgrade_cache_dir_if_necessary() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'upgrade_cache_dir_if_necessary' has cognitive complexity of 119 (threshold 50) [readability-function-cognitive-complexity]

Status FSFileCacheStorage::upgrade_cache_dir_if_necessary() const {
                           ^
Additional context

be/src/io/cache/fs_file_cache_storage.cpp:292: +1, including nesting penalty of 0, nesting level increased to 1

    RETURN_IF_ERROR(read_file_cache_version(&version));
    ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:292: +2, including nesting penalty of 1, nesting level increased to 2

    RETURN_IF_ERROR(read_file_cache_version(&version));
    ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:293: +1, including nesting penalty of 0, nesting level increased to 1

    if (USE_CACHE_VERSION2 && version != "2.0") {
    ^

be/src/io/cache/fs_file_cache_storage.cpp:293: +1

    if (USE_CACHE_VERSION2 && version != "2.0") {
                           ^

be/src/io/cache/fs_file_cache_storage.cpp:297: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:301: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_it != std::filesystem::directory_iterator(); ++key_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:302: +3, including nesting penalty of 2, nesting level increased to 3

            if (key_it->is_directory()) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:304: +4, including nesting penalty of 3, nesting level increased to 4

                if (cache_key.size() > KEY_PREFIX_LENGTH) {
                ^

be/src/io/cache/fs_file_cache_storage.cpp:308: +5, including nesting penalty of 4, nesting level increased to 5

                    RETURN_IF_ERROR(fs->exists(key_prefix, &exists));
                    ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:308: +6, including nesting penalty of 5, nesting level increased to 6

                    RETURN_IF_ERROR(fs->exists(key_prefix, &exists));
                    ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:309: +5, including nesting penalty of 4, nesting level increased to 5

                    if (!exists) {
                    ^

be/src/io/cache/fs_file_cache_storage.cpp:310: +6, including nesting penalty of 5, nesting level increased to 6

                        RETURN_IF_ERROR(fs->create_directory(key_prefix));
                        ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:310: +7, including nesting penalty of 6, nesting level increased to 7

                        RETURN_IF_ERROR(fs->create_directory(key_prefix));
                        ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:312: +5, including nesting penalty of 4, nesting level increased to 5

                    RETURN_IF_ERROR(fs->rename(key_it->path(), key_prefix / cache_key));
                    ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:312: +6, including nesting penalty of 5, nesting level increased to 6

                    RETURN_IF_ERROR(fs->rename(key_it->path(), key_prefix / cache_key));
                    ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:316: +2, including nesting penalty of 1, nesting level increased to 2

        if (!write_file_cache_version().ok()) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:321: nesting level increased to 1

    auto rebuild_dir = [&](std::filesystem::directory_iterator& upgrade_key_it) -> Status {
                       ^

be/src/io/cache/fs_file_cache_storage.cpp:322: +2, including nesting penalty of 1, nesting level increased to 2

        for (; upgrade_key_it != std::filesystem::directory_iterator(); ++upgrade_key_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:323: +3, including nesting penalty of 2, nesting level increased to 3

            if (upgrade_key_it->path().filename().native().find('_') == std::string::npos) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:324: +4, including nesting penalty of 3, nesting level increased to 4

                RETURN_IF_ERROR(fs->delete_directory(upgrade_key_it->path().native() + "_0"));
                ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:324: +5, including nesting penalty of 4, nesting level increased to 5

                RETURN_IF_ERROR(fs->delete_directory(upgrade_key_it->path().native() + "_0"));
                ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:325: +4, including nesting penalty of 3, nesting level increased to 4

                RETURN_IF_ERROR(
                ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:325: +5, including nesting penalty of 4, nesting level increased to 5

                RETURN_IF_ERROR(
                ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:332: +1, including nesting penalty of 0, nesting level increased to 1

    if constexpr (USE_CACHE_VERSION2) {
    ^

be/src/io/cache/fs_file_cache_storage.cpp:334: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) [[unlikely]] {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:338: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_prefix_it != std::filesystem::directory_iterator(); ++key_prefix_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:339: +3, including nesting penalty of 2, nesting level increased to 3

            if (!key_prefix_it->is_directory()) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:343: +3, including nesting penalty of 2, nesting level increased to 3

            if (key_prefix_it->path().filename().native().size() != KEY_PREFIX_LENGTH) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:346: +4, including nesting penalty of 3, nesting level increased to 4

                RETURN_IF_ERROR(fs->delete_directory(key_prefix_it->path()));
                ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:346: +5, including nesting penalty of 4, nesting level increased to 5

                RETURN_IF_ERROR(fs->delete_directory(key_prefix_it->path()));
                ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:349: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) [[unlikely]] {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:352: +3, including nesting penalty of 2, nesting level increased to 3

            RETURN_IF_ERROR(rebuild_dir(key_it));
            ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:352: +4, including nesting penalty of 3, nesting level increased to 4

            RETURN_IF_ERROR(rebuild_dir(key_it));
            ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:354: +1, nesting level increased to 1

    } else {
      ^

be/src/io/cache/fs_file_cache_storage.cpp:356: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) [[unlikely]] {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:359: +2, including nesting penalty of 1, nesting level increased to 2

        RETURN_IF_ERROR(rebuild_dir(key_it));
        ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:359: +3, including nesting penalty of 2, nesting level increased to 3

        RETURN_IF_ERROR(rebuild_dir(key_it));
        ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

}
return Status::OK();
}

void FSFileCacheStorage::load_cache_info_into_memory(BlockFileCache* _mgr) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'load_cache_info_into_memory' has cognitive complexity of 53 (threshold 50) [readability-function-cognitive-complexity]

void FSFileCacheStorage::load_cache_info_into_memory(BlockFileCache* _mgr) const {
                         ^
Additional context

be/src/io/cache/fs_file_cache_storage.cpp:469: nesting level increased to 1

    auto add_cell_batch_func = [&]() {
                               ^

be/src/io/cache/fs_file_cache_storage.cpp:471: nesting level increased to 2

        auto f = [&](const BatchLoadArgs& args) {
                 ^

be/src/io/cache/fs_file_cache_storage.cpp:473: +3, including nesting penalty of 2, nesting level increased to 3

            if (_mgr->_files.contains(args.hash) && _mgr->_files[args.hash].contains(args.offset)) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:473: +1

            if (_mgr->_files.contains(args.hash) && _mgr->_files[args.hash].contains(args.offset)) {
                                                 ^

be/src/io/cache/fs_file_cache_storage.cpp:475: +4, including nesting penalty of 3, nesting level increased to 4

                if (file_block->expiration_time() != args.ctx.expiration_time ||
                ^

be/src/io/cache/fs_file_cache_storage.cpp:475: +1

                if (file_block->expiration_time() != args.ctx.expiration_time ||
                                                                              ^

be/src/io/cache/fs_file_cache_storage.cpp:489: +3, including nesting penalty of 2, nesting level increased to 3

            if (!args.is_tmp) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:496: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:504: nesting level increased to 1

    auto scan_file_cache = [&](std::filesystem::directory_iterator& key_it) {
                           ^

be/src/io/cache/fs_file_cache_storage.cpp:506: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_it != std::filesystem::directory_iterator(); ++key_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:515: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) [[unlikely]] {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:524: +3, including nesting penalty of 2, nesting level increased to 3

            for (; offset_it != std::filesystem::directory_iterator(); ++offset_it) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:529: +4, including nesting penalty of 3, nesting level increased to 4

                if (!parse_filename_suffix_to_cache_type(fs, offset_it->path().filename().native(),
                ^

be/src/io/cache/fs_file_cache_storage.cpp:546: +4, including nesting penalty of 3, nesting level increased to 4

                if (batch_load_buffer.size() >= scan_length) {
                ^

be/src/io/cache/fs_file_cache_storage.cpp:554: +1, including nesting penalty of 0, nesting level increased to 1

    if constexpr (USE_CACHE_VERSION2) {
    ^

be/src/io/cache/fs_file_cache_storage.cpp:556: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:560: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_prefix_it != std::filesystem::directory_iterator(); ++key_prefix_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:561: +3, including nesting penalty of 2, nesting level increased to 3

            if (!key_prefix_it->is_directory()) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:565: +3, including nesting penalty of 2, nesting level increased to 3

            if (key_prefix_it->path().filename().native().size() != KEY_PREFIX_LENGTH) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:570: +4, including nesting penalty of 3, nesting level increased to 4

                if (ec) {
                ^

be/src/io/cache/fs_file_cache_storage.cpp:577: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:583: +1, nesting level increased to 1

    } else {
      ^

be/src/io/cache/fs_file_cache_storage.cpp:585: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:591: +1, including nesting penalty of 0, nesting level increased to 1

    if (!batch_load_buffer.empty()) {
    ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}
return Status::OK();
}

void FSFileCacheStorage::load_cache_info_into_memory(BlockFileCache* _mgr) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'load_cache_info_into_memory' has cognitive complexity of 53 (threshold 50) [readability-function-cognitive-complexity]

void FSFileCacheStorage::load_cache_info_into_memory(BlockFileCache* _mgr) const {
                         ^
Additional context

be/src/io/cache/fs_file_cache_storage.cpp:469: nesting level increased to 1

    auto add_cell_batch_func = [&]() {
                               ^

be/src/io/cache/fs_file_cache_storage.cpp:471: nesting level increased to 2

        auto f = [&](const BatchLoadArgs& args) {
                 ^

be/src/io/cache/fs_file_cache_storage.cpp:473: +3, including nesting penalty of 2, nesting level increased to 3

            if (_mgr->_files.contains(args.hash) && _mgr->_files[args.hash].contains(args.offset)) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:473: +1

            if (_mgr->_files.contains(args.hash) && _mgr->_files[args.hash].contains(args.offset)) {
                                                 ^

be/src/io/cache/fs_file_cache_storage.cpp:475: +4, including nesting penalty of 3, nesting level increased to 4

                if (file_block->expiration_time() != args.ctx.expiration_time ||
                ^

be/src/io/cache/fs_file_cache_storage.cpp:475: +1

                if (file_block->expiration_time() != args.ctx.expiration_time ||
                                                                              ^

be/src/io/cache/fs_file_cache_storage.cpp:489: +3, including nesting penalty of 2, nesting level increased to 3

            if (!args.is_tmp) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:496: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:504: nesting level increased to 1

    auto scan_file_cache = [&](std::filesystem::directory_iterator& key_it) {
                           ^

be/src/io/cache/fs_file_cache_storage.cpp:506: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_it != std::filesystem::directory_iterator(); ++key_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:515: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) [[unlikely]] {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:524: +3, including nesting penalty of 2, nesting level increased to 3

            for (; offset_it != std::filesystem::directory_iterator(); ++offset_it) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:529: +4, including nesting penalty of 3, nesting level increased to 4

                if (!parse_filename_suffix_to_cache_type(fs, offset_it->path().filename().native(),
                ^

be/src/io/cache/fs_file_cache_storage.cpp:546: +4, including nesting penalty of 3, nesting level increased to 4

                if (batch_load_buffer.size() >= scan_length) {
                ^

be/src/io/cache/fs_file_cache_storage.cpp:554: +1, including nesting penalty of 0, nesting level increased to 1

    if constexpr (USE_CACHE_VERSION2) {
    ^

be/src/io/cache/fs_file_cache_storage.cpp:557: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:561: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_prefix_it != std::filesystem::directory_iterator(); ++key_prefix_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:562: +3, including nesting penalty of 2, nesting level increased to 3

            if (!key_prefix_it->is_directory()) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:566: +3, including nesting penalty of 2, nesting level increased to 3

            if (key_prefix_it->path().filename().native().size() != KEY_PREFIX_LENGTH) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:571: +4, including nesting penalty of 3, nesting level increased to 4

                if (ec) {
                ^

be/src/io/cache/fs_file_cache_storage.cpp:578: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:584: +1, nesting level increased to 1

    } else {
      ^

be/src/io/cache/fs_file_cache_storage.cpp:586: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:592: +1, including nesting penalty of 0, nesting level increased to 1

    if (!batch_load_buffer.empty()) {
    ^

fs::remove_all(cache_base_path);
}
fs::create_directories(cache_base_path);
auto sp = SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = SyncPoint::get_instance();
h);auto *

@freemandealer
Copy link
Contributor Author

run buildall

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -227,7 +289,7 @@ std::string FSFileCacheStorage::get_path_in_local_cache(const UInt128Wrapper& va
}
}

Status FSFileCacheStorage::rebuild_data_structure() const {
Status FSFileCacheStorage::upgrade_cache_dir_if_necessary() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'upgrade_cache_dir_if_necessary' has cognitive complexity of 119 (threshold 50) [readability-function-cognitive-complexity]

Status FSFileCacheStorage::upgrade_cache_dir_if_necessary() const {
                           ^
Additional context

be/src/io/cache/fs_file_cache_storage.cpp:295: +1, including nesting penalty of 0, nesting level increased to 1

    RETURN_IF_ERROR(read_file_cache_version(&version));
    ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:295: +2, including nesting penalty of 1, nesting level increased to 2

    RETURN_IF_ERROR(read_file_cache_version(&version));
    ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:296: +1, including nesting penalty of 0, nesting level increased to 1

    if (USE_CACHE_VERSION2 && version != "2.0") {
    ^

be/src/io/cache/fs_file_cache_storage.cpp:296: +1

    if (USE_CACHE_VERSION2 && version != "2.0") {
                           ^

be/src/io/cache/fs_file_cache_storage.cpp:300: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:304: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_it != std::filesystem::directory_iterator(); ++key_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:305: +3, including nesting penalty of 2, nesting level increased to 3

            if (key_it->is_directory()) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:307: +4, including nesting penalty of 3, nesting level increased to 4

                if (cache_key.size() > KEY_PREFIX_LENGTH) {
                ^

be/src/io/cache/fs_file_cache_storage.cpp:311: +5, including nesting penalty of 4, nesting level increased to 5

                    RETURN_IF_ERROR(fs->exists(key_prefix, &exists));
                    ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:311: +6, including nesting penalty of 5, nesting level increased to 6

                    RETURN_IF_ERROR(fs->exists(key_prefix, &exists));
                    ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:312: +5, including nesting penalty of 4, nesting level increased to 5

                    if (!exists) {
                    ^

be/src/io/cache/fs_file_cache_storage.cpp:313: +6, including nesting penalty of 5, nesting level increased to 6

                        RETURN_IF_ERROR(fs->create_directory(key_prefix));
                        ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:313: +7, including nesting penalty of 6, nesting level increased to 7

                        RETURN_IF_ERROR(fs->create_directory(key_prefix));
                        ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:315: +5, including nesting penalty of 4, nesting level increased to 5

                    RETURN_IF_ERROR(fs->rename(key_it->path(), key_prefix / cache_key));
                    ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:315: +6, including nesting penalty of 5, nesting level increased to 6

                    RETURN_IF_ERROR(fs->rename(key_it->path(), key_prefix / cache_key));
                    ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:319: +2, including nesting penalty of 1, nesting level increased to 2

        if (!write_file_cache_version().ok()) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:324: nesting level increased to 1

    auto rebuild_dir = [&](std::filesystem::directory_iterator& upgrade_key_it) -> Status {
                       ^

be/src/io/cache/fs_file_cache_storage.cpp:325: +2, including nesting penalty of 1, nesting level increased to 2

        for (; upgrade_key_it != std::filesystem::directory_iterator(); ++upgrade_key_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:326: +3, including nesting penalty of 2, nesting level increased to 3

            if (upgrade_key_it->path().filename().native().find('_') == std::string::npos) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:327: +4, including nesting penalty of 3, nesting level increased to 4

                RETURN_IF_ERROR(fs->delete_directory(upgrade_key_it->path().native() + "_0"));
                ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:327: +5, including nesting penalty of 4, nesting level increased to 5

                RETURN_IF_ERROR(fs->delete_directory(upgrade_key_it->path().native() + "_0"));
                ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:328: +4, including nesting penalty of 3, nesting level increased to 4

                RETURN_IF_ERROR(
                ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:328: +5, including nesting penalty of 4, nesting level increased to 5

                RETURN_IF_ERROR(
                ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:335: +1, including nesting penalty of 0, nesting level increased to 1

    if constexpr (USE_CACHE_VERSION2) {
    ^

be/src/io/cache/fs_file_cache_storage.cpp:337: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) [[unlikely]] {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:341: +2, including nesting penalty of 1, nesting level increased to 2

        for (; key_prefix_it != std::filesystem::directory_iterator(); ++key_prefix_it) {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:342: +3, including nesting penalty of 2, nesting level increased to 3

            if (!key_prefix_it->is_directory()) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:346: +3, including nesting penalty of 2, nesting level increased to 3

            if (key_prefix_it->path().filename().native().size() != KEY_PREFIX_LENGTH) {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:349: +4, including nesting penalty of 3, nesting level increased to 4

                RETURN_IF_ERROR(fs->delete_directory(key_prefix_it->path()));
                ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:349: +5, including nesting penalty of 4, nesting level increased to 5

                RETURN_IF_ERROR(fs->delete_directory(key_prefix_it->path()));
                ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:352: +3, including nesting penalty of 2, nesting level increased to 3

            if (ec) [[unlikely]] {
            ^

be/src/io/cache/fs_file_cache_storage.cpp:355: +3, including nesting penalty of 2, nesting level increased to 3

            RETURN_IF_ERROR(rebuild_dir(key_it));
            ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:355: +4, including nesting penalty of 3, nesting level increased to 4

            RETURN_IF_ERROR(rebuild_dir(key_it));
            ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/io/cache/fs_file_cache_storage.cpp:357: +1, nesting level increased to 1

    } else {
      ^

be/src/io/cache/fs_file_cache_storage.cpp:359: +2, including nesting penalty of 1, nesting level increased to 2

        if (ec) [[unlikely]] {
        ^

be/src/io/cache/fs_file_cache_storage.cpp:362: +2, including nesting penalty of 1, nesting level increased to 2

        RETURN_IF_ERROR(rebuild_dir(key_it));
        ^

be/src/common/status.h:628: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/io/cache/fs_file_cache_storage.cpp:362: +3, including nesting penalty of 2, nesting level increased to 3

        RETURN_IF_ERROR(rebuild_dir(key_it));
        ^

be/src/common/status.h:630: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

@@ -4644,5 +4642,105 @@ TEST_F(BlockFileCacheTest, load_cache2) {
key1.to_string() + "_0/" + std::to_string(offset));
}
}
*/

TEST_F(BlockFileCacheTest, test_load) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'TEST_F' exceeds recommended size/complexity thresholds [readability-function-size]

*/
    ^
Additional context

be/test/io/cache/block_file_cache_test.cpp:4646: 97 lines including whitespace and comments (threshold 80)

*/
    ^

fs::remove_all(cache_base_path);
}
fs::create_directories(cache_base_path);
auto sp = SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = SyncPoint::get_instance();
h);auto *

@doris-robot
Copy link

TPC-H: Total hot run time: 38217 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit b3f6130cb3724e492d6ea0bc4f09164e047fc5c0, data reload: false

------ Round 1 ----------------------------------
q1	18213	4522	4422	4422
q2	2018	187	173	173
q3	11690	978	1137	978
q4	10501	740	797	740
q5	7806	2934	2793	2793
q6	234	141	138	138
q7	968	611	597	597
q8	9326	2108	2110	2108
q9	7386	6586	6599	6586
q10	7002	2379	2183	2183
q11	444	237	238	237
q12	398	224	221	221
q13	17880	3058	3086	3058
q14	274	246	240	240
q15	520	513	503	503
q16	595	506	496	496
q17	996	642	701	642
q18	7471	6772	7051	6772
q19	1381	1036	1105	1036
q20	706	327	325	325
q21	3968	3138	2944	2944
q22	1134	1081	1025	1025
Total cold run time: 110911 ms
Total hot run time: 38217 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4402	4389	4348	4348
q2	390	279	281	279
q3	2879	2664	2696	2664
q4	1966	1699	1712	1699
q5	5698	5729	5800	5729
q6	235	134	138	134
q7	2195	1870	1840	1840
q8	3314	3465	3555	3465
q9	8892	8909	8894	8894
q10	3661	3452	3332	3332
q11	612	516	500	500
q12	836	664	675	664
q13	13170	3241	3309	3241
q14	321	295	288	288
q15	546	488	502	488
q16	640	557	560	557
q17	1862	1545	1573	1545
q18	8299	7821	7870	7821
q19	1752	1623	1560	1560
q20	2152	1864	1898	1864
q21	5772	5565	5476	5476
q22	1123	1083	1056	1056
Total cold run time: 70717 ms
Total hot run time: 57444 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.85% (9397/25502)
Line Coverage: 28.27% (77438/273935)
Region Coverage: 27.67% (39977/144458)
Branch Coverage: 24.32% (20347/83662)
Coverage Report: http://coverage.selectdb-in.cc/coverage/b3f6130cb3724e492d6ea0bc4f09164e047fc5c0_b3f6130cb3724e492d6ea0bc4f09164e047fc5c0/report/index.html

@doris-robot
Copy link

TPC-DS: Total hot run time: 193318 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit b3f6130cb3724e492d6ea0bc4f09164e047fc5c0, data reload: false

query1	1253	892	850	850
query2	6164	1942	1926	1926
query3	10611	4162	3808	3808
query4	59735	27253	23298	23298
query5	5378	507	471	471
query6	400	162	184	162
query7	5747	292	291	291
query8	281	199	202	199
query9	9042	2480	2484	2480
query10	498	273	254	254
query11	18081	15072	15613	15072
query12	159	101	103	101
query13	1543	396	374	374
query14	11155	7528	7349	7349
query15	232	185	184	184
query16	7505	408	497	408
query17	1079	574	583	574
query18	1907	290	296	290
query19	292	145	144	144
query20	122	114	118	114
query21	219	113	110	110
query22	4698	4514	4655	4514
query23	34439	33471	33676	33471
query24	5950	2849	2832	2832
query25	531	379	370	370
query26	679	153	153	153
query27	1774	282	276	276
query28	3818	2065	2049	2049
query29	674	407	401	401
query30	236	155	157	155
query31	958	772	753	753
query32	80	53	54	53
query33	460	281	286	281
query34	871	472	489	472
query35	852	718	738	718
query36	1075	923	952	923
query37	155	83	98	83
query38	4098	3901	3925	3901
query39	1453	1425	1404	1404
query40	203	120	117	117
query41	49	50	45	45
query42	121	98	95	95
query43	505	492	463	463
query44	1126	749	745	745
query45	199	168	165	165
query46	1110	761	771	761
query47	1899	1831	1813	1813
query48	393	294	302	294
query49	765	444	446	444
query50	833	417	407	407
query51	7019	6905	6834	6834
query52	102	90	88	88
query53	247	181	183	181
query54	574	463	459	459
query55	81	75	77	75
query56	279	269	268	268
query57	1189	1068	1081	1068
query58	234	248	239	239
query59	3097	2861	2760	2760
query60	297	278	279	278
query61	125	121	120	120
query62	747	665	623	623
query63	215	188	191	188
query64	2687	760	746	746
query65	3215	3165	3209	3165
query66	689	352	352	352
query67	15496	15299	15194	15194
query68	3066	583	585	583
query69	407	280	285	280
query70	1207	1104	1086	1086
query71	368	276	278	276
query72	6452	4183	4202	4183
query73	748	319	317	317
query74	9142	9032	9068	9032
query75	3392	2684	2696	2684
query76	1618	903	1008	903
query77	522	319	315	315
query78	9794	9841	9131	9131
query79	1144	536	541	536
query80	961	507	505	505
query81	567	230	233	230
query82	293	150	141	141
query83	261	145	148	145
query84	257	72	72	72
query85	941	277	273	273
query86	372	301	294	294
query87	4509	4384	4291	4291
query88	3294	2312	2319	2312
query89	377	277	302	277
query90	1892	188	185	185
query91	121	100	97	97
query92	62	48	48	48
query93	1099	529	530	529
query94	851	293	299	293
query95	338	244	284	244
query96	579	264	260	260
query97	3244	3087	3178	3087
query98	215	198	195	195
query99	1569	1289	1259	1259
Total cold run time: 307362 ms
Total hot run time: 193318 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 32.05 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit b3f6130cb3724e492d6ea0bc4f09164e047fc5c0, data reload: false

query1	0.04	0.04	0.04
query2	0.08	0.04	0.04
query3	0.22	0.05	0.05
query4	1.68	0.08	0.07
query5	0.51	0.49	0.49
query6	1.14	0.72	0.74
query7	0.02	0.01	0.02
query8	0.05	0.04	0.05
query9	0.55	0.48	0.48
query10	0.54	0.54	0.56
query11	0.16	0.11	0.11
query12	0.16	0.12	0.12
query13	0.60	0.60	0.58
query14	2.04	2.05	2.08
query15	0.89	0.82	0.85
query16	0.37	0.38	0.38
query17	1.01	1.04	1.06
query18	0.22	0.20	0.21
query19	1.90	1.80	1.75
query20	0.02	0.01	0.01
query21	15.39	0.67	0.65
query22	4.08	7.05	1.85
query23	18.29	1.42	1.25
query24	2.18	0.22	0.22
query25	0.16	0.08	0.08
query26	0.26	0.17	0.17
query27	0.08	0.07	0.08
query28	13.15	1.02	0.99
query29	12.62	3.42	3.43
query30	0.24	0.05	0.06
query31	2.90	0.40	0.38
query32	3.25	0.48	0.51
query33	3.05	3.01	3.01
query34	17.16	4.39	4.37
query35	4.47	4.44	4.48
query36	0.66	0.49	0.50
query37	0.18	0.15	0.15
query38	0.16	0.14	0.15
query39	0.05	0.04	0.04
query40	0.16	0.12	0.13
query41	0.09	0.05	0.05
query42	0.06	0.05	0.05
query43	0.04	0.04	0.04
Total cold run time: 110.88 s
Total hot run time: 32.05 s

@freemandealer freemandealer changed the title [wip][enhancement](cloud) clarify codes and make TTL expiration work after abnormal cache type transition [enhancement](cloud) clarify codes and make TTL expiration work after abnormal cache type transition Sep 5, 2024
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 6, 2024
@freemandealer
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 38186 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 73c8516c0224d8d92d15c64b3cb6cf86ba55b051, data reload: false

------ Round 1 ----------------------------------
q1	18120	4480	4460	4460
q2	2039	192	189	189
q3	11614	1000	1166	1000
q4	10335	778	698	698
q5	7756	2894	2831	2831
q6	224	137	135	135
q7	963	617	589	589
q8	9335	2096	2092	2092
q9	7145	6588	6592	6588
q10	6987	2228	2181	2181
q11	464	247	241	241
q12	404	223	226	223
q13	18936	3122	3055	3055
q14	272	234	240	234
q15	529	498	477	477
q16	528	440	423	423
q17	996	736	792	736
q18	7370	6875	6777	6777
q19	1394	1101	1016	1016
q20	677	329	341	329
q21	4004	2905	3062	2905
q22	1109	1007	1021	1007
Total cold run time: 111201 ms
Total hot run time: 38186 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4365	4263	4260	4260
q2	378	280	269	269
q3	2928	2698	2655	2655
q4	1946	1629	1606	1606
q5	5679	5664	5787	5664
q6	232	139	134	134
q7	2225	1820	1834	1820
q8	3277	3434	3475	3434
q9	8875	8836	8787	8787
q10	3586	3399	3341	3341
q11	598	497	518	497
q12	837	669	658	658
q13	14850	3138	3256	3138
q14	335	309	290	290
q15	544	494	486	486
q16	544	511	505	505
q17	1859	1549	1579	1549
q18	8380	7785	7740	7740
q19	1738	1654	1498	1498
q20	2140	1938	1909	1909
q21	5667	5454	5452	5452
q22	1149	1023	1045	1023
Total cold run time: 72132 ms
Total hot run time: 56715 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.86% (9384/25460)
Line Coverage: 28.22% (77328/274022)
Region Coverage: 27.64% (39959/144594)
Branch Coverage: 24.27% (20341/83804)
Coverage Report: http://coverage.selectdb-in.cc/coverage/73c8516c0224d8d92d15c64b3cb6cf86ba55b051_73c8516c0224d8d92d15c64b3cb6cf86ba55b051/report/index.html

@doris-robot
Copy link

TPC-DS: Total hot run time: 193090 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 73c8516c0224d8d92d15c64b3cb6cf86ba55b051, data reload: false

query1	1240	874	854	854
query2	6375	1903	1847	1847
query3	10624	4092	3964	3964
query4	59285	24184	23138	23138
query5	5301	497	497	497
query6	397	168	156	156
query7	5786	287	283	283
query8	317	216	212	212
query9	9128	2483	2488	2483
query10	501	282	264	264
query11	18621	15182	15270	15182
query12	157	100	100	100
query13	1592	391	363	363
query14	11111	7067	7511	7067
query15	234	171	166	166
query16	7159	480	482	480
query17	1102	557	589	557
query18	1965	306	311	306
query19	306	157	159	157
query20	123	116	114	114
query21	210	104	141	104
query22	4699	4750	4895	4750
query23	34586	33897	33688	33688
query24	5906	2868	2897	2868
query25	517	393	415	393
query26	687	153	153	153
query27	1763	274	274	274
query28	3635	2026	2020	2020
query29	655	426	424	424
query30	236	156	152	152
query31	944	768	774	768
query32	88	52	55	52
query33	453	292	286	286
query34	866	477	472	472
query35	818	737	717	717
query36	1089	921	908	908
query37	138	86	80	80
query38	3932	3916	3903	3903
query39	1436	1417	1412	1412
query40	200	117	115	115
query41	49	49	48	48
query42	120	95	95	95
query43	505	475	459	459
query44	1056	745	741	741
query45	195	166	167	166
query46	1075	723	711	711
query47	1909	1823	1827	1823
query48	365	290	286	286
query49	797	461	445	445
query50	826	404	408	404
query51	7126	6941	6802	6802
query52	97	87	87	87
query53	249	180	179	179
query54	563	448	454	448
query55	76	74	73	73
query56	279	269	260	260
query57	1231	1090	1075	1075
query58	229	234	300	234
query59	2982	2933	2836	2836
query60	302	275	275	275
query61	144	129	125	125
query62	756	648	663	648
query63	213	185	186	185
query64	2950	767	812	767
query65	3209	3132	3138	3132
query66	691	329	356	329
query67	15367	15424	15363	15363
query68	4474	576	559	559
query69	428	277	282	277
query70	1103	1126	1164	1126
query71	357	275	267	267
query72	6153	3966	3875	3875
query73	755	314	356	314
query74	9163	8743	8762	8743
query75	3345	2692	2733	2692
query76	1876	1078	993	993
query77	534	326	309	309
query78	11044	9326	9066	9066
query79	2847	536	531	531
query80	972	519	489	489
query81	562	238	228	228
query82	708	143	133	133
query83	184	149	148	148
query84	258	74	72	72
query85	758	334	277	277
query86	410	287	294	287
query87	4372	4283	4337	4283
query88	4214	2245	2236	2236
query89	396	281	282	281
query90	1879	183	186	183
query91	122	97	96	96
query92	60	48	49	48
query93	2327	557	553	553
query94	776	289	284	284
query95	341	249	249	249
query96	585	260	258	258
query97	3214	3051	3044	3044
query98	215	215	202	202
query99	1584	1270	1262	1262
Total cold run time: 313559 ms
Total hot run time: 193090 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 31.35 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 73c8516c0224d8d92d15c64b3cb6cf86ba55b051, data reload: false

query1	0.04	0.04	0.04
query2	0.09	0.04	0.04
query3	0.23	0.05	0.05
query4	1.68	0.09	0.10
query5	0.51	0.47	0.49
query6	1.13	0.72	0.73
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.54	0.50	0.48
query10	0.52	0.55	0.54
query11	0.15	0.11	0.11
query12	0.15	0.13	0.12
query13	0.61	0.58	0.57
query14	1.42	1.40	1.42
query15	0.84	0.84	0.81
query16	0.36	0.37	0.38
query17	0.97	1.06	1.04
query18	0.20	0.20	0.20
query19	1.78	1.85	1.82
query20	0.01	0.01	0.01
query21	15.39	0.68	0.66
query22	4.12	7.63	1.78
query23	18.28	1.38	1.30
query24	2.07	0.22	0.22
query25	0.16	0.08	0.08
query26	0.27	0.19	0.17
query27	0.07	0.07	0.07
query28	13.27	1.00	1.00
query29	12.64	3.38	3.38
query30	0.25	0.06	0.06
query31	2.87	0.40	0.39
query32	3.27	0.47	0.48
query33	2.98	2.99	3.02
query34	17.01	4.38	4.43
query35	4.43	4.40	4.45
query36	0.65	0.46	0.47
query37	0.19	0.16	0.16
query38	0.17	0.15	0.15
query39	0.05	0.04	0.04
query40	0.15	0.12	0.12
query41	0.09	0.05	0.05
query42	0.05	0.05	0.05
query43	0.05	0.04	0.04
Total cold run time: 109.78 s
Total hot run time: 31.35 s

Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

2. read&delete retry with old format if new format failed
3. write only new format
4. transition between TTL and Others won't rename the file suffix

Signed-off-by: freemandealer <[email protected]>
Signed-off-by: freemandealer <[email protected]>
Signed-off-by: freemandealer <[email protected]>
Signed-off-by: freemandealer <[email protected]>
Signed-off-by: freemandealer <[email protected]>
Signed-off-by: freemandealer <[email protected]>
@dataroaring
Copy link
Contributor

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 38466 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit d240c52fef203cc97bf17b5895a527aed581e301, data reload: false

------ Round 1 ----------------------------------
q1	18667	4582	4453	4453
q2	2023	188	187	187
q3	10470	1159	1157	1157
q4	10138	722	651	651
q5	7715	2900	2892	2892
q6	233	135	136	135
q7	975	624	632	624
q8	9333	2134	2076	2076
q9	7179	6606	6610	6606
q10	7033	2293	2245	2245
q11	459	249	252	249
q12	405	231	232	231
q13	17797	3116	3091	3091
q14	293	249	241	241
q15	543	497	502	497
q16	534	440	448	440
q17	1004	679	674	674
q18	7438	7003	7009	7003
q19	1394	1055	936	936
q20	690	350	345	345
q21	4550	3059	2725	2725
q22	1108	1039	1008	1008
Total cold run time: 109981 ms
Total hot run time: 38466 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4378	4328	4345	4328
q2	388	270	285	270
q3	2946	2692	2716	2692
q4	1958	1666	1688	1666
q5	5471	5452	5529	5452
q6	228	132	131	131
q7	2154	1757	1769	1757
q8	3284	3366	3422	3366
q9	8539	8536	8518	8518
q10	3501	3222	3210	3210
q11	592	502	523	502
q12	790	618	590	590
q13	10484	3096	3076	3076
q14	308	275	274	274
q15	533	482	482	482
q16	526	475	487	475
q17	1821	1497	1491	1491
q18	7923	7548	7513	7513
q19	1696	1688	1578	1578
q20	2087	1831	1838	1831
q21	5449	5295	5186	5186
q22	1126	1052	1026	1026
Total cold run time: 66182 ms
Total hot run time: 55414 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 191794 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit d240c52fef203cc97bf17b5895a527aed581e301, data reload: false

query1	918	382	384	382
query2	6509	1985	1963	1963
query3	6639	206	213	206
query4	31271	23142	23308	23142
query5	4147	526	487	487
query6	260	180	189	180
query7	4589	293	303	293
query8	287	230	239	230
query9	8802	2550	2523	2523
query10	453	300	281	281
query11	17963	15117	15255	15117
query12	148	97	100	97
query13	1640	388	355	355
query14	8794	7403	6690	6690
query15	289	168	185	168
query16	8085	455	472	455
query17	1561	554	536	536
query18	2121	283	295	283
query19	335	143	140	140
query20	122	110	113	110
query21	211	106	103	103
query22	4512	4187	4175	4175
query23	34261	33507	33544	33507
query24	11166	2882	2865	2865
query25	619	379	376	376
query26	1149	167	157	157
query27	2388	277	283	277
query28	7365	2027	2009	2009
query29	866	398	401	398
query30	316	171	152	152
query31	991	772	810	772
query32	99	55	57	55
query33	757	287	279	279
query34	976	481	473	473
query35	865	698	717	698
query36	1106	928	933	928
query37	164	87	81	81
query38	3995	3930	3881	3881
query39	1427	1425	1378	1378
query40	198	115	114	114
query41	49	48	45	45
query42	116	94	97	94
query43	528	479	472	472
query44	1253	758	724	724
query45	201	176	172	172
query46	1109	721	721	721
query47	1907	1836	1836	1836
query48	359	286	319	286
query49	1102	426	433	426
query50	814	402	412	402
query51	6937	6844	6902	6844
query52	100	86	86	86
query53	251	190	183	183
query54	922	449	454	449
query55	73	74	73	73
query56	283	243	263	243
query57	1218	1097	1062	1062
query58	250	259	247	247
query59	3027	2896	2744	2744
query60	307	270	264	264
query61	101	100	98	98
query62	879	656	672	656
query63	221	191	183	183
query64	5011	674	641	641
query65	3214	3202	3145	3145
query66	1416	332	359	332
query67	15957	15339	15456	15339
query68	3105	646	541	541
query69	418	259	264	259
query70	1258	1146	1078	1078
query71	327	275	265	265
query72	6231	4030	3981	3981
query73	737	329	317	317
query74	9162	9082	8912	8912
query75	3430	2732	2634	2634
query76	1895	1005	1012	1005
query77	488	296	315	296
query78	9775	9263	9262	9262
query79	939	882	853	853
query80	863	805	808	805
query81	461	262	266	262
query82	292	268	266	266
query83	192	200	193	193
query84	235	118	107	107
query85	698	409	378	378
query86	315	322	317	317
query87	4275	4342	4386	4342
query88	4448	4033	4031	4031
query89	386	373	369	369
query90	1820	318	318	318
query91	124	132	139	132
query92	81	78	144	78
query93	918	937	917	917
query94	721	362	346	346
query95	439	407	407	407
query96	465	476	469	469
query97	3108	3090	3138	3090
query98	229	224	221	221
query99	1374	1282	1260	1260
Total cold run time: 285178 ms
Total hot run time: 191794 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.90% (9458/25629)
Line Coverage: 28.25% (77768/275255)
Region Coverage: 27.65% (40140/145179)
Branch Coverage: 24.26% (20399/84068)
Coverage Report: http://coverage.selectdb-in.cc/coverage/d240c52fef203cc97bf17b5895a527aed581e301_d240c52fef203cc97bf17b5895a527aed581e301/report/index.html

@doris-robot
Copy link

ClickBench: Total hot run time: 31.57 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit d240c52fef203cc97bf17b5895a527aed581e301, data reload: false

query1	0.05	0.04	0.04
query2	0.08	0.04	0.04
query3	0.22	0.04	0.05
query4	1.68	0.08	0.07
query5	0.50	0.50	0.50
query6	1.12	0.74	0.73
query7	0.02	0.01	0.01
query8	0.05	0.04	0.04
query9	0.54	0.50	0.48
query10	0.55	0.57	0.56
query11	0.17	0.12	0.12
query12	0.15	0.13	0.12
query13	0.61	0.59	0.59
query14	1.37	1.38	1.47
query15	0.85	0.83	0.82
query16	0.38	0.35	0.36
query17	1.09	1.07	1.06
query18	0.22	0.20	0.21
query19	1.86	1.84	1.87
query20	0.01	0.01	0.01
query21	15.42	0.67	0.65
query22	4.34	6.63	1.92
query23	18.28	1.37	1.31
query24	2.11	0.25	0.22
query25	0.15	0.08	0.08
query26	0.27	0.18	0.18
query27	0.08	0.08	0.07
query28	13.17	1.02	1.00
query29	12.59	3.41	3.33
query30	0.25	0.06	0.05
query31	2.88	0.40	0.40
query32	3.24	0.48	0.48
query33	2.98	2.99	3.05
query34	17.00	4.44	4.42
query35	4.46	4.44	4.48
query36	0.66	0.46	0.50
query37	0.18	0.16	0.15
query38	0.15	0.14	0.14
query39	0.05	0.03	0.04
query40	0.16	0.13	0.12
query41	0.09	0.05	0.05
query42	0.06	0.04	0.04
query43	0.05	0.05	0.04
Total cold run time: 110.14 s
Total hot run time: 31.57 s

@freemandealer
Copy link
Contributor Author

run cloud_p0

Copy link
Collaborator

@TangSiyang2001 TangSiyang2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gavinchou gavinchou merged commit c71514d into apache:master Sep 12, 2024
22 of 26 checks passed
gavinchou pushed a commit that referenced this pull request Sep 12, 2024
… abnormal cache type transition (#40226)

current TTL embeds the expiration time and type into filename and path.
Maintaining both is buggy for lack of atomicity. I simplify this by
using only expiration time to infer the type so that we need only
expiration time.

Signed-off-by: freemandealer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/3.0.2-merged p0_c reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants