Run a check of metadata
This is request to add feature to identify invalid objects like views, procedures etc.
Database objects can be invalid when base table altered/drop
Could be some information_schema query would be helpful
Note that invalid views can be identified with:
select * from information_schema.tables where table_schema not in ('INFORMATION_SCHEMA','performance_schema','mysql','sys') and table_type='VIEW' and table_comment like '%invalid%';
For completeness, this is a full list of standard _USAGE views:
CHECK_CONSTRAINT_ROUTINE_USAGE
COLUMN_COLUMN_USAGE
COLUMN_DOMAIN_USAGE
COLUMN_UDT_USAGE
CONSTRAINT_COLUMN_USAGE
CONSTRAINT_PERIOD_USAGE
CONSTRAINT_TABLE_USAGE
KEY_COLUMN_USAGE
KEY_PERIOD_USAGE
ROUTINE_COLUMN_USAGE
ROUTINE_PERIOD_USAGE
ROUTINE_ROUTINE_USAGE
ROUTINE_SEQUENCE_USAGE
ROUTINE_TABLE_USAGE
TRIGGER_COLUMN_USAGE
TRIGGER_PERIOD_USAGE
TRIGGER_ROUTINE_USAGE
TRIGGER_SEQUENCE_USAGE
TRIGGER_TABLE_USAGE
VIEW_COLUMN_USAGE
VIEW_PERIOD_USAGE
VIEW_ROUTINE_USAGE
VIEW_TABLE_USAGE
For the purpose of this task it's tempting to implement all ROUTINE_ views, but selecting them all to find missing objects would be rather inefficient, as they all will go through all rows in mysql.proc, parse and compile stored routines, etc.
It would be better if all of these views would print warnings for missing objects in routines, then it'll be enough to select from one of these views to get the complete list. Let's try to do that. Meaning, it'll be enough to implement just one view, let's say, ROUTINE_COLUMN_USAGE.
Sergei Golubchik
added a comment - - edited For completeness, this is a full list of standard _USAGE views:
CHECK_CONSTRAINT_ROUTINE_USAGE
COLUMN_COLUMN_USAGE
COLUMN_DOMAIN_USAGE
COLUMN_UDT_USAGE
CONSTRAINT_COLUMN_USAGE
CONSTRAINT_PERIOD_USAGE
CONSTRAINT_TABLE_USAGE
KEY_COLUMN_USAGE
KEY_PERIOD_USAGE
ROUTINE_COLUMN_USAGE
ROUTINE_PERIOD_USAGE
ROUTINE_ROUTINE_USAGE
ROUTINE_SEQUENCE_USAGE
ROUTINE_TABLE_USAGE
TRIGGER_COLUMN_USAGE
TRIGGER_PERIOD_USAGE
TRIGGER_ROUTINE_USAGE
TRIGGER_SEQUENCE_USAGE
TRIGGER_TABLE_USAGE
VIEW_COLUMN_USAGE
VIEW_PERIOD_USAGE
VIEW_ROUTINE_USAGE
VIEW_TABLE_USAGE
For the purpose of this task it's tempting to implement all ROUTINE_ views, but selecting them all to find missing objects would be rather inefficient, as they all will go through all rows in mysql.proc , parse and compile stored routines, etc.
It would be better if all of these views would print warnings for missing objects in routines, then it'll be enough to select from one of these views to get the complete list. Let's try to do that. Meaning, it'll be enough to implement just one view, let's say, ROUTINE_COLUMN_USAGE .
CHECK for other objects is kind of consistent with what we do. Even if not very convenient, nobody needs to check individual views of stored routines. I don't like ALL at all, though, it's very strange. mariadb-check can do all already.
Sergei Golubchik
added a comment - CHECK for other objects is kind of consistent with what we do. Even if not very convenient, nobody needs to check individual views of stored routines. I don't like ALL at all, though, it's very strange. mariadb-check can do all already.
using mariadb-check for checking all or defined databases
mariadb-check -u root -p -A --process-views --skip-process-tables
mariadb-check -u root -p --databases test --process-views --skip-process-tables
(An SQL option to CHECK all views in a database or all views in an instance does not exist, as it also does not for CHECK TABLE)
serg and monty, so is it correct that we need is the following?
CHECK PROCEDURE <procedure>
CHECK FUNCTION <function>
CHECK EVENT <event> (not requested here, but would make the request complete)
CHECK TRIGGER <trigger> (not requested here, but would make the request complete)
new options for mariadb-check for use these new checks for checking all or defined databases
Ralf Gebhardt
added a comment - So we can identify invalid views already by
using CHECK VIEW <view>
using mariadb-check for checking all or defined databases
mariadb-check -u root -p -A --process-views --skip-process-tables
mariadb-check -u root -p --databases test --process-views --skip-process-tables
(An SQL option to CHECK all views in a database or all views in an instance does not exist, as it also does not for CHECK TABLE)
serg and monty , so is it correct that we need is the following?
CHECK PROCEDURE <procedure>
CHECK FUNCTION <function>
CHECK EVENT <event> (not requested here, but would make the request complete)
CHECK TRIGGER <trigger> (not requested here, but would make the request complete)
new options for mariadb-check for use these new checks for checking all or defined databases
I agree with that having CHECK PROCEDURE, CHECK FUNCTION and CHECK EVENT should be implemented.
Regarding CHECK TRIGGER, I am not as sure about as the trigger should already be checked as part of CHECK TABLE.
mariadb-check should check all of the above. We would need new options for doing this.
Michael Widenius
added a comment - I agree with that having CHECK PROCEDURE, CHECK FUNCTION and CHECK EVENT should be implemented.
Regarding CHECK TRIGGER, I am not as sure about as the trigger should already be checked as part of CHECK TABLE.
mariadb-check should check all of the above. We would need new options for doing this.
Per this announcement in the Slack triage channel: https://mariadb.slack.com/archives/C05S0ANJ8BE/p1739890335402039, we will now only use the "triage" label to indicate an ongoing customer-engineering escalation. Also, I will remove it, and if it's still needed, let me know.
Julien Fritsch
added a comment - Per this announcement in the Slack triage channel: https://mariadb.slack.com/archives/C05S0ANJ8BE/p1739890335402039 , we will now only use the "triage" label to indicate an ongoing customer-engineering escalation. Also, I will remove it, and if it's still needed, let me know.
People
Sergei Golubchik
Muhammad Irfan
Votes:
0Vote for this issue
Watchers:
10Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1087.1999998092651,"ttfb":215.60000038146973,"pageVisibility":"visible","entityId":114070,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"561b6cf9-6752-40a2-870e-9f1786a9fe26","navigationType":0,"readyForUser":1147.3000001907349,"redirectCount":0,"resourceLoadedEnd":777.1000003814697,"resourceLoadedStart":235.60000038146973,"resourceTiming":[{"duration":18.399999618530273,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":235.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":254,"responseStart":0,"secureConnectionStart":0},{"duration":23.300000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":236.10000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":259.4000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":356.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":236.19999980926514,"connectEnd":236.19999980926514,"connectStart":236.19999980926514,"domainLookupEnd":236.19999980926514,"domainLookupStart":236.19999980926514,"fetchStart":236.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":268.30000019073486,"responseEnd":592.5,"responseStart":331.30000019073486,"secureConnectionStart":236.19999980926514},{"duration":72.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":236.30000019073486,"connectEnd":236.30000019073486,"connectStart":236.30000019073486,"domainLookupEnd":236.30000019073486,"domainLookupStart":236.30000019073486,"fetchStart":236.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":269,"responseEnd":309.19999980926514,"responseStart":299.30000019073486,"secureConnectionStart":236.30000019073486},{"duration":540.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":236.30000019073486,"connectEnd":236.30000019073486,"connectStart":236.30000019073486,"domainLookupEnd":236.30000019073486,"domainLookupStart":236.30000019073486,"fetchStart":236.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":268.9000005722046,"responseEnd":777.1000003814697,"responseStart":344.4000005722046,"secureConnectionStart":236.30000019073486},{"duration":71.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":236.4000005722046,"connectEnd":236.4000005722046,"connectStart":236.4000005722046,"domainLookupEnd":236.4000005722046,"domainLookupStart":236.4000005722046,"fetchStart":236.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":269.1000003814697,"responseEnd":308.30000019073486,"responseStart":297.69999980926514,"secureConnectionStart":236.4000005722046},{"duration":93,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":236.5,"connectEnd":236.5,"connectStart":236.5,"domainLookupEnd":236.5,"domainLookupStart":236.5,"fetchStart":236.5,"redirectEnd":0,"redirectStart":0,"requestStart":273.69999980926514,"responseEnd":329.5,"responseStart":319.19999980926514,"secureConnectionStart":236.5},{"duration":36.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":236.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":272.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":52.70000076293945,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":236.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":289.4000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":93.70000076293945,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":236.69999980926514,"connectEnd":236.69999980926514,"connectStart":236.69999980926514,"domainLookupEnd":236.69999980926514,"domainLookupStart":236.69999980926514,"fetchStart":236.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":277.19999980926514,"responseEnd":330.4000005722046,"responseStart":323.4000005722046,"secureConnectionStart":236.69999980926514},{"duration":136,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":236.9000005722046,"connectEnd":236.9000005722046,"connectStart":236.9000005722046,"domainLookupEnd":236.9000005722046,"domainLookupStart":236.9000005722046,"fetchStart":236.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":285.1000003814697,"responseEnd":372.9000005722046,"responseStart":341.30000019073486,"secureConnectionStart":236.9000005722046},{"duration":481.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":270.9000005722046,"connectEnd":270.9000005722046,"connectStart":270.9000005722046,"domainLookupEnd":270.9000005722046,"domainLookupStart":270.9000005722046,"fetchStart":270.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":315.4000005722046,"responseEnd":752.1000003814697,"responseStart":742.8000001907349,"secureConnectionStart":270.9000005722046},{"duration":482.5999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":271.4000005722046,"connectEnd":271.4000005722046,"connectStart":271.4000005722046,"domainLookupEnd":271.4000005722046,"domainLookupStart":271.4000005722046,"fetchStart":271.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":330,"responseEnd":754,"responseStart":744.6999998092651,"secureConnectionStart":271.4000005722046},{"duration":211.10000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":767.8000001907349,"connectEnd":767.8000001907349,"connectStart":767.8000001907349,"domainLookupEnd":767.8000001907349,"domainLookupStart":767.8000001907349,"fetchStart":767.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":936.4000005722046,"responseEnd":978.9000005722046,"responseStart":969.4000005722046,"secureConnectionStart":767.8000001907349},{"duration":113.39999961853027,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1022.3000001907349,"connectEnd":1022.3000001907349,"connectStart":1022.3000001907349,"domainLookupEnd":1022.3000001907349,"domainLookupStart":1022.3000001907349,"fetchStart":1022.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1095.6000003814697,"responseEnd":1135.6999998092651,"responseStart":1135.1000003814697,"secureConnectionStart":1022.3000001907349},{"duration":75,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1080.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1080.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1155.1999998092651,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":39,"domainLookupEnd":47,"connectStart":47,"connectEnd":68,"secureConnectionStart":56,"requestStart":68,"responseStart":216,"responseEnd":274,"domLoading":219,"domInteractive":1296,"domContentLoadedEventStart":1296,"domContentLoadedEventEnd":1351,"domComplete":1486,"loadEventStart":1486,"loadEventEnd":1486,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1240.3000001907349},{"name":"bigPipe.sidebar-id.end","time":1241},{"name":"bigPipe.activity-panel-pipe-id.start","time":1241.1000003814697},{"name":"bigPipe.activity-panel-pipe-id.end","time":1243.8000001907349},{"name":"activityTabFullyLoaded","time":1374.5}],"measures":[],"correlationId":"bb53f5142783ab","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":73,"dbReadsTimeInMs":8,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
For completeness, this is a full list of standard _USAGE views:
CHECK_CONSTRAINT_ROUTINE_USAGE
COLUMN_COLUMN_USAGE
COLUMN_DOMAIN_USAGE
COLUMN_UDT_USAGE
CONSTRAINT_COLUMN_USAGE
CONSTRAINT_PERIOD_USAGE
CONSTRAINT_TABLE_USAGE
KEY_COLUMN_USAGE
KEY_PERIOD_USAGE
ROUTINE_COLUMN_USAGE
ROUTINE_PERIOD_USAGE
ROUTINE_ROUTINE_USAGE
ROUTINE_SEQUENCE_USAGE
ROUTINE_TABLE_USAGE
TRIGGER_COLUMN_USAGE
TRIGGER_PERIOD_USAGE
TRIGGER_ROUTINE_USAGE
TRIGGER_SEQUENCE_USAGE
TRIGGER_TABLE_USAGE
VIEW_COLUMN_USAGE
VIEW_PERIOD_USAGE
VIEW_ROUTINE_USAGE
VIEW_TABLE_USAGE
For the purpose of this task it's tempting to implement all ROUTINE_ views, but selecting them all to find missing objects would be rather inefficient, as they all will go through all rows in mysql.proc, parse and compile stored routines, etc.
It would be better if all of these views would print warnings for missing objects in routines, then it'll be enough to select from one of these views to get the complete list. Let's try to do that. Meaning, it'll be enough to implement just one view, let's say, ROUTINE_COLUMN_USAGE.