From 05bbd9676bad40d677107eb5af6f4d80b939c999 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 10 Aug 2017 12:54:47 +0300 Subject: [PATCH] MXS-1307 Ignore usage differences for functions Also in the case of functions, we ignore differences in reported usage context between qc_mysqlembedded and qc_sqlite. --- query_classifier/test/compare.cc | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/query_classifier/test/compare.cc b/query_classifier/test/compare.cc index ef0452768..6ec0b0411 100644 --- a/query_classifier/test/compare.cc +++ b/query_classifier/test/compare.cc @@ -1094,6 +1094,35 @@ public: return rv; } + static bool at_most_usage_differs(const std::set& l, + const std::set& r) + { + bool rv = false; + + if (l.size() == r.size()) + { + rv = true; + + std::set::iterator i = l.begin(); + std::set::iterator j = r.begin(); + + while (rv && (i != l.end())) + { + if (i->m_name != j->m_name) + { + rv = false; + } + else + { + ++i; + ++j; + } + } + } + + return rv; + } + void print(ostream& out) const { out << m_name; @@ -1174,6 +1203,11 @@ bool compare_get_function_info(QUERY_CLASSIFIER* pClassifier1, GWBUF* pCopy1, ss << f1; success = true; } + else if (QcFunctionInfo::at_most_usage_differs(f1, f2)) + { + ss << "WRN: " << f1 << " != " << f2; + success = true; + } else { ss << "ERR: " << f1 << " != " << f2;