Commit 091223b3 authored by Ramon Nou's avatar Ramon Nou
Browse files

regression on too many get_metadata

parent a6b69aab
Loading
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -1206,6 +1206,21 @@ gkfs_do_write(gkfs::filemap::OpenFile& file, const char* buf, size_t count,
    // beyond the inline limit (or appending).
    bool migrated = false;
    if(gkfs::config::metadata::use_inline_data) {
        // OPTIMIZATION: Check if the file is already larger than the inline limit
        // using the write size cache. If so, we know it's not inline (or
        // handled), so we skip the RPC.
        bool skip_migration_check = false;
        if(CTX->use_write_size_cache()) {
            auto [cnt, size] = CTX->write_size_cache()->get(*path);
            if(size > gkfs::config::metadata::inline_data_size) {
                skip_migration_check = true;
                LOG(DEBUG,
                    "{}() Skipping migration check. Cached size '{}' > inline limit '{}'",
                    __func__, size, gkfs::config::metadata::inline_data_size);
            }
        }

        if(!skip_migration_check) {
            auto md = gkfs::utils::get_metadata(*path, false, true);
            if(md && md->size() > 0 &&
               md->size() <= gkfs::config::metadata::inline_data_size) {
@@ -1224,6 +1239,7 @@ gkfs_do_write(gkfs::filemap::OpenFile& file, const char* buf, size_t count,
            migrated = true;
            }
        }
    }

    if(is_append) {
        auto ret_offset = gkfs::utils::update_file_size(*path, count, offset,