@@ -454,9 +454,10 @@ int ObjectDirectory::del(const DoutPrefixProvider* dpp, CacheObj* object, option
454454
455455int ObjectDirectory::update_field (const DoutPrefixProvider* dpp, CacheObj* object, const std::string& field, std::string& value, optional_yield y)
456456{
457+ int ret = -1 ;
457458 std::string key = build_index (object);
458459
459- if (exist_key (dpp, object, y)) {
460+ if ((ret = exist_key (dpp, object, y) )) {
460461 try {
461462 if (field == " hosts" ) {
462463 /* Append rather than overwrite */
@@ -506,10 +507,13 @@ int ObjectDirectory::update_field(const DoutPrefixProvider* dpp, CacheObj* objec
506507 ldpp_dout (dpp, 0 ) << " ObjectDirectory::" << __func__ << " () ERROR: " << e.what () << dendl;
507508 return -EINVAL;
508509 }
509- } else {
510+ } else if (ret == -ENOENT) {
510511 ldpp_dout (dpp, 0 ) << " ObjectDirectory::" << __func__ << " (): Object does not exist." << dendl;
511- return -ENOENT;
512+ } else {
513+ ldpp_dout (dpp, 0 ) << " ObjectDirectory::" << __func__ << " (): ERROR: ret=" << ret << dendl;
512514 }
515+
516+ return ret;
513517}
514518
515519int ObjectDirectory::zadd (const DoutPrefixProvider* dpp, CacheObj* object, double score, const std::string& member, optional_yield y, bool multi)
@@ -1095,9 +1099,10 @@ int BlockDirectory::del(const DoutPrefixProvider* dpp, CacheBlock* block, option
10951099
10961100int BlockDirectory::update_field (const DoutPrefixProvider* dpp, CacheBlock* block, const std::string& field, std::string& value, optional_yield y)
10971101{
1102+ int ret = -1 ;
10981103 std::string key = build_index (block);
10991104
1100- if (exist_key (dpp, block, y)) {
1105+ if ((ret = exist_key (dpp, block, y) )) {
11011106 try {
11021107 if (field == " hosts" ) {
11031108 /* Append rather than overwrite */
@@ -1147,10 +1152,13 @@ int BlockDirectory::update_field(const DoutPrefixProvider* dpp, CacheBlock* bloc
11471152 ldpp_dout (dpp, 0 ) << " BlockDirectory::" << __func__ << " () ERROR: " << e.what () << dendl;
11481153 return -EINVAL;
11491154 }
1155+ } else if (ret == -ENOENT) {
1156+ ldpp_dout (dpp, 10 ) << " BlockDirectory::" << __func__ << " (): Block does not exist." << dendl;
11501157 } else {
1151- ldpp_dout (dpp, 0 ) << " BlockDirectory::" << __func__ << " (): Block does not exist." << dendl;
1152- return -ENOENT;
1158+ ldpp_dout (dpp, 0 ) << " BlockDirectory::" << __func__ << " (): ERROR: ret=" << ret << dendl;
11531159 }
1160+
1161+ return ret;
11541162}
11551163
11561164int BlockDirectory::remove_host (const DoutPrefixProvider* dpp, CacheBlock* block, std::string& value, optional_yield y)
0 commit comments