After running MySQL, there are 7 servers executing concurrently initially access information_schema, There are a large number of checking permissions in the schema, which takes a long time. There are 3200 files underdatabase ds
SHOW FULL PROCESSLIST;
Id: 827
User: mysql
Host: 192.1.3.115:38378
db: dss
Command: Query
Time: 14
State: checking permissions
Info: SELECT A.TABLE_SCHEMA TABLE_CAT, NULL TABLE_SCHEM, A.TABLE_NAME, A.COLUMN_NAME, B.SEQ_IN_INDEX KEY_SEQ, B.INDEX_NAME PK_NAME FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.STATISTICS B WHERE A.COLUMN_KEY in ('PRI','pri') AND B.INDEX_NAME='PRIMARY' AND (A.TABLE_SCHEMA = 'ds') AND (B.TABLE_SCHEMA = 'ds') AND A.TABLE_NAME LIKE 'adm_history' AND B.TABLE_NAME LIKE 'adm_history' AND A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME AND A.COLUMN_NAME = B.COLUMN_NAME ORDER BY A.COLUMN_NAME
Progress: 0.000
This situation is bound to occur every time the mysqld is restarted,and There are a large number of sub tables in the database ds.
The environment built is a center with 6 distributed nodes, capturing slow queries for more than 0.2 seconds. None of the center nodes are present (Center Server first run), while the other 6 distributed nodes are all very slow(Concurrent Access Center Server).
Can we avoid it by optimizing what parameters? Or can upgrading the mariadb version solve this problem?
kennyliao, is this query coming from MariaDB's JDBC driver? DatabaseMetadata.getPrimaryKeys()?
Can you execute it yourself, replacing
A.TABLE_NAME LIKE 'adm_history' AND B.TABLE_NAME LIKE 'adm_history' with
A.TABLE_NAME = 'adm_history' AND B.TABLE_NAME = 'adm_history'
(basically replacing LIKE with '=')
and then see if it helps?
I believe there is a bug in JDBC driver logic, documentation indicates there should not be wildcard search here, so no "LIKE". It possibly has an implication on how many tables are checked (and you got many)
Vladislav Vaintroub
added a comment - kennyliao , is this query coming from MariaDB's JDBC driver? DatabaseMetadata.getPrimaryKeys()?
Can you execute it yourself, replacing
A.TABLE_NAME LIKE 'adm_history' AND B.TABLE_NAME LIKE 'adm_history' with
A.TABLE_NAME = 'adm_history' AND B.TABLE_NAME = 'adm_history'
(basically replacing LIKE with '=')
and then see if it helps?
I believe there is a bug in JDBC driver logic, documentation indicates there should not be wildcard search here, so no "LIKE". It possibly has an implication on how many tables are checked (and you got many)
Vladislav Vaintroub,after ‘like’ replace to ‘=’ ,The distributed nodes has been shortened from 5 minutes to 2 minutes, and the effect is very obvious.
kennyliao
added a comment - - edited Vladislav Vaintroub,after ‘like’ replace to ‘=’ ,The distributed nodes has been shortened from 5 minutes to 2 minutes, and the effect is very obvious.
Diego Dupin
added a comment - - edited kennyliao There was indeed a problem in mariadb connector. After discussing it with wlad , consist of 2 parts:
query has been corrected to use "=" in place of "like" following JDBC spec
DatabaseMetaData.getPrimaryKeys now use only IS.STATISTICS table
(correction done connector side in CONJ-1129 )
benchmark result show huge improvement: 12251.3 operations per second in place of 11.5 in testing environment, using 10k tables
Correction is for now only as a snapshot version for testing, until 3.3.2 release.
Snapshot can be used adding snapshot repository:
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https: //oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version> 3.3 . 2 -SNAPSHOT</version>
</dependency>
</dependencies>
I moved it to Connector/J , as the fix is done inside the connector. I do not know about the blocker, only that it worked like this for a long time, or even since inception of the Connector. It is likely that only not very usual setups with many thousands of tables are affected
Vladislav Vaintroub
added a comment - - edited I moved it to Connector/J , as the fix is done inside the connector. I do not know about the blocker, only that it worked like this for a long time, or even since inception of the Connector. It is likely that only not very usual setups with many thousands of tables are affected
Vladislav Vaintroub
added a comment - That was released some days ago in Connector/J 3.3.2 ( https://mariadb.com/kb/en/mariadb-connector-j-3-3-2-release-notes/ )
People
Diego Dupin
kennyliao
Votes:
0Vote for this issue
Watchers:
4Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1239.0999994277954,"ttfb":412.19999980926514,"pageVisibility":"visible","entityId":126690,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ef22dafc-0683-4ee7-ab90-dddaef4d3073","navigationType":0,"readyForUser":1315.0999994277954,"redirectCount":0,"resourceLoadedEnd":1794.3999996185303,"resourceLoadedStart":417,"resourceTiming":[{"duration":245,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":417,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":417,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":662,"responseStart":0,"secureConnectionStart":0},{"duration":245,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":417.29999923706055,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":417.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":662.2999992370605,"responseStart":0,"secureConnectionStart":0},{"duration":272.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":417.5,"connectEnd":417.5,"connectStart":417.5,"domainLookupEnd":417.5,"domainLookupStart":417.5,"fetchStart":417.5,"redirectEnd":0,"redirectStart":0,"requestStart":417.5,"responseEnd":689.6999998092651,"responseStart":689.6999998092651,"secureConnectionStart":417.5},{"duration":362.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":417.5999994277954,"connectEnd":417.5999994277954,"connectStart":417.5999994277954,"domainLookupEnd":417.5999994277954,"domainLookupStart":417.5999994277954,"fetchStart":417.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":417.5999994277954,"responseEnd":779.8999996185303,"responseStart":779.8999996185303,"secureConnectionStart":417.5999994277954},{"duration":366,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":417.8999996185303,"connectEnd":417.8999996185303,"connectStart":417.8999996185303,"domainLookupEnd":417.8999996185303,"domainLookupStart":417.8999996185303,"fetchStart":417.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":417.8999996185303,"responseEnd":783.8999996185303,"responseStart":783.8999996185303,"secureConnectionStart":417.8999996185303},{"duration":366.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":418,"connectEnd":418,"connectStart":418,"domainLookupEnd":418,"domainLookupStart":418,"fetchStart":418,"redirectEnd":0,"redirectStart":0,"requestStart":418,"responseEnd":784.3999996185303,"responseStart":784.3999996185303,"secureConnectionStart":418},{"duration":366.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":418.0999994277954,"connectEnd":418.0999994277954,"connectStart":418.0999994277954,"domainLookupEnd":418.0999994277954,"domainLookupStart":418.0999994277954,"fetchStart":418.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":418.0999994277954,"responseEnd":784.7999992370605,"responseStart":784.7999992370605,"secureConnectionStart":418.0999994277954},{"duration":437.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":418.29999923706055,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":418.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":855.5999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":366.79999923706055,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":418.5,"connectEnd":418.5,"connectStart":418.5,"domainLookupEnd":418.5,"domainLookupStart":418.5,"fetchStart":418.5,"redirectEnd":0,"redirectStart":0,"requestStart":418.5,"responseEnd":785.2999992370605,"responseStart":785.2999992370605,"secureConnectionStart":418.5},{"duration":437,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":418.79999923706055,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":418.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":855.7999992370605,"responseStart":0,"secureConnectionStart":0},{"duration":366.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":418.8999996185303,"connectEnd":418.8999996185303,"connectStart":418.8999996185303,"domainLookupEnd":418.8999996185303,"domainLookupStart":418.8999996185303,"fetchStart":418.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":418.8999996185303,"responseEnd":785.7999992370605,"responseStart":785.7999992370605,"secureConnectionStart":418.8999996185303},{"duration":1361.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":431.69999980926514,"connectEnd":431.69999980926514,"connectStart":431.69999980926514,"domainLookupEnd":431.69999980926514,"domainLookupStart":431.69999980926514,"fetchStart":431.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":431.69999980926514,"responseEnd":1793.1999998092651,"responseStart":1793.1999998092651,"secureConnectionStart":431.69999980926514},{"duration":1362.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":431.79999923706055,"connectEnd":431.79999923706055,"connectStart":431.79999923706055,"domainLookupEnd":431.79999923706055,"domainLookupStart":431.79999923706055,"fetchStart":431.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":431.79999923706055,"responseEnd":1794.3999996185303,"responseStart":1794.3999996185303,"secureConnectionStart":431.79999923706055},{"duration":530.4000005722046,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":897.7999992370605,"connectEnd":897.7999992370605,"connectStart":897.7999992370605,"domainLookupEnd":897.7999992370605,"domainLookupStart":897.7999992370605,"fetchStart":897.7999992370605,"redirectEnd":0,"redirectStart":0,"requestStart":897.7999992370605,"responseEnd":1428.1999998092651,"responseStart":1428.0999994277954,"secureConnectionStart":897.7999992370605}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":250,"responseStart":412,"responseEnd":426,"domLoading":415,"domInteractive":1832,"domContentLoadedEventStart":1832,"domContentLoadedEventEnd":1881,"domComplete":2476,"loadEventStart":2476,"loadEventEnd":2477,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1800.1999998092651},{"name":"bigPipe.sidebar-id.end","time":1801.0999994277954},{"name":"bigPipe.activity-panel-pipe-id.start","time":1801.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1804.2999992370605},{"name":"activityTabFullyLoaded","time":1898.7999992370605}],"measures":[],"correlationId":"f7bfcc53127eec","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I guess you need to provide (anonymized) DDL for all tables in the database.
Or other way to reproduce.