Type:
Task
Priority:
Blocker
Resolution:
Done
Overview
MariaDB allows storage engines to define additional attributes per index, field, or table. However, per-table attributes cannot be specified per partition. We should support per-partition attributes for more flexible configurations. Also, this functionality is necessary for other important features (see the issue links below). https://mariadb.com/kb/en/engine-defined-new-tablefieldindex-attributes/
Syntax
partition_definition:
PARTITION partition_name
[VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]
[[STORAGE] ENGINE [=] engine_name]
[engine_defined_options ]
...
[(subpartition_definition [, subpartition_definition] ...)]
https://mariadb.com/kb/en/create-table/#partitions
Example
Here is a possible use case of the per-partition attributes support. By the use of per-partition attributes, the Spider storage engine (and other federated engines) can provide users with a cleaner way to specify where to connect.
CREATE TABLE tbl_a (
a INT ,
b VARCHAR (255),
PRIMARY KEY (a)
) ENGINE=Spider PARTITION BY RANGE(a) (
PARTITION pt1 VALUES LESS THAN (100) REMOTE_SERVER= "s_2_1" REMOTE_TABLE= "ta_r1" ,
PARTITION pt2 VALUES LESS THAN MAXVALUE REMOTE_SERVER= "s_2_1" , REMOTE_TABLE= "ta_r2"
)
Note that the example above doesn't work with the current server implementation.
Description
If an engine-defined attribute is specified at table-level, it applies to all the partitions in the table (backward compatible behavior).
Specifying an engine-defined attribute at table-level is only possible when all the storage engines composing a partitioned table support this attribute. Currently, it is not possible to use multiple storage engines to create a partitioned table, but this will be possible in MDEV-22168 .
One can use both per-table attributes and per-partition attributes for a single table. If the same attribute is specified both at table-level and partition-level, the per-partition attribute takes precedence. So, we can consider per-table attributes as default values.
We do not support, at least in the present issue, engine-defined attributes per subpartitions .
TODO
Modify the parser to accept per-partition attributes;
Keep per-partition attributes some in-memory data structure (class partition_element ?);
Pass per-partition attributes to ha_partition::create() as per-table attributes ;
Persist per-partition attributes in FRM files;
Modify the SHOW function to handle per-partition attributes. (unnecessary)
Make it work with subpartitions
Add test cases (subpartitioning, alter table)
Fix CONNECT tests failures: https://buildbot.mariadb.org/#/builders/236/builds/3094
Refactor the entire patch.
{"report":{"fcp":964.3999996185303,"ttfb":214.19999980926514,"pageVisibility":"visible","entityId":26344,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"e4a4086f-9c1c-4f36-a6bd-7298040b1f77","navigationType":0,"readyForUser":1060.2999997138977,"redirectCount":0,"resourceLoadedEnd":1377.3999996185303,"resourceLoadedStart":220.2999997138977,"resourceTiming":[{"duration":205.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":220.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":220.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":425.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":205.59999990463257,"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":220.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":220.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":426.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":228.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":220.69999980926514,"connectEnd":220.69999980926514,"connectStart":220.69999980926514,"domainLookupEnd":220.69999980926514,"domainLookupStart":220.69999980926514,"fetchStart":220.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":220.69999980926514,"responseEnd":449,"responseStart":449,"secureConnectionStart":220.69999980926514},{"duration":308.6000003814697,"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":220.89999961853027,"connectEnd":220.89999961853027,"connectStart":220.89999961853027,"domainLookupEnd":220.89999961853027,"domainLookupStart":220.89999961853027,"fetchStart":220.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":220.89999961853027,"responseEnd":529.5,"responseStart":529.5,"secureConnectionStart":220.89999961853027},{"duration":312.7999997138977,"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":221.09999990463257,"connectEnd":221.09999990463257,"connectStart":221.09999990463257,"domainLookupEnd":221.09999990463257,"domainLookupStart":221.09999990463257,"fetchStart":221.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":221.09999990463257,"responseEnd":533.8999996185303,"responseStart":533.8999996185303,"secureConnectionStart":221.09999990463257},{"duration":313.2000002861023,"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":221.2999997138977,"connectEnd":221.2999997138977,"connectStart":221.2999997138977,"domainLookupEnd":221.2999997138977,"domainLookupStart":221.2999997138977,"fetchStart":221.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":221.2999997138977,"responseEnd":534.5,"responseStart":534.5,"secureConnectionStart":221.2999997138977},{"duration":313.5,"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":221.39999961853027,"connectEnd":221.39999961853027,"connectStart":221.39999961853027,"domainLookupEnd":221.39999961853027,"domainLookupStart":221.39999961853027,"fetchStart":221.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":221.39999961853027,"responseEnd":534.8999996185303,"responseStart":534.8999996185303,"secureConnectionStart":221.39999961853027},{"duration":371.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":221.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":221.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":593,"responseStart":0,"secureConnectionStart":0},{"duration":313.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":221.89999961853027,"connectEnd":221.89999961853027,"connectStart":221.89999961853027,"domainLookupEnd":221.89999961853027,"domainLookupStart":221.89999961853027,"fetchStart":221.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":221.89999961853027,"responseEnd":535.3999996185303,"responseStart":535.3999996185303,"secureConnectionStart":221.89999961853027},{"duration":371.09999990463257,"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":222,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":222,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":593.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":313.90000009536743,"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":222.19999980926514,"connectEnd":222.19999980926514,"connectStart":222.19999980926514,"domainLookupEnd":222.19999980926514,"domainLookupStart":222.19999980926514,"fetchStart":222.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":222.19999980926514,"responseEnd":536.0999999046326,"responseStart":536.0999999046326,"secureConnectionStart":222.19999980926514},{"duration":464.2000002861023,"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":228.7999997138977,"connectEnd":228.7999997138977,"connectStart":228.7999997138977,"domainLookupEnd":228.7999997138977,"domainLookupStart":228.7999997138977,"fetchStart":228.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":228.7999997138977,"responseEnd":693,"responseStart":693,"secureConnectionStart":228.7999997138977},{"duration":1148.5999999046326,"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":228.7999997138977,"connectEnd":228.7999997138977,"connectStart":228.7999997138977,"domainLookupEnd":228.7999997138977,"domainLookupStart":228.7999997138977,"fetchStart":228.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":228.7999997138977,"responseEnd":1377.3999996185303,"responseStart":1377.3999996185303,"secureConnectionStart":228.7999997138977},{"duration":88.39999961853027,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":605.5,"connectEnd":605.5,"connectStart":605.5,"domainLookupEnd":605.5,"domainLookupStart":605.5,"fetchStart":605.5,"redirectEnd":0,"redirectStart":0,"requestStart":605.5,"responseEnd":693.8999996185303,"responseStart":693.8999996185303,"secureConnectionStart":605.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":8,"responseStart":214,"responseEnd":222,"domLoading":217,"domInteractive":1396,"domContentLoadedEventStart":1396,"domContentLoadedEventEnd":1441,"domComplete":3235,"loadEventStart":3235,"loadEventEnd":3237,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1379.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1379.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":1380.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1382.3999996185303},{"name":"activityTabFullyLoaded","time":1449.7999997138977}],"measures":[],"correlationId":"357fc36114e195","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":141,"dbReadsTimeInMs":21,"dbConnsTimeInMs":31,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}