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)}]
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.
CREATETABLE tbl_a (
a INT,
b VARCHAR(255),
PRIMARYKEY(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;
This is to keep the handler mostly oblivious whether it's a partition or a table.
10.8.0-dbg>CREATE TABLE t1 (a INT,b VARCHAR(255),PRIMARY KEY(a)) ENGINE=MyISAM PARTITION BY RANGE(a) (
-> PARTITION pt1 VALUES LESS THAN (100) ENGINE=InnoDB,
-> PARTITION pt2 VALUES LESS THAN MAXVALUE ENGINE=InnoDB);
ERROR 1497 (HY000): The mix of handlers in the partitions is not allowed in this version of MariaDB
Roel Van de Paar
added a comment - - edited Note that mixing of SE's is not implemented yet (planned in MDEV-22168 ):
10.8.0 959a6a723f6b6fb6d9630380c2317b8d51f9e4d8 (Debug)
10.8.0-dbg>CREATE TABLE t1 (a INT,b VARCHAR(255),PRIMARY KEY(a)) ENGINE=MyISAM PARTITION BY RANGE(a) (
-> PARTITION pt1 VALUES LESS THAN (100) ENGINE=InnoDB,
-> PARTITION pt2 VALUES LESS THAN MAXVALUE ENGINE=InnoDB);
ERROR 1497 (HY000): The mix of handlers in the partitions is not allowed in this version of MariaDB
OK to push. However, I am still running a generic crash test against the feature branch. Results from that will be available around next week Wednesday.
Roel Van de Paar
added a comment - OK to push. However, I am still running a generic crash test against the feature branch. Results from that will be available around next week Wednesday.
People
Nayuta Yanagisawa (Inactive)
Sergei Golubchik
Votes:
6Vote for this issue
Watchers:
14Start 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":1241.7999997138977,"ttfb":387.09999990463257,"pageVisibility":"visible","entityId":26344,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"563f1cee-f7a2-4f45-abfb-7e9aa7b51761","navigationType":0,"readyForUser":1368.5999999046326,"redirectCount":0,"resourceLoadedEnd":1401.4000000953674,"resourceLoadedStart":393.90000009536743,"resourceTiming":[{"duration":358.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":393.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":393.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":752.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":358.80000019073486,"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":394.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":394.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":753,"responseStart":0,"secureConnectionStart":0},{"duration":367.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":394.40000009536743,"connectEnd":394.40000009536743,"connectStart":394.40000009536743,"domainLookupEnd":394.40000009536743,"domainLookupStart":394.40000009536743,"fetchStart":394.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":394.40000009536743,"responseEnd":762.2999997138977,"responseStart":762.2999997138977,"secureConnectionStart":394.40000009536743},{"duration":475.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":394.59999990463257,"connectEnd":394.59999990463257,"connectStart":394.59999990463257,"domainLookupEnd":394.59999990463257,"domainLookupStart":394.59999990463257,"fetchStart":394.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":394.59999990463257,"responseEnd":869.9000000953674,"responseStart":869.9000000953674,"secureConnectionStart":394.59999990463257},{"duration":478.90000009536743,"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":394.7999997138977,"connectEnd":394.7999997138977,"connectStart":394.7999997138977,"domainLookupEnd":394.7999997138977,"domainLookupStart":394.7999997138977,"fetchStart":394.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":394.7999997138977,"responseEnd":873.6999998092651,"responseStart":873.6999998092651,"secureConnectionStart":394.7999997138977},{"duration":479.7999997138977,"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":394.90000009536743,"connectEnd":394.90000009536743,"connectStart":394.90000009536743,"domainLookupEnd":394.90000009536743,"domainLookupStart":394.90000009536743,"fetchStart":394.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":394.90000009536743,"responseEnd":874.6999998092651,"responseStart":874.6999998092651,"secureConnectionStart":394.90000009536743},{"duration":479.90000009536743,"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":395.09999990463257,"connectEnd":395.09999990463257,"connectStart":395.09999990463257,"domainLookupEnd":395.09999990463257,"domainLookupStart":395.09999990463257,"fetchStart":395.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":395.09999990463257,"responseEnd":875,"responseStart":875,"secureConnectionStart":395.09999990463257},{"duration":518,"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":395.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":395.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":913.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":480.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":395.40000009536743,"connectEnd":395.40000009536743,"connectStart":395.40000009536743,"domainLookupEnd":395.40000009536743,"domainLookupStart":395.40000009536743,"fetchStart":395.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":395.40000009536743,"responseEnd":875.7999997138977,"responseStart":875.7999997138977,"secureConnectionStart":395.40000009536743},{"duration":517.9000000953674,"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":395.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":395.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":913.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":480.7000002861023,"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":395.69999980926514,"connectEnd":395.69999980926514,"connectStart":395.69999980926514,"domainLookupEnd":395.69999980926514,"domainLookupStart":395.69999980926514,"fetchStart":395.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":395.69999980926514,"responseEnd":876.4000000953674,"responseStart":876.4000000953674,"secureConnectionStart":395.69999980926514},{"duration":917.5999999046326,"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":409.90000009536743,"connectEnd":409.90000009536743,"connectStart":409.90000009536743,"domainLookupEnd":409.90000009536743,"domainLookupStart":409.90000009536743,"fetchStart":409.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":409.90000009536743,"responseEnd":1327.5,"responseStart":1327.5,"secureConnectionStart":409.90000009536743},{"duration":988,"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":413.40000009536743,"connectEnd":413.40000009536743,"connectStart":413.40000009536743,"domainLookupEnd":413.40000009536743,"domainLookupStart":413.40000009536743,"fetchStart":413.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":413.40000009536743,"responseEnd":1401.4000000953674,"responseStart":1401.4000000953674,"secureConnectionStart":413.40000009536743},{"duration":401.7000002861023,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":926.1999998092651,"connectEnd":926.1999998092651,"connectStart":926.1999998092651,"domainLookupEnd":926.1999998092651,"domainLookupStart":926.1999998092651,"fetchStart":926.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":926.1999998092651,"responseEnd":1327.9000000953674,"responseStart":1327.9000000953674,"secureConnectionStart":926.1999998092651},{"duration":283.7999997138977,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1234,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1234,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1517.7999997138977,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":159,"responseStart":387,"responseEnd":411,"domLoading":392,"domInteractive":1525,"domContentLoadedEventStart":1525,"domContentLoadedEventEnd":1589,"domComplete":2030,"loadEventStart":2030,"loadEventEnd":2031,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1501.1999998092651},{"name":"bigPipe.sidebar-id.end","time":1502.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1502.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1504},{"name":"activityTabFullyLoaded","time":1607.5999999046326}],"measures":[],"correlationId":"69d51af13d2342","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":127,"dbReadsTimeInMs":25,"dbConnsTimeInMs":35,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Ok to push as discussed on Slack.