Skip to content

Commit cc1fd56

Browse files
authored
Merge pull request #4822 from sysown/v2.7-minorBugs
V2.7 minor bugs fixes
2 parents c7c15d4 + 9ddea3a commit cc1fd56

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/MySQL_Logger.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,9 @@ int MySQL_Logger::processEvents(SQLite3DB * statsdb , SQLite3DB * statsdb_disk)
14601460
int rows_to_keep = maxInMemorySize - events.size();
14611461
if (current_rows > rows_to_keep) {
14621462
int rows_to_delete = (current_rows - rows_to_keep);
1463-
string delete_stmt = "DELETE FROM stats_mysql_query_events ORDER BY id LIMIT " + to_string(rows_to_delete);
1463+
string query = "SELECT MAX(id) FROM (SELECT id FROM stats_mysql_query_events ORDER BY id LIMIT " + to_string(rows_to_delete) + ")";
1464+
int maxIdToDelete = statsdb->return_one_int(query.c_str());
1465+
string delete_stmt = "DELETE FROM stats_mysql_query_events WHERE id <= " + to_string(maxIdToDelete);
14641466
statsdb->execute(delete_stmt.c_str());
14651467
}
14661468
}

lib/ProxySQL_Admin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9937,7 +9937,7 @@ void ProxySQL_Admin::stats___mysql_global() {
99379937
free(query);
99389938
}
99399939
if (GloMyLogger != nullptr) {
9940-
const string prefix = "MySQL_Logger-";
9940+
const string prefix = "MySQL_Logger_";
99419941
std::unordered_map<std::string, unsigned long long> metrics = GloMyLogger->getAllMetrics();
99429942
for (std::unordered_map<std::string, unsigned long long>::iterator it = metrics.begin(); it != metrics.end(); it++) {
99439943
unsigned int l = strlen(a) + prefix.length() + it->first.length() + 32;

0 commit comments

Comments
 (0)