Hi Christoph, Thanks for checking. The actual code is only on branch mysqlnd-azure-php723-1.0.0 or tag v1.0.0. Is this ok? Can you have a look again? Thanks.
Best Regards, Qianqian Bu > -----Original Message----- > From: Christoph M. Becker <cmbecke...@gmx.de> > Sent: Tuesday, September 24, 2019 1:12 AM > To: Qianqian Bu <qianqian...@microsoft.com>; pecl-dev@lists.php.net > Cc: Hong Wang (R&D) <how...@microsoft.com>; Hang Zhang > <h...@microsoft.com>; Xiangyu Hu <xiangyu...@microsoft.com>; Shuode Li > <shu...@microsoft.com>; Andrea Lam <andrea....@microsoft.com> > Subject: Re: Request for submitting a PECL extension which uses mysqlnd > pluginAPIand enables redirection functionality for MySQL servers > > Hi Qianqian Bu, > > <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit > hub.com%2Fmicrosoft%2Fmysqlnd_azure&data=02%7C01%7CQianqian. > Bu%40microsoft.com%7C415eada329404f827dd108d7404926ff%7C72f988bf8 > 6f141af91ab2d7cd011db47%7C1%7C0%7C637048555261501446&sdata=C > qL3O2oH4g8RcQVUv%2Fs6kZ%2F%2FUM0qi%2FQ3BpmdZcjmP0Y%3D& > reserved=0> looks fine so far, but there is no actual code yet; I only can > see .gitignore, LICENSE.txt and README.md. > > Best regards, > Christoph > > On 20.09.2019 at 08:37, Qianqian Bu wrote: > > > Hi Christoph, > > > > It has been a while, and we have a public repo > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith > ub.com%2Fmicrosoft%2Fmysqlnd_azure&data=02%7C01%7CQianqian.B > u%40microsoft.com%7C415eada329404f827dd108d7404926ff%7C72f988bf86f > 141af91ab2d7cd011db47%7C1%7C0%7C637048555261501446&sdata=Cq > L3O2oH4g8RcQVUv%2Fs6kZ%2F%2FUM0qi%2FQ3BpmdZcjmP0Y%3D&r > eserved=0 available now for the extension source code. I've created the > package.xml file and add a brief Readme.txt under folder mysqlnd_azure. > Could you help review the code again if any problem? The user name in the > package.xml is invalid since I just submitted the php user account form and > request is not finished yet. Thanks. > > > > Best Regards, > > Qianqian Bu > > > > > > -----Original > > Message--------------------------------------------------------------- > > -------------------------------------------------- > > From: Christoph M. Becker <cmbecke...@gmx.de> > > Sent: Monday, August 12, 2019 4:56 PM > > To: Qianqian Bu <qianqian...@microsoft.com>; pecl-dev@lists.php.net > > Cc: Hong Wang (R&D) <how...@microsoft.com>; Hang Zhang > > <h...@microsoft.com>; Xiangyu Hu <xiangyu...@microsoft.com>; Shuode > Li > > <shu...@microsoft.com> > > Subject: Re: Request for submitting a PECL extension which uses > > mysqlnd pluginAPIand enables redirection functionality for MySQL > > servers > > > > Hi Qianqian Bu! > > > > On 12.08.2019 at 05:03, Qianqian Bu via pecl-dev wrote: > > > >> Hi Christoph, > >> > >> Thanks so much for your checking and response. For the code repo, we > currently have a private github repo which is currently on-going legal review > and will be publicly accessible in near future. I think it will be suitable > to hold > the code, I'll update with you when it is ready. And I'll try to generate > package.xml later. There is a change for the extension implementation, that > is we decide to rename the extension with name from mysqlnd_rd to > mysqlnd_azure, may I ask does the name sound good to you? > > > > I have no objections regarding the name. > > > > Regards, > > Christoph > > > >> Thanks & Best Regards, > >> Qianqian Bu > >> > >> -----Original > >> Message-------------------------------------------------------------- > >> - > >> --------------------------------- > >> From: Christoph M. Becker <cmbecke...@gmx.de> > >> Sent: Wednesday, August 7, 2019 5:23 PM > >> To: Qianqian Bu <qianqian...@microsoft.com>; pecl-dev@lists.php.net > >> Cc: Hong Wang (R&D) <how...@microsoft.com>; Hang Zhang > >> <h...@microsoft.com>; Xiangyu Hu <xiangyu...@microsoft.com>; > Shuode Li > >> <shu...@microsoft.com> > >> Subject: Re: Request for submitting a PECL extension which uses > >> mysqlnd plugin APIand enables redirection functionality for MySQL > >> servers > >> > >> Hi! > >> > >> On 07.08.2019 at 10:03, Qianqian Bu via pecl-dev wrote: > >> > >>> Dear Madam/Sir, > >>> > >>> My name is Qianqian Bu, I'm from Microsoft company and recently work > on a project which enables redirection functionality for MySQL servers using > PHP mysqlnd driver. The functionality has been implemented as a PHP > extension using mysqlnd plugin API, and I'd like to request submitting it to > PECL website. > >>> > >>> There is a document > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjira. > mariadb.org%2Fbrowse%2FMDEV- > 15935&data=02%7C01%7CQianqian.Bu%40microsoft.com%7C415eada32 > 9404f827dd108d7404926ff%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C > 0%7C637048555261501446&sdata=AEX0PZxMiA57jKEH3dwBZEF43wcW3 > rv0OpAgLd%2B%2B5Ns%3D&reserved=0 for MariaDB Connector J for > the same purpose which you may use as a reference. The document gives > the purpose and initial approach. The final implementation takes use of the > message field of OK packet, server fills the message field with redirection > information, then driver side needs extract the information and use it to > establish a new connection. There is a ongoing pull request > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith > ub.com%2FMariaDB%2Fmariadb-connector- > j%2Fpull%2F134&data=02%7C01%7CQianqian.Bu%40microsoft.com%7C > 415eada329404f827dd108d7404926ff%7C72f988bf86f141af91ab2d7cd011db47 > %7C1%7C0%7C637048555261501446&sdata=0SB4oVxP7gS%2F4q72g7By > MfrKPIHmWgx7s4D8C3TXCtg%3D&reserved=0 for MariaDB Connector J > for this, which you may also use as a reference. Following is the detailed > description of the scenario and extension solution for PHP mysqlnd. > >>> > >>> Scenario (same as described in MDEV-15935): > >>> 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. > >>> > >>> Extension solution: > >>> We implement the solution as a PECL style extension using mysqlnd > plugin API, and the basic idea is modifying the > MYSQLND_METHOD(mysqlnd_data, connect) method, make it possible to > establish a new connection based on the redirection information provided by > the response OK packet in the last message field, and use the new > connection if connection succeed. And then cache the redirection > information, so next time, it only need one establishment phase to connect > to MySQL server. > >>> There are three MYSQLND_METHOD methods replaced as follows: > >>> conn_m->connect = MYSQLND_METHOD(mysqlnd_rd, connect); > >>> conn_d_m->connect = MYSQLND_METHOD(mysqlnd_rd_data, connect); > >>> conn_d_m->dtor = MYSQLND_METHOD_PRIVATE(mysqlnd_rd_data, > dtor); > >>> > >>> And I've modified the interface of > MYSQLND_METHOD(mysqlnd_rd_data, connect) a little, make the first > parameter as MYSQLND_CONN_DATA ** instead of MYSQLND_CONN_DATA > *, so I can modify the content of the connection object the pointer points to. > >>> After the first connection established and before send the > init_command which may update last message field: > >>> { > >>> const MYSQLND_CSTRING scheme = { transport.s, transport.l }; > >>> if (FAIL == conn->m->connect_handshake(conn, &scheme, > &username, &password, &database, mysql_flags)) { > >>> goto err; > >>> } > >>> } > >>> Try to establish a new connection: > >>> enum_func_status redirectState = > >>> redirect_conn->m->connect_handshake(redirect_conn, > &redirect_scheme, &redirect_username, &password, &database, > mysql_flags); If succeeds, close the original connection, and update the > connection information: > >>> conn->m->send_close(conn); > >>> conn->m->dtor(conn); > >>> ... > >>> conn = redirect_conn; > >>> ... > >>> *pconn = redirect_conn; //use new conn outside for caller > >>> ... > >>> hostname = redirect_hostname; > >>> username = redirect_username; > >>> port = ui_redirect_port; > >> > >> Thanks for the detailed explanation. From what I can tell, this looks good > to me. > >> > >>> I've presented the code to @Christoph Becker (HAYS Professional > Solutions GM)<mailto:a-chb...@microsoft.com> before. Since currently the > code is hold on a private repository, and there is a limit foe email size so I > cannot add it in the attachment, may I ask how should I present the code to > you? > >> > >> One option could be to move it to a public Github repository. Some other > PECL extensions are also hosted there (e.g. Imagick[1]). > >> > >>> The code does not have a package.xml yet, from > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpear > .php.net%2Fmanual%2Fen%2Fpyrus.commands.pickle.php&data=02%7 > C01%7CQianqian.Bu%40microsoft.com%7C415eada329404f827dd108d740492 > 6ff%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6370485552615014 > 46&sdata=QR1p4yFGH3RhRrhlsprr7b1%2FW0oxix42ebhZjevxbIU%3D&a > mp;reserved=0 it says that I can use picke with pyrus.phar to generate the > package file, but it seems pyrus.phar cannot work with PHP7. I cannot find > pyrus.phar from pear2.php.net as described on > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpear > .php.net%2Fmanual%2Fen%2Finstallationpyrus.introduction.php&data > =02%7C01%7CQianqian.Bu%40microsoft.com%7C415eada329404f827dd108d > 7404926ff%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6370485552 > 61501446&sdata=O11jp26x9N0VKsSSAZJlkTUvHQF0JTclManFEkNzixA%3 > D&reserved=0, and the download version from > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith > ub.com%2Fpyrus%2FPyrus&data=02%7C01%7CQianqian.Bu%40microso > ft.com%7C415eada329404f827dd108d7404926ff%7C72f988bf86f141af91ab2d > 7cd011db47%7C1%7C0%7C637048555261511440&sdata=Zgq3Pgguw6Bx > TvYWKHgBdyG0jrVhws6sJFRb8oObhf8%3D&reserved=0 does not work, > and the repo has not been updated for many years. May I ask can you give > me some help about how to generate the package.xml file? > >> > >> I've filed a bug report regarding the obviously out-dated Pyrus > >> documentation[2]. It seems to me that you would have to write the > >> package.xml manually. :( > >> > >> [1] > >> > <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi > >> t > >> > hub.com%2FImagick%2Fimagick&data=02%7C01%7CQianqian.Bu%40mi > crosof > >> t > >> .com%7C0f78a037b5ea42ccf72c08d71f02f1a5%7C72f988bf86f141af91ab2d > 7cd01 > >> 1 > >> > db47%7C1%7C0%7C637011969848073885&sdata=vpUVVADXbyQMz5igk > gYMqCZkv > >> J be5QLLd0G7%2BiMhIbA%3D&reserved=0> > >> [2] > >> > <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpe > >> a > >> > r.php.net%2Fbugs%2Fbug.php%3Fid%3D23840&data=02%7C01%7CQian > qian.B > >> u > >> %40microsoft.com%7C0f78a037b5ea42ccf72c08d71f02f1a5%7C72f988bf86 > f141a > >> f > >> > 91ab2d7cd011db47%7C1%7C0%7C637011969848073885&sdata=eAkV5av > MBWi2e > >> 6 cWxzSXBrPlkXt115EGWuIpASHG4AM%3D&reserved=0> > >> > >> Thanks, > >> Christoph > >> > >