Previously, if only the local image was using the journal or if
a disconnected peer was attached, the tag entries could not be
expired even if unreferenced.
Fixes: http://tracker.ceph.com/issues/21960
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit
19fa1c7f5b2809e9a223b7b196dfc031e97a5dcd)
}
uint64_t minimum_tag_tid = std::numeric_limits<uint64_t>::max();
- std::string last_read = HEADER_KEY_CLIENT_PREFIX;
+ std::string last_read = "";
bool more;
do {
std::map<std::string, bufferlist> vals;
return -EIO;
}
+ if (client.state == cls::journal::CLIENT_STATE_DISCONNECTED) {
+ // don't allow a disconnected client to prevent pruning
+ continue;
+ } else if (client.commit_position.object_positions.empty()) {
+ // cannot prune if one or more clients has an empty commit history
+ return 0;
+ }
+
for (auto object_position : client.commit_position.object_positions) {
minimum_tag_tid = MIN(minimum_tag_tid, object_position.tag_tid);
}