Erase verf key left from creation from ientries on every modification

master
Vitaliy Filippov 2024-03-12 00:51:24 +03:00
parent 603dc68f11
commit 018e89f867
4 changed files with 8 additions and 0 deletions

View File

@ -283,6 +283,7 @@ static void touch_inode(nfs_proxy_t *proxy, inode_t ino, bool allow_cache)
{
auto ientry = attrs.object_items();
ientry["mtime"] = nfstime_now_str();
ientry.erase("verf");
// FIXME: Use "update" query
bool *found = new bool;
*found = true;

View File

@ -238,6 +238,7 @@ resume_7:
{
auto copy = st->new_ientry.object_items();
copy["nlink"] = st->new_ientry["nlink"].uint64_value()-1;
copy.erase("verf");
st->self->parent->db->set(kv_inode_key(st->new_direntry["ino"].uint64_value()), json11::Json(copy).dump(), [st](int res)
{
st->res = res;
@ -324,6 +325,7 @@ resume_11:
{
auto ientry_new = st->old_ientry.object_items();
ientry_new["parent_ino"] = st->new_dir_ino;
ientry_new.erase("verf");
st->self->parent->db->set(kv_inode_key(st->old_direntry["ino"].uint64_value()), json11::Json(ientry_new).dump(), [st](int res)
{
st->res = res;

View File

@ -71,6 +71,7 @@ resume_1:
}
st->new_attrs[kv.first] = kv.second;
}
st->new_attrs.erase("verf");
st->self->parent->db->set(kv_inode_key(st->ino), json11::Json(st->new_attrs).dump(), [st](int res)
{
st->res = res;

View File

@ -546,6 +546,7 @@ static std::string new_normal_ientry(nfs_kv_write_state *st)
ni.erase("shared_ver");
ni["size"] = st->ext->cur_extend;
ni["mtime"] = nfstime_now_str();
ni.erase("verf");
return json11::Json(ni).dump();
}
@ -559,6 +560,7 @@ static std::string new_moved_ientry(nfs_kv_write_state *st)
ni.erase("shared_ver");
ni["size"] = st->new_size;
ni["mtime"] = nfstime_now_str();
ni.erase("verf");
return json11::Json(ni).dump();
}
@ -569,6 +571,7 @@ static std::string new_shared_ientry(nfs_kv_write_state *st)
ni["size"] = st->new_size;
ni["mtime"] = nfstime_now_str();
ni["shared_ver"] = ni["shared_ver"].uint64_value()+1;
ni.erase("verf");
return json11::Json(ni).dump();
}
@ -581,6 +584,7 @@ static std::string new_unshared_ientry(nfs_kv_write_state *st)
ni.erase("shared_alloc");
ni.erase("shared_ver");
ni["mtime"] = nfstime_now_str();
ni.erase("verf");
return json11::Json(ni).dump();
}