Commit 8f53e3d3 authored by Ramon Nou's avatar Ramon Nou
Browse files

fix(client): only migrate inline data to chunks when inline_data is non-empty

parent e626a032
Loading
Loading
Loading
Loading
Loading
+4 −3
Changes for src/client/gkfs_data.cpp: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -219,14 +219,15 @@ gkfs_do_write(gkfs::filemap::OpenFile& file, const char* buf, size_t count,

        if(!skip_migration_check) {
            auto md = gkfs::utils::get_metadata(*path, false, true);
            if(md && md->size() > 0 &&
            if(md && !md->inline_data().empty() &&
               md->size() <= gkfs::config::metadata::inline_data_size) {
                LOG(DEBUG, "{}() Migrating inline data to chunks. Size: {}",
                    __func__, md->size());
                    __func__, md->inline_data().size());

                // Write inline data to chunks
                auto err_migration = gkfs::rpc::forward_write(
                        *path, md->inline_data().c_str(), 0, md->size(), 0);
                        *path, md->inline_data().data(), 0,
                        md->inline_data().size(), 0);
                if(err_migration.first) {
                    LOG(ERROR, "{}() Failed to migrate inline data to chunks",
                        __func__);