The op.is_delete() function only returns true if the op is not ALSO
doing something else (e.g. a clone). This causes issues with clearing
the new EC extent cache.
Also improve some debug and code cleanliness.
Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
void ECExtentCache::execute(list<OpRef> &op_list) {
for (auto &op : op_list) {
- if (op->projected_size < op->object.projected_size) {
- // Invalidate the object's cache when we see any object reduce in size.
- op->invalidates_cache = true;
- }
op->object.request(op);
}
waiting_ops.insert(waiting_ops.end(), op_list.begin(), op_list.end());
{
extent_set unaligned_ro_writes;
hobject_t source;
- invalidates_cache = op.has_source(&source) || op.is_delete();
+ /* Certain transactions mean that the cache is invalid:
+ * 1. Clone operations invalidate the *target*
+ * 2. ALL delete operations (do NOT use is_delete() here!!!)
+ * 3. Truncates that reduce size.
+ */
+ invalidates_cache = op.has_source(&source) || op.delete_first || projected_size < orig_size;
op.buffer_updates.to_interval_set(unaligned_ro_writes);