Redirection mechanism is widely used in proxy-based scenario.
Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
What to do
We'll add a new global/session variable, say, redirect_url. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).
Internally the server might have a check to ensure that the value of this variable is a valid url.
This variable is appended to the default value of session_track_system_variables variable.
When this variable is changed, the existing SESSION_TRACK_SYSTEM_VARIABLES implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.
Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.
Thoughts
perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.
Possible use cases:
always redirect all clients to a new location
set @@global.redirect_url or start the server with --redurect-url= or put it in my.cnf
redirect to a group of servers randomly
create a table with connection urls, one per row.
use an sql script that selects a random row from it and sets @@redirect_url to this value
specify this script in the --init-connect server parameter
dynamically redirect from the master to one of the slaves
same as above, but use INFORMATION_SCHEMA.PROCESSLIST to get the list of active slaves.
and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.
Original specs for comparison:
What to Do
Client/Server Protocol change needs both client and server support.
Ending connection OK_Packet info field might contain redirection information.
Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
There is no recursion, meaning that connector that have been redirect will not take another redirection in account.
Thanks ramesh. Now that MDEV-32525 is fixed with the commit 3a3bb0771a3abc0ad88fee09ab7eec69935dfb79 in bb-11.3-mdev-15935, could you re-test the branch?
Yuchen Pei
added a comment - Thanks ramesh . Now that MDEV-32525 is fixed with the commit 3a3bb0771a3abc0ad88fee09ab7eec69935dfb79 in bb-11.3-mdev-15935, could you re-test the branch?
c4a506f0bf3 upstream/bb-11.3-mdev-15935 MDEV-32525 Validate --redirect_url supplied as server flag
5af70decca3 MDEV-15935 Adding global/session system var redirect_url
6151bde48c8 cleanup: string sys_var types
Yuchen Pei
added a comment - pushed the following to 11.3
c4a506f0bf3 upstream/bb-11.3-mdev-15935 MDEV-32525 Validate --redirect_url supplied as server flag
5af70decca3 MDEV-15935 Adding global/session system var redirect_url
6151bde48c8 cleanup: string sys_var types
People
Yuchen Pei
Alex Lee
Votes:
0Vote for this issue
Watchers:
21Start 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":1108.0999999046326,"ttfb":309.19999980926514,"pageVisibility":"visible","entityId":66953,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"f7228748-36ac-4c7e-b3bd-56d94700f564","navigationType":0,"readyForUser":1210.6999998092651,"redirectCount":0,"resourceLoadedEnd":1457.4000000953674,"resourceLoadedStart":314.40000009536743,"resourceTiming":[{"duration":280.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":314.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":314.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":594.5,"responseStart":0,"secureConnectionStart":0},{"duration":280.2000002861023,"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":314.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":314.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":594.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":303.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":314.90000009536743,"connectEnd":314.90000009536743,"connectStart":314.90000009536743,"domainLookupEnd":314.90000009536743,"domainLookupStart":314.90000009536743,"fetchStart":314.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":314.90000009536743,"responseEnd":618.1999998092651,"responseStart":618.1999998092651,"secureConnectionStart":314.90000009536743},{"duration":382.2000002861023,"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":315.09999990463257,"connectEnd":315.09999990463257,"connectStart":315.09999990463257,"domainLookupEnd":315.09999990463257,"domainLookupStart":315.09999990463257,"fetchStart":315.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":315.09999990463257,"responseEnd":697.3000001907349,"responseStart":697.3000001907349,"secureConnectionStart":315.09999990463257},{"duration":386.40000009536743,"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":315.19999980926514,"connectEnd":315.19999980926514,"connectStart":315.19999980926514,"domainLookupEnd":315.19999980926514,"domainLookupStart":315.19999980926514,"fetchStart":315.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":315.19999980926514,"responseEnd":701.5999999046326,"responseStart":701.5999999046326,"secureConnectionStart":315.19999980926514},{"duration":386.69999980926514,"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":315.40000009536743,"connectEnd":315.40000009536743,"connectStart":315.40000009536743,"domainLookupEnd":315.40000009536743,"domainLookupStart":315.40000009536743,"fetchStart":315.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":315.40000009536743,"responseEnd":702.0999999046326,"responseStart":702.0999999046326,"secureConnectionStart":315.40000009536743},{"duration":387.2000002861023,"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":315.59999990463257,"connectEnd":315.59999990463257,"connectStart":315.59999990463257,"domainLookupEnd":315.59999990463257,"domainLookupStart":315.59999990463257,"fetchStart":315.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":315.59999990463257,"responseEnd":702.8000001907349,"responseStart":702.8000001907349,"secureConnectionStart":315.59999990463257},{"duration":459,"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":315.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":315.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":774.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":387.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":316,"connectEnd":316,"connectStart":316,"domainLookupEnd":316,"domainLookupStart":316,"fetchStart":316,"redirectEnd":0,"redirectStart":0,"requestStart":316,"responseEnd":703.4000000953674,"responseStart":703.4000000953674,"secureConnectionStart":316},{"duration":458.80000019073486,"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":316.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":316.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":774.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":387.7999997138977,"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":316.30000019073486,"connectEnd":316.30000019073486,"connectStart":316.30000019073486,"domainLookupEnd":316.30000019073486,"domainLookupStart":316.30000019073486,"fetchStart":316.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":316.30000019073486,"responseEnd":704.0999999046326,"responseStart":704.0999999046326,"secureConnectionStart":316.30000019073486},{"duration":614.2999997138977,"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":323.40000009536743,"connectEnd":323.40000009536743,"connectStart":323.40000009536743,"domainLookupEnd":323.40000009536743,"domainLookupStart":323.40000009536743,"fetchStart":323.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":323.40000009536743,"responseEnd":937.6999998092651,"responseStart":937.6999998092651,"secureConnectionStart":323.40000009536743},{"duration":1132.4000000953674,"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":325,"connectEnd":325,"connectStart":325,"domainLookupEnd":325,"domainLookupStart":325,"fetchStart":325,"redirectEnd":0,"redirectStart":0,"requestStart":325,"responseEnd":1457.4000000953674,"responseStart":1457.3000001907349,"secureConnectionStart":325},{"duration":151.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":786.1999998092651,"connectEnd":786.1999998092651,"connectStart":786.1999998092651,"domainLookupEnd":786.1999998092651,"domainLookupStart":786.1999998092651,"fetchStart":786.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":786.1999998092651,"responseEnd":938,"responseStart":938,"secureConnectionStart":786.1999998092651},{"duration":486.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1059,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1059,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1545.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":472.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1060.0999999046326,"connectEnd":1060.0999999046326,"connectStart":1060.0999999046326,"domainLookupEnd":1060.0999999046326,"domainLookupStart":1060.0999999046326,"fetchStart":1060.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":1060.0999999046326,"responseEnd":1532.5999999046326,"responseStart":1532.5999999046326,"secureConnectionStart":1060.0999999046326},{"duration":478.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1060.4000000953674,"connectEnd":1060.4000000953674,"connectStart":1060.4000000953674,"domainLookupEnd":1060.4000000953674,"domainLookupStart":1060.4000000953674,"fetchStart":1060.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1060.4000000953674,"responseEnd":1538.5999999046326,"responseStart":1538.5999999046326,"secureConnectionStart":1060.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":106,"responseStart":309,"responseEnd":325,"domLoading":312,"domInteractive":1500,"domContentLoadedEventStart":1500,"domContentLoadedEventEnd":1546,"domComplete":2094,"loadEventStart":2094,"loadEventEnd":2094,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1480.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1481.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1481.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1482.5999999046326},{"name":"activityTabFullyLoaded","time":1570.3000001907349}],"measures":[],"correlationId":"fbb5bd05b2d50b","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":138,"dbReadsTimeInMs":30,"dbConnsTimeInMs":41,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
ycp pquery test run looks good.