Skip to content

tsdb: GloAdmin and GloProxyStats open two separate SQLite connections to the same stats file #6065

Description

@renecannao

ProxySQL_Statistics::statsdb_disk (lib/ProxySQL_Statistics.cpp, ctor) and ProxySQL_Admin::statsdb_disk (lib/Admin_Bootstrap.cpp) are two independent SQLite3DB instances opened against the same on-disk proxysql_stats.db. The commented-out line // statsdb_disk = GloAdmin->statsdb_disk; in the statistics ctor shows this was once intended to be shared.

Consequences:

  • SQLite3DB's per-instance rwlock cannot serialize writers across the two connections; only SQLite's own file locking + busy-retry does. PR Cluster leader election + leader-side TSDB stats aggregation (cluster as a single entity, phase 1) #6034 added wrlock() around every explicit transaction on the statistics connection, but the eventslog dumps (MySQL_Logger::insertMysqlEventsIntoDb, PgSQL twin) run on the Admin connection and therefore serialize only at the file level.
  • Two connections means two page caches and two journals for one file.

Decide and document: either unify onto one connection (and one lock), or state explicitly that cross-connection serialization is by SQLite file locking and remove the misleading commented-out line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions