From b63ae293c4f93d3bea9f1a7d96baf006cc459597 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 14 Aug 2017 08:30:06 -0600 Subject: Only count every uid once. The previous code would fail on the second revision with the same uid. --- sinksh/syntax_modules/sink_inspect.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'sinksh/syntax_modules') diff --git a/sinksh/syntax_modules/sink_inspect.cpp b/sinksh/syntax_modules/sink_inspect.cpp index b271b4f..9cc3b23 100644 --- a/sinksh/syntax_modules/sink_inspect.cpp +++ b/sinksh/syntax_modules/sink_inspect.cpp @@ -85,10 +85,9 @@ bool inspect(const QStringList &args, State &state) }, false); + QSet uids; db.scan("", [&] (const QByteArray &key, const QByteArray &data) { - if (!hash.remove(Sink::Storage::DataStore::uidFromKey(key))) { - qWarning() << "Failed to find RID for " << key; - } + uids.insert(Sink::Storage::DataStore::uidFromKey(key)); return true; }, [&](const Sink::Storage::DataStore::Error &e) { @@ -96,6 +95,17 @@ bool inspect(const QStringList &args, State &state) }, false); + int missing = 0; + for (const auto &uid : uids) { + if (!hash.remove(uid)) { + missing++; + qWarning() << "Failed to find RID for " << uid; + } + } + if (missing) { + qWarning() << "Found a total of " << missing << " missing rids"; + } + //If we still have items in the hash it means we have rid mappings for entities //that no longer exist. if (!hash.isEmpty()) { -- cgit v1.2.3