Skip to content

Commit 725c864

Browse files
committed
MB-41944: Improve logging for body-size>0 in Item::removeUserXattrs
Change-Id: I9f9b81351966d8848ba7d690fdacf18e64574d85 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/137568 Well-Formed: Build Bot <[email protected]> Tested-by: Paolo Cocchi <[email protected]> Reviewed-by: James Harrison <[email protected]>
1 parent 789033c commit 725c864

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

engines/ep/src/item.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "ep_time.h"
1918
#include "item.h"
19+
#include "ep_time.h"
2020
#include "item_eviction.h"
21+
#include "logtags.h"
2122
#include "objectregistry.h"
2223

2324
#include <folly/lang/Assume.h>
@@ -488,7 +489,14 @@ Item::WasValueInflated Item::removeUserXattrs() {
488489
const auto valNBytes = value->valueSize();
489490
cb::char_buffer valBuf{const_cast<char*>(value->getData()), valNBytes};
490491
const auto bodySize = valNBytes - cb::xattr::get_body_offset(valBuf);
491-
Expects(bodySize == 0);
492+
if (bodySize > 0) {
493+
std::stringstream ss;
494+
ss << *this;
495+
throw std::logic_error(
496+
"Item::removeUserXattrs: Unexpected body (size " +
497+
std::to_string(bodySize) + ") in deletion: " +
498+
cb::UserDataView(ss.str()).getSanitizedValue());
499+
}
492500

493501
// Operate on a copy
494502
const cb::xattr::Blob originalBlob(valBuf, false /*compressed*/);

0 commit comments

Comments
 (0)