<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fabien Bagard, Author at OVHcloud Blog</title>
	<atom:link href="https://blog.ovhcloud.com/author/fabien-bagard/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.ovhcloud.com/author/fabien-bagard/</link>
	<description>Innovation for Freedom</description>
	<lastBuildDate>Mon, 03 Jul 2023 08:22:24 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.ovhcloud.com/wp-content/uploads/2019/07/cropped-cropped-nouveau-logo-ovh-rebranding-32x32.gif</url>
	<title>Fabien Bagard, Author at OVHcloud Blog</title>
	<link>https://blog.ovhcloud.com/author/fabien-bagard/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>An insight on SQL modes</title>
		<link>https://blog.ovhcloud.com/an-insight-on-sql-modes/</link>
		
		<dc:creator><![CDATA[Fabien Bagard]]></dc:creator>
		<pubDate>Tue, 22 Mar 2022 15:34:13 +0000</pubDate>
				<category><![CDATA[OVHcloud Engineering]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<guid isPermaLink="false">https://blog.ovhcloud.com/?p=22574</guid>

					<description><![CDATA[SQL mode controls the way the MySQL / MariaDB DBMS engine (Data Base Management System) understand syntax and validates data given to it for processing. We can compare it to a game with different rule sets, on which every player must agree before playing. The UNO analogy Let&#8217;s make an analogy with the UNO card [&#8230;]<img src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Fan-insight-on-sql-modes%2F&amp;action_name=An%20insight%20on%20SQL%20modes&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></description>
										<content:encoded><![CDATA[
<p>SQL mode controls the way the MySQL / MariaDB  DBMS engine (Data Base Management System) understand syntax and validates data given to it for processing.</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img fetchpriority="high" decoding="async" src="https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0891-1024x545.jpeg" alt="An insight on SQL modes" class="wp-image-22764" width="512" height="273" srcset="https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0891-1024x545.jpeg 1024w, https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0891-300x160.jpeg 300w, https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0891-768x408.jpeg 768w, https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0891.jpeg 1194w" sizes="(max-width: 512px) 100vw, 512px" /></figure></div>



<p>We can compare it to a game with different rule sets, on which every player must agree before playing.</p>



<h2 class="wp-block-heading">The UNO analogy</h2>



<p>Let&#8217;s make an analogy with the UNO card game. There is many variants, but we can sum them up like this:</p>



<figure class="wp-block-table is-style-stripes"><table><thead><tr><th><strong>Variant</strong></th><th><strong>Effect</strong></th></tr></thead><tbody><tr><td>DOUBLE</td><td>Every player can lay down several cards at once if they are strictly identical</td></tr><tr><td>INTERCEPTION</td><td>If a player has the very same card than the one just layed down, he can play his, even when it&#8217;s not his turn</td></tr><tr><td>STRAIGHT_FLUSH</td><td>Every player can lay down multiple cards at once if they follow the numerical order and has the same colour</td></tr></tbody></table></figure>



<p>Before starting to play, one defines <code>uno_mode=DOUBLE,INTERCEPTION</code>, which means the&nbsp;<code>STRAIGHT_FLUSH</code> rule does not apply. If this rule is activated later in the game, it may cause problems around the table, some players may have been disadvantaged in the previous rounds and may not want to play any more.</p>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img decoding="async" src="https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0887.png" alt="The UNO analogy" class="wp-image-22761" width="434" height="230" srcset="https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0887.png 867w, https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0887-300x159.png 300w, https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0887-768x407.png 768w" sizes="(max-width: 434px) 100vw, 434px" /></figure></div>



<h2 class="wp-block-heading">A card game to manage data?</h2>



<p>SQL mode works like this, but instead of specifying how to play cards, it specifies what to do in certain situations:</p>



<ul class="wp-block-list"><li>Is &#8220;2020-11-00&#8221; a valid date (<code>NO_ZERO_IN_DATE</code>)? It changes data validation performed by the DBMS.</li><li>Is <code>SELECT name FROM users GROUP BY first_name</code> a valid query (<code>ONLY_FULL_GROUP_BY</code>)? It changes the allowed syntax.</li></ul>



<p>When MariaDB 10.2 and MySQL 5.7 were released, the rules have changed:</p>



<figure class="wp-block-table is-style-stripes"><table><thead><tr><th><strong>DBMS</strong></th><th><strong>Default SQL_Mode</strong></th></tr></thead><tbody><tr><td>MariaDB 10.1</td><td>NO_ENGINE_SUBSTITUTION, NO_AUTO_CREATE_USER</td></tr><tr><td>MariaDB 10.2</td><td>STRICT_TRANS_TABLES, ERROR_FOR_DIVISION_BY_ZERO , NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION</td></tr><tr><td>MySQL 5.6</td><td>NO_ENGINE_SUBSTITUTION</td></tr><tr><td>MySQL 5.7</td><td>ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION</td></tr></tbody></table></figure>



<p>We can note that newer versions kept old rules, but new ones were added. That&#8217;s why when upgrading from MariaDB 10.1 to MariaDB 10.2 for instance, one must specify to its database to play with old rules, and not to enforce <code>STRICT_TRANS_TABLES, ERROR_FOR_DIVISION_BY_ZERO</code>.</p>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img decoding="async" src="https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0892.png" alt="A card game to manage data?" class="wp-image-22767" width="437" height="190" srcset="https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0892.png 873w, https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0892-300x130.png 300w, https://blog.ovhcloud.com/wp-content/uploads/2022/03/IMG_0892-768x333.png 768w" sizes="(max-width: 437px) 100vw, 437px" /></figure></div>



<h2 class="wp-block-heading">Concretely</h2>



<p>Actually, if my website should store the result of a division, but the denominator is `0`, my database with the MariaDB 10.1 default SQL mode database will allow it and store the result as <code>NULL</code>. My database with the MariaDB 10.2 default SQL mode will also allow and store a <code>NULL</code> value it but will raise a warning. If strict mode is also enabled, MariaDB 10.2 will throw an error and store nothing. Thus, changing SQL mode can break websites and should be done carefully.</p>



<p>As we cannot check every line of code of every website of each of our customers, when an DBMS major upgrade changing the default SQL mode is planned, OVHcloud activates the legacy SQL mode ensuring your website will not be affected. Of course, you can switch to the new default SQL Mode in the &#8220;Configuration&#8221; tab of your CloudDB. But keep in mind this is for experienced users and OVHcloud advises to stick with the default sql_mode, unless your database was upgraded from a previous version with a different default sql_mode.</p>



<p>Official Documentation:<br>MariaDB: <a href="https://mariadb.com/kb/en/sql-mode/" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">https://mariadb.com/kb/en/sql-mode/</a><br>MySQL: <a href="https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html</a></p>
<img loading="lazy" decoding="async" src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Fan-insight-on-sql-modes%2F&amp;action_name=An%20insight%20on%20SQL%20modes&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Life cycle policies</title>
		<link>https://blog.ovhcloud.com/life-cycle-policies/</link>
		
		<dc:creator><![CDATA[Fabien Bagard]]></dc:creator>
		<pubDate>Tue, 07 Dec 2021 10:00:00 +0000</pubDate>
				<category><![CDATA[OVHcloud Engineering]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Industrialization]]></category>
		<category><![CDATA[Life cycle]]></category>
		<guid isPermaLink="false">https://blog.ovhcloud.com/?p=21091</guid>

					<description><![CDATA[At OVHcloud our motto is &#8220;Innovation for freedom&#8221;. OVHcloud is powered by passionate people trying to stay at the state of the art of technologies. But many things slow innovation: handling legacy is one of them. One way to tackle that is to define and follow good life cycle policies. What is a life cycle [&#8230;]<img src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Flife-cycle-policies%2F&amp;action_name=Life%20cycle%20policies&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></description>
										<content:encoded><![CDATA[
<p>At OVHcloud our motto is &#8220;Innovation for freedom&#8221;. OVHcloud is powered by passionate people trying to stay at the state of the art of technologies. But many things slow innovation: handling legacy is one of them.</p>



<p>One way to tackle that is to define and follow good life cycle policies.</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://blog.ovhcloud.com/wp-content/uploads/2021/12/IMG_0705-1024x537.png" alt="Life cycle policies" class="wp-image-21445" width="512" height="269" srcset="https://blog.ovhcloud.com/wp-content/uploads/2021/12/IMG_0705-1024x537.png 1024w, https://blog.ovhcloud.com/wp-content/uploads/2021/12/IMG_0705-300x157.png 300w, https://blog.ovhcloud.com/wp-content/uploads/2021/12/IMG_0705-768x403.png 768w, https://blog.ovhcloud.com/wp-content/uploads/2021/12/IMG_0705.png 1200w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure></div>



<h3 class="wp-block-heading" id="Lifecycles-Whatisalifecyclepolicy">What is a life cycle policy</h3>



<p>A life cycle policy is a set of guidelines, written documents, describing the different steps in a product&#8217;s life, including its end of life.</p>



<h3 class="wp-block-heading" id="Lifecycles-Whyyoushouldhavealifecyclepolicy">Why you should have a life cycle policy</h3>



<p>When you read the news, it is not uncommon to hear from here and there that company XYZ got hacked through an old software, outdated for ages.</p>



<p>Having a good life cycle policy guarantees you never have to deal with outdated software. It defines when you must upgrade your software and when you must stop using an old version and migrate to a new one.</p>



<p>Benefits are multiple:</p>



<ul class="wp-block-list"><li>You don&#8217;t have to rely on unmaintained software</li><li>You reduce attack perimeter, as newer versions have security patches applied</li><li>You benefit from new versions&#8217; features, allowing you to accelerate innovation</li></ul>



<p>Of course there are downsides. The biggest one is having to stick with it. A life cycle policy is a written document and as such has value only if people read it and apply its recommendations.</p>



<h3 class="wp-block-heading" id="Lifecycles-Whyyoushouldautomateit">Why you should automate it</h3>



<p>A wise man once told &#8220;A good sysadmin is a sysadmin doing nothing&#8221;. Not because he is lazy, nor because he is bad at his job and got his credentials revoked, but because he automates all painful tasks, to focus on tasks with added value.</p>



<p>It also removes one major cause of errors: the human factor. An automated job will never mistype a command line or click on the `destroy` button, instead of the `upgrade` one.</p>



<p>Last but not least, it is a good way to make sure your carefully crafted document is not redirected to `/dev/null` in the following months.</p>



<p>Bonus: you also free a lot of time to automate new things !</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://blog.ovhcloud.com/wp-content/uploads/2021/12/livecycle-1024x270.png" alt="Live cycle" class="wp-image-21437" width="768" height="203" srcset="https://blog.ovhcloud.com/wp-content/uploads/2021/12/livecycle-1024x270.png 1024w, https://blog.ovhcloud.com/wp-content/uploads/2021/12/livecycle-300x79.png 300w, https://blog.ovhcloud.com/wp-content/uploads/2021/12/livecycle-768x202.png 768w, https://blog.ovhcloud.com/wp-content/uploads/2021/12/livecycle.png 1105w" sizes="auto, (max-width: 768px) 100vw, 768px" /></figure></div>



<h3 class="wp-block-heading" id="Lifecycles-Howwedidit">How we did it</h3>



<p>Our policy on cloud databases (available here: <a href="https://docs.ovh.com/gb/en/clouddb/managed-db-life-cycle-policy/" data-wpel-link="exclude">https://docs.ovh.com/gb/en/clouddb/managed-db-life-cycle-policy/</a>) forces us to warn our customers at least 30 days before a major upgrade by e-mail. This email contains the day the upgrade will take place on.<br>We also have an internal mechanism allowing our customers to upgrade by themselves, using our API.<br>Combining these two bricks were all we had to do, with minor adjustments:</p>



<ul class="wp-block-list"><li>When sending a email, we keep track of the planned date of the operation.</li><li>An automated job is triggered every day, checking what operations are due this day and launching them.</li></ul>



<p>Almost everyday, our job realises there is no major upgrade planned and goes back to sleep. But if a single operation is found, this job calls our API, triggering this upgrade. No human needed.</p>



<p>This process is very simple, yet very effective. We already had all the building blocks ready, from sending an email to API calls for major upgrades. All we had to do was to link all these operations together in a nice workflow. This allow us a very fine tuning of how many operation we want being done everyday, down to the instance.</p>



<p>Want to try the process for the first time ? Easy, trigger it on one of our test instance.<br>Is this process reliable and scalable ? Enough to upgrade a batch of 10 000 instances in 30 days with no human intervention !</p>



<h2 class="wp-block-heading">One last word on an automated life-cycle policy</h2>



<p>At Web Cloud Databases, with thousands of instances, 4 different DBMS and a total of 12 major versions, automation is the key.</p>



<p>In May 2021, for this process&#8217; firsts steps in this world, we upgraded 6K instances in a week. The only human interaction needed was to launch a script to inform all affected customers.</p>



<p>Figures of this use-case ? 6000+ instances updated, 0 website down, 1 human needed for 5 minutes.</p>
<img loading="lazy" decoding="async" src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Flife-cycle-policies%2F&amp;action_name=Life%20cycle%20policies&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Another day in ProxySQL life: sharing is caring</title>
		<link>https://blog.ovhcloud.com/another-day-in-proxysql-life-sharing-is-caring/</link>
		
		<dc:creator><![CDATA[Fabien Bagard]]></dc:creator>
		<pubDate>Tue, 31 Mar 2020 13:31:33 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<guid isPermaLink="false">https://www.ovh.com/blog/?p=17216</guid>

					<description><![CDATA[This post is another part of our list of short posts pinpointing specific cases OVHcloud has dealt with, both preparing for and during the migration. Here, we tell a story of how sometimes, a little unexpected behaviour can lead to a bug fix in a software program used by millions of people around the world. [&#8230;]<img src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Fanother-day-in-proxysql-life-sharing-is-caring%2F&amp;action_name=Another%20day%20in%20ProxySQL%20life%3A%20sharing%20is%20caring&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></description>
										<content:encoded><![CDATA[
<p>This post is another part of our list of short posts pinpointing specific cases OVHcloud has dealt with, both preparing for and during the migration. Here, we tell a story of how sometimes, a little unexpected behaviour can lead to a bug fix in a software program used by millions of people around the world.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="537" src="https://www.ovh.com/blog/wp-content/uploads/2020/03/7C047A4D-C9B8-4CFC-8A6A-809E8FFC3D2D-1024x537.jpeg" alt="" class="wp-image-17752" srcset="https://blog.ovhcloud.com/wp-content/uploads/2020/03/7C047A4D-C9B8-4CFC-8A6A-809E8FFC3D2D-1024x537.jpeg 1024w, https://blog.ovhcloud.com/wp-content/uploads/2020/03/7C047A4D-C9B8-4CFC-8A6A-809E8FFC3D2D-300x157.jpeg 300w, https://blog.ovhcloud.com/wp-content/uploads/2020/03/7C047A4D-C9B8-4CFC-8A6A-809E8FFC3D2D-768x403.jpeg 768w, https://blog.ovhcloud.com/wp-content/uploads/2020/03/7C047A4D-C9B8-4CFC-8A6A-809E8FFC3D2D.jpeg 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>In <a href="https://www.ovh.com/blog/migrate-datacentre-quiet-how-do-we-seamlessly-migrate-a-datacentre/" data-wpel-link="exclude">this post</a>, I explained how we had to push proxySQL past its limits.</p>



<p>Julien explained <a href="https://www.ovh.com/blog/a-day-in-the-life-of-a-proxysql-at-ovhcloud/" data-wpel-link="exclude">here</a> how difficult it can be to hijack pieces of a software program, and make it work for a very specific use case. One so specific that we just could not push it upstream, as we were breaking some assumptions on the base code (something like, &#8220;look, we don&#8217;t use this, maybe we can divert it, to make it match our use&#8221;).</p>



<p>But sometimes, as we dig deeper and deeper through lines of code, pushing the limits of open-source software programs further and further, we reach bugs.</p>



<p>Here are two real-life case where we had an unexpected behaviour from ProxySQL, resulting in a patch for MariaDB/MySQL.</p>



<h1 class="wp-block-heading" id="id-5thPost-Sharingiscaring-1.Theimportanceofquoting">1. The importance of quoting</h1>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Anunexpectedbehaviour">An unexpected behaviour</h2>



<p>When we first started using ProxySQL, we had an unexpected behaviour. ProxySQL used to hang. No warning, no precursor. A hang means that ProxySQL cannot process your requests, causing your websites to be unavailable as a result.</p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Digging">Digging</h2>



<p>Sysadmins know that when in doubt, check the logs. That&#8217;s what we did, and we noticed this:</p>



<pre class="wp-block-preformatted">[ERROR] Detected a broken connection during SET NAMES on 192.168.59.272 , 3306 : 2019, Can't initialize character set (null) (path: compiled_in)</pre>



<p>So we took a closer look at the logs, tried to replicate the behaviour, and finally came across this:</p>



<pre class="wp-block-preformatted">ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'binary' at line 1</pre>



<p>This  is clearly an error returned from the MySQL server. As this log line was generated on the ProxySQL, it means the error was between our  ProxySQL and the MySQL server.</p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Findinggold">Finding gold</h2>



<p>Julien worked hard — he read tonnes of logs, traced many PIDs, and tracked the problem down to <span style="text-decoration: underline">THE</span> triggering case — issuing this command:</p>



<pre class="wp-block-preformatted">set names binary COLLATE binary;</pre>



<p>A collation is a kind of rule-set for comparing strings. It can define, for example when sorting alphabetically, if <code>A</code> comes before <code>a</code>, if <code>é</code> should be treated as <code>e</code> or not, or where <code>œ</code> should be in the alphabet.</p>



<p>You can read more about it on <a href="https://mariadb.com/kb/en/character-set-and-collation-overview/" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">MariaDB&#8217;s Knowledge Base</a>.<br></p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-TheFix">The fix</h2>



<p>After submitting an issue on ProxySQL&#8217;s bug-tracker with what we discovered, and proposing a patch, the author of ProxySQL had a look and confirmed the bug.</p>



<p>While writing ProxySQL, <a href="https://www.proxysql.com/" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">René Cannaò</a> did what all developers do — he followed MariaDB&#8217;s connector documentation. And the bug was from here:</p>



<pre class="wp-block-preformatted">According to the documentation on SET NAMES syntax (<a href="https://dev.mysql.com/doc/refman/5.7/en/set-names.html" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">https://dev.mysql.com/doc/refman/5.7/en/set-names.html</a>) :

charset_name and collation_name may be quoted or unquoted

This doesn't seem true for "SET NAMES binary COLLATE binary" , that requires the collation name to be quoted.</pre>



<p>(<a href="https://bugs.mysql.com/bug.php?id=93692" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">https://bugs.mysql.com/bug.php?172id=93692</a>)</p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Thebutterflyeffect">The butterfly effect</h2>



<p>So, from a hang on our infrastructure, we reported a bug to the project&#8217;s creator, who then traced it to a bug in a MariaDB connector, followed it up to its parent MySQL, and fixed it upstream. The bug was closed in early 2020.</p>



<p>In the meantime, we worked with Mr Cannaò to provide a workaround (basically forcing the collation name to be quoted in ProxySQL&#8217;s code).</p>



<p></p>



<h1 class="wp-block-heading" id="id-5thPost-Sharingiscaring-2.Whenfingersgetsentangled">2. When wires get crossed</h1>



<p>While writing this article, I remembered another <em>funny</em> bug. I decided to check this bug status, and noticed we never reported it. My mistake is now fixed.</p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Anunexpectedbehaviour.1">An unexpected behaviour</h2>



<p>When using some real but exotic charsets on ProxySQL (we also love tricky scenarios, so we try to test them as much as possible), we had a  ProxySQL error, stating we were using an incorrect charset.</p>



<pre class="wp-block-preformatted">MySQL_Session.cpp:2964:handler(): [WARNING] Error during query on (42,192.168.59.272,3306): 1267, Illegal mix of collations (utf8_general_ci,IMPLICIT) and (dec8_swedish_ci,COERCIBLE) for operation '='</pre>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Digging.1">Digging</h2>



<p>Of course, first of all we checked that we were using a real and legit charset and associated collation. We double- and triple-checked that we  should be allowed to use `dec8_swedish_ci`.</p>



<p>We decided to have a look at the connector&#8217;s source code.</p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Findinggold.1">Finding gold</h2>



<p>If you are curious about it, you can have a look at older versions of the `libmariadb/my_charset.c` code, starting from line 541. You will notice that `dec8_swedish_ci` is nowhere to be found. But if you look closely, you will notice  dec8_swedisch_ci. Dear friends from Sweden, you were not the only ones with a typo.</p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-TheFix.1">The fix</h2>



<p>When fixing our issue with exotic charsets, we applied a custom patch on our custom build of ProxySQL. In the heat of the moment, we delayed the bug reporting.</p>



<p>We forked the <a href="https://github.com/mariadb-corporation" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">mariadb-corporation</a> /<strong> <a href="https://github.com/mariadb-corporation/mariadb-connector-c" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">mariadb-connector-c</a> </strong>GitHub repository, fixed some typos, and proposed a pull request — which was then merged mid-February.</p>



<h2 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Thebutterflyeffect.1">The butterfly effect</h2>



<p>Everyone is prone to typos, and making mistakes. We encountered some, they were fixed and ported for everyone.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="551" src="https://www.ovh.com/blog/wp-content/uploads/2020/03/C42AC630-51F1-4153-AC5E-6AC417DFA420-1024x551.jpeg" alt="" class="wp-image-17753" srcset="https://blog.ovhcloud.com/wp-content/uploads/2020/03/C42AC630-51F1-4153-AC5E-6AC417DFA420-1024x551.jpeg 1024w, https://blog.ovhcloud.com/wp-content/uploads/2020/03/C42AC630-51F1-4153-AC5E-6AC417DFA420-300x161.jpeg 300w, https://blog.ovhcloud.com/wp-content/uploads/2020/03/C42AC630-51F1-4153-AC5E-6AC417DFA420-768x413.jpeg 768w, https://blog.ovhcloud.com/wp-content/uploads/2020/03/C42AC630-51F1-4153-AC5E-6AC417DFA420.jpeg 1270w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<h1 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Conclusion">Conclusion</h1>



<p>As a leading web hosting provider in Europe, we face the Law of truly large numbers (<a href="https://en.wikipedia.org/wiki/Law_of_truly_large_numbers" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">https://en.wikipedia.org/wiki/Law_of_truly_large_numbers</a>). TL;DR: Each and every event with a non null occurring probability will happen.</p>



<p>We host more than 1.3 million websites. Let&#8217;s assume that 0.0001% of our customers can trigger one single specific bug — we have at least 1  customer who will trigger it. The question is not <em>if,</em> but <em>when</em> we will have to deal with it, and <em>how</em> to do so.</p>



<p>Wondering how we noticed that we had hit the Law of truly large numbers? Stay tuned, because we will write about this soon.</p>



<h1 class="wp-block-heading" id="id-5thPost-Sharingiscaring-Sharingiscaring">Sharing is caring</h1>



<p>OVHCloud loves open-source, and loves sharing. This is not the first time we contributed to the open-source world, and definitely not the last.</p>
<img loading="lazy" decoding="async" src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Fanother-day-in-proxysql-life-sharing-is-caring%2F&amp;action_name=Another%20day%20in%20ProxySQL%20life%3A%20sharing%20is%20caring&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
