Fix database renaming with no default database
If no default database was given, it was possible that the code would end up in an endless loop.
This commit is contained in:
parent
2f3afa943c
commit
90f7c69f9d
@ -263,7 +263,7 @@ std::string pcre2_substitute(pcre2_code* re,
|
||||
(PCRE2_SPTR) replace.c_str(), replace.length(),
|
||||
(PCRE2_UCHAR*) &rval[0], &size_tmp)) == PCRE2_ERROR_NOMEMORY)
|
||||
{
|
||||
rval.resize(rval.size() * 2);
|
||||
rval.resize(rval.size() * 2 + 1);
|
||||
size_tmp = rval.size();
|
||||
}
|
||||
|
||||
|
@ -855,7 +855,7 @@ void BinlogFilterSession::checkStatement(GWBUF** buffer, const REP_HEADER& hdr)
|
||||
auto new_db = mxs::pcre2_substitute(config.rewrite_src, db, config.rewrite_dest, &err);
|
||||
auto new_sql = mxs::pcre2_substitute(config.rewrite_src, sql, config.rewrite_dest, &err);
|
||||
|
||||
if (new_db.empty() || new_sql.empty())
|
||||
if ((new_db.empty() && !db.empty()) || (new_sql.empty() && !sql.empty()))
|
||||
{
|
||||
MXS_ERROR("PCRE2 error on pattern '%s' with replacement '%s': %s",
|
||||
config.rewrite_src_pattern.c_str(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user