Commit f739a563 authored by Julien Muchembled's avatar Julien Muchembled

mysql: workaround for MDEV-20693

parent 2c823e2e
...@@ -781,11 +781,19 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -781,11 +781,19 @@ class MySQLDatabaseManager(DatabaseManager):
if max_tid is not None: if max_tid is not None:
sql += " AND tid <= %d" % max_tid sql += " AND tid <= %d" % max_tid
q = self.query q = self.query
q("DELETE FROM trans" + sql) if q("SELECT 1 FROM trans%s LIMIT 1" % sql):
q("DELETE FROM trans" + sql)
else:
logging.info("Nothing to truncate in trans for partition %s",
partition)
sql = " FROM obj" + sql sql = " FROM obj" + sql
data_id_list = [x for x, in q( data_id_list = [x for x, in q(
"SELECT DISTINCT data_id%s AND data_id IS NOT NULL" % sql)] "SELECT DISTINCT data_id%s AND data_id IS NOT NULL" % sql)]
q("DELETE" + sql) if q("SELECT 1%s LIMIT 1" % sql):
q("DELETE" + sql)
else:
logging.info("Nothing to truncate in obj for partition %s",
partition)
self._pruneData(data_id_list) self._pruneData(data_id_list)
def getTransaction(self, tid, all = False): def getTransaction(self, tid, all = False):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment