From 1d98f5f6b324025351559df32d05bec28551cb89 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Jun 2010 16:38:23 +0400 Subject: [PATCH 001/349] From ceb60c564f4609542a5ac32639157c8ff0155b59 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jun 2010 12:36:13 +0400 Subject: [PATCH 002/349] From ff2878f13bc4be2c3483f213124817c63ea554c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jun 2010 14:58:02 +0400 Subject: [PATCH 003/349] From b43616cb10fe10f9de6ffa244d5fa56bf40d6844 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Aug 2010 12:35:28 +0400 Subject: [PATCH 004/349] From 98a85c54215a1e345a7a5de95c2843eda752ff23 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Sep 2010 14:13:19 +0400 Subject: [PATCH 005/349] From 724ca07bd2b468ef4fb16666d2b6c48b991da506 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Oct 2010 11:50:30 +0200 Subject: [PATCH 006/349] From b3be64a6225e91c7b1d63ef2c7d9b9ff84e59670 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Oct 2010 12:10:57 +0200 Subject: [PATCH 007/349] From 282bd2c48b39857d23451e0801d08358cc512ff9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Oct 2010 15:08:56 +0200 Subject: [PATCH 008/349] From 49bf45f09e220be7ccef2ba60772f5630d81a04a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 13 Oct 2010 14:09:09 +0200 Subject: [PATCH 009/349] From d8763119c3ae7e54701eadfa8cf65c08a03606e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Oct 2010 07:57:58 +0200 Subject: [PATCH 010/349] From a8326f82a2fef6029dede4e8a9197cde258f357c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Oct 2010 14:28:05 +0200 Subject: [PATCH 011/349] From 983287b9cee28508a3a35954a100aeee2dfe4dc3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 09:44:06 +0200 Subject: [PATCH 012/349] From 583304564667acea066b4d13c1dd2619478a06c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 10:08:23 +0200 Subject: [PATCH 013/349] From 528ee88f452ddaf15c32d915cf8662c7eeb7f4de Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 12:24:40 +0200 Subject: [PATCH 014/349] From 5d424ac6c937bfc6372ba81143449e85a28da440 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 14:17:56 +0200 Subject: [PATCH 015/349] From ad6c110c2657a871a02de0c24acbacea080584dd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Oct 2010 12:31:10 +0200 Subject: [PATCH 016/349] From 365f30c69b8c350979ebebb634438b76dc8396bd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Oct 2010 14:04:53 +0200 Subject: [PATCH 017/349] From d8c435acbd5aa5ae43d8c3ed1efb4cec53283784 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Oct 2010 19:31:27 +0200 Subject: [PATCH 018/349] From cd5541bccf226f3591aa844458f8edb8ae5f8887 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Oct 2010 12:26:56 +0200 Subject: [PATCH 019/349] From 6e36a3327c2cb839775ab5cf2c7300bfe46fa505 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Oct 2010 14:12:34 +0200 Subject: [PATCH 020/349] From 027dc3469aab4d8d281392418d22c2b97f3941cc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 14:41:51 +0100 Subject: [PATCH 021/349] From 3e69de9da0f7cefc0f99af70430e1d336e4ecd53 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 15:45:58 +0100 Subject: [PATCH 022/349] From ac98991149c589757b281037c64b525f02028441 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 22:40:42 +0100 Subject: [PATCH 023/349] From 1a25823b8f55c304a7cb742e8e09bda55cab6f7a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 22:53:34 +0100 Subject: [PATCH 024/349] From 56633558581d35b78f7de947afd80d1867f9a29e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 Nov 2010 17:21:49 +0100 Subject: [PATCH 025/349] From a6824da69b56e3204682e508dc2492a18b0e5645 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 15:37:06 +0200 Subject: [PATCH 026/349] From 44d90be51804ec1f078430c5694c878cb4d8814f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 16:00:48 +0200 Subject: [PATCH 027/349] From a5745fbc29384b64b0cf60fe88da8a6691dc19ea Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 17:59:04 +0200 Subject: [PATCH 028/349] From 06b7e7bd655eb67bd0d2f140cdd2b57496dd75dc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 16:45:53 +0200 Subject: [PATCH 029/349] From a5fc25b0a65c61c79618df0933ea2d9fffc56cb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Nov 2010 14:52:02 +0100 Subject: [PATCH 030/349] From 2d4a00578ca4c63241c056a6aac243f827641e05 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Nov 2010 23:52:50 +0100 Subject: [PATCH 031/349] From 69ed65c8b8be488b4615b7400bced26f138662ea Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Nov 2010 17:43:52 +0200 Subject: [PATCH 032/349] From 5171af9402250db6a4f6c529b80654359559c4f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 Dec 2010 15:35:22 +0300 Subject: [PATCH 033/349] From 7bff141ce39fa82e1034478813e1521173219b54 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Dec 2010 15:05:34 +0300 Subject: [PATCH 034/349] From d1743d0ff502fb37afee96958045b3f8e6c46623 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Dec 2010 10:45:24 +0300 Subject: [PATCH 035/349] From 5d73a7a878b84243dff9a94063a721919f3b6228 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Dec 2010 13:14:15 +0300 Subject: [PATCH 036/349] From 73e4d40b025dd9ae14726cb1de8f631b8ed07ff0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Jan 2011 15:38:52 +0100 Subject: [PATCH 037/349] From 044c3f3c8c35262f48f765f3056416d5c5759396 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Jan 2011 15:40:44 +0100 Subject: [PATCH 038/349] From 7a08d9b91bbd1adf50cfb4272c30e0c909a45983 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Jan 2011 14:42:19 +0200 Subject: [PATCH 039/349] From b947b5e39d7505cfced968d5a3c21adb89c70d34 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Jan 2011 15:02:28 +0200 Subject: [PATCH 040/349] From 4b1d7b760f4f33df6adf0cc586b52c807b4216a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2011 13:39:08 +0200 Subject: [PATCH 041/349] From 4346f30e739d395de69f6d222e1be3c1379b0ccc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2011 13:39:45 +0200 Subject: [PATCH 042/349] From df38d3b7de69596c43b38654bc744ab99a0b66ab Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2011 13:41:57 +0200 Subject: [PATCH 043/349] From 70e9b65b859c8805ed7453792f78592b9d3096a3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Jan 2011 12:13:54 +0200 Subject: [PATCH 044/349] From 50f442bdb6c212bfd0d512f8ef533532758c378c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Jan 2011 18:20:03 +0200 Subject: [PATCH 045/349] From 36334fdca37c629f88b079ba4bc5624f033cb352 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Feb 2011 16:56:27 +0100 Subject: [PATCH 046/349] From 594741043e907418dda64dc20350cd4588db6b88 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Feb 2011 18:36:20 +0300 Subject: [PATCH 047/349] From 9c1795853825952f9fc94124b81d06887feb6624 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Feb 2011 10:31:05 +0300 Subject: [PATCH 048/349] From 57bc1bef4a83cb4d9b5392c45487f3080a24f4dd Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Feb 2011 14:28:28 +0300 Subject: [PATCH 049/349] From b1b3614e4eb3918f12ccdb28e1df9bf2ade93e4e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2011 09:14:04 +0300 Subject: [PATCH 050/349] From e6d7ccd689dcf54bf42b1967f3dc0e90a0f59400 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2011 10:18:15 +0300 Subject: [PATCH 051/349] From 9a9b685bf051ac1ec322c995eb4fc7529fef45de Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2011 11:36:47 +0300 Subject: [PATCH 052/349] From a67848ca54e59682caf78f2fd9238709611b2dd3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Feb 2011 09:16:15 +0300 Subject: [PATCH 053/349] From 5844fcee03f9412eef0000d5a8354476da2a3781 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2011 11:17:48 +0300 Subject: [PATCH 054/349] From d30f6443d5913d36295bc49a17058c47ed0e9d2f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2011 11:41:54 +0300 Subject: [PATCH 055/349] From 4df417da5bceb3457a4abcb5cd508ed5c5e0260d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Mar 2011 11:45:26 +0300 Subject: [PATCH 056/349] From 88c0cfd2b07fa94df15cfda114b55e96fc5c38c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Mar 2011 15:06:16 +0300 Subject: [PATCH 057/349] From aad279b33125f01af819bd86a1282a761178a0b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Mar 2011 15:19:02 +0300 Subject: [PATCH 058/349] From 11e2548910b295167f88fd80e562ccd6b86294f0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Mar 2011 16:15:05 +0300 Subject: [PATCH 059/349] From 5bf7ea745bef54d9ec9fcbd6b6048d9d9c4d4abc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Mar 2011 17:30:59 +0300 Subject: [PATCH 060/349] From c1f4c3ab92531101d004bb22a0e42781f8334604 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Mar 2011 12:34:24 +0300 Subject: [PATCH 061/349] From 2461535285fa28e13eba852d74cf043a09a5f72d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Mar 2011 11:30:42 +0300 Subject: [PATCH 062/349] From 15c67437dbf1e3b1a6bf5cae0672bd0d778411e3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Mar 2011 09:28:21 +0300 Subject: [PATCH 063/349] From 799150f58bcbc1a21cd3c5d2d1f312a3faecd20f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Mar 2011 11:41:28 +0200 Subject: [PATCH 064/349] From cc118d68fbda2c3bd26cc8fd76a26a96e2a9e57e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 18 Apr 2011 11:11:02 +0200 Subject: [PATCH 065/349] From 78ef1681cd6374ff622d60ac70eff3f4bda00150 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Apr 2011 12:51:58 +0200 Subject: [PATCH 066/349] From 54ac334d384a6d8ac675d393906c2ef65ef3256f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Apr 2011 22:54:05 +0200 Subject: [PATCH 067/349] From a483c2585a3ba1f3b53ac7e6c164a1aa670615b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 May 2011 12:38:44 +0300 Subject: [PATCH 068/349] From 76b829d5a02280d7ac44f501f8afe5cfe261d447 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 May 2011 12:40:29 +0300 Subject: [PATCH 069/349] From b7ea8621af4fb8f91b6d3e70bf6ed19f682a3c68 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 14:19:41 +0200 Subject: [PATCH 070/349] From ad8034bc83bdf372bb16cf1fd292fd9224dc2a1e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:02:22 +0200 Subject: [PATCH 071/349] From 6aea16c33c2530c105b886498554330b4d1c8b4d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:05:38 +0200 Subject: [PATCH 072/349] From fc31ce5086f304527ad6dede5f9de47d96716130 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:08:27 +0200 Subject: [PATCH 073/349] From 18a49e7a27f4da46aa34dd43664b6ba221415c17 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:17:28 +0200 Subject: [PATCH 074/349] From 5288f99fb8785fc6442f0e7b2824d6b92de183d7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:22:18 +0200 Subject: [PATCH 075/349] From 326621e5a3a7445c6c40a067ca6a5ff44cbf8330 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 10:00:22 +0200 Subject: [PATCH 076/349] From 730d160a69f6897281786c1fedac00eebffd9d2f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 10:39:44 +0200 Subject: [PATCH 077/349] From 113fb69f0f6d45183ac64fd9429908e27356a02f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 13:22:01 +0200 Subject: [PATCH 078/349] From c5c9fc2dbecc9eb6970f661752da40beb56d913b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 13:31:36 +0200 Subject: [PATCH 079/349] From 7c2dd1561824a771abd277f1719b5d766d272706 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 16:15:16 +0200 Subject: [PATCH 080/349] From 7e59b5cd948c041a7e68cdb492d9b02893b55da8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 11:59:46 +0200 Subject: [PATCH 081/349] From 97105260188eb3765d8af21c974b91ea92456c6f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 14:46:30 +0200 Subject: [PATCH 082/349] From b957a5d831aa8d3e3f8e3a70e4c29c277470bcd9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 15:44:29 +0200 Subject: [PATCH 083/349] From 8eccbb7dc3f5ed4407417d1858f3ed00160239ff Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 16:21:34 +0200 Subject: [PATCH 084/349] From f21203f1f6cdab7a8da16ac25c0060bc6f357a20 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 16:28:59 +0200 Subject: [PATCH 085/349] From fc209fe922fe5851b3a61074c89ff9f06e0dc691 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 11:34:53 +0200 Subject: [PATCH 086/349] From 1a3a1d45fd6bd13ee867bd8df6f53c299929ace7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 13:37:32 +0200 Subject: [PATCH 087/349] From a73ee62a33a24b360bd7c350d47d10e0a4e500d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 14:17:35 +0200 Subject: [PATCH 088/349] From 021812e38dc337cdca62e8b4b054c1ca34bb277e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 20:40:46 +0200 Subject: [PATCH 089/349] From 30ab0a9268bdfe071db826b1125d77a7054c7f16 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 20:42:53 +0200 Subject: [PATCH 090/349] From 71090aa72863ffdb77b3e2a3938539e89cedb934 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 20:47:39 +0200 Subject: [PATCH 091/349] From c7a95864b8e4498a1e361f9b39e362f995e7113b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 21:01:12 +0200 Subject: [PATCH 092/349] From 8d33c5d17403b57acd02f17ed43b7bb684a3a774 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jun 2011 21:47:44 +0200 Subject: [PATCH 093/349] From df672bef4b1b41a4ee9d6197064965dd18f8404a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jun 2011 20:55:37 +0200 Subject: [PATCH 094/349] From 528448ff02023510c5663be6c854e92916e0b6ae Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2011 13:27:46 +0200 Subject: [PATCH 095/349] From ae4d027ce925539e64b303fb7243c329fdf14da3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2011 12:28:29 +0400 Subject: [PATCH 096/349] From 09341b78dda52ec9260240392dfdec0e77f5e428 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2011 16:53:08 +0200 Subject: [PATCH 097/349] From 028d87e7a1108ba7d8872027c54aedda85ed5707 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jun 2011 09:19:21 +0200 Subject: [PATCH 098/349] From e58c971fb120b20db5701e575b048fdde71199bc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jun 2011 11:28:10 +0200 Subject: [PATCH 099/349] From 5584961e030bc44619d704515df5921e118bf9f9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jun 2011 22:17:15 +0200 Subject: [PATCH 100/349] From e79c71b7e96515b24091a704e7ce6263457ea55a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 11 Jun 2011 16:25:46 +0200 Subject: [PATCH 101/349] From 2480e76ce9a211704c554f2af1f158f48d5c3aa8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Jun 2011 12:54:59 +0200 Subject: [PATCH 102/349] From f7593d71d1bfa5f604a42c03035e7ce2c31a6517 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jun 2011 10:38:51 +0200 Subject: [PATCH 103/349] From 30412e252193e9f1c1cc4cadc9e152e0f0d3a480 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Jun 2011 14:57:02 +0400 Subject: [PATCH 104/349] From a5ad75acb0f47fd1c13cc940a2373881b8521099 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Jul 2011 17:57:44 +0300 Subject: [PATCH 105/349] From 95854892298a26d7ac0fca2928e0cbc7e1604e31 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Jul 2011 21:39:15 -0300 Subject: [PATCH 106/349] From 3d2e329dec873d177f973ed0ff5b06f62c59cc10 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Jul 2011 22:10:35 -0300 Subject: [PATCH 107/349] From 2e6eccc241630412e2c0289f323cef8b53b16330 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jul 2011 12:42:04 -0300 Subject: [PATCH 108/349] From b3589afe4d0adc9873d7f66b89adc15c75a164cb Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Aug 2011 17:27:30 +0200 Subject: [PATCH 109/349] From 09cd3f305e142a50adb789da345d071b9ba3a027 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2011 15:52:28 +0300 Subject: [PATCH 110/349] From 282b192da33bb023b047d302079d11f69b0d1431 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2011 16:41:24 +0200 Subject: [PATCH 111/349] From ff32d581e44c174609770a6b90b8bd4e374f92be Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 Aug 2011 13:16:08 +0300 Subject: [PATCH 112/349] From df7ecefc38ce89362e18e34ddd0d125df4c9e4f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Aug 2011 10:46:23 +0300 Subject: [PATCH 113/349] From 5628f022eafbb386bc23c222e0edbefbc3d4acaa Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Aug 2011 16:06:01 +0200 Subject: [PATCH 114/349] From 84f8af386c4c9a3fe68ff0288b7c44ec87566130 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Sep 2011 11:46:05 +0200 Subject: [PATCH 115/349] From c7034a21be5da4be3b025ff70b0374c84ba1b454 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Sep 2011 15:13:04 +0200 Subject: [PATCH 116/349] From 5dc086cb84ff261172a9f5e28763aabc02553c5a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Sep 2011 15:18:03 +0200 Subject: [PATCH 117/349] From 1dae9261054266f245635df15377ca934771cb28 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Sep 2011 18:58:54 +0200 Subject: [PATCH 118/349] From 28b3dde980b4794bc6d34333cd6eb6e138efbc2c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Sep 2011 22:16:05 +0200 Subject: [PATCH 119/349] From fde05cbe60038358f240d3fde7db0dfda97d0059 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Sep 2011 22:19:07 +0200 Subject: [PATCH 120/349] From ac9739ff80ceb21e5939065652aaf1d8bed30157 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Sep 2011 10:11:39 +0200 Subject: [PATCH 121/349] From b48eec0413bf140a91eda98fe63e7d9fc17d0069 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2011 18:40:54 +0200 Subject: [PATCH 122/349] From 2d20d8389bdec7bf11e9f35755ce414aec575c59 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Sep 2011 12:23:38 +0300 Subject: [PATCH 123/349] From a510b5638e187e0fa5996f9728b0dbf3e4cda6ec Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Sep 2011 17:06:02 +0300 Subject: [PATCH 124/349] From b1ca7fdd06eca64f672d52d309ecb17d5873484d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2011 17:50:00 +0200 Subject: [PATCH 125/349] From f35537d75da055cc5d195b64f10e9554a1a07ab1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2011 17:51:26 +0200 Subject: [PATCH 126/349] From 6639c39d3aa230c65a4743be8c3561f60a642f49 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Nov 2011 11:43:55 +0100 Subject: [PATCH 127/349] From 45dd5afb1fdf90a2f60f804c27e1073f6a85a10f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 21 Dec 2011 17:04:24 +0100 Subject: [PATCH 128/349] From 0debf36f963dd2a67fc5314702aa36cc588f734f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jan 2012 16:16:29 +0100 Subject: [PATCH 129/349] From fa40ae3797571d3d63e358f8912d61865a820014 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jan 2012 12:09:06 +0100 Subject: [PATCH 130/349] From 599d6bbb1149be4c9e1a012103def15e0c0687ab Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Feb 2012 13:18:53 +0100 Subject: [PATCH 131/349] From 286edcdb00a254cbbce8bc2bcb35fce9f1950a49 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Feb 2012 13:20:36 +0100 Subject: [PATCH 132/349] From 0f222c6b2a7877f233d6811b7c714823c0af64f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Mar 2012 12:40:57 +0100 Subject: [PATCH 133/349] From e629839f5143fe06a6b262812ec5bc7e3e98016a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Apr 2012 14:05:03 +0400 Subject: [PATCH 134/349] From 5967ae0143e11b99bf20a0841ceaf8a4647fec31 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Jun 2012 14:56:04 +0200 Subject: [PATCH 135/349] From 7bc9f782f2ef60c14a4bcf9a0ba01d73fcbd4930 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2012 09:41:31 +0200 Subject: [PATCH 136/349] From 057cb35c459185af9e2bf901d27ced6e55b6b28f Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Fri, 8 Jun 2012 19:44:06 +0200 Subject: [PATCH 137/349] First version of supporting the build of RPMs for ULN from the MySQL 5.5 source tree. This change adds the spec file for these ULN RPMs as well as several patches and additional sources, to be used only in ULN RPMs. All these files are in a new directory "SPECIFIC-ULN/". This commit is for internal tool tests only, not yet ready for publishing. --- SPECIFIC-ULN/README-ULN | 15 + SPECIFIC-ULN/README.mysql-docs | 4 + SPECIFIC-ULN/filter-requires-mysql.sh | 3 + SPECIFIC-ULN/generate-tarball.sh | 15 + SPECIFIC-ULN/my.cnf | 10 + SPECIFIC-ULN/my_config.h | 29 ++ SPECIFIC-ULN/mysql-5.5-errno.patch | 21 + SPECIFIC-ULN/mysql-5.5-fix-tests.patch | 34 ++ SPECIFIC-ULN/mysql-5.5-libdir.patch | 28 ++ SPECIFIC-ULN/mysql-5.5-mtr1.patch | 25 + SPECIFIC-ULN/mysql-5.5-stack-guard.patch | 140 ++++++ SPECIFIC-ULN/mysql-5.5-testing.patch | 23 + SPECIFIC-ULN/mysql-chain-certs.patch | 41 ++ SPECIFIC-ULN/mysql-embedded-check.c | 26 ++ SPECIFIC-ULN/mysql-expired-certs.patch | 555 +++++++++++++++++++++++ SPECIFIC-ULN/mysql-install-test.patch | 33 ++ SPECIFIC-ULN/mysql-strmov.patch | 32 ++ SPECIFIC-ULN/mysql.init | 209 +++++++++ SPECIFIC-ULN/scriptstub.c | 32 ++ 19 files changed, 1275 insertions(+) create mode 100644 SPECIFIC-ULN/README-ULN create mode 100644 SPECIFIC-ULN/README.mysql-docs create mode 100755 SPECIFIC-ULN/filter-requires-mysql.sh create mode 100755 SPECIFIC-ULN/generate-tarball.sh create mode 100644 SPECIFIC-ULN/my.cnf create mode 100644 SPECIFIC-ULN/my_config.h create mode 100644 SPECIFIC-ULN/mysql-5.5-errno.patch create mode 100644 SPECIFIC-ULN/mysql-5.5-fix-tests.patch create mode 100644 SPECIFIC-ULN/mysql-5.5-libdir.patch create mode 100644 SPECIFIC-ULN/mysql-5.5-mtr1.patch create mode 100644 SPECIFIC-ULN/mysql-5.5-stack-guard.patch create mode 100644 SPECIFIC-ULN/mysql-5.5-testing.patch create mode 100644 SPECIFIC-ULN/mysql-chain-certs.patch create mode 100644 SPECIFIC-ULN/mysql-embedded-check.c create mode 100644 SPECIFIC-ULN/mysql-expired-certs.patch create mode 100644 SPECIFIC-ULN/mysql-install-test.patch create mode 100644 SPECIFIC-ULN/mysql-strmov.patch create mode 100644 SPECIFIC-ULN/mysql.init create mode 100644 SPECIFIC-ULN/scriptstub.c diff --git a/SPECIFIC-ULN/README-ULN b/SPECIFIC-ULN/README-ULN new file mode 100644 index 00000000000..8ae44a18605 --- /dev/null +++ b/SPECIFIC-ULN/README-ULN @@ -0,0 +1,15 @@ +In order to have RPMs of MySQL which are distributed via ULN for Oracle Linux +to be as closely compatible to such RPMs built and distributed by RedHat, +this directory contains additional files which originated at RedHat +and are used only for such RPMs intended for distribution via ULN. + +Especially, this directory contains the spec file used to build these RPMs, +named "mysql.spec". Please regard the following note: + + You are receiving a copy of the Red Hat spec file. + The terms of the Oracle license do NOT apply to the Red Hat spec file; + it is licensed under the + GNU GENERAL PUBLIC LICENSE Version 2, June 1991 + separately from the Oracle programs you receive. + + diff --git a/SPECIFIC-ULN/README.mysql-docs b/SPECIFIC-ULN/README.mysql-docs new file mode 100644 index 00000000000..dd894a7b9c0 --- /dev/null +++ b/SPECIFIC-ULN/README.mysql-docs @@ -0,0 +1,4 @@ +The official MySQL documentation is not freely redistributable, so we cannot +include it in RHEL or Fedora. You can find it on-line at + +http://dev.mysql.com/doc/ diff --git a/SPECIFIC-ULN/filter-requires-mysql.sh b/SPECIFIC-ULN/filter-requires-mysql.sh new file mode 100755 index 00000000000..d435062b8dc --- /dev/null +++ b/SPECIFIC-ULN/filter-requires-mysql.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/lib/rpm/perl.req $* | grep -v -e "perl(th" -e "perl(lib::mtr" -e "perl(mtr" diff --git a/SPECIFIC-ULN/generate-tarball.sh b/SPECIFIC-ULN/generate-tarball.sh new file mode 100755 index 00000000000..2ff4bff2349 --- /dev/null +++ b/SPECIFIC-ULN/generate-tarball.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +VERSION=$1 + +rm -rf mysql-$VERSION + +tar xfz mysql-$VERSION.tar.gz || exit 1 + +rm mysql-$VERSION/Docs/mysql.info + +tar cfz mysql-$VERSION-nodocs.tar.gz mysql-$VERSION || exit 1 + +rm -rf mysql-$VERSION + +exit 0 diff --git a/SPECIFIC-ULN/my.cnf b/SPECIFIC-ULN/my.cnf new file mode 100644 index 00000000000..fae0fa276e1 --- /dev/null +++ b/SPECIFIC-ULN/my.cnf @@ -0,0 +1,10 @@ +[mysqld] +datadir=/var/lib/mysql +socket=/var/lib/mysql/mysql.sock +user=mysql +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 + +[mysqld_safe] +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid diff --git a/SPECIFIC-ULN/my_config.h b/SPECIFIC-ULN/my_config.h new file mode 100644 index 00000000000..435a126ac97 --- /dev/null +++ b/SPECIFIC-ULN/my_config.h @@ -0,0 +1,29 @@ +/* + * Kluge to support multilib installation of both 32- and 64-bit RPMS: + * we need to arrange that header files that appear in both RPMs are + * identical. Hence, this file is architecture-independent and calls + * in an arch-dependent file that will appear in just one RPM. + * + * To avoid breaking arches not explicitly supported by Red Hat, we + * use this indirection file *only* on known multilib arches. + * + * Note: this may well fail if user tries to use gcc's -I- option. + * But that option is deprecated anyway. + */ +#if defined(__x86_64__) +#include "my_config_x86_64.h" +#elif defined(__i386__) +#include "my_config_i386.h" +#elif defined(__ppc64__) || defined(__powerpc64__) +#include "my_config_ppc64.h" +#elif defined(__ppc__) || defined(__powerpc__) +#include "my_config_ppc.h" +#elif defined(__s390x__) +#include "my_config_s390x.h" +#elif defined(__s390__) +#include "my_config_s390.h" +#elif defined(__sparc__) && defined(__arch64__) +#include "my_config_sparc64.h" +#elif defined(__sparc__) +#include "my_config_sparc.h" +#endif diff --git a/SPECIFIC-ULN/mysql-5.5-errno.patch b/SPECIFIC-ULN/mysql-5.5-errno.patch new file mode 100644 index 00000000000..033e5195973 --- /dev/null +++ b/SPECIFIC-ULN/mysql-5.5-errno.patch @@ -0,0 +1,21 @@ +"extern int errno" is just a really bad idea. + + +diff -Naur mysql-5.1.32.orig/include/my_sys.h mysql-5.1.32/include/my_sys.h +--- mysql-5.1.32.orig/include/my_sys.h 2009-02-13 19:52:19.000000000 -0500 ++++ mysql-5.1.32/include/my_sys.h 2009-03-04 18:08:40.000000000 -0500 +@@ -199,13 +199,8 @@ + #define my_afree(PTR) my_free(PTR) + #endif /* HAVE_ALLOCA */ + +-#ifndef errno /* did we already get it? */ +-#ifdef HAVE_ERRNO_AS_DEFINE + #include /* errno is a define */ +-#else +-extern int errno; /* declare errno */ +-#endif +-#endif /* #ifndef errno */ ++ + extern char *home_dir; /* Home directory for user */ + extern const char *my_progname; /* program-name (printed in errors) */ + extern char curr_dir[]; /* Current directory for user */ diff --git a/SPECIFIC-ULN/mysql-5.5-fix-tests.patch b/SPECIFIC-ULN/mysql-5.5-fix-tests.patch new file mode 100644 index 00000000000..a1ab7a82210 --- /dev/null +++ b/SPECIFIC-ULN/mysql-5.5-fix-tests.patch @@ -0,0 +1,34 @@ +Adapt tests (where needed) to RedHat conventions. + +1) The RedHat convention uses the package name "mysql*" whereas upstream uses "MySQL*". + Test "file_contents" constructs path names and needs to be adapted. + +=== modified file 'mysql-test/t/file_contents.test' +--- mysql-5.5.17-orig/mysql-test/t/file_contents.test 2011-10-10 12:03:29 +0000 ++++ mysql-5.5.17/mysql-test/t/file_contents.test 2011-11-16 18:07:55 +0000 +@@ -17,20 +17,20 @@ if ($dir_bin =~ m|/usr/|) { + $dir_docs =~ s|/lib|/share/doc|; + if(-d "$dir_docs/packages") { + # SuSE: "packages/" in the documentation path +- $dir_docs = glob "$dir_docs/packages/MySQL-server*"; ++ $dir_docs = glob "$dir_docs/packages/mysql-server*"; + } else { + # RedHat: version number in directory name +- $dir_docs = glob "$dir_docs/MySQL-server*"; ++ $dir_docs = glob "$dir_docs/mysql-server*"; + } + } elsif ($dir_bin =~ m|/usr$|) { + # RPM build during development + $dir_docs = "$dir_bin/share/doc"; + if(-d "$dir_docs/packages") { + # SuSE: "packages/" in the documentation path +- $dir_docs = glob "$dir_docs/packages/MySQL-server*"; ++ $dir_docs = glob "$dir_docs/packages/mysql-server*"; + } else { + # RedHat: version number in directory name +- $dir_docs = glob "$dir_docs/MySQL-server*"; ++ $dir_docs = glob "$dir_docs/mysql-server*"; + } + } else { + # tar.gz package, Windows, or developer work (in BZR) + diff --git a/SPECIFIC-ULN/mysql-5.5-libdir.patch b/SPECIFIC-ULN/mysql-5.5-libdir.patch new file mode 100644 index 00000000000..60ffbed0dab --- /dev/null +++ b/SPECIFIC-ULN/mysql-5.5-libdir.patch @@ -0,0 +1,28 @@ +The RPMs built by MySQL AB (-> Sun -> Oracle) put the libraries into "/usr/lib". +Those built by RedHat put them into "/usr/lib/mysql". +This patch is to modify the cmake files to follow the RedHat convention. +Similar, the server is now in "/usr/libexec" (formerly "/usr/sbin"). + + +diff -Naur mysql-5.5.17.orig/cmake/install_layout.cmake mysql-5.5.17/cmake/install_layout.cmake +--- mysql-5.5.17.orig/cmake/install_layout.cmake 2011-06-30 15:46:53 +0000 ++++ mysql-5.5.17/cmake/install_layout.cmake 2011-10-27 16:40:10 +0000 +@@ -135,14 +135,14 @@ SET(INSTALL_SBINDIR_RPM + # RPM layout + # + SET(INSTALL_BINDIR_RPM "bin") +-SET(INSTALL_SBINDIR_RPM "sbin") ++SET(INSTALL_SBINDIR_RPM "libexec") + SET(INSTALL_SCRIPTDIR_RPM "bin") + # + IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") +- SET(INSTALL_LIBDIR_RPM "lib64") ++ SET(INSTALL_LIBDIR_RPM "lib64/mysql") + SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin") + ELSE() +- SET(INSTALL_LIBDIR_RPM "lib") ++ SET(INSTALL_LIBDIR_RPM "lib/mysql") + SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin") + ENDIF() + # + diff --git a/SPECIFIC-ULN/mysql-5.5-mtr1.patch b/SPECIFIC-ULN/mysql-5.5-mtr1.patch new file mode 100644 index 00000000000..7a7dc85f16c --- /dev/null +++ b/SPECIFIC-ULN/mysql-5.5-mtr1.patch @@ -0,0 +1,25 @@ +Drop support for version 1 of "mysql-test-run.pl" from the RPMs: + +1) The auto-generation of Perl dependencies will mishandle that code, + probably because its run directory differs from its storage location. +2) It does not provide several variables which are used in tests of MySQL 5.5 + +If you really need it, take it from the source tarball. + +=== modified file 'mysql-test/mysql-test-run.pl' +--- mysql-5.5.17-orig/mysql-test/mysql-test-run.pl 2011-10-03 11:16:40 +0000 ++++ mysql-5.5.17/mysql-test/mysql-test-run.pl 2011-11-16 19:06:38 +0000 +@@ -58,10 +58,9 @@ BEGIN { + if ( $version == 1 ) + { + print "=======================================================\n"; +- print " WARNING: Using mysql-test-run.pl version 1! \n"; ++ print " ERROR: Support for version 1 is dropped in this distribution! \n"; + print "=======================================================\n"; +- # Should use exec() here on *nix but this appears not to work on Windows +- exit(system($^X, "lib/v1/mysql-test-run.pl", @ARGV) >> 8); ++ exit(1); + } + elsif ( $version == 2 ) + { + diff --git a/SPECIFIC-ULN/mysql-5.5-stack-guard.patch b/SPECIFIC-ULN/mysql-5.5-stack-guard.patch new file mode 100644 index 00000000000..b2624d982de --- /dev/null +++ b/SPECIFIC-ULN/mysql-5.5-stack-guard.patch @@ -0,0 +1,140 @@ +mysql is not accounting for the "guard page" when setting thread stack size +requests. This is fatal on PPC systems, which may use guard pages as large +as 64K. This patch also documents the IA64 situation a bit better. + +Note: there are quite a few other setstacksize calls besides the two in +mysqld.cc; is it important to fix any of the others? + +Filed upstream at http://bugs.mysql.com/bug.php?id=35019 + + +diff -Naur mysql-5.1.30.orig/sql/mysqld.cc mysql-5.1.30/sql/mysqld.cc +--- mysql-5.1.30.orig/sql/mysqld.cc 2008-11-14 11:37:13.000000000 -0500 ++++ mysql-5.1.30/sql/mysqld.cc 2009-01-13 12:08:35.000000000 -0500 +@@ -2653,6 +2653,70 @@ + } + + ++/* pthread_attr_setstacksize without so much platform-dependency */ ++/* returns the actual stack size if possible */ ++static size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize) ++{ ++ size_t guard_size = 0; ++ ++#if defined(__ia64__) || defined(__ia64) ++ /* ++ On IA64, half of the requested stack size is used for "normal stack" ++ and half for "register stack". The space measured by check_stack_overrun ++ is the "normal stack", so double the request to make sure we have the ++ caller-expected amount of normal stack. ++ ++ NOTE: there is no guarantee that the register stack can't grow faster ++ than normal stack, so it's very unclear that we won't dump core due to ++ stack overrun despite check_stack_overrun's efforts. Experimentation ++ shows that in the execution_constants test, the register stack grows ++ less than half as fast as normal stack, but perhaps other scenarios are ++ less forgiving. If it turns out that more space is needed for the ++ register stack, that could be forced (rather inefficiently) by using a ++ multiplier higher than 2 here. ++ */ ++ stacksize *= 2; ++#endif ++ ++ /* ++ On many machines, the "guard space" is subtracted from the requested ++ stack size, and that space is quite large on some platforms. So add ++ it to our request, if we can find out what it is. ++ ++ FIXME: autoconfiscate use of pthread_attr_getguardsize ++ */ ++ if (pthread_attr_getguardsize(attr, &guard_size)) ++ guard_size = 0; /* if can't find it out, treat as 0 */ ++ ++ pthread_attr_setstacksize(attr, stacksize + guard_size); ++ ++ /* Retrieve actual stack size if possible */ ++#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE ++ { ++ size_t real_stack_size= 0; ++ /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */ ++ if (pthread_attr_getstacksize(attr, &real_stack_size) == 0 && ++ real_stack_size > guard_size) ++ { ++ real_stack_size -= guard_size; ++ if (real_stack_size < stacksize) ++ { ++ if (global_system_variables.log_warnings) ++ sql_print_warning("Asked for %ld thread stack, but got %ld", ++ (long) stacksize, (long) real_stack_size); ++ stacksize= real_stack_size; ++ } ++ } ++ } ++#endif ++ ++#if defined(__ia64__) || defined(__ia64) ++ stacksize /= 2; ++#endif ++ return stacksize; ++} ++ ++ + static void start_signal_handler(void) + { + int error; +@@ -2663,15 +2727,7 @@ + #if !defined(HAVE_DEC_3_2_THREADS) + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM); + (void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); +-#if defined(__ia64__) || defined(__ia64) +- /* +- Peculiar things with ia64 platforms - it seems we only have half the +- stack size in reality, so we have to double it here +- */ +- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2); +-#else +- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size); +-#endif ++ (void) my_setstacksize(&thr_attr,my_thread_stack_size); + #endif + + mysql_mutex_lock(&LOCK_thread_count); +@@ -4445,37 +4501,7 @@ + unireg_abort(1); // Will do exit + + init_signals(); +-#if defined(__ia64__) || defined(__ia64) +- /* +- Peculiar things with ia64 platforms - it seems we only have half the +- stack size in reality, so we have to double it here +- */ +- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size*2); +-#else +- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size); +-#endif +-#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE +- { +- /* Retrieve used stack size; Needed for checking stack overflows */ +- size_t stack_size= 0; +- pthread_attr_getstacksize(&connection_attrib, &stack_size); +-#if defined(__ia64__) || defined(__ia64) +- stack_size/= 2; +-#endif +- /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ +- if (stack_size && stack_size < my_thread_stack_size) +- { +- if (global_system_variables.log_warnings) +- sql_print_warning("Asked for %lu thread stack, but got %ld", +- my_thread_stack_size, (long) stack_size); +-#if defined(__ia64__) || defined(__ia64) +- my_thread_stack_size= stack_size*2; +-#else +- my_thread_stack_size= stack_size; +-#endif +- } +- } +-#endif ++ my_thread_stack_size = my_setstacksize(&connection_attrib,my_thread_stack_size); + + (void) thr_setconcurrency(concurrency); // 10 by default + diff --git a/SPECIFIC-ULN/mysql-5.5-testing.patch b/SPECIFIC-ULN/mysql-5.5-testing.patch new file mode 100644 index 00000000000..74387135346 --- /dev/null +++ b/SPECIFIC-ULN/mysql-5.5-testing.patch @@ -0,0 +1,23 @@ +Hack the top-level Makefile to enable the openssl regression tests. +(Why doesn't this happen automatically given the configure option??) + +Also, increase the overall timeout for the regression tests to 12 hours, +because on a slow or heavily-loaded build machine sometimes the default of +5 hours isn't enough. (This has been demonstrated to fail in mass-rebuild +scenarios, which aren't that uncommon for Fedora.) Similarly increase the +per-testcase timeout to 30 minutes, since the default of 15 hasn't got a +great deal of headroom either. + + +diff -Naur mysql-5.1.32.orig/Makefile.am mysql-5.1.32/Makefile.am +--- mysql-5.1.32.orig/Makefile.am 2009-02-13 19:51:56.000000000 -0500 ++++ mysql-5.1.32/Makefile.am 2009-03-04 18:12:36.000000000 -0500 +@@ -98,7 +98,7 @@ + + test-ns: + cd mysql-test ; \ +- @PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed ++ @PERL@ ./mysql-test-run.pl $(force) $(mem) --ssl --mysqld=--binlog-format=mixed --suite-timeout=720 --testcase-timeout=30 + + test-binlog-statement: + cd mysql-test ; \ diff --git a/SPECIFIC-ULN/mysql-chain-certs.patch b/SPECIFIC-ULN/mysql-chain-certs.patch new file mode 100644 index 00000000000..3b20a28031d --- /dev/null +++ b/SPECIFIC-ULN/mysql-chain-certs.patch @@ -0,0 +1,41 @@ +Fix things so that chains of certificates work in the server and client +certificate files. + +This only really works for OpenSSL-based builds, as yassl is unable to read +multiple certificates from a file. The patch below to yassl/src/ssl.cpp +doesn't fix that, but just arranges that the viosslfactories.c patch won't +have any ill effects in a yassl build. Since we don't use yassl in Red Hat/ +Fedora builds, I'm not feeling motivated to try to fix yassl for this. + +See RH bug #598656. Filed upstream at http://bugs.mysql.com/bug.php?id=54158 + + +diff -Naur mysql-5.1.47.orig/vio/viosslfactories.c mysql-5.1.47/vio/viosslfactories.c +--- mysql-5.1.47.orig/vio/viosslfactories.c 2010-05-06 11:28:07.000000000 -0400 ++++ mysql-5.1.47/vio/viosslfactories.c 2010-05-26 23:23:46.000000000 -0400 +@@ -100,7 +100,7 @@ + (long) ctx, cert_file, key_file)); + if (cert_file) + { +- if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) ++ if (SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) + { + *error= SSL_INITERR_CERT; + DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file)); +diff -Naur mysql-5.1.47.orig/extra/yassl/src/ssl.cpp mysql-5.1.47/extra/yassl/src/ssl.cpp +--- mysql-5.1.47.orig/extra/yassl/src/ssl.cpp 2010-05-06 11:24:26.000000000 -0400 ++++ mysql-5.1.47/extra/yassl/src/ssl.cpp 2010-05-26 23:29:13.000000000 -0400 +@@ -1606,10 +1606,10 @@ + } + + +- int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*) ++ int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file) + { +- // TDOD: +- return SSL_SUCCESS; ++ // For the moment, treat like use_certificate_file ++ return read_file(ctx, file, SSL_FILETYPE_PEM, Cert); + } + + diff --git a/SPECIFIC-ULN/mysql-embedded-check.c b/SPECIFIC-ULN/mysql-embedded-check.c new file mode 100644 index 00000000000..8bf8ca53dad --- /dev/null +++ b/SPECIFIC-ULN/mysql-embedded-check.c @@ -0,0 +1,26 @@ +/* simple test program to see if we can link the embedded server library */ + +#include +#include +#include + +#include "mysql.h" + +MYSQL *mysql; + +static char *server_options[] = \ + { "mysql_test", "--defaults-file=my.cnf", NULL }; +int num_elements = (sizeof(server_options) / sizeof(char *)) - 1; + +static char *server_groups[] = { "libmysqld_server", + "libmysqld_client", NULL }; + +int main(int argc, char **argv) +{ + mysql_library_init(num_elements, server_options, server_groups); + mysql = mysql_init(NULL); + mysql_close(mysql); + mysql_library_end(); + + return 0; +} diff --git a/SPECIFIC-ULN/mysql-expired-certs.patch b/SPECIFIC-ULN/mysql-expired-certs.patch new file mode 100644 index 00000000000..acd3a78cce7 --- /dev/null +++ b/SPECIFIC-ULN/mysql-expired-certs.patch @@ -0,0 +1,555 @@ +Upstream insists on generating SSL testing certificates with relatively short +lifespan, which has repeatedly caused problems (ie, one day the regression +tests suddenly stop working). Replace them with certificates with 20-year +lifespan. We should periodically regenerate these, too, but at least not +very often. + + +diff -Naur mysql-5.1.50.orig/mysql-test/std_data/cacert.pem mysql-5.1.50/mysql-test/std_data/cacert.pem +--- mysql-5.1.50.orig/mysql-test/std_data/cacert.pem 2010-08-03 13:55:04.000000000 -0400 ++++ mysql-5.1.50/mysql-test/std_data/cacert.pem 2010-08-27 23:42:05.751428144 -0400 +@@ -1,17 +1,22 @@ + -----BEGIN CERTIFICATE----- +-MIICrTCCAhagAwIBAgIJAMI7xZKjhrDbMA0GCSqGSIb3DQEBBAUAMEQxCzAJBgNV ++MIIDsjCCApqgAwIBAgIJAL5YrUwfPSWVMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV + BAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxhMREwDwYD +-VQQKEwhNeVNRTCBBQjAeFw0xMDAxMjkxMTQ3MTBaFw0xNTAxMjgxMTQ3MTBaMEQx ++VQQKEwhNeVNRTCBBQjAeFw0xMDAxMjkwNTU5NTNaFw0xNTAxMjgwNTU5NTNaMEQx + CzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxh +-MREwDwYDVQQKEwhNeVNRTCBBQjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +-wQYsOEfrN4ESP3FjsI8cghE+tZVuyK2gck61lwieVxjgFMtBd65mI5a1y9pmlOI1 +-yM4SB2Ppqcuw7/e1CdV1y7lvHrGNt5yqEHbN4QX1gvsN8TQauP/2WILturk4R4Hq +-rKg0ZySu7f1Xhl0ed9a48LpaEHD17IcxWEGMMJwAxF0CAwEAAaOBpjCBozAMBgNV +-HRMEBTADAQH/MB0GA1UdDgQWBBSvktYQ0ahLnyxyVKqty+WpBbBrDTB0BgNVHSME +-bTBrgBSvktYQ0ahLnyxyVKqty+WpBbBrDaFIpEYwRDELMAkGA1UEBhMCU0UxEDAO +-BgNVBAgTB1VwcHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FM +-IEFCggkAwjvFkqOGsNswDQYJKoZIhvcNAQEEBQADgYEAdKN1PjwMHAKG2Ww1145g +-JQGBnKxSFOUaoSvkBi/4ntTM+ysnViWh7WvxyWjR9zU9arfr7aqsDeQxm0XDOqzj +-AQ/cQIla2/Li8tXyfc06bisH/IHRaSc2zWqioTKbEwMdVOdrvq4a8V8ic3xYyIWn +-7F4WeS07J8LKardSvM0+hOA= ++MREwDwYDVQQKEwhNeVNRTCBBQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC ++ggEBAL6kNN4peX7uhK9rb06W/QbPEpVuejmdWdl2PqMshP/eSuXXw7kwVgfpxx9R ++vC000CKQQSG9MCoZjtqPnFRsetmWLZgApRpEalGXTXJqq9sEbCfoFizg94U8G7d2 ++u5XJjLVmcG34ru36KoBgVx1zeH1puBAf8dOzrE4L7Y+ZQBFzFohjh8C2LqWC4nM5 ++qsLmOkDWMipGqYU5DvkKjIbTbwTyRNRgZHWSPfVDDPUIUOsY4BGUp2DpgeGY9aEv ++lIs57Ev9JqlIUCV65lOhhDkG+xwmkHKHA+ECEU9cALI8+uXbh48MB9XpMOuk408X ++/lX89aZwD0/G9kmObVGnE2G+H5UCAwEAAaOBpjCBozAdBgNVHQ4EFgQUsft+d7VA ++jWgRftkR5cPG2k2sUbAwdAYDVR0jBG0wa4AUsft+d7VAjWgRftkR5cPG2k2sUbCh ++SKRGMEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdV ++cHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAL5YrUwfPSWVMAwGA1UdEwQFMAMB ++Af8wDQYJKoZIhvcNAQEFBQADggEBALRUOAmdL8R8sl1y8kiEiFgDatdXK5RDqWai ++8yZChfmwTIToHhmQsOEshJe2e8hky3huUj+33VyXjINoMbebIwMuXPwEkbJal8RZ ++nSJmF0jN1Qz7J/jFffwK9xmejWZJx49Kt2+Qwrwp6kDeq9TLFqQOoVczgyJPYsTL ++NAOib5WqTud3XWvCwxrhqmWu7JZq6sp1fomP/uunprb8y2miWfLESZN2mKAhm44Q ++Lws867LT8v2lskEjq2dT1LutD5+R66XcdjgSr0uDziDs64jZwCD6ea94hVFM7ej0 ++ZOXYeSEZJ56FjUxu632e9fY8NyMh30yKjjmQf1mM9PuGJvdvsWU= + -----END CERTIFICATE----- +diff -Naur mysql-5.1.50.orig/mysql-test/std_data/client-cert.pem mysql-5.1.50/mysql-test/std_data/client-cert.pem +--- mysql-5.1.50.orig/mysql-test/std_data/client-cert.pem 2010-08-03 13:55:04.000000000 -0400 ++++ mysql-5.1.50/mysql-test/std_data/client-cert.pem 2010-08-27 23:42:05.752428395 -0400 +@@ -1,46 +1,69 @@ + Certificate: + Data: +- Version: 1 (0x0) +- Serial Number: 1048577 (0x100001) +- Signature Algorithm: md5WithRSAEncryption ++ Version: 3 (0x2) ++ Serial Number: 6 (0x6) ++ Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB + Validity +- Not Before: Jan 29 11:50:22 2010 GMT +- Not After : Jan 28 11:50:22 2015 GMT ++ Not Before: Feb 20 03:03:26 2010 GMT ++ Not After : Sep 3 03:03:26 2030 GMT + Subject: C=SE, ST=Uppsala, O=MySQL AB + Subject Public Key Info: + Public Key Algorithm: rsaEncryption +- Public-Key: (1024 bit) +- Modulus: +- 00:cc:9a:37:49:13:66:dc:cf:e3:0b:13:a1:23:ed: +- 78:db:4e:bd:11:f6:8c:0d:76:f9:a3:32:56:9a:f8: +- a1:21:6a:55:4e:4d:3f:e6:67:9d:26:99:b2:cd:a4: +- 9a:d2:2b:59:5c:d7:8a:d3:60:68:f8:18:bd:c5:be: +- 15:e1:2a:3c:a3:d4:61:cb:f5:11:94:17:81:81:f7: +- 87:8c:f6:6a:d2:ee:d8:e6:77:f6:62:66:4d:2e:16: +- 8d:08:81:4a:c9:c6:4b:31:e5:b9:c7:8a:84:96:48: +- a7:47:8c:0d:26:90:56:4e:e6:a5:6e:8c:b3:f2:9f: +- fc:3d:78:9b:49:6e:86:83:77 ++ RSA Public Key: (1024 bit) ++ Modulus (1024 bit): ++ 00:c2:e7:20:cf:89:59:2f:67:cb:4c:9f:e8:11:f2: ++ 23:e5:f1:b1:ee:3f:66:5f:c3:f5:fd:1e:31:ee:8f: ++ 4c:2a:bd:c0:4a:a5:9f:c8:44:d5:77:8f:15:1b:4d: ++ 78:6e:b2:a2:48:a5:24:33:05:40:02:b3:c1:87:8d: ++ 59:3c:1a:07:aa:86:f0:04:e1:9c:20:4b:22:32:c4: ++ 51:9e:40:e4:31:c3:57:f5:98:bf:2e:b1:fd:2c:56: ++ bf:49:d9:9b:e7:17:cc:95:5f:b5:08:19:5e:9d:df: ++ 65:22:39:2c:48:fb:69:96:31:7a:35:4d:de:60:b4: ++ c1:60:19:5f:96:56:7e:55:19 + Exponent: 65537 (0x10001) +- Signature Algorithm: md5WithRSAEncryption +- 5e:1f:a3:53:5f:24:13:1c:f8:28:32:b0:7f:69:69:f3:0e:c0: +- 34:87:10:03:7d:da:15:8b:bd:19:b8:1a:56:31:e7:85:49:81: +- c9:7f:45:20:74:3e:89:c0:e0:26:84:51:cc:04:16:ce:69:99: +- 01:e1:26:99:b3:e3:f5:bd:ec:5f:a0:84:e4:38:da:75:78:7b: +- 89:9c:d2:cd:60:95:20:ba:8e:e3:7c:e6:df:76:3a:7c:89:77: +- 02:94:86:11:3a:c4:61:7d:6f:71:83:21:8a:17:fb:17:e2:ee: +- 02:6b:61:c1:b4:52:63:d7:d8:46:b2:c5:9c:6f:38:91:8a:35: +- 32:0b ++ X509v3 extensions: ++ X509v3 Basic Constraints: ++ CA:FALSE ++ X509v3 Subject Key Identifier: ++ 8D:10:67:91:33:76:9C:02:E5:78:5D:D8:C5:EF:25:96:B2:D7:FA:1F ++ X509v3 Authority Key Identifier: ++ keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0 ++ DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB ++ serial:BE:58:AD:4C:1F:3D:25:95 ++ ++ Signature Algorithm: sha1WithRSAEncryption ++ a9:88:10:3e:5d:2a:47:29:c8:03:27:7a:31:5a:8e:10:03:bc: ++ b5:4e:37:1d:12:7b:eb:5f:50:71:70:b1:a3:8e:93:0e:77:17: ++ 6c:47:b6:c9:a4:4d:2a:c4:38:f0:61:55:b2:7f:28:ba:06:79: ++ ee:67:11:7d:d4:c9:7f:0a:18:c8:c1:cb:d0:2c:f9:63:0f:bb: ++ 45:ca:de:ea:bb:ac:00:01:52:48:36:2b:07:2b:c8:46:c7:b1: ++ 21:81:bd:77:39:e7:4c:39:aa:bd:ac:60:d8:a7:bf:cf:14:98: ++ 4a:0b:a1:40:55:06:8d:6f:35:a9:39:a0:71:a9:97:ba:7c:73: ++ 3c:41:ba:c5:1c:11:4b:2b:43:1d:2d:ba:7b:5f:14:b5:3d:64: ++ 62:15:36:b4:16:bd:78:c8:43:8d:f9:1c:a5:d2:ac:a1:58:74: ++ e1:99:de:ad:04:19:43:a8:bd:0a:fd:19:9b:50:44:46:6d:18: ++ 55:4d:bf:b4:5b:a4:93:62:c7:64:91:6c:54:34:d1:f8:f3:ff: ++ 12:6d:5f:85:e7:35:9e:5c:42:81:5e:fb:c8:bb:44:51:98:b2: ++ ef:1b:9f:5a:22:77:28:7d:da:fb:08:c2:94:9a:0f:42:08:93: ++ 54:10:1e:ad:f2:4f:fc:62:98:51:e9:9b:b9:3a:93:d9:e4:1f: ++ 1d:c4:76:d0 + -----BEGIN CERTIFICATE----- +-MIIB5zCCAVACAxAAATANBgkqhkiG9w0BAQQFADBEMQswCQYDVQQGEwJTRTEQMA4G +-A1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwg +-QUIwHhcNMTAwMTI5MTE1MDIyWhcNMTUwMTI4MTE1MDIyWjAyMQswCQYDVQQGEwJT +-RTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIwgZ8wDQYJKoZI +-hvcNAQEBBQADgY0AMIGJAoGBAMyaN0kTZtzP4wsToSPteNtOvRH2jA12+aMyVpr4 +-oSFqVU5NP+ZnnSaZss2kmtIrWVzXitNgaPgYvcW+FeEqPKPUYcv1EZQXgYH3h4z2 +-atLu2OZ39mJmTS4WjQiBSsnGSzHluceKhJZIp0eMDSaQVk7mpW6Ms/Kf/D14m0lu +-hoN3AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAXh+jU18kExz4KDKwf2lp8w7ANIcQ +-A33aFYu9GbgaVjHnhUmByX9FIHQ+icDgJoRRzAQWzmmZAeEmmbPj9b3sX6CE5Dja +-dXh7iZzSzWCVILqO43zm33Y6fIl3ApSGETrEYX1vcYMhihf7F+LuAmthwbRSY9fY +-RrLFnG84kYo1Mgs= ++MIIDETCCAfmgAwIBAgIBBjANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ ++MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT ++UUwgQUIwHhcNMTAwMjIwMDMwMzI2WhcNMzAwOTAzMDMwMzI2WjAyMQswCQYDVQQG ++EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIwgZ8wDQYJ ++KoZIhvcNAQEBBQADgY0AMIGJAoGBAMLnIM+JWS9ny0yf6BHyI+Xxse4/Zl/D9f0e ++Me6PTCq9wEqln8hE1XePFRtNeG6yokilJDMFQAKzwYeNWTwaB6qG8AThnCBLIjLE ++UZ5A5DHDV/WYvy6x/SxWv0nZm+cXzJVftQgZXp3fZSI5LEj7aZYxejVN3mC0wWAZ ++X5ZWflUZAgMBAAGjgaMwgaAwCQYDVR0TBAIwADAdBgNVHQ4EFgQUjRBnkTN2nALl ++eF3Yxe8llrLX+h8wdAYDVR0jBG0wa4AUsft+d7VAjWgRftkR5cPG2k2sUbChSKRG ++MEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBz ++YWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAL5YrUwfPSWVMA0GCSqGSIb3DQEBBQUA ++A4IBAQCpiBA+XSpHKcgDJ3oxWo4QA7y1TjcdEnvrX1BxcLGjjpMOdxdsR7bJpE0q ++xDjwYVWyfyi6BnnuZxF91Ml/ChjIwcvQLPljD7tFyt7qu6wAAVJINisHK8hGx7Eh ++gb13OedMOaq9rGDYp7/PFJhKC6FAVQaNbzWpOaBxqZe6fHM8QbrFHBFLK0MdLbp7 ++XxS1PWRiFTa0Fr14yEON+Ryl0qyhWHThmd6tBBlDqL0K/RmbUERGbRhVTb+0W6ST ++YsdkkWxUNNH48/8SbV+F5zWeXEKBXvvIu0RRmLLvG59aIncofdr7CMKUmg9CCJNU ++EB6t8k/8YphR6Zu5OpPZ5B8dxHbQ + -----END CERTIFICATE----- +diff -Naur mysql-5.1.50.orig/mysql-test/std_data/client-key.pem mysql-5.1.50/mysql-test/std_data/client-key.pem +--- mysql-5.1.50.orig/mysql-test/std_data/client-key.pem 2010-08-03 13:55:05.000000000 -0400 ++++ mysql-5.1.50/mysql-test/std_data/client-key.pem 2010-08-27 23:42:05.752428395 -0400 +@@ -1,15 +1,15 @@ + -----BEGIN RSA PRIVATE KEY----- +-MIICXQIBAAKBgQDMmjdJE2bcz+MLE6Ej7XjbTr0R9owNdvmjMlaa+KEhalVOTT/m +-Z50mmbLNpJrSK1lc14rTYGj4GL3FvhXhKjyj1GHL9RGUF4GB94eM9mrS7tjmd/Zi +-Zk0uFo0IgUrJxksx5bnHioSWSKdHjA0mkFZO5qVujLPyn/w9eJtJboaDdwIDAQAB +-AoGASqk/4We2En+93y3jkIO4pXafIe3w/3zZ7caRue1ehx4RUQh5d+95djuB9u7J +-HEZ7TpjM7QNyao5EueL6gvbxt0LXFvqAMni7yM9tt/HUYtHHPqYiRtUny9bKYFTm +-l8szCCMal/wD9GZU9ByHDNHm7tHUMyMhARNTYSgx+SERFmECQQD/6jJocC4SXf6f +-T3LqimWR02lbJ7qCoDgRglsUXh0zjrG+IIiAyE+QOCCx1GMe3Uw6bsIuYwdHT6as +-WcdPs04xAkEAzKulvEvLVvN5zfa/DTYRTV7jh6aDleOxjsD5oN/oJXoACnPzVuUL +-qQQMNtuAXm6Q1QItrRxpQsSKbY0UQka6JwJBAOSgoNoG5lIIYTKIMvzwGV+XBLeo +-HYsXgh+6Wo4uql3mLErUG78ZtWL9kc/tE4R+ZdyKGLaCR/1gXmH5bwN4B/ECQEBb +-uUH8k3REG4kojesZlVc+/00ojzgS4UKCa/yqa9VdB6ZBz8MDQydinnShkTwgiGpy +-xOoqhO753o2UT0qH8wECQQC99IEJWUnwvExVMkLaZH5NjAFJkb22sjkmuT11tAgU +-RQgOMoDOm6driojnOnDWOkx1r1Gy9NgMLooduja4v6cx ++MIICWwIBAAKBgQDC5yDPiVkvZ8tMn+gR8iPl8bHuP2Zfw/X9HjHuj0wqvcBKpZ/I ++RNV3jxUbTXhusqJIpSQzBUACs8GHjVk8GgeqhvAE4ZwgSyIyxFGeQOQxw1f1mL8u ++sf0sVr9J2ZvnF8yVX7UIGV6d32UiOSxI+2mWMXo1Td5gtMFgGV+WVn5VGQIDAQAB ++AoGARXcXLKDpVooJ3W+IyQyiWsw//IhANpWjUOm4JiyQmxMyO+i4ACr4Yjpu7WI5 ++MEseqAGj20NdwxjKO0PXsCIe5LmrGZ+SI8+CSERFOWXWRtCWz7y7SG30i1k6suvM ++mwqWom0tJLwn93uA1lm/WSwKQwUrJRahRQd3EaZqrl7DP5kCQQD/8gbuYAT5pxQe ++ULLGM0RvEsXxDYbEDxNbY5wrBazfklBwpumxZpFl6jEAT++7Kh2Ns3A7kB1oUNlA ++FPYr+dYPAkEAwvHEwRtoyUr8jqoqVVJWI76CDmBjEOzVeMKW97ztqbs2LxZW8dYI ++iOh/myFGpdoUwgu0U8w9MmXcj3ZeZCYKVwJALyQ+AJPw9qa+fuLwOq9gsHCtwrty ++EhSQxSlwrz/pWniRll439vPkXfgntF4E0t1r+hiN2Hqv3/HcQgBaYzkuIwJAG023 ++bACFxaOuCeFFepvEms8E8jSHy4gQQhCnCl24v8wLw76SQN7kZSCDNtwLRBFuVNtE ++z3PMonFn2eQPRmGZkwJAP1c1BHprMQx/ruafdscROILv3JrH40C1bR6KVVBKt1dK ++Qpnpgi7hK5rUQjDF8k3bn9ugTt06jyeHe/QhAml0kg== + -----END RSA PRIVATE KEY----- +diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server-cert.pem mysql-5.1.50/mysql-test/std_data/server-cert.pem +--- mysql-5.1.50.orig/mysql-test/std_data/server-cert.pem 2010-08-03 13:55:08.000000000 -0400 ++++ mysql-5.1.50/mysql-test/std_data/server-cert.pem 2010-08-27 23:42:05.753428361 -0400 +@@ -1,41 +1,69 @@ + Certificate: + Data: +- Version: 1 (0x0) +- Serial Number: 1048578 (0x100002) +- Signature Algorithm: md5WithRSAEncryption ++ Version: 3 (0x2) ++ Serial Number: 4 (0x4) ++ Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB + Validity +- Not Before: Jan 29 11:56:49 2010 GMT +- Not After : Jan 28 11:56:49 2015 GMT ++ Not Before: Feb 20 02:55:06 2010 GMT ++ Not After : Sep 3 02:55:06 2030 GMT + Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=localhost + Subject Public Key Info: + Public Key Algorithm: rsaEncryption +- Public-Key: (512 bit) +- Modulus: +- 00:cd:e4:87:51:9d:72:11:a0:d1:fa:f3:92:8b:13: +- 1c:eb:f7:e2:9a:2f:72:a8:d6:65:48:d1:69:af:1b: +- c0:4c:13:e5:60:60:51:41:e9:ab:a6:bc:13:bb:0c: +- 5e:32:7c:d9:6c:9e:cd:05:24:84:78:db:80:91:2e: +- d8:88:2b:c2:ed ++ RSA Public Key: (1024 bit) ++ Modulus (1024 bit): ++ 00:e3:7d:4f:c2:23:77:a9:3a:2c:d2:69:59:a0:2f: ++ 4e:d1:51:4c:ae:8d:f5:17:cc:ce:58:9c:83:4f:0b: ++ a3:bb:29:a2:b8:1d:3e:1b:04:f9:a9:3e:e2:61:d0: ++ e6:7b:b9:7c:12:d8:1f:86:c9:53:b5:04:dd:df:26: ++ e9:c0:2b:de:4a:96:2e:f3:23:6f:79:6d:a9:d2:4e: ++ 17:af:2f:de:8b:68:44:ae:de:a3:e2:c4:37:1c:04: ++ ad:73:4b:85:f9:83:ac:fe:b7:c1:54:47:2e:96:d4: ++ 31:96:85:94:69:d6:5a:63:24:04:99:89:19:1d:56: ++ 8a:d1:77:aa:87:fb:38:cd:b7 + Exponent: 65537 (0x10001) +- Signature Algorithm: md5WithRSAEncryption +- 73:ce:9c:6e:39:46:b4:14:be:da:3f:f3:1b:ba:90:bc:23:43: +- d7:82:2a:70:4e:a6:d9:5a:65:5c:b7:df:71:df:75:77:c5:80: +- a4:af:fa:d2:59:e2:fd:c9:9c:f0:98:95:8e:69:a9:8c:7c:d8: +- 6f:48:d2:e3:36:e0:cd:ff:3f:d1:a5:e6:ab:75:09:c4:50:10: +- c4:96:dd:bf:3b:de:32:46:da:ca:4a:f1:d6:52:8a:33:2f:ab: +- f5:2e:70:3f:d4:9c:be:00:c8:03:f9:39:8a:df:5b:70:3c:40: +- ef:03:be:7c:3d:1d:32:32:f3:51:81:e2:83:30:6e:3d:38:9b: +- fb:3c ++ X509v3 extensions: ++ X509v3 Basic Constraints: ++ CA:FALSE ++ X509v3 Subject Key Identifier: ++ CC:8C:71:40:D0:0F:BF:D1:99:79:3F:1B:E9:10:76:19:67:36:0F:A3 ++ X509v3 Authority Key Identifier: ++ keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0 ++ DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB ++ serial:BE:58:AD:4C:1F:3D:25:95 ++ ++ Signature Algorithm: sha1WithRSAEncryption ++ 6f:ad:5e:59:fa:84:3a:be:e2:72:b1:e8:66:2a:4e:f8:73:19: ++ 11:06:11:92:78:56:3e:d6:e8:68:29:90:8b:59:d2:fe:aa:ae: ++ 25:59:c7:e9:99:bb:4a:06:43:dd:40:bd:cb:f4:ae:79:95:7d: ++ 8e:90:ef:58:d2:a8:fc:bf:07:f3:37:b2:9b:bd:da:e6:8c:56: ++ dd:5e:c6:4a:70:7c:3e:3d:a1:e8:35:06:b8:a7:7b:ac:26:85: ++ 54:5d:09:a2:7b:77:b4:17:7f:72:31:cb:ff:cc:67:6d:e6:3e: ++ c6:dc:96:eb:4a:0a:ae:e9:48:ae:8a:e0:d6:73:57:6e:32:4c: ++ 00:dc:28:da:55:b3:9f:9f:d8:98:cc:d9:f1:b6:b3:14:67:2e: ++ a1:47:1e:51:11:cf:70:9f:31:8f:ba:59:29:f2:d0:88:0b:e2: ++ 51:6b:f8:31:ed:6d:ac:00:5e:d3:78:4c:95:97:02:cc:74:2b: ++ 3b:c6:28:e6:2a:c3:30:99:35:b4:4d:31:46:d4:90:f2:47:ed: ++ 64:85:1a:75:2a:72:0a:2f:c6:3a:2f:d2:ac:6b:31:cc:e5:a8: ++ 07:c2:d6:22:f3:c6:0f:bf:67:d9:d6:b2:79:cd:48:b5:c3:e0: ++ e3:18:7f:b5:74:c9:43:19:fb:c4:93:29:ca:cc:90:2b:1b:6f: ++ 45:f6:25:f9 + -----BEGIN CERTIFICATE----- +-MIIBtzCCASACAxAAAjANBgkqhkiG9w0BAQQFADBEMQswCQYDVQQGEwJTRTEQMA4G +-A1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwg +-QUIwHhcNMTAwMTI5MTE1NjQ5WhcNMTUwMTI4MTE1NjQ5WjBGMQswCQYDVQQGEwJT +-RTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxEjAQBgNVBAMT +-CWxvY2FsaG9zdDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDN5IdRnXIRoNH685KL +-Exzr9+KaL3Ko1mVI0WmvG8BME+VgYFFB6aumvBO7DF4yfNlsns0FJIR424CRLtiI +-K8LtAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAc86cbjlGtBS+2j/zG7qQvCND14Iq +-cE6m2VplXLffcd91d8WApK/60lni/cmc8JiVjmmpjHzYb0jS4zbgzf8/0aXmq3UJ +-xFAQxJbdvzveMkbaykrx1lKKMy+r9S5wP9ScvgDIA/k5it9bcDxA7wO+fD0dMjLz +-UYHigzBuPTib+zw= ++MIIDJTCCAg2gAwIBAgIBBDANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ ++MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT ++UUwgQUIwHhcNMTAwMjIwMDI1NTA2WhcNMzAwOTAzMDI1NTA2WjBGMQswCQYDVQQG ++EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxEjAQBgNV ++BAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA431PwiN3 ++qTos0mlZoC9O0VFMro31F8zOWJyDTwujuymiuB0+GwT5qT7iYdDme7l8EtgfhslT ++tQTd3ybpwCveSpYu8yNveW2p0k4Xry/ei2hErt6j4sQ3HAStc0uF+YOs/rfBVEcu ++ltQxloWUadZaYyQEmYkZHVaK0Xeqh/s4zbcCAwEAAaOBozCBoDAJBgNVHRMEAjAA ++MB0GA1UdDgQWBBTMjHFA0A+/0Zl5PxvpEHYZZzYPozB0BgNVHSMEbTBrgBSx+353 ++tUCNaBF+2RHlw8baTaxRsKFIpEYwRDELMAkGA1UEBhMCU0UxEDAOBgNVBAgTB1Vw ++cHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCggkAvlit ++TB89JZUwDQYJKoZIhvcNAQEFBQADggEBAG+tXln6hDq+4nKx6GYqTvhzGREGEZJ4 ++Vj7W6GgpkItZ0v6qriVZx+mZu0oGQ91Avcv0rnmVfY6Q71jSqPy/B/M3spu92uaM ++Vt1exkpwfD49oeg1Brine6wmhVRdCaJ7d7QXf3Ixy//MZ23mPsbclutKCq7pSK6K ++4NZzV24yTADcKNpVs5+f2JjM2fG2sxRnLqFHHlERz3CfMY+6WSny0IgL4lFr+DHt ++bawAXtN4TJWXAsx0KzvGKOYqwzCZNbRNMUbUkPJH7WSFGnUqcgovxjov0qxrMczl ++qAfC1iLzxg+/Z9nWsnnNSLXD4OMYf7V0yUMZ+8STKcrMkCsbb0X2Jfk= + -----END CERTIFICATE----- +diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server-key.pem mysql-5.1.50/mysql-test/std_data/server-key.pem +--- mysql-5.1.50.orig/mysql-test/std_data/server-key.pem 2010-08-03 13:55:08.000000000 -0400 ++++ mysql-5.1.50/mysql-test/std_data/server-key.pem 2010-08-27 23:42:05.754428433 -0400 +@@ -1,9 +1,15 @@ + -----BEGIN RSA PRIVATE KEY----- +-MIIBOwIBAAJBAM3kh1GdchGg0frzkosTHOv34povcqjWZUjRaa8bwEwT5WBgUUHp +-q6a8E7sMXjJ82WyezQUkhHjbgJEu2Igrwu0CAwEAAQJBAJuwhFbF3NzRpBbEmnqJ +-4GPa1UJMQMLFJF+04tqj/HxJcAIVhOJhGmmtYNw1yjz/ZsPnfJCMz4eFOtdjvGtf +-peECIQDmFFg2WLvYo+2m9w9V7z4ZIkg7ixYkI/ObUUctfZkPOQIhAOUWnrvjFrAX +-bIvYT/YR50+3ZDLEc51XxNgJnWqWYl1VAiEAnTOFWgyivFC1DgF8PvDp8u5TgCt2 +-A1d1GMgd490O+TECIC/WMl0/hTxOF9930vKqOGf//o9PUGkZq8QE9fcM4gtlAiAE +-iOcFpnLjtWj57jrhuw214ucnB5rklkQQe+AtcARNkg== ++MIICXgIBAAKBgQDjfU/CI3epOizSaVmgL07RUUyujfUXzM5YnINPC6O7KaK4HT4b ++BPmpPuJh0OZ7uXwS2B+GyVO1BN3fJunAK95Kli7zI295banSThevL96LaESu3qPi ++xDccBK1zS4X5g6z+t8FURy6W1DGWhZRp1lpjJASZiRkdVorRd6qH+zjNtwIDAQAB ++AoGAUb0o91y/FjMs/72S0pes/lDz+JRRSGfyjKxQEgrgndNsADOhqRu0iTdrKDJj ++XnlbN3ooecnFJfnFrvTQcJhSmlS30j6VrBw6LXpCBK3dvjYgJ9LOne7WK+dF1+vS ++FMQtsP04C56Sxy6HJDpMyWJ6oS3Bu169ygG2AxKo+Fk+E6ECQQD38w/MzmrARz2Z ++AGeEPDUnVZPYgtmXkmks95S0/2jSoLhmgpvJimzxwpYwVG/BG8dSDVuTDu5kp05D ++3bZIp3EzAkEA6uAwJsCZPtHXlWU3wYZJsA697rUNjPaCQOIaZ/lnh5RUHTmUiw1h ++Oj/VORqKB0kXqcDfawwLjZEvh1Xli+H5bQJBANTmhw2TvEPnp/OFTl1UGUvyBmXl ++TRMB639qAu07VfVtfYi/4ya1zn/0VmOfTOoigQ5qW9Q1AOu6YNCTQl62L9MCQQDc ++YfEsW2kvNYxYJHoVfuBjbuGuOnn1e1Oqd70ZND59S6NFLMMBWlORaVWzWACNZ3rp ++kAzSj6HDeqgjD2jsQONdAkEAt7S1YHUn8F760bRn4AnAto2TVOYdArtTP/wYjd4o ++9rJREO/d8AYkYJ96APLvF0SZ4n3t1pLwQRsKKN8ZGTmzLA== + -----END RSA PRIVATE KEY----- +diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server8k-cert.pem mysql-5.1.50/mysql-test/std_data/server8k-cert.pem +--- mysql-5.1.50.orig/mysql-test/std_data/server8k-cert.pem 2010-08-03 13:55:08.000000000 -0400 ++++ mysql-5.1.50/mysql-test/std_data/server8k-cert.pem 2010-08-27 23:43:00.005366270 -0400 +@@ -1,51 +1,69 @@ ++Certificate: ++ Data: ++ Version: 3 (0x2) ++ Serial Number: 5 (0x5) ++ Signature Algorithm: sha1WithRSAEncryption ++ Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB ++ Validity ++ Not Before: Feb 20 03:00:54 2010 GMT ++ Not After : Sep 3 03:00:54 2030 GMT ++ Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=server ++ Subject Public Key Info: ++ Public Key Algorithm: rsaEncryption ++ RSA Public Key: (1024 bit) ++ Modulus (1024 bit): ++ 00:c5:da:44:95:06:77:16:21:af:a0:c4:3c:e9:f8: ++ 1d:2d:95:f9:63:90:8c:3f:86:ba:77:76:4a:52:4b: ++ 6b:af:29:f5:1c:aa:d4:3f:3e:42:9f:6d:46:ba:86: ++ 90:b1:2d:cc:db:c6:33:15:a3:f4:af:53:33:4f:a1: ++ 56:d1:aa:3b:26:10:f7:64:b5:f9:bf:1b:b1:47:8e: ++ cc:a6:d6:0d:aa:4a:77:e3:a3:63:9d:2a:dc:65:f4: ++ 7f:91:17:38:2d:d6:cd:4e:8d:53:52:97:6e:87:fc: ++ 64:60:a6:a1:00:ac:96:6c:e4:42:94:75:17:46:6f: ++ 91:b5:dd:06:47:ed:05:e3:db ++ Exponent: 65537 (0x10001) ++ X509v3 extensions: ++ X509v3 Basic Constraints: ++ CA:FALSE ++ X509v3 Subject Key Identifier: ++ 6E:60:3F:29:13:60:99:ED:0C:F7:15:B5:DB:7B:1C:FB:6F:60:19:ED ++ X509v3 Authority Key Identifier: ++ keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0 ++ DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB ++ serial:BE:58:AD:4C:1F:3D:25:95 ++ ++ Signature Algorithm: sha1WithRSAEncryption ++ 63:2e:0f:07:14:06:cf:74:90:3d:37:42:f2:48:70:60:21:bc: ++ 34:52:31:f1:87:70:d2:b2:fb:ff:13:38:dc:f0:5e:43:d7:ee: ++ a7:c7:1f:ac:aa:d2:8c:4f:fa:3c:4c:73:f6:b6:c2:0c:a0:ea: ++ a2:c9:e2:73:61:c3:2e:78:40:0f:2a:d3:63:50:9b:b8:f9:89: ++ 40:ed:98:08:97:c3:07:24:17:34:b5:78:89:0a:bb:83:4c:e2: ++ 5c:2e:13:d6:21:30:ad:30:48:b5:70:12:ff:4a:6f:42:f0:f8: ++ 9f:b1:4b:bd:89:2b:f0:9d:e2:49:2b:35:69:18:1f:76:40:b4: ++ 76:bd:cb:dd:27:2f:c0:c1:e2:33:3e:6e:df:68:54:19:92:8a: ++ bb:13:9c:cf:d6:17:56:da:bf:0d:64:70:3a:45:b7:aa:5f:e3: ++ f5:96:ae:34:f2:17:37:27:d0:4b:e8:30:4a:c0:02:42:e2:d2: ++ 30:eb:eb:c7:d7:ec:d8:df:5c:43:58:e2:6f:b7:58:54:0d:c4: ++ 01:71:2d:59:8f:44:c7:a1:6c:0b:41:28:fa:b7:63:a7:68:d3: ++ 4f:c3:0f:17:9e:b2:32:50:e6:0b:87:3d:e2:39:47:c0:d8:0a: ++ 3b:f6:af:50:68:0f:9d:ef:6e:34:0d:3a:07:94:f8:a4:d7:24: ++ 86:32:d3:b4 + -----BEGIN CERTIFICATE----- +-MIIJFDCCBPwCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV +-BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw +-CQYDVQQDEwJDQTAeFw0xMDA3MjgxNDA3MjhaFw0xODEwMTQxNDA3MjhaMFIxCzAJ +-BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQjEN +-MAsGA1UECxMEVGVzdDEPMA0GA1UEAxMGc2VydmVyMIIEIjANBgkqhkiG9w0BAQEF +-AAOCBA8AMIIECgKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSEC +-PgxNNcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+Lr +-hXIqCz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2 +-DA7kvMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5 +-hACbfU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09 +-Gh/GwmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33 +-aGsZ5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4 +-PRd31qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2 +-OaIwFjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83 +-psQ6R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCc +-HSFu07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs +-+LFdt4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS +-9+LB+LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1P +-sZi4UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUd +-NhXxi/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfV +-JTt8Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwx +-UADgR0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1 +-kOE7GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQ +-uw4qVKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRY +-nTIywUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PT +-trohFSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFT +-d33ZDke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABMA0GCSqGSIb3DQEB +-BAUAA4IEAQCc9RBhRbuWlmRZPZkqIdi5/+enyjoMmOa6ryJPxFSP8D2jrlHgQsk1 +-+GsJmPFT3rwWfoGAQu/aeSX4sp8OhKVJtqNA6MJrGYnZIMolgYa1wZPbkjJsdEfi +-UsZdIB0n2+KA0xwEdGPdkGCfNPBtOg557DkcyEvsIZ9ELp4Pp2XzWRhyFGasJZc4 +-YwgD/3K2rpOPZoMkBKeKqV19j41OfLKGBVyuaqzitbu9+KT4RU1ibr2a+UuFCwdT +-oqyN7bfWXjcjXOMkxCsOmLfKmqQxs7TEOVrYPTdYjamDxLy/e5g5FgoCxGY8iil0 +-+YFLZyH6eEx/Os9DlG/M3O1MeRD9U97CdsphbDVZIDyWw5xeX8qQHJe0KSprAgiG +-TLhTZHeyrKujQCQS1oFFmNy4gSqXt0j1/6/9T80j6HeyjiiYEaEQK9YLTAjRoA7W +-VN8wtHI5F3RlNOVQEJks/bjdlpLL3VhaWtfewGh/mXRGcow84cgcsejMexmhreHm +-JfTUl9+X1IFFxGq2/606A9ROQ7kN/s4rXu7/TiMODXI/kZijoWd2SCc7Z0YWoNo7 +-IRKkmZtrsflJbObEuK2Jk59uqzSxyQOBId8qtbPo8qJJyHGV5GCp34g4x67BxJBo +-h1iyVMamBAS5Ip1ejghuROrB8Hit8NhAZApXju62btJeXLX+mQayXb/wC/IXNJJD +-83tXiLfZgs6GzLAq7+KW/64sZSvj87CPiNtxkvjchAvyr+fhbBXCrf4rlOjJE6SH +-Je2/Jon7uqijncARGLBeYUT0Aa6k1slpXuSKxDNt7EIkP21kDZ5/OJ0Y1u587KVB +-dEhuDgNf2/8ij7gAQBwBoZMe1DrwddrxgLLBlyHpAZetNYFZNT+Cs/OlpqI0Jm59 +-kK9pX0BY4AGOd23XM3K/uLawdmf67kkftim7aVaqXFHPiWsJVtlzmidKvNSmbmZe +-dOmMXp6PBoqcdusFVUS7vjd3KAes5wUX/CaTyOOPRu0LMSnpwEnaL76IC9x4Jd6d +-7QqY/OFTjpPH8nP57LwouiT6MgSUCWGaOkPuBJ9w9sENSbbINpgJJ42iAe2kE+R7 +-qEIvf/2ETCTseeQUqm2nWiSPLkNagEh6kojmEoKrGyrv3YjrSXSOY1a70tDVy43+ +-ueQDQzNZm3Q7inpke2ZKvWyY0LQmLzP2te+tnNBcdLyKJx7emPRTuMUlEdK7cLbt +-V3Sy9IKtyAXqqd66fPFj4NhJygyncj8M6CSqhG5L0GhDbkA8UJ8yK/gfKm3h5xe2 +-utULK5VMtAhQt6cVahO59A9t/OI17y45bmlIgdlEQISzVFe9ZbIUJW44zBfPx74k +-/w8pMRr8gEuRqpL2WdJiKGG6lhMHLVFo ++MIIDIjCCAgqgAwIBAgIBBTANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ ++MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT ++UUwgQUIwHhcNMTAwMjIwMDMwMDU0WhcNMzAwOTAzMDMwMDU0WjBDMQswCQYDVQQG ++EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxDzANBgNV ++BAMTBnNlcnZlcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxdpElQZ3FiGv ++oMQ86fgdLZX5Y5CMP4a6d3ZKUktrryn1HKrUPz5Cn21GuoaQsS3M28YzFaP0r1Mz ++T6FW0ao7JhD3ZLX5vxuxR47MptYNqkp346NjnSrcZfR/kRc4LdbNTo1TUpduh/xk ++YKahAKyWbORClHUXRm+Rtd0GR+0F49sCAwEAAaOBozCBoDAJBgNVHRMEAjAAMB0G ++A1UdDgQWBBRuYD8pE2CZ7Qz3FbXbexz7b2AZ7TB0BgNVHSMEbTBrgBSx+353tUCN ++aBF+2RHlw8baTaxRsKFIpEYwRDELMAkGA1UEBhMCU0UxEDAOBgNVBAgTB1VwcHNh ++bGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCggkAvlitTB89 ++JZUwDQYJKoZIhvcNAQEFBQADggEBAGMuDwcUBs90kD03QvJIcGAhvDRSMfGHcNKy +++/8TONzwXkPX7qfHH6yq0oxP+jxMc/a2wgyg6qLJ4nNhwy54QA8q02NQm7j5iUDt ++mAiXwwckFzS1eIkKu4NM4lwuE9YhMK0wSLVwEv9Kb0Lw+J+xS72JK/Cd4kkrNWkY ++H3ZAtHa9y90nL8DB4jM+bt9oVBmSirsTnM/WF1bavw1kcDpFt6pf4/WWrjTyFzcn ++0EvoMErAAkLi0jDr68fX7NjfXENY4m+3WFQNxAFxLVmPRMehbAtBKPq3Y6do00/D ++DxeesjJQ5guHPeI5R8DYCjv2r1BoD53vbjQNOgeU+KTXJIYy07Q= + -----END CERTIFICATE----- +diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server8k-key.pem mysql-5.1.50/mysql-test/std_data/server8k-key.pem +--- mysql-5.1.50.orig/mysql-test/std_data/server8k-key.pem 2010-08-03 13:55:08.000000000 -0400 ++++ mysql-5.1.50/mysql-test/std_data/server8k-key.pem 2010-08-27 23:43:10.165365998 -0400 +@@ -1,99 +1,15 @@ + -----BEGIN RSA PRIVATE KEY----- +-MIISKQIBAAKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSECPgxN +-NcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+LrhXIq +-Cz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2DA7k +-vMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5hACb +-fU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09Gh/G +-wmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33aGsZ +-5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4PRd3 +-1qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2OaIw +-FjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83psQ6 +-R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCcHSFu +-07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs+LFd +-t4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS9+LB +-+LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1PsZi4 +-UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUdNhXx +-i/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfVJTt8 +-Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwxUADg +-R0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1kOE7 +-GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQuw4q +-VKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRYnTIy +-wUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PTtroh +-FSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFTd33Z +-Dke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABAoIEAQCSt6YoZqigz/50 +-XvYT6Uf6T6S1lBDFXNmY1qOuDkLBJTWRiwYMDViQEaWCaZgGTKDYeT3M8uR/Phyu +-lRFi5vCEMufmcAeZ3hxptw7KU+R8ILJ207/zgit6YglTys9h5txTIack39+6FJmx +-wbZ64HpETJZnpMO6+fuZaMXyLjuT8mmXjvHcOgXOvjWeFkZOveDhjJkAesUXuqyX +-EI+ajoXuQiPXeKonkD2qd7NTjzfy4gw/ZF4NXs0ZVJeviqtIPo2xp33udOw2vRFh +-bMvlF4cNLAbIKYVyOG0ruOfd2I7Unsc/CvD1u5vlRVuUd8OO0JZLIZR7hlRX+A58 +-8O1g2H/wJZAsF1BnLnFzDGYCX2WjCCK3Zn85FkKGRa0lTdYDduad/C/N3Y2/pHFE +-e7U/2D7IkEei59tD2HcsDBB3MJnckkn/hyiL9qWcxqWZ61vurE+XjU6tc6fnfhk9 +-pJQ6yU3epPU7Vfsk0UGA7bbgKpsyzyH8Zl76YC2mN2ZVJjZekfhY+ibT9odEPdOl +-yLB5iXA6/WhKkDWaOqZGOH+7MblWgT9wHINlcn+nKzOr00JHl26ac6aMlXXi9vbe +-4jgJbFK1HYlFIndyX/BdqRTsFemDoDrVqrEYsaONoVYDd9c5qrqYOeh34DhOksQW +-hNwWBfmMlfzgOGtCYhMeK+AajqTtUbMYQA6qp47KJd/Oa5Dvi3ZCpvZh3Ll5iIau +-rqCtmojsWCqmpWSu7P+Wu4+O3XkUMPdQUuQ5rJFESEBB3yEJcxqk/RItTcKNElNC +-PASrPrMD9cli7S/pJ+frbhu1Gna1ArXzXQE9pMozPaBpjCig7+15R0lL3pmOKO6e +-WK3dgSwrnW6TQdLPlSD4lbRoiIdTHVBczztDeUqVvFiV3/cuaEi1nvaVdAYLqjuL +-ogK4HwE/FQ54S0ijAsP52n25usoH6OTU3bSd/7NTp0vZCy3yf10x7HUdsh2DvhRO +-3+TSK5t0yz0Nt7hNwcI6pLmWUIYcZgpFc/WsiiGscTfhy8rh3kRHI8ylGq53KNF+ +-yCVmjqnBRWs91ArxmeF1ctX2t3w5p7gf65hJWqoX/2DiSi5FBsr6HLxa5sUi4wRZ +-136aCNt5Wu7w+AzPDbQW6qKUGSyfHJAw4JZasZcaZLise5IWb1ks0DtFbWWdT3ux +-8r2AM7IO1WopnekrYCnx/aBvBAv4NjWozVA517ztVttPERt3AGb4nm387nYt5R2U +-NO2GBWcDyT8JQLKmffE1AkWolCR1GsvcNLQfLCbnNppgsnsLE/viTG4mq1wjnd8O +-2Q8nH1SVTuyGFREMp/zsiAEaGfdd0hI2r1J7OdNPBBCtmhITsy9ZYHqm5vrGvy3s +-vi2GuB2RAoICAQD/oWUsg4eTJxHifTJLz/tVSTXnw7DhfbFVa1K1rUV63/MRQAFW +-pabN4T6Yfp3CpdRkljCA8KPJZj7euwhm4OEg1ulpOouA+cfWlE9RFE8wyOK5SYwM +-k+nk31P9MUC866pZg/ghzBGDub91OW1+ZGEtqnLI/n/LhiAIWt0hJvgZclTc1cAL +-xffHVlFwoSyNl/nc3ueZCC95nOLst2XcuxZLLbOFtZCmDYsp49q/Jn6EFjn4Ge2o +-qp38z6eZgDMP1F4lb9nDqXPHfUSt2jxKlmpfXS+IPKdba67+EjhbtmUYzaR4EoPI +-zh+o6SrVWT6Yve7KGiYv06fuRz1m/lLQO/Arbd9ntSjgn+ZEXGOkbhnHUX3DJ4ny +-/6XEGB9NLQjern4uNTn0AaV+uvhncapFMaIBnVfq0Cw8eog0136PBYRaVX7T44j5 +-HwIyGXWtYGA/SzDEQoksD0Y/T61BEGnLZaKeavNd82WwFvcYHZtE0J4aQGjCEE7N +-+nijzCy+j5ETmme9KJvQHpEyXP3N4RBko1eWvyTwFZDdIXtoa6TTEI51lm+FXJ/b +-Y+BzMr6KRo29FB+7//1ptUoMvn5hzL0PwOv2ZSTQuoG5hLDEbxWXLNhd1VHcfznF +-3EZHwfD2F8aGQ3kz+fkMTNfK955KorDrmLgvmV9eZZ5yQxGZrs5H5YfKpwKCAgEA +-6nSUbzfSdVFUH89NM5FmEJgkD06vqCgHl2mpyF+VmDGcay4K06eA4QbRO5kns13+ +-n6PcBl/YVW/rNE8iFi+WxfqUpAjdR1HlShvTuTRVqtFTfuN8XhbYU6VMjKyuE0kd +-LKe3KRdwubjVNhXRZLBknU+3Y/4hnIR7mcE3/M5Zv5hjb7XnwWg/SzxV9WojCKiu +-vQ7cXhH5/o7EuKcl1d6vueGhWsRylCG9RimwgViR2H7zD9kpkOc0nNym9cSpb0Gv +-Lui4cf/fVwIt2HfNEGBjbM/83e2MH6b8Xp1fFAy0aXCdRtOo4LVOzJVAxn5dERMX +-4JJ4d5cSFbssDN1bITOKzuytfBqRIQGNkOfizgQNWUiaFI0MhEN/icymjm1ybOIh +-Gc9tzqKI4wP2X9g+u3+Oof1QaBcZ4UbZEU9ITN87Pa6XVJmpNx7A81BafWoEPFeE +-ahoO4XDwlHZazDuSlOseEShxXcVwaIiqySy7OBEPBVuYdEd2Qw/z3JTx9Kw8MKnf +-hu+ar5tz5dPnJIsvLeYCcJDe/K6loiZuHTtPbWEy9p6It7qubQNPBvTSBN5eVDKc +-Q2bTQNCx8SAAA9C5gJiwWoQKsXJzbRFRY77P9JjuGpua3YJ2nYBHEJmF+fp1R33c +-uHIyMphPMkKC4GC3/43kkMr6tck8kZbXGSYsLsBr2GkCggIBAJvvrjILQianzKcm +-zAmnI6AQ+ssYesvyyrxaraeZvSqJdlLtgmOCxVANuQt5IW9djUSWwZvGL4Np1aw0 +-15k6UNqhftzsE7FnrVneOsww4WXXBUcV8FKz4Bf3i9qFswILmGzmrfSf8YczRfGS +-SJKzVPxwX3jwlrBmbx/pnb7dcLbFIbNcyLvl1ZJJu4BDMVRmgssTRp/5eExtQZg4 +-//A4SA8wH7TO3yAMXvn8vrGgH8kfbdlEp88d1SYk3g4rP/rGB3A63NIYikIEzmJn +-ICQ3wUfPJnGq3kRMWgEuyCZaCy2oNE3yrWVPJ8z3/2MJ/79ZDVNHxEeki2o1FuW+ +-+nGAPq+fZIp03iy4HdVRro7dgugtc9QaSHJtNId8V4vSjviX5Oz3FxUb9AJst58S +-nVV8Q2FMxBa/SlzSOkhRtCg2q1gXkzhaMnIVUleRZFGQ2uWBToxKMjcoUifIyN1J +-z999bkfI4hBLq5pRSAXz+YVu5SMKa10GaawIwJLat+i+1zboF6QyI2o/Wz8nrsNq +-KX/ajFGu5C94WFgsVoWKNI90KBLe48Ssje9c68waBlV/WHMg1YLvU3yqVDOV+K5c +-IHB9tPMnG+AgBYZPxSzuvnLrrkj/GeKx0WI7TrvzOLRGKJo6irMEJ8IzFegASRUq +-TVZKYQDYRG7m+lKlSxU+pyMAh2c9AoICAE4kavCip1eIssQjYLTGSkFPo/0iGbOv +-G9CgXAE3snFWX67tWphupKrbjdMSWcQTmPD2OTg6q6zWL4twsIi6dcMooHAHsFC7 +-//LyUV/SDJdxSyXohiQJ8zH1zwy35RDydnHSuF5OvLh53T44iWDI1dAEqLgAFI3J +-LjTxzEpLMGiGTuYFt+ejai0WQAQayvBw4ESM9m+4CB2K0hBFTXv5y5HlnNTW0uWC +-VUZUUMrbjUieDz8B/zOXi9aYSGFzmZFGUDAPSqJcSMEELemPDF7f8WNr8vi42tIV +-4tlaFD1nep4F9bWMiCXU6B2RxVQi+7vcJEIqL1KUnGd3ydfD00K+ng4Xnj7Vz/cz +-QE7CqrpFaXmPlCMzW6+dm51/AyhHXDLkL2od05hiXcNkJ7KMLWRqwExHVIxM3shR +-x7lYNl3ArUsCrNd6m4aOjnrKFk7kjeLavHxskPccoGKrC9o0JMfTkWLgmuBJFQ0S +-N/HzIbcvIFWF0Ms4ojb50yp6ziXhXfJOO/0KUQEki71XIhvw89mVZszDzD5lqzjf +-HCZMBU4MbmL6NdEevFIDH0zPPkx3HPNtJt3kIJbit9wI8VhUMe+ldGnGxpWb8tKw +-SfM3vrHkYr+lizk26XfXMFhdAuVtT7dzQKSNEyP/1a2Hs307Xzgiv8JulJ8QIkrX +-/nsYWPOAGLG5AoICABmdW9Ppkvuhb1AEcjTWb+XCyopoBc6vit/uQWD9uO+CeX7a +-cfzq+iH01CAjyVMc4E1JDc5Lpi106U+GRGcAAaPJB2Sp5NznoxaOVrb71blu4Q4x +-bNjtKM/P/DXpO+yJYoOPdKtaSDhtnfNDM7H/jztJ3XIrOltKA7CcRDohbBWIx8Q0 +-0uEpvfFpZZBco3yVmjP0RLgIVYn/ZDj9wGhSvFWIJ5vv6GXmtDrcHGMLxcfv7t76 +-UVcMW/Yy4mYJRCzGOrWagyVijJ6MTVNciqadWcH1KcbB3EGoMFYMn61or2qJABPM +-xz89IlhnROU1Re3X/QRx5t86cw6oa+FqrWMOhSs31I0dNWSuS/xDympG27YIYSDd +-mv5seT78GjFmMJC5pPOLoXsbTPB0HpsX2/UL/w/eRAfilTOef/Cf9VE5MP/C2YR7 +-NBxUU7/+21D6WvdtBTcZbrXWGroAo8zPP+PwX0+c6WoAvqDJvCPndp8xZhSgEJN/ +-0kScptezi8n3ZHI95EA9U5mAHxHz0IhDDVzWw/z1f1SBPxKVX3+By3zaa3lrD2ch +-cHq7nBkX72veEevnHUY8Z2rHE2G2jdmRfOtwm4sjL0VBV9fRRoxzJWRduKyeOtDL +-EhhBhUoTrT48UnfW9hxnbNLB9P/hh+UJu9HrS2uAwHoGE1+8gcyundupGDBn ++MIICXgIBAAKBgQDF2kSVBncWIa+gxDzp+B0tlfljkIw/hrp3dkpSS2uvKfUcqtQ/ ++PkKfbUa6hpCxLczbxjMVo/SvUzNPoVbRqjsmEPdktfm/G7FHjsym1g2qSnfjo2Od ++Ktxl9H+RFzgt1s1OjVNSl26H/GRgpqEArJZs5EKUdRdGb5G13QZH7QXj2wIDAQAB ++AoGBAJLCjh7Q9eLnx+QDzH9s+Q/IcH4nSbERmh1lFEopAc6j29qQ6PGkmDy0DUPs ++70VOCOh5A4mo3aZzm9sUfVb24/nRtmyTP/AtMuIVGCsUqzI28dJRGvRlY0aSQG/C ++ILqMP69kiMNGBvuyEIiJhisOmMvDFEp7HrrXHJM9qcc217DpAkEA4nzJ9yyy2e4O ++r6/D711hdfcU/F+ktXw+pL77kSSdTABUap92Uv2RL36UA4q5h8RNvq/GrzMNm6Ye ++u2IMvBCiTQJBAN+iRbiMJCSitTg5YVMluVbT87co7jbTqk7LN1ujyIFEklm4xlHG ++DLJNgEoDR7QJtAkL++FyogC4zsQsey5voscCQQCp54trTbDuI9QIoAaQrrDKWgz4 ++NpfNPeOQm2UFQT5vIWAyjGWrZGViB8bp0UvVOcJI5nxaOiZfOYOcdrWu75uRAkAn ++67zMc9/j1lPJRJz2Dc7nDBD+ikTz7pcBV897AWLCiK4jbBOi91q+3YzgKXO8VNsZ ++nlUJasA2psbqSBJ5OJ5zAkEA2UxoMju54hASjT54Z92IzraVw4Vo8CYwOcw5fr7z +++m5xg1mmWdLBclmZ+WjARzDuTHIW6u/WCxNGg42AykWzfw== + -----END RSA PRIVATE KEY----- diff --git a/SPECIFIC-ULN/mysql-install-test.patch b/SPECIFIC-ULN/mysql-install-test.patch new file mode 100644 index 00000000000..5980aea6a9f --- /dev/null +++ b/SPECIFIC-ULN/mysql-install-test.patch @@ -0,0 +1,33 @@ +Improve the documentation that will be installed in the mysql-test RPM. + + +diff -Naur mysql-5.1.43.orig/mysql-test/README mysql-5.1.43/mysql-test/README +--- mysql-5.1.43.orig/mysql-test/README 2010-01-15 12:14:43.000000000 -0500 ++++ mysql-5.1.43/mysql-test/README 2010-02-13 21:18:06.000000000 -0500 +@@ -6,6 +6,16 @@ + actually have a co-existing MySQL installation. The tests will not + conflict with it. + ++For use in Red Hat distributions, you should run the script as user mysql, ++so the best bet is something like ++ cd /usr/share/mysql-test ++ sudo -u mysql ./mysql-test-run ++This will use the installed mysql executables, but will run a private copy ++of the server process (using data files within /usr/share/mysql-test), ++so you need not start the mysqld service beforehand. ++To clean up afterwards, remove the created "var" subdirectory, eg ++ sudo -u mysql rm -rf /usr/share/mysql-test/var ++ + All tests must pass. If one or more of them fail on your system, please + read the following manual section for instructions on how to report the + problem: +@@ -25,7 +35,8 @@ + + With no test cases named on the command line, mysql-test-run falls back + to the normal "non-extern" behavior. The reason for this is that some +-tests cannot run with an external server. ++tests cannot run with an external server (because they need to control the ++options with which the server is started). + + + You can create your own test cases. To create a test case, create a new diff --git a/SPECIFIC-ULN/mysql-strmov.patch b/SPECIFIC-ULN/mysql-strmov.patch new file mode 100644 index 00000000000..a144d0936e4 --- /dev/null +++ b/SPECIFIC-ULN/mysql-strmov.patch @@ -0,0 +1,32 @@ +Remove overly optimistic definition of strmov() as stpcpy(). + +mysql uses this macro with overlapping source and destination strings, +which is verboten per spec, and fails on some Red Hat platforms. +Deleting the definition is sufficient to make it fall back to a +byte-at-a-time copy loop, which should consistently give the +expected behavior. + +Note: the particular case that prompted this patch is reported and fixed +at http://bugs.mysql.com/bug.php?id=48864. However, my faith in upstream's +ability to detect this type of error is low, and I also see little evidence +of any real performance gain from optimizing these calls. So I'm keeping +this patch. + + +diff -Naur mysql-5.1.37.orig/include/m_string.h mysql-5.1.37/include/m_string.h +--- mysql-5.1.37.orig/include/m_string.h 2009-07-13 19:08:50.000000000 -0400 ++++ mysql-5.1.37/include/m_string.h 2009-08-31 21:49:49.000000000 -0400 +@@ -81,13 +81,6 @@ + extern void *(*my_str_malloc)(size_t); + extern void (*my_str_free)(void *); + +-#if defined(HAVE_STPCPY) +-#define strmov(A,B) stpcpy((A),(B)) +-#ifndef stpcpy +-extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ +-#endif +-#endif +- + /* Declared in int2str() */ + extern char NEAR _dig_vec_upper[]; + extern char NEAR _dig_vec_lower[]; diff --git a/SPECIFIC-ULN/mysql.init b/SPECIFIC-ULN/mysql.init new file mode 100644 index 00000000000..310e8cfa023 --- /dev/null +++ b/SPECIFIC-ULN/mysql.init @@ -0,0 +1,209 @@ +#!/bin/sh +# +# mysqld This shell script takes care of starting and stopping +# the MySQL subsystem (mysqld). +# +# chkconfig: - 64 36 +# description: MySQL database server. +# processname: mysqld +# config: /etc/my.cnf +# pidfile: /var/run/mysqld/mysqld.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + + +exec="/usr/bin/mysqld_safe" +prog="mysqld" + +# Set timeouts here so they can be overridden from /etc/sysconfig/mysqld +STARTTIMEOUT=120 +STOPTIMEOUT=60 + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + + +# extract value of a MySQL option from config files +# Usage: get_mysql_option SECTION VARNAME DEFAULT +# result is returned in $result +# We use my_print_defaults which prints all options from multiple files, +# with the more specific ones later; hence take the last match. +get_mysql_option(){ + result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1` + if [ -z "$result" ]; then + # not found, use default + result="$3" + fi +} + +get_mysql_option mysqld datadir "/var/lib/mysql" +datadir="$result" +get_mysql_option mysqld socket "$datadir/mysql.sock" +socketfile="$result" +get_mysql_option mysqld_safe log-error "/var/log/mysqld.log" +errlogfile="$result" +get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid" +mypidfile="$result" + + +start(){ + [ -x $exec ] || exit 5 + # check to see if it's already running + RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` + if [ $? = 0 ]; then + # already running, do nothing + action $"Starting $prog: " /bin/true + ret=0 + elif echo "$RESPONSE" | grep -q "Access denied for user" + then + # already running, do nothing + action $"Starting $prog: " /bin/true + ret=0 + else + # prepare for start + touch "$errlogfile" + chown mysql:mysql "$errlogfile" + chmod 0640 "$errlogfile" + [ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile" + if [ ! -d "$datadir/mysql" ] ; then + # First, make sure $datadir is there with correct permissions + if [ ! -e "$datadir" -a ! -h "$datadir" ] + then + mkdir -p "$datadir" || exit 1 + fi + chown mysql:mysql "$datadir" + chmod 0755 "$datadir" + [ -x /sbin/restorecon ] && /sbin/restorecon "$datadir" + # Now create the database + action $"Initializing MySQL database: " /usr/bin/mysql_install_db --datadir="$datadir" --user=mysql + ret=$? + chown -R mysql:mysql "$datadir" + if [ $ret -ne 0 ] ; then + return $ret + fi + fi + chown mysql:mysql "$datadir" + chmod 0755 "$datadir" + # Pass all the options determined above, to ensure consistent behavior. + # In many cases mysqld_safe would arrive at the same conclusions anyway + # but we need to be sure. (An exception is that we don't force the + # log-error setting, since this script doesn't really depend on that, + # and some users might prefer to configure logging to syslog.) + # Note: set --basedir to prevent probes that might trigger SELinux + # alarms, per bug #547485 + $exec --datadir="$datadir" --socket="$socketfile" \ + --pid-file="$mypidfile" \ + --basedir=/usr --user=mysql >/dev/null 2>&1 & + safe_pid=$! + # Spin for a maximum of N seconds waiting for the server to come up; + # exit the loop immediately if mysqld_safe process disappears. + # Rather than assuming we know a valid username, accept an "access + # denied" response as meaning the server is functioning. + ret=0 + TIMEOUT="$STARTTIMEOUT" + while [ $TIMEOUT -gt 0 ]; do + RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` && break + echo "$RESPONSE" | grep -q "Access denied for user" && break + if ! /bin/kill -0 $safe_pid 2>/dev/null; then + echo "MySQL Daemon failed to start." + ret=1 + break + fi + sleep 1 + let TIMEOUT=${TIMEOUT}-1 + done + if [ $TIMEOUT -eq 0 ]; then + echo "Timeout error occurred trying to start MySQL Daemon." + ret=1 + fi + if [ $ret -eq 0 ]; then + action $"Starting $prog: " /bin/true + touch $lockfile + else + action $"Starting $prog: " /bin/false + fi + fi + return $ret +} + +stop(){ + if [ ! -f "$mypidfile" ]; then + # not running; per LSB standards this is "ok" + action $"Stopping $prog: " /bin/true + return 0 + fi + MYSQLPID=`cat "$mypidfile"` + if [ -n "$MYSQLPID" ]; then + /bin/kill "$MYSQLPID" >/dev/null 2>&1 + ret=$? + if [ $ret -eq 0 ]; then + TIMEOUT="$STOPTIMEOUT" + while [ $TIMEOUT -gt 0 ]; do + /bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break + sleep 1 + let TIMEOUT=${TIMEOUT}-1 + done + if [ $TIMEOUT -eq 0 ]; then + echo "Timeout error occurred trying to stop MySQL Daemon." + ret=1 + action $"Stopping $prog: " /bin/false + else + rm -f $lockfile + rm -f "$socketfile" + action $"Stopping $prog: " /bin/true + fi + else + action $"Stopping $prog: " /bin/false + fi + else + # failed to read pidfile, probably insufficient permissions + action $"Stopping $prog: " /bin/false + ret=4 + fi + return $ret +} + +restart(){ + stop + start +} + +condrestart(){ + [ -e $lockfile ] && restart || : +} + + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p "$mypidfile" $prog + ;; + restart) + restart + ;; + condrestart|try-restart) + condrestart + ;; + reload) + exit 3 + ;; + force-reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac + +exit $? diff --git a/SPECIFIC-ULN/scriptstub.c b/SPECIFIC-ULN/scriptstub.c new file mode 100644 index 00000000000..de942c136e7 --- /dev/null +++ b/SPECIFIC-ULN/scriptstub.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include + +/* Translate call of myself into call of same-named script in LIBDIR */ +/* The macro LIBDIR must be defined as a double-quoted string */ + +int main (int argc, char **argv) +{ + char *basename; + char *fullname; + char **newargs; + int i; + + basename = strrchr(argv[0], '/'); + if (basename) + basename++; + else + basename = argv[0]; + fullname = malloc(strlen(LIBDIR) + strlen(basename) + 2); + sprintf(fullname, "%s/%s", LIBDIR, basename); + newargs = malloc((argc+1) * sizeof(char *)); + newargs[0] = fullname; + for (i = 1; i < argc; i++) + newargs[i] = argv[i]; + newargs[argc] = NULL; + + execvp(fullname, newargs); + + return 1; +} From 6cd3c6b6b008cbe3614ca2790439164fb3be57b2 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 11 Jun 2012 12:11:02 +0200 Subject: [PATCH 138/349] More changes to supporting the build of RPMs for ULN from the MySQL 5.5 source tree. Contrary to the comment, the spec file for these ULN RPMs was missing in the previous changeset (blame ".bzrignore"). This change now brings said spec file, and it adds cmake handling for the new files. Still for internal tool tests only, not yet ready for publishing. CMakeLists.txt: Add the subdirectory holding specific stuff for the RedHat-compatible RPMs for ULN. cmake/install_layout.cmake: Explicitly mention my the ULN RPMs are handled. --- CMakeLists.txt | 1 + SPECIFIC-ULN/CMakeLists.txt | 28 + SPECIFIC-ULN/mysql.spec.sh | 1845 +++++++++++++++++++++++++++++++++++ cmake/install_layout.cmake | 7 +- 4 files changed, 1880 insertions(+), 1 deletion(-) create mode 100644 SPECIFIC-ULN/CMakeLists.txt create mode 100644 SPECIFIC-ULN/mysql.spec.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 2adb60f0942..d566fd9f541 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,6 +324,7 @@ IF(NOT WITHOUT_SERVER) IF(UNIX) ADD_SUBDIRECTORY(man) ENDIF() + ADD_SUBDIRECTORY(SPECIFIC-ULN) ENDIF() INCLUDE(cmake/abi_check.cmake) diff --git a/SPECIFIC-ULN/CMakeLists.txt b/SPECIFIC-ULN/CMakeLists.txt new file mode 100644 index 00000000000..6f6587e75b3 --- /dev/null +++ b/SPECIFIC-ULN/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +IF(UNIX) + SET(prefix ${CMAKE_INSTALL_PREFIX}) + + SET(SPECFILENAME "mysql.${VERSION}.spec") + IF("${VERSION}" MATCHES "-ndb-") + STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") + SET(SPECFILENAME "mysql-cluster-${NDBVERSION}.spec") + ENDIF() + + # Left in current directory, to be taken during build + CONFIGURE_FILE(mysql.spec.sh ./${SPECFILENAME} @ONLY) +ENDIF() diff --git a/SPECIFIC-ULN/mysql.spec.sh b/SPECIFIC-ULN/mysql.spec.sh new file mode 100644 index 00000000000..63b897cfb76 --- /dev/null +++ b/SPECIFIC-ULN/mysql.spec.sh @@ -0,0 +1,1845 @@ +# Copyright (c) CORRECT TEXT TO BE DETERMINED - TODO / FIXME +# + +%define mysql_version @VERSION@ +%define release 1 +%define mysql_vendor Oracle and/or its affiliates +%define mysqldatadir /var/lib/mysql + +############################################################################## +# Command line handling +############################################################################## +# +# To set options: +# +# $ rpmbuild --define="option " ... +# + +# ---------------------------------------------------------------------------- +# Commercial builds +# ---------------------------------------------------------------------------- +%if %{undefined commercial} +%define commercial 0 +%endif + +# ---------------------------------------------------------------------------- +# Source name +# ---------------------------------------------------------------------------- +%if %{undefined src_base} +%define src_base mysql +%endif +%define src_dir %{src_base}-%{mysql_version} + +# ---------------------------------------------------------------------------- +# Feature set (storage engines, options). Default to community (everything) +# ---------------------------------------------------------------------------- +%if %{undefined feature_set} +%define feature_set community +%endif + +# ---------------------------------------------------------------------------- +# Server comment strings +# ---------------------------------------------------------------------------- +%if %{undefined compilation_comment_debug} +%define compilation_comment_debug MySQL Community Server - Debug (GPL) +%endif +%if %{undefined compilation_comment_release} +%define compilation_comment_release MySQL Community Server (GPL) +%endif + +# ---------------------------------------------------------------------------- +# Product and server suffixes +# ---------------------------------------------------------------------------- +%if %{undefined product_suffix} + %if %{defined short_product_tag} + %define product_suffix -%{short_product_tag} + %else + %define product_suffix %{nil} + %endif +%endif + +%if %{undefined server_suffix} +%define server_suffix %{nil} +%endif + +# ---------------------------------------------------------------------------- +# Distribution support +# ---------------------------------------------------------------------------- +%if %{undefined distro_specific} +%define distro_specific 0 +%endif +%if %{distro_specific} + %if %(test -f /etc/oracle-release && echo 1 || echo 0) + %define elver %(rpm -qf --qf '%%{version}\\n' /etc/oracle-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') + %if "%elver" == "6" + %define distro_description Oracle Linux 6 + %define distro_releasetag el6 + %define distro_buildreq gcc-c++ ncurses-devel perl readline-devel time zlib-devel + %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools + %else + %{error:Oracle Linux %{elver} is unsupported} + %endif + %else + %if %(test -f /etc/redhat-release && echo 1 || echo 0) + %define rhelver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') + %if "%rhelver" == "5" + %define distro_description Red Hat Enterprise Linux 5 + %define distro_releasetag rhel5 + %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel + %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools + %else + %if "%rhelver" == "6" + %define distro_description Red Hat Enterprise Linux 6 + %define distro_releasetag rhel6 + %define distro_buildreq gcc-c++ ncurses-devel perl readline-devel time zlib-devel + %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools + %else + %{error:Red Hat Enterprise Linux %{rhelver} is unsupported} + %endif + %endif + %else + %if %(test -f /etc/SuSE-release && echo 1 || echo 0) + %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release) + %if "%susever" == "10" + %define distro_description SUSE Linux Enterprise Server 10 + %define distro_releasetag sles10 + %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client readline-devel zlib-devel + %define distro_requires aaa_base coreutils grep procps pwdutils + %else + %if "%susever" == "11" + %define distro_description SUSE Linux Enterprise Server 11 + %define distro_releasetag sles11 + %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils readline-devel zlib-devel + %define distro_requires aaa_base coreutils grep procps pwdutils + %else + %{error:SuSE %{susever} is unsupported} + %endif + %endif + %else + %{error:Unsupported distribution} + %endif + %endif + %endif +%else + %define generic_kernel %(uname -r | cut -d. -f1-2) + %define distro_description Generic Linux (kernel %{generic_kernel}) + %define distro_releasetag linux%{generic_kernel} + %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel + %define distro_requires coreutils grep procps /sbin/chkconfig /usr/sbin/useradd /usr/sbin/groupadd +%endif + +# Avoid debuginfo RPMs, leaves binaries unstripped +%define debug_package %{nil} + +# Hack to work around bug in RHEL5 __os_install_post macro, wrong inverted +# test for __debug_package +%define __strip /bin/true + +# ---------------------------------------------------------------------------- +# Support optional "tcmalloc" library (experimental) +# ---------------------------------------------------------------------------- +%if %{defined malloc_lib_target} +%define WITH_TCMALLOC 1 +%else +%define WITH_TCMALLOC 0 +%endif + +############################################################################## +# Configuration based upon above user input, not to be set directly +############################################################################## + +%if %{commercial} +%define license_files_server %{src_dir}/LICENSE.mysql +%define license_type Commercial +%else +%define license_files_server %{src_dir}/COPYING %{src_dir}/README +%define license_type GPL +%endif + +############################################################################## +# Main spec file section +############################################################################## + +Name: mysql%{product_suffix} +Version: @MYSQL_RPM_VERSION@ +Release: %{release}%{?distro_releasetag:.%{distro_releasetag}} +Summary: MySQL client programs and shared libraries +Group: Applications/Databases +URL: http://www.mysql.com +Packager: MySQL Release Engineering +# exceptions allow client libraries to be linked with most open source SW, +# not only GPL code. +License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{license_type} license as shown in the Description field. + +# Regression tests take a long time, you can skip 'em with this +%{!?runselftest:%global runselftest 1} + +# Upstream has a mirror redirector for downloads, so the URL is hard to +# represent statically. You can get the tarball by following a link from +# http://dev.mysql.com/downloads/mysql/ +Source0: %{src_dir}.tar.gz +# The upstream tarball includes non-free documentation that only the +# copyright holder (MySQL -> Sun -> Oracle) may ship. +# To remove the non-free documentation, run this script after downloading +# the tarball into the current directory: +# ./generate-tarball.sh $VERSION +# Then, source name changes: +# Source0: mysql-%{version}-nodocs.tar.gz +%if %{commercial} +NoSource: 0 +%endif +Source1: generate-tarball.sh +Source2: mysql.init +Source3: my.cnf +Source4: scriptstub.c +Source5: my_config.h +# The below is only needed for packages built outside MySQL -> Sun -> Oracle: +Source6: README.mysql-docs +Source9: mysql-embedded-check.c +# Working around perl dependency checking bug in rpm FTTB. Remove later. +Source999: filter-requires-mysql.sh + +# Patch1: mysql-ssl-multilib.patch Not needed by MySQL (yaSSL), will not work in 5.5 (cmake) +Patch2: mysql-5.5-errno.patch +Patch4: mysql-5.5-testing.patch +Patch5: mysql-install-test.patch +Patch6: mysql-5.5-stack-guard.patch +# Patch7: mysql-disable-test.patch Already fixed in current 5.1 +# Patch8: mysql-setschedparam.patch Will not work in 5.5 (cmake) +# Patch9: mysql-no-docs.patch Will not work in 5.5 (cmake) +Patch10: mysql-strmov.patch + # Not used by MySQL +# Patch12: mysql-cve-2008-7247.patch Already fixed in 5.5 +Patch13: mysql-expired-certs.patch + # Will not be used by MySQL +# Patch14: mysql-missing-string-code.patch Undecided, will not work in 5.5 (cmake) +# Patch15: mysql-lowercase-bug.patch Fixed in MySQL 5.1.54 and 5.5.9 +Patch16: mysql-chain-certs.patch +Patch17: mysql-5.5-libdir.patch +Patch18: mysql-5.5-fix-tests.patch +Patch19: mysql-5.5-mtr1.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +BuildRequires: %{distro_buildreq} +BuildRequires: gawk +# make test requires time and ps +BuildRequires: procps +# Socket and Time::HiRes are needed to run regression tests +BuildRequires: perl(Socket), perl(Time::HiRes) + +Requires: %{distro_requires} +Requires: fileutils +Requires: mysql-libs%{product_suffix} = %{version}-%{release} +Requires: bash + +# If %%{product_suffix} is non-empty, the auto-generated capability is insufficient: +# We want all dependency handling to use the generic name only. +# Similar in other sub-packages +Provides: mysql + +# MySQL (with caps) is upstream's spelling of their own RPMs for mysql +Conflicts: MySQL +# mysql-cluster used to be built from this SRPM, but no more +Obsoletes: mysql-cluster < 5.1.44 +# We need cross-product "Obsoletes:" to allow cross-product upgrades: +Obsoletes: mysql mysql-advanced + +# Working around perl dependency checking bug in rpm FTTB. Remove later. +%global __perl_requires %{SOURCE999} + +%description -n mysql%{product_suffix} +MySQL is a multi-user, multi-threaded SQL database server. MySQL is a +client/server implementation consisting of a server daemon (mysqld) +and many different client programs and libraries. The base package +contains the standard MySQL client programs and generic MySQL files. + +The MySQL software has Dual Licensing, which means you can use the MySQL +software free of charge under the GNU General Public License +(http://www.gnu.org/licenses/). You can also purchase commercial MySQL +licenses from %{mysql_vendor} if you do not wish to be bound by the terms of +the GPL. See the chapter "Licensing and Support" in the manual for +further info. + +%package -n mysql-libs%{product_suffix} + +Summary: The shared libraries required for MySQL clients +Group: Applications/Databases +Requires: /sbin/ldconfig +Provides: mysql-libs +Obsoletes: mysql-libs mysql-libs-advanced + +%description -n mysql-libs%{product_suffix} +The mysql-libs package provides the essential shared libraries for any +MySQL client program or interface. You will need to install this package +to use any other MySQL package or any clients that need to connect to a +MySQL server. + +%package -n mysql-server%{product_suffix} + +Summary: The MySQL server and related files +Group: Applications/Databases +Requires: mysql%{product_suffix} = %{version}-%{release} +Requires: sh-utils +Requires(pre): /usr/sbin/useradd +Requires(post): chkconfig +Requires(preun): chkconfig +# This is for /sbin/service +Requires(preun): initscripts +Requires(postun): initscripts +# mysqlhotcopy needs DBI/DBD support +Requires: perl-DBI, perl-DBD-MySQL +Provides: mysql-server +Conflicts: MySQL-server +Obsoletes: mysql-server mysql-server-advanced + +%description -n mysql-server%{product_suffix} +MySQL is a multi-user, multi-threaded SQL database server. MySQL is a +client/server implementation consisting of a server daemon (mysqld) +and many different client programs and libraries. This package contains +the MySQL server and some accompanying files and directories. + +%package -n mysql-devel%{product_suffix} + +Summary: Files for development of MySQL applications +Group: Applications/Databases +Requires: mysql%{product_suffix} = %{version}-%{release} +Requires: openssl-devel +Provides: mysql-devel +Conflicts: MySQL-devel +Obsoletes: mysql-devel mysql-devel-advanced + +%description -n mysql-devel%{product_suffix} +MySQL is a multi-user, multi-threaded SQL database server. This +package contains the libraries and header files that are needed for +developing MySQL client applications. + +%package -n mysql-embedded%{product_suffix} + +Summary: MySQL as an embeddable library +Group: Applications/Databases +Provides: mysql-embedded +Obsoletes: mysql-embedded mysql-embedded-advanced + +%description -n mysql-embedded%{product_suffix} +MySQL is a multi-user, multi-threaded SQL database server. This +package contains a version of the MySQL server that can be embedded +into a client application instead of running as a separate process, +as well as a command line client with such an embedded server. + +%package -n mysql-embedded-devel%{product_suffix} + +Summary: Development files for MySQL as an embeddable library +Group: Applications/Databases +Requires: mysql-embedded%{product_suffix} = %{version}-%{release} +Requires: mysql-devel%{product_suffix} = %{version}-%{release} +Provides: mysql-embedded-devel +Obsoletes: mysql-embedded-devel mysql-embedded-devel-advanced + +%description -n mysql-embedded-devel%{product_suffix} +MySQL is a multi-user, multi-threaded SQL database server. This +package contains files needed for developing and testing with +the embedded version of the MySQL server. + +%package -n mysql-test%{product_suffix} + +Summary: The test suite distributed with MySQL +Group: Applications/Databases +Requires: mysql%{product_suffix} = %{version}-%{release} +Requires: mysql-server%{product_suffix} = %{version}-%{release} +Provides: mysql-test +Conflicts: MySQL-test +Obsoletes: mysql-test mysql-test-advanced + +%description -n mysql-test%{product_suffix} +MySQL is a multi-user, multi-threaded SQL database server. This +package contains the regression test suite distributed with +the MySQL sources. + +%prep +%setup -T -a 0 -c -n %{src_dir} + +cd %{src_dir} # read about "%setup -n" +# %patch1 -p1 +%patch2 -p1 +# %patch4 -p1 TODO / FIXME: if wanted, needs to be adapted to new mysql-test-run setup +%patch5 -p1 +%patch6 -p1 +# %patch8 -p1 +# %patch9 -p1 +# %patch10 -p1 +# %patch13 -p1 +# %patch14 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 + +# workaround for upstream bug #56342 +rm -f mysql-test/t/ssl_8k_key-master.opt + +%build + +# fail quickly and obviously if user tries to build as root +%if %runselftest + if [ x"`id -u`" = x0 ]; then + echo "mysql's regression tests fail if run as root." + echo "If you really need to build the RPM as root, use" + echo "--define='runselftest 0' to skip the regression tests." + exit 1 + fi +%endif + +# Be strict about variables, bail at earliest opportunity, etc. +set -eu + +# Optional package files +touch optional-files-devel + +# +# Set environment in order of preference, MYSQL_BUILD_* first, then variable +# name, finally a default. RPM_OPT_FLAGS is assumed to be a part of the +# default RPM build environment. +# +# We set CXX=gcc by default to support so-called 'generic' binaries, where we +# do not have a dependancy on libgcc/libstdc++. This only works while we do +# not require C++ features such as exceptions, and may need to be removed at +# a later date. +# + +# This is a hack, $RPM_OPT_FLAGS on ia64 hosts contains flags which break +# the compile in cmd-line-utils/readline - needs investigation, but for now +# we simply unset it and use those specified directly in cmake. +%if "%{_arch}" == "ia64" +RPM_OPT_FLAGS= +%endif + +# This goes in sync with Patch19. "rm" is faster than "patch" for this. +rm -rf %{src_dir}/mysql-test/lib/v1 + +export PATH=${MYSQL_BUILD_PATH:-$PATH} +export CC=${MYSQL_BUILD_CC:-${CC:-gcc}} +export CXX=${MYSQL_BUILD_CXX:-${CXX:-gcc}} +export CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}} +# Following "%ifarch" developed by RedHat, MySQL/Oracle does not support/maintain Linux/Sparc: +# gcc seems to have some bugs on sparc as of 4.4.1, back off optimization +# submitted as bz #529298 +%ifarch sparc sparcv9 sparc64 +CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" ` +%endif +export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti}} +export LDFLAGS=${MYSQL_BUILD_LDFLAGS:-${LDFLAGS:-}} +export CMAKE=${MYSQL_BUILD_CMAKE:-${CMAKE:-cmake}} +export MAKE_JFLAG=${MYSQL_BUILD_MAKE_JFLAG:-%{?_smp_mflags}} + +# Build debug mysqld and libmysqld.a +mkdir debug +( + cd debug + # Attempt to remove any optimisation flags from the debug build + CFLAGS=`echo " ${CFLAGS} " | \ + sed -e 's/ -O[0-9]* / /' \ + -e 's/ -unroll2 / /' \ + -e 's/ -ip / /' \ + -e 's/^ //' \ + -e 's/ $//'` + CXXFLAGS=`echo " ${CXXFLAGS} " | \ + sed -e 's/ -O[0-9]* / /' \ + -e 's/ -unroll2 / /' \ + -e 's/ -ip / /' \ + -e 's/^ //' \ + -e 's/ $//'` + # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before + # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM + ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \ + -DCMAKE_BUILD_TYPE=Debug \ + -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \ + -DFEATURE_SET="%{feature_set}" \ + -DCOMPILATION_COMMENT="%{compilation_comment_debug}" \ + -DMYSQL_SERVER_SUFFIX="%{server_suffix}" + echo BEGIN_DEBUG_CONFIG ; egrep '^#define' include/config.h ; echo END_DEBUG_CONFIG + make ${MAKE_JFLAG} VERBOSE=1 +) +# Build full release +mkdir release +( + cd release + # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before + # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM + ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \ + -DFEATURE_SET="%{feature_set}" \ + -DCOMPILATION_COMMENT="%{compilation_comment_release}" \ + -DMYSQL_SERVER_SUFFIX="%{server_suffix}" + echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG + make ${MAKE_JFLAG} VERBOSE=1 +) + +# TODO / FIXME: Do we need "scriptstub"? +gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql\"" %{SOURCE4} + +# TODO / FIXME: "libmysqld.so" should have been produced above - WORK in PROGRESS +# regular build will make libmysqld.a but not libmysqld.so :-( +cd release +mkdir libmysqld/work +cd libmysqld/work +ar -x ../libmysqld.a +rm rpl_utility.cc.o sql_binlog.cc.o # Try-and-Error: These modules cause unresolved references +gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o libmysqld.so.0.0.1 \ + *.o \ + -lpthread -lcrypt -laio -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc +# this is to check that we built a complete library +cp %{SOURCE9} . +ln -s libmysqld.so.0.0.1 libmysqld.so.0 +gcc -I../../include -I../../../%{src_dir}/include $CFLAGS mysql-embedded-check.c libmysqld.so.0 +LD_LIBRARY_PATH=. ldd ./a.out +cd ../.. +cd .. + +# TODO / FIXME: autotools only? +# make check + +# TODO / FIXME: Test suite is run elsewhere in release builds - +# do we need this for users who want to build from source? +# Also, check whether MTR_BUILD_THREAD=auto would solve all issues +%if %runselftest + # hack to let 32- and 64-bit tests run concurrently on same build machine + case `uname -m` in + ppc64 | s390x | x86_64 | sparc64 ) + MTR_BUILD_THREAD=7 + ;; + *) + MTR_BUILD_THREAD=11 + ;; + esac + export MTR_BUILD_THREAD + + # if you want to change which tests are run, look at mysql-5.5-testing.patch too. + (cd release && make test-bt-fast ) +%endif + +%install +RBR=$RPM_BUILD_ROOT +MBD=$RPM_BUILD_DIR/%{src_dir} +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + +# Ensure that needed directories exists +# TODO / FIXME: needed ? install -d $RBR%{mysqldatadir}/mysql +# TODO / FIXME: needed ? install -d $RBR%{_datadir}/mysql-test +# TODO / FIXME: needed ? install -d $RBR%{_datadir}/mysql/SELinux/RHEL4 +# TODO / FIXME: needed ? install -d $RBR%{_includedir} +# TODO / FIXME: needed ? install -d $RBR%{_libdir} +# TODO / FIXME: needed ? install -d $RBR%{_mandir} +# TODO / FIXME: needed ? install -d $RBR%{_sbindir} + +# Install all binaries +( + cd $MBD/release + make DESTDIR=$RBR install +) + +# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921). Do +# this in a sub-shell to ensure we don't pollute the install environment +# with compiler bits. +( + PATH=${MYSQL_BUILD_PATH:-$PATH} + CC=${MYSQL_BUILD_CC:-${CC:-gcc}} + CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}} + if "${CC}" -v 2>&1 | grep '^gcc.version' >/dev/null 2>&1; then + libgcc=`${CC} ${CFLAGS} --print-libgcc-file` + if [ -f ${libgcc} ]; then + mkdir -p $RBR%{_libdir}/mysql + install -m 644 ${libgcc} $RBR%{_libdir}/mysql/libmygcc.a + echo "%{_libdir}/mysql/libmygcc.a" >>optional-files-devel + fi + fi +) + +# multilib header hacks +# we only apply this to known Red Hat multilib arches, per bug #181335 +case `uname -i` in + i386 | x86_64 | ppc | ppc64 | s390 | s390x | sparc | sparc64 ) + mv $RPM_BUILD_ROOT/usr/include/mysql/my_config.h $RPM_BUILD_ROOT/usr/include/mysql/my_config_`uname -i`.h + install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/usr/include/mysql/ + ;; + *) + ;; +esac + +mkdir -p $RPM_BUILD_ROOT/var/log +touch $RPM_BUILD_ROOT/var/log/mysqld.log + +# List the installed tree for RPM package maintenance purposes. +find $RPM_BUILD_ROOT -print | sed "s|^$RPM_BUILD_ROOT||" | sort > ROOTFILES + +mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d +mkdir -p $RPM_BUILD_ROOT/var/run/mysqld +install -m 0755 -d $RPM_BUILD_ROOT/var/lib/mysql +install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysqld +install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/etc/my.cnf +# obsolete: mv $RPM_BUILD_ROOT/usr/sql-bench $RPM_BUILD_ROOT%{_datadir}/sql-bench # 'sql-bench' is dropped +# obsolete: mv $RPM_BUILD_ROOT/usr/mysql-test $RPM_BUILD_ROOT%{_datadir}/mysql-test # 'mysql-test' is there already +# 5.1.32 forgets to install the mysql-test README file +# obsolete: install -m 0644 mysql-test/README $RPM_BUILD_ROOT%{_datadir}/mysql-test/README # 'README' is there already + +mv ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysqlbug +install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug +mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysql_config +install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysql_config + +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a +install -m 0755 release/libmysqld/work/libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0.0.1 +ln -s libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0 +ln -s libmysqld.so.0 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so + +rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1* +rm -f ${RPM_BUILD_ROOT}%{_bindir}/make_win_binary_distribution +rm -f ${RPM_BUILD_ROOT}%{_bindir}/make_win_src_distribution +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/make_win_bin_dist.1* +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/make_win_src_distribution.1* +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient*.la +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/*.a +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/plugin/*.la +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/plugin/*.a +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/binary-configure +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/make_binary_distribution +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/make_sharedlib_distribution +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mi_test_all* +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ndb-config-2-node.ini +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql.server +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysqld_multi.server +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/MySQL-shared-compat.spec +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/*.plist +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/preinstall +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/postinstall +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-*.spec +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ChangeLog +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-stress-test.pl.1* +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-test-run.pl.1* + +mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d +echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf + +# The below *only* applies to builds not done by MySQL / Sun / Oracle: +# copy additional docs into build tree so %%doc will find them +# cp %{SOURCE6} README.mysql-docs + +%clean +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + +%pre -n mysql-server%{product_suffix} +/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || : +/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \ + -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || : + +%post -n mysql-libs%{product_suffix} +/sbin/ldconfig + +%post -n mysql-server%{product_suffix} +if [ $1 = 1 ]; then + /sbin/chkconfig --add mysqld +fi +/bin/chmod 0755 /var/lib/mysql +/bin/touch /var/log/mysqld.log + +%preun -n mysql-server%{product_suffix} +if [ $1 = 0 ]; then + /sbin/service mysqld stop >/dev/null 2>&1 + /sbin/chkconfig --del mysqld +fi + +%postun -n mysql-libs%{product_suffix} +if [ $1 = 0 ] ; then + /sbin/ldconfig +fi + +%postun -n mysql-server%{product_suffix} +if [ $1 -ge 1 ]; then + /sbin/service mysqld condrestart >/dev/null 2>&1 || : +fi + + +%files -n mysql%{product_suffix} +%defattr(-,root,root) +%doc %{license_files_server} + +# The below file *only* applies to builds not done by MySQL / Sun / Oracle: +# %doc README.mysql-docs + +%{_bindir}/msql2mysql +%{_bindir}/mysql +%{_bindir}/mysql_config +%{_bindir}/mysql_find_rows +%{_bindir}/mysql_waitpid +%{_bindir}/mysqlaccess +%{_bindir}/mysqlaccess.conf +%{_bindir}/mysqladmin +%{_bindir}/mysqlbinlog +%{_bindir}/mysqlcheck +%{_bindir}/mysqldump +%{_bindir}/mysqlimport +%{_bindir}/mysqlshow +%{_bindir}/mysqlslap +%{_bindir}/my_print_defaults + +%{_mandir}/man1/mysql.1* +%{_mandir}/man1/mysql_config.1* +%{_mandir}/man1/mysql_find_rows.1* +%{_mandir}/man1/mysql_waitpid.1* +%{_mandir}/man1/mysqlaccess.1* +%{_mandir}/man1/mysqladmin.1* +%{_mandir}/man1/mysqldump.1* +%{_mandir}/man1/mysqlshow.1* +%{_mandir}/man1/mysqlslap.1* +%{_mandir}/man1/my_print_defaults.1* + +%{_libdir}/mysql/mysqlbug +%{_libdir}/mysql/mysql_config + +%files -n mysql-libs%{product_suffix} +%defattr(-,root,root) +%doc %{license_files_server} +# although the default my.cnf contains only server settings, we put it in the +# libs package because it can be used for client settings too. +%config(noreplace) /etc/my.cnf +%dir %{_libdir}/mysql +%{_libdir}/mysql/libmysqlclient*.so.* +/etc/ld.so.conf.d/* + +%dir %{_datadir}/mysql +%{_datadir}/mysql/english +%lang(cs) %{_datadir}/mysql/czech +%lang(da) %{_datadir}/mysql/danish +%lang(nl) %{_datadir}/mysql/dutch +%lang(et) %{_datadir}/mysql/estonian +%lang(fr) %{_datadir}/mysql/french +%lang(de) %{_datadir}/mysql/german +%lang(el) %{_datadir}/mysql/greek +%lang(hu) %{_datadir}/mysql/hungarian +%lang(it) %{_datadir}/mysql/italian +%lang(ja) %{_datadir}/mysql/japanese +%lang(ko) %{_datadir}/mysql/korean +%lang(no) %{_datadir}/mysql/norwegian +%lang(no) %{_datadir}/mysql/norwegian-ny +%lang(pl) %{_datadir}/mysql/polish +%lang(pt) %{_datadir}/mysql/portuguese +%lang(ro) %{_datadir}/mysql/romanian +%lang(ru) %{_datadir}/mysql/russian +%lang(sr) %{_datadir}/mysql/serbian +%lang(sk) %{_datadir}/mysql/slovak +%lang(es) %{_datadir}/mysql/spanish +%lang(sv) %{_datadir}/mysql/swedish +%lang(uk) %{_datadir}/mysql/ukrainian +%{_datadir}/mysql/charsets + +%files -n mysql-server%{product_suffix} -f release/support-files/plugins.files +%defattr(-,root,root) +%doc release/support-files/*.cnf +%doc %{_datadir}/info/mysql.info* +%doc %{src_dir}/Docs/ChangeLog +%doc %{src_dir}/Docs/INFO_SRC* +%doc release/Docs/INFO_BIN* + +%{_bindir}/myisamchk +%{_bindir}/myisam_ftdump +%{_bindir}/myisamlog +%{_bindir}/myisampack +%{_bindir}/mysql_convert_table_format +%{_bindir}/mysql_fix_extensions +%{_bindir}/mysql_install_db +%{_bindir}/mysql_plugin +%{_bindir}/mysql_secure_installation +%if %{commercial} +%else +%{_bindir}/mysql_setpermission +%endif +%{_bindir}/mysql_tzinfo_to_sql +%{_bindir}/mysql_upgrade +%{_bindir}/mysql_zap +%{_bindir}/mysqlbug +%{_bindir}/mysqldumpslow +%{_bindir}/mysqld_multi +%{_bindir}/mysqld_safe +%{_bindir}/mysqlhotcopy +%{_bindir}/mysqltest +%{_bindir}/innochecksum +%{_bindir}/perror +%{_bindir}/replace +%{_bindir}/resolve_stack_dump +%{_bindir}/resolveip + +/usr/libexec/mysqld +/usr/libexec/mysqld-debug +%{_libdir}/mysql/plugin/daemon_example.ini + +%if %{WITH_TCMALLOC} +%{_libdir}/mysql/%{malloc_lib_target} +%endif + +# obsolete by "-f release/support-files/plugins.files" above +# %{_libdir}/mysql/plugin + +%{_mandir}/man1/msql2mysql.1* +%{_mandir}/man1/myisamchk.1* +%{_mandir}/man1/myisamlog.1* +%{_mandir}/man1/myisampack.1* +%{_mandir}/man1/mysql_convert_table_format.1* +%{_mandir}/man1/myisam_ftdump.1* +%{_mandir}/man1/mysql.server.1* +%{_mandir}/man1/mysql_fix_extensions.1* +%{_mandir}/man1/mysql_install_db.1* +%{_mandir}/man1/mysql_plugin.1* +%{_mandir}/man1/mysql_secure_installation.1* +%{_mandir}/man1/mysql_upgrade.1* +%{_mandir}/man1/mysql_zap.1* +%{_mandir}/man1/mysqlbug.1* +%{_mandir}/man1/mysqldumpslow.1* +%{_mandir}/man1/mysqlbinlog.1* +%{_mandir}/man1/mysqlcheck.1* +%{_mandir}/man1/mysqld_multi.1* +%{_mandir}/man1/mysqld_safe.1* +%{_mandir}/man1/mysqlhotcopy.1* +%{_mandir}/man1/mysqlimport.1* +%{_mandir}/man1/mysqlman.1* +%if %{commercial} +%else +%{_mandir}/man1/mysql_setpermission.1* +%endif +%{_mandir}/man1/mysqltest.1* +%{_mandir}/man1/innochecksum.1* +%{_mandir}/man1/perror.1* +%{_mandir}/man1/replace.1* +%{_mandir}/man1/resolve_stack_dump.1* +%{_mandir}/man1/resolveip.1* +%{_mandir}/man1/mysql_tzinfo_to_sql.1* +%{_mandir}/man8/mysqld.8* + +%{_datadir}/mysql/errmsg-utf8.txt +%{_datadir}/mysql/fill_help_tables.sql +%{_datadir}/mysql/magic +%{_datadir}/mysql/mysql_system_tables.sql +%{_datadir}/mysql/mysql_system_tables_data.sql +%{_datadir}/mysql/mysql_test_data_timezone.sql +%{_datadir}/mysql/my-*.cnf +%{_datadir}/mysql/config.*.ini + +/etc/rc.d/init.d/mysqld +%attr(0755,mysql,mysql) %dir /var/run/mysqld +%attr(0755,mysql,mysql) %dir /var/lib/mysql +%attr(0640,mysql,mysql) %config(noreplace) %verify(not md5 size mtime) /var/log/mysqld.log + +# TODO / FIXME: Do we need "libmygcc.a"? If yes, append "-f optional-files-devel" +# and fix the "rm -f" list in the "install" section. +%files -n mysql-devel%{product_suffix} +%defattr(-,root,root) +/usr/include/mysql +/usr/share/aclocal/mysql.m4 +%{_libdir}/mysql/libmysqlclient*.so + +%files -n mysql-embedded%{product_suffix} +%defattr(-,root,root) +%doc %{license_files_server} +%{_libdir}/mysql/libmysqld.so.* +%{_bindir}/mysql_embedded + +%files -n mysql-embedded-devel%{product_suffix} +%defattr(-,root,root) +%{_libdir}/mysql/libmysqld.so +%{_bindir}/mysql_client_test_embedded +%{_bindir}/mysqltest_embedded +%{_mandir}/man1/mysql_client_test_embedded.1* +%{_mandir}/man1/mysqltest_embedded.1* + +%files -n mysql-test%{product_suffix} +%defattr(-,root,root) +%{_bindir}/mysql_client_test +%attr(-,mysql,mysql) %{_datadir}/mysql-test + +%{_mandir}/man1/mysql_client_test.1* + +%changelog +* Mon Feb 13 2012 Joerg Bruehe +- Add "Provides:" lines for the generic names of the subpackages, + independent of "product_suffix". + +* Tue Feb 7 2012 Joerg Bruehe +- Make "mysql_setpermission" and its man page appear in GPL builds only. + +* Thu Nov 24 2011 Joerg Bruehe +- Add two patches (#18 + #19) regarding the test suite; + version 1 of "mysql-test-run.pl" had to go because the auto-detection + of Perl dependencies does not handle differences between run directory + and delivery location. + +* Thu Nov 3 2011 Joerg Bruehe +- Adapt from MySQL 5.1 to 5.5, tested using 5.5.17: + - Done by the MySQL Build Team at Oracle: + set as packager, set copyright owner and related info; + - handle command line options, allowing different configurations, platforms, ... + - configurations will show up in the file name as "product_suffix", + - use "-n" for all subpackage specifications, + - license may be GPL or commercial, mention that in the description, + the license output and the included license files will vary, + - commercial is "nosource", + - improve "requires" listings for different platforms, + - explicitly use "product_suffix" in the "requires" entries; + - adapt to 5.5 changes in features and function: + - remove "mysql-bench" package (files are outdated, not maintained), + - no InnoDB plugin, + - the set of plugins will vary by configuration, to control the "server" + package contents use "-f release/support-files/plugins.files" in the + "files" section, + - remove "mysqlmanager", "mysql_fix_privilege_tables", + - add "mysql_embedded", "mysql-plugin", "mysqlaccess.conf", "magic", + - "errmsg.txt" is now in UTF8: "errmsg-utf8.txt", + - adapt patches to changed code where needed, rename these to include "5.5", + - stop using patches which are not applicable to 5.5; + - 5.5 uses a different way of building: + - autotools are replaced by cmake, + - both a "release" and a "debug" server are built in separate subtrees + ("out of source"!), this also affects path names in further handling, + - the debug server is added to the "server" subpackage, + - add "mysql-5.5-libdir.patch" to handle file placement at user site. + +* Mon Dec 20 2010 Tom Lane 5.1.52-1.1 +- Update to MySQL 5.1.52, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-52.html + including numerous small security issues +Resolves: #652553 +- Sync with current Fedora package; this includes: +- Duplicate COPYING and EXCEPTIONS-CLIENT in -libs and -embedded subpackages, + to ensure they are available when any subset of mysql RPMs are installed, + per revised packaging guidelines +- Allow init script's STARTTIMEOUT/STOPTIMEOUT to be overridden from sysconfig + +* Thu Jul 15 2010 Tom Lane 5.1.47-4 +- Add backported patch for CVE-2010-2008 (upstream bug 53804) +Resolves: #614215 +- Add BuildRequires perl(Time::HiRes) ... seems to no longer be installed + by just pulling in perl. + +* Mon Jun 28 2010 Tom Lane 5.1.47-3 +- Add -p "$mypidfile" to initscript's status call to improve corner cases. + (Note: can't be fixed in Fedora until 595597 is fixed there.) +Resolves: #596008 + +* Mon Jun 7 2010 Tom Lane 5.1.47-2 +- Add back "partition" storage engine +Resolves: #598585 +- Fix broken "federated" storage engine plugin +Resolves: #587170 +- Read all certificates in SSL certificate files, to support chained certs +Resolves: #598656 + +* Mon May 24 2010 Tom Lane 5.1.47-1 +- Update to MySQL 5.1.47, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-47.html + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-46.html + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-45.html + including fixes for CVE-2010-1621, CVE-2010-1626, + CVE-2010-1848, CVE-2010-1849, CVE-2010-1850 +Resolves: #590598 +- Create mysql group explicitly in pre-server script, to ensure correct GID + +* Mon Mar 8 2010 Tom Lane 5.1.44-2 +- Update to MySQL 5.1.44, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-44.html +Resolves: #565554 +- Remove mysql.info, which is not freely redistributable +Related: #560181 +- Revert broken upstream fix for their bug 45058 +Related: #566547 +- Bring init script into some modicum of compliance with Fedora/LSB standards +Resolves: #557711 +Resolves: #562749 + +* Mon Feb 15 2010 Tom Lane 5.1.43-2 +- Update to MySQL 5.1.43, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-43.html +Resolves: #565554 +- Remove mysql-cluster, which is no longer supported by upstream in this + source distribution. If we want it we'll need a separate SRPM for it. +Resolves: #565210 + +* Fri Jan 29 2010 Tom Lane 5.1.42-7 +- Add backported patch for CVE-2008-7247 (upstream bug 39277) +Resolves: #549329 +- Use non-expired certificates for SSL testing (upstream bug 50702) + +* Tue Jan 26 2010 Tom Lane 5.1.42-6 +- Emit explicit error message if user tries to build RPM as root +Resolves: #558915 + +* Wed Jan 20 2010 Tom Lane 5.1.42-5 +- Correct Source0: tag and comment to reflect how to get the tarball + +* Fri Jan 8 2010 Tom Lane 5.1.42-4 +- Sync with current Fedora build, including: +- Update to MySQL 5.1.42, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-42.html +- Disable symbolic links by default in /etc/my.cnf +Resolves: #553653 +- Remove static libraries (.a files) from package, per packaging guidelines +- Change %%define to %%global, per packaging guidelines +- Disable building the innodb plugin; it tickles assorted gcc bugs and + doesn't seem entirely ready for prime time anyway. +Resolves: #553632 +- Start mysqld_safe with --basedir=/usr, to avoid unwanted SELinux messages + (see 547485) +- Stop waiting during "service mysqld start" if mysqld_safe exits +Resolves: #544095 + +* Mon Nov 23 2009 Tom Lane 5.1.41-1 +- Update to MySQL 5.1.41, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-41.html + including fixes for CVE-2009-4019 +Resolves: #549327 +- Don't set old_passwords=1; we aren't being bug-compatible with 3.23 anymore +Resolves: #540735 + +* Tue Nov 10 2009 Tom Lane 5.1.40-1 +- Update to MySQL 5.1.40, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-40.html +- Do not force the --log-error setting in mysqld init script +Resolves: #533736 + +* Sat Oct 17 2009 Tom Lane 5.1.39-4 +- Replace kluge fix for ndbd sparc crash with a real fix (mysql bug 48132) + +* Thu Oct 15 2009 Tom Lane 5.1.39-3 +- Work around two different compiler bugs on sparc, one by backing off + optimization from -O2 to -O1, and the other with a klugy patch +Related: #529298, #529299 +- Clean up bogosity in multilib stub header support: ia64 should not be + listed (it's not multilib), sparc and sparc64 should be + +* Wed Sep 23 2009 Tom Lane 5.1.39-2 +- Work around upstream bug 46895 by disabling outfile_loaddata test + +* Tue Sep 22 2009 Tom Lane 5.1.39-1 +- Update to MySQL 5.1.39, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-39.html + +* Mon Aug 31 2009 Tom Lane 5.1.37-5 +- Work around unportable assumptions about stpcpy(); re-enable main.mysql test +- Clean up some obsolete parameters to the configure script + +* Sat Aug 29 2009 Tom Lane 5.1.37-4 +- Remove one misguided patch; turns out I was chasing a glibc bug +- Temporarily disable "main.mysql" test; there's something broken there too, + but we need to get mysql built in rawhide for dependency reasons + +* Fri Aug 21 2009 Tomas Mraz - 5.1.37-3 +- rebuilt with new openssl + +* Fri Aug 14 2009 Tom Lane 5.1.37-2 +- Add a couple of patches to improve the probability of the regression tests + completing in koji builds + +* Sun Aug 2 2009 Tom Lane 5.1.37-1 +- Update to MySQL 5.1.37, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-37.html + +* Sat Jul 25 2009 Fedora Release Engineering - 5.1.36-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Jul 10 2009 Tom Lane 5.1.36-1 +- Update to MySQL 5.1.36, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-36.html + +* Sat Jun 6 2009 Tom Lane 5.1.35-1 +- Update to MySQL 5.1.35, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-35.html +- Ensure that /var/lib/mysql is created with the right SELinux context +Resolves: #502966 + +* Fri May 15 2009 Tom Lane 5.1.34-1 +- Update to MySQL 5.1.34, for various fixes described at + http://dev.mysql.com/doc/refman/5.1/en/news-5-1-34.html +- Increase startup timeout per bug #472222 + +* Wed Apr 15 2009 Tom Lane 5.1.33-2 +- Increase stack size of ndbd threads for safety's sake. +Related: #494631 + +* Tue Apr 7 2009 Tom Lane 5.1.33-1 +- Update to MySQL 5.1.33. +- Disable use of pthread_setschedparam; doesn't work the way code expects. +Related: #477624 + +* Wed Mar 4 2009 Tom Lane 5.1.32-1 +- Update to MySQL 5.1.32. + +* Wed Feb 25 2009 Fedora Release Engineering - 5.1.31-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Fri Feb 13 2009 Tom Lane 5.1.31-1 +- Update to MySQL 5.1.31. + +* Thu Jan 22 2009 Tom Lane 5.1.30-2 +- hm, apparently --with-innodb and --with-ndbcluster are still needed + even though no longer documented ... + +* Thu Jan 22 2009 Tom Lane 5.1.30-1 +- Update to MySQL 5.1.30. Note that this includes an ABI break for + libmysqlclient (it's now got .so major version 16). +- This also updates mysql for new openssl build + +* Wed Oct 1 2008 Tom Lane 5.0.67-2 +- Build the "embedded server" library, and package it in a new sub-RPM + mysql-embedded, along with mysql-embedded-devel for devel support files. +Resolves: #149829 + +* Sat Aug 23 2008 Tom Lane 5.0.67-1 +- Update to mysql version 5.0.67 +- Move mysql_config's man page to base package, again (apparently I synced + that change the wrong way while importing specfile changes for ndbcluster) + +* Sun Jul 27 2008 Tom Lane 5.0.51a-2 +- Enable ndbcluster support +Resolves: #163758 +- Suppress odd crash messages during package build, caused by trying to + build dbug manual (which we don't install anyway) with dbug disabled +Resolves: #437053 +- Improve mysql.init to pass configured datadir to mysql_install_db, + and to force user=mysql for both mysql_install_db and mysqld_safe. +Related: #450178 + +* Mon Mar 3 2008 Tom Lane 5.0.51a-1 +- Update to mysql version 5.0.51a + +* Mon Mar 3 2008 Tom Lane 5.0.45-11 +- Fix mysql-stack-guard patch to work correctly on IA64 +- Fix mysql.init to wait correctly when socket is not in default place +Related: #435494 + +* Mon Mar 03 2008 Dennis Gilmore 5.0.45-10 +- add sparc64 to 64 bit arches for test suite checking +- add sparc, sparcv9 and sparc64 to multilib handling + +* Thu Feb 28 2008 Tom Lane 5.0.45-9 +- Fix the stack overflow problem encountered in January. It seems the real +issue is that the buildfarm machines were moved to RHEL5, which uses 64K not +4K pages on PPC, and because RHEL5 takes the guard area out of the requested +thread stack size we no longer had enough headroom. +Related: #435337 + +* Tue Feb 19 2008 Fedora Release Engineering - 5.0.45-8 +- Autorebuild for GCC 4.3 + +* Tue Jan 8 2008 Tom Lane 5.0.45-7 +- Unbelievable ... upstream still thinks that it's a good idea to have a + regression test that is guaranteed to begin failing come January 1. +- ... and it seems we need to raise STACK_MIN_SIZE again too. + +* Thu Dec 13 2007 Tom Lane 5.0.45-6 +- Back-port upstream fixes for CVE-2007-5925, CVE-2007-5969, CVE-2007-6303. +Related: #422211 + +* Wed Dec 5 2007 Tom Lane 5.0.45-5 +- Rebuild for new openssl + +* Sat Aug 25 2007 Tom Lane 5.0.45-4 +- Seems we need explicit BuildRequires on gawk and procps now +- Rebuild to fix Fedora toolchain issues + +* Sun Aug 12 2007 Tom Lane 5.0.45-3 +- Recent perl changes in rawhide mean we need a more specific BuildRequires + +* Thu Aug 2 2007 Tom Lane 5.0.45-2 +- Update License tag to match code. +- Work around recent Fedora change that makes "open" a macro name. + +* Sun Jul 22 2007 Tom Lane 5.0.45-1 +- Update to MySQL 5.0.45 +Resolves: #246535 +- Move mysql_config's man page to base package +Resolves: #245770 +- move my_print_defaults to base RPM, for consistency with Stacks packaging +- mysql user is no longer deleted at RPM uninstall +Resolves: #241912 + +* Thu Mar 29 2007 Tom Lane 5.0.37-2 +- Use a less hacky method of getting default values in initscript +Related: #233771, #194596 +- Improve packaging of mysql-libs per suggestions from Remi Collet +Resolves: #233731 +- Update default /etc/my.cnf ([mysql.server] has been bogus for a long time) + +* Mon Mar 12 2007 Tom Lane 5.0.37-1 +- Update to MySQL 5.0.37 +Resolves: #231838 +- Put client library into a separate mysql-libs RPM to reduce dependencies +Resolves: #205630 + +* Fri Feb 9 2007 Tom Lane 5.0.33-1 +- Update to MySQL 5.0.33 +- Install band-aid fix for "view" regression test designed to fail after 2006 +- Don't chmod -R the entire database directory tree on every startup +Related: #221085 +- Fix unsafe use of install-info +Resolves: #223713 +- Cope with new automake in F7 +Resolves: #224171 + +* Thu Nov 9 2006 Tom Lane 5.0.27-1 +- Update to MySQL 5.0.27 (see CVE-2006-4031, CVE-2006-4226, CVE-2006-4227) +Resolves: #202247, #202675, #203427, #203428, #203432, #203434, #208641 +- Fix init script to return status 1 on server start timeout +Resolves: #203910 +- Move mysqldumpslow from base package to mysql-server +Resolves: #193559 +- Adjust link options for BDB module +Resolves: #199368 + +* Wed Jul 12 2006 Jesse Keating - 5.0.22-2.1 +- rebuild + +* Sat Jun 10 2006 Tom Lane 5.0.22-2 +- Work around brew's tendency not to clean up failed builds completely, + by adding code in mysql-testing.patch to kill leftover mysql daemons. + +* Thu Jun 8 2006 Tom Lane 5.0.22-1 +- Update to MySQL 5.0.22 (fixes CVE-2006-2753) +- Install temporary workaround for gcc bug on s390x (bz #193912) + +* Tue May 2 2006 Tom Lane 5.0.21-2 +- Fix bogus perl Requires for mysql-test + +* Mon May 1 2006 Tom Lane 5.0.21-1 +- Update to MySQL 5.0.21 + +* Mon Mar 27 2006 Tom Lane 5.0.18-4 +- Modify multilib header hack to not break non-RH arches, per bug #181335 +- Remove logrotate script, per bug #180639. +- Add a new mysql-test RPM to carry the regression test files; + hack up test scripts as needed to make them run in /usr/share/mysql-test. + +* Fri Feb 10 2006 Jesse Keating - 5.0.18-2.1 +- bump again for double-long bug on ppc(64) + +* Thu Feb 9 2006 Tom Lane 5.0.18-2 +- err-log option has been renamed to log-error, fix my.cnf and initscript + +* Tue Feb 07 2006 Jesse Keating - 5.0.18-1.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Thu Jan 5 2006 Tom Lane 5.0.18-1 +- Update to MySQL 5.0.18 + +* Thu Dec 15 2005 Tom Lane 5.0.16-4 +- fix my_config.h for ppc platforms + +* Thu Dec 15 2005 Tom Lane 5.0.16-3 +- my_config.h needs to guard against 64-bit platforms that also define the + 32-bit symbol + +* Wed Dec 14 2005 Tom Lane 5.0.16-2 +- oops, looks like we want uname -i not uname -m + +* Mon Dec 12 2005 Tom Lane 5.0.16-1 +- Update to MySQL 5.0.16 +- Add EXCEPTIONS-CLIENT license info to the shipped documentation +- Make my_config.h architecture-independent for multilib installs; + put the original my_config.h into my_config_$ARCH.h +- Add -fwrapv to CFLAGS so that gcc 4.1 doesn't break it + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Mon Nov 14 2005 Tom Lane 5.0.15-3 +- Make stop script wait for daemon process to disappear (bz#172426) + +* Wed Nov 9 2005 Tom Lane 5.0.15-2 +- Rebuild due to openssl library update. + +* Thu Nov 3 2005 Tom Lane 5.0.15-1 +- Update to MySQL 5.0.15 (scratch build for now) + +* Wed Oct 5 2005 Tom Lane 4.1.14-1 +- Update to MySQL 4.1.14 + +* Tue Aug 23 2005 Tom Lane 4.1.12-3 +- Use politically correct patch name. + +* Tue Jul 12 2005 Tom Lane 4.1.12-2 +- Fix buffer overflow newly exposed in isam code; it's the same issue + previously found in myisam, and not very exciting, but I'm tired of + seeing build warnings. + +* Mon Jul 11 2005 Tom Lane 4.1.12-1 +- Update to MySQL 4.1.12 (includes a fix for bz#158688, bz#158689) +- Extend mysql-test-ssl.patch to solve rpl_openssl test failure (bz#155850) +- Update mysql-lock-ssl.patch to match the upstream committed version +- Add --with-isam to re-enable the old ISAM table type, per bz#159262 +- Add dependency on openssl-devel per bz#159569 +- Remove manual.txt, as upstream decided not to ship it anymore; + it was redundant with the mysql.info file anyway. + +* Mon May 9 2005 Tom Lane 4.1.11-4 +- Include proper locking for OpenSSL in the server, per bz#155850 + +* Mon Apr 25 2005 Tom Lane 4.1.11-3 +- Enable openssl tests during build, per bz#155850 +- Might as well turn on --disable-dependency-tracking + +* Fri Apr 8 2005 Tom Lane 4.1.11-2 +- Avoid dependency on , cause it won't build anymore on ia64. + This is probably a cleaner solution for bz#143537, too. + +* Thu Apr 7 2005 Tom Lane 4.1.11-1 +- Update to MySQL 4.1.11 to fix bz#152911 as well as other issues +- Move perl-DBI, perl-DBD-MySQL dependencies to server package (bz#154123) +- Override configure thread library test to suppress HAVE_LINUXTHREADS check +- Fix BDB failure on s390x (bz#143537) +- At last we can enable "make test" on all arches + +* Fri Mar 11 2005 Tom Lane 4.1.10a-1 +- Update to MySQL 4.1.10a to fix security vulnerabilities (bz#150868, + for CAN-2005-0711, and bz#150871 for CAN-2005-0709, CAN-2005-0710). + +* Sun Mar 6 2005 Tom Lane 4.1.10-3 +- Fix package Requires: interdependencies. + +* Sat Mar 5 2005 Tom Lane 4.1.10-2 +- Need -fno-strict-aliasing in at least one place, probably more. +- Work around some C spec violations in mysql. + +* Fri Feb 18 2005 Tom Lane 4.1.10-1 +- Update to MySQL 4.1.10. + +* Sat Jan 15 2005 Tom Lane 4.1.9-1 +- Update to MySQL 4.1.9. + +* Wed Jan 12 2005 Tom Lane 4.1.7-10 +- Don't assume /etc/my.cnf will specify pid-file (bz#143724) + +* Wed Jan 12 2005 Tim Waugh 4.1.7-9 +- Rebuilt for new readline. + +* Tue Dec 21 2004 Tom Lane 4.1.7-8 +- Run make test on all archs except s390x (which seems to have a bdb issue) + +* Mon Dec 13 2004 Tom Lane 4.1.7-7 +- Suppress someone's silly idea that libtool overhead can be skipped + +* Sun Dec 12 2004 Tom Lane 4.1.7-6 +- Fix init script to not need a valid username for startup check (bz#142328) +- Fix init script to honor settings appearing in /etc/my.cnf (bz#76051) +- Enable SSL (bz#142032) + +* Thu Dec 2 2004 Tom Lane 4.1.7-5 +- Add a restorecon to keep the mysql.log file in the right context (bz#143887) + +* Tue Nov 23 2004 Tom Lane 4.1.7-4 +- Turn off old_passwords in default /etc/my.cnf file, for better compatibility + with mysql 3.x clients (per suggestion from Joe Orton). + +* Fri Oct 29 2004 Tom Lane 4.1.7-3 +- Handle ldconfig more cleanly (put a file in /etc/ld.so.conf.d/). + +* Thu Oct 28 2004 Tom Lane 4.1.7-2 +- rebuild in devel branch + +* Wed Oct 27 2004 Tom Lane 4.1.7-1 +- Update to MySQL 4.1.x. + +* Tue Oct 12 2004 Tom Lane 3.23.58-13 +- fix security issues CAN-2004-0835, CAN-2004-0836, CAN-2004-0837 + (bugs #135372, 135375, 135387) +- fix privilege escalation on GRANT ALL ON `Foo\_Bar` (CAN-2004-0957) + +* Wed Oct 06 2004 Tom Lane 3.23.58-12 +- fix multilib problem with mysqlbug and mysql_config +- adjust chkconfig priority per bug #128852 +- remove bogus quoting per bug #129409 (MySQL 4.0 has done likewise) +- add sleep to mysql.init restart(); may or may not fix bug #133993 + +* Tue Oct 05 2004 Tom Lane 3.23.58-11 +- fix low-priority security issues CAN-2004-0388, CAN-2004-0381, CAN-2004-0457 + (bugs #119442, 125991, 130347, 130348) +- fix bug with dropping databases under recent kernels (bug #124352) + +* Tue Jun 15 2004 Elliot Lee 3.23.58-10 +- rebuilt + +* Sat Apr 17 2004 Warren Togami 3.23.58-9 +- remove redundant INSTALL-SOURCE, manual.* +- compress manual.txt.bz2 +- BR time + +* Tue Mar 16 2004 Tom Lane 3.23.58-8 +- repair logfile attributes in %%files, per bug #102190 +- repair quoting problem in mysqlhotcopy, per bug #112693 +- repair missing flush in mysql_setpermission, per bug #113960 +- repair broken error message printf, per bug #115165 +- delete mysql user during uninstall, per bug #117017 +- rebuilt + +* Tue Mar 02 2004 Elliot Lee +- rebuilt + +* Tue Feb 24 2004 Tom Lane +- fix chown syntax in mysql.init +- rebuild + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Tue Nov 18 2003 Kim Ho 3.23.58-5 +- update mysql.init to use anonymous user (UNKNOWN_MYSQL_USER) for + pinging mysql server (#108779) + +* Mon Oct 27 2003 Kim Ho 3.23.58-4 +- update mysql.init to wait (max 10 seconds) for mysql server to + start (#58732) + +* Mon Oct 27 2003 Patrick Macdonald 3.23.58-3 +- re-enable Berkeley DB support (#106832) +- re-enable ia64 testing + +* Fri Sep 19 2003 Patrick Macdonald 3.23.58-2 +- rebuilt + +* Mon Sep 15 2003 Patrick Macdonald 3.23.58-1 +- upgrade to 3.23.58 for security fix + +* Tue Aug 26 2003 Patrick Macdonald 3.23.57-2 +- rebuilt + +* Wed Jul 02 2003 Patrick Macdonald 3.23.57-1 +- revert to prior version of MySQL due to license incompatibilities + with packages that link against the client. The MySQL folks are + looking into the issue. + +* Wed Jun 18 2003 Patrick Macdonald 4.0.13-4 +- restrict test on ia64 (temporary) + +* Wed Jun 04 2003 Elliot Lee 4.0.13-3 +- rebuilt + +* Thu May 29 2003 Patrick Macdonald 4.0.13-2 +- fix filter-requires-mysql.sh with less restrictive for mysql-bench + +* Wed May 28 2003 Patrick Macdonald 4.0.13-1 +- update for MySQL 4.0 +- back-level shared libraries available in mysqlclient10 package + +* Fri May 09 2003 Patrick Macdonald 3.23.56-2 +- add sql-bench package (#90110) + +* Wed Mar 19 2003 Patrick Macdonald 3.23.56-1 +- upgrade to 3.23.56 for security fixes +- remove patch for double-free (included in 3.23.56) + +* Tue Feb 18 2003 Patrick Macdonald 3.23.54a-11 +- enable thread safe client +- add patch for double free fix + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Mon Jan 13 2003 Karsten Hopp 3.23.54a-9 +- disable checks on s390x + +* Sat Jan 4 2003 Jeff Johnson 3.23.54a-8 +- use internal dep generator. + +* Wed Jan 1 2003 Bill Nottingham 3.23.54a-7 +- fix mysql_config on hammer + +* Sun Dec 22 2002 Tim Powers 3.23.54a-6 +- don't use rpms internal dep generator + +* Tue Dec 17 2002 Elliot Lee 3.23.54a-5 +- Push it into the build system + +* Mon Dec 16 2002 Joe Orton 3.23.54a-4 +- upgrade to 3.23.54a for safe_mysqld fix + +* Thu Dec 12 2002 Joe Orton 3.23.54-3 +- upgrade to 3.23.54 for latest security fixes + +* Tue Nov 19 2002 Jakub Jelinek 3.23.52-5 +- Always include for errno +- Remove unpackaged files + +* Tue Nov 12 2002 Florian La Roche +- do not prereq userdel, not used at all + +* Mon Sep 9 2002 Trond Eivind Glomsrd 3.23.52-4 +- Use %%{_libdir} +- Add patch for x86-64 + +* Wed Sep 4 2002 Jakub Jelinek 3.23.52-3 +- rebuilt with gcc-3.2-7 + +* Thu Aug 29 2002 Trond Eivind Glomsrd 3.23.52-2 +- Add --enable-local-infile to configure - a new option + which doesn't default to the old behaviour (#72885) + +* Fri Aug 23 2002 Trond Eivind Glomsrd 3.23.52-1 +- 3.23.52. Fixes a minor security problem, various bugfixes. + +* Sat Aug 10 2002 Elliot Lee 3.23.51-5 +- rebuilt with gcc-3.2 (we hope) + +* Mon Jul 22 2002 Trond Eivind Glomsrd 3.23.51-4 +- rebuild + +* Thu Jul 18 2002 Trond Eivind Glomsrd 3.23.51-3 +- Fix #63543 and #63542 + +* Thu Jul 11 2002 Trond Eivind Glomsrd 3.23.51-2 +- Turn off bdb on PPC(#68591) +- Turn off the assembly optimizations, for safety. + +* Wed Jun 26 2002 Trond Eivind Glomsrd 3.23.51-1 +- Work around annoying auto* thinking this is a crosscompile +- 3.23.51 + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Mon Jun 10 2002 Trond Eivind Glomsrd 3.23.50-2 +- Add dependency on perl-DBI and perl-DBD-MySQL (#66349) + +* Thu May 30 2002 Trond Eivind Glomsrd 3.23.50-1 +- 3.23.50 + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Mon May 13 2002 Trond Eivind Glomsrd 3.23.49-4 +- Rebuild +- Don't set CXX to gcc, it doesn't work anymore +- Exclude Alpha + +* Mon Apr 8 2002 Trond Eivind Glomsrd 3.23.49-3 +- Add the various .cnf examples as doc files to mysql-server (#60349) +- Don't include manual.ps, it's just 200 bytes with a URL inside (#60349) +- Don't include random files in /usr/share/mysql (#60349) +- langify (#60349) + +* Thu Feb 21 2002 Trond Eivind Glomsrd 3.23.49-2 +- Rebuild + +* Sun Feb 17 2002 Trond Eivind Glomsrd 3.23.49-1 +- 3.23.49 + +* Thu Feb 14 2002 Trond Eivind Glomsrd 3.23.48-2 +- work around perl dependency bug. + +* Mon Feb 11 2002 Trond Eivind Glomsrd 3.23.48-1 +- 3.23.48 + +* Thu Jan 17 2002 Trond Eivind Glomsrd 3.23.47-4 +- Use kill, not mysqladmin, to flush logs and shut down. Thus, + an admin password can be set with no problems. +- Remove reload from init script + +* Wed Jan 16 2002 Trond Eivind Glomsrd 3.23.47-3 +- remove db3-devel from buildrequires, + MySQL has had its own bundled copy since the mid thirties + +* Sun Jan 6 2002 Trond Eivind Glomsrd 3.23.47-1 +- 3.23.47 +- Don't build for alpha, toolchain immature. + +* Mon Dec 3 2001 Trond Eivind Glomsrd 3.23.46-1 +- 3.23.46 +- use -fno-rtti and -fno-exceptions, and set CXX to increase stability. + Recommended by mysql developers. + +* Sun Nov 25 2001 Trond Eivind Glomsrd 3.23.45-1 +- 3.23.45 + +* Wed Nov 14 2001 Trond Eivind Glomsrd 3.23.44-2 +- centralize definition of datadir in the initscript (#55873) + +* Fri Nov 2 2001 Trond Eivind Glomsrd 3.23.44-1 +- 3.23.44 + +* Thu Oct 4 2001 Trond Eivind Glomsrd 3.23.43-1 +- 3.23.43 + +* Mon Sep 10 2001 Trond Eivind Glomsrd 3.23.42-1 +- 3.23.42 +- reenable innodb + +* Tue Aug 14 2001 Trond Eivind Glomsrd 3.23.41-1 +- 3.23.41 bugfix release +- disable innodb, to avoid the broken updates +- Use "mysqladmin flush_logs" instead of kill -HUP in logrotate + script (#51711) + +* Sat Jul 21 2001 Trond Eivind Glomsrd +- 3.23.40, bugfix release +- Add zlib-devel to buildrequires: + +* Fri Jul 20 2001 Trond Eivind Glomsrd +- BuildRequires-tweaking + +* Thu Jun 28 2001 Trond Eivind Glomsrd +- Reenable test, but don't run them for s390, s390x or ia64 +- Make /etc/my.cnf config(noplace). Same for /etc/logrotate.d/mysqld + +* Thu Jun 14 2001 Trond Eivind Glomsrd +- 3.23.29 +- enable innodb +- enable assembly again +- disable tests for now... + +* Tue May 15 2001 Trond Eivind Glomsrd +- 3.23.38 +- Don't use BDB on Alpha - no fast mutexes + +* Tue Apr 24 2001 Trond Eivind Glomsrd +- 3.23.37 +- Add _GNU_SOURCE to the compile flags + +* Wed Mar 28 2001 Trond Eivind Glomsrd +- Make it obsolete our 6.2 PowerTools packages +- 3.23.36 bugfix release - fixes some security issues + which didn't apply to our standard configuration +- Make "make test" part of the build process, except on IA64 + (it fails there) + +* Tue Mar 20 2001 Trond Eivind Glomsrd +- 3.23.35 bugfix release +- Don't delete the mysql user on uninstall + +* Tue Mar 13 2001 Trond Eivind Glomsrd +- 3.23.34a bugfix release + +* Wed Feb 7 2001 Trond Eivind Glomsrd +- added readline-devel to BuildRequires: + +* Tue Feb 6 2001 Trond Eivind Glomsrd +- small i18n-fixes to initscript (action needs $) + +* Tue Jan 30 2001 Trond Eivind Glomsrd +- make it shut down and rotate logs without using mysqladmin + (from #24909) + +* Mon Jan 29 2001 Trond Eivind Glomsrd +- conflict with "MySQL" + +* Tue Jan 23 2001 Trond Eivind Glomsrd +- improve gettextizing + +* Mon Jan 22 2001 Trond Eivind Glomsrd +- 3.23.32 +- fix logrotate script (#24589) + +* Wed Jan 17 2001 Trond Eivind Glomsrd +- gettextize +- move the items in Requires(post): to Requires: in preparation + for an errata for 7.0 when 3.23.31 is released +- 3.23.31 + +* Tue Jan 16 2001 Trond Eivind Glomsrd +- add the log file to the rpm database, and make it 0640 + (#24116) +- as above in logrotate script +- changes to the init sequence - put most of the data + in /etc/my.cnf instead of hardcoding in the init script +- use /var/run/mysqld/mysqld.pid instead of + /var/run/mysqld/pid +- use standard safe_mysqld +- shut down cleaner + +* Mon Jan 08 2001 Trond Eivind Glomsrd +- 3.23.30 +- do an explicit chmod on /var/lib/mysql in post, to avoid + any problems with broken permissons. There is a report + of rm not changing this on its own (#22989) + +* Mon Jan 01 2001 Trond Eivind Glomsrd +- bzipped source +- changed from 85 to 78 in startup, so it starts before + apache (which can use modules requiring mysql) + +* Wed Dec 27 2000 Trond Eivind Glomsrd +- 3.23.29a + +* Tue Dec 19 2000 Trond Eivind Glomsrd +- add requirement for new libstdc++, build for errata + +* Mon Dec 18 2000 Trond Eivind Glomsrd +- 3.23.29 + +* Mon Nov 27 2000 Trond Eivind Glomsrd +- 3.23.28 (gamma) +- remove old patches, as they are now upstreamed + +* Thu Nov 14 2000 Trond Eivind Glomsrd +- Add a requirement for a new glibc (#20735) +- build on IA64 + +* Wed Nov 1 2000 Trond Eivind Glomsrd +- disable more assembly + +* Wed Nov 1 2000 Jakub Jelinek +- fix mysql on SPARC (#20124) + +* Tue Oct 31 2000 Trond Eivind Glomsrd +- 3.23.27 + +* Wed Oct 25 2000 Trond Eivind Glomsrd +- add patch for fixing bogus aliasing in mysql from Jakub, + which should fix #18905 and #18620 + +* Mon Oct 23 2000 Trond Eivind Glomsrd +- check for negative niceness values, and negate it + if present (#17899) +- redefine optflags on IA32 FTTB + +* Wed Oct 18 2000 Trond Eivind Glomsrd +- 3.23.26, which among other fixes now uses mkstemp() + instead of tempnam(). +- revert changes made yesterday, the problem is now + isolated + +* Tue Oct 17 2000 Trond Eivind Glomsrd +- use the compat C++ compiler FTTB. Argh. +- add requirement of ncurses4 (see above) + +* Sun Oct 01 2000 Trond Eivind Glomsrd +- 3.23.25 +- fix shutdown problem (#17956) + +* Tue Sep 26 2000 Trond Eivind Glomsrd +- Don't try to include no-longer-existing PUBLIC file + as doc (#17532) + +* Thu Sep 12 2000 Trond Eivind Glomsrd +- rename config file to /etc/my.cnf, which is what + mysqld wants... doh. (#17432) +- include a changed safe_mysqld, so the pid file option + works. +- make mysql dir world readable to they can access the + mysql socket. (#17432) +- 3.23.24 + +* Wed Sep 06 2000 Trond Eivind Glomsrd +- 3.23.23 + +* Sun Aug 27 2000 Trond Eivind Glomsrd +- Add "|| :" to condrestart to avoid non-zero exit code + +* Thu Aug 24 2000 Trond Eivind Glomsrd +- it's mysql.com, not mysql.org and use correct path to + source (#16830) + +* Wed Aug 16 2000 Trond Eivind Glomsrd +- source file from /etc/rc.d, not /etc/rd.d. Doh. + +* Sun Aug 13 2000 Trond Eivind Glomsrd +- don't run ldconfig -n, it doesn't update ld.so.cache + (#16034) +- include some missing binaries +- use safe_mysqld to start the server (request from + mysql developers) + +* Sat Aug 05 2000 Bill Nottingham +- condrestart fixes + +* Mon Aug 01 2000 Trond Eivind Glomsrd +- 3.23.22. Disable the old patches, they're now in. + +* Thu Jul 27 2000 Trond Eivind Glomsrd +- bugfixes in the initscript +- move the .so link to the devel package + +* Wed Jul 19 2000 Trond Eivind Glomsrd +- rebuild due to glibc changes + +* Tue Jul 18 2000 Trond Eivind Glomsrd +- disable compiler patch +- don't include info directory file + +* Mon Jul 17 2000 Trond Eivind Glomsrd +- move back to /etc/rc.d/init.d + +* Fri Jul 14 2000 Trond Eivind Glomsrd +- more cleanups in initscript + +* Thu Jul 13 2000 Trond Eivind Glomsrd +- add a patch to work around compiler bug + (from monty@mysql.com) + +* Wed Jul 12 2000 Trond Eivind Glomsrd +- don't build the SQL daemon statically (glibc problems) +- fix the logrotate script - only flush log if mysql + is running +- change the reloading procedure +- remove icon - glint is obsolete a long time ago + +* Wed Jul 12 2000 Prospector +- automatic rebuild + +* Mon Jul 10 2000 Trond Eivind Glomsrd +- try the new compiler again +- build the SQL daemon statically +- add compile time support for complex charsets +- enable assembler +- more cleanups in initscript + +* Sun Jul 09 2000 Trond Eivind Glomsrd +- use old C++ compiler +- Exclusivearch x86 + +* Sat Jul 08 2000 Trond Eivind Glomsrd +- move .so files to devel package +- more cleanups +- exclude sparc for now + +* Wed Jul 05 2000 Trond Eivind Glomsrd +- 3.23.21 +- remove file from /etc/sysconfig +- Fix initscript a bit - initialization of databases doesn't + work yet +- specify the correct licenses +- include a /etc/my.conf (empty, FTTB) +- add conditional restart to spec file + +* Tue Jul 2 2000 Jakub Jelinek +- Rebuild with new C++ + +* Fri Jun 30 2000 Trond Eivind Glomsrd +- update to 3.23.20 +- use %%configure, %%makeinstall, %%{_tmppath}, %%{_mandir}, + %%{_infodir}, /etc/init.d +- remove the bench package +- change some of the descriptions a little bit +- fix the init script +- some compile fixes +- specify mysql user +- use mysql uid 27 (postgresql is 26) +- don't build on ia64 + +* Sat Feb 26 2000 Jos Vos +- Version 3.22.32 release XOS.1 for LinuX/OS 1.8.0 +- Upgrade from version 3.22.27 to 3.22.32. +- Do "make install" instead of "make install-strip", because "install -s" + now appears to fail on various scripts. Afterwards, strip manually. +- Reorganize subpackages, according to common Red Hat packages: the client + program and shared library become the base package and the server and + some accompanying files are now in a separate server package. The + server package implicitly requires the base package (shared library), + but we have added a manual require tag anyway (because of the shared + config file, and more). +- Rename the mysql-benchmark subpackage to mysql-bench. + +* Mon Jan 31 2000 Jos Vos +- Version 3.22.27 release XOS.2 for LinuX/OS 1.7.1 +- Add post(un)install scripts for updating ld.so.conf (client subpackage). + +* Sun Nov 21 1999 Jos Vos +- Version 3.22.27 release XOS.1 for LinuX/OS 1.7.0 +- Initial version. +- Some ideas borrowed from Red Hat Powertools 6.1, although this spec + file is a full rewrite from scratch. diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 9f9dc7dc9a3..036164d868b 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ # # RPM # Build as per default RPM layout, with prefix=/usr +# Note: The layout for ULN RPMs differs, see the "RPM" section. # # DEB # Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor @@ -134,6 +135,10 @@ SET(INSTALL_PLUGINTESTDIR_STANDALONE ${plugin_tests}) # # RPM layout # +# See "SPECIFIC-ULN/mysql-5.5-libdir.patch" for the differences +# which apply to RPMs in ULN (Oracle Linux), that patch file will +# be applied at build time via "rpmbuild". +# SET(INSTALL_BINDIR_RPM "bin") SET(INSTALL_SBINDIR_RPM "sbin") SET(INSTALL_SCRIPTDIR_RPM "bin") From 08bfc131d69b5fa604b78c7c45caec69759f78ce Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Jun 2012 16:56:44 +0200 Subject: [PATCH 139/349] From 014ed2bd17b744ac69c387fb92c20a1225fca84b Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 11 Jun 2012 18:02:30 +0200 Subject: [PATCH 140/349] Adape "SPECIFIC-ULN/mysql-5.5-libdir.patch" to changed comments in "cmake/install_layout.cmake" (pravious changeset). --- SPECIFIC-ULN/mysql-5.5-libdir.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SPECIFIC-ULN/mysql-5.5-libdir.patch b/SPECIFIC-ULN/mysql-5.5-libdir.patch index 60ffbed0dab..2ab3e9eec27 100644 --- a/SPECIFIC-ULN/mysql-5.5-libdir.patch +++ b/SPECIFIC-ULN/mysql-5.5-libdir.patch @@ -7,8 +7,8 @@ Similar, the server is now in "/usr/libexec" (formerly "/usr/sbin"). diff -Naur mysql-5.5.17.orig/cmake/install_layout.cmake mysql-5.5.17/cmake/install_layout.cmake --- mysql-5.5.17.orig/cmake/install_layout.cmake 2011-06-30 15:46:53 +0000 +++ mysql-5.5.17/cmake/install_layout.cmake 2011-10-27 16:40:10 +0000 -@@ -135,14 +135,14 @@ SET(INSTALL_SBINDIR_RPM - # RPM layout +@@ -140,14 +140,14 @@ SET(INSTALL_SBINDIR_RPM + # be applied at build time via "rpmbuild". # SET(INSTALL_BINDIR_RPM "bin") -SET(INSTALL_SBINDIR_RPM "sbin") From ed8fc69f4f2194f81014a4fda28deb6e2a1ea489 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 11 Jun 2012 19:50:03 +0200 Subject: [PATCH 141/349] Files in "SPECIFIC-ULN" need to be mentioned in a cmake "INSTALL". --- SPECIFIC-ULN/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SPECIFIC-ULN/CMakeLists.txt b/SPECIFIC-ULN/CMakeLists.txt index 6f6587e75b3..3efc1a2960b 100644 --- a/SPECIFIC-ULN/CMakeLists.txt +++ b/SPECIFIC-ULN/CMakeLists.txt @@ -24,5 +24,14 @@ IF(UNIX) ENDIF() # Left in current directory, to be taken during build - CONFIGURE_FILE(mysql.spec.sh ./${SPECFILENAME} @ONLY) + CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/SPECIFIC-ULN/${SPECFILENAME} @ONLY) + + FOREACH(ulnfile filter-requires-mysql.sh generate-tarball.sh my.cnf my_config.h + mysql-5.5-errno.patch mysql-5.5-fix-tests.patch mysql-5.5-libdir.patch + mysql-5.5-mtr1.patch mysql-5.5-stack-guard.patch mysql-5.5-testing.patch + mysql-chain-certs.patch mysql-embedded-check.c mysql-expired-certs.patch + mysql.init mysql-install-test.patch mysql-strmov.patch scriptstub.c) + INSTALL(FILES ulnfile DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/SPECIFIC-ULN) + ENDFOREACH() ENDIF() + From 4245d1bac29c82617ff4b3e18342874052e1bc32 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 11 Jun 2012 20:30:04 +0200 Subject: [PATCH 142/349] cmake syntax error: missed ${...} --- SPECIFIC-ULN/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SPECIFIC-ULN/CMakeLists.txt b/SPECIFIC-ULN/CMakeLists.txt index 3efc1a2960b..2980263379a 100644 --- a/SPECIFIC-ULN/CMakeLists.txt +++ b/SPECIFIC-ULN/CMakeLists.txt @@ -24,14 +24,14 @@ IF(UNIX) ENDIF() # Left in current directory, to be taken during build - CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/SPECIFIC-ULN/${SPECFILENAME} @ONLY) + CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME} @ONLY) FOREACH(ulnfile filter-requires-mysql.sh generate-tarball.sh my.cnf my_config.h mysql-5.5-errno.patch mysql-5.5-fix-tests.patch mysql-5.5-libdir.patch mysql-5.5-mtr1.patch mysql-5.5-stack-guard.patch mysql-5.5-testing.patch mysql-chain-certs.patch mysql-embedded-check.c mysql-expired-certs.patch mysql.init mysql-install-test.patch mysql-strmov.patch scriptstub.c) - INSTALL(FILES ulnfile DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/SPECIFIC-ULN) + INSTALL(FILES ${ulnfile} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) ENDFOREACH() ENDIF() From 2c64e17361bb1560c51c7cb5285e46525593775a Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 11 Jun 2012 22:07:24 +0200 Subject: [PATCH 143/349] Protect traditional RPMs that "SPECIFIC-ULN/" will not break their packaging. --- SPECIFIC-ULN/CMakeLists.txt | 29 ++++++++++++++++++++++------- support-files/mysql.spec.sh | 9 ++++++++- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/SPECIFIC-ULN/CMakeLists.txt b/SPECIFIC-ULN/CMakeLists.txt index 2980263379a..6b920cc6ef2 100644 --- a/SPECIFIC-ULN/CMakeLists.txt +++ b/SPECIFIC-ULN/CMakeLists.txt @@ -26,12 +26,27 @@ IF(UNIX) # Left in current directory, to be taken during build CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME} @ONLY) - FOREACH(ulnfile filter-requires-mysql.sh generate-tarball.sh my.cnf my_config.h - mysql-5.5-errno.patch mysql-5.5-fix-tests.patch mysql-5.5-libdir.patch - mysql-5.5-mtr1.patch mysql-5.5-stack-guard.patch mysql-5.5-testing.patch - mysql-chain-certs.patch mysql-embedded-check.c mysql-expired-certs.patch - mysql.init mysql-install-test.patch mysql-strmov.patch scriptstub.c) - INSTALL(FILES ${ulnfile} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - ENDFOREACH() + SET(PATCHES + mysql-5.5-errno.patch + mysql-5.5-fix-tests.patch + mysql-5.5-libdir.patch + mysql-5.5-mtr1.patch + mysql-5.5-stack-guard.patch + mysql-5.5-testing.patch + mysql-chain-certs.patch + mysql-expired-certs.patch + mysql-install-test.patch + mysql-strmov.patch) + + SET(OTHER + filter-requires-mysql.sh + generate-tarball.sh + my.cnf + my_config.h + mysql-embedded-check.c + mysql.init + scriptstub.c) + + INSTALL(FILES ${PATCHES} ${OTHER} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) ENDIF() diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index a3d8554188e..64016fd2ee6 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1,4 +1,4 @@ -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -406,6 +406,9 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ # Be strict about variables, bail at earliest opportunity, etc. set -eu +# Get rid of stuff for ULN RPMs - not needed here +rm -fr %{src_dir}/SPECIFIC-ULN/ + # Optional package files touch optional-files-devel @@ -1146,6 +1149,10 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Mon Jun 11 2012 Joerg Bruehe + +- Make sure newly added "SPECIFIC-ULN/" directory does not disturb packaging. + * Wed Sep 28 2011 Joerg Bruehe - Fix duplicate mentioning of "mysql_plugin" and its manual page, From 9ea789e43434f9f341e0d9ad63b058e1ea116539 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 12 Jun 2012 11:01:41 +0200 Subject: [PATCH 144/349] Still work on getting the "SPECIFIC-ULN/" files into the build. "INSTALL" was wrong, happens too late, but "CONFIGURE_FILES(... COPYONLY)" should hopefully do it. Traditional RPMs need to be checked, the above might fix their issues. --- SPECIFIC-ULN/CMakeLists.txt | 29 +++++++---------------------- support-files/mysql.spec.sh | 3 --- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/SPECIFIC-ULN/CMakeLists.txt b/SPECIFIC-ULN/CMakeLists.txt index 6b920cc6ef2..0b61090d4c7 100644 --- a/SPECIFIC-ULN/CMakeLists.txt +++ b/SPECIFIC-ULN/CMakeLists.txt @@ -26,27 +26,12 @@ IF(UNIX) # Left in current directory, to be taken during build CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME} @ONLY) - SET(PATCHES - mysql-5.5-errno.patch - mysql-5.5-fix-tests.patch - mysql-5.5-libdir.patch - mysql-5.5-mtr1.patch - mysql-5.5-stack-guard.patch - mysql-5.5-testing.patch - mysql-chain-certs.patch - mysql-expired-certs.patch - mysql-install-test.patch - mysql-strmov.patch) - - SET(OTHER - filter-requires-mysql.sh - generate-tarball.sh - my.cnf - my_config.h - mysql-embedded-check.c - mysql.init - scriptstub.c) - - INSTALL(FILES ${PATCHES} ${OTHER} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + FOREACH(ulnfile filter-requires-mysql.sh generate-tarball.sh my.cnf my_config.h + mysql-5.5-errno.patch mysql-5.5-fix-tests.patch mysql-5.5-libdir.patch + mysql-5.5-mtr1.patch mysql-5.5-stack-guard.patch mysql-5.5-testing.patch + mysql-chain-certs.patch mysql-embedded-check.c mysql-expired-certs.patch + mysql.init mysql-install-test.patch mysql-strmov.patch scriptstub.c) + CONFIGURE_FILE(${ulnfile} ${CMAKE_CURRENT_BINARY_DIR}/${ulnfile} COPYONLY) + ENDFOREACH() ENDIF() diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 64016fd2ee6..3589a85228a 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -406,9 +406,6 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ # Be strict about variables, bail at earliest opportunity, etc. set -eu -# Get rid of stuff for ULN RPMs - not needed here -rm -fr %{src_dir}/SPECIFIC-ULN/ - # Optional package files touch optional-files-devel From 7394bd60fbcdbe115a1bd3435c56370d86c6bf5e Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 12 Jun 2012 17:18:09 +0200 Subject: [PATCH 145/349] One file still missing for ULN RPMs. --- SPECIFIC-ULN/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SPECIFIC-ULN/CMakeLists.txt b/SPECIFIC-ULN/CMakeLists.txt index 0b61090d4c7..c8f13379697 100644 --- a/SPECIFIC-ULN/CMakeLists.txt +++ b/SPECIFIC-ULN/CMakeLists.txt @@ -30,7 +30,8 @@ IF(UNIX) mysql-5.5-errno.patch mysql-5.5-fix-tests.patch mysql-5.5-libdir.patch mysql-5.5-mtr1.patch mysql-5.5-stack-guard.patch mysql-5.5-testing.patch mysql-chain-certs.patch mysql-embedded-check.c mysql-expired-certs.patch - mysql.init mysql-install-test.patch mysql-strmov.patch scriptstub.c) + mysql.init mysql-install-test.patch mysql-strmov.patch scriptstub.c + README.mysql-docs) CONFIGURE_FILE(${ulnfile} ${CMAKE_CURRENT_BINARY_DIR}/${ulnfile} COPYONLY) ENDFOREACH() ENDIF() From 53b80730cb00f52ca644c7ed081e8afb2c879b45 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 14 Jun 2012 12:26:27 +0200 Subject: [PATCH 146/349] Copyright text in the spec file for ULN RPMs. --- SPECIFIC-ULN/mysql.spec.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/SPECIFIC-ULN/mysql.spec.sh b/SPECIFIC-ULN/mysql.spec.sh index 63b897cfb76..105a31f68dc 100644 --- a/SPECIFIC-ULN/mysql.spec.sh +++ b/SPECIFIC-ULN/mysql.spec.sh @@ -1,5 +1,24 @@ -# Copyright (c) CORRECT TEXT TO BE DETERMINED - TODO / FIXME # +# This file was modified by Oracle in 2011 and later. +# Details of the modifications are described in the "changelog" section. +# +# Modifications copyright (c) 2011, 2012, Oracle and/or its +# affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA + %define mysql_version @VERSION@ %define release 1 From f72b541190818bcd53356e4ad2cfeb27c0eb7bce Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 Jun 2012 11:23:47 +0400 Subject: [PATCH 147/349] From bb0f0276357be688b207a3eba4ccd6123bf8ef36 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Jun 2012 09:25:05 +0400 Subject: [PATCH 148/349] From 9aa4063511d43afe08e437a69a67b0a71f280b41 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Jun 2012 10:46:52 +0200 Subject: [PATCH 149/349] From c5af50cecd567f56b79e17e518295e648279c501 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jun 2012 15:19:58 +0200 Subject: [PATCH 150/349] From 97bd43920c0be78f370d9f7a7a555f142b683b7c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Jun 2012 12:31:12 +0200 Subject: [PATCH 151/349] From 885d4641d4e15b1deef4d45a019696bc4c309fc1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2012 11:32:39 +0400 Subject: [PATCH 152/349] From 446bd50e4ce6772b5774023649df30049e39ce0d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Jul 2012 12:58:51 +0200 Subject: [PATCH 153/349] From 40f9b65f93da9a077a071e629cd741a7b4e6672e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2012 13:55:03 +0200 Subject: [PATCH 154/349] From 4540e722689e6906f7600f7656da900d08b02dd6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Jul 2012 08:24:07 +0200 Subject: [PATCH 155/349] From dce6acf67cbdf9489a5e50c8bf99866578321a4e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Jul 2012 11:34:03 +0200 Subject: [PATCH 156/349] From b9a8be20d67094f59a90bccf864898e361b46f0f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2012 11:28:25 +0200 Subject: [PATCH 157/349] From 202a2591c4153618e250a560fc1c6792398879e9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Jul 2012 09:06:50 +0200 Subject: [PATCH 158/349] From 8ebfe7edf190490d08d209ebcff0420300fec96b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Jul 2012 09:38:40 +0200 Subject: [PATCH 159/349] From b3ac76da0801637bc1f3902e46ac165b0b2acf75 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Jul 2012 08:55:55 +0200 Subject: [PATCH 160/349] From 45176d9f14092c2f517f6167712c2c9cc9b8119f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2012 09:09:13 +0200 Subject: [PATCH 161/349] From cedccf11572e7cf4150ef3fd005b85236cd3e795 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2012 14:45:43 +0530 Subject: [PATCH 162/349] From d06273ef43089f95a5a46bf75a7262c5ad4e2841 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 26 Jul 2012 20:24:51 +0200 Subject: [PATCH 163/349] Spec file polishing: Handle 'MySQL-*' and 'mysql-*', part 1 --- support-files/mysql.spec.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index b627b131e71..0cd6f8dc852 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -581,8 +581,13 @@ fi # Check if we can safely upgrade. An upgrade is only safe if it's from one # of our RPMs in the same version family. +# Handle both ways of spelling the capability. installed=`rpm -q --whatprovides mysql-server 2> /dev/null` +if [ $? -ne 0 -o -z "$installed" ]; then + installed=`rpm -q --whatprovides MySQL-server 2> /dev/null` +fi if [ $? -eq 0 -a -n "$installed" ]; then + installed=`echo $installed | sed 's/\([^ ]*\) .*/\1/'` # Tests have shown duplicated package names vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` myoldvendor='%{mysql_old_vendor}' From 15cc02842719171202fe7c041e64a08e0464a29d Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 26 Jul 2012 20:33:06 +0200 Subject: [PATCH 164/349] Spec file for ULN RPMs: - Add the vendor and release series checks from our traditional spec file, to protect against errors during upgrade. - Do some reformatting, to reduce the differences to our traditional spec file. --- SPECIFIC-ULN/mysql.spec.sh | 133 ++++++++++++++++++++++++++++++++----- 1 file changed, 115 insertions(+), 18 deletions(-) diff --git a/SPECIFIC-ULN/mysql.spec.sh b/SPECIFIC-ULN/mysql.spec.sh index 105a31f68dc..6d00825ed16 100644 --- a/SPECIFIC-ULN/mysql.spec.sh +++ b/SPECIFIC-ULN/mysql.spec.sh @@ -5,26 +5,38 @@ # Modifications copyright (c) 2011, 2012, Oracle and/or its # affiliates. All rights reserved. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; version 2 of the License. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston +# MA 02110-1301 USA. +############################################################################## +# Some common macro definitions +############################################################################## + +# NOTE: "vendor" is used in upgrade/downgrade check, so you can't +# change these, has to be exactly as is. +# %define mysql_old_vendor MySQL AB # Applies to traditional MySQL RPMs only. +# %define mysql_vendor_2 Sun Microsystems, Inc. # Duplicated here to have code similar. +%define mysql_old_vendor Oracle and/or its affiliates +%define mysql_vendor_2 Oracle and/or its affiliates +%define mysql_vendor Oracle and/or its affiliates %define mysql_version @VERSION@ -%define release 1 -%define mysql_vendor Oracle and/or its affiliates + %define mysqldatadir /var/lib/mysql +%define release 1 + ############################################################################## # Command line handling ############################################################################## @@ -118,7 +130,7 @@ %endif %else %if %(test -f /etc/SuSE-release && echo 1 || echo 0) - %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release) + %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release | cut -d. -f1) %if "%susever" == "10" %define distro_description SUSE Linux Enterprise Server 10 %define distro_releasetag sles10 @@ -180,15 +192,16 @@ ############################################################################## Name: mysql%{product_suffix} -Version: @MYSQL_RPM_VERSION@ -Release: %{release}%{?distro_releasetag:.%{distro_releasetag}} Summary: MySQL client programs and shared libraries Group: Applications/Databases -URL: http://www.mysql.com -Packager: MySQL Release Engineering +Version: @MYSQL_RPM_VERSION@ +Release: %{release}%{?distro_releasetag:.%{distro_releasetag}} # exceptions allow client libraries to be linked with most open source SW, # not only GPL code. License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{license_type} license as shown in the Description field. +URL: http://www.mysql.com/ +Packager: MySQL Release Engineering +Vendor: %{mysql_vendor} # Regression tests take a long time, you can skip 'em with this %{!?runselftest:%global runselftest 1} @@ -649,6 +662,84 @@ echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %pre -n mysql-server%{product_suffix} + +# Check if we can safely upgrade. An upgrade is only safe if it's from one +# of our RPMs in the same version family. + +# Handle both ways of spelling the capability. +installed=`rpm -q --whatprovides mysql-server 2> /dev/null` +if [ $? -ne 0 -o -z "$installed" ]; then + installed=`rpm -q --whatprovides MySQL-server 2> /dev/null` +fi +if [ $? -eq 0 -a -n "$installed" ]; then + installed=`echo $installed | sed 's/\([^ ]*\) .*/\1/'` # Tests have shown duplicated package names + vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` + version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` + myoldvendor='%{mysql_old_vendor}' + myvendor_2='%{mysql_vendor_2}' + myvendor='%{mysql_vendor}' + myversion='%{mysql_version}' + + old_family=`echo $version \ + | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` + new_family=`echo $myversion \ + | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` + + [ -z "$vendor" ] && vendor='' + [ -z "$old_family" ] && old_family="" + [ -z "$new_family" ] && new_family="" + + error_text= + if [ "$vendor" != "$myoldvendor" \ + -a "$vendor" != "$myvendor_2" \ + -a "$vendor" != "$myvendor" ]; then + error_text="$error_text +The current MySQL server package is provided by a different +vendor ($vendor) than $myoldvendor, $myvendor_2, or $myvendor. +Some files may be installed to different locations, including log +files and the service startup script in %{_sysconfdir}/init.d/. +" + fi + + if [ "$old_family" != "$new_family" ]; then + error_text="$error_text +Upgrading directly from MySQL $old_family to MySQL $new_family may not +be safe in all cases. A manual dump and restore using mysqldump is +recommended. It is important to review the MySQL manual's Upgrading +section for version-specific incompatibilities. +" + fi + + if [ -n "$error_text" ]; then + cat <&2 + +****************************************************************** +A MySQL server package ($installed) is installed. +$error_text +A manual upgrade is required. + +- Ensure that you have a complete, working backup of your data and my.cnf + files +- Shut down the MySQL server cleanly +- Remove the existing MySQL packages. Usually this command will + list the packages you should remove: + rpm -qa | grep -i '^mysql-' + + You may choose to use 'rpm --nodeps -ev ' to remove + the package which contains the mysqlclient shared library. The + library will be reinstalled by the MySQL-shared-compat package. +- Install the new MySQL packages supplied by $myvendor +- Ensure that the MySQL server is started +- Run the 'mysql_upgrade' program + +This is a brief description of the upgrade process. Important details +can be found in the MySQL manual, in the Upgrading section. +****************************************************************** +HERE + exit 1 + fi +fi + /usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || : /usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \ -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || : @@ -879,6 +970,12 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Thu Jul 26 2012 Joerg Bruehe +- Add the vendor and release series checks from the traditional MySQL RPM + spec file, to protect against errors happening during upgrades. +- Do some code alignment with the traditional MySQL RPM spec file, + to make synchronous maintenance (and possibly even integration?) easier. + * Mon Feb 13 2012 Joerg Bruehe - Add "Provides:" lines for the generic names of the subpackages, independent of "product_suffix". From aa36e25cb2d618920ec9c897652211559ada3851 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 26 Jul 2012 20:41:45 +0200 Subject: [PATCH 165/349] Spec file: transfer the 'runselftest' macro to a work tree. --- support-files/mysql.spec.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 0cd6f8dc852..1e904fd996b 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -252,6 +252,9 @@ Vendor: %{mysql_vendor} Provides: msqlormysql MySQL-server mysql BuildRequires: %{distro_buildreq} +# Regression tests may take a long time, override the default to skip them +%{!?runselftest:%global runselftest 1} + # Think about what you use here since the first step is to # run a rm -rf BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -403,6 +406,16 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ ############################################################################## %build +# Fail quickly and obviously if user tries to build as root +%if %runselftest + if [ x"`id -u`" = x0 ]; then + echo "The MySQL regression tests may fail if run as root." + echo "If you really need to build the RPM as root, use" + echo "--define='runselftest 0' to skip the regression tests." + exit 1 + fi +%endif + # Be strict about variables, bail at earliest opportunity, etc. set -eu @@ -480,6 +493,13 @@ mkdir release make ${MAKE_JFLAG} VERBOSE=1 ) +%if %runselftest + MTR_BUILD_THREAD=auto + export MTR_BUILD_THREAD + + (cd release && make test-bt-fast || true) +%endif + ############################################################################## %install @@ -1151,6 +1171,14 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Tue Jul 24 2012 Joerg Bruehe + +- Add a macro "runselftest": + if set to 1 (default), the test suite will be run during the RPM build; + this can be oveeridden via the command line by adding + --define "runselftest 0" + Failures of the test suite will NOT make the RPM build fail! + * Mon Jun 11 2012 Joerg Bruehe - Make sure newly added "SPECIFIC-ULN/" directory does not disturb packaging. From 5bb0b7759f712db913c03ca2a69530b5a1d58b04 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 26 Jul 2012 21:02:41 +0200 Subject: [PATCH 166/349] ULN spec file: Some comment or message text alignments. --- SPECIFIC-ULN/mysql.spec.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SPECIFIC-ULN/mysql.spec.sh b/SPECIFIC-ULN/mysql.spec.sh index 6d00825ed16..b0026f04773 100644 --- a/SPECIFIC-ULN/mysql.spec.sh +++ b/SPECIFIC-ULN/mysql.spec.sh @@ -203,7 +203,7 @@ URL: http://www.mysql.com/ Packager: MySQL Release Engineering Vendor: %{mysql_vendor} -# Regression tests take a long time, you can skip 'em with this +# Regression tests may take a long time, override the default to skip them %{!?runselftest:%global runselftest 1} # Upstream has a mirror redirector for downloads, so the URL is hard to @@ -411,10 +411,10 @@ rm -f mysql-test/t/ssl_8k_key-master.opt %build -# fail quickly and obviously if user tries to build as root +# Fail quickly and obviously if user tries to build as root %if %runselftest if [ x"`id -u`" = x0 ]; then - echo "mysql's regression tests fail if run as root." + echo "The MySQL regression tests may fail if run as root." echo "If you really need to build the RPM as root, use" echo "--define='runselftest 0' to skip the regression tests." exit 1 From 11fc7b64d379d28a976e2ea6f0f4c8587bb918c3 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 26 Jul 2012 21:20:15 +0200 Subject: [PATCH 167/349] Spec file: Declare conflicts with the ULN RPMs. --- support-files/mysql.spec.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 1e904fd996b..2d629c766e8 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -286,8 +286,9 @@ documentation and the manual for more information. Summary: MySQL: a very fast and reliable SQL database server Group: Applications/Databases Requires: %{distro_requires} -Provides: msqlormysql mysql MySQL mysql-server MySQL-server -Obsoletes: mysql MySQL mysql-server MySQL-server +Provides: msqlormysql MySQL MySQL-server +Conflicts: mysql mysql-server mysql-advanced mysql-server-advanced +Obsoletes: MySQL MySQL-server Obsoletes: MySQL-server-classic MySQL-server-community MySQL-server-enterprise Obsoletes: MySQL-server-advanced MySQL-server-advanced-gpl MySQL-server-enterprise-gpl @@ -319,8 +320,9 @@ package "MySQL-client%{product_suffix}" as well! %package -n MySQL-client%{product_suffix} Summary: MySQL - Client Group: Applications/Databases -Provides: mysql-client MySQL-client -Obsoletes: mysql-client MySQL-client +Provides: MySQL-client +Conflicts: mysql mysql-advanced +Obsoletes: MySQL-client Obsoletes: MySQL-client-classic MySQL-client-community MySQL-client-enterprise Obsoletes: MySQL-client-advanced MySQL-client-advanced-gpl MySQL-client-enterprise-gpl @@ -334,8 +336,9 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ Summary: MySQL - Test suite Group: Applications/Databases Requires: MySQL-client perl -Provides: mysql-test MySQL-test -Obsoletes: mysql-test MySQL-test +Provides: MySQL-test +Conflicts: mysql-test mysql-test-advanced +Obsoletes: MySQL-test Obsoletes: mysql-bench MySQL-bench Obsoletes: MySQL-test-classic MySQL-test-community MySQL-test-enterprise Obsoletes: MySQL-test-advanced MySQL-test-advanced-gpl MySQL-test-enterprise-gpl @@ -350,8 +353,9 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ %package -n MySQL-devel%{product_suffix} Summary: MySQL - Development header files and libraries Group: Applications/Databases -Provides: mysql-devel MySQL-devel -Obsoletes: mysql-devel MySQL-devel +Provides: MySQL-devel +Conflicts: mysql-devel mysql-embedded-devel mysql-devel-advanced mysql-embedded-devel-advanced +Obsoletes: MySQL-devel Obsoletes: MySQL-devel-classic MySQL-devel-community MySQL-devel-enterprise Obsoletes: MySQL-devel-advanced MySQL-devel-advanced-gpl MySQL-devel-enterprise-gpl @@ -365,8 +369,9 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ %package -n MySQL-shared%{product_suffix} Summary: MySQL - Shared libraries Group: Applications/Databases -Provides: mysql-shared MySQL-shared -Obsoletes: mysql-shared MySQL-shared-standard MySQL-shared-pro +Provides: MySQL-shared +Conflicts: mysql-libs mysql-libs-advanced +Obsoletes: MySQL-shared-standard MySQL-shared-pro Obsoletes: MySQL-shared-pro-cert MySQL-shared-pro-gpl Obsoletes: MySQL-shared-pro-gpl-cert MySQL-shared Obsoletes: MySQL-shared-classic MySQL-shared-community MySQL-shared-enterprise @@ -381,8 +386,9 @@ and applications need to dynamically load and use MySQL. Summary: MySQL - Embedded library Group: Applications/Databases Requires: MySQL-devel -Provides: mysql-embedded MySQL-embedded -Obsoletes: mysql-embedded MySQL-embedded +Provides: MySQL-embedded +Conflicts: mysql-embedded mysql-embedded-advanced +Obsoletes: MySQL-embedded Obsoletes: MySQL-embedded-pro Obsoletes: MySQL-embedded-classic MySQL-embedded-community MySQL-embedded-enterprise Obsoletes: MySQL-embedded-advanced MySQL-embedded-advanced-gpl MySQL-embedded-enterprise-gpl From 69e44f4947a462501e8d315da8965f82fa1a5f11 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Aug 2012 20:13:38 +0400 Subject: [PATCH 168/349] From ec7d3f63dbfaa73e1c42191cc927a24eef535a56 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2012 00:53:10 +0400 Subject: [PATCH 169/349] From d028cc5f1d39c5dfa0ae332e5341cea918a5a6b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2012 15:37:40 +0400 Subject: [PATCH 170/349] From 3ea983dab1bcf543cb6cfc6c48a16342f1eafbf6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Aug 2012 11:11:48 +0200 Subject: [PATCH 171/349] From cd0a82d8b1cec34a9cf88d34d4636d8b35b9214c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Aug 2012 16:17:37 +0400 Subject: [PATCH 172/349] From 42827de4918fd630e3b134ac8df5b7c548478837 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Aug 2012 19:49:47 +0200 Subject: [PATCH 173/349] Raise version number after cloning 5.5.28 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4ed7f1471fd..1889f4c8aff 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=28 +MYSQL_VERSION_PATCH=29 MYSQL_VERSION_EXTRA= From 30aadd6b41c99d9f01cc5c1ec024cd0cb25f5691 Mon Sep 17 00:00:00 2001 From: Aditya A Date: Mon, 27 Aug 2012 15:42:11 +0530 Subject: [PATCH 174/349] Bug#14145950 AUTO_INCREMENT ON DOUBLE WILL FAIL ON WINDOWS Backport from mysql-5.6 the fix (revision-id sunny.bains@oracle.com-20120315045831-20rgfa4cozxmz7kz) Bug#13839886 - CRASH IN INNOBASE_NEXT_AUTOINC The assertion introduce in the fix for Bug#13817703 is too strong, a negative number can be greater than the column max value, when the column value is a negative number. rb://978 Approved by Jimmy Yang. rb:1236 approved by Marko Makela --- .../suite/innodb/r/innodb-autoinc.result | 88 +++++++++++++++++++ mysql-test/suite/innodb/t/innodb-autoinc.test | 41 ++++++++- storage/innobase/handler/ha_innodb.cc | 10 +-- 3 files changed, 132 insertions(+), 7 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index 9eb89bead74..ef45255fc7b 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -1269,3 +1269,91 @@ SELECT * FROM t1; c1 c2 1 NULL DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (2147483648, 'a'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2147483649 DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 c2 +2147483648 a +ALTER TABLE t1 CHANGE c1 c1 INT; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL DEFAULT '0', + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +INSERT INTO t1(c2) VALUES('b'); +SELECT * FROM t1; +c1 c2 +0 b +2147483647 a +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL DEFAULT '0', + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE = MyISAM; +INSERT INTO t1 (c1) VALUES (NULL), (-290783232), (NULL); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM AUTO_INCREMENT=2147483648 DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 c2 +1 NULL +-290783232 NULL +2147483647 NULL +ALTER TABLE t1 ENGINE = InnoDB; +SELECT * FROM t1; +c1 c2 +-290783232 NULL +1 NULL +2147483647 NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2147483648 DEFAULT CHARSET=latin1 +REPLACE INTO t1 (c2 ) VALUES (0); +ERROR HY000: Failed to read auto-increment value from storage engine +SELECT * FROM t1; +c1 c2 +-290783232 NULL +1 NULL +2147483647 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB +AUTO_INCREMENT=10000000000000000000; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` double NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=10000000000000000000 DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (); +ERROR HY000: Failed to read auto-increment value from storage engine +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index 5e5a40b3c89..38038de732f 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -139,7 +139,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; INSERT INTO t1 VALUES (NULL, 1); DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (2,1); INSERT INTO t1 VALUES (NULL,8); SELECT * FROM t1; DROP TABLE t1; @@ -639,7 +639,7 @@ SHOW CREATE TABLE t1; DROP TABLE t1; -# Check if we handl offset > column max value properly +# Check if we handle offset > column max value properly SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256; SHOW VARIABLES LIKE "%auto_inc%"; # TINYINT @@ -648,3 +648,40 @@ INSERT INTO t1 VALUES (1, NULL); SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; + +# Check if we handle the case where a current value is greater than the max +# of the column. IMO, this should not be allowed and the assertion that fails +# is actually an invariant. +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SHOW VARIABLES LIKE "%auto_inc%"; +# TINYINT +CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (2147483648, 'a'); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +ALTER TABLE t1 CHANGE c1 c1 INT; +SHOW CREATE TABLE t1; +INSERT INTO t1(c2) VALUES('b'); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE = MyISAM; +INSERT INTO t1 (c1) VALUES (NULL), (-290783232), (NULL); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +ALTER TABLE t1 ENGINE = InnoDB; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +--error ER_AUTOINC_READ_FAILED +REPLACE INTO t1 (c2 ) VALUES (0); +SELECT * FROM t1; +DROP TABLE t1; + +#DOUBLE +CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB +AUTO_INCREMENT=10000000000000000000; +SHOW CREATE TABLE t1; +--error 1467 +INSERT INTO t1 VALUES (); +DROP TABLE t1; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a68ed48fead..c3fb6ba5721 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1473,19 +1473,19 @@ innobase_next_autoinc( ut_a(block > 0); ut_a(max_value > 0); - /* Current value should never be greater than the maximum. */ - ut_a(current <= max_value); - /* According to MySQL documentation, if the offset is greater than the step then the offset is ignored. */ if (offset > block) { offset = 0; } - /* Check for overflow. */ + /* Check for overflow. Current can be > max_value if the value is + in reality a negative value.The visual studio compilers converts + large double values automatically into unsigned long long datatype + maximum value */ if (block >= max_value || offset > max_value - || current == max_value + || current >= max_value || max_value - offset <= offset) { next_value = max_value; From fefc29a6487fe376c0ccad1ee1264330be93bfdd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 Aug 2012 16:21:20 +0530 Subject: [PATCH 175/349] From 87f5583415e5cc777b383f9e1483b69e48dc8053 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Aug 2012 16:22:02 +0530 Subject: [PATCH 176/349] From 9d41d7c57b4566b86ef2b623ed93ada50a359781 Mon Sep 17 00:00:00 2001 From: Annamalai Gurusami Date: Tue, 4 Sep 2012 14:33:56 +0530 Subject: [PATCH 177/349] Bug #14500557 CRASH WHEN USING LONG INNODB INDEXES The ha_innobase table handler contained two search key buffers (srch_key_val1, srch_key_val2) of fixed size used to store the search key. The size of these buffers where fixed at REC_VERSION_56_MAX_INDEX_COL_LEN + 2. But this size is not sufficient to hold the search key. Hence the following assert in row_sel_convert_mysql_key_to_innobase() failed. 2438 /* Storing may use at most data_len bytes of buf */ 2439 2440 if (UNIV_LIKELY(!is_null)) { 2441 ut_a(buf + data_len <= original_buf + buf_len); 2442 row_mysql_store_col_in_innobase_format( 2443 dfield, buf, 2444 FALSE, /* MySQL key value format col */ 2445 key_ptr + data_offset, data_len, 2446 dict_table_is_comp(index->table)); 2447 buf += data_len; 2448 } The buffer size is now calculated with the formula MAX_KEY_LENGTH + MAX_REF_PARTS*2. This properly takes into account the extra bytes needed to store the length for each column. An index can contain a maximum of MAX_REF_PARTS columns in it, and for each column 2 bytes are needed to store length. rb://1238 approved by Marko and Vasil Dimov. --- storage/innobase/handler/ha_innodb.h | 9 +++++---- storage/innobase/row/row0sel.c | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index b32b23e418b..dfe58e2c309 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -80,12 +80,13 @@ class ha_innobase: public handler uchar* upd_buf; /*!< buffer used in updates */ ulint upd_buf_size; /*!< the size of upd_buf in bytes */ - uchar srch_key_val1[REC_VERSION_56_MAX_INDEX_COL_LEN + 2]; - uchar srch_key_val2[REC_VERSION_56_MAX_INDEX_COL_LEN + 2]; + uchar srch_key_val1[MAX_KEY_LENGTH + MAX_REF_PARTS*2]; + uchar srch_key_val2[MAX_KEY_LENGTH + MAX_REF_PARTS*2]; /*!< buffers used in converting search key values from MySQL format - to InnoDB format. "+ 2" for the two - bytes where the length is stored */ + to InnoDB format. For each column + 2 bytes are used to store length, + hence MAX_REF_PARTS*2. */ Table_flags int_table_flags; uint primary_key; ulong start_of_scan; /*!< this is set to 1 when we are diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 7bec0a26225..1e352d49670 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -2487,6 +2487,9 @@ row_sel_convert_mysql_key_to_innobase( dfield++; } + DBUG_EXECUTE_IF("innodb_srch_key_buffer_full", + ut_a(buf == (original_buf + buf_len));); + ut_a(buf <= original_buf + buf_len); /* We set the length of tuple to n_fields: we assume that the memory From b143676297032ab143ae9f16e85151a5edb137cd Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 7 Sep 2012 10:12:32 +0200 Subject: [PATCH 178/349] Bug#14593123 CONFIGURE.PL WITH CMAKE2.8 BREAKS THE BUILD Ignore --with-client-ldflags it's not supported by the cmake scripts anyways. Ignore --with-mysqld-ldflags it's only used with --with-mysqld-ldflags=-static and that doesn't work. --- CMakeLists.txt | 1 + cmake/configure.pl | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a05727ae3a..ee8c73846aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6) CMAKE_POLICY(VERSION 2.8) endif() +MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) diff --git a/cmake/configure.pl b/cmake/configure.pl index 565de571452..dea641ef889 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -211,6 +211,16 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DENABLE_GCOV=ON"; next; } + if ($option =~ /with-client-ldflags/) + { + print("configure.pl : ignoring $option\n"); + next; + } + if ($option =~ /with-mysqld-ldflags=/) + { + print("configure.pl : ignoring $option\n"); + next; + } $option = uc($option); $option =~ s/-/_/g; From 8a2aa03bffa4d6bd50d4ffa38518134c2db21cc4 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 7 Sep 2012 11:07:20 +0200 Subject: [PATCH 179/349] Bug#14072995 - PERFSCHEMA.FUNC_FILE_IO FAILS WITH RESULT CONTENT MISMATCH OCASSIONALLY ON PB2 Improved the robustness of the func_file_io tests. --- .../suite/perfschema/r/func_file_io.result | 17 +++++++++++++++++ mysql-test/suite/perfschema/t/func_file_io.test | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result index c95fae94803..7849b97f0ed 100644 --- a/mysql-test/suite/perfschema/r/func_file_io.result +++ b/mysql-test/suite/perfschema/r/func_file_io.result @@ -1,6 +1,7 @@ UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/io/file/%'; +flush status; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; @@ -113,3 +114,19 @@ WHERE p.PROCESSLIST_ID = 1 GROUP BY h.EVENT_NAME HAVING TOTAL_WAIT > 0; UPDATE performance_schema.setup_instruments SET enabled = 'YES'; +show status like "performance_schema%"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test index e8b01a10bd1..3de26cfcb8e 100644 --- a/mysql-test/suite/perfschema/t/func_file_io.test +++ b/mysql-test/suite/perfschema/t/func_file_io.test @@ -12,6 +12,9 @@ UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/io/file/%'; +# reset lost counters +flush status; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -182,3 +185,7 @@ HAVING TOTAL_WAIT > 0; # Clean-up. UPDATE performance_schema.setup_instruments SET enabled = 'YES'; + +# In case of failure, will indicate the root cause +show status like "performance_schema%"; + From e5f925b066b46bbd039d610154ba9e9fc9ead914 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 7 Sep 2012 11:09:22 +0200 Subject: [PATCH 180/349] Bug#14100113 - PERFSCHEMA.FUNC_MUTEX FAILS WITH RESULT CONTENT MISMATCH OCCASIONALLY ON PB2 Improved the robustness of the func_mutex test. --- .../suite/perfschema/r/func_mutex.result | 25 +++++++++++++++++++ mysql-test/suite/perfschema/t/func_mutex.test | 13 ++++++++++ 2 files changed, 38 insertions(+) diff --git a/mysql-test/suite/perfschema/r/func_mutex.result b/mysql-test/suite/perfschema/r/func_mutex.result index 93a8ae5d218..2cb1d3da80d 100644 --- a/mysql-test/suite/perfschema/r/func_mutex.result +++ b/mysql-test/suite/perfschema/r/func_mutex.result @@ -2,6 +2,15 @@ UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; +flush status; +select NAME from performance_schema.mutex_instances +where NAME = 'wait/synch/mutex/sql/LOCK_open'; +NAME +wait/synch/mutex/sql/LOCK_open +select NAME from performance_schema.rwlock_instances +where NAME = 'wait/synch/rwlock/sql/LOCK_grant'; +NAME +wait/synch/rwlock/sql/LOCK_grant DROP TABLE IF EXISTS t1; CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; @@ -112,3 +121,19 @@ test_fm2_rw_timed Success UPDATE performance_schema.setup_instruments SET enabled = 'YES'; DROP TABLE t1; +show status like "performance_schema%"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/t/func_mutex.test b/mysql-test/suite/perfschema/t/func_mutex.test index c0af600077e..a96b497ffec 100644 --- a/mysql-test/suite/perfschema/t/func_mutex.test +++ b/mysql-test/suite/perfschema/t/func_mutex.test @@ -13,6 +13,15 @@ UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; +# reset lost counters +flush status; + +# Make sure objects are instrumented +select NAME from performance_schema.mutex_instances + where NAME = 'wait/synch/mutex/sql/LOCK_open'; +select NAME from performance_schema.rwlock_instances + where NAME = 'wait/synch/rwlock/sql/LOCK_grant'; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -116,3 +125,7 @@ SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success # Clean-up. UPDATE performance_schema.setup_instruments SET enabled = 'YES'; DROP TABLE t1; + +# In case of failure, will indicate the root cause +show status like "performance_schema%"; + From aa624daf8be6d826398020913f859adcf6159f2c Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 24 Aug 2012 15:01:31 +0300 Subject: [PATCH 181/349] Bug #14181049: MYSQL_INSTALL_DB.PL CREATES EMPTY SYSTEM TABLES FOR MYSQL The script is different from what's used on unixes. It was not playing the table insertion script (mysql_system_tables_data.sql), although it was checking for the presence of this script. Fixed by re-enabling the lookup for this file and replaying it at bootstrap time. Note that on the Unixes "SELECT @@hostname" does return a fully qualified name, whereas on Windows it returns only a hostname. So by default we're filtering records in the mysql.user table until we ensure this is fixed. --- scripts/mysql_install_db.pl.in | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index c63da6df537..12cd6a21ad1 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -423,10 +423,11 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap, "--bootstrap", "--basedir=$opt->{basedir}", "--datadir=$opt->{ldata}", - "--skip-innodb", - "--skip-bdb", - "--skip-ndbcluster", + "--log-warnings=0", + "--loose-skip-innodb", + "--loose-skip-ndbcluster", "--max_allowed_packet=8M", + "--default-storage-engine=MyISAM", "--net_buffer_length=16K", @args, ); @@ -439,6 +440,8 @@ report_verbose_wait($opt,"Installing MySQL system tables..."); open(SQL, $create_system_tables) or error($opt,"can't open $create_system_tables for reading: $!"); +open(SQL2, $fill_system_tables) + or error($opt,"can't open $fill_system_tables for reading: $!"); # FIXME > /dev/null ? if ( open(PIPE, "| $mysqld_install_cmd_line") ) { @@ -452,8 +455,20 @@ if ( open(PIPE, "| $mysqld_install_cmd_line") ) print PIPE $_; } + while ( ) + { + # TODO: make it similar to the above condition when we're sure + # @@hostname returns a fqdn + # When doing a "cross bootstrap" install, no reference to the current + # host should be added to the system tables. So we filter out any + # lines which contain the current host name. + next if /\@current_hostname/; + + print PIPE $_; + } close PIPE; close SQL; + close SQL2; report_verbose($opt,"OK"); From 4fb57747fe90a148c25089f813bba56cbd230aeb Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 27 Aug 2012 15:30:58 +0300 Subject: [PATCH 182/349] Bug #13548161: MYSQLD_SAFE IMPROVEMENTS FOR 5.5 ALLWAYS SETS PLUGIN_DIR TO DEFAULT IGNOR The test in mysqld_safe for the presence of the --plugin-dir and assigning a default value to it were performed before the actual argument parsing. This is wrong, as PLUGIN_DIR mysqld_safe code also uses MY_BASEDIR_VERSION to look for version specific plugin directory if present. Fixed by moving the PLUGIN_DIR logic after the parse_arguments() call. --- scripts/mysqld_safe.sh | 48 ++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 37e0e351ccd..1f67e2fe271 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -413,29 +413,6 @@ else DATADIR=@localstatedir@ fi -# -# Try to find the plugin directory -# - -# Use user-supplied argument -if [ -n "${PLUGIN_DIR}" ]; then - plugin_dir="${PLUGIN_DIR}" -else - # Try to find plugin dir relative to basedir - for dir in lib/mysql/plugin lib/plugin - do - if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then - plugin_dir="${MY_BASEDIR_VERSION}/${dir}" - break - fi - done - # Give up and use compiled-in default - if [ -z "${plugin_dir}" ]; then - plugin_dir='@pkgplugindir@' - fi -fi -plugin_dir="${plugin_dir}${PLUGIN_VARIANT}" - if test -z "$MYSQL_HOME" then if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf" @@ -496,6 +473,31 @@ fi parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld` parse_arguments PICK-ARGS-FROM-ARGV "$@" + +# +# Try to find the plugin directory +# + +# Use user-supplied argument +if [ -n "${PLUGIN_DIR}" ]; then + plugin_dir="${PLUGIN_DIR}" +else + # Try to find plugin dir relative to basedir + for dir in lib/mysql/plugin lib/plugin + do + if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then + plugin_dir="${MY_BASEDIR_VERSION}/${dir}" + break + fi + done + # Give up and use compiled-in default + if [ -z "${plugin_dir}" ]; then + plugin_dir='@pkgplugindir@' + fi +fi +plugin_dir="${plugin_dir}${PLUGIN_VARIANT}" + + # Determine what logging facility to use # Ensure that 'logger' exists, if it's requested From e2a34af35f3c708c22e145163533e3d230e0d768 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 Aug 2012 16:46:45 +0200 Subject: [PATCH 183/349] From 108474f01bd7b6a1b0d8dff8927ed0d257523840 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Aug 2012 16:13:34 +0200 Subject: [PATCH 184/349] From 95a937e368e20027ce126fecc257d31c8a10dcc9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Sep 2012 10:30:53 +0200 Subject: [PATCH 185/349] Raise version number after cloning 5.1.66 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 068328992e0..9f361d88a38 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.66], [], [mysql]) +AC_INIT([MySQL Server], [5.1.67], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 8c641484dc43571b16edeb9780a587472fc1f14b Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Tue, 11 Sep 2012 16:29:51 +0200 Subject: [PATCH 186/349] WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS Added deprecation warning for SHOW AUTHORS and SHOW CONTRIBUTORS. This is the 5.5 version of the patch. --- mysql-test/r/contributors.result | 2 ++ mysql-test/r/show_check.result | 11 +++++++++++ mysql-test/t/show_check.test | 14 ++++++++++++++ sql/sql_yacc.yy | 8 ++++++++ 4 files changed, 35 insertions(+) diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 5739c2244c3..19fdd96b4fb 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -3,3 +3,5 @@ Name Location Comment Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction Sheeri Kritzer Boston, Mass. USA EFF contribution for UC2006 Auction Mark Shuttleworth London, UK. EFF contribution for UC2006 Auction +Warnings: +Warning 1681 'SHOW CONTRIBUTORS' is deprecated and will be removed in a future release. diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index fb15f7e9a4e..1d4202efc18 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1552,3 +1552,14 @@ RELEASE_LOCK('t') óóóó 1 SET NAMES latin1; +# +# WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS +# +SHOW AUTHORS; +SHOW WARNINGS; +Level Code Message +Warning 1681 'SHOW AUTHORS' is deprecated and will be removed in a future release. +SHOW CONTRIBUTORS; +SHOW WARNINGS; +Level Code Message +Warning 1681 'SHOW CONTRIBUTORS' is deprecated and will be removed in a future release. diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 3a38b85f1ae..c2edef87d41 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1371,3 +1371,17 @@ SELECT RELEASE_LOCK('t'); --connection default SET NAMES latin1; + +--echo # +--echo # WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS +--echo # + +--disable_result_log +SHOW AUTHORS; +--enable_result_log +SHOW WARNINGS; + +--disable_result_log +SHOW CONTRIBUTORS; +--enable_result_log +SHOW WARNINGS; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 45024faa03f..e93ed4e8853 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -11010,11 +11010,19 @@ show_param: { LEX *lex=Lex; lex->sql_command= SQLCOM_SHOW_AUTHORS; + push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, + ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), + "SHOW AUTHORS"); } | CONTRIBUTORS_SYM { LEX *lex=Lex; lex->sql_command= SQLCOM_SHOW_CONTRIBUTORS; + push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, + ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), + "SHOW CONTRIBUTORS"); } | PRIVILEGES { From 26cd372516d9468896579b81bb651a572bc932fe Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 18 Sep 2012 13:38:43 +0200 Subject: [PATCH 187/349] Spec file for ULN RPMs: Restrict the vendor check to Oracle: There is no history here which we have to allow for. --- SPECIFIC-ULN/mysql.spec.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/SPECIFIC-ULN/mysql.spec.sh b/SPECIFIC-ULN/mysql.spec.sh index b0026f04773..8b25b160be1 100644 --- a/SPECIFIC-ULN/mysql.spec.sh +++ b/SPECIFIC-ULN/mysql.spec.sh @@ -26,9 +26,7 @@ # NOTE: "vendor" is used in upgrade/downgrade check, so you can't # change these, has to be exactly as is. # %define mysql_old_vendor MySQL AB # Applies to traditional MySQL RPMs only. -# %define mysql_vendor_2 Sun Microsystems, Inc. # Duplicated here to have code similar. -%define mysql_old_vendor Oracle and/or its affiliates -%define mysql_vendor_2 Oracle and/or its affiliates +# %define mysql_vendor_2 Sun Microsystems, Inc. %define mysql_vendor Oracle and/or its affiliates %define mysql_version @VERSION@ @@ -675,8 +673,6 @@ if [ $? -eq 0 -a -n "$installed" ]; then installed=`echo $installed | sed 's/\([^ ]*\) .*/\1/'` # Tests have shown duplicated package names vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` - myoldvendor='%{mysql_old_vendor}' - myvendor_2='%{mysql_vendor_2}' myvendor='%{mysql_vendor}' myversion='%{mysql_version}' @@ -690,12 +686,10 @@ if [ $? -eq 0 -a -n "$installed" ]; then [ -z "$new_family" ] && new_family="" error_text= - if [ "$vendor" != "$myoldvendor" \ - -a "$vendor" != "$myvendor_2" \ - -a "$vendor" != "$myvendor" ]; then + if [ "$vendor" != "$myvendor" ]; then error_text="$error_text The current MySQL server package is provided by a different -vendor ($vendor) than $myoldvendor, $myvendor_2, or $myvendor. +vendor ($vendor) than $myvendor. Some files may be installed to different locations, including log files and the service startup script in %{_sysconfdir}/init.d/. " @@ -970,6 +964,10 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Tue Sep 18 2012 Joerg Bruehe +- Restrict the vendor check to Oracle: There is no history here + which we have to allow for. + * Thu Jul 26 2012 Joerg Bruehe - Add the vendor and release series checks from the traditional MySQL RPM spec file, to protect against errors happening during upgrades. From 88f2746a7a22734d2f2aaa2ac20cc40665e52f6c Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 18 Sep 2012 17:32:02 +0200 Subject: [PATCH 188/349] Bug#14542543 FIX BUG #12694872 IN 5.5 Bug#14530242 CRASH / MEMORY CORRUPTION IN FILESORT_BUFFER::GET_RECORD_BUFFER WITH MYISAM This is a backport of Bug#12694872 - VALGRIND: 18,816 BYTES IN 196 BLOCKS ARE DEFINITELY LOST Bug#13340270: assertion table->sort.record_pointers == __null Bug#14536113 CRASH IN CLOSEFRM (TABLE.CC) OR UNPACK (FIELD.H) ON SUBQUERY WITH MYISAM TABLES Also: removed and re-added test files with file-ids from trunk. --- dbug/dbug.c | 2 +- sql/filesort.cc | 3 +++ sql/opt_range.cc | 7 ++++++- sql/sql_select.cc | 12 ++++++------ sql/uniques.cc | 7 ++++++- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/dbug/dbug.c b/dbug/dbug.c index 2dadf7bb2d5..d55195255d4 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -1179,7 +1179,7 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_) pthread_mutex_lock(&THR_LOCK_dbug); DoPrefix(cs, _line_); Indent(cs, cs->level); - (void) fprintf(cs->stack->out_file, "<%s\n", cs->func); + (void) fprintf(cs->stack->out_file, "<%s %u\n", cs->func, _line_); DbugFlush(cs); } } diff --git a/sql/filesort.cc b/sql/filesort.cc index dba09c969e3..a11be501991 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -138,6 +138,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, */ memcpy(&table_sort, &table->sort, sizeof(FILESORT_INFO)); table->sort.io_cache= NULL; + DBUG_ASSERT(table_sort.record_pointers == NULL); outfile= table_sort.io_cache; my_b_clear(&tempfile); @@ -366,6 +367,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, void filesort_free_buffers(TABLE *table, bool full) { + DBUG_ENTER("filesort_free_buffers"); my_free(table->sort.record_pointers); table->sort.record_pointers= NULL; @@ -383,6 +385,7 @@ void filesort_free_buffers(TABLE *table, bool full) my_free(table->sort.addon_field); table->sort.addon_buf= NULL; table->sort.addon_field= NULL; + DBUG_VOID_RETURN; } /** Make a array of string pointers. */ diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 8d221af392b..ce48a8da958 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -74,6 +74,7 @@ #include "records.h" // init_read_record, end_read_record #include #include "sql_select.h" +#include "filesort.h" // filesort_free_buffers #ifndef EXTRA_DEBUG #define test_rb_tree(A,B) {} @@ -1246,7 +1247,8 @@ int QUICK_INDEX_MERGE_SELECT::init() int QUICK_INDEX_MERGE_SELECT::reset() { DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::reset"); - DBUG_RETURN(read_keys_and_merge()); + const int retval= read_keys_and_merge(); + DBUG_RETURN(retval); } bool @@ -8295,7 +8297,10 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() thd->variables.sortbuff_size); } else + { unique->reset(); + filesort_free_buffers(head, false); + } DBUG_ASSERT(file->ref_length == unique->get_size()); DBUG_ASSERT(thd->variables.sortbuff_size == unique->get_max_in_memory_size()); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fd6d0e44597..3bde5aa8f6a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7173,14 +7173,14 @@ void JOIN::cleanup(bool full) { JOIN_TAB *tab,*end; /* - Only a sorted table may be cached. This sorted table is always the - first non const table in join->all_tables + Free resources allocated by filesort() and Unique::get() */ if (tables > const_tables) // Test for not-const tables - { - free_io_cache(all_tables[const_tables]); - filesort_free_buffers(all_tables[const_tables],full); - } + for (uint ix= const_tables; ix < tables; ++ix) + { + free_io_cache(all_tables[ix]); + filesort_free_buffers(all_tables[ix], full); + } if (full) { diff --git a/sql/uniques.cc b/sql/uniques.cc index e7ce2197147..71e680682cd 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -57,7 +57,10 @@ int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique) Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg, uint size_arg, ulonglong max_in_memory_size_arg) - :max_in_memory_size(max_in_memory_size_arg), size(size_arg), elements(0) + :max_in_memory_size(max_in_memory_size_arg), + record_pointers(NULL), + size(size_arg), + elements(0) { my_b_clear(&file); init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func, 0, @@ -583,6 +586,7 @@ bool Unique::get(TABLE *table) if (my_b_tell(&file) == 0) { /* Whole tree is in memory; Don't use disk if you don't need to */ + DBUG_ASSERT(table->sort.record_pointers == NULL); if ((record_pointers=table->sort.record_pointers= (uchar*) my_malloc(size * tree.elements_in_tree, MYF(0)))) { @@ -603,6 +607,7 @@ bool Unique::get(TABLE *table) bool error=1; /* Open cached file if it isn't open */ + DBUG_ASSERT(table->sort.io_cache == NULL); outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE), MYF(MY_ZEROFILL)); From 8bff5101b9c7ecd43f7cefa83844f12a07b92593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Sep 2012 09:04:34 +0300 Subject: [PATCH 189/349] Do not try innodb_change_buffering_debug=2. --- .../sys_vars/r/innodb_change_buffering_debug_basic.result | 3 --- .../suite/sys_vars/t/innodb_change_buffering_debug_basic.test | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result index 2b74f891050..fc0078581fb 100644 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result @@ -55,9 +55,6 @@ Warnings: Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '-2' set global innodb_change_buffering_debug=1e1; ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' -set global innodb_change_buffering_debug=2; -Warnings: -Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '2' SET @@global.innodb_change_buffering_debug = @start_global_value; SELECT @@global.innodb_change_buffering_debug; @@global.innodb_change_buffering_debug diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test index ec1065a538e..893d1cb42e3 100644 --- a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test @@ -42,7 +42,9 @@ set global innodb_change_buffering_debug='foo'; set global innodb_change_buffering_debug=-2; --error ER_WRONG_TYPE_FOR_VAR set global innodb_change_buffering_debug=1e1; -set global innodb_change_buffering_debug=2; +# The value 2 is supposed to kill the server if there are unmerged changes. +# Do not try to set the value to 2 or anything that can be clamped to 2. +#set global innodb_change_buffering_debug=2; # # Cleanup From 4fe5be1171060fac94bd5e62a838f67c5ddac39e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Sep 2012 12:37:25 +0300 Subject: [PATCH 190/349] From 76e4d6acf09f26a13f4d4378d2c0559973aa4638 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Thu, 20 Sep 2012 08:44:33 -0400 Subject: [PATCH 191/349] Bug#14594600 ASSERT FROM DROP TABLE CONCURRENT WITH IBUF MERGES rb://1293 approved by: Marko Makela There is race when dropping a single table tablespace where a reader thread can initiate a read request before the delete flag is set and before it is finished the deleting thread can attempt to free the fil_node. This patch checks the status in fil_io() to make sure that the tablespace is not being deleted. If it is being deleted then an error is returned instead of attempting IO. --- storage/innobase/fil/fil0fil.c | 69 ++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index 23fe76f2281..8fe33459994 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -187,14 +187,16 @@ struct fil_space_struct { requests on the file */ ibool stop_new_ops; /*!< we set this TRUE when we start - deleting a single-table tablespace */ - ibool is_being_deleted; - /*!< this is set to TRUE when we start - deleting a single-table tablespace and its - file; when this flag is set no further i/o - or flush requests can be placed on this space, - though there may be such requests still being - processed on this space */ + deleting a single-table tablespace. + When this is set following new ops + are not allowed: + * read IO request + * ibuf merge + * file flush + Note that we can still possibly have + new write operations because we don't + check this flag when doing flush + batches. */ ulint purpose;/*!< FIL_TABLESPACE, FIL_LOG, or FIL_ARCH_LOG */ UT_LIST_BASE_NODE_T(fil_node_t) chain; @@ -1286,7 +1288,6 @@ try_again: space->stop_ios = FALSE; space->stop_new_ops = FALSE; - space->is_being_deleted = FALSE; space->purpose = purpose; space->size = 0; space->flags = flags; @@ -2301,11 +2302,9 @@ try_again: return(FALSE); } - ut_a(space); + ut_a(space->stop_new_ops); ut_a(space->n_pending_ops == 0); - space->is_being_deleted = TRUE; - ut_a(UT_LIST_GET_LEN(space->chain) == 1); node = UT_LIST_GET_FIRST(space->chain); @@ -2348,13 +2347,26 @@ try_again: rw_lock_x_lock(&space->latch); #ifndef UNIV_HOTBACKUP - /* Invalidate in the buffer pool all pages belonging to the - tablespace. Since we have set space->is_being_deleted = TRUE, readahead - or ibuf merge can no longer read more pages of this tablespace to the - buffer pool. Thus we can clean the tablespace out of the buffer pool - completely and permanently. The flag is_being_deleted also prevents - fil_flush() from being applied to this tablespace. */ + /* IMPORTANT: Because we have set space::stop_new_ops there + can't be any new ibuf merges, reads or flushes. We are here + because node::n_pending was zero above. However, it is still + possible to have pending read and write requests: + A read request can happen because the reader thread has + gone through the ::stop_new_ops check in buf_page_init_for_read() + before the flag was set and has not yet incremented ::n_pending + when we checked it above. + + A write request can be issued any time because we don't check + the ::stop_new_ops flag when queueing a block for write. + + We deal with pending write requests in the following function + where we'd minimally evict all dirty pages belonging to this + space from the flush_list. Not that if a block is IO-fixed + we'll wait for IO to complete. + + To deal with potential read requests by checking the + ::stop_new_ops flag in fil_io() */ buf_LRU_flush_or_remove_pages( id, evict_all ? BUF_REMOVE_ALL_NO_WRITE @@ -2364,6 +2376,15 @@ try_again: mutex_enter(&fil_system->mutex); + /* Double check the sanity of pending ops after reacquiring + the fil_system::mutex. */ + if (fil_space_get_by_id(id)) { + ut_a(space->n_pending_ops == 0); + ut_a(UT_LIST_GET_LEN(space->chain) == 1); + node = UT_LIST_GET_FIRST(space->chain); + ut_a(node->n_pending == 0); + } + success = fil_space_free(id, TRUE); mutex_exit(&fil_system->mutex); @@ -2421,7 +2442,7 @@ fil_tablespace_is_being_deleted( ut_a(space != NULL); - is_being_deleted = space->is_being_deleted; + is_being_deleted = space->stop_new_ops; mutex_exit(&fil_system->mutex); @@ -3695,7 +3716,7 @@ fil_tablespace_deleted_or_being_deleted_in_mem( space = fil_space_get_by_id(id); - if (space == NULL || space->is_being_deleted) { + if (space == NULL || space->stop_new_ops) { mutex_exit(&fil_system->mutex); return(TRUE); @@ -4408,7 +4429,9 @@ fil_io( space = fil_space_get_by_id(space_id); - if (!space) { + /* If we are deleting a tablespace we don't allow any read + operations on that. However, we do allow write operations. */ + if (!space || (type == OS_FILE_READ && space->stop_new_ops)) { mutex_exit(&fil_system->mutex); ut_print_timestamp(stderr); @@ -4624,7 +4647,7 @@ fil_flush( space = fil_space_get_by_id(space_id); - if (!space || space->is_being_deleted) { + if (!space || space->stop_new_ops) { mutex_exit(&fil_system->mutex); return; @@ -4755,7 +4778,7 @@ fil_flush_file_spaces( space; space = UT_LIST_GET_NEXT(unflushed_spaces, space)) { - if (space->purpose == purpose && !space->is_being_deleted) { + if (space->purpose == purpose && !space->stop_new_ops) { space_ids[n_space_ids++] = space->id; } From 04b5f518599313412c79ea5beb0bf0aa806bf983 Mon Sep 17 00:00:00 2001 From: Akhila Maddukuri Date: Thu, 27 Sep 2012 02:06:08 +0530 Subject: [PATCH 192/349] Description: ----------- After compiling from source, during make test I got the following error: test main.loaddata failed with error CURRENT_TEST: main.loaddata mysqltest: At line 592: query 'LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 (@b) SET a=REVERSE(@b)' failed: 1115: Unknown character set: 'ucs2' I noticed other tests are skipped because of no ucs2 main.mix2_myisam_ucs2 [ skipped ] Test requires:' have_ucs2' Should main.loaddata be skipped if there is no ucs2 How To Repeat: ------------- Run make test on compiled source that doesn't have ucs2 Suggested fix: ------------- the failing piece of the test should be moved from mysql-test/t/loaddata.test to mysql-test/t/ctype_ucs.test. --- mysql-test/r/loaddata.result | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index fc33e6c0b5f..932c1c76027 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -504,37 +504,6 @@ CREATE TABLE t1 (id INT NOT NULL); LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; DROP TABLE t1; # -# Bug #51876 : crash/memory underrun when loading data with ucs2 -# and reverse() function -# -# Problem # 1 (original report): wrong parsing of ucs2 data -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); -Warnings: -Warning 1366 Incorrect integer value: '?' for column 'a' at row 1 -Warning 1366 Incorrect integer value: '?' for column 'a' at row 2 -# should return 2 zeroes (as the value is truncated) -SELECT * FROM t1; -a -0 -0 -DROP TABLE t1; -# Problem # 2 : if you write and read ucs2 data to a file they're lost -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); -# should return 0 and 1 (10 reversed) -SELECT * FROM t1; -a -0 -1 -DROP TABLE t1; -# - - # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U # CREATE TABLE t1(f1 INT); From 4bbb20157efbfa46712c3b4e9e6decd8b07d1806 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Sep 2012 12:12:34 +0530 Subject: [PATCH 193/349] From a47d8d76652d95f2a1340141bf63e17f73b4e9e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 1 Oct 2012 08:44:52 +0200 Subject: [PATCH 194/349] Merge from mysql-5.5.28-release From 7dbada1674aee6914aff096885dd18a7ea7b73c0 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Tue, 2 Oct 2012 22:05:51 +0400 Subject: [PATCH 195/349] BUG#12604949. Increased timeout for switching sync->async. Number of iterations for loops sets 10. --- mysql-test/suite/rpl/r/rpl_semi_sync.result | 23 +++++++++++---------- mysql-test/suite/rpl/t/rpl_semi_sync.test | 7 ++++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index 0c3a98d5d90..0377716698c 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -93,7 +93,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 301 +Rpl_semi_sync_master_yes_tx 11 [ on slave ] [ slave status after replicated inserts ] show status like 'Rpl_semi_sync_slave_status'; @@ -101,13 +101,13 @@ Variable_name Value Rpl_semi_sync_slave_status ON select count(distinct a) from t1; count(distinct a) -300 +10 select min(a) from t1; min(a) 1 select max(a) from t1; max(a) -300 +10 # BUG#50157 # semi-sync replication crashes when replicating a transaction which @@ -133,6 +133,7 @@ SET SESSION AUTOCOMMIT= 1; # include/stop_slave.inc [ on master ] +set global rpl_semi_sync_master_timeout= 5000; [ master status should be ON ] show status like 'Rpl_semi_sync_master_status'; Variable_name Value @@ -142,7 +143,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 304 +Rpl_semi_sync_master_yes_tx 14 show status like 'Rpl_semi_sync_master_clients'; Variable_name Value Rpl_semi_sync_master_clients 1 @@ -157,7 +158,7 @@ Variable_name Value Rpl_semi_sync_master_no_tx 1 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 304 +Rpl_semi_sync_master_yes_tx 14 insert into t1 values (100); [ master status should be OFF ] show status like 'Rpl_semi_sync_master_status'; @@ -165,10 +166,10 @@ Variable_name Value Rpl_semi_sync_master_status OFF show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value -Rpl_semi_sync_master_no_tx 302 +Rpl_semi_sync_master_no_tx 12 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 304 +Rpl_semi_sync_master_yes_tx 14 # # Test semi-sync status on master will be ON again when slave catches up # @@ -198,10 +199,10 @@ Variable_name Value Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value -Rpl_semi_sync_master_no_tx 302 +Rpl_semi_sync_master_no_tx 12 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 304 +Rpl_semi_sync_master_yes_tx 14 show status like 'Rpl_semi_sync_master_clients'; Variable_name Value Rpl_semi_sync_master_clients 1 @@ -217,10 +218,10 @@ include/stop_slave.inc [ Semi-sync master status variables before FLUSH STATUS ] SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; Variable_name Value -Rpl_semi_sync_master_no_tx 302 +Rpl_semi_sync_master_no_tx 12 SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 305 +Rpl_semi_sync_master_yes_tx 15 FLUSH NO_WRITE_TO_BINLOG STATUS; [ Semi-sync master status variables after FLUSH STATUS ] SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 228757496f3..21967fb6f8c 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -63,7 +63,7 @@ if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN'; - set global rpl_semi_sync_master_timeout= 5000; /* 5s */ + set global rpl_semi_sync_master_timeout= 60000; /* 60s */ set sql_log_bin=1; } enable_query_log; @@ -170,7 +170,7 @@ replace_result $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE; replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE; eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0'; -let $i=300; +let $i=10; echo [ insert records to table ]; disable_query_log; while ($i) @@ -234,6 +234,7 @@ source include/stop_slave.inc; connection master; echo [ on master ]; +set global rpl_semi_sync_master_timeout= 5000; # The first semi-sync check should be on because after slave stop, # there are no transactions on the master. @@ -260,7 +261,7 @@ show status like 'Rpl_semi_sync_master_yes_tx'; # Semi-sync status on master is now OFF, so all these transactions # will be replicated asynchronously. -let $i=300; +let $i=10; disable_query_log; while ($i) { From 8ce6582c37be81281b7ada6797c456c661c214dd Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Mon, 10 Sep 2012 13:32:50 +0200 Subject: [PATCH 196/349] Bug#14495351: CRASH IN HA_PARTITION::HANDLE_UNORDERED_NEXT The partitioning engine does not implement index_next for partitions which return HA_ERR_KEY_NOT_FOUND in index_read_map. If HA_ERR_KEY_NOT_FOUND was returned by a partition during index_read_map, that partition would not be included in following calls to index_next. If no partition returned a row in index_read_map, then the subsequent call to index_next would try to use a non existing handler (index out of bound). Even after fixing the index out of bound if at least one partition returned. So it is really two connected bugs 1) crash due to index out of bound (-1 unsigned). 2) not including partitions that returned HA_ERR_KEY_NOT_FOUND. Fixed by recording the partitions that returned HA_ERR_KEY_NOT_FOUND, and include them too when doing handle_ordered_next the first time. --- sql/ha_partition.cc | 218 ++++++++++++++++++++++++++++++++++---------- sql/ha_partition.h | 4 + 2 files changed, 176 insertions(+), 46 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 14b89bf0dc8..e9ffc7abbac 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2670,6 +2670,17 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE)) DBUG_RETURN(error); bitmap_clear_all(&m_bulk_insert_started); + /* + Initialize the bitmap we use to keep track of partitions which returned + HA_ERR_KEY_NOT_FOUND from index_read_map. + */ + if (bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE)) + { + bitmap_free(&m_bulk_insert_started); + DBUG_RETURN(error); + } + bitmap_clear_all(&m_key_not_found_partitions); + m_key_not_found= false; /* Initialize the bitmap we use to determine what partitions are used */ if (!m_is_clone_of) { @@ -2810,6 +2821,7 @@ err_handler: (*file)->close(); err_alloc: bitmap_free(&m_bulk_insert_started); + bitmap_free(&m_key_not_found_partitions); if (!m_is_clone_of) bitmap_free(&(m_part_info->used_partitions)); @@ -2886,6 +2898,7 @@ int ha_partition::close(void) DBUG_ASSERT(table->s == table_share); destroy_record_priority_queue(); bitmap_free(&m_bulk_insert_started); + bitmap_free(&m_key_not_found_partitions); if (!m_is_clone_of) bitmap_free(&(m_part_info->used_partitions)); file= m_file; @@ -4419,21 +4432,24 @@ int ha_partition::index_read_map(uchar *buf, const uchar *key, } -/* +/** Common routine for a number of index_read variants - SYNOPSIS - ha_partition::common_index_read() - buf Buffer where the record should be returned - have_start_key TRUE <=> the left endpoint is available, i.e. - we're in index_read call or in read_range_first - call and the range has left endpoint - - FALSE <=> there is no left endpoint (we're in - read_range_first() call and the range has no left - endpoint) + @param buf Buffer where the record should be returned. + @param have_start_key TRUE <=> the left endpoint is available, i.e. + we're in index_read call or in read_range_first + call and the range has left endpoint. + FALSE <=> there is no left endpoint (we're in + read_range_first() call and the range has no left + endpoint). - DESCRIPTION + @return Operation status + @retval 0 OK + @retval HA_ERR_END_OF_FILE Whole index scanned, without finding the record. + @retval HA_ERR_KEY_NOT_FOUND Record not found, but index cursor positioned. + @retval other error code. + + @details Start scanning the range (when invoked from read_range_first()) or doing an index lookup (when invoked from index_read_XXX): - If possible, perform partition selection @@ -4443,10 +4459,6 @@ int ha_partition::index_read_map(uchar *buf, const uchar *key, handle_unordered_scan_next_partition) YES: Fill the priority queue and get the record that is the first in the ordering - - RETURN - 0 OK - other HA_ERR_END_OF_FILE or other error code. */ int ha_partition::common_index_read(uchar *buf, bool have_start_key) @@ -4456,14 +4468,16 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key) bool reverse_order= FALSE; DBUG_ENTER("ha_partition::common_index_read"); - DBUG_PRINT("info", ("m_ordered %u m_ordered_scan_ong %u have_start_key %u", - m_ordered, m_ordered_scan_ongoing, have_start_key)); + DBUG_PRINT("info", ("m_ordered %u m_ordered_scan_ong %u", + m_ordered, m_ordered_scan_ongoing)); if (have_start_key) { m_start_key.length= key_len= calculate_key_len(table, active_index, m_start_key.key, m_start_key.keypart_map); + DBUG_PRINT("info", ("have_start_key map %u find_flag %u len %u", + m_start_key.keypart_map, m_start_key.flag, key_len)); DBUG_ASSERT(key_len); } if ((error= partition_scan_set_up(buf, have_start_key))) @@ -4481,24 +4495,16 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key) } DBUG_PRINT("info", ("m_ordered %u m_o_scan_ong %u have_start_key %u", m_ordered, m_ordered_scan_ongoing, have_start_key)); - if (!m_ordered_scan_ongoing || - (have_start_key && m_start_key.flag == HA_READ_KEY_EXACT && - !m_pkey_is_clustered && - key_len >= m_curr_key_info[0]->key_length)) + if (!m_ordered_scan_ongoing) { /* - We use unordered index scan either when read_range is used and flag - is set to not use ordered or when an exact key is used and in this - case all records will be sorted equal and thus the sort order of the - resulting records doesn't matter. + We use unordered index scan when read_range is used and flag + is set to not use ordered. We also use an unordered index scan when the number of partitions to scan is only one. The unordered index scan will use the partition set created. - Need to set unordered scan ongoing since we can come here even when - it isn't set. */ DBUG_PRINT("info", ("doing unordered scan")); - m_ordered_scan_ongoing= FALSE; error= handle_unordered_scan_next_partition(buf); } else @@ -4616,7 +4622,7 @@ int ha_partition::common_first_last(uchar *buf) int ha_partition::index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map) { - DBUG_ENTER("ha_partition::index_read_last"); + DBUG_ENTER("ha_partition::index_read_last_map"); m_ordered= TRUE; // Safety measure end_range= 0; @@ -4709,6 +4715,8 @@ int ha_partition::index_next(uchar * buf) TODO(low priority): If we want partition to work with the HANDLER commands, we must be able to do index_last() -> index_prev() -> index_next() + and if direction changes, we must step back those partitions in + the record queue so we don't return a value from the wrong direction. */ DBUG_ASSERT(m_index_scan_type != partition_index_last); if (!m_ordered_scan_ongoing) @@ -4960,10 +4968,18 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag) int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same) { - handler *file= m_file[m_part_spec.start_part]; + handler *file; int error; DBUG_ENTER("ha_partition::handle_unordered_next"); + if (m_part_spec.start_part >= m_tot_parts) + { + /* Should never happen! */ + DBUG_ASSERT(0); + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + file= m_file[m_part_spec.start_part]; + /* We should consider if this should be split into three functions as partition_read_range is_next_same are always local constants @@ -5024,6 +5040,7 @@ int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same) int ha_partition::handle_unordered_scan_next_partition(uchar * buf) { uint i; + int saved_error= HA_ERR_END_OF_FILE; DBUG_ENTER("ha_partition::handle_unordered_scan_next_partition"); for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) @@ -5074,26 +5091,33 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf) } if ((error != HA_ERR_END_OF_FILE) && (error != HA_ERR_KEY_NOT_FOUND)) DBUG_RETURN(error); - DBUG_PRINT("info", ("HA_ERR_END_OF_FILE on partition %d", i)); + + /* + If HA_ERR_KEY_NOT_FOUND, we must return that error instead of + HA_ERR_END_OF_FILE, to be able to continue search. + */ + if (saved_error != HA_ERR_KEY_NOT_FOUND) + saved_error= error; + DBUG_PRINT("info", ("END_OF_FILE/KEY_NOT_FOUND on partition %d", i)); } - m_part_spec.start_part= NO_CURRENT_PART_ID; - DBUG_RETURN(HA_ERR_END_OF_FILE); + if (saved_error == HA_ERR_END_OF_FILE) + m_part_spec.start_part= NO_CURRENT_PART_ID; + DBUG_RETURN(saved_error); } -/* - Common routine to start index scan with ordered results +/** + Common routine to start index scan with ordered results. - SYNOPSIS - handle_ordered_index_scan() - out:buf Read row in MySQL Row Format + @param[out] buf Read row in MySQL Row Format - RETURN VALUE - HA_ERR_END_OF_FILE End of scan - 0 Success - other Error code + @return Operation status + @retval HA_ERR_END_OF_FILE End of scan + @retval HA_ERR_KEY_NOT_FOUNE End of scan + @retval 0 Success + @retval other Error code - DESCRIPTION + @details This part contains the logic to handle index scans that require ordered output. This includes all except those started by read_range_first with the flag ordered set to FALSE. Thus most direct index_read and all @@ -5115,8 +5139,14 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) uint j= 0; bool found= FALSE; uchar *part_rec_buf_ptr= m_ordered_rec_buffer; + int saved_error= HA_ERR_END_OF_FILE; DBUG_ENTER("ha_partition::handle_ordered_index_scan"); + if (m_key_not_found) + { + m_key_not_found= false; + bitmap_clear_all(&m_key_not_found_partitions); + } m_top_entry= NO_CURRENT_PART_ID; queue_remove_all(&m_queue); @@ -5178,6 +5208,13 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) { DBUG_RETURN(error); } + else if (error == HA_ERR_KEY_NOT_FOUND) + { + DBUG_PRINT("info", ("HA_ERR_KEY_NOT_FOUND from partition %u", i)); + bitmap_set_bit(&m_key_not_found_partitions, i); + m_key_not_found= true; + saved_error= error; + } part_rec_buf_ptr+= m_rec_length + PARTITION_BYTES_IN_POS; } if (found) @@ -5195,7 +5232,7 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) DBUG_PRINT("info", ("Record returned from partition %d", m_top_entry)); DBUG_RETURN(0); } - DBUG_RETURN(HA_ERR_END_OF_FILE); + DBUG_RETURN(saved_error); } @@ -5223,6 +5260,59 @@ void ha_partition::return_top_record(uchar *buf) } +/** + Add index_next/prev from partitions without exact match. + + If there where any partitions that returned HA_ERR_KEY_NOT_FOUND when + ha_index_read_map was done, those partitions must be included in the + following index_next/prev call. +*/ + +int ha_partition::handle_ordered_index_scan_key_not_found() +{ + int error; + uint i; + uchar *part_buf= m_ordered_rec_buffer; + uchar *curr_rec_buf= NULL; + DBUG_ENTER("ha_partition::handle_ordered_index_scan_key_not_found"); + DBUG_ASSERT(m_key_not_found); + /* + Loop over all used partitions to get the correct offset + into m_ordered_rec_buffer. + */ + for (i= 0; i < m_tot_parts; i++) + { + if (!bitmap_is_set(&m_part_info->used_partitions, i)) + continue; + + if (bitmap_is_set(&m_key_not_found_partitions, i)) + { + /* + This partition is used and did return HA_ERR_KEY_NOT_FOUND + in index_read_map. + */ + curr_rec_buf= part_buf + PARTITION_BYTES_IN_POS; + error= m_file[i]->index_next(curr_rec_buf); + /* HA_ERR_KEY_NOT_FOUND is not allowed from index_next! */ + DBUG_ASSERT(error != HA_ERR_KEY_NOT_FOUND); + if (!error) + queue_insert(&m_queue, part_buf); + else if (error != HA_ERR_END_OF_FILE && error != HA_ERR_KEY_NOT_FOUND) + DBUG_RETURN(error); + } + part_buf+= m_rec_length + PARTITION_BYTES_IN_POS; + } + DBUG_ASSERT(curr_rec_buf); + bitmap_clear_all(&m_key_not_found_partitions); + m_key_not_found= false; + + /* Update m_top_entry, which may have changed. */ + uchar *key_buffer= queue_top(&m_queue); + m_top_entry= uint2korr(key_buffer); + DBUG_RETURN(0); +} + + /* Common routine to handle index_next with ordered results @@ -5242,9 +5332,45 @@ int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) int error; uint part_id= m_top_entry; uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS; - handler *file= m_file[part_id]; + handler *file; DBUG_ENTER("ha_partition::handle_ordered_next"); + if (m_key_not_found) + { + if (is_next_same) + { + /* Only rows which match the key. */ + m_key_not_found= false; + bitmap_clear_all(&m_key_not_found_partitions); + } + else + { + /* There are partitions not included in the index record queue. */ + uint old_elements= m_queue.elements; + if ((error= handle_ordered_index_scan_key_not_found())) + DBUG_RETURN(error); + /* + If the queue top changed, i.e. one of the partitions that gave + HA_ERR_KEY_NOT_FOUND in index_read_map found the next record, + return it. + Otherwise replace the old with a call to index_next (fall through). + */ + if (old_elements != m_queue.elements && part_id != m_top_entry) + { + return_top_record(buf); + DBUG_RETURN(0); + } + } + } + if (part_id >= m_tot_parts) + { + /* This should never happen! */ + DBUG_ASSERT(0); + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + + file= m_file[part_id]; + if (m_index_scan_type == partition_read_range) { error= file->read_range_next(); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 294e9f8adf6..24f04ee596b 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -183,6 +183,9 @@ private: static int compare_number_of_records(ha_partition *me, const uint32 *a, const uint32 *b); + /** partitions that returned HA_ERR_KEY_NOT_FOUND. */ + MY_BITMAP m_key_not_found_partitions; + bool m_key_not_found; public: handler *clone(const char *name, MEM_ROOT *mem_root); virtual void set_part_info(partition_info *part_info) @@ -519,6 +522,7 @@ private: int handle_unordered_next(uchar * buf, bool next_same); int handle_unordered_scan_next_partition(uchar * buf); int handle_ordered_index_scan(uchar * buf, bool reverse_order); + int handle_ordered_index_scan_key_not_found(); int handle_ordered_next(uchar * buf, bool next_same); int handle_ordered_prev(uchar * buf); void return_top_record(uchar * buf); From 0678a68bd0edeaa48a6e912d5a0bf3b65fb78fb0 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Mon, 10 Sep 2012 17:32:04 +0300 Subject: [PATCH 197/349] Bug#14597605 Issue with Null-value user on slave An "orthographic" typo in User_var::set_deferred() was made in fixes for bug@14275000. While editing the signature of the initial patch to remove the only argument, the assigned value of the argument remained in the body ... to be successfully compiled (!) thanks to names coincidence: the arg to User_var method and its member. Fixed with correcting the typo. --- sql/log_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/log_event.h b/sql/log_event.h index 5030e1c6f3d..6b411a90382 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2508,7 +2508,7 @@ public: and which case the applier adjusts execution path. */ bool is_deferred() { return deferred; } - void set_deferred() { deferred= val; } + void set_deferred() { deferred= true; } #endif bool is_valid() const { return 1; } From 575a64c48edcc049ae2ec09bffd72f37adbae3da Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 11 Sep 2012 20:56:22 +0200 Subject: [PATCH 198/349] Backport this change from MySQL 5.5 to 5.1: Bug #14181049: MYSQL_INSTALL_DB.PL CREATES EMPTY SYSTEM TABLES FOR MYSQL The script is different from what's used on unixes. It was not playing the table insertion script (mysql_system_tables_data.sql), although it was checking for the presence of this script. Fixed by re-enabling the lookup for this file and replaying it at bootstrap time. Note that on the Unixes "SELECT @@hostname" does return a fully qualified name, whereas on Windows it returns only a hostname. So by default we're filtering records in the mysql.user table until we ensure this is fixed. The change was coded in 5.5 by Georgi Kodinov --- scripts/mysql_install_db.pl.in | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index c63da6df537..12cd6a21ad1 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -423,10 +423,11 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap, "--bootstrap", "--basedir=$opt->{basedir}", "--datadir=$opt->{ldata}", - "--skip-innodb", - "--skip-bdb", - "--skip-ndbcluster", + "--log-warnings=0", + "--loose-skip-innodb", + "--loose-skip-ndbcluster", "--max_allowed_packet=8M", + "--default-storage-engine=MyISAM", "--net_buffer_length=16K", @args, ); @@ -439,6 +440,8 @@ report_verbose_wait($opt,"Installing MySQL system tables..."); open(SQL, $create_system_tables) or error($opt,"can't open $create_system_tables for reading: $!"); +open(SQL2, $fill_system_tables) + or error($opt,"can't open $fill_system_tables for reading: $!"); # FIXME > /dev/null ? if ( open(PIPE, "| $mysqld_install_cmd_line") ) { @@ -452,8 +455,20 @@ if ( open(PIPE, "| $mysqld_install_cmd_line") ) print PIPE $_; } + while ( ) + { + # TODO: make it similar to the above condition when we're sure + # @@hostname returns a fqdn + # When doing a "cross bootstrap" install, no reference to the current + # host should be added to the system tables. So we filter out any + # lines which contain the current host name. + next if /\@current_hostname/; + + print PIPE $_; + } close PIPE; close SQL; + close SQL2; report_verbose($opt,"OK"); From f0b52a9e7e26b761e14911a7a072d4cf91ceab54 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 12 Sep 2012 08:36:12 +0200 Subject: [PATCH 199/349] Backport Bug#13724099 --- sql/sql_list.h | 11 +++++++++-- sql/sql_select.cc | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/sql/sql_list.h b/sql/sql_list.h index 81283a6ae53..2eef291d948 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -1,7 +1,6 @@ #ifndef INCLUDES_MYSQL_SQL_LIST_H #define INCLUDES_MYSQL_SQL_LIST_H -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -165,6 +164,14 @@ protected: public: uint elements; + bool operator==(const base_list &rhs) const + { + return + elements == rhs.elements && + first == rhs.first && + last == rhs.last; + } + inline void empty() { elements=0; first= &end_of_list; last=&first;} inline base_list() { empty(); } /** diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 042e7563d42..bcf601e5142 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1676,6 +1676,8 @@ JOIN::optimize() */ void JOIN::restore_tmp() { + DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join)); + DBUG_ASSERT(tmp_join != this); memcpy(tmp_join, this, (size_t) sizeof(JOIN)); } @@ -7090,13 +7092,18 @@ void JOIN::cleanup(bool full) { if (tmp_join) tmp_table_param.copy_field= 0; - group_fields.delete_elements(); + /* - Ensure that the above delete_elements() would not be called + Ensure that the following delete_elements() would not be called twice for the same list. */ - if (tmp_join && tmp_join != this) - tmp_join->group_fields= group_fields; + if (tmp_join && tmp_join != this && + tmp_join->group_fields == this->group_fields) + tmp_join->group_fields.empty(); + + // Run Cached_item DTORs! + group_fields.delete_elements(); + /* We can't call delete_elements() on copy_funcs as this will cause problems in free_elements() as some of the elements are then deleted. From ab7358fb35c01df5a716c0b15d041bdf2ceae71e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Sep 2012 15:08:44 +0300 Subject: [PATCH 200/349] From 5cbdb908270a052284155cd5b7eff7eacb177218 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Mon, 17 Sep 2012 11:48:02 +0530 Subject: [PATCH 201/349] Bug#11750014:ASSERTION TRX_DATA->EMPTY() IN BINLOG_CLOSE_CONNECTION Problem: ======= trx_data->empty() assert happens at `binlog_close_connection' Analysis: ======== trx_data->empty() function checks for no pending events and the transaction cache to be empty.This function returns "true" if no pending events are present and cache is empty. Otherwise it returns false. `binlog_close_connection' call expects the above function to return true. But if the return value is false then assert is raised. This bug was reproducible in a diskfull scenario. In this disk full scenario try to do an insert operation so that a new pending event is created and flushing this pending event fails. Due to this failure the server goes down and invokes `binlog_close_connection' for clean closure. Since the pending event still remains the assert is caused. This assert is caused only in non transactional databases. Fix: === In a disk full scenario when the insertion fails the transaction is rolled back and `binlog_end_trans` is called to flush the pending events. But flush operation fails as the disk is full and the function simply returns `1' without taking any action to delete the pending event. This leaves the event to remain till the closure of connection. `delete pending' statement has been added to do the required clean up action. sql/log.cc: Added "delete pending" statement to clean pending event --- sql/log.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sql/log.cc b/sql/log.cc index 57c14b24782..7e0e90e28c0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4313,10 +4313,16 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd, /* Write pending event to log file or transaction cache */ + DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending", + {DBUG_SET("+d,simulate_file_write_error");}); if (pending->write(file)) { pthread_mutex_unlock(&LOCK_log); set_write_error(thd); + delete pending; + trx_data->set_pending(NULL); + DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending", + {DBUG_SET("-d,simulate_file_write_error");}); DBUG_RETURN(1); } From 300f3fb77f3cc402b454a5f35e56efcefa2e7fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 17 Sep 2012 14:21:00 +0300 Subject: [PATCH 202/349] Bug#12701488 ASSERT PAGE_ZIP_VALIDATE, UNIV_ZIP_DEBUG page_zip_validate(), page_zip_validate_low(): Add a parameter for the B-tree index. page_zip_validate_low(): If the page contents does not match, check that the record link chains match. Furthermore, if dict_index_t is passed, check that the records match. (This reduces coverage a bit: if index=NULL, we will ignore differences in record contents, that is, the page payload.) rb:1264 approved by Inaam Rana --- storage/innodb_plugin/ChangeLog | 7 ++ storage/innodb_plugin/btr/btr0btr.c | 34 ++--- storage/innodb_plugin/btr/btr0cur.c | 25 ++-- storage/innodb_plugin/buf/buf0lru.c | 4 +- storage/innodb_plugin/include/page0zip.h | 8 +- storage/innodb_plugin/log/log0recv.c | 5 +- storage/innodb_plugin/page/page0cur.c | 6 +- storage/innodb_plugin/page/page0page.c | 14 ++- storage/innodb_plugin/page/page0zip.c | 151 ++++++++++++++++------- 9 files changed, 168 insertions(+), 86 deletions(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 4ef88e3bca1..7521b593aa2 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,10 @@ +2012-09-17 The InnoDB Team + + * btr/btr0btr.c, btr/btr0cur.c, buf/buf0lru.c, + include/page0zip.h, log/log0recv.c, page/page0cur.c, + page/page0page.c, page/page0zip.c: + Fix Bug#12701488 ASSERT PAGE_ZIP_VALIDATE, UNIV_ZIP_DEBUG + 2012-08-29 The InnoDB Team * btr/btr0btr.c, page/page0cur.c, page/page0page.c: diff --git a/storage/innodb_plugin/btr/btr0btr.c b/storage/innodb_plugin/btr/btr0btr.c index 604c56b5e73..9fef7843f9a 100644 --- a/storage/innodb_plugin/btr/btr0btr.c +++ b/storage/innodb_plugin/btr/btr0btr.c @@ -1573,7 +1573,7 @@ btr_page_reorganize_low( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table)); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ data_size1 = page_get_data_size(page); max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1); @@ -1691,7 +1691,7 @@ btr_page_reorganize_low( func_exit: #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ #ifndef UNIV_HOTBACKUP buf_block_free(temp_block); @@ -1766,7 +1766,7 @@ btr_page_empty( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(page_zip == buf_block_get_page_zip(block)); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ btr_search_drop_page_hash_index(block); @@ -1823,10 +1823,10 @@ btr_root_raise_and_insert( root_block = btr_cur_get_block(cursor); root_page_zip = buf_block_get_page_zip(root_block); ut_ad(page_get_n_recs(root) > 0); -#ifdef UNIV_ZIP_DEBUG - ut_a(!root_page_zip || page_zip_validate(root_page_zip, root)); -#endif /* UNIV_ZIP_DEBUG */ index = btr_cur_get_index(cursor); +#ifdef UNIV_ZIP_DEBUG + ut_a(!root_page_zip || page_zip_validate(root_page_zip, root, index)); +#endif /* UNIV_ZIP_DEBUG */ #ifdef UNIV_BTR_DEBUG if (!dict_index_is_ibuf(index)) { ulint space = dict_index_get_space(index); @@ -2756,8 +2756,8 @@ insert_empty: #ifdef UNIV_ZIP_DEBUG if (UNIV_LIKELY_NULL(page_zip)) { - ut_a(page_zip_validate(page_zip, page)); - ut_a(page_zip_validate(new_page_zip, new_page)); + ut_a(page_zip_validate(page_zip, page, cursor->index)); + ut_a(page_zip_validate(new_page_zip, new_page, cursor->index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -2791,7 +2791,8 @@ insert_empty: = buf_block_get_page_zip(insert_block); ut_a(!insert_page_zip - || page_zip_validate(insert_page_zip, insert_page)); + || page_zip_validate(insert_page_zip, insert_page, + cursor->index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -3156,7 +3157,7 @@ btr_lift_page_up( btr_page_set_level(page, page_zip, page_level, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3332,8 +3333,8 @@ err_exit: const page_zip_des_t* page_zip = buf_block_get_page_zip(block); ut_a(page_zip); - ut_a(page_zip_validate(merge_page_zip, merge_page)); - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(merge_page_zip, merge_page, index)); + ut_a(page_zip_validate(page_zip, page, index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -3466,7 +3467,8 @@ err_exit: ut_ad(page_validate(merge_page, index)); #ifdef UNIV_ZIP_DEBUG - ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page)); + ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page, + index)); #endif /* UNIV_ZIP_DEBUG */ /* Free the file page */ @@ -3649,7 +3651,7 @@ btr_discard_page( page_zip_des_t* merge_page_zip = buf_block_get_page_zip(merge_block); ut_a(!merge_page_zip - || page_zip_validate(merge_page_zip, merge_page)); + || page_zip_validate(merge_page_zip, merge_page, index)); } #endif /* UNIV_ZIP_DEBUG */ @@ -4126,7 +4128,7 @@ btr_validate_level( ut_a(space == page_get_space_id(page)); #ifdef UNIV_ZIP_DEBUG page_zip = buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ ut_a(!page_is_leaf(page)); @@ -4154,7 +4156,7 @@ loop: #ifdef UNIV_ZIP_DEBUG page_zip = buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ /* Check ordering etc. of records */ diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c index 8fb4366d894..798d2822431 100644 --- a/storage/innodb_plugin/btr/btr0cur.c +++ b/storage/innodb_plugin/btr/btr0cur.c @@ -578,7 +578,8 @@ retry_page_get: #ifdef UNIV_ZIP_DEBUG const page_zip_des_t* page_zip = buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip + || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ buf_block_dbg_add_level( @@ -1939,7 +1940,7 @@ any_extern: page_zip = buf_block_get_page_zip(block); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (page_zip @@ -2148,7 +2149,7 @@ btr_cur_pessimistic_update( MTR_MEMO_X_LOCK)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ /* The insert buffer tree should never be updated in place. */ ut_ad(!dict_index_is_ibuf(index)); @@ -2286,7 +2287,7 @@ make_external: btr_search_update_hash_on_delete(cursor); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_cursor = btr_cur_get_page_cur(cursor); @@ -2393,7 +2394,7 @@ make_external: buf_block_t* rec_block = btr_cur_get_block(cursor); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); page = buf_block_get_frame(rec_block); #endif /* UNIV_ZIP_DEBUG */ page_zip = buf_block_get_page_zip(rec_block); @@ -2419,7 +2420,7 @@ make_external: return_after_reservations: #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (n_extents > 0) { @@ -2880,12 +2881,14 @@ btr_cur_optimistic_delete( page, 1); } #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip + || page_zip_validate(page_zip, page, cursor->index)); #endif /* UNIV_ZIP_DEBUG */ page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, offsets, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip + || page_zip_validate(page_zip, page, cursor->index)); #endif /* UNIV_ZIP_DEBUG */ if (dict_index_is_clust(cursor->index) @@ -2980,7 +2983,7 @@ btr_cur_pessimistic_delete( rec = btr_cur_get_rec(cursor); page_zip = buf_block_get_page_zip(block); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); @@ -2990,7 +2993,7 @@ btr_cur_pessimistic_delete( rec, offsets, page_zip, rb_ctx, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3051,7 +3054,7 @@ btr_cur_pessimistic_delete( page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ ut_ad(btr_check_node_ptr(index, block, mtr)); diff --git a/storage/innodb_plugin/buf/buf0lru.c b/storage/innodb_plugin/buf/buf0lru.c index 5124787eba1..71cb1293df8 100644 --- a/storage/innodb_plugin/buf/buf0lru.c +++ b/storage/innodb_plugin/buf/buf0lru.c @@ -1642,7 +1642,9 @@ buf_LRU_block_remove_hashed_page( break; case FIL_PAGE_INDEX: #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(&bpage->zip, page)); + ut_a(page_zip_validate( + &bpage->zip, page, + ((buf_block_t*) bpage)->index)); #endif /* UNIV_ZIP_DEBUG */ break; default: diff --git a/storage/innodb_plugin/include/page0zip.h b/storage/innodb_plugin/include/page0zip.h index 00c1d0516e6..9cf3b9805bc 100644 --- a/storage/innodb_plugin/include/page0zip.h +++ b/storage/innodb_plugin/include/page0zip.h @@ -156,9 +156,10 @@ page_zip_validate_low( /*==================*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index, /*!< in: index of the page, if known */ ibool sloppy) /*!< in: FALSE=strict, TRUE=ignore the MIN_REC_FLAG */ - __attribute__((nonnull)); + __attribute__((nonnull(1,2))); /**********************************************************************//** Check that the compressed and decompressed pages match. */ UNIV_INTERN @@ -166,8 +167,9 @@ ibool page_zip_validate( /*==============*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ - const page_t* page) /*!< in: uncompressed page */ - __attribute__((nonnull)); + const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index) /*!< in: index of the page, if known */ + __attribute__((nonnull(1,2))); #endif /* UNIV_ZIP_DEBUG */ /**********************************************************************//** diff --git a/storage/innodb_plugin/log/log0recv.c b/storage/innodb_plugin/log/log0recv.c index 1591bb02ec2..677ada9fbde 100644 --- a/storage/innodb_plugin/log/log0recv.c +++ b/storage/innodb_plugin/log/log0recv.c @@ -1626,9 +1626,8 @@ recv_recover_page_func( if (fil_page_get_type(page) == FIL_PAGE_INDEX) { page_zip_des_t* page_zip = buf_block_get_page_zip(block); - if (page_zip) { - ut_a(page_zip_validate_low(page_zip, page, FALSE)); - } + ut_a(!page_zip + || page_zip_validate_low(page_zip, page, NULL, FALSE)); } #endif /* UNIV_ZIP_DEBUG */ diff --git a/storage/innodb_plugin/page/page0cur.c b/storage/innodb_plugin/page/page0cur.c index 00fb55d169c..dd7a707dfd9 100644 --- a/storage/innodb_plugin/page/page0cur.c +++ b/storage/innodb_plugin/page/page0cur.c @@ -310,7 +310,7 @@ page_cur_search_with_match( #endif /* UNIV_DEBUG */ page = buf_block_get_frame(block); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_check_dir(page); @@ -1248,7 +1248,7 @@ page_cur_insert_rec_zip( ut_ad(!page_rec_is_supremum(*current_rec)); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ /* 1. Get the size of the physical record in the page */ @@ -1973,7 +1973,7 @@ page_cur_delete_rec( } #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } diff --git a/storage/innodb_plugin/page/page0page.c b/storage/innodb_plugin/page/page0page.c index a85789f5c32..44364333296 100644 --- a/storage/innodb_plugin/page/page0page.c +++ b/storage/innodb_plugin/page/page0page.c @@ -625,7 +625,7 @@ page_copy_rec_list_end( Furthermore, btr_compress() may set FIL_PAGE_PREV to FIL_NULL on new_page while leaving it intact on new_page_zip. So, we cannot validate new_page_zip. */ - ut_a(page_zip_validate_low(page_zip, page, TRUE)); + ut_a(page_zip_validate_low(page_zip, page, index, TRUE)); } #endif /* UNIV_ZIP_DEBUG */ ut_ad(buf_block_get_frame(block) == page); @@ -945,7 +945,7 @@ page_delete_rec_list_end( ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE); ut_ad(!page_zip || page_rec_is_comp(rec)); #ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page)); + ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (page_rec_is_infimum(rec)) { @@ -987,7 +987,7 @@ page_delete_rec_list_end( ULINT_UNDEFINED, &heap); rec = rec_get_next_ptr(rec, TRUE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_cur_delete_rec(&cur, index, offsets, mtr); } while (page_offset(rec) != PAGE_NEW_SUPREMUM); @@ -1127,7 +1127,8 @@ page_delete_rec_list_start( between btr_attach_half_pages() and insert_page = ... when btr_page_get_split_rec_to_left() holds (direction == FSP_DOWN). */ - ut_a(!page_zip || page_zip_validate_low(page_zip, page, TRUE)); + ut_a(!page_zip + || page_zip_validate_low(page_zip, page, index, TRUE)); } #endif /* UNIV_ZIP_DEBUG */ @@ -1198,9 +1199,10 @@ page_move_rec_list_end( = buf_block_get_page_zip(block); ut_a(!new_page_zip == !page_zip); ut_a(!new_page_zip - || page_zip_validate(new_page_zip, new_page)); + || page_zip_validate(new_page_zip, new_page, index)); ut_a(!page_zip - || page_zip_validate(page_zip, page_align(split_rec))); + || page_zip_validate(page_zip, page_align(split_rec), + index)); } #endif /* UNIV_ZIP_DEBUG */ diff --git a/storage/innodb_plugin/page/page0zip.c b/storage/innodb_plugin/page/page0zip.c index 9f00fb4d1e0..546401ccec0 100644 --- a/storage/innodb_plugin/page/page0zip.c +++ b/storage/innodb_plugin/page/page0zip.c @@ -1433,7 +1433,7 @@ err_exit: page_zip_get_size(page_zip) - PAGE_DATA); mem_heap_free(heap); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (mtr) { @@ -3119,6 +3119,7 @@ page_zip_validate_low( /*==================*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index, /*!< in: index of the page, if known */ ibool sloppy) /*!< in: FALSE=strict, TRUE=ignore the MIN_REC_FLAG */ { @@ -3206,39 +3207,102 @@ page_zip_validate_low( committed. Let us tolerate that difference when we are performing a sloppy validation. */ - if (sloppy) { - byte info_bits_diff; - ulint offset - = rec_get_next_offs(page + PAGE_NEW_INFIMUM, - TRUE); - ut_a(offset >= PAGE_NEW_SUPREMUM); - offset -= 5 /* REC_NEW_INFO_BITS */; + ulint* offsets; + mem_heap_t* heap; + const rec_t* rec; + const rec_t* trec; + byte info_bits_diff; + ulint offset + = rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE); + ut_a(offset >= PAGE_NEW_SUPREMUM); + offset -= 5/*REC_NEW_INFO_BITS*/; - info_bits_diff = page[offset] ^ temp_page[offset]; + info_bits_diff = page[offset] ^ temp_page[offset]; - if (info_bits_diff == REC_INFO_MIN_REC_FLAG) { - temp_page[offset] = page[offset]; + if (info_bits_diff == REC_INFO_MIN_REC_FLAG) { + temp_page[offset] = page[offset]; - if (!memcmp(page + PAGE_HEADER, - temp_page + PAGE_HEADER, - UNIV_PAGE_SIZE - PAGE_HEADER - - FIL_PAGE_DATA_END)) { + if (!memcmp(page + PAGE_HEADER, + temp_page + PAGE_HEADER, + UNIV_PAGE_SIZE - PAGE_HEADER + - FIL_PAGE_DATA_END)) { - /* Only the minimum record flag - differed. Let us ignore it. */ - page_zip_fail(("page_zip_validate: " - "min_rec_flag " - "(ignored, " - "%lu,%lu,0x%02lx)\n", - page_get_space_id(page), - page_get_page_no(page), - (ulong) page[offset])); - goto func_exit; - } + /* Only the minimum record flag + differed. Let us ignore it. */ + page_zip_fail(("page_zip_validate: " + "min_rec_flag " + "(%s" + "%lu,%lu,0x%02lx)\n", + sloppy ? "ignored, " : "", + page_get_space_id(page), + page_get_page_no(page), + (ulong) page[offset])); + valid = sloppy; + goto func_exit; } } - page_zip_fail(("page_zip_validate: content\n")); - valid = FALSE; + + /* Compare the pointers in the PAGE_FREE list. */ + rec = page_header_get_ptr(page, PAGE_FREE); + trec = page_header_get_ptr(temp_page, PAGE_FREE); + + while (rec || trec) { + if (page_offset(rec) != page_offset(trec)) { + page_zip_fail(("page_zip_validate: " + "PAGE_FREE list: %u!=%u\n", + (unsigned) page_offset(rec), + (unsigned) page_offset(trec))); + valid = FALSE; + goto func_exit; + } + + rec = page_rec_get_next_low(rec, TRUE); + trec = page_rec_get_next_low(trec, TRUE); + } + + /* Compare the records. */ + heap = NULL; + offsets = NULL; + rec = page_rec_get_next_low( + page + PAGE_NEW_INFIMUM, TRUE); + trec = page_rec_get_next_low( + temp_page + PAGE_NEW_INFIMUM, TRUE); + + do { + if (page_offset(rec) != page_offset(trec)) { + page_zip_fail(("page_zip_validate: " + "record list: 0x%02x!=0x%02x\n", + (unsigned) page_offset(rec), + (unsigned) page_offset(trec))); + valid = FALSE; + break; + } + + if (index) { + /* Compare the data. */ + offsets = rec_get_offsets( + rec, index, offsets, + ULINT_UNDEFINED, &heap); + + if (memcmp(rec - rec_offs_extra_size(offsets), + trec - rec_offs_extra_size(offsets), + rec_offs_size(offsets))) { + page_zip_fail( + ("page_zip_validate: " + "record content: 0x%02x", + (unsigned) page_offset(rec))); + valid = FALSE; + break; + } + } + + rec = page_rec_get_next_low(rec, TRUE); + trec = page_rec_get_next_low(trec, TRUE); + } while (rec || trec); + + if (heap) { + mem_heap_free(heap); + } } func_exit: @@ -3260,9 +3324,10 @@ ibool page_zip_validate( /*==============*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ - const page_t* page) /*!< in: uncompressed page */ + const page_t* page, /*!< in: uncompressed page */ + const dict_index_t* index) /*!< in: index of the page, if known */ { - return(page_zip_validate_low(page_zip, page, + return(page_zip_validate_low(page_zip, page, index, recv_recovery_is_on())); } #endif /* UNIV_ZIP_DEBUG */ @@ -3593,7 +3658,7 @@ page_zip_write_rec( page_zip->m_nonempty = TRUE; #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page_align(rec))); + ut_a(page_zip_validate(page_zip, page_align(rec), index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3640,7 +3705,7 @@ corrupt: } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ memcpy(page + offset, @@ -3649,7 +3714,7 @@ corrupt: ptr + 4, BTR_EXTERN_FIELD_REF_SIZE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -3716,7 +3781,7 @@ page_zip_write_blob_ptr( memcpy(externs, field, BTR_EXTERN_FIELD_REF_SIZE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ if (mtr) { @@ -3787,7 +3852,7 @@ corrupt: } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ field = page + offset; @@ -3808,7 +3873,7 @@ corrupt: memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4035,7 +4100,7 @@ page_zip_clear_rec( } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4059,7 +4124,7 @@ page_zip_rec_set_deleted( *slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8); } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page_align(rec))); + ut_a(page_zip_validate(page_zip, page_align(rec), NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4360,14 +4425,14 @@ corrupt: goto corrupt; } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ memcpy(page + offset, ptr, len); memcpy(page_zip->data + offset, ptr, len); #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, NULL)); #endif /* UNIV_ZIP_DEBUG */ } @@ -4442,7 +4507,7 @@ page_zip_reorganize( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(page_is_comp(page)); ut_ad(!dict_index_is_ibuf(index)); - /* Note that page_zip_validate(page_zip, page) may fail here. */ + /* Note that page_zip_validate(page_zip, page, index) may fail here. */ UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); @@ -4529,7 +4594,7 @@ page_zip_copy_recs( FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag mismatch. A strict page_zip_validate() will be executed later during the B-tree operations. */ - ut_a(page_zip_validate_low(src_zip, src, TRUE)); + ut_a(page_zip_validate_low(src_zip, src, index, TRUE)); #endif /* UNIV_ZIP_DEBUG */ ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip)); if (UNIV_UNLIKELY(src_zip->n_blobs)) { @@ -4590,7 +4655,7 @@ page_zip_copy_recs( } #ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page)); + ut_a(page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ btr_blob_dbg_add(page, index, "page_zip_copy_recs"); From 9d007e075d6b933df9dbd1a42d52ab00ee91827c Mon Sep 17 00:00:00 2001 From: Harin Vadodaria Date: Mon, 17 Sep 2012 17:02:17 +0530 Subject: [PATCH 203/349] Bug#11753779: MAX_CONNECT_ERRORS WORKS ONLY WHEN 1ST INC_HOST_ERRORS() IS CALLED. Issue : Sequence of calling inc_host_errors() and reset_host_errors() required some changes in order to maintain correct connection error count. Solution : Call to reset_host_errors() is shifted to a location after which no calls to inc_host_errors() are made. --- sql/hostname.cc | 9 ++++++ sql/sql_connect.cc | 68 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 69 insertions(+), 8 deletions(-) diff --git a/sql/hostname.cc b/sql/hostname.cc index 9796755e9fb..38316a8ee19 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -214,6 +214,15 @@ char * ip_to_hostname(struct in_addr *in, uint *errors) } my_gethostbyname_r_free(); #else + + DBUG_EXECUTE_IF("addr_fake_ipv4", + { + const char* fake_host= "santa.claus.ipv4.example.com"; + name=my_strdup(fake_host, MYF(0)); + add_hostname(in,name); + DBUG_RETURN(name); + };); + VOID(pthread_mutex_lock(&LOCK_hostname)); if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET))) { diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 21e2701d06c..e7aa48c94f5 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -336,6 +336,7 @@ check_user(THD *thd, enum enum_server_command command, USER_RESOURCES ur; int res= acl_getroot(thd, &ur, passwd, passwd_len); + DBUG_EXECUTE_IF("password_format_mismatch",{res= -1;};); #ifndef EMBEDDED_LIBRARY if (res == -1) { @@ -346,6 +347,12 @@ check_user(THD *thd, enum enum_server_command command, in old format. */ NET *net= &thd->net; + DBUG_EXECUTE_IF("password_format_mismatch", + { + inc_host_errors(&thd->remote.sin_addr); + my_error(ER_HANDSHAKE_ERROR, MYF(0)); + DBUG_RETURN(1); + };); if (opt_secure_auth_local) { my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0), @@ -816,6 +823,8 @@ static int check_connection(THD *thd) size_t passwd_len; char *user; size_t user_len; + uint charset_code= 0; + size_t bytes_remaining_in_packet= 0; DBUG_PRINT("info", ("New connection received on %s", vio_description(net->vio))); @@ -832,6 +841,19 @@ static int check_connection(THD *thd) my_error(ER_BAD_HOST_ERROR, MYF(0)); return 1; } + /* BEGIN : DEBUG */ + DBUG_EXECUTE_IF("addr_fake_ipv4", + { + struct sockaddr *sa= (sockaddr *) &net->vio->remote; + sa->sa_family= AF_INET; + struct in_addr *ip4= &((struct sockaddr_in *)sa)->sin_addr; + /* See RFC 5737, 192.0.2.0/23 is reserved */ + const char* fake= "192.0.2.4"; + ip4->s_addr= inet_addr(fake); + strcpy(ip, fake); + };); + /* END : DEBUG */ + if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME)))) return 1; /* The error is set by my_strdup(). */ thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip; @@ -927,32 +949,31 @@ static int check_connection(THD *thd) (uchar*) buff, (size_t) (end-buff)) || (pkt_len= my_net_read(net)) == packet_error) { - inc_host_errors(&thd->remote.sin_addr); - my_error(ER_HANDSHAKE_ERROR, MYF(0)); - return 1; + goto error; } } #ifdef _CUSTOMCONFIG_ #include "_cust_sql_parse.h" #endif - if (connect_errors) - reset_host_errors(&thd->remote.sin_addr); if (thd->packet.alloc(thd->variables.net_buffer_length)) return 1; /* The error is set by alloc(). */ - uint charset_code= 0; end= (char *)net->read_pos; /* In order to safely scan a head for '\0' string terminators we must keep track of how many bytes remain in the allocated buffer or we might read past the end of the buffer. */ - size_t bytes_remaining_in_packet= pkt_len; + bytes_remaining_in_packet= pkt_len; /* Peek ahead on the client capability packet and determine which version of the protocol should be used. */ + DBUG_EXECUTE_IF("host_error_packet_length", + { + bytes_remaining_in_packet= 0; + };); if (bytes_remaining_in_packet < 2) goto error; @@ -1011,6 +1032,10 @@ static int check_connection(THD *thd) skip_to_ssl: + DBUG_EXECUTE_IF("host_error_charset", + { + goto error; + };); DBUG_PRINT("info", ("client_character_set: %u", charset_code)); if (thd_init_client_charset(thd, charset_code)) goto error; @@ -1079,6 +1104,10 @@ skip_to_ssl: bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_40; } + DBUG_EXECUTE_IF("host_error_SSL_layering", + { + packet_has_required_size= 0; + };); if (!packet_has_required_size) goto error; } @@ -1104,6 +1133,11 @@ skip_to_ssl: get_string= get_40_protocol_string; user= get_string(&end, &bytes_remaining_in_packet, &user_len); + DBUG_EXECUTE_IF("host_error_user", + { + user= NULL; + };); + if (user == NULL) goto error; @@ -1131,6 +1165,11 @@ skip_to_ssl: passwd= get_string(&end, &bytes_remaining_in_packet, &passwd_len); } + DBUG_EXECUTE_IF("host_error_password", + { + passwd= NULL; + };); + if (passwd == NULL) goto error; @@ -1191,7 +1230,20 @@ skip_to_ssl: if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME)))) return 1; /* The error is set by my_strdup(). */ - return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE); + + if (!check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE)) + { + /* + Call to reset_host_errors() should be made only when all sanity checks + are done and connection is going to be a successful. + */ + reset_host_errors(&thd->remote.sin_addr); + return 0; + } + else + { + return 1; + } error: inc_host_errors(&thd->remote.sin_addr); From 6bbe24e9a00d9190df72c353810ae909e5116994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 19 Sep 2012 22:35:38 +0300 Subject: [PATCH 204/349] Bug#14636528 INNODB CHANGE BUFFERING IS NOT ENTIRELY CRASH-SAFE Delete-mark change buffer records when resorting to a pessimistic delete from the change buffer B-tree. Skip delete-marked records in the change buffer merge and when estimating whether an operation can be buffered. Without this fix, we could try to apply the same buffered changes multiple times if the server was killed at the right moment. In MySQL 5.5 and later: ibuf_get_volume_buffered_count_func(): Ignore delete-marked (already processed) records. ibuf_delete_rec(): Add a crash point before optimistic delete. If the optimistic delete fails, flag the record processed before mtr_commit(). ibuf_merge_or_delete_for_page(): Ignore delete-marked (already processed) records. Backport to 5.1: Rename btr_cur_del_unmark_for_ibuf() to btr_cur_set_deleted_flag_for_ibuf() and add a parameter. rb:1307 approved by Jimmy Yang --- storage/innobase/btr/btr0cur.c | 11 ++++---- storage/innobase/handler/ha_innodb.cc | 4 +-- storage/innobase/ibuf/ibuf0ibuf.c | 28 ++++++++++++++++++--- storage/innobase/include/btr0cur.h | 9 ++++--- storage/innodb_plugin/ChangeLog | 6 +++++ storage/innodb_plugin/btr/btr0cur.c | 15 +++++------ storage/innodb_plugin/handler/ha_innodb.cc | 4 +-- storage/innodb_plugin/ibuf/ibuf0ibuf.c | 29 +++++++++++++++++++--- storage/innodb_plugin/include/btr0cur.h | 11 ++++---- 9 files changed, 86 insertions(+), 31 deletions(-) diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 4678ea8cd22..389e95bcb0a 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -2377,21 +2377,22 @@ btr_cur_del_mark_set_sec_rec( } /*************************************************************** -Sets a secondary index record delete mark to FALSE. This function is only +Sets a secondary index record delete mark. This function is only used by the insert buffer insert merge mechanism. */ void -btr_cur_del_unmark_for_ibuf( -/*========================*/ +btr_cur_set_deleted_flag_for_ibuf( +/*==============================*/ rec_t* rec, /* in: record to delete unmark */ + ibool val, /* in: value to set */ mtr_t* mtr) /* in: mtr */ { /* We do not need to reserve btr_search_latch, as the page has just been read to the buffer pool and there cannot be a hash index to it. */ - rec_set_deleted_flag(rec, page_is_comp(buf_frame_align(rec)), FALSE); + rec_set_deleted_flag(rec, page_is_comp(buf_frame_align(rec)), val); - btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr); + btr_cur_del_mark_set_sec_rec_log(rec, val, mtr); } /*==================== B-TREE RECORD REMOVE =========================*/ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index df465d016e1..bcb903d22bf 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -9265,8 +9265,8 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method, #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, PLUGIN_VAR_RQCMDARG, - "Debug flags for InnoDB change buffering (0=none)", - NULL, NULL, 0, 0, 1, 0); + "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)", + NULL, NULL, 0, 0, 2, 0); #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ #ifdef UNIV_DEBUG diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 476d78e79ba..e2b5bda44fd 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -2978,7 +2978,7 @@ dump: /* The records only differ in the delete-mark. Clear the delete-mark, like we did before Bug #56680 was fixed. */ - btr_cur_del_unmark_for_ibuf(rec, mtr); + btr_cur_set_deleted_flag_for_ibuf(rec, FALSE, mtr); updated_in_place: mem_heap_free(heap); return; @@ -3058,6 +3058,22 @@ ibuf_delete_rec( ut_ad(ibuf_inside()); +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug == 2) { + /* Inject a fault (crash). We do this before trying + optimistic delete, because a pessimistic delete in the + change buffer would require a larger test case. */ + + /* Flag the buffered record as processed, to avoid + an assertion failure after crash recovery. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), TRUE, mtr); + mtr_commit(mtr); + log_make_checkpoint_at(ut_dulint_max, TRUE); + DBUG_SUICIDE(); + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); if (success) { @@ -3072,7 +3088,13 @@ ibuf_delete_rec( return(FALSE); } - /* We have to resort to a pessimistic delete from ibuf */ + /* We have to resort to a pessimistic delete from ibuf. + Delete-mark the record so that it will not be applied again, + in case the server crashes before the pessimistic delete is + made persistent. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), TRUE, mtr); + btr_pcur_store_position(pcur, mtr); btr_pcur_commit_specify_mtr(pcur, mtr); @@ -3343,7 +3365,7 @@ loop: fputs("InnoDB: Discarding record\n ", stderr); rec_print_old(stderr, ibuf_rec); fputs("\n from the insert buffer!\n\n", stderr); - } else if (page) { + } else if (page && !rec_get_deleted_flag(ibuf_rec, 0)) { /* Now we have at pcur a record which should be inserted to the index page; NOTE that the call below copies pointers to fields in ibuf_rec, and we must diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 20235c55f22..341d628c6dc 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -277,13 +277,14 @@ btr_cur_del_mark_set_sec_rec( que_thr_t* thr, /* in: query thread */ mtr_t* mtr); /* in: mtr */ /*************************************************************** -Sets a secondary index record delete mark to FALSE. This function is -only used by the insert buffer insert merge mechanism. */ +Sets a secondary index record delete mark. This function is only +used by the insert buffer insert merge mechanism. */ void -btr_cur_del_unmark_for_ibuf( -/*========================*/ +btr_cur_set_deleted_flag_for_ibuf( +/*==============================*/ rec_t* rec, /* in: record to delete unmark */ + ibool val, /* in: value to set */ mtr_t* mtr); /* in: mtr */ /***************************************************************** Tries to compress a page of the tree on the leaf level. It is assumed diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 7521b593aa2..f71ca0b009a 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2012-09-18 The InnoDB Team + + * btr/btr0cur.c, handler/ha_innodb.cc, ibuf/ibuf0ibuf.c, + include/btr0cur.h: + Fix Bug#14636528 INNODB CHANGE BUFFERING IS NOT ENTIRELY CRASH-SAFE + 2012-09-17 The InnoDB Team * btr/btr0btr.c, btr/btr0cur.c, buf/buf0lru.c, diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c index 798d2822431..6c67d27ffec 100644 --- a/storage/innodb_plugin/btr/btr0cur.c +++ b/storage/innodb_plugin/btr/btr0cur.c @@ -2769,19 +2769,20 @@ btr_cur_del_mark_set_sec_rec( return(DB_SUCCESS); } -/***********************************************************//** -Clear a secondary index record's delete mark. This function is only +/*************************************************************** +Sets a secondary index record delete mark. This function is only used by the insert buffer insert merge mechanism. */ UNIV_INTERN void -btr_cur_del_unmark_for_ibuf( -/*========================*/ +btr_cur_set_deleted_flag_for_ibuf( +/*==============================*/ rec_t* rec, /*!< in/out: record to delete unmark */ page_zip_des_t* page_zip, /*!< in/out: compressed page corresponding to rec, or NULL when the tablespace is uncompressed */ - mtr_t* mtr) /*!< in: mtr */ + ibool val, /*!< in: value to set */ + mtr_t* mtr) /*!< in/out: mini-transaction */ { /* We do not need to reserve btr_search_latch, as the page has just been read to the buffer pool and there cannot be @@ -2789,9 +2790,9 @@ btr_cur_del_unmark_for_ibuf( updated in place and the adaptive hash index does not depend on it. */ - btr_rec_set_deleted_flag(rec, page_zip, FALSE); + btr_rec_set_deleted_flag(rec, page_zip, val); - btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr); + btr_cur_del_mark_set_sec_rec_log(rec, val, mtr); } /*==================== B-TREE RECORD REMOVE =========================*/ diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 7e3ecce77bd..bbdf5680e30 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -11242,8 +11242,8 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method, #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, PLUGIN_VAR_RQCMDARG, - "Debug flags for InnoDB change buffering (0=none)", - NULL, NULL, 0, 0, 1, 0); + "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)", + NULL, NULL, 0, 0, 2, 0); #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, diff --git a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c index 965d8df7d0c..c1c72b04f69 100644 --- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c +++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c @@ -3042,7 +3042,8 @@ dump: /* The records only differ in the delete-mark. Clear the delete-mark, like we did before Bug #56680 was fixed. */ - btr_cur_del_unmark_for_ibuf(rec, page_zip, mtr); + btr_cur_set_deleted_flag_for_ibuf( + rec, page_zip, FALSE, mtr); updated_in_place: mem_heap_free(heap); return; @@ -3127,6 +3128,22 @@ ibuf_delete_rec( ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no); ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space); +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug == 2) { + /* Inject a fault (crash). We do this before trying + optimistic delete, because a pessimistic delete in the + change buffer would require a larger test case. */ + + /* Flag the buffered record as processed, to avoid + an assertion failure after crash recovery. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), NULL, TRUE, mtr); + mtr_commit(mtr); + log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE); + DBUG_SUICIDE(); + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); if (success) { @@ -3145,7 +3162,13 @@ ibuf_delete_rec( ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no); ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space); - /* We have to resort to a pessimistic delete from ibuf */ + /* We have to resort to a pessimistic delete from ibuf. + Delete-mark the record so that it will not be applied again, + in case the server crashes before the pessimistic delete is + made persistent. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), NULL, TRUE, mtr); + btr_pcur_store_position(pcur, mtr); btr_pcur_commit_specify_mtr(pcur, mtr); @@ -3454,7 +3477,7 @@ loop: fputs("InnoDB: Discarding record\n ", stderr); rec_print_old(stderr, rec); fputs("\nInnoDB: from the insert buffer!\n\n", stderr); - } else if (block) { + } else if (block && !rec_get_deleted_flag(rec, 0)) { /* Now we have at pcur a record which should be inserted to the index page; NOTE that the call below copies pointers to fields in rec, and we must diff --git a/storage/innodb_plugin/include/btr0cur.h b/storage/innodb_plugin/include/btr0cur.h index afc111970e2..1c421167828 100644 --- a/storage/innodb_plugin/include/btr0cur.h +++ b/storage/innodb_plugin/include/btr0cur.h @@ -357,19 +357,20 @@ btr_cur_del_mark_set_sec_rec( ibool val, /*!< in: value to set */ que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr); /*!< in: mtr */ -/***********************************************************//** -Clear a secondary index record's delete mark. This function is only +/*************************************************************** +Sets a secondary index record delete mark. This function is only used by the insert buffer insert merge mechanism. */ UNIV_INTERN void -btr_cur_del_unmark_for_ibuf( -/*========================*/ +btr_cur_set_deleted_flag_for_ibuf( +/*==============================*/ rec_t* rec, /*!< in/out: record to delete unmark */ page_zip_des_t* page_zip, /*!< in/out: compressed page corresponding to rec, or NULL when the tablespace is uncompressed */ - mtr_t* mtr); /*!< in: mtr */ + ibool val, /*!< in: value to set */ + mtr_t* mtr); /*!< in/out: mini-transaction */ /*************************************************************//** Tries to compress a page of the tree if it seems useful. It is assumed that mtr holds an x-latch on the tree and on the cursor page. To avoid From 373c428fbb4730bf2d1f6287b49d2aa5ef6ea362 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Sep 2012 12:31:26 +0300 Subject: [PATCH 205/349] From 1f419232486730a8cdf5428d04ce1df0d0abfb7f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Sep 2012 10:54:09 +0200 Subject: [PATCH 206/349] From f820334bbfd0cc6effdab7e947bb095885566a70 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Fri, 21 Sep 2012 23:28:55 +0530 Subject: [PATCH 207/349] Bug#14645196 MYSQL CLIENT'S USE COMMAND FAILS WHEN DBNAME CONTAINS MULTIPLE QUOTES MySQL client's USE command might fail if the database name contains multiple quotes (backticks). The reason behind the failure being the method that client uses to remove/escape the quotes while parsing the USE command's option (dbname), where the option parsing might terminate if a matching quote is found. Also, C-APIs like mysql_select_db() expect a normalized dbname. Now, in certain cases, client might fail to normalize dbname similar to that of server and hence mysql_select_db() would fail. Fixed by getting the normalized dbname (indirectly) from the server by directly sending the "USE dbanme" as query to the server followed by a "SELECT DATABASE()". The above steps are only performed if number of quotes in the dbname is greater than 2. Once the normalized dbname is received, the original db is restored. --- client/mysql.cc | 91 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 3cb28e81164..965b1929af8 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -242,6 +242,8 @@ static const char* construct_prompt(); static char *get_arg(char *line, my_bool get_next_arg); static void init_username(); static void add_int_to_prompt(int toadd); +static int normalize_dbname(const char *line, char *buff, uint buff_size); +static int get_quote_count(const char *line); /* A structure which contains information on the commands this program can understand. */ @@ -4112,8 +4114,23 @@ com_use(String *buffer __attribute__((unused)), char *line) int select_db; bzero(buff, sizeof(buff)); - strmake(buff, line, sizeof(buff) - 1); - tmp= get_arg(buff, 0); + + /* + In case number of quotes exceed 2, we try to get + the normalized db name. + */ + if (get_quote_count(line) > 2) + { + if (normalize_dbname(line, buff, sizeof(buff))) + return put_error(&mysql); + tmp= buff; + } + else + { + strmake(buff, line, sizeof(buff) - 1); + tmp= get_arg(buff, 0); + } + if (!tmp || !*tmp) { put_info("USE must be followed by a database name", INFO_ERROR); @@ -4179,6 +4196,62 @@ com_use(String *buffer __attribute__((unused)), char *line) return 0; } +/** + Normalize database name. + + @param line [IN] The command. + @param buff [OUT] Normalized db name. + @param buff_size [IN] Buffer size. + + @return Operation status + @retval 0 Success + @retval 1 Failure + + @note Sometimes server normilizes the database names + & APIs like mysql_select_db() expect normalized + database names. Since it is difficult to perform + the name conversion/normalization on the client + side, this function tries to get the normalized + dbname (indirectly) from the server. +*/ + +static int +normalize_dbname(const char *line, char *buff, uint buff_size) +{ + MYSQL_RES *res= NULL; + + /* Send the "USE db" commmand to the server. */ + if (mysql_query(&mysql, line)) + return 1; + + /* + Now, get the normalized database name and store it + into the buff. + */ + if (!mysql_query(&mysql, "SELECT DATABASE()") && + (res= mysql_use_result(&mysql))) + { + MYSQL_ROW row= mysql_fetch_row(res); + if (row && row[0]) + { + size_t len= strlen(row[0]); + /* Make sure there is enough room to store the dbname. */ + if ((len > buff_size) || ! memcpy(buff, row[0], len)) + { + mysql_free_result(res); + return 1; + } + } + mysql_free_result(res); + } + + /* Restore the original database. */ + if (current_db && mysql_select_db(&mysql, current_db)) + return 1; + + return 0; +} + static int com_warnings(String *buffer __attribute__((unused)), char *line __attribute__((unused))) @@ -4258,6 +4331,20 @@ char *get_arg(char *line, my_bool get_next_arg) return valid_arg ? start : NullS; } +/* + Number of quotes present in the command's argument. +*/ +static int +get_quote_count(const char *line) +{ + int quote_count; + const char *ptr= line; + + for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`")) + quote_count ++; + + return quote_count; +} static int sql_real_connect(char *host,char *database,char *user,char *password, From 5530c5e38dbefac8e5d2c333c0f35ed9f73946a4 Mon Sep 17 00:00:00 2001 From: Rohit Kalhans Date: Sat, 22 Sep 2012 17:50:51 +0530 Subject: [PATCH 208/349] BUG#14548159: NUMEROUS CASES OF INCORRECT IDENTIFIER QUOTING IN REPLICATION Problem: Misquoting or unquoted identifiers may lead to incorrect statements to be logged to the binary log. Fix: we use specialized functions to append quoted identifiers in the statements generated by the server. --- mysql-test/r/mysqlbinlog.result | 32 +- mysql-test/r/mysqlbinlog2.result | 70 ++-- mysql-test/r/mysqlbinlog_row.result | 384 +++++++++--------- mysql-test/r/mysqlbinlog_row_innodb.result | 210 +++++----- mysql-test/r/mysqlbinlog_row_myisam.result | 210 +++++----- mysql-test/r/mysqlbinlog_row_trans.result | 72 ++-- mysql-test/r/user_var-binlog.result | 2 +- .../suite/binlog/r/binlog_base64_flag.result | 2 +- .../r/binlog_row_mysqlbinlog_verbose.result | 56 +-- .../binlog/r/binlog_stm_ctype_ucs.result | 2 +- .../suite/rpl/r/rpl_row_mysqlbinlog.result | 8 +- mysql-test/suite/rpl/r/rpl_sp.result | 12 +- sql/ha_ndbcluster_binlog.cc | 31 +- sql/log.cc | 35 +- sql/log_event.cc | 209 ++++++++-- sql/log_event.h | 16 + sql/sql_base.cc | 31 +- sql/sql_db.cc | 35 +- sql/sql_insert.cc | 19 +- sql/sql_load.cc | 28 +- sql/sql_show.cc | 3 +- sql/sql_show.h | 1 + sql/sql_table.cc | 22 +- 23 files changed, 830 insertions(+), 660 deletions(-) diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 45068ddfaec..540ecd99479 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -18,7 +18,7 @@ flush logs; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -64,7 +64,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -97,7 +97,7 @@ Warning: The option '--position' is deprecated and will be removed in a future r /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -119,7 +119,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -165,7 +165,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -198,7 +198,7 @@ Warning: The option '--position' is deprecated and will be removed in a future r /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -220,7 +220,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1108844556/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; @@ -239,7 +239,7 @@ Warning: The option '--position' is deprecated and will be removed in a future r /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1108844556/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; @@ -299,7 +299,7 @@ ERROR 42000: PROCEDURE test.p1 does not exist /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -349,7 +349,7 @@ flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -484,7 +484,7 @@ FLUSH LOGS; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1253783037/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -581,22 +581,22 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1266652094/*!*/; SavePoint mixed_cases /*!*/; -use db1/*!*/; +use `db1`/*!*/; SET TIMESTAMP=1266652094/*!*/; INSERT INTO db1.t2 VALUES("in savepoint mixed_cases") /*!*/; SET TIMESTAMP=1266652094/*!*/; INSERT INTO db1.t1 VALUES(40) /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1266652094/*!*/; ROLLBACK TO mixed_cases /*!*/; -use db1/*!*/; +use `db1`/*!*/; SET TIMESTAMP=1266652094/*!*/; INSERT INTO db1.t2 VALUES("after rollback to") /*!*/; @@ -624,7 +624,7 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1266652094/*!*/; SavePoint mixed_cases /*!*/; diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result index dba9bdc9d70..ab97f0fe51b 100644 --- a/mysql-test/r/mysqlbinlog2.result +++ b/mysql-test/r/mysqlbinlog2.result @@ -19,7 +19,7 @@ insert into t1 values(null, "f"); /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -62,7 +62,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -101,7 +101,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=4/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -127,7 +127,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -162,7 +162,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=4/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -185,7 +185,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -215,7 +215,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -246,7 +246,7 @@ flush logs; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -281,7 +281,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -304,7 +304,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -335,7 +335,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -358,7 +358,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=4/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -377,7 +377,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -399,7 +399,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -445,7 +445,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -468,7 +468,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -490,7 +490,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -520,7 +520,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -563,7 +563,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -601,7 +601,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; SET INSERT_ID=4/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -627,7 +627,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -661,7 +661,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; SET INSERT_ID=4/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -684,7 +684,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -714,7 +714,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -744,7 +744,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -779,7 +779,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -802,7 +802,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -833,7 +833,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -855,7 +855,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; SET INSERT_ID=4/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -874,7 +874,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -896,7 +896,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -942,7 +942,7 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -965,7 +965,7 @@ insert into t1 values(null, "e") DELIMITER ; DELIMITER /*!*/; SET INSERT_ID=6/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -987,7 +987,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -1017,7 +1017,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/r/mysqlbinlog_row.result index 9b562ac0fff..d58e55c809c 100644 --- a/mysql-test/r/mysqlbinlog_row.result +++ b/mysql-test/r/mysqlbinlog_row.result @@ -336,7 +336,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -357,7 +357,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ # at # @@ -374,7 +374,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ # at # @@ -401,7 +401,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0000001' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -418,7 +418,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0000010' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -435,7 +435,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0000100' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -452,7 +452,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0001000' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -469,7 +469,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0010000' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -486,7 +486,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0100000' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -503,7 +503,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1000000' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -520,7 +520,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1111111' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -537,7 +537,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'1111111' /* BIT(7) meta=7 nullable=1 is_null=0 */ # at # @@ -554,7 +554,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=b'0010000' /* BIT(7) meta=7 nullable=1 is_null=0 */ ### SET @@ -583,7 +583,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00010010010010001001' /* BIT(20) meta=516 nullable=1 is_null=0 */ ### @2='ab' /* STRING(2) meta=65026 nullable=1 is_null=0 */ @@ -611,7 +611,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0000000000000000000000000000000000000000000000000000000000000001' /* BIT(64) meta=2048 nullable=1 is_null=0 */ # at # @@ -628,7 +628,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0000000000000000000000000000000000000000000000000000000000000010' /* BIT(64) meta=2048 nullable=1 is_null=0 */ # at # @@ -645,7 +645,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0000000000000000000000000000000000000000000000000000000010000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ # at # @@ -662,7 +662,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ # at # @@ -689,13 +689,13 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=2 /* TINYINT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=3 /* TINYINT meta=0 nullable=1 is_null=0 */ # at # @@ -712,7 +712,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */ # at # @@ -729,7 +729,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */ ### SET @@ -748,7 +748,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */ # at # @@ -775,10 +775,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */ # at # @@ -795,7 +795,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */ # at # @@ -822,7 +822,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */ # at # @@ -839,7 +839,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */ # at # @@ -866,7 +866,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1234 /* SHORTINT meta=0 nullable=1 is_null=0 */ # at # @@ -883,7 +883,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=1234 /* SHORTINT meta=0 nullable=1 is_null=0 */ # at # @@ -910,10 +910,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-32768 (32768) /* SHORTINT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-1 (65535) /* SHORTINT meta=0 nullable=1 is_null=0 */ # at # @@ -930,7 +930,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=-32768 (32768) /* SHORTINT meta=0 nullable=1 is_null=0 */ ### SET @@ -949,7 +949,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (65535) /* SHORTINT meta=0 nullable=1 is_null=0 */ # at # @@ -976,7 +976,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=12345 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ # at # @@ -993,7 +993,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=12345 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ # at # @@ -1020,10 +1020,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-8388608 (8388608) /* MEDIUMINT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-1 (16777215) /* MEDIUMINT meta=0 nullable=1 is_null=0 */ # at # @@ -1040,7 +1040,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=-8388608 (8388608) /* MEDIUMINT meta=0 nullable=1 is_null=0 */ ### SET @@ -1059,7 +1059,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (16777215) /* MEDIUMINT meta=0 nullable=1 is_null=0 */ # at # @@ -1086,7 +1086,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=123456 /* INT meta=0 nullable=1 is_null=0 */ # at # @@ -1103,7 +1103,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=123456 /* INT meta=0 nullable=1 is_null=0 */ # at # @@ -1130,10 +1130,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-2147483648 (2147483648) /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-1 (4294967295) /* INT meta=0 nullable=1 is_null=0 */ # at # @@ -1150,7 +1150,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=-2147483648 (2147483648) /* INT meta=0 nullable=1 is_null=0 */ ### SET @@ -1169,7 +1169,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (4294967295) /* INT meta=0 nullable=1 is_null=0 */ # at # @@ -1196,7 +1196,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1234567890 /* LONGINT meta=0 nullable=1 is_null=0 */ # at # @@ -1213,7 +1213,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=1234567890 /* LONGINT meta=0 nullable=1 is_null=0 */ # at # @@ -1240,10 +1240,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-9223372036854775808 (9223372036854775808) /* LONGINT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-1 (18446744073709551615) /* LONGINT meta=0 nullable=1 is_null=0 */ # at # @@ -1260,7 +1260,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=-9223372036854775808 (9223372036854775808) /* LONGINT meta=0 nullable=1 is_null=0 */ ### SET @@ -1279,7 +1279,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=-1 (18446744073709551615) /* LONGINT meta=0 nullable=1 is_null=0 */ # at # @@ -1306,7 +1306,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=123.223... /* FLOAT meta=4 nullable=1 is_null=0 */ # at # @@ -1323,7 +1323,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=123.223... /* FLOAT meta=4 nullable=1 is_null=0 */ # at # @@ -1350,7 +1350,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=123434.223... /* DOUBLE meta=8 nullable=1 is_null=0 */ # at # @@ -1367,7 +1367,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=123434.223... /* DOUBLE meta=8 nullable=1 is_null=0 */ # at # @@ -1394,7 +1394,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=000000124.450000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */ # at # @@ -1411,7 +1411,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=-000000543.210000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */ # at # @@ -1428,7 +1428,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=000000124.450000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */ # at # @@ -1455,7 +1455,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2001:02:03' /* DATE meta=0 nullable=1 is_null=0 */ # at # @@ -1472,7 +1472,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2001:02:03' /* DATE meta=0 nullable=1 is_null=0 */ # at # @@ -1499,7 +1499,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=2001-02-03 10:20:30 /* DATETIME meta=0 nullable=1 is_null=0 */ # at # @@ -1516,7 +1516,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=2001-02-03 10:20:30 /* DATETIME meta=0 nullable=1 is_null=0 */ # at # @@ -1544,7 +1544,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=981184830 /* TIMESTAMP meta=0 nullable=0 is_null=0 */ # at # @@ -1561,7 +1561,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=981184830 /* TIMESTAMP meta=0 nullable=0 is_null=0 */ # at # @@ -1588,7 +1588,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='11:22:33' /* TIME meta=0 nullable=1 is_null=0 */ # at # @@ -1605,7 +1605,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='11:22:33' /* TIME meta=0 nullable=1 is_null=0 */ # at # @@ -1632,7 +1632,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=2001 /* YEAR meta=0 nullable=1 is_null=0 */ # at # @@ -1649,7 +1649,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=2001 /* YEAR meta=0 nullable=1 is_null=0 */ # at # @@ -1676,7 +1676,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -1693,7 +1693,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -1720,7 +1720,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -1737,7 +1737,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -1764,7 +1764,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='b' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -1781,7 +1781,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='b' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -1808,7 +1808,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' /* STRING(255) meta=65279 nullable=1 is_null=0 */ # at # @@ -1825,7 +1825,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' /* STRING(255) meta=65279 nullable=1 is_null=0 */ # at # @@ -1852,7 +1852,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ # at # @@ -1869,7 +1869,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ # at # @@ -1896,7 +1896,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -1913,7 +1913,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -1940,7 +1940,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ # at # @@ -1957,7 +1957,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */ # at # @@ -1984,7 +1984,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* STRING(765) meta=57085 nullable=1 is_null=0 */ # at # @@ -2001,7 +2001,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* STRING(765) meta=57085 nullable=1 is_null=0 */ # at # @@ -2018,10 +2018,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* STRING(765) meta=57085 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* STRING(765) meta=57085 nullable=1 is_null=0 */ # at # @@ -2048,7 +2048,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ # at # @@ -2065,7 +2065,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ # at # @@ -2092,7 +2092,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -2109,7 +2109,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -2136,7 +2136,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ # at # @@ -2153,7 +2153,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */ # at # @@ -2180,7 +2180,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(510) meta=61182 nullable=1 is_null=0 */ # at # @@ -2197,7 +2197,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß' /* STRING(510) meta=61182 nullable=1 is_null=0 */ # at # @@ -2216,10 +2216,10 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(510) meta=61182 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß' /* STRING(510) meta=61182 nullable=1 is_null=0 */ # at # @@ -2246,7 +2246,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -2263,7 +2263,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -2290,7 +2290,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ # at # @@ -2307,7 +2307,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ # at # @@ -2334,7 +2334,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ # at # @@ -2351,7 +2351,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ # at # @@ -2378,7 +2378,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(261) meta=261 nullable=1 is_null=0 */ # at # @@ -2395,7 +2395,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(261) meta=261 nullable=1 is_null=0 */ # at # @@ -2422,7 +2422,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -2439,7 +2439,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -2466,7 +2466,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* VARSTRING(3) meta=3 nullable=1 is_null=0 */ # at # @@ -2483,7 +2483,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* VARSTRING(3) meta=3 nullable=1 is_null=0 */ # at # @@ -2510,7 +2510,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */ # at # @@ -2527,7 +2527,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */ # at # @@ -2544,10 +2544,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */ # at # @@ -2574,7 +2574,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */ # at # @@ -2591,7 +2591,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */ # at # @@ -2608,10 +2608,10 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */ # at # @@ -2638,7 +2638,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -2655,7 +2655,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -2682,7 +2682,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00a' /* VARSTRING(2) meta=2 nullable=1 is_null=0 */ # at # @@ -2699,7 +2699,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a' /* VARSTRING(2) meta=2 nullable=1 is_null=0 */ # at # @@ -2726,7 +2726,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(510) meta=510 nullable=1 is_null=0 */ # at # @@ -2743,7 +2743,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(510) meta=510 nullable=1 is_null=0 */ # at # @@ -2770,7 +2770,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(522) meta=522 nullable=1 is_null=0 */ # at # @@ -2787,7 +2787,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(522) meta=522 nullable=1 is_null=0 */ # at # @@ -2814,7 +2814,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -2831,7 +2831,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -2848,7 +2848,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -2865,7 +2865,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -2892,7 +2892,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -2909,7 +2909,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */ # at # @@ -2936,7 +2936,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -2953,7 +2953,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -2970,7 +2970,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -2987,7 +2987,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # at # @@ -3014,7 +3014,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* STRING(255) meta=65279 nullable=1 is_null=0 */ # at # @@ -3031,7 +3031,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* STRING(255) meta=65279 nullable=1 is_null=0 */ # at # @@ -3048,7 +3048,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(255) meta=65279 nullable=1 is_null=0 */ # at # @@ -3065,7 +3065,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* STRING(255) meta=65279 nullable=1 is_null=0 */ # at # @@ -3092,7 +3092,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -3109,7 +3109,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */ # at # @@ -3136,7 +3136,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ # at # @@ -3153,7 +3153,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ # at # @@ -3170,7 +3170,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ # at # @@ -3187,7 +3187,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x02' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */ # at # @@ -3214,7 +3214,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ # at # @@ -3231,7 +3231,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ # at # @@ -3248,7 +3248,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ # at # @@ -3265,7 +3265,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ # at # @@ -3292,7 +3292,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='tinyblob1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ # at # @@ -3309,7 +3309,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='tinyblob1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ # at # @@ -3336,7 +3336,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='blob1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ # at # @@ -3353,7 +3353,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='blob1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ # at # @@ -3380,7 +3380,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='mediumblob1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ # at # @@ -3397,7 +3397,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='mediumblob1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ # at # @@ -3424,7 +3424,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='longblob1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ # at # @@ -3441,7 +3441,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='longblob1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ # at # @@ -3468,7 +3468,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='tinytext1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ # at # @@ -3485,7 +3485,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='tinytext1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ # at # @@ -3512,7 +3512,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='text1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ # at # @@ -3529,7 +3529,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='text1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ # at # @@ -3556,7 +3556,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='mediumtext1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ # at # @@ -3573,7 +3573,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='mediumtext1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ # at # @@ -3600,7 +3600,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='longtext1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ # at # @@ -3617,7 +3617,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='longtext1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ # at # @@ -3644,7 +3644,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00t\x00i\x00n\x00y\x00t\x00e\x00x\x00t\x001' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ # at # @@ -3661,7 +3661,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00t\x00i\x00n\x00y\x00t\x00e\x00x\x00t\x001' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */ # at # @@ -3688,7 +3688,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00t\x00e\x00x\x00t\x001' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ # at # @@ -3705,7 +3705,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00t\x00e\x00x\x00t\x001' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ # at # @@ -3732,7 +3732,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00m\x00e\x00d\x00i\x00u\x00m\x00t\x00e\x00x\x00t\x001' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ # at # @@ -3749,7 +3749,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00m\x00e\x00d\x00i\x00u\x00m\x00t\x00e\x00x\x00t\x001' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */ # at # @@ -3776,7 +3776,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='\x00l\x00o\x00n\x00g\x00t\x00e\x00x\x00t\x001' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ # at # @@ -3793,7 +3793,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='\x00l\x00o\x00n\x00g\x00t\x00e\x00x\x00t\x001' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */ # at # @@ -3820,7 +3820,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ # at # @@ -3837,7 +3837,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */ # at # @@ -3864,7 +3864,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00000011' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -3881,7 +3881,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00000101' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -3898,7 +3898,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -3915,7 +3915,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -3932,7 +3932,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00001111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -3949,7 +3949,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00011111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -3966,7 +3966,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'00111111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -3983,7 +3983,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'00000011' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */ # at # @@ -4015,7 +4015,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ @@ -4033,7 +4033,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=0 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ @@ -4051,7 +4051,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ @@ -4069,7 +4069,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=0 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ @@ -4091,28 +4091,28 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=0 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ ### SET ### @1=20 /* INT meta=0 nullable=0 is_null=0 */ ### @2=0 /* INT meta=0 nullable=0 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=0 /* INT meta=0 nullable=0 is_null=0 */ ### @2=1 /* INT meta=0 nullable=0 is_null=0 */ diff --git a/mysql-test/r/mysqlbinlog_row_innodb.result b/mysql-test/r/mysqlbinlog_row_innodb.result index ee448311278..428106dcdab 100644 --- a/mysql-test/r/mysqlbinlog_row_innodb.result +++ b/mysql-test/r/mysqlbinlog_row_innodb.result @@ -2253,7 +2253,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -2363,7 +2363,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2456,7 +2456,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2551,7 +2551,7 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */ ### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */ @@ -2632,7 +2632,7 @@ BEGIN ### @77=NULL /* TIMESTAMP meta=63233 nullable=1 is_null=1 */ ### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */ ### @79=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2725,7 +2725,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2898,7 +2898,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3071,7 +3071,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */ ### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */ @@ -3244,7 +3244,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3417,7 +3417,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3510,7 +3510,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3603,7 +3603,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3696,7 +3696,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */ ### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */ @@ -3876,7 +3876,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -3901,47 +3901,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=1 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-08' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=8 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-09' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -3958,7 +3958,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -3967,7 +3967,7 @@ BEGIN ### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=1 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -3976,7 +3976,7 @@ BEGIN ### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -3985,7 +3985,7 @@ BEGIN ### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -3994,7 +3994,7 @@ BEGIN ### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4003,7 +4003,7 @@ BEGIN ### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4012,7 +4012,7 @@ BEGIN ### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4033,37 +4033,37 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=1 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4243,7 +4243,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -4286,47 +4286,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=11 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=18 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4343,47 +4343,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=21 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=28 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4400,47 +4400,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t3` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=31 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=38 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4465,7 +4465,7 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4474,7 +4474,7 @@ BEGIN ### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4483,7 +4483,7 @@ BEGIN ### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4492,7 +4492,7 @@ BEGIN ### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4501,7 +4501,7 @@ BEGIN ### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4510,7 +4510,7 @@ BEGIN ### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4519,7 +4519,7 @@ BEGIN ### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4528,7 +4528,7 @@ BEGIN ### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4537,7 +4537,7 @@ BEGIN ### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4546,7 +4546,7 @@ BEGIN ### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4555,7 +4555,7 @@ BEGIN ### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4564,7 +4564,7 @@ BEGIN ### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4573,7 +4573,7 @@ BEGIN ### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4582,7 +4582,7 @@ BEGIN ### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4591,7 +4591,7 @@ BEGIN ### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4600,7 +4600,7 @@ BEGIN ### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4609,7 +4609,7 @@ BEGIN ### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4618,7 +4618,7 @@ BEGIN ### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4647,92 +4647,92 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4804,7 +4804,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -4829,17 +4829,17 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2=2 /* INT meta=0 nullable=1 is_null=0 */ ### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2=4 /* INT meta=0 nullable=1 is_null=0 */ ### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=5 /* INT meta=0 nullable=1 is_null=0 */ ### @2=6 /* INT meta=0 nullable=1 is_null=0 */ diff --git a/mysql-test/r/mysqlbinlog_row_myisam.result b/mysql-test/r/mysqlbinlog_row_myisam.result index b9366d941f8..4cfff31e223 100644 --- a/mysql-test/r/mysqlbinlog_row_myisam.result +++ b/mysql-test/r/mysqlbinlog_row_myisam.result @@ -2253,7 +2253,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -2363,7 +2363,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2458,7 +2458,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2555,7 +2555,7 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */ ### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */ @@ -2636,7 +2636,7 @@ BEGIN ### @77=NULL /* TIMESTAMP meta=63233 nullable=1 is_null=1 */ ### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */ ### @79=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2731,7 +2731,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -2906,7 +2906,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3081,7 +3081,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */ ### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */ @@ -3256,7 +3256,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3431,7 +3431,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3526,7 +3526,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3621,7 +3621,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */ ### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */ @@ -3716,7 +3716,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */ ### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */ @@ -3898,7 +3898,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -3923,47 +3923,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=1 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-08' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=8 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:08:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-09' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -3982,7 +3982,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -3991,7 +3991,7 @@ BEGIN ### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=1 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4000,7 +4000,7 @@ BEGIN ### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4009,7 +4009,7 @@ BEGIN ### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4018,7 +4018,7 @@ BEGIN ### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4027,7 +4027,7 @@ BEGIN ### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4036,7 +4036,7 @@ BEGIN ### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4059,37 +4059,37 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=1 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */ @@ -4271,7 +4271,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -4314,47 +4314,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=11 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=18 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1='2008:01:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4373,47 +4373,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=21 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=28 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1='2008:02:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4432,47 +4432,47 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t3` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:01' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=31 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:08' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=38 /* INT meta=0 nullable=1 is_null=0 */ -### INSERT INTO test.t3 +### INSERT INTO `test`.`t3` ### SET ### @1='2008:03:09' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4499,7 +4499,7 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4508,7 +4508,7 @@ BEGIN ### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4517,7 +4517,7 @@ BEGIN ### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4526,7 +4526,7 @@ BEGIN ### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4535,7 +4535,7 @@ BEGIN ### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4544,7 +4544,7 @@ BEGIN ### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4553,7 +4553,7 @@ BEGIN ### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4562,7 +4562,7 @@ BEGIN ### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4571,7 +4571,7 @@ BEGIN ### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4580,7 +4580,7 @@ BEGIN ### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4589,7 +4589,7 @@ BEGIN ### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4598,7 +4598,7 @@ BEGIN ### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4607,7 +4607,7 @@ BEGIN ### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4616,7 +4616,7 @@ BEGIN ### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4625,7 +4625,7 @@ BEGIN ### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4634,7 +4634,7 @@ BEGIN ### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4643,7 +4643,7 @@ BEGIN ### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4652,7 +4652,7 @@ BEGIN ### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### UPDATE test.t3 +### UPDATE `test`.`t3` ### WHERE ### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4683,92 +4683,92 @@ BEGIN #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=7 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=2 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=3 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=4 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=5 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ ### @3=6 /* INT meta=0 nullable=1 is_null=0 */ -### DELETE FROM test.t3 +### DELETE FROM `test`.`t3` ### WHERE ### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */ ### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */ @@ -4842,7 +4842,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -4867,17 +4867,17 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2=2 /* INT meta=0 nullable=1 is_null=0 */ ### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2=4 /* INT meta=0 nullable=1 is_null=0 */ ### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=5 /* INT meta=0 nullable=1 is_null=0 */ ### @2=6 /* INT meta=0 nullable=1 is_null=0 */ diff --git a/mysql-test/r/mysqlbinlog_row_trans.result b/mysql-test/r/mysqlbinlog_row_trans.result index 9c3348a9e76..10ba2a82089 100644 --- a/mysql-test/r/mysqlbinlog_row_trans.result +++ b/mysql-test/r/mysqlbinlog_row_trans.result @@ -132,7 +132,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -164,15 +164,15 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -180,21 +180,21 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=11 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -205,7 +205,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -247,15 +247,15 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -263,21 +263,21 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=11 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -288,7 +288,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -296,15 +296,15 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -312,21 +312,21 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=11 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -337,7 +337,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -371,15 +371,15 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t1 +### INSERT INTO `test`.`t1` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -387,21 +387,21 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=11 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t1 +### UPDATE `test`.`t1` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -412,7 +412,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t1 +### DELETE FROM `test`.`t1` ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -420,15 +420,15 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### INSERT INTO test.t2 +### INSERT INTO `test`.`t2` ### SET ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -436,21 +436,21 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=1 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=11 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=2 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ ### SET ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ -### UPDATE test.t2 +### UPDATE `test`.`t2` ### WHERE ### @1=3 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ @@ -461,7 +461,7 @@ BEGIN # at # #010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number # #010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F -### DELETE FROM test.t2 +### DELETE FROM `test`.`t2` ### WHERE ### @1=12 /* INT meta=0 nullable=1 is_null=0 */ ### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */ diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 05efea79fe7..c1effffde53 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -19,7 +19,7 @@ flush logs; DELIMITER /*!*/; ROLLBACK/*!*/; SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index a4c610c845a..deaeaf47679 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -35,7 +35,7 @@ DELIMITER /*!*/; # at 4 <#>ROLLBACK/*!*/; # at 102 -<#>use test/*!*/; +<#>use `test`/*!*/; SET TIMESTAMP=1196959712/*!*/; <#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result index 2687b21213a..cbb739a9c48 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result +++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result @@ -1,152 +1,152 @@ Verbose statements from : write-partial-row.binlog select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%'; stmt -### INSERT INTO mysql.ndb_apply_status +### INSERT INTO `mysql`.`ndb_apply_status` ### SET ### @1=1 ### @2=25769803786 ### @3='' ### @4=0 ### @5=0 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=3 ### @2=3 ### @3=3 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=1 ### @2=1 ### @3=1 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=2 ### @2=2 ### @3=2 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=4 ### @2=4 ### @3=4 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=4 ### @3=40 -### DELETE FROM test.ba +### DELETE FROM `test`.`ba` ### WHERE ### @1=2 drop table raw_binlog_rows; Verbose statements from : write-full-row.binlog select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%'; stmt -### INSERT INTO mysql.ndb_apply_status +### INSERT INTO `mysql`.`ndb_apply_status` ### SET ### @1=2 ### @2=25769803786 ### @3='' ### @4=0 ### @5=0 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=3 ### @2=3 ### @3=3 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=1 ### @2=1 ### @3=1 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=2 ### @2=2 ### @3=2 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=4 ### @2=4 ### @3=4 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=4 ### @2=4 ### @3=40 -### DELETE FROM test.ba +### DELETE FROM `test`.`ba` ### WHERE ### @1=2 drop table raw_binlog_rows; Verbose statements from : update-partial-row.binlog select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%'; stmt -### INSERT INTO mysql.ndb_apply_status +### INSERT INTO `mysql`.`ndb_apply_status` ### SET ### @1=3 ### @2=25769803786 ### @3='' ### @4=0 ### @5=0 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=3 ### @2=3 ### @3=3 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=1 ### @2=1 ### @3=1 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=2 ### @2=2 ### @3=2 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=4 ### @2=4 ### @3=4 -### UPDATE test.ba +### UPDATE `test`.`ba` ### WHERE ### @1=4 ### @3=4 ### SET ### @1=4 ### @3=40 -### DELETE FROM test.ba +### DELETE FROM `test`.`ba` ### WHERE ### @1=2 drop table raw_binlog_rows; Verbose statements from : update-full-row.binlog select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%'; stmt -### INSERT INTO mysql.ndb_apply_status +### INSERT INTO `mysql`.`ndb_apply_status` ### SET ### @1=4 ### @2=25769803786 ### @3='' ### @4=0 ### @5=0 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=3 ### @2=3 ### @3=3 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=1 ### @2=1 ### @3=1 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=2 ### @2=2 ### @3=2 -### INSERT INTO test.ba +### INSERT INTO `test`.`ba` ### SET ### @1=4 ### @2=4 ### @3=4 -### UPDATE test.ba +### UPDATE `test`.`ba` ### WHERE ### @1=4 ### @2=4 @@ -155,7 +155,7 @@ stmt ### @1=4 ### @2=4 ### @3=40 -### DELETE FROM test.ba +### DELETE FROM `test`.`ba` ### WHERE ### @1=2 drop table raw_binlog_rows; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index b7edf7fedb8..21974ba2913 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -13,7 +13,7 @@ flush logs; DELIMITER /*!*/; ROLLBACK/*!*/; SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index 5fee82f6017..082ff16f157 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -153,7 +153,7 @@ Warning: The option '--position' is deprecated and will be removed in a future r /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -175,7 +175,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -284,7 +284,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; @@ -316,7 +316,7 @@ Warning: The option '--position' is deprecated and will be removed in a future r /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index fc9c05ebc81..8d0d6a8bf86 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -627,7 +627,7 @@ drop database if exists mysqltest1 SET TIMESTAMP=t/*!*/; create database mysqltest1 /*!*/; -use mysqltest1/*!*/; +use `mysqltest1`/*!*/; SET TIMESTAMP=t/*!*/; create table t1 (a varchar(100)) /*!*/; @@ -840,7 +840,7 @@ drop database mysqltest1 SET TIMESTAMP=t/*!*/; drop user "zedjzlcsjhd"@127.0.0.1 /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=t/*!*/; drop function if exists f1 /*!*/; @@ -925,7 +925,7 @@ create database mysqltest SET TIMESTAMP=t/*!*/; create database mysqltest2 /*!*/; -use mysqltest2/*!*/; +use `mysqltest2`/*!*/; SET TIMESTAMP=t/*!*/; create table t ( t integer ) /*!*/; @@ -943,7 +943,7 @@ insert into t values (1); return 0; end /*!*/; -use mysqltest/*!*/; +use `mysqltest`/*!*/; SET TIMESTAMP=t/*!*/; SELECT `mysqltest2`.`f1`() /*!*/; @@ -953,14 +953,14 @@ drop database mysqltest SET TIMESTAMP=t/*!*/; drop database mysqltest2 /*!*/; -use test/*!*/; +use `test`/*!*/; SET TIMESTAMP=t/*!*/; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`() begin select 1; end /*!*/; -use mysql/*!*/; +use `mysql`/*!*/; SET TIMESTAMP=t/*!*/; CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`( a int) `label`: diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index fe802ce0e2d..70e52306e14 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -22,6 +22,7 @@ #include "rpl_injector.h" #include "rpl_filter.h" #include "slave.h" +#include "log_event.h" #include "ha_ndbcluster_binlog.h" #include "NdbDictionary.hpp" #include "ndb_cluster_connection.hpp" @@ -1269,6 +1270,11 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, } char tmp_buf2[FN_REFLEN]; + char quoted_table1[2 + 2 * FN_REFLEN + 1]; + char quoted_db1[2 + 2 * FN_REFLEN + 1]; + char quoted_db2[2 + 2 * FN_REFLEN + 1]; + char quoted_table2[2 + 2 * FN_REFLEN + 1]; + int id_length= 0; const char *type_str; switch (type) { @@ -1278,16 +1284,31 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, DBUG_RETURN(0); /* redo the drop table query as is may contain several tables */ query= tmp_buf2; - query_length= (uint) (strxmov(tmp_buf2, "drop table `", - table_name, "`", NullS) - tmp_buf2); + id_length= my_strmov_quoted_identifier (thd, (char *) quoted_table1, + table_name, 0); + quoted_table1[id_length]= '\0'; + query_length= (uint) (strxmov(tmp_buf2, "drop table ", + quoted_table1, NullS) - tmp_buf2); type_str= "drop table"; break; case SOT_RENAME_TABLE: /* redo the rename table query as is may contain several tables */ query= tmp_buf2; - query_length= (uint) (strxmov(tmp_buf2, "rename table `", - db, ".", table_name, "` to `", - new_db, ".", new_table_name, "`", NullS) - tmp_buf2); + id_length= my_strmov_quoted_identifier (thd, (char *) quoted_db1, + db, 0); + quoted_db1[id_length]= '\0'; + id_length= my_strmov_quoted_identifier (thd, (char *) quoted_table1, + table_name, 0); + quoted_table1[id_length]= '\0'; + id_length= my_strmov_quoted_identifier (thd, (char *) quoted_db2, + new_db, 0); + quoted_db2[id_length]= '\0'; + id_length= my_strmov_quoted_identifier (thd, (char *) quoted_table2, + new_table_name, 0); + quoted_table2[id_length]= '\0'; + query_length= (uint) (strxmov(tmp_buf2, "rename table ", + quoted_db1, ".", quoted_table_1, " to ", + quoted_db2, ".", quoted_table2, NullS) - tmp_buf2); type_str= "rename table"; break; case SOT_CREATE_TABLE: diff --git a/sql/log.cc b/sql/log.cc index 7e0e90e28c0..93dd70b33c5 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -29,6 +29,7 @@ #include "rpl_filter.h" #include "rpl_rli.h" +#include "sql_show.h" #include #include #include // For test_if_number @@ -1708,17 +1709,24 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv) DBUG_ENTER("binlog_savepoint_set"); binlog_trans_log_savepos(thd, (my_off_t*) sv); + + // buffer to store quoted identifier + char* buffer= (char *)my_malloc(sizeof("SAVEPOINT ")+ 1 + NAME_LEN * 2 + 2, + MYF(0)); + String log_query(buffer, sizeof(buffer), system_charset_info); + log_query.length(0); + /* Write it to the binary log */ - String log_query; - if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) || - log_query.append("`") || - log_query.append(thd->lex->ident.str, thd->lex->ident.length) || - log_query.append("`")) + if (log_query.append(STRING_WITH_LEN("SAVEPOINT "))) DBUG_RETURN(1); + else + append_identifier(thd, &log_query, thd->lex->ident.str, + thd->lex->ident.length); int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), TRUE, TRUE, errcode); + my_free(buffer, MYF(MY_WME)); DBUG_RETURN(mysql_bin_log.write(&qinfo)); } @@ -1731,18 +1739,23 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv) non-transactional table. Otherwise, truncate the binlog cache starting from the SAVEPOINT command. */ - if (unlikely(trans_has_updated_non_trans_table(thd) || + if (unlikely(trans_has_updated_non_trans_table(thd) || (thd->options & OPTION_KEEP_LOG))) { - String log_query; - if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) || - log_query.append("`") || - log_query.append(thd->lex->ident.str, thd->lex->ident.length) || - log_query.append("`")) + // buffer to store rollback query with quoted identifier + char* buffer= (char *)my_malloc(12 + 1 + NAME_LEN * 2 + 2, MYF(0)); + String log_query(buffer, sizeof(buffer), system_charset_info); + log_query.length(0); + + if (log_query.append(STRING_WITH_LEN("ROLLBACK TO "))) DBUG_RETURN(1); + else + append_identifier(thd, &log_query, thd->lex->ident.str, + thd->lex->ident.length); int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), TRUE, TRUE, errcode); + my_free(buffer, MYF(MY_WME)); DBUG_RETURN(mysql_bin_log.write(&qinfo)); } binlog_trans_log_truncate(thd, *(my_off_t*)sv); diff --git a/sql/log_event.cc b/sql/log_event.cc index 2f27efa8b4e..829ee06d20e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -34,6 +34,7 @@ #include "rpl_utility.h" #include "rpl_record.h" #include +#include "sql_show.h" // append_identifier #endif /* MYSQL_CLIENT */ @@ -1946,6 +1947,10 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, void Rows_log_event::print_verbose(IO_CACHE *file, PRINT_EVENT_INFO *print_event_info) { + // Quoted length of the identifier can be twice the original length + char quoted_db[1 + NAME_LEN * 2 + 2]; + char quoted_table[1 + NAME_LEN * 2 + 2]; + int quoted_db_len, quoted_table_len; Table_map_log_event *map; table_def *td; const char *sql_command, *sql_clause1, *sql_clause2; @@ -1982,9 +1987,23 @@ void Rows_log_event::print_verbose(IO_CACHE *file, for (const uchar *value= m_rows_buf; value < m_rows_end; ) { size_t length; +#ifdef MYSQL_SERVER + quoted_db_len= my_strmov_quoted_identifier(this->thd, (char *) quoted_db, + map->get_db_name(), 0); + quoted_table_len= my_strmov_quoted_identifier(this->thd, + (char *) quoted_table, + map->get_table_name(), 0); +#else + quoted_db_len= my_strmov_quoted_identifier((char *) quoted_db, + map->get_db_name()); + quoted_table_len= my_strmov_quoted_identifier((char *) quoted_table, + map->get_table_name()); +#endif + quoted_db[quoted_db_len]= '\0'; + quoted_table[quoted_table_len]= '\0'; my_b_printf(file, "### %s %s.%s\n", sql_command, - map->get_db_name(), map->get_table_name()); + quoted_db, quoted_table); /* Print the first image */ if (!(length= print_verbose_one_row(file, td, print_event_info, &m_cols, value, @@ -2143,24 +2162,20 @@ Log_event::continue_group(Relay_log_info *rli) void Query_log_event::pack_info(Protocol *protocol) { // TODO: show the catalog ?? - char *buf, *pos; - if (!(buf= (char*) my_malloc(9 + db_len + q_len, MYF(MY_WME)))) - return; - pos= buf; + String temp_buf; + // Add use `DB` to the string if required if (!(flags & LOG_EVENT_SUPPRESS_USE_F) && db && db_len) { - pos= strmov(buf, "use `"); - memcpy(pos, db, db_len); - pos= strmov(pos+db_len, "`; "); + temp_buf.append("use "); + append_identifier(this->thd, &temp_buf, db, db_len); + temp_buf.append("; "); } + // Add the query to the string if (query && q_len) - { - memcpy(pos, query, q_len); - pos+= q_len; - } - protocol->store(buf, pos-buf, &my_charset_bin); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + temp_buf.append(query); + // persist the buffer in protocol + protocol->store(temp_buf.ptr(), temp_buf.length(), &my_charset_bin); } #endif @@ -2932,6 +2947,8 @@ void Query_log_event::print_query_header(IO_CACHE* file, { // TODO: print the catalog ?? char buff[40],*end; // Enough for SET TIMESTAMP + char quoted_id[1+ 2*FN_REFLEN+ 2]; + int quoted_len= 0; bool different_db= 1; uint32 tmp; @@ -2950,11 +2967,17 @@ void Query_log_event::print_query_header(IO_CACHE* file, } else if (db) { +#ifdef MYSQL_SERVER + quoted_len= my_strmov_quoted_identifier(this->thd, (char*)quoted_id, db, 0); +#else + quoted_len= my_strmov_quoted_identifier((char*)quoted_id, db); +#endif + quoted_id[quoted_len]= '\0'; different_db= memcmp(print_event_info->db, db, db_len + 1); if (different_db) memcpy(print_event_info->db, db, db_len + 1); if (db[0] && different_db) - my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter); + my_b_printf(file, "use %s%s\n", quoted_id, print_event_info->delimiter); } end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10); @@ -4216,7 +4239,8 @@ void Format_description_log_event::calc_server_version_split() uint Load_log_event::get_query_buffer_length() { return - 5 + db_len + 3 + // "use DB; " + //the DB name may double if we escape the quote character + 5 + 2*db_len + 3 + 18 + fname_len + 2 + // "LOAD DATA INFILE 'file''" 11 + // "CONCURRENT " 7 + // LOCAL @@ -4235,13 +4259,21 @@ uint Load_log_event::get_query_buffer_length() void Load_log_event::print_query(bool need_db, const char *cs, char *buf, char **end, char **fn_start, char **fn_end) { + char quoted_id[1 + NAME_LEN * 2 + 2];//quoted length + int quoted_id_len= 0; char *pos= buf; if (need_db && db && db_len) { - pos= strmov(pos, "use `"); - memcpy(pos, db, db_len); - pos= strmov(pos+db_len, "`; "); + pos= strmov(pos, "use "); +#ifdef MYSQL_SERVER + quoted_id_len= my_strmov_quoted_identifier(this->thd, (char *) quoted_id, + db, 0); +#else + quoted_id_len= my_strmov_quoted_identifier((char *) quoted_id, db); +#endif + pos+= quoted_id_len; + pos= strmov(pos, "; "); } pos= strmov(pos, "LOAD DATA "); @@ -4268,17 +4300,15 @@ void Load_log_event::print_query(bool need_db, const char *cs, char *buf, if (fn_end) *fn_end= pos; - pos= strmov(pos ," TABLE `"); + pos= strmov(pos ," TABLE "); memcpy(pos, table_name, table_name_len); pos+= table_name_len; if (cs != NULL) { - pos= strmov(pos ,"` CHARACTER SET "); + pos= strmov(pos ," CHARACTER SET "); pos= strmov(pos , cs); } - else - pos= strmov(pos, "`"); /* We have to create all optional fields as the default is not empty */ pos= strmov(pos, " FIELDS TERMINATED BY "); @@ -4318,9 +4348,9 @@ void Load_log_event::print_query(bool need_db, const char *cs, char *buf, *pos++= ' '; *pos++= ','; } - memcpy(pos, field, field_lens[i]); - pos+= field_lens[i]; - field+= field_lens[i] + 1; + quoted_id_len= my_strmov_quoted_identifier(this->thd, quoted_id, field, + 0); + memcpy(pos, quoted_id, quoted_id_len); } *pos++= ')'; } @@ -4560,6 +4590,8 @@ void Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, bool commented) { + size_t id_len= 0; + char temp_buf[1 + 2*FN_REFLEN + 2]; Write_on_release_cache cache(&print_event_info->head_cache, file_arg); DBUG_ENTER("Load_log_event::print"); @@ -4585,10 +4617,16 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, } if (db && db[0] && different_db) - my_b_printf(&cache, "%suse %s%s\n", - commented ? "# " : "", - db, print_event_info->delimiter); - + { +#ifdef MYSQL_SERVER + id_len= my_strmov_quoted_identifier(this->thd, temp_buf, db, 0); +#else + id_len= my_strmov_quoted_identifier(temp_buf, db); +#endif + temp_buf[id_len]= '\0'; + my_b_printf(&cache, "%suse %s%s\n", + commented ? "# " : "", temp_buf, print_event_info->delimiter); + } if (flags & LOG_EVENT_THREAD_SPECIFIC_F) my_b_printf(&cache,"%sSET @@session.pseudo_thread_id=%lu%s\n", commented ? "# " : "", (ulong)thread_id, @@ -4603,8 +4641,14 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, my_b_printf(&cache,"REPLACE "); else if (sql_ex.opt_flags & IGNORE_FLAG) my_b_printf(&cache,"IGNORE "); - - my_b_printf(&cache, "INTO TABLE `%s`", table_name); + +#ifdef MYSQL_SERVER + id_len= my_strmov_quoted_identifier(this->thd, temp_buf, table_name, 0); +#else + id_len= my_strmov_quoted_identifier(temp_buf, table_name); +#endif + temp_buf[id_len]= '\0'; + my_b_printf(&cache, "INTO TABLE %s", temp_buf); my_b_printf(&cache, " FIELDS TERMINATED BY "); pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len); @@ -4637,7 +4681,9 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, { if (i) my_b_printf(&cache, ","); - my_b_printf(&cache, "%s", field); + id_len= my_strmov_quoted_identifier((char *) temp_buf, field); + temp_buf[id_len]= '\0'; + my_b_printf(&cache, "%s", temp_buf); field += field_lens[i] + 1; } @@ -5560,7 +5606,10 @@ Xid_log_event::do_shall_skip(Relay_log_info *rli) void User_var_log_event::pack_info(Protocol* protocol) { char *buf= 0; - uint val_offset= 4 + name_len; + char quoted_id[1 + FN_REFLEN * 2 + 2];// quoted identifier + int id_len= my_strmov_quoted_identifier(this->thd, quoted_id, name, 0); + quoted_id[id_len]= '\0'; + uint val_offset= 2 + id_len; uint event_len= val_offset; if (is_null) @@ -5626,10 +5675,8 @@ void User_var_log_event::pack_info(Protocol* protocol) } } buf[0]= '@'; - buf[1]= '`'; - memcpy(buf+2, name, name_len); - buf[2+name_len]= '`'; - buf[3+name_len]= '='; + memcpy(buf + 1, quoted_id, id_len); + buf[1 + id_len]= '='; protocol->store(buf, event_len, &my_charset_bin); my_free(buf, MYF(0)); } @@ -5740,6 +5787,8 @@ bool User_var_log_event::write(IO_CACHE* file) #ifdef MYSQL_CLIENT void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { + char quoted_id[1 + NAME_LEN * 2 + 2];// quoted length of the identifier + int quoted_len= 0; Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); @@ -5749,9 +5798,11 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) my_b_printf(&cache, "\tUser_var\n"); } - my_b_printf(&cache, "SET @`"); - my_b_write(&cache, (uchar*) name, (uint) (name_len)); - my_b_printf(&cache, "`"); + my_b_printf(&cache, "SET @"); + quoted_len= my_strmov_quoted_identifier((char *) quoted_id, + (const char *) name); + quoted_id[quoted_len]= '\0'; + my_b_write(&cache, (uchar*) quoted_id, (uint) quoted_len); if (is_null) { @@ -7043,14 +7094,23 @@ void Execute_load_query_log_event::print(FILE* file, void Execute_load_query_log_event::pack_info(Protocol *protocol) { char *buf, *pos; - if (!(buf= (char*) my_malloc(9 + db_len + q_len + 10 + 21, MYF(MY_WME)))) + if (!(buf= (char*) my_malloc(9 + (db_len * 2) + 2 + q_len + 10 + 21, + MYF(MY_WME)))) return; pos= buf; if (db && db_len) { - pos= strmov(buf, "use `"); - memcpy(pos, db, db_len); - pos= strmov(pos+db_len, "`; "); + /* + Statically allocates room to store '\0' and an identifier + that may have NAME_LEN * 2 due to quoting and there are + two quoting characters that wrap them. + */ + char quoted_db[1 + NAME_LEN * 2 + 2];// quoted length of the identifier + size_t size= 0; + size= my_strmov_quoted_identifier(this->thd, quoted_db, db, 0); + pos= strmov(buf, "use "); + memcpy(pos, quoted_db, size); + pos= strmov(pos + size, "; "); } if (query && q_len) { @@ -9907,3 +9967,62 @@ st_print_event_info::st_print_event_info() open_cached_file(&body_cache, NULL, NULL, 0, flags); } #endif + +#ifdef MYSQL_SERVER +/* + This is a utility function that adds a quoted identifier into the a buffer. + This also escapes any existance of the quote string inside the identifier. + + SYNOPSIS + my_strmov_quoted_identifier + thd thread handler + buffer target buffer + identifier the identifier to be quoted + length length of the identifier +*/ +size_t my_strmov_quoted_identifier(THD* thd, char *buffer, + const char* identifier, + uint length) +{ + int q= thd ? get_quote_char_for_identifier(thd, identifier, length) : '`'; + return my_strmov_quoted_identifier_helper(q, buffer, identifier, length); +} +#else +size_t my_strmov_quoted_identifier(char *buffer, const char* identifier) +{ + int q= '`'; + return my_strmov_quoted_identifier_helper(q, buffer, identifier, 0); +} + +#endif + +size_t my_strmov_quoted_identifier_helper(int q, char *buffer, + const char* identifier, + uint length) +{ + size_t written= 0; + char quote_char; + uint id_length= (length) ? length : strlen(identifier); + + if (q == EOF) + { + (void *) strncpy(buffer, identifier, id_length); + return id_length; + } + quote_char= (char) q; + *buffer++= quote_char; + written++; + while (id_length--) + { + if (*identifier == quote_char) + { + *buffer++= quote_char; + written++; + } + *buffer++= *identifier++; + written++; + } + *buffer++= quote_char; + return ++written; +} + diff --git a/sql/log_event.h b/sql/log_event.h index 6b411a90382..ba6b9b876aa 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3987,6 +3987,22 @@ static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, bool slave_execute_deferred_events(THD *thd); #endif +#ifdef MYSQL_SERVER +/** + This is an utility function that adds a quoted identifier into the a buffer. + This also escapes any existance of the quote string inside the identifier. + */ +size_t my_strmov_quoted_identifier(THD *thd, char *buffer, + const char* identifier, + uint length); +#else +size_t my_strmov_quoted_identifier(char *buffer, const char* identifier); +#endif +size_t my_strmov_quoted_identifier_helper(int q, char *buffer, + const char* identifier, + uint length); + + /** @} (end of group Replication) */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 2ce5ec81917..c7513f45983 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4144,24 +4144,19 @@ retry: entry->file->implicit_emptied= 0; if (mysql_bin_log.is_open()) { - char *query, *end; - uint query_buf_size= 20 + share->db.length + share->table_name.length +1; - if ((query= (char*) my_malloc(query_buf_size,MYF(MY_WME)))) - { - /* this DELETE FROM is needed even with row-based binlogging */ - end = strxmov(strmov(query, "DELETE FROM `"), - share->db.str,"`.`",share->table_name.str,"`", NullS); - int errcode= query_error_code(thd, TRUE); - if (thd->binlog_query(THD::STMT_QUERY_TYPE, - query, (ulong)(end-query), - FALSE, FALSE, errcode)) - { - my_free(query, MYF(0)); - goto err; - } - my_free(query, MYF(0)); - } - else + bool error= false; + String temp_buf; + error= temp_buf.append("DELETE FROM "); + append_identifier(thd, &temp_buf, share->db.str, strlen(share->db.str)); + error= temp_buf.append("."); + append_identifier(thd, &temp_buf, share->table_name.str, + strlen(share->table_name.str)); + int errcode= query_error_code(thd, TRUE); + if (thd->binlog_query(THD::STMT_QUERY_TYPE, + temp_buf.ptr(), temp_buf.length(), + FALSE, FALSE, errcode)) + goto err; + if(error) { /* As replication is maybe going to be corrupted, we need to warn the diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 39c33da23ef..fe3aed5c8f0 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -25,6 +25,7 @@ #include #include #include "log.h" +#include "log_event.h" #ifdef __WIN__ #include #endif @@ -718,12 +719,17 @@ not_silent: { char *query; uint query_length; + char db_name_quoted[2 * FN_REFLEN + sizeof("create database ") + 2]; + int id_len= 0; if (!thd->query()) // Only in replication { - query= tmp_query; - query_length= (uint) (strxmov(tmp_query,"create database `", - db, "`", NullS) - tmp_query); + id_len= my_strmov_quoted_identifier(thd, (char *) db_name_quoted, db, + 0); + db_name_quoted[id_len]= '\0'; + query= tmp_query; + query_length= (uint) (strxmov(tmp_query,"create database ", + db_name_quoted, NullS) - tmp_query); } else { @@ -889,7 +895,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) { long deleted=0; int error= 0; - char path[FN_REFLEN+16]; + char path[2 * FN_REFLEN + 16]; MY_DIR *dirp; uint length; TABLE_LIST* dropped_tables= 0; @@ -989,11 +995,17 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) { const char *query; ulong query_length; + // quoted db name + wraping quote + char buffer_temp [2 * FN_REFLEN + 2]; + int id_len= 0; + if (!thd->query()) { /* The client used the old obsolete mysql_drop_db() call */ query= path; - query_length= (uint) (strxmov(path, "drop database `", db, "`", + id_len= my_strmov_quoted_identifier(thd, buffer_temp, db, strlen(db)); + buffer_temp[id_len] ='\0'; + query_length= (uint) (strxmov(path, "DROP DATABASE ", buffer_temp, "", NullS) - path); } else @@ -1029,12 +1041,13 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) else if (mysql_bin_log.is_open()) { char *query, *query_pos, *query_end, *query_data_start; + char temp_identifier[ 2 * FN_REFLEN + 2]; TABLE_LIST *tbl; - uint db_len; + uint db_len, id_length=0; if (!(query= (char*) thd->alloc(MAX_DROP_TABLE_Q_LEN))) goto exit; /* not much else we can do */ - query_pos= query_data_start= strmov(query,"drop table "); + query_pos= query_data_start= strmov(query,"DROP TABLE "); query_end= query + MAX_DROP_TABLE_Q_LEN; db_len= strlen(db); @@ -1054,10 +1067,10 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) } query_pos= query_data_start; } - - *query_pos++ = '`'; - query_pos= strmov(query_pos,tbl->table_name); - *query_pos++ = '`'; + id_length= my_strmov_quoted_identifier(thd, (char *)temp_identifier, + tbl->table_name, 0); + temp_identifier[id_length]= '\0'; + query_pos= strmov(query_pos,(char *)&temp_identifier); *query_pos++ = ','; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 4cd456829ba..7e94e7e7df3 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3426,16 +3426,16 @@ int select_create::write_to_binlog(bool is_trans, int errcode) if (thd->lex->create_select_in_comment) query.append(STRING_WITH_LEN("/*! ")); if (thd->lex->ignore) - query.append(STRING_WITH_LEN("INSERT IGNORE INTO `")); + query.append(STRING_WITH_LEN("INSERT IGNORE INTO ")); else if (thd->lex->duplicates == DUP_REPLACE) - query.append(STRING_WITH_LEN("REPLACE INTO `")); + query.append(STRING_WITH_LEN("REPLACE INTO ")); else - query.append(STRING_WITH_LEN("INSERT INTO `")); + query.append(STRING_WITH_LEN("INSERT INTO ")); - query.append(create_table->db, db_len); - query.append(STRING_WITH_LEN("`.`")); - query.append(create_info->alias, table_len); - query.append(STRING_WITH_LEN("` ")); + append_identifier(thd, &query, create_table->db, db_len); + query.append(STRING_WITH_LEN(".")); + append_identifier(thd, &query, create_info->alias, table_len ); + query.append(STRING_WITH_LEN(" ")); /* The insert items. @@ -3447,9 +3447,8 @@ int select_create::write_to_binlog(bool is_trans, int errcode) if (f != field) query.append(STRING_WITH_LEN(",")); - query.append(STRING_WITH_LEN("`")); - query.append((*f)->field_name, strlen((*f)->field_name)); - query.append(STRING_WITH_LEN("`")); + append_identifier(thd, &query, (*f)->field_name, + strlen((*f)->field_name)); } query.append(STRING_WITH_LEN(") ")); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 6a0e5fd9133..b736fa59c22 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -25,6 +25,7 @@ #include "sp_head.h" #include "sql_trigger.h" +#include "sql_show.h" class READ_INFO { File file; uchar *buffer, /* Buffer for read text */ @@ -619,23 +620,20 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, const char *tbl= table_name_arg; const char *tdb= (thd->db != NULL ? thd->db : db_arg); String string_buf; - - if (!thd->db || strcmp(db_arg, thd->db)) + if (!thd->db || strcmp(db_arg, thd->db)) { /* - If used database differs from table's database, - prefix table name with database name so that it + If used database differs from table's database, + prefix table name with database name so that it becomes a FQ name. */ string_buf.set_charset(system_charset_info); - string_buf.append(db_arg); - string_buf.append("`"); + append_identifier(thd, &string_buf, db_arg, strlen(db_arg)); string_buf.append("."); - string_buf.append("`"); - string_buf.append(table_name_arg); - tbl= string_buf.c_ptr_safe(); } - + append_identifier(thd, &string_buf, table_name_arg, + strlen(table_name_arg)); + tbl= string_buf.c_ptr_safe(); Load_log_event lle(thd, ex, tdb, tbl, fv, duplicates, ignore, transactional_table); @@ -660,11 +658,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, if (n++) pfields.append(", "); if (item->name) - { - pfields.append("`"); - pfields.append(item->name); - pfields.append("`"); - } + append_identifier(thd, &pfields, item->name, strlen(item->name)); else item->print(&pfields, QT_ORDINARY); } @@ -684,9 +678,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, val= lv++; if (n++) pfields.append(", "); - pfields.append("`"); - pfields.append(item->name); - pfields.append("`"); + append_identifier(thd, &pfields, item->name, strlen(item->name)); pfields.append("="); val->print(&pfields, QT_ORDINARY); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 7847fe5b510..7859d7f61e3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1006,7 +1006,8 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) { const char *name_end; char quote_char; - int q= get_quote_char_for_identifier(thd, name, length); + int q; + q= thd ? get_quote_char_for_identifier(thd, name, length) : '`'; if (q == EOF) { diff --git a/sql/sql_show.h b/sql/sql_show.h index fec73122e8b..3a6cd158cb4 100644 --- a/sql/sql_show.h +++ b/sql/sql_show.h @@ -40,5 +40,6 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, int view_store_create_info(THD *thd, TABLE_LIST *table, String *buff); int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table); +int get_quote_char_for_identifier(THD *thd, const char *name, uint length); #endif /* SQL_SHOW_H */ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 39eee62ee91..b8d57341e42 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1944,6 +1944,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, for (table= tables; table; table= table->next_local) { char *db=table->db; + int db_len= table->db_length; handlerton *table_type; enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN; @@ -1966,14 +1967,14 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, built_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS "); } - built_tmp_query.append("`"); if (thd->db == NULL || strcmp(db,thd->db) != 0) { - built_tmp_query.append(db); - built_tmp_query.append("`.`"); + append_identifier(thd, &built_tmp_query, db, db_len); + built_tmp_query.append("."); } - built_tmp_query.append(table->table_name); - built_tmp_query.append("`,"); + append_identifier(thd, &built_tmp_query, table->table_name, + strlen(table->table_name)); + built_tmp_query.append(","); } continue; @@ -1999,15 +2000,14 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, Don't write the database name if it is the current one (or if thd->db is NULL). */ - built_query.append("`"); if (thd->db == NULL || strcmp(db,thd->db) != 0) { - built_query.append(db); - built_query.append("`.`"); + append_identifier(thd, &built_query, db, db_len); + built_query.append("."); } - - built_query.append(table->table_name); - built_query.append("`,"); + append_identifier(thd, &built_query, table->table_name, + strlen(table->table_name)); + built_query.append(","); } if (!drop_temporary) From 7c671a7ead96dd9115a6ae77ebbf78d0dea43485 Mon Sep 17 00:00:00 2001 From: Rohit Kalhans Date: Sun, 23 Sep 2012 15:45:22 +0530 Subject: [PATCH 209/349] BUG#14548159: Followup patch to fix some issues on PB2 --- sql/ha_ndbcluster_binlog.cc | 2 +- sql/log_event.cc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 70e52306e14..6d2a6f06c99 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1307,7 +1307,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, new_table_name, 0); quoted_table2[id_length]= '\0'; query_length= (uint) (strxmov(tmp_buf2, "rename table ", - quoted_db1, ".", quoted_table_1, " to ", + quoted_db1, ".", quoted_table1, " to ", quoted_db2, ".", quoted_table2, NullS) - tmp_buf2); type_str= "rename table"; break; diff --git a/sql/log_event.cc b/sql/log_event.cc index 829ee06d20e..c3ba969cf1f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4259,7 +4259,7 @@ uint Load_log_event::get_query_buffer_length() void Load_log_event::print_query(bool need_db, const char *cs, char *buf, char **end, char **fn_start, char **fn_end) { - char quoted_id[1 + NAME_LEN * 2 + 2];//quoted length + char quoted_id[1 + NAME_LEN * 2 + 2];//quoted length int quoted_id_len= 0; char *pos= buf; @@ -4272,7 +4272,8 @@ void Load_log_event::print_query(bool need_db, const char *cs, char *buf, #else quoted_id_len= my_strmov_quoted_identifier((char *) quoted_id, db); #endif - pos+= quoted_id_len; + quoted_id[quoted_id_len]= '\0'; + pos= strmov(pos, quoted_id); pos= strmov(pos, "; "); } From 815aad69287d83a1e1e98cd7797d02ca96f74bc3 Mon Sep 17 00:00:00 2001 From: Raghav Kapoor Date: Tue, 25 Sep 2012 15:58:46 +0530 Subject: [PATCH 210/349] BUG#13864642: DROP/CREATE USER BEHAVING ODDLY BACKGROUND: In certain situations DROP USER fails to remove all privileges belonging to user being dropped from in-memory structures. Current workaround is to do DROP USER twice in scenario below OR doing FLUSH PRIVILEGES after doing DROP USER. ANALYSIS: In MySQL, When we grant some stored routines privileges to a user they are stored in their respective hash. When doing DROP USER all the stored routine privilege entries associated with that user has to be deleted from its respective hash. The root cause for this bug is some entries from the hash are not getting deleted. The problem is that code that deletes entries from the hash tries to do so while iterating over it, without taking enough measures to address the fact that such deletion can reshuffle elements in the hash. If the user/administrator creates the same user again he is thrown an error 'Error 1396 ER_CANNOT_USER' from MySQL. This prompts the user to either do FLUSH PRIVILEGES or do DROP USER again. This behaviour is not desirable as it is a workaround and does not solves the problem mentioned above. FIX: This bug is fixed by introducing a dynamic array to store the pointersto all stored routine privilege objects that either have to be deleted or updated. This is done in 3 steps. Step 1: Fetching the element from the hash and checking whether it is to be deleted or updated. Step 2: Storing the pointer to that privilege object in dynamic array. Step 3: Traversing the dynamic array to perform the appropriate action either delete or update. This is a much cleaner way to delete or update the privilege entries associated with some user and solves the problem mentioned above. Also the code has been refactored a bit by introducing an enum instead of hard coded numbers used for respective dynamic arrays and hashes in handle_grant_struct() function. --- sql/sql_acl.cc | 241 ++++++++++++++++++++++++++++++------------------- 1 file changed, 149 insertions(+), 92 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 6d5d34d0602..e07f668b1cf 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -195,7 +195,17 @@ static bool compare_hostname(const acl_host_and_ip *host,const char *hostname, static my_bool acl_load(THD *thd, TABLE_LIST *tables); static my_bool grant_load(THD *thd, TABLE_LIST *tables); static inline void get_grantor(THD *thd, char* grantor); - +/* + Enumeration of various ACL's and Hashes used in handle_grant_struct() +*/ +enum enum_acl_lists +{ + USER_ACL= 0, + DB_ACL, + COLUMN_PRIVILEGES_HASH, + PROC_PRIVILEGES_HASH, + FUNC_PRIVILEGES_HASH +}; /* Convert scrambled password to binary form, according to scramble type, Binary form is stored in user.salt. @@ -5390,19 +5400,19 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, Delete from grant structure if drop is true. Update in grant structure if drop is false and user_to is not NULL. Search in grant structure if drop is false and user_to is NULL. - Structures are numbered as follows: - 0 acl_users - 1 acl_dbs - 2 column_priv_hash - 3 proc_priv_hash - 4 func_priv_hash + Structures are enumerated as follows: + 0 ACL_USER + 1 ACL_DB + 2 COLUMN_PRIVILEGES_HASH + 3 PROC_PRIVILEGES_HASH + 4 FUNC_PRIVILEGES_HASH @retval > 0 At least one element matched. @retval 0 OK, but no element matched. - @retval -1 Wrong arguments to function. + @retval -1 Wrong arguments to function or Out of Memory */ -static int handle_grant_struct(uint struct_no, bool drop, +static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, LEX_USER *user_from, LEX_USER *user_to) { int result= 0; @@ -5413,6 +5423,11 @@ static int handle_grant_struct(uint struct_no, bool drop, ACL_USER *acl_user= NULL; ACL_DB *acl_db= NULL; GRANT_NAME *grant_name= NULL; + /* + Dynamic array acl_grant_name used to store pointers to all + GRANT_NAME objects + */ + Dynamic_array acl_grant_name; HASH *grant_name_hash= NULL; DBUG_ENTER("handle_grant_struct"); DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'", @@ -5425,21 +5440,21 @@ static int handle_grant_struct(uint struct_no, bool drop, /* Get the number of elements in the in-memory structure. */ switch (struct_no) { - case 0: + case USER_ACL: elements= acl_users.elements; break; - case 1: + case DB_ACL: elements= acl_dbs.elements; break; - case 2: + case COLUMN_PRIVILEGES_HASH: elements= column_priv_hash.records; grant_name_hash= &column_priv_hash; break; - case 3: + case PROC_PRIVILEGES_HASH: elements= proc_priv_hash.records; grant_name_hash= &proc_priv_hash; break; - case 4: + case FUNC_PRIVILEGES_HASH: elements= func_priv_hash.records; grant_name_hash= &func_priv_hash; break; @@ -5458,21 +5473,21 @@ static int handle_grant_struct(uint struct_no, bool drop, Get a pointer to the element. */ switch (struct_no) { - case 0: + case USER_ACL: acl_user= dynamic_element(&acl_users, idx, ACL_USER*); user= acl_user->user; host= acl_user->host.hostname; break; - case 1: + case DB_ACL: acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*); user= acl_db->user; host= acl_db->host.hostname; break; - case 2: - case 3: - case 4: + case COLUMN_PRIVILEGES_HASH: + case PROC_PRIVILEGES_HASH: + case FUNC_PRIVILEGES_HASH: grant_name= (GRANT_NAME*) hash_element(grant_name_hash, idx); user= grant_name->user; host= grant_name->host.hostname; @@ -5498,86 +5513,60 @@ static int handle_grant_struct(uint struct_no, bool drop, if ( drop ) { switch ( struct_no ) { - case 0: + case USER_ACL: delete_dynamic_element(&acl_users, idx); - break; - - case 1: - delete_dynamic_element(&acl_dbs, idx); - break; - - case 2: - case 3: - case 4: - hash_delete(grant_name_hash, (uchar*) grant_name); - break; - } - elements--; - /* + elements--; + /* - If we are iterating through an array then we just have moved all elements after the current element one position closer to its head. This means that we have to take another look at the element at current position as it is a new element from the array's tail. - - If we are iterating through a hash the current element was replaced - with one of elements from the tail. So we also have to take a look - at the new element in current position. - Note that in our HASH implementation hash_delete() won't move any - elements with position after current one to position before the - current (i.e. from the tail to the head), so it is safe to continue - iteration without re-starting. - */ - idx--; + - This is valid for USER_ACL, DB_ACL. + */ + idx--; + break; + + case DB_ACL: + delete_dynamic_element(&acl_dbs, idx); + elements--; + idx--; + break; + + case COLUMN_PRIVILEGES_HASH: + case PROC_PRIVILEGES_HASH: + case FUNC_PRIVILEGES_HASH: + /* + Deleting while traversing a hash table is not valid procedure and + hence we save pointers to GRANT_NAME objects for later processing. + */ + if (acl_grant_name.append(grant_name)) + DBUG_RETURN(-1); + break; + } } else if ( user_to ) { switch ( struct_no ) { - case 0: + case USER_ACL: acl_user->user= strdup_root(&mem, user_to->user.str); acl_user->host.hostname= strdup_root(&mem, user_to->host.str); break; - case 1: + case DB_ACL: acl_db->user= strdup_root(&mem, user_to->user.str); acl_db->host.hostname= strdup_root(&mem, user_to->host.str); break; - case 2: - case 3: - case 4: - { - /* - Save old hash key and its length to be able properly update - element position in hash. - */ - char *old_key= grant_name->hash_key; - size_t old_key_length= grant_name->key_length; - - /* - Update the grant structure with the new user name and host name. - */ - grant_name->set_user_details(user_to->host.str, grant_name->db, - user_to->user.str, grant_name->tname, - TRUE); - - /* - Since username is part of the hash key, when the user name - is renamed, the hash key is changed. Update the hash to - ensure that the position matches the new hash key value - */ - hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key, - old_key_length); - /* - hash_update() operation could have moved element from the tail - of the hash to the current position. So we need to take a look - at the element in current position once again. - Thanks to the fact that hash_update() for our HASH implementation - won't move any elements from the tail of the hash to the positions - before the current one (a.k.a. head) it is safe to continue - iteration without restarting. - */ - idx--; - break; - } + case COLUMN_PRIVILEGES_HASH: + case PROC_PRIVILEGES_HASH: + case FUNC_PRIVILEGES_HASH: + /* + Updating while traversing a hash table is not valid procedure and + hence we save pointers to GRANT_NAME objects for later processing. + */ + if (acl_grant_name.append(grant_name)) + DBUG_RETURN(-1); + break; } } else @@ -5586,6 +5575,48 @@ static int handle_grant_struct(uint struct_no, bool drop, break; } } + + if (drop || user_to) + { + /* + Traversing the elements stored in acl_grant_name dynamic array + to either delete or update them. + */ + for (int i= 0; i < acl_grant_name.elements(); ++i) + { + grant_name= acl_grant_name.at(i); + + if (drop) + { + my_hash_delete(grant_name_hash, (uchar *) grant_name); + } + else + { + /* + Save old hash key and its length to be able properly update + element position in hash. + */ + char *old_key= grant_name->hash_key; + size_t old_key_length= grant_name->key_length; + + /* + Update the grant structure with the new user name and host name. + */ + grant_name->set_user_details(user_to->host.str, grant_name->db, + user_to->user.str, grant_name->tname, + TRUE); + + /* + Since username is part of the hash key, when the user name + is renamed, the hash key is changed. Update the hash to + ensure that the position matches the new hash key value + */ + my_hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key, + old_key_length); + } + } + } + #ifdef EXTRA_DEBUG DBUG_PRINT("loop",("scan struct: %u result %d", struct_no, result)); #endif @@ -5623,6 +5654,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, { int result= 0; int found; + int ret; DBUG_ENTER("handle_grant_data"); /* Handle user table. */ @@ -5634,14 +5666,19 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, else { /* Handle user array. */ - if ((handle_grant_struct(0, drop, user_from, user_to) && ! result) || - found) + if (((ret= handle_grant_struct(USER_ACL, drop, user_from, user_to) > 0) && + ! result) || found) { result= 1; /* At least one record/element found. */ /* If search is requested, we do not need to search further. */ if (! drop && ! user_to) goto end; } + else if (ret < 0) + { + result= -1; + goto end; + } } /* Handle db table. */ @@ -5653,14 +5690,19 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, else { /* Handle db array. */ - if (((handle_grant_struct(1, drop, user_from, user_to) && ! result) || - found) && ! result) + if ((((ret= handle_grant_struct(DB_ACL, drop, user_from, user_to) > 0) && + ! result) || found) && ! result) { result= 1; /* At least one record/element found. */ /* If search is requested, we do not need to search further. */ if (! drop && ! user_to) goto end; } + else if (ret < 0) + { + result= -1; + goto end; + } } /* Handle stored routines table. */ @@ -5672,23 +5714,35 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, else { /* Handle procs array. */ - if (((handle_grant_struct(3, drop, user_from, user_to) && ! result) || - found) && ! result) + if ((((ret= handle_grant_struct(PROC_PRIVILEGES_HASH, drop, user_from, + user_to) > 0) && ! result) || found) && + ! result) { result= 1; /* At least one record/element found. */ /* If search is requested, we do not need to search further. */ if (! drop && ! user_to) goto end; } + else if (ret < 0) + { + result= -1; + goto end; + } /* Handle funcs array. */ - if (((handle_grant_struct(4, drop, user_from, user_to) && ! result) || - found) && ! result) + if ((((ret= handle_grant_struct(FUNC_PRIVILEGES_HASH, drop, user_from, + user_to) > 0) && ! result) || found) && + ! result) { result= 1; /* At least one record/element found. */ /* If search is requested, we do not need to search further. */ if (! drop && ! user_to) goto end; } + else if (ret < 0) + { + result= -1; + goto end; + } } /* Handle tables table. */ @@ -5716,9 +5770,12 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, else { /* Handle columns hash. */ - if (((handle_grant_struct(2, drop, user_from, user_to) && ! result) || - found) && ! result) + if ((((ret= handle_grant_struct(COLUMN_PRIVILEGES_HASH, drop, user_from, + user_to) > 0) && ! result) || found) && + ! result) result= 1; /* At least one record/element found. */ + else if (ret < 0) + result= -1; } } end: From 58de1660629890abfeeb50eb6bc9cf998c145894 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Tue, 25 Sep 2012 13:09:53 +0200 Subject: [PATCH 211/349] Bug#14621627 THREAD CACHE IS UNFAIR When a client connects to a MySQL server, first a THD object is created. If there are any idle server threads waiting, the THD object is then added to a list and a server thread is woken up. This thread then retrieves the THD object from the list and starts executing. The problem was that this list of THD objects waiting for a server thread, was not working in a FIFO fashion, but rather LIFO. This is unfair, as it means that the last THD added (=last client connected) will be assigned a server thread first. Note however that for this to be a problem, several clients must be able to connect and have THD objects constructed before any server threads manages to be woken up. This is not a very likely scenario. This patch fixes the problem by changing the THD list to work FIFO rather than LIFO. This is the 5.1/5.5 version of the patch. --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bc8d4162272..11e756381ab 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4808,7 +4808,7 @@ void create_thread_to_handle_connection(THD *thd) if (cached_thread_count > wake_thread) { /* Get thread from cache */ - thread_cache.append(thd); + thread_cache.push_back(thd); wake_thread++; pthread_cond_signal(&COND_thread_cache); } From bb11c81be5eb5126eb968df0e55eb05ac7d72821 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Sep 2012 18:00:26 +0530 Subject: [PATCH 212/349] From 66c7b315b1c71cdf209961c9f25bee52c674429b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Sep 2012 18:44:21 +0530 Subject: [PATCH 213/349] From b079b388a50dfa1fdaa4da0cb22154b0cc6d885e Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 25 Sep 2012 16:03:05 +0200 Subject: [PATCH 214/349] Backport Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN Bug #11764818 57692: Crash in item_func_in::val_int() with ZEROFILL --- sql/item_cmpfunc.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 23f081e1cc0..6e8fa9a5f75 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3045,6 +3045,15 @@ void Item_func_case::fix_length_and_dec() return; } } + /* + Set cmp_context of all WHEN arguments. This prevents + Item_field::equal_fields_propagator() from transforming a + zerofill argument into a string constant. Such a change would + require rebuilding cmp_items. + */ + for (i= 0; i < ncases; i+= 2) + args[i]->cmp_context= item_cmp_type(left_result_type, + args[i]->result_type()); } if (else_expr_num == -1 || args[else_expr_num]->maybe_null) @@ -4032,6 +4041,16 @@ void Item_func_in::fix_length_and_dec() } } } + /* + Set cmp_context of all arguments. This prevents + Item_field::equal_fields_propagator() from transforming a zerofill integer + argument into a string constant. Such a change would require rebuilding + cmp_itmes. + */ + for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++) + { + arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type()); + } max_length= 1; } From 422e6b520dd8790ec2e81790c5621ca4288e5289 Mon Sep 17 00:00:00 2001 From: Akhila Maddukuri Date: Wed, 26 Sep 2012 16:38:42 +0530 Subject: [PATCH 215/349] Description: ----------- After compiling from source, during make test I got the following error: test main.loaddata failed with error CURRENT_TEST: main.loaddata mysqltest: At line 592: query 'LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 (@b) SET a=REVERSE(@b)' failed: 1115: Unknown character set: 'ucs2' I noticed other tests are skipped because of no ucs2 main.mix2_myisam_ucs2 [ skipped ] Test requires:' have_ucs2' Should main.loaddata be skipped if there is no ucs2 How To Repeat: ------------- Run make test on compiled source that doesn't have ucs2 Suggested fix: ------------- the failing piece of the test should be moved from mysql-test/t/loaddata.test to mysql-test/t/ctype_ucs.test. --- mysql-test/r/ctype_ucs.result | 26 +++++++++++++++++ mysql-test/r/loaddata.result | 29 ------------------- mysql-test/t/ctype_ucs.test | 32 +++++++++++++++++++++ mysql-test/t/loaddata.test | 54 +++++++++++++++++++---------------- 4 files changed, 87 insertions(+), 54 deletions(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 78b15748eee..62d6c41fa91 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -191,6 +191,32 @@ t1 CREATE TABLE `t1` ( `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# Bug #51876 : crash/memory underrun when loading data with ucs2 +# and reverse() function +# +# Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +# should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; +a +0 +1 +DROP TABLE t1; +# Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +# should return 0 and 1 (10 reversed) +SELECT * FROM t1; +a +0 +1 +DROP TABLE t1; create table t2(f1 Char(30)); insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000"); select lpad(f1, 12, "-o-/") from t2; diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 59a1b904744..b3ac1a84fe6 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -504,35 +504,6 @@ CREATE TABLE t1 (id INT NOT NULL); LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; DROP TABLE t1; # -# Bug #51876 : crash/memory underrun when loading data with ucs2 -# and reverse() function -# -# Problem # 1 (original report): wrong parsing of ucs2 data -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); -Warnings: -Warning 1366 Incorrect integer value: '00' for column 'a' at row 1 -Warning 1366 Incorrect integer value: '10' for column 'a' at row 2 -# should return 2 zeroes (as the value is truncated) -SELECT * FROM t1; -a -0 -0 -DROP TABLE t1; -# Problem # 2 : if you write and read ucs2 data to a file they're lost -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); -# should return 0 and 1 (10 reversed) -SELECT * FROM t1; -a -0 -1 -DROP TABLE t1; -# # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U # CREATE TABLE t1(f1 INT); diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index a9ce6b0b23d..05d564b3de2 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -68,6 +68,38 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r; SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 +--echo # and reverse() function +--echo # + +--echo # Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp.txt; + + +--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 0 and 1 (10 reversed) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp2.txt; + + + # # BUG3946 # diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 3d0fdea05ed..def93cb4d29 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -580,36 +580,40 @@ DROP TABLE t1; connection default; disconnect con1; +############################################################################# +# The below protion is moved to ctype_ucs.test # +############################################################################# +#--echo # +#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 +#--echo # and reverse() function +#--echo # ---echo # ---echo # Bug #51876 : crash/memory underrun when loading data with ucs2 ---echo # and reverse() function ---echo # +#--echo # Problem # 1 (original report): wrong parsing of ucs2 data +#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +#CREATE TABLE t1(a INT); +#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +#(@b) SET a=REVERSE(@b); +#--echo # should return 2 zeroes (as the value is truncated) +#SELECT * FROM t1; ---echo # Problem # 1 (original report): wrong parsing of ucs2 data -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); ---echo # should return 2 zeroes (as the value is truncated) -SELECT * FROM t1; - -DROP TABLE t1; -let $MYSQLD_DATADIR= `select @@datadir`; -remove_file $MYSQLD_DATADIR/test/tmpp.txt; +#DROP TABLE t1; +#let $MYSQLD_DATADIR= `select @@datadir`; +#remove_file $MYSQLD_DATADIR/test/tmpp.txt; ---echo # Problem # 2 : if you write and read ucs2 data to a file they're lost -SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; -CREATE TABLE t1(a INT); -LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 -(@b) SET a=REVERSE(@b); ---echo # should return 0 and 1 (10 reversed) -SELECT * FROM t1; +#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +#CREATE TABLE t1(a INT); +#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +#(@b) SET a=REVERSE(@b); +#--echo # should return 0 and 1 (10 reversed) +#SELECT * FROM t1; + +#DROP TABLE t1; +#let $MYSQLD_DATADIR= `select @@datadir`; +#remove_file $MYSQLD_DATADIR/test/tmpp2.txt; +###################################################################################### -DROP TABLE t1; -let $MYSQLD_DATADIR= `select @@datadir`; -remove_file $MYSQLD_DATADIR/test/tmpp2.txt; --echo # --echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U From faca6ed81e90e953fb7cf6e9756c424a0ecd391d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Sep 2012 18:29:09 +0100 Subject: [PATCH 216/349] From b59a64e2f3a48b9e584f73fde0962f4876b20f05 Mon Sep 17 00:00:00 2001 From: Annamalai Gurusami Date: Fri, 28 Sep 2012 16:02:58 +0530 Subject: [PATCH 217/349] Bug #13249921 ASSERT !BPAGE->FILE_PAGE_WAS_FREED, USUALLY IN TRANSACTION ROLLBACK Description: During the rollback operation, a blob page is removed earlier than desired. Consider following scenario: 1. create table t1(a int primary key,b blob) engine=innodb; 2. insert into t1 values (1,repeat('b',9000)); 3. begin; 4. update t1 set b=concat(b,'b'); 5. update t1 set a=a+1; 6. insert into t1 values (1,repeat('b',9000)); 7. rollback; The update operation in line 5 produces 2 undo log record. The first undo record (TRX_UNDO_DEL_MARK_REC) goes to trx->update_undo and the second undo record (TRX_UNDO_INSERT_REC) goes to trx->insert_undo. During rollback, they are executed out of order. When the undo record TRX_UNDO_DEL_MARK_REC is applied/executed, the blob ownership is also reset. Because of this the blob page is released earlier than desired. This blob page must have been freed only as part of applying/executing the undo record TRX_UNDO_INSERT_REC. This problem can be avoided by executing the undo records in order. This patch will make innodb to execute the undo records in order. rb://1125 approved by Marko. --- storage/innobase/include/row0undo.h | 9 +--- storage/innobase/row/row0umod.c | 54 ------------------------ storage/innobase/row/row0undo.c | 19 --------- storage/innodb_plugin/ChangeLog | 7 +++ storage/innodb_plugin/include/row0undo.h | 7 --- storage/innodb_plugin/row/row0umod.c | 53 ----------------------- storage/innodb_plugin/row/row0undo.c | 19 --------- 7 files changed, 9 insertions(+), 159 deletions(-) diff --git a/storage/innobase/include/row0undo.h b/storage/innobase/include/row0undo.h index 0be09ed1822..f7f71a440b5 100644 --- a/storage/innobase/include/row0undo.h +++ b/storage/innobase/include/row0undo.h @@ -78,8 +78,6 @@ struct undo_node_struct{ dulint undo_no;/* undo number of the record */ ulint rec_type;/* undo log record type: TRX_UNDO_INSERT_REC, ... */ - dulint new_roll_ptr; /* roll ptr to restore to clustered index - record */ dulint new_trx_id; /* trx id to restore to clustered index record */ btr_pcur_t pcur; /* persistent cursor used in searching the @@ -101,11 +99,8 @@ struct undo_node_struct{ /* Execution states for an undo node */ #define UNDO_NODE_FETCH_NEXT 1 /* we should fetch the next undo log record */ -#define UNDO_NODE_PREV_VERS 2 /* the roll ptr to previous version of - a row is stored in node, and undo - should be done based on it */ -#define UNDO_NODE_INSERT 3 -#define UNDO_NODE_MODIFY 4 +#define UNDO_NODE_INSERT 2 +#define UNDO_NODE_MODIFY 3 #ifndef UNIV_NONINL diff --git a/storage/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c index a3333fcc536..83288c570cb 100644 --- a/storage/innobase/row/row0umod.c +++ b/storage/innobase/row/row0umod.c @@ -41,37 +41,6 @@ delete marked clustered index record was delete unmarked and possibly also some of its fields were changed. Now, it is possible that the delete marked version has become obsolete at the time the undo is started. */ -/*************************************************************** -Checks if also the previous version of the clustered index record was -modified or inserted by the same transaction, and its undo number is such -that it should be undone in the same rollback. */ -UNIV_INLINE -ibool -row_undo_mod_undo_also_prev_vers( -/*=============================*/ - /* out: TRUE if also previous modify or - insert of this row should be undone */ - undo_node_t* node, /* in: row undo node */ - dulint* undo_no)/* out: the undo number */ -{ - trx_undo_rec_t* undo_rec; - trx_t* trx; - - trx = node->trx; - - if (0 != ut_dulint_cmp(node->new_trx_id, trx->id)) { - - *undo_no = ut_dulint_zero; - return(FALSE); - } - - undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap); - - *undo_no = trx_undo_rec_get_undo_no(undo_rec); - - return(ut_dulint_cmp(trx->roll_limit, *undo_no) <= 0); -} - /*************************************************************** Undoes a modify in a clustered index record. */ static @@ -202,17 +171,9 @@ row_undo_mod_clust( btr_pcur_t* pcur; mtr_t mtr; ulint err; - ibool success; - ibool more_vers; - dulint new_undo_no; ut_ad(node && thr); - /* Check if also the previous version of the clustered index record - should be undone in this same rollback operation */ - - more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no); - pcur = &(node->pcur); mtr_start(&mtr); @@ -260,20 +221,6 @@ row_undo_mod_clust( trx_undo_rec_release(node->trx, node->undo_no); - if (more_vers && err == DB_SUCCESS) { - - /* Reserve the undo log record to the prior version after - committing &mtr: this is necessary to comply with the latching - order, as &mtr may contain the fsp latch which is lower in - the latch hierarchy than trx->undo_mutex. */ - - success = trx_undo_rec_reserve(node->trx, new_undo_no); - - if (success) { - node->state = UNDO_NODE_PREV_VERS; - } - } - return(err); } @@ -702,7 +649,6 @@ row_undo_mod_parse_undo_rec( trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, roll_ptr, info_bits, trx, node->heap, &(node->update)); - node->new_roll_ptr = roll_ptr; node->new_trx_id = trx_id; node->cmpl_info = cmpl_info; } diff --git a/storage/innobase/row/row0undo.c b/storage/innobase/row/row0undo.c index 7f31fd0060c..1cb6c722b6f 100644 --- a/storage/innobase/row/row0undo.c +++ b/storage/innobase/row/row0undo.c @@ -236,25 +236,6 @@ row_undo( node->roll_ptr = roll_ptr; node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); - if (trx_undo_roll_ptr_is_insert(roll_ptr)) { - - node->state = UNDO_NODE_INSERT; - } else { - node->state = UNDO_NODE_MODIFY; - } - - } else if (node->state == UNDO_NODE_PREV_VERS) { - - /* Undo should be done to the same clustered index record - again in this same rollback, restoring the previous version */ - - roll_ptr = node->new_roll_ptr; - - node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr, - node->heap); - node->roll_ptr = roll_ptr; - node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); - if (trx_undo_roll_ptr_is_insert(roll_ptr)) { node->state = UNDO_NODE_INSERT; diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index f71ca0b009a..1e5b388643d 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,10 @@ +2012-09-28 The InnoDB Team + + * include/row0undo.h, row/row0umod.c, row/row0undo.c: + Fix Bug#13249921 ASSERT !BPAGE->FILE_PAGE_WAS_FREED, USUALLY + IN TRANSACTION ROLLBACK. This patch will ensure that the + undo logs will be applied in proper reverse order. + 2012-09-18 The InnoDB Team * btr/btr0cur.c, handler/ha_innodb.cc, ibuf/ibuf0ibuf.c, diff --git a/storage/innodb_plugin/include/row0undo.h b/storage/innodb_plugin/include/row0undo.h index 6eb4ca448b3..9420d022e3b 100644 --- a/storage/innodb_plugin/include/row0undo.h +++ b/storage/innodb_plugin/include/row0undo.h @@ -87,10 +87,6 @@ that index record. */ enum undo_exec { UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next undo log record */ - UNDO_NODE_PREV_VERS, /*!< the roll ptr to previous - version of a row is stored in - node, and undo should be done - based on it */ UNDO_NODE_INSERT, /*!< undo a fresh insert of a row to a table */ UNDO_NODE_MODIFY /*!< undo a modify operation @@ -108,9 +104,6 @@ struct undo_node_struct{ undo_no_t undo_no;/*!< undo number of the record */ ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC, ... */ - roll_ptr_t new_roll_ptr; - /*!< roll ptr to restore to clustered index - record */ trx_id_t new_trx_id; /*!< trx id to restore to clustered index record */ btr_pcur_t pcur; /*!< persistent cursor used in searching the diff --git a/storage/innodb_plugin/row/row0umod.c b/storage/innodb_plugin/row/row0umod.c index 5202a498eed..31f7c9f4888 100644 --- a/storage/innodb_plugin/row/row0umod.c +++ b/storage/innodb_plugin/row/row0umod.c @@ -68,36 +68,6 @@ check. If you make a change in this module make sure that no codepath is introduced where a call to log_free_check() is bypassed. */ -/***********************************************************//** -Checks if also the previous version of the clustered index record was -modified or inserted by the same transaction, and its undo number is such -that it should be undone in the same rollback. -@return TRUE if also previous modify or insert of this row should be undone */ -static -ibool -row_undo_mod_undo_also_prev_vers( -/*=============================*/ - undo_node_t* node, /*!< in: row undo node */ - undo_no_t* undo_no)/*!< out: the undo number */ -{ - trx_undo_rec_t* undo_rec; - trx_t* trx; - - trx = node->trx; - - if (0 != ut_dulint_cmp(node->new_trx_id, trx->id)) { - - *undo_no = ut_dulint_zero; - return(FALSE); - } - - undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap); - - *undo_no = trx_undo_rec_get_undo_no(undo_rec); - - return(ut_dulint_cmp(trx->roll_limit, *undo_no) <= 0); -} - /***********************************************************//** Undoes a modify in a clustered index record. @return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ @@ -226,19 +196,11 @@ row_undo_mod_clust( btr_pcur_t* pcur; mtr_t mtr; ulint err; - ibool success; - ibool more_vers; - undo_no_t new_undo_no; ut_ad(node && thr); log_free_check(); - /* Check if also the previous version of the clustered index record - should be undone in this same rollback operation */ - - more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no); - pcur = &(node->pcur); mtr_start(&mtr); @@ -286,20 +248,6 @@ row_undo_mod_clust( trx_undo_rec_release(node->trx, node->undo_no); - if (more_vers && err == DB_SUCCESS) { - - /* Reserve the undo log record to the prior version after - committing &mtr: this is necessary to comply with the latching - order, as &mtr may contain the fsp latch which is lower in - the latch hierarchy than trx->undo_mutex. */ - - success = trx_undo_rec_reserve(node->trx, new_undo_no); - - if (success) { - node->state = UNDO_NODE_PREV_VERS; - } - } - return(err); } @@ -799,7 +747,6 @@ row_undo_mod_parse_undo_rec( trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, roll_ptr, info_bits, trx, node->heap, &(node->update)); - node->new_roll_ptr = roll_ptr; node->new_trx_id = trx_id; node->cmpl_info = cmpl_info; } diff --git a/storage/innodb_plugin/row/row0undo.c b/storage/innodb_plugin/row/row0undo.c index fd28a4f6520..b1606bda5ef 100644 --- a/storage/innodb_plugin/row/row0undo.c +++ b/storage/innodb_plugin/row/row0undo.c @@ -277,25 +277,6 @@ row_undo( node->roll_ptr = roll_ptr; node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); - if (trx_undo_roll_ptr_is_insert(roll_ptr)) { - - node->state = UNDO_NODE_INSERT; - } else { - node->state = UNDO_NODE_MODIFY; - } - - } else if (node->state == UNDO_NODE_PREV_VERS) { - - /* Undo should be done to the same clustered index record - again in this same rollback, restoring the previous version */ - - roll_ptr = node->new_roll_ptr; - - node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr, - node->heap); - node->roll_ptr = roll_ptr; - node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); - if (trx_undo_roll_ptr_is_insert(roll_ptr)) { node->state = UNDO_NODE_INSERT; From 540d0cd28eeb11abab578d189bbe748b930d8edc Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Mon, 1 Oct 2012 13:12:38 +0200 Subject: [PATCH 218/349] Bug#14683676 ENDLESS MEMORY CONSUMPTION IN SETUP_REF_ARRAY WITH MAX IN SUBQUERY n_child_sum_items kept increasing. Since it is used for calculating the size of ref_pointer_array, we will allocate larger and larger chunks of memory, until we hit some operating system limit. The memory is free()d at disconnect, but is most likely *not* returned to the operating system. --- sql/sql_lex.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index fd9367b99f2..e171cf1c06d 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1616,6 +1616,7 @@ void st_select_lex::init_query() ref_pointer_array= 0; select_n_where_fields= 0; select_n_having_items= 0; + n_child_sum_items= 0; subquery_in_having= explicit_limit= 0; is_item_list_lookup= 0; first_execution= 1; From 2943c8131a180de40d94a28bec89d3c1ba1f3687 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Wed, 3 Oct 2012 15:00:43 +0200 Subject: [PATCH 219/349] Bug#14495351: CRASH IN HA_PARTITION::HANDLE_UNORDERED_NEXT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up patch - Fix broken build: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘key_part_map {aka long unsigned int}’ [-Werror=format] --- sql/ha_partition.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e9ffc7abbac..2f39f201f80 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4476,7 +4476,7 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key) m_start_key.length= key_len= calculate_key_len(table, active_index, m_start_key.key, m_start_key.keypart_map); - DBUG_PRINT("info", ("have_start_key map %u find_flag %u len %u", + DBUG_PRINT("info", ("have_start_key map %lu find_flag %u len %u", m_start_key.keypart_map, m_start_key.flag, key_len)); DBUG_ASSERT(key_len); } From 30d35590a3bce929679cdc38d36fc67f7923a39e Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 3 Oct 2012 16:05:07 +0200 Subject: [PATCH 220/349] Bug#13713525 CREATE_INITIAL_DB.CMAKE IS FAILING ON WINDOWS, STILL "DEVENV" RETURNS 0 This bug depends on cmake version. For cmake 2.6 (which is still in use for some pushbuild trees) the main build would succeed, even if create_initial_db failed. The problem was the chaining of commands in the CUSTOM_COMMAND to produce 'initdb.dep'. It first invokes cmake to run mysqld, then invokes 'touch' to create the file. Moving the 'touch' command makes the error propagate properly for both cmake 2.6 and 2.8 --- cmake/create_initial_db.cmake.in | 10 ++++++++-- sql/CMakeLists.txt | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in index e37f41255e0..fba6209d147 100644 --- a/cmake/create_initial_db.cmake.in +++ b/cmake/create_initial_db.cmake.in @@ -69,10 +69,13 @@ EXECUTE_PROCESS( COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND} ) EXECUTE_PROCESS ( - COMMAND "@CMAKE_COMMAND@" -E echo input file bootstrap.sql, current directory ${CWD} + COMMAND "@CMAKE_COMMAND@" -E + echo input file bootstrap.sql, current directory ${CWD} ) EXECUTE_PROCESS ( - COMMAND ${BOOTSTRAP_COMMAND} INPUT_FILE bootstrap.sql OUTPUT_VARIABLE OUT + COMMAND ${BOOTSTRAP_COMMAND} + INPUT_FILE bootstrap.sql + OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR RESULT_VARIABLE RESULT ) @@ -81,3 +84,6 @@ IF(NOT RESULT EQUAL 0) MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}") ENDIF() +EXECUTE_PROCESS ( + COMMAND "@CMAKE_COMMAND@" -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep +) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index a3df9e7948b..d79b732005b 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -291,15 +291,17 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep DEPENDS mysqld ) ADD_CUSTOM_TARGET(initial_database ALL DEPENDS initdb.dep ) - INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION . - COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE PATTERN "bootstrap.sql" EXCLUDE) + INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data + DESTINATION . + COMPONENT DataFiles + PATTERN "initdb.dep" EXCLUDE + PATTERN "bootstrap.sql" EXCLUDE) ELSE() # Not windows or cross compiling, just install an empty directory INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles) From bfba296d4084eab4b580cddc04e889ad2abdaeb2 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Thu, 4 Oct 2012 16:15:13 +0200 Subject: [PATCH 221/349] Bug#14640599 MEMORY LEAK WHEN EXECUTING STORED ROUTINE EXCEPTION HANDLER When a SP handler is activated, memory is allocated to hold the MESSAGE_TEXT for the condition that caused the activation. The problem was that this memory was allocated on the MEM_ROOT belonging to the stored program. Since this MEM_ROOT is not freed until the stored program ends, a stored program that causes lots of handler activations can start using lots of memory. In 5.1 and earlier the problem did not exist as no MESSAGE_TEXT was allocated if a condition was raised with a handler present. However, this behavior lead to a number of other issues such as Bug#23032. This patch fixes the problem by allocating enough memory for the necessary MESSAGE_TEXTs in the SP MEM_ROOT when the SP starts and then re-using this memory each time a handler is activated. This is the 5.5 version of the patch. --- sql/sp_rcontext.cc | 11 +++-------- sql/sp_rcontext.h | 45 ++++++++++++++++++++++++++++++++++++++++++--- sql/sql_signal.cc | 12 +++++++++--- 3 files changed, 54 insertions(+), 14 deletions(-) diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index fba6a56b37c..09f48d824b0 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -67,19 +67,15 @@ sp_rcontext::~sp_rcontext() bool sp_rcontext::init(THD *thd) { uint handler_count= m_root_parsing_ctx->max_handler_index(); - uint i; in_sub_stmt= thd->in_sub_stmt; if (init_var_table(thd) || init_var_items()) return TRUE; - if (!(m_raised_conditions= new (thd->mem_root) MYSQL_ERROR[handler_count])) + if (!(m_raised_conditions= new (thd->mem_root) Sql_condition_info[handler_count])) return TRUE; - for (i= 0; imem_root); - return !(m_handler= (sp_handler_t*)thd->alloc(handler_count * sizeof(sp_handler_t))) || @@ -446,13 +442,12 @@ sp_rcontext::exit_handler() DBUG_VOID_RETURN; } -MYSQL_ERROR* -sp_rcontext::raised_condition() const +Sql_condition_info* sp_rcontext::raised_condition() const { if (m_ihsp > 0) { uint hindex= m_in_handler[m_ihsp - 1].index; - MYSQL_ERROR *raised= & m_raised_conditions[hindex]; + Sql_condition_info *raised= & m_raised_conditions[hindex]; return raised; } diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 84d5a1227fe..c89ada3f3c8 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -58,6 +58,46 @@ typedef struct uint index; } sp_active_handler_t; + +class Sql_condition_info : public Sql_alloc +{ +public: + /** SQL error code. */ + uint m_sql_errno; + + /** Error level. */ + MYSQL_ERROR::enum_warning_level m_level; + + /** SQLSTATE. */ + char m_sql_state[SQLSTATE_LENGTH + 1]; + + /** Text message. */ + char m_message[MYSQL_ERRMSG_SIZE]; + + void set(uint sql_errno, const char* sqlstate, + MYSQL_ERROR::enum_warning_level level, + const char* msg) + { + m_sql_errno= sql_errno; + m_level= level; + + memcpy(m_sql_state, sqlstate, SQLSTATE_LENGTH); + m_sql_state[SQLSTATE_LENGTH]= '\0'; + + strncpy(m_message, msg, MYSQL_ERRMSG_SIZE); + } + + void clear() + { + m_sql_errno= 0; + m_level= MYSQL_ERROR::WARN_LEVEL_ERROR; + + m_sql_state[0]= '\0'; + m_message[0]= '\0'; + } +}; + + /* This class is a runtime context of a Stored Routine. It is used in an execution and is intended to contain all dynamic objects (i.e. objects, which @@ -146,8 +186,7 @@ class sp_rcontext : public Sql_alloc MYSQL_ERROR::enum_warning_level level, const char *msg); - MYSQL_ERROR * - raised_condition() const; + Sql_condition_info *raised_condition() const; void push_hstack(uint h); @@ -232,7 +271,7 @@ private: SQL conditions caught by each handler. This is an array indexed by handler index. */ - MYSQL_ERROR *m_raised_conditions; + Sql_condition_info *m_raised_conditions; uint m_hcount; // Stack pointer for m_handler uint *m_hstack; // Return stack for continue handlers diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index 9910dfc924e..e0c2a96ac84 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -478,7 +478,7 @@ bool Signal_statement::execute(THD *thd) bool Resignal_statement::execute(THD *thd) { - MYSQL_ERROR *signaled; + Sql_condition_info *signaled; int result= TRUE; DBUG_ENTER("Resignal_statement::execute"); @@ -491,15 +491,21 @@ bool Resignal_statement::execute(THD *thd) DBUG_RETURN(result); } + MYSQL_ERROR signaled_err(thd->mem_root); + signaled_err.set(signaled->m_sql_errno, + signaled->m_sql_state, + signaled->m_level, + signaled->m_message); + if (m_cond == NULL) { /* RESIGNAL without signal_value */ - result= raise_condition(thd, signaled); + result= raise_condition(thd, &signaled_err); DBUG_RETURN(result); } /* RESIGNAL with signal_value */ - result= raise_condition(thd, signaled); + result= raise_condition(thd, &signaled_err); DBUG_RETURN(result); } From b06620868ea840beffcfaf36e905bfecd27cfa85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 8 Oct 2012 16:01:50 +0300 Subject: [PATCH 222/349] Bug#14731482 UPDATE OR DELETE CORRUPTS A RECORD WITH A LONG PRIMARY KEY We did not allocate enough bits for index->trx_id_offset, causing an UPDATE or DELETE of a table with a PRIMARY KEY longer than 1024 bytes to corrupt the PRIMARY KEY. dict_index_t: Allocate enough bits. dict_index_build_internal_clust(): Check for overflow of index->trx_id_offset. Trip a debug assertion when overflow occurs. rb:1380 approved by Jimmy Yang --- storage/innobase/dict/dict0dict.c | 18 +++++++++++++++--- storage/innobase/include/dict0mem.h | 7 ++++++- storage/innodb_plugin/dict/dict0dict.c | 18 +++++++++++++++--- storage/innodb_plugin/include/dict0mem.h | 7 ++++++- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index b2baa81b73f..7139eb5db95 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -1629,7 +1629,6 @@ dict_index_build_internal_clust( { dict_index_t* new_index; dict_field_t* field; - ulint fixed_size; ulint trx_id_pos; ulint i; ibool* indexed; @@ -1706,7 +1705,7 @@ dict_index_build_internal_clust( for (i = 0; i < trx_id_pos; i++) { - fixed_size = dict_col_get_fixed_size( + ulint fixed_size = dict_col_get_fixed_size( dict_index_get_nth_col(new_index, i)); if (fixed_size == 0) { @@ -1722,7 +1721,20 @@ dict_index_build_internal_clust( break; } - new_index->trx_id_offset += (unsigned int) fixed_size; + /* Add fixed_size to new_index->trx_id_offset. + Because the latter is a bit-field, an overflow + can theoretically occur. Check for it. */ + fixed_size += new_index->trx_id_offset; + + new_index->trx_id_offset = fixed_size; + + if (new_index->trx_id_offset != fixed_size) { + /* Overflow. Pretend that this is a + variable-length PRIMARY KEY. */ + ut_ad(0); + new_index->trx_id_offset = 0; + break; + } } } diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 83dbf65ea41..8a55fef7f73 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -196,10 +196,15 @@ struct dict_index_struct{ unsigned space:32; /* space where the index tree is placed */ unsigned page:32;/* index tree root page number */ - unsigned trx_id_offset:10;/* position of the the trx id column +#define MAX_KEY_LENGTH_BITS 12 + unsigned trx_id_offset:MAX_KEY_LENGTH_BITS; + /* position of the trx id column in a clustered index record, if the fields before it are known to be of a fixed size, 0 otherwise */ +#if (1<trx_id_offset += (unsigned int) fixed_size; + /* Add fixed_size to new_index->trx_id_offset. + Because the latter is a bit-field, an overflow + can theoretically occur. Check for it. */ + fixed_size += new_index->trx_id_offset; + + new_index->trx_id_offset = fixed_size; + + if (new_index->trx_id_offset != fixed_size) { + /* Overflow. Pretend that this is a + variable-length PRIMARY KEY. */ + ut_ad(0); + new_index->trx_id_offset = 0; + break; + } } } diff --git a/storage/innodb_plugin/include/dict0mem.h b/storage/innodb_plugin/include/dict0mem.h index 1b26aea38c9..8a7984a4375 100644 --- a/storage/innodb_plugin/include/dict0mem.h +++ b/storage/innodb_plugin/include/dict0mem.h @@ -286,10 +286,15 @@ struct dict_index_struct{ #endif /* !UNIV_HOTBACKUP */ unsigned type:4; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE, DICT_UNIVERSAL, DICT_IBUF) */ - unsigned trx_id_offset:10;/*!< position of the trx id column +#define MAX_KEY_LENGTH_BITS 12 + unsigned trx_id_offset:MAX_KEY_LENGTH_BITS; + /*!< position of the trx id column in a clustered index record, if the fields before it are known to be of a fixed size, 0 otherwise */ +#if (1< Date: Mon, 8 Oct 2012 19:40:30 +0530 Subject: [PATCH 223/349] Bug #14036214 MYSQLD CRASHES WHEN EXECUTING UPDATE IN TRX WITH CONSISTENT SNAPSHOT OPTION A transaction is started with a consistent snapshot. After the transaction is started new indexes are added to the table. Now when we issue an update statement, the optimizer chooses an index. When the index scan is being initialized via ha_innobase::change_active_index(), InnoDB reports the error code HA_ERR_TABLE_DEF_CHANGED, with message stating that "insufficient history for index". This error message is propagated up to the SQL layer. But the my_error() api is never called. The statement level diagnostics area is not updated with the correct error status (it remains in Diagnostics_area::DA_EMPTY). Hence the following check in the Protocol::end_statement() fails. 516 case Diagnostics_area::DA_EMPTY: 517 default: 518 DBUG_ASSERT(0); 519 error= send_ok(thd->server_status, 0, 0, 0, NULL); 520 break; The fix is to backport the fix of bugs 14365043, 11761652 and 11746399. 14365043 PROTOCOL::END_STATEMENT(): ASSERTION `0' FAILED 11761652 HA_RND_INIT() RESULT CODE NOT CHECKED 11746399 RETURN VALUES OF HA_INDEX_INIT() AND INDEX_INIT() IGNORED rb://1227 approved by guilhem and mattiasj. --- .../suite/innodb/r/innodb_corrupt_bit.result | 8 +-- .../suite/innodb/t/innodb_corrupt_bit.test | 6 +- sql/event_db_repository.cc | 10 ++- sql/filesort.cc | 8 ++- sql/handler.cc | 47 ++++++++++--- sql/handler.h | 2 + sql/item_subselect.cc | 31 ++++++--- sql/log_event.cc | 12 +++- sql/log_event_old.cc | 36 +++++++--- sql/opt_range.cc | 32 ++++++--- sql/opt_sum.cc | 9 ++- sql/records.cc | 10 ++- sql/sp.cc | 17 ++++- sql/sql_acl.cc | 38 +++++++++-- sql/sql_handler.cc | 25 +++---- sql/sql_help.cc | 10 ++- sql/sql_select.cc | 68 +++++++++++++++---- sql/sql_show.cc | 12 +++- sql/sql_update.cc | 14 ++-- sql/tztime.cc | 32 ++++----- storage/innobase/handler/ha_innodb.cc | 4 +- 21 files changed, 313 insertions(+), 118 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result index c88e1ed2504..7e8792bb5b4 100644 --- a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result +++ b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result @@ -40,13 +40,13 @@ test.corrupt_bit_test_Ä check Warning InnoDB: The B-tree of index "idxÄ" is co test.corrupt_bit_test_Ä check Warning InnoDB: The B-tree of index "idxÄ“" is corrupted. test.corrupt_bit_test_Ä check error Corrupt select c from corrupt_bit_test_Ä; -ERROR HY000: Incorrect key file for table 'corrupt_bit_test_Ä'; try to repair it +ERROR HY000: Index corrupt_bit_test_Ä is corrupted select z from corrupt_bit_test_Ä; -ERROR HY000: Incorrect key file for table 'corrupt_bit_test_Ä'; try to repair it +ERROR HY000: Index corrupt_bit_test_Ä is corrupted show warnings; Level Code Message Warning 179 InnoDB: Index "idxÄ“" for table "test"."corrupt_bit_test_Ä" is marked as corrupted -Error 1034 Incorrect key file for table 'corrupt_bit_test_Ä'; try to repair it +Error 1712 Index corrupt_bit_test_Ä is corrupted insert into corrupt_bit_test_Ä values (10001, "a", 20001, 20001); select * from corrupt_bit_test_Ä use index(primary) where a = 10001; a b c z @@ -63,7 +63,7 @@ test.corrupt_bit_test_Ä check Warning InnoDB: Index "idxÄ“" is marked as corrup test.corrupt_bit_test_Ä check error Corrupt set names utf8; select z from corrupt_bit_test_Ä; -ERROR HY000: Incorrect key file for table 'corrupt_bit_test_Ä'; try to repair it +ERROR HY000: Index corrupt_bit_test_Ä is corrupted drop index idxÄ“ on corrupt_bit_test_Ä; select z from corrupt_bit_test_Ä limit 10; z diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test index 7c4ea00afec..b8d19ddfcee 100644 --- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test +++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test @@ -79,10 +79,10 @@ CREATE INDEX idx4 ON corrupt_bit_test_Ä(b, z); check table corrupt_bit_test_Ä; # This selection intend to use the corrupted index. Expect to fail --- error ER_NOT_KEYFILE +-- error ER_INDEX_CORRUPT select c from corrupt_bit_test_Ä; --- error ER_NOT_KEYFILE +-- error ER_INDEX_CORRUPT select z from corrupt_bit_test_Ä; show warnings; @@ -108,7 +108,7 @@ check table corrupt_bit_test_Ä; set names utf8; --- error ER_NOT_KEYFILE +-- error ER_INDEX_CORRUPT select z from corrupt_bit_test_Ä; # Drop the corrupted index diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 59d168e01b5..74da4d8f587 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -406,7 +406,6 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table, const char *db) { - int ret=0; CHARSET_INFO *scs= system_charset_info; KEY *key_info; uint key_len; @@ -416,7 +415,14 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, DBUG_ENTER("Event_db_repository::index_read_for_db_for_i_s"); DBUG_PRINT("info", ("Using prefix scanning on PK")); - event_table->file->ha_index_init(0, 1); + + int ret= event_table->file->ha_index_init(0, 1); + if (ret) + { + event_table->file->print_error(ret, MYF(0)); + DBUG_RETURN(true); + } + key_info= event_table->key_info; if (key_info->key_parts == 0 || diff --git a/sql/filesort.cc b/sql/filesort.cc index a11be501991..b64f5221606 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -567,7 +567,13 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, if (!quick_select) { next_pos=(uchar*) 0; /* Find records in sequence */ - file->ha_rnd_init(1); + DBUG_EXECUTE_IF("bug14365043_1", + DBUG_SET("+d,ha_rnd_init_fail");); + if ((error= file->ha_rnd_init(1))) + { + file->print_error(error, MYF(0)); + DBUG_RETURN(HA_POS_ERROR); + } file->extra_opt(HA_EXTRA_CACHE, current_thd->variables.read_buff_size); } diff --git a/sql/handler.cc b/sql/handler.cc index 27309a4b1d7..f4eb89912e9 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2291,16 +2291,25 @@ int handler::read_first_row(uchar * buf, uint primary_key) if (stats.deleted < 10 || primary_key >= MAX_KEY || !(index_flags(primary_key, 0, 0) & HA_READ_ORDER)) { - (void) ha_rnd_init(1); - while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ; - (void) ha_rnd_end(); + if (!(error= ha_rnd_init(1))) + { + while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) + /* skip deleted row */; + const int end_error= ha_rnd_end(); + if (!error) + error= end_error; + } } else { /* Find the first row through the primary key */ - (void) ha_index_init(primary_key, 0); - error=index_first(buf); - (void) ha_index_end(); + if (!(error= ha_index_init(primary_key, 0))) + { + error= index_first(buf); + const int end_error= ha_index_end(); + if (!error) + error= end_error; + } } DBUG_RETURN(error); } @@ -2695,7 +2704,15 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment, table->mark_columns_used_by_index_no_reset(table->s->next_number_index, table->read_set); column_bitmaps_signal(); - index_init(table->s->next_number_index, 1); + + if (ha_index_init(table->s->next_number_index, 1)) + { + /* This should never happen, assert in debug, and fail in release build */ + DBUG_ASSERT(0); + *first_value= ULONGLONG_MAX; + return; + } + if (table->s->next_number_keypart == 0) { // Autoincrement at key-start error=index_last(table->record[1]); @@ -2725,13 +2742,25 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment, } if (error) - nr=1; + { + if (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND) + { + /* No entry found, start with 1. */ + nr= 1; + } + else + { + DBUG_ASSERT(0); + nr= ULONGLONG_MAX; + } + } else nr= ((ulonglong) table->next_number_field-> val_int_offset(table->s->rec_buff_length)+1); - index_end(); + ha_index_end(); (void) extra(HA_EXTRA_NO_KEYREAD); *first_value= nr; + return; } diff --git a/sql/handler.h b/sql/handler.h index 0b970a1349d..5eb2d6b440a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1351,6 +1351,7 @@ public: int ha_open(TABLE *table, const char *name, int mode, int test_if_locked); int ha_index_init(uint idx, bool sorted) { + DBUG_EXECUTE_IF("ha_index_init_fail", return HA_ERR_TABLE_DEF_CHANGED;); int result; DBUG_ENTER("ha_index_init"); DBUG_ASSERT(inited==NONE); @@ -1367,6 +1368,7 @@ public: } int ha_rnd_init(bool scan) { + DBUG_EXECUTE_IF("ha_rnd_init_fail", return HA_ERR_TABLE_DEF_CHANGED;); int result; DBUG_ENTER("ha_rnd_init"); DBUG_ASSERT(inited==NONE || (inited==RND && scan)); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index bc81e5b01c1..d3b06f5983a 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -2058,10 +2058,14 @@ int subselect_uniquesubquery_engine::scan_table() TABLE *table= tab->table; DBUG_ENTER("subselect_uniquesubquery_engine::scan_table"); - if (table->file->inited) - table->file->ha_index_end(); - - table->file->ha_rnd_init(1); + if ((table->file->inited && + (error= table->file->ha_index_end())) || + (error= table->file->ha_rnd_init(1))) + { + (void) report_error(table, error); + DBUG_RETURN(true); + } + table->file->extra_opt(HA_EXTRA_CACHE, current_thd->variables.read_buff_size); table->null_row= 0; @@ -2238,9 +2242,14 @@ int subselect_uniquesubquery_engine::exec() if (null_keypart) DBUG_RETURN(scan_table()); - - if (!table->file->inited) - table->file->ha_index_init(tab->ref.key, 0); + + if (!table->file->inited && + (error= table->file->ha_index_init(tab->ref.key, 0))) + { + (void) report_error(table, error); + DBUG_RETURN(true); + } + error= table->file->index_read_map(table->record[0], tab->ref.key_buff, make_prev_keypart_map(tab->ref.key_parts), @@ -2360,8 +2369,12 @@ int subselect_indexsubquery_engine::exec() if (null_keypart) DBUG_RETURN(scan_table()); - if (!table->file->inited) - table->file->ha_index_init(tab->ref.key, 1); + if (!table->file->inited && + (error= table->file->ha_index_init(tab->ref.key, 1))) + { + (void) report_error(table, error); + DBUG_RETURN(true); + } error= table->file->index_read_map(table->record[0], tab->ref.key_buff, make_prev_keypart_map(tab->ref.key_parts), diff --git a/sql/log_event.cc b/sql/log_event.cc index c4a6ebb9a71..a31e5f71c37 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -9777,19 +9777,25 @@ int Rows_log_event::find_row(const Relay_log_info *rli) case HA_ERR_END_OF_FILE: if (++restart_count < 2) - table->file->ha_rnd_init(1); + { + if ((error= table->file->ha_rnd_init(1))) + { + table->file->print_error(error, MYF(0)); + goto err; + } + } break; default: DBUG_PRINT("info", ("Failed to get next record" " (rnd_next returns %d)",error)); table->file->print_error(error, MYF(0)); - table->file->ha_rnd_end(); + (void) table->file->ha_rnd_end(); goto err; } } while (restart_count < 2 && record_compare(table)); - + /* Note: above record_compare will take into accout all record fields which might be incorrect in case a partial row was given in the event diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index d68c474d00a..55d8d72ec5d 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -725,7 +725,10 @@ static int find_and_fetch_row(TABLE *table, uchar *key) int error; /* We have a key: search the table using the index */ if (!table->file->inited && (error= table->file->ha_index_init(0, FALSE))) + { + table->file->print_error(error, MYF(0)); DBUG_RETURN(error); + } /* Don't print debug messages when running valgrind since they can @@ -823,7 +826,10 @@ static int find_and_fetch_row(TABLE *table, uchar *key) /* We don't have a key: search the table using rnd_next() */ if ((error= table->file->ha_rnd_init(1))) - return error; + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(error); + } /* Continue until we find the right record or have made a full loop */ do @@ -846,15 +852,21 @@ static int find_and_fetch_row(TABLE *table, uchar *key) goto restart_rnd_next; case HA_ERR_END_OF_FILE: - if (++restart_count < 2) - table->file->ha_rnd_init(1); - break; + if (++restart_count < 2) + { + if ((error= table->file->ha_rnd_init(1))) + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(error); + } + } + break; default: - table->file->print_error(error, MYF(0)); + table->file->print_error(error, MYF(0)); DBUG_PRINT("info", ("Record not found")); - table->file->ha_rnd_end(); - DBUG_RETURN(error); + (void) table->file->ha_rnd_end(); + DBUG_RETURN(error); } } while (restart_count < 2 && record_compare(table)); @@ -2417,7 +2429,7 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) continue; DBUG_PRINT("info",("no record matching the given row found")); table->file->print_error(error, MYF(0)); - table->file->ha_index_end(); + (void) table->file->ha_index_end(); DBUG_RETURN(error); } } @@ -2458,7 +2470,13 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) case HA_ERR_END_OF_FILE: if (++restart_count < 2) - table->file->ha_rnd_init(1); + { + if ((error= table->file->ha_rnd_init(1))) + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(error); + } + } break; default: diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ce48a8da958..ffd66253eaa 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1183,7 +1183,7 @@ int QUICK_RANGE_SELECT::init() { DBUG_ENTER("QUICK_RANGE_SELECT::init"); - if (file->inited != handler::NONE) + if (file->inited) file->ha_index_or_rnd_end(); DBUG_RETURN(FALSE); } @@ -1191,7 +1191,7 @@ int QUICK_RANGE_SELECT::init() void QUICK_RANGE_SELECT::range_end() { - if (file->inited != handler::NONE) + if (file->inited) file->ha_index_or_rnd_end(); } @@ -1450,8 +1450,9 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler) There is no use of this->file. Use it for the first of merged range selects. */ - if (quick->init_ror_merged_scan(TRUE)) - DBUG_RETURN(1); + int error= quick->init_ror_merged_scan(TRUE); + if (error) + DBUG_RETURN(error); quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS); } while ((quick= quick_it++)) @@ -1522,7 +1523,7 @@ QUICK_ROR_INTERSECT_SELECT::~QUICK_ROR_INTERSECT_SELECT() quick_selects.delete_elements(); delete cpk_quick; free_root(&alloc,MYF(0)); - if (need_to_fetch_row && head->file->inited != handler::NONE) + if (need_to_fetch_row && head->file->inited) head->file->ha_rnd_end(); DBUG_VOID_RETURN; } @@ -1626,8 +1627,8 @@ int QUICK_ROR_UNION_SELECT::reset() List_iterator_fast it(quick_selects); while ((quick= it++)) { - if (quick->reset()) - DBUG_RETURN(1); + if ((error= quick->reset())) + DBUG_RETURN(error); if ((error= quick->get_next())) { if (error == HA_ERR_END_OF_FILE) @@ -1638,10 +1639,10 @@ int QUICK_ROR_UNION_SELECT::reset() queue_insert(&queue, (uchar*)quick); } - if (head->file->ha_rnd_init(1)) + if ((error= head->file->ha_rnd_init(1))) { DBUG_PRINT("error", ("ROR index_merge rnd_init call failed")); - DBUG_RETURN(1); + DBUG_RETURN(error); } DBUG_RETURN(0); @@ -1659,7 +1660,7 @@ QUICK_ROR_UNION_SELECT::~QUICK_ROR_UNION_SELECT() DBUG_ENTER("QUICK_ROR_UNION_SELECT::~QUICK_ROR_UNION_SELECT"); delete_queue(&queue); quick_selects.delete_elements(); - if (head->file->inited != handler::NONE) + if (head->file->inited) head->file->ha_rnd_end(); free_root(&alloc,MYF(0)); DBUG_VOID_RETURN; @@ -8316,7 +8317,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() if (!cur_quick) break; - if (cur_quick->file->inited != handler::NONE) + if (cur_quick->file->inited) cur_quick->file->ha_index_end(); if (cur_quick->init() || cur_quick->reset()) DBUG_RETURN(1); @@ -8568,8 +8569,14 @@ int QUICK_RANGE_SELECT::reset() { if (in_ror_merged_scan) head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap); + + DBUG_EXECUTE_IF("bug14365043_2", + DBUG_SET("+d,ha_index_init_fail");); if ((error= file->ha_index_init(index,1))) + { + file->print_error(error, MYF(0)); DBUG_RETURN(error); + } } /* Do not allocate the buffers twice. */ @@ -10783,7 +10790,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void) head->set_keyread(TRUE); /* We need only the key attributes */ if ((result= file->ha_index_init(index,1))) + { + head->file->print_error(result, MYF(0)); DBUG_RETURN(result); + } if (quick_prefix_select && quick_prefix_select->reset()) DBUG_RETURN(1); result= file->index_last(record); diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index e187cf19917..aaf279395dc 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -380,9 +380,14 @@ int opt_sum_query(THD *thd, const_result= 0; break; } - table->file->ha_index_init((uint) ref.key, 1); + if ((error= table->file->ha_index_init((uint) ref.key, 1))) + { + table->file->print_error(error, MYF(0)); + table->set_keyread(FALSE); + DBUG_RETURN(error); + } - error= is_max ? + error= is_max ? get_index_max_value(table, &ref, range_fl) : get_index_min_value(table, &ref, item_field, range_fl, prefix_len); diff --git a/sql/records.cc b/sql/records.cc index 55859e05f29..7f74b84b2d7 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -67,6 +67,7 @@ static int rr_index_desc(READ_RECORD *info); void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, bool print_error, uint idx, bool reverse) { + int error; empty_record(table); bzero((char*) info,sizeof(*info)); info->thd= thd; @@ -77,8 +78,13 @@ void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, info->unlock_row= rr_unlock_row; table->status=0; /* And it's always found */ - if (!table->file->inited) - table->file->ha_index_init(idx, 1); + if (!table->file->inited && + (error= table->file->ha_index_init(idx, 1))) + { + if (print_error) + table->file->print_error(error, MYF(0)); + } + /* read_record will be changed to rr_index in rr_index_first */ info->read_record= reverse ? rr_index_last : rr_index_first; } diff --git a/sql/sp.cc b/sql/sp.cc index b257e23c8c7..6300329398d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1442,7 +1442,6 @@ bool lock_db_routines(THD *thd, char *db) { TABLE *table; uint key_len; - int nxtres= 0; Open_tables_backup open_tables_state_backup; MDL_request_list mdl_requests; Lock_db_routines_error_handler err_handler; @@ -1468,7 +1467,13 @@ bool lock_db_routines(THD *thd, char *db) table->field[MYSQL_PROC_FIELD_DB]->store(db, strlen(db), system_charset_info); key_len= table->key_info->key_part[0].store_length; - table->file->ha_index_init(0, 1); + int nxtres= table->file->ha_index_init(0, 1); + if (nxtres) + { + table->file->print_error(nxtres, MYF(0)); + close_system_tables(thd, &open_tables_state_backup); + DBUG_RETURN(true); + } if (! table->file->index_read_map(table->record[0], table->field[MYSQL_PROC_FIELD_DB]->ptr, @@ -1532,7 +1537,12 @@ sp_drop_db_routines(THD *thd, char *db) key_len= table->key_info->key_part[0].store_length; ret= SP_OK; - table->file->ha_index_init(0, 1); + if (table->file->ha_index_init(0, 1)) + { + ret= SP_KEY_NOT_FOUND; + goto err_idx_init; + } + if (! table->file->index_read_map(table->record[0], (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr, (key_part_map)1, HA_READ_KEY_EXACT)) @@ -1560,6 +1570,7 @@ sp_drop_db_routines(THD *thd, char *db) } table->file->ha_index_end(); +err_idx_init: close_thread_tables(thd); /* Make sure to only release the MDL lock on mysql.proc, not other diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 201335f16b5..5c4a144247f 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2659,7 +2659,13 @@ replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user, get_grantor(thd, grantor); - table->file->ha_index_init(0, 1); + if ((error= table->file->ha_index_init(0, 1))) + { + table->file->print_error(error, MYF(0)); + DBUG_PRINT("info", ("ha_index_init error")); + DBUG_RETURN(-1); + } + if (table->file->index_read_map(table->record[0], user_key, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) @@ -2901,7 +2907,12 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) key_copy(key, col_privs->record[0], col_privs->key_info, key_prefix_len); col_privs->field[4]->store("",0, &my_charset_latin1); - col_privs->file->ha_index_init(0, 1); + if (col_privs->file->ha_index_init(0, 1)) + { + cols= 0; + return; + } + if (col_privs->file->index_read_map(col_privs->record[0], (uchar*) key, (key_part_map)15, HA_READ_KEY_EXACT)) { @@ -3032,7 +3043,7 @@ static int replace_column_table(GRANT_TABLE *g_t, const char *db, const char *table_name, ulong rights, bool revoke_grant) { - int error=0,result=0; + int result=0; uchar key[MAX_KEY_LENGTH]; uint key_prefix_length; KEY_PART_INFO *key_part= table->key_info->key_part; @@ -3059,7 +3070,13 @@ static int replace_column_table(GRANT_TABLE *g_t, List_iterator iter(columns); class LEX_COLUMN *column; - table->file->ha_index_init(0, 1); + int error= table->file->ha_index_init(0, 1); + if (error) + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(-1); + } + while ((column= iter++)) { ulong privileges= column->rights; @@ -4180,7 +4197,10 @@ static my_bool grant_load_procs_priv(TABLE *p_table) (void) my_hash_init(&func_priv_hash, &my_charset_utf8_bin, 0,0,0, (my_hash_get_key) get_grant_table, 0,0); - p_table->file->ha_index_init(0, 1); + + if (p_table->file->ha_index_init(0, 1)) + DBUG_RETURN(TRUE); + p_table->use_all_columns(); if (!p_table->file->index_first(p_table->record[0])) @@ -4281,7 +4301,10 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables) t_table = tables[0].table; c_table = tables[1].table; - t_table->file->ha_index_init(0, 1); + + if (t_table->file->ha_index_init(0, 1)) + goto end_index_init; + t_table->use_all_columns(); c_table->use_all_columns(); @@ -4326,9 +4349,10 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables) return_val=0; // Return ok end_unlock: - thd->variables.sql_mode= old_sql_mode; t_table->file->ha_index_end(); my_pthread_setspecific_ptr(THR_MALLOC, save_mem_root_ptr); +end_index_init: + thd->variables.sql_mode= old_sql_mode; DBUG_RETURN(return_val); } diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 4435dfab9ea..e7973850194 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -665,14 +665,14 @@ retry: case RFIRST: if (keyname) { - table->file->ha_index_or_rnd_end(); - table->file->ha_index_init(keyno, 1); - error= table->file->index_first(table->record[0]); + if (!(error= table->file->ha_index_or_rnd_end()) && + !(error= table->file->ha_index_init(keyno, 1))) + error= table->file->index_first(table->record[0]); } else { - table->file->ha_index_or_rnd_end(); - if (!(error= table->file->ha_rnd_init(1))) + if (!(error= table->file->ha_index_or_rnd_end()) && + !(error= table->file->ha_rnd_init(1))) error= table->file->rnd_next(table->record[0]); } mode=RNEXT; @@ -689,9 +689,9 @@ retry: /* else fall through */ case RLAST: DBUG_ASSERT(keyname != 0); - table->file->ha_index_or_rnd_end(); - table->file->ha_index_init(keyno, 1); - error= table->file->index_last(table->record[0]); + if (!(error= table->file->ha_index_or_rnd_end()) && + !(error= table->file->ha_index_init(keyno, 1))) + error= table->file->index_last(table->record[0]); mode=RPREV; break; case RNEXT_SAME: @@ -734,11 +734,12 @@ retry: if (!(key= (uchar*) thd->calloc(ALIGN_SIZE(key_len)))) goto err; - table->file->ha_index_or_rnd_end(); - table->file->ha_index_init(keyno, 1); + if ((error= table->file->ha_index_or_rnd_end())) + break; key_copy(key, table->record[0], table->key_info + keyno, key_len); - error= table->file->index_read_map(table->record[0], - key, keypart_map, ha_rkey_mode); + if (!(error= table->file->ha_index_init(keyno, 1))) + error= table->file->index_read_map(table->record[0], + key, keypart_map, ha_rkey_mode); mode=rkey_to_rnext[(int)ha_rkey_mode]; break; } diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 99203ef98ba..0dca1f6a75a 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -297,8 +297,14 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations, rtopic_id= find_fields[help_relation_help_topic_id].field; rkey_id= find_fields[help_relation_help_keyword_id].field; - topics->file->ha_index_init(iindex_topic,1); - relations->file->ha_index_init(iindex_relations,1); + if (topics->file->ha_index_init(iindex_topic,1) || + relations->file->ha_index_init(iindex_relations,1)) + { + if (topics->file->inited) + topics->file->ha_index_end(); + my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0)); + DBUG_RETURN(-1); + } rkey_id->store((longlong) key_id, TRUE); rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3bde5aa8f6a..5c216a44d70 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11466,7 +11466,14 @@ do_select(JOIN *join,List *fields,TABLE *table,Procedure *procedure) empty_record(table); if (table->group && join->tmp_table_param.sum_func_count && table->s->keys && !table->file->inited) - table->file->ha_index_init(0, 0); + { + rc= table->file->ha_index_init(0, 0); + if (rc) + { + table->file->print_error(rc, MYF(0)); + DBUG_RETURN(rc); + } + } } /* Set up select_end */ Next_select_func end_select= setup_end_select_func(join); @@ -12286,8 +12293,13 @@ join_read_key(JOIN_TAB *tab) if (!table->file->inited) { - table->file->ha_index_init(tab->ref.key, tab->sorted); + if ((error= table->file->ha_index_init(tab->ref.key, tab->sorted))) + { + (void) report_error(table, error); + return 1; + } } + if (cmp_buffer_with_ref(tab) || (table->status & (STATUS_GARBAGE | STATUS_NO_PARENT | STATUS_NULL_ROW))) { @@ -12371,8 +12383,12 @@ join_read_always_key(JOIN_TAB *tab) TABLE *table= tab->table; /* Initialize the index first */ - if (!table->file->inited) - table->file->ha_index_init(tab->ref.key, tab->sorted); + if (!table->file->inited && + (error= table->file->ha_index_init(tab->ref.key, tab->sorted))) + { + (void) report_error(table, error); + return 1; + } /* Perform "Late NULLs Filtering" (see internals manual for explanations) */ for (uint i= 0 ; i < tab->ref.key_parts ; i++) @@ -12407,8 +12423,13 @@ join_read_last_key(JOIN_TAB *tab) int error; TABLE *table= tab->table; - if (!table->file->inited) - table->file->ha_index_init(tab->ref.key, tab->sorted); + if (!table->file->inited && + (error= table->file->ha_index_init(tab->ref.key, tab->sorted))) + { + (void) report_error(table, error); + return 1; + } + if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref)) return -1; if ((error=table->file->index_read_last_map(table->record[0], @@ -12520,8 +12541,14 @@ join_read_first(JOIN_TAB *tab) tab->read_record.file=table->file; tab->read_record.index=tab->index; tab->read_record.record=table->record[0]; - if (!table->file->inited) - table->file->ha_index_init(tab->index, tab->sorted); + + if (!table->file->inited && + (error= table->file->ha_index_init(tab->index, tab->sorted))) + { + (void) report_error(table, error); + return 1; + } + if ((error=tab->table->file->index_first(tab->table->record[0]))) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) @@ -12555,8 +12582,13 @@ join_read_last(JOIN_TAB *tab) tab->read_record.file=table->file; tab->read_record.index=tab->index; tab->read_record.record=table->record[0]; - if (!table->file->inited) - table->file->ha_index_init(tab->index, 1); + if (!table->file->inited && + (error= table->file->ha_index_init(tab->index, 1))) + { + (void) report_error(table, error); + return 1; + } + if ((error= tab->table->file->index_last(tab->table->record[0]))) return report_error(table, error); return 0; @@ -12579,8 +12611,13 @@ join_ft_read_first(JOIN_TAB *tab) int error; TABLE *table= tab->table; - if (!table->file->inited) - table->file->ha_index_init(tab->ref.key, 1); + if (!table->file->inited && + (error= table->file->ha_index_init(tab->ref.key, 1))) + { + (void) report_error(table, error); + return 1; + } + table->file->ft_init(); if ((error= table->file->ft_read(table->record[0]))) @@ -12973,7 +13010,12 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), error, 0)) DBUG_RETURN(NESTED_LOOP_ERROR); // Not a table_is_full error /* Change method to update rows */ - table->file->ha_index_init(0, 0); + if ((error= table->file->ha_index_init(0, 0))) + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(NESTED_LOOP_ERROR); + } + join->join_tab[join->tables-1].next_select=end_unique_update; } join->send_records++; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 81e18ccd6c3..b921b2c782e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4925,7 +4925,13 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) { DBUG_RETURN(1); } - proc_table->file->ha_index_init(0, 1); + + if (proc_table->file->ha_index_init(0, 1)) + { + res= 1; + goto err; + } + if ((res= proc_table->file->index_first(proc_table->record[0]))) { res= (res == HA_ERR_END_OF_FILE) ? 0 : 1; @@ -4951,7 +4957,9 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) } err: - proc_table->file->ha_index_end(); + if (proc_table->file->inited) + (void) proc_table->file->ha_index_end(); + close_system_tables(thd, &open_tables_state_backup); DBUG_RETURN(res); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index c4a95edcfc2..222b3d9470a 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -2038,7 +2038,8 @@ int multi_update::do_updates() org_updated= updated; tmp_table= tmp_tables[cur_table->shared]; tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache - (void) table->file->ha_rnd_init(0); + if (local_error= table->file->ha_rnd_init(0)) + goto err; table->file->extra(HA_EXTRA_NO_CACHE); check_opt_it.rewind(); @@ -2163,11 +2164,16 @@ err: } err2: - (void) table->file->ha_rnd_end(); - (void) tmp_table->file->ha_rnd_end(); + if (table->file->inited) + (void) table->file->ha_rnd_end(); + if (tmp_table->file->inited) + (void) tmp_table->file->ha_rnd_end(); check_opt_it.rewind(); while (TABLE *tbl= check_opt_it++) - tbl->file->ha_rnd_end(); + { + if (tbl->file->inited) + (void) tbl->file->ha_rnd_end(); + } if (updated != org_updated) { diff --git a/sql/tztime.cc b/sql/tztime.cc index f245b736f52..72898ccc706 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1706,14 +1706,11 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) } table= tz_tables[0].table; - /* - It is OK to ignore ha_index_init()/ha_index_end() return values since - mysql.time_zone* tables are MyISAM and these operations always succeed - for MyISAM. - */ - (void)table->file->ha_index_init(0, 1); - table->use_all_columns(); + if (table->file->ha_index_init(0, 1)) + goto end_with_close; + + table->use_all_columns(); tz_leapcnt= 0; res= table->file->index_first(table->record[0]); @@ -1899,12 +1896,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) tz_tables= tz_tables->next_local; table->field[0]->store(tz_name->ptr(), tz_name->length(), &my_charset_latin1); - /* - It is OK to ignore ha_index_init()/ha_index_end() return values since - mysql.time_zone* tables are MyISAM and these operations always succeed - for MyISAM. - */ - (void)table->file->ha_index_init(0, 1); + if (table->file->ha_index_init(0, 1)) + goto end; if (table->file->index_read_map(table->record[0], table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) @@ -1932,7 +1925,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) table= tz_tables->table; tz_tables= tz_tables->next_local; table->field[0]->store((longlong) tzid, TRUE); - (void)table->file->ha_index_init(0, 1); + if (table->file->ha_index_init(0, 1)) + goto end; if (table->file->index_read_map(table->record[0], table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) @@ -1959,7 +1953,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) table= tz_tables->table; tz_tables= tz_tables->next_local; table->field[0]->store((longlong) tzid, TRUE); - (void)table->file->ha_index_init(0, 1); + if (table->file->ha_index_init(0, 1)) + goto end; res= table->file->index_read_map(table->record[0], table->field[0]->ptr, (key_part_map)1, HA_READ_KEY_EXACT); @@ -2030,7 +2025,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) */ table= tz_tables->table; table->field[0]->store((longlong) tzid, TRUE); - (void)table->file->ha_index_init(0, 1); + if (table->file->ha_index_init(0, 1)) + goto end; res= table->file->index_read_map(table->record[0], table->field[0]->ptr, (key_part_map)1, HA_READ_KEY_EXACT); @@ -2165,8 +2161,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) end: - if (table) - (void)table->file->ha_index_end(); + if (table && table->file->inited) + (void) table->file->ha_index_end(); DBUG_RETURN(return_val); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9c77179c188..12c4b5a0e40 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6110,7 +6110,7 @@ ha_innobase::change_active_index( "InnoDB: Index %s for table %s is" " marked as corrupted", index_name, table_name); - DBUG_RETURN(1); + DBUG_RETURN(HA_ERR_INDEX_CORRUPT); } else { push_warning_printf( user_thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -6121,7 +6121,7 @@ ha_innobase::change_active_index( /* The caller seems to ignore this. Thus, we must check this again in row_search_for_mysql(). */ - DBUG_RETURN(2); + DBUG_RETURN(HA_ERR_TABLE_DEF_CHANGED); } ut_a(prebuilt->search_tuple != 0); From 35a05a600868cf73166d78b8ce4396cf5d4c5951 Mon Sep 17 00:00:00 2001 From: Praveenkumar Hulakund Date: Mon, 8 Oct 2012 23:35:15 +0530 Subject: [PATCH 224/349] Bug#11756600 - SLAVE THREAD CAN CRASH IF EVENT SCHEDULER FAILS TO READ EVENT TABLE AT STARTUP. This issue is fixed in 5.5+ versions. This patch adds a test case for this scenario. --- mysql-test/include/rpl_start_server.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mysql-test/include/rpl_start_server.inc b/mysql-test/include/rpl_start_server.inc index c59c7759910..932fc9da7ef 100644 --- a/mysql-test/include/rpl_start_server.inc +++ b/mysql-test/include/rpl_start_server.inc @@ -8,6 +8,7 @@ # --let $rpl_server_number= N # [--let $rpl_server_parameters= --flag1 --flag2 ...] # [--let $rpl_debug= 1] +# [--let $rpl_server_error= 0] # --source include/rpl_start_server.inc # # Parameters: @@ -21,6 +22,9 @@ # If set, extra parameters given by this variable are passed to # mysqld. # +# $rpl_server_error +# If set, failure of the server startup is expected. +# # $rpl_debug # See include/rpl_init.inc # @@ -47,8 +51,9 @@ if ($rpl_server_parameters) # Write file to make mysql-test-run.pl start up the server again --exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect ---source include/rpl_reconnect.inc - - ---let $include_filename= rpl_start_server.inc $_rpl_start_server_args ---source include/end_include_file.inc +if (!$rpl_server_error) +{ + --source include/rpl_reconnect.inc + --let $include_filename= rpl_start_server.inc $_rpl_start_server_args + --source include/end_include_file.inc +} From d5d53d190293af440f6a7d116df63c21fa391bd1 Mon Sep 17 00:00:00 2001 From: Annamalai Gurusami Date: Tue, 9 Oct 2012 12:25:02 +0530 Subject: [PATCH 225/349] Fixing a compilation issue. --- sql/sql_update.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 222b3d9470a..e7600fe248e 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -2038,7 +2038,7 @@ int multi_update::do_updates() org_updated= updated; tmp_table= tmp_tables[cur_table->shared]; tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache - if (local_error= table->file->ha_rnd_init(0)) + if ((local_error= table->file->ha_rnd_init(0))) goto err; table->file->extra(HA_EXTRA_NO_CACHE); From 5427d33e6248caa4e6a2b92c9ab9317fadcb5c2f Mon Sep 17 00:00:00 2001 From: Harin Vadodaria Date: Tue, 9 Oct 2012 18:15:40 +0530 Subject: [PATCH 226/349] Bug #14211140: CRASH WHEN GRANTING OR REVOKING PROXY PRIVILEGES Description: (user,host) pair from security context is used privilege checking at the time of granting or revoking proxy privileges. This creates problem when server is started with --skip-name-resolve option because host will not contain any value. Checks should be dependent on consistent values regardless the way server is started. Further, privilege check should use (priv_user,priv_host) pair rather than values obtained from inbound connection because this pair represents the correct account context obtained from mysql.user table. --- mysql-test/r/plugin_auth.result | 19 +++++++++++-------- mysql-test/t/plugin_auth.test | 26 ++++++++++++++++++++------ sql/sql_acl.cc | 21 ++++++++++++++++----- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index 64bc870a7fa..94e600123ae 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -124,17 +124,20 @@ ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost' this should fail : not the same user GRANT PROXY ON grant_plug TO grant_plug_dest; ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost' -this should fail : same user, but on a different host +This is a valid grant GRANT PROXY ON grant_plug_dest TO grant_plug; -ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost' -this should work : same user -GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2; -REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2; +REVOKE PROXY ON grant_plug_dest FROM grant_plug; this should work : same user +GRANT PROXY ON grant_plug_dest TO grant_plug_dest2; +REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2; +this should fail : not the same user GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION; +ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost' +this should fail : not the same user REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug; +ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost' this should fail : can't create users -GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost; +GRANT PROXY ON grant_plug_dest TO grant_plug@localhost; ERROR 42000: You are not allowed to create a user with GRANT in default connection # test what root can grant @@ -152,12 +155,12 @@ GRANT PROXY ON future_user TO grant_plug; in default connection SHOW GRANTS FOR grant_plug; Grants for grant_plug@% -GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' WITH GRANT OPTION +GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' GRANT PROXY ON 'future_user'@'%' TO 'grant_plug'@'%' REVOKE PROXY ON future_user FROM grant_plug; SHOW GRANTS FOR grant_plug; Grants for grant_plug@% -GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' WITH GRANT OPTION +GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' ## testing drop user CREATE USER test_drop@localhost; GRANT PROXY ON future_user TO test_drop@localhost; diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test index 75d3ef3e807..994b8f26308 100644 --- a/mysql-test/t/plugin_auth.test +++ b/mysql-test/t/plugin_auth.test @@ -179,21 +179,35 @@ GRANT PROXY ON ''@'' TO grant_plug; --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR GRANT PROXY ON grant_plug TO grant_plug_dest; ---echo this should fail : same user, but on a different host ---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR +# Security context in THD contains two pairs of (user,host) +# 1. (user,host) pair referring to inbound connection +# 2. (priv_user,priv_host) pair obtained from mysql.user table after doing +# authnetication of incoming connection. +# Granting/revoking proxy privileges, privileges should be checked wrt +# (priv_user, priv_host) tuple that is obtained from mysql.user table +# Following is a valid grant because effective user of connection is +# grant_plug_dest@% and statement is trying to grant proxy on the same +# user. +--echo This is a valid grant GRANT PROXY ON grant_plug_dest TO grant_plug; +REVOKE PROXY ON grant_plug_dest FROM grant_plug; --echo this should work : same user -GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2; -REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2; +GRANT PROXY ON grant_plug_dest TO grant_plug_dest2; +REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2; ---echo this should work : same user +# grant_plug_dest@localhost is not the same as grant_plug_dest@% +# so following grant/revoke should fail +--echo this should fail : not the same user +--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION; +--echo this should fail : not the same user +--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug; --echo this should fail : can't create users --error ER_CANT_CREATE_USER_WITH_GRANT -GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost; +GRANT PROXY ON grant_plug_dest TO grant_plug@localhost; connection default; --echo in default connection diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 5c4a144247f..d99ca3ceb99 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -7256,14 +7256,25 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user, DBUG_RETURN(FALSE); } - /* one can grant proxy to himself to others */ - if (!strcmp(thd->security_ctx->user, user) && + /* + one can grant proxy for self to others. + Security context in THD contains two pairs of (user,host): + 1. (user,host) pair referring to inbound connection. + 2. (priv_user,priv_host) pair obtained from mysql.user table after doing + authnetication of incoming connection. + Privileges should be checked wrt (priv_user, priv_host) tuple, because + (user,host) pair obtained from inbound connection may have different + values than what is actually stored in mysql.user table and while granting + or revoking proxy privilege, user is expected to provide entries mentioned + in mysql.user table. + */ + if (!strcmp(thd->security_ctx->priv_user, user) && !my_strcasecmp(system_charset_info, host, - thd->security_ctx->host)) + thd->security_ctx->priv_host)) { DBUG_PRINT("info", ("strcmp (%s, %s) my_casestrcmp (%s, %s) equal", - thd->security_ctx->user, user, - host, thd->security_ctx->host)); + thd->security_ctx->priv_user, user, + host, thd->security_ctx->priv_host)); DBUG_RETURN(FALSE); } From 93398c307fb682c56bea022924baf46248ffa253 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 9 Oct 2012 16:02:58 +0300 Subject: [PATCH 227/349] Fix Bug#14708715 CREATE TABLE MEMORY LEAK ON DB_OUT_OF_FILE_SPACE The problem is in the error handling in row_create_table_for_mysql(). In the 'disk full' case we may forget to call dict_mem_table_free() on the table object. Approved by: Marko (rb:1377 and rb:1386) --- storage/innodb_plugin/os/os0file.c | 16 ++++++++++++++++ storage/innodb_plugin/row/row0mysql.c | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c index ff80f7ed1b4..7f8c7c637a1 100644 --- a/storage/innodb_plugin/os/os0file.c +++ b/storage/innodb_plugin/os/os0file.c @@ -1249,6 +1249,22 @@ os_file_create( ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */ ibool* success)/*!< out: TRUE if succeed, FALSE if error */ { +#ifdef __WIN__ + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + SetLastError(ERROR_DISK_FULL); + return((os_file_t) -1); + ); +#else /* __WIN__ */ + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + errno = ENOSPC; + return((os_file_t) -1); + ); +#endif /* __WIN__ */ + #ifdef __WIN__ os_file_t file; DWORD share_mode = FILE_SHARE_READ; diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index 974d67893a3..137a164c4cd 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -1768,7 +1768,8 @@ Creates a table for MySQL. If the name of the table ends in one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", "innodb_table_monitor", then this will also start the printing of monitor output by the master thread. If the table name ends in "innodb_mem_validate", -InnoDB will try to invoke mem_validate(). +InnoDB will try to invoke mem_validate(). On failure the transaction will +be rolled back and the 'table' object will be freed. @return error code or DB_SUCCESS */ UNIV_INTERN int @@ -1907,6 +1908,8 @@ err_exit: row_drop_table_for_mysql(table->name, trx, FALSE); trx_commit_for_mysql(trx); + } else { + dict_mem_table_free(table); } break; From 8baabf30900c30d733ce3b8942512d8cce191582 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 9 Oct 2012 16:08:06 +0300 Subject: [PATCH 228/349] Update the ChangeLog with the fix of Bug#14708715 --- storage/innodb_plugin/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 1e5b388643d..cc4962bd125 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2012-10-09 The InnoDB Team + + * row/row0mysql.c: + Fix Bug#14708715 CREATE TABLE MEMORY LEAK ON DB_OUT_OF_FILE_SPACE + 2012-09-28 The InnoDB Team * include/row0undo.h, row/row0umod.c, row/row0undo.c: From 4cefe863aee8430a09e74a52feef0eb9ea4fae9b Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 9 Oct 2012 16:29:00 +0300 Subject: [PATCH 229/349] Port the test for Bug#14708715 from 5.1/innodb_plugin into 5.1/innodb although the bug does not exist in 5.1/innodb. --- storage/innobase/os/os0file.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 566c50381e7..9f68f93fd99 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -1209,6 +1209,22 @@ os_file_create( ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */ ibool* success)/* out: TRUE if succeed, FALSE if error */ { +#ifdef __WIN__ + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + SetLastError(ERROR_DISK_FULL); + return((os_file_t) -1); + ); +#else /* __WIN__ */ + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + errno = ENOSPC; + return((os_file_t) -1); + ); +#endif /* __WIN__ */ + #ifdef __WIN__ os_file_t file; DWORD share_mode = FILE_SHARE_READ; From 1d16fc16dc50d21e2456d6367cea20f83404ffc6 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 10 Oct 2012 22:22:10 +0300 Subject: [PATCH 230/349] Fix compilation error in debug mode: os/os0file.c:1332: error: ISO C90 forbids mixed declarations and code --- storage/innobase/os/os0file.c | 27 +++++++++++++-------------- storage/innodb_plugin/os/os0file.c | 27 +++++++++++++-------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 9f68f93fd99..d088ff54ebc 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -1210,27 +1210,19 @@ os_file_create( ibool* success)/* out: TRUE if succeed, FALSE if error */ { #ifdef __WIN__ + os_file_t file; + DWORD share_mode = FILE_SHARE_READ; + DWORD create_flag; + DWORD attributes; + ibool retry; + DBUG_EXECUTE_IF( "ib_create_table_fail_disk_full", *success = FALSE; SetLastError(ERROR_DISK_FULL); return((os_file_t) -1); ); -#else /* __WIN__ */ - DBUG_EXECUTE_IF( - "ib_create_table_fail_disk_full", - *success = FALSE; - errno = ENOSPC; - return((os_file_t) -1); - ); -#endif /* __WIN__ */ -#ifdef __WIN__ - os_file_t file; - DWORD share_mode = FILE_SHARE_READ; - DWORD create_flag; - DWORD attributes; - ibool retry; try_again: ut_a(name); @@ -1334,6 +1326,13 @@ try_again: ibool retry; const char* mode_str = NULL; + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + errno = ENOSPC; + return((os_file_t) -1); + ); + try_again: ut_a(name); diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c index 7f8c7c637a1..57a140ea698 100644 --- a/storage/innodb_plugin/os/os0file.c +++ b/storage/innodb_plugin/os/os0file.c @@ -1250,27 +1250,19 @@ os_file_create( ibool* success)/*!< out: TRUE if succeed, FALSE if error */ { #ifdef __WIN__ + os_file_t file; + DWORD share_mode = FILE_SHARE_READ; + DWORD create_flag; + DWORD attributes; + ibool retry; + DBUG_EXECUTE_IF( "ib_create_table_fail_disk_full", *success = FALSE; SetLastError(ERROR_DISK_FULL); return((os_file_t) -1); ); -#else /* __WIN__ */ - DBUG_EXECUTE_IF( - "ib_create_table_fail_disk_full", - *success = FALSE; - errno = ENOSPC; - return((os_file_t) -1); - ); -#endif /* __WIN__ */ -#ifdef __WIN__ - os_file_t file; - DWORD share_mode = FILE_SHARE_READ; - DWORD create_flag; - DWORD attributes; - ibool retry; try_again: ut_a(name); @@ -1386,6 +1378,13 @@ try_again: ibool retry; const char* mode_str = NULL; + DBUG_EXECUTE_IF( + "ib_create_table_fail_disk_full", + *success = FALSE; + errno = ENOSPC; + return((os_file_t) -1); + ); + try_again: ut_a(name); From f1d3b0f19011217c13927f44a82e8e17291fbba7 Mon Sep 17 00:00:00 2001 From: Nuno Carvalho Date: Fri, 12 Oct 2012 08:32:10 +0100 Subject: [PATCH 231/349] BUG#14629727: USER_VAR_EVENT IS MISSING RANGE CHECKS This bug had two problems: P1) Reads out of bounds; P2) Writes out of bounds. PROBLEM P1 ---------- User_var_log_event unmarshalling from binlog was not performing range checks when using name_len and val_len variables to walk on event buffer. Added range checks to User_var_log_event unmarshalling to prevent unmarshalling errors. PROBLEM P2 ---------- User_var_log_event value was allocated on thread stack, what caused stack frame errors when User_var_log_event value was bigger than thread stack size. Currently value is allocated on heap memory. --- sql/log_event.cc | 45 ++++++++++++++++++++++++++++++++++++++++----- sql/log_event.h | 4 ++-- sql/mysql_priv.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 7 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index c3ba969cf1f..0ad258f7073 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1286,7 +1286,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, ev = new Rand_log_event(buf, description_event); break; case USER_VAR_EVENT: - ev = new User_var_log_event(buf, description_event); + ev = new User_var_log_event(buf, event_len, description_event); break; case FORMAT_DESCRIPTION_EVENT: ev = new Format_description_log_event(buf, event_len, description_event); @@ -5685,18 +5685,34 @@ void User_var_log_event::pack_info(Protocol* protocol) User_var_log_event:: -User_var_log_event(const char* buf, +User_var_log_event(const char* buf, uint event_len, const Format_description_log_event* description_event) :Log_event(buf, description_event) #ifndef MYSQL_CLIENT , deferred(false) #endif { + bool error= false; + const char* buf_start= buf; /* The Post-Header is empty. The Variable Data part begins immediately. */ buf+= description_event->common_header_len + description_event->post_header_len[USER_VAR_EVENT-1]; name_len= uint4korr(buf); name= (char *) buf + UV_NAME_LEN_SIZE; + + /* + We don't know yet is_null value, so we must assume that name_len + may have the bigger value possible, is_null= True and there is no + payload for val. + */ + if (0 == name_len || + !valid_buffer_range(name_len, buf_start, name, + event_len - UV_VAL_IS_NULL)) + { + error= true; + goto err; + } + buf+= UV_NAME_LEN_SIZE + name_len; is_null= (bool) *buf; if (is_null) @@ -5708,13 +5724,31 @@ User_var_log_event(const char* buf, } else { + if (!valid_buffer_range(UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE, + buf_start, buf, event_len)) + { + error= true; + goto err; + } + type= (Item_result) buf[UV_VAL_IS_NULL]; charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE); val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + UV_CHARSET_NUMBER_SIZE); val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE); + + if (!valid_buffer_range(val_len, buf_start, val, event_len)) + { + error= true; + goto err; + } } + +err: + if (error) + name= 0; } @@ -5860,8 +5894,9 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) char *hex_str; CHARSET_INFO *cs; - if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte - break; // no error, as we are 'void' + hex_str= (char *)my_malloc(2*val_len+1+2,MYF(MY_WME)); // 2 hex digits / byte + if (!hex_str) + return; str_to_hex(hex_str, val, val_len); /* For proper behaviour when mysqlbinlog|mysql, we need to explicitely @@ -5879,7 +5914,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n", cs->csname, hex_str, cs->name, print_event_info->delimiter); - my_afree(hex_str); + my_free(hex_str, MYF(MY_WME)); } break; case ROW_RESULT: diff --git a/sql/log_event.h b/sql/log_event.h index ba6b9b876aa..c36564fcde8 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2496,7 +2496,7 @@ public: void print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif - User_var_log_event(const char* buf, + User_var_log_event(const char* buf, uint event_len, const Format_description_log_event *description_event); ~User_var_log_event() {} Log_event_type get_type_code() { return USER_VAR_EVENT;} @@ -2510,7 +2510,7 @@ public: bool is_deferred() { return deferred; } void set_deferred() { deferred= true; } #endif - bool is_valid() const { return 1; } + bool is_valid() const { return name != 0; } private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 937617032dd..05a37228e17 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -501,6 +501,50 @@ protected: */ #define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1) +/* + Check how many bytes are available on buffer. + + @param buf_start Pointer to buffer start. + @param buf_current Pointer to the current position on buffer. + @param buf_len Buffer length. + + @return Number of bytes available on event buffer. +*/ +template T available_buffer(const char* buf_start, + const char* buf_current, + T buf_len) +{ + return buf_len - (buf_current - buf_start); +} +/* Explicit instantion to unsigned int. */ +template unsigned int available_buffer(const char*, + const char*, + unsigned int); + +/* + Check if jump value is within buffer limits. + + @param jump Number of positions we want to advance. + @param buf_start Pointer to buffer start + @param buf_current Pointer to the current position on buffer. + @param buf_len Buffer length. + + @return True If jump value is within buffer limits. + False Otherwise. +*/ +template bool valid_buffer_range(T jump, + const char* buf_start, + const char* buf_current, + T buf_len) +{ + return (jump <= available_buffer(buf_start, buf_current, buf_len)); +} +/* Explicit instantion to unsigned int. */ +template bool valid_buffer_range(unsigned int, + const char*, + const char*, + unsigned int); + /* The rest of the file is included in the server only */ #ifndef MYSQL_CLIENT From fc1fbe159afa043d647711c83778d6911e5dfe39 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 12 Oct 2012 19:38:45 +0200 Subject: [PATCH 232/349] Bug#14629232 SECURITY VULNERABILITY WITH SHOW PROFILE This fix resolves a security vulnerability of SHOW PROFILE. See the bug report for details. --- sql/sql_profile.cc | 29 +++++++++++++++++++---------- sql/sql_profile.h | 6 ++++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 49666dde476..f3a95e6479b 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -39,6 +39,7 @@ #define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3) #define MAX_QUERY_LENGTH 300 +#define MAX_QUERY_HISTORY 101 /* Reserved for systems that can't record the function name in source. */ const char * const _unknown_func_ = ""; @@ -233,9 +234,12 @@ void PROF_MEASUREMENT::collect() QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg) :profiling(profiling_arg), profiling_query_id(0), query_source(NULL) { - profile_start= new PROF_MEASUREMENT(this, status_arg); - entries.push_back(profile_start); - profile_end= profile_start; + m_seq_counter= 1; + PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg); + prof->m_seq= m_seq_counter++; + m_start_time_usecs= prof->time_usecs; + m_end_time_usecs= m_start_time_usecs; + entries.push_back(prof); } QUERY_PROFILE::~QUERY_PROFILE() @@ -275,9 +279,14 @@ void QUERY_PROFILE::new_status(const char *status_arg, else prof= new PROF_MEASUREMENT(this, status_arg); - profile_end= prof; + prof->m_seq= m_seq_counter++; + m_end_time_usecs= prof->time_usecs; entries.push_back(prof); + /* Maintain the query history size. */ + while (entries.elements > MAX_QUERY_HISTORY) + delete entries.pop(); + DBUG_VOID_RETURN; } @@ -437,8 +446,7 @@ bool PROFILING::show_profiles() String elapsed; - PROF_MEASUREMENT *ps= prof->profile_start; - PROF_MEASUREMENT *pe= prof->profile_end; + double query_time_usecs= prof->m_end_time_usecs - prof->m_start_time_usecs; if (++idx <= unit->offset_limit_cnt) continue; @@ -447,7 +455,7 @@ bool PROFILING::show_profiles() protocol->prepare_for_resend(); protocol->store((uint32)(prof->profiling_query_id)); - protocol->store((double)(pe->time_usecs - ps->time_usecs)/(1000.0*1000), + protocol->store((double)(query_time_usecs/(1000.0*1000)), (uint32) TIME_FLOAT_DIGITS-1, &elapsed); if (prof->query_source != NULL) protocol->store(prof->query_source, strlen(prof->query_source), @@ -507,17 +515,18 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond us also include a numbering of each state per query. The query_id and the "seq" together are unique. */ - ulonglong seq; + ulong seq; void *entry_iterator; PROF_MEASUREMENT *entry, *previous= NULL; /* ...and for each query, go through all its state-change steps. */ - for (seq= 0, entry_iterator= query->entries.new_iterator(); + for (entry_iterator= query->entries.new_iterator(); entry_iterator != NULL; entry_iterator= query->entries.iterator_next(entry_iterator), - seq++, previous=entry, row_number++) + previous=entry, row_number++) { entry= query->entries.iterator_value(entry_iterator); + seq= entry->m_seq; /* Skip the first. We count spans of fence, not fence-posts. */ if (previous == NULL) continue; diff --git a/sql/sql_profile.h b/sql/sql_profile.h index b21216f290f..c59b342e502 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -182,6 +182,7 @@ private: char *file; unsigned int line; + ulong m_seq; double time_usecs; char *allocated_status_memory; @@ -213,8 +214,9 @@ private: query_id_t profiling_query_id; /* Session-specific id. */ char *query_source; - PROF_MEASUREMENT *profile_start; - PROF_MEASUREMENT *profile_end; + double m_start_time_usecs; + double m_end_time_usecs; + ulong m_seq_counter; Queue entries; From 9bfc910f2f5d8282a4c69104cc2574da780902d6 Mon Sep 17 00:00:00 2001 From: "Krunal Bauskar krunal.bauskar@oracle.com" Date: Mon, 15 Oct 2012 09:24:33 +0530 Subject: [PATCH 233/349] bug#14704286 SECONDARY INDEX UPDATES MAKE CONSISTENT READS DO O(N^2) UNDO PAGE LOOKUPS (honoring kill query while accessing sec_index) If secondary index is being used for select query evaluation and this query is operating with consistent read snapshot it might take good time for secondary index to return back control to mysql as MVCC would kick in. If user issues "kill query " while query is actively accessing secondary index it will not be honored as there is no hook to check for this condition. Added hook for this check. ----- Parallely secondary index taking too long to evaluate for consistent read snapshot case is being examined for performance improvement. WL#6540. --- .../suite/innodb/r/innodb_bug14704286.result | 43 +++++++++ .../suite/innodb/t/innodb_bug14704286.test | 89 +++++++++++++++++++ storage/innobase/row/row0sel.c | 6 +- storage/innodb_plugin/row/row0sel.c | 5 ++ 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug14704286.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug14704286.test diff --git a/mysql-test/suite/innodb/r/innodb_bug14704286.result b/mysql-test/suite/innodb/r/innodb_bug14704286.result new file mode 100644 index 00000000000..9703955cfa7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug14704286.result @@ -0,0 +1,43 @@ +use test; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (id int primary key, value int, value2 int, +value3 int, index(value,value2)) engine=innodb; +insert into t1 values +(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), +(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), +(20,20,20,20); +use test; +start transaction with consistent snapshot; +use test; +CREATE PROCEDURE update_t1() +BEGIN +DECLARE i INT DEFAULT 1; +while (i <= 5000) DO +update test.t1 set value2=value2+1, value3=value3+1 where id=12; +SET i = i + 1; +END WHILE; +END| +CALL update_t1(); +select * from t1; +id value value2 value3 +10 10 10 10 +11 11 11 11 +12 12 5012 5012 +13 13 13 13 +14 14 14 14 +15 15 15 15 +16 16 16 16 +17 17 17 17 +18 18 18 18 +19 19 19 19 +20 20 20 20 +select * from t1 force index(value) where value=12; +kill query @id; +ERROR 70100: Query execution was interrupted +select * from t1 where value = 12; +id value value2 value3 +12 12 12 12 +drop procedure if exists update_t1; +drop table if exists t1; diff --git a/mysql-test/suite/innodb/t/innodb_bug14704286.test b/mysql-test/suite/innodb/t/innodb_bug14704286.test new file mode 100644 index 00000000000..bdc2ab94b01 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug14704286.test @@ -0,0 +1,89 @@ +--source include/have_innodb.inc + +# +# create test-bed to run test +# +use test; + +drop table if exists t1; +create table t1 (id int primary key, value int, value2 int, +value3 int, index(value,value2)) engine=innodb; + +insert into t1 values +(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), +(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), +(20,20,20,20); +let $ID= `SELECT @id := CONNECTION_ID()`; + +# +# we need multiple connections as we need to keep one connection +# active with trx requesting consistent read. +# +connect (conn1, localhost, root,,); +connect (conn2, localhost, root,,); +connect (conn3, localhost, root,,); + +# +# start trx with consistent read +# +connection conn1; +use test; + +start transaction with consistent snapshot; + +# +# update table such that secondary index is updated. +# +connection conn2; +use test; +delimiter |; +CREATE PROCEDURE update_t1() +BEGIN + DECLARE i INT DEFAULT 1; + while (i <= 5000) DO + update test.t1 set value2=value2+1, value3=value3+1 where id=12; + SET i = i + 1; + END WHILE; +END| + +delimiter ;| + +CALL update_t1(); +select * from t1; + +# +# Now try to fire select query from connection-1 enforcing +# use of secondary index. +# +connection conn1; +let $ID= `SELECT @id := CONNECTION_ID()`; +#--error ER_QUERY_INTERRUPTED +--send +select * from t1 force index(value) where value=12; + +# +# select is going to take good time so let's kill query. +# +connection conn3; +let $ignore= `SELECT @id := $ID`; +kill query @id; + +# +# reap the value of connection-1 +# +connection conn1; +--error ER_QUERY_INTERRUPTED +reap; +select * from t1 where value = 12; + +# +# clean test-bed. +# +connection default; +disconnect conn1; +disconnect conn2; +disconnect conn3; +drop procedure if exists update_t1; +drop table if exists t1; + + diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 915cc8339d4..c600fa62151 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3758,9 +3758,13 @@ wait_table_again: } rec_loop: + if (trx_is_interrupted(trx)) { + err = DB_INTERRUPTED; + goto normal_return; + } + /*-------------------------------------------------------------*/ /* PHASE 4: Look for matching records in a loop */ - rec = btr_pcur_get_rec(pcur); ut_ad(!!page_rec_is_comp(rec) == comp); #ifdef UNIV_SEARCH_DEBUG diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index 54172e71a47..c70a477db1d 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -3908,6 +3908,11 @@ wait_table_again: } rec_loop: + if (trx_is_interrupted(trx)) { + err = DB_INTERRUPTED; + goto normal_return; + } + /*-------------------------------------------------------------*/ /* PHASE 4: Look for matching records in a loop */ From ed6732dd16d75fe2d051524ec0d28d87c09df1cd Mon Sep 17 00:00:00 2001 From: "Krunal Bauskar krunal.bauskar@oracle.com" Date: Mon, 15 Oct 2012 09:49:50 +0530 Subject: [PATCH 234/349] bug#14704286 SECONDARY INDEX UPDATES MAKE CONSISTENT READS DO O(N^2) UNDO PAGE LOOKUPS (honoring kill query while accessing sec_index) If secondary index is being used for select query evaluation and this query is operating with consistent read snapshot it might take good time for secondary index to return back control to mysql as MVCC would kick in. If user issues "kill query " while query is actively accessing secondary index it will not be honored as there is no hook to check for this condition. Added hook for this check. ----- Parallely secondary index taking too long to evaluate for consistent read snapshot case is being examined for performance improvement. WL#6540. --- .../suite/innodb/r/innodb_bug14704286.result | 43 +++++++++ .../suite/innodb/t/innodb_bug14704286.test | 89 +++++++++++++++++++ storage/innobase/row/row0sel.c | 5 ++ 3 files changed, 137 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb_bug14704286.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug14704286.test diff --git a/mysql-test/suite/innodb/r/innodb_bug14704286.result b/mysql-test/suite/innodb/r/innodb_bug14704286.result new file mode 100644 index 00000000000..9703955cfa7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug14704286.result @@ -0,0 +1,43 @@ +use test; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (id int primary key, value int, value2 int, +value3 int, index(value,value2)) engine=innodb; +insert into t1 values +(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), +(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), +(20,20,20,20); +use test; +start transaction with consistent snapshot; +use test; +CREATE PROCEDURE update_t1() +BEGIN +DECLARE i INT DEFAULT 1; +while (i <= 5000) DO +update test.t1 set value2=value2+1, value3=value3+1 where id=12; +SET i = i + 1; +END WHILE; +END| +CALL update_t1(); +select * from t1; +id value value2 value3 +10 10 10 10 +11 11 11 11 +12 12 5012 5012 +13 13 13 13 +14 14 14 14 +15 15 15 15 +16 16 16 16 +17 17 17 17 +18 18 18 18 +19 19 19 19 +20 20 20 20 +select * from t1 force index(value) where value=12; +kill query @id; +ERROR 70100: Query execution was interrupted +select * from t1 where value = 12; +id value value2 value3 +12 12 12 12 +drop procedure if exists update_t1; +drop table if exists t1; diff --git a/mysql-test/suite/innodb/t/innodb_bug14704286.test b/mysql-test/suite/innodb/t/innodb_bug14704286.test new file mode 100644 index 00000000000..bdc2ab94b01 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug14704286.test @@ -0,0 +1,89 @@ +--source include/have_innodb.inc + +# +# create test-bed to run test +# +use test; + +drop table if exists t1; +create table t1 (id int primary key, value int, value2 int, +value3 int, index(value,value2)) engine=innodb; + +insert into t1 values +(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), +(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), +(20,20,20,20); +let $ID= `SELECT @id := CONNECTION_ID()`; + +# +# we need multiple connections as we need to keep one connection +# active with trx requesting consistent read. +# +connect (conn1, localhost, root,,); +connect (conn2, localhost, root,,); +connect (conn3, localhost, root,,); + +# +# start trx with consistent read +# +connection conn1; +use test; + +start transaction with consistent snapshot; + +# +# update table such that secondary index is updated. +# +connection conn2; +use test; +delimiter |; +CREATE PROCEDURE update_t1() +BEGIN + DECLARE i INT DEFAULT 1; + while (i <= 5000) DO + update test.t1 set value2=value2+1, value3=value3+1 where id=12; + SET i = i + 1; + END WHILE; +END| + +delimiter ;| + +CALL update_t1(); +select * from t1; + +# +# Now try to fire select query from connection-1 enforcing +# use of secondary index. +# +connection conn1; +let $ID= `SELECT @id := CONNECTION_ID()`; +#--error ER_QUERY_INTERRUPTED +--send +select * from t1 force index(value) where value=12; + +# +# select is going to take good time so let's kill query. +# +connection conn3; +let $ignore= `SELECT @id := $ID`; +kill query @id; + +# +# reap the value of connection-1 +# +connection conn1; +--error ER_QUERY_INTERRUPTED +reap; +select * from t1 where value = 12; + +# +# clean test-bed. +# +connection default; +disconnect conn1; +disconnect conn2; +disconnect conn3; +drop procedure if exists update_t1; +drop table if exists t1; + + diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 1e352d49670..5030c6c9b50 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3918,6 +3918,11 @@ wait_table_again: } rec_loop: + if (trx_is_interrupted(trx)) { + err = DB_INTERRUPTED; + goto normal_return; + } + /*-------------------------------------------------------------*/ /* PHASE 4: Look for matching records in a loop */ From 04c7730006748a32ef3f7069670699452013cf52 Mon Sep 17 00:00:00 2001 From: "Krunal Bauskar krunal.bauskar@oracle.com" Date: Mon, 15 Oct 2012 14:16:46 +0530 Subject: [PATCH 235/349] removed warning message as they have changed in mysql-5.6 and mysql-trunk and this is left over from changes that got up-merged --- mysql-test/suite/innodb/r/innodb_bug14704286.result | 2 -- mysql-test/suite/innodb/t/innodb_bug14704286.test | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug14704286.result b/mysql-test/suite/innodb/r/innodb_bug14704286.result index 9703955cfa7..f1acbb2685e 100644 --- a/mysql-test/suite/innodb/r/innodb_bug14704286.result +++ b/mysql-test/suite/innodb/r/innodb_bug14704286.result @@ -1,7 +1,5 @@ use test; drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' create table t1 (id int primary key, value int, value2 int, value3 int, index(value,value2)) engine=innodb; insert into t1 values diff --git a/mysql-test/suite/innodb/t/innodb_bug14704286.test b/mysql-test/suite/innodb/t/innodb_bug14704286.test index bdc2ab94b01..68a4fb62c5d 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14704286.test +++ b/mysql-test/suite/innodb/t/innodb_bug14704286.test @@ -4,8 +4,9 @@ # create test-bed to run test # use test; - +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int primary key, value int, value2 int, value3 int, index(value,value2)) engine=innodb; From aec624762b0719c43a5149c228f36daa405b82cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 16 Oct 2012 14:24:15 +0300 Subject: [PATCH 236/349] Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF REAL DUPLICATE VALUE FOR PREFIX KEYS innobase_rec_to_mysql(): Invoke dict_index_get_nth_col_or_prefix_pos() instead of dict_index_get_nth_col_pos() to find the column. --- storage/innodb_plugin/ChangeLog | 6 ++++ storage/innodb_plugin/dict/dict0dict.c | 29 +++++++++++++++---- .../innodb_plugin/handler/handler0alter.cc | 2 +- storage/innodb_plugin/include/dict0dict.h | 12 ++++++++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index cc4962bd125..35795e10dd4 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2012-10-16 The InnoDB Team + + * dict/dict0dict.c, handler/handler0alter.cc, include/dict0dict.h: + Fix Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF REAL + DUPLICATE VALUE FOR PREFIX KEYS + 2012-10-09 The InnoDB Team * row/row0mysql.c: diff --git a/storage/innodb_plugin/dict/dict0dict.c b/storage/innodb_plugin/dict/dict0dict.c index fdc93382190..56c71cefa05 100644 --- a/storage/innodb_plugin/dict/dict0dict.c +++ b/storage/innodb_plugin/dict/dict0dict.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -473,10 +473,12 @@ Looks for column n in an index. ULINT_UNDEFINED if not contained */ UNIV_INTERN ulint -dict_index_get_nth_col_pos( -/*=======================*/ - const dict_index_t* index, /*!< in: index */ - ulint n) /*!< in: column number */ +dict_index_get_nth_col_or_prefix_pos( +/*=================================*/ + const dict_index_t* index, /*!< in: index */ + ulint n, /*!< in: column number */ + ibool inc_prefix) /*!< in: TRUE=consider + column prefixes too */ { const dict_field_t* field; const dict_col_t* col; @@ -498,7 +500,8 @@ dict_index_get_nth_col_pos( for (pos = 0; pos < n_fields; pos++) { field = dict_index_get_nth_field(index, pos); - if (col == field->col && field->prefix_len == 0) { + if (col == field->col + && (inc_prefix || field->prefix_len == 0)) { return(pos); } @@ -507,6 +510,20 @@ dict_index_get_nth_col_pos( return(ULINT_UNDEFINED); } +/********************************************************************//** +Looks for column n in an index. +@return position in internal representation of the index; +ULINT_UNDEFINED if not contained */ +UNIV_INTERN +ulint +dict_index_get_nth_col_pos( +/*=======================*/ + const dict_index_t* index, /*!< in: index */ + ulint n) /*!< in: column number */ +{ + return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE)); +} + #ifndef UNIV_HOTBACKUP /********************************************************************//** Returns TRUE if the index contains a column or a prefix of that column. diff --git a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc index 6f02b500d96..7095077b788 100644 --- a/storage/innodb_plugin/handler/handler0alter.cc +++ b/storage/innodb_plugin/handler/handler0alter.cc @@ -147,7 +147,7 @@ innobase_rec_to_mysql( field->reset(); - ipos = dict_index_get_nth_col_pos(index, i); + ipos = dict_index_get_nth_col_or_prefix_pos(index, i, TRUE); if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) { null_field: diff --git a/storage/innodb_plugin/include/dict0dict.h b/storage/innodb_plugin/include/dict0dict.h index e728c78b9c0..7ce968fb45c 100644 --- a/storage/innodb_plugin/include/dict0dict.h +++ b/storage/innodb_plugin/include/dict0dict.h @@ -839,6 +839,18 @@ dict_index_get_nth_col_pos( const dict_index_t* index, /*!< in: index */ ulint n); /*!< in: column number */ /********************************************************************//** +Looks for column n in an index. +@return position in internal representation of the index; +ULINT_UNDEFINED if not contained */ +UNIV_INTERN +ulint +dict_index_get_nth_col_or_prefix_pos( +/*=================================*/ + const dict_index_t* index, /*!< in: index */ + ulint n, /*!< in: column number */ + ibool inc_prefix); /*!< in: TRUE=consider + column prefixes too */ +/********************************************************************//** Returns TRUE if the index contains a column or a prefix of that column. @return TRUE if contains the column or its prefix */ UNIV_INTERN From 5f37d738bed86552ab8e4589a1c4c514e27e67d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Oct 2012 14:27:33 +0200 Subject: [PATCH 237/349] From 93d60018dbe15effc540be37f7e52c8d3926fa1d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Oct 2012 16:02:27 +0200 Subject: [PATCH 238/349] From bdb4104cf6b658b0b614f2b5b3c690535fde3726 Mon Sep 17 00:00:00 2001 From: Neeraj Bisht Date: Tue, 16 Oct 2012 23:18:48 +0530 Subject: [PATCH 239/349] Bug#11745891 - LAST_INSERT(ID) DOES NOT SUPPORT BIGINT UNSIGNED Problem:- using last_insert_id() on an auto_incremented bigint unsigned does not work for values which are greater than max-bigint-signed. Analysis:- last_insert_id() returns the first auto_incremented value for a column and an auto_incremented value can have only positive values. In our code, when we are initializing a last_insert_id object, we are taking it as a signed BIGINT, So when the auto_incremented value reaches greater than max signed bigint, last_insert_id gives negative result. Solution: When we are fetching the value from last_insert_id, We are setting the unsigned_flag, so that it take only unsigned BIGINT value. sql/item_func.cc: here unsigned value is converted to signed value. sql/item_func.h: last_insert_id() gives an auto_incremented value which can be positive only,so defined it as a unsigned longlong sets the unsigned_flag to 1. --- sql/item_func.cc | 3 ++- sql/item_func.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index feb87fe5fd7..21efaf83aa8 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3596,7 +3596,8 @@ longlong Item_func_last_insert_id::val_int() thd->first_successful_insert_id_in_prev_stmt= value; return value; } - return thd->read_first_successful_insert_id_in_prev_stmt(); + return + static_cast(thd->read_first_successful_insert_id_in_prev_stmt()); } diff --git a/sql/item_func.h b/sql/item_func.h index de1338b4081..ec410ed3d3d 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1043,6 +1043,7 @@ public: const char *func_name() const { return "last_insert_id"; } void fix_length_and_dec() { + unsigned_flag= TRUE; if (arg_count) max_length= args[0]->max_length; } From b86aea6ce51422af6987c30a8c03f748f5898a5c Mon Sep 17 00:00:00 2001 From: Tatjana Azundris Nuernberg Date: Wed, 17 Oct 2012 07:22:06 +0100 Subject: [PATCH 240/349] Bug#11764559: UMASK IS IGNORED BY ERROR LOG mysqld_safe script did not heed MySQL specific environment variable $UMASK, leading to divergent behavior between mysqld and mysqld_safe. Patch adds an approximation of mysqld's behavior to mysqld_safe, within the bounds dictated by attempt to have mysqld_safe run on even the most basic of shells (proper '70s sh, not just bash with a fancy symlink). Patch also adds approximation of said behavior to mysqld_multi (in perl). --- scripts/mysqld_multi.sh | 22 ++++++++++++++++++++++ scripts/mysqld_safe.sh | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 8a4d0d44203..5bf59ae27be 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -47,6 +47,28 @@ $homedir = $ENV{HOME}; $my_progname = $0; $my_progname =~ s/.*[\/]//; + +if (defined($ENV{UMASK})) { + my $UMASK = $ENV{UMASK}; + my $m; + my $fmode = "0640"; + + if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) { + printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n"); + printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); } + else { + $fmode= substr $UMASK, 2, 2; + $fmode= "06${fmode}"; } + + if($fmode != $UMASK) { + printf("UMASK corrected from $UMASK to $fmode ...\n"); } + + $fmode= oct($fmode); + + umask($fmode); +} + + main(); #### diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index e4e5f1a1510..75589a2d004 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -27,7 +27,28 @@ syslog_tag_mysqld_safe=mysqld_safe trap '' 1 2 3 15 # we shouldn't let anyone kill us -umask 007 +# MySQL-specific environment variable. First off, it's not really a umask, +# it's the desired mode. Second, it follows umask(2), not umask(3) in that +# octal needs to be explicit. Our shell might be a proper sh without printf, +# multiple-base arithmetic, and binary arithmetic, so this will get ugly. +# We reject decimal values to keep things at least half-sane. +umask 007 # fallback +UMASK="${UMASK-0640}" +fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'` +octalp=`echo "$fmode"|cut -c1` +fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'` +if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ] +then + fmode=0640 + echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2 + echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2 +fi +fmode=`echo "$fmode"|cut -c3-4` +fmode="6$fmode" +if [ "x$UMASK" != "x0$fmode" ] +then + echo "UMASK corrected from $UMASK to 0$fmode ..." +fi defaults= case "$1" in @@ -371,6 +392,12 @@ then # Log to err_log file log_notice "Logging to '$err_log'." logging=file + + if [ ! -e "$err_log" ]; then # if error log already exists, + touch "$err_log" # we just append. otherwise, + chmod "$fmode" "$err_log" # fix the permissions here! + fi + else if [ -n "$syslog_tag" ] then @@ -572,6 +599,12 @@ do eval_log_error "$cmd" + if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then + touch "$err_log" # hypothetical: log was renamed but not + chown $user "$err_log" # flushed yet. we'd recreate it with + chmod "$fmode" "$err_log" # wrong owner next time we log, so set + fi # it up correctly while we can! + if test ! -f "$pid_file" # This is removed if normal shutdown then break From 39e6eafc208476b15e134aa3c31dd11af512a146 Mon Sep 17 00:00:00 2001 From: Yasufumi Kinoshita Date: Wed, 17 Oct 2012 15:28:31 +0900 Subject: [PATCH 241/349] Bug #13702112 : WAIT_FOR_READ IS STUCK IN THE 90S rb://1334 approved by: Inaam Rana --- storage/innodb_plugin/buf/buf0buf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c index 3ec9ba246d2..b49f5288681 100644 --- a/storage/innodb_plugin/buf/buf0buf.c +++ b/storage/innodb_plugin/buf/buf0buf.c @@ -241,7 +241,7 @@ the read requests for the whole area. #ifndef UNIV_HOTBACKUP /** Value in microseconds */ -static const int WAIT_FOR_READ = 5000; +static const int WAIT_FOR_READ = 100; /** Number of attemtps made to read in a page in the buffer pool */ static const ulint BUF_PAGE_READ_MAX_RETRIES = 100; @@ -1897,8 +1897,9 @@ wait_until_unfixed: mutex_exit(&block->mutex); if (io_fix == BUF_IO_READ) { - - os_thread_sleep(WAIT_FOR_READ); + /* wait by temporaly s-latch */ + rw_lock_s_lock(&(block->lock)); + rw_lock_s_unlock(&(block->lock)); } else { break; } From 6883c08faad2fc4203a3a689c1ad5b6d1927e235 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Oct 2012 08:57:21 +0200 Subject: [PATCH 242/349] From 779960205f85a88b11126e6aedd750440fb486c3 Mon Sep 17 00:00:00 2001 From: "Krunal Bauskar krunal.bauskar@oracle.com" Date: Wed, 17 Oct 2012 14:30:32 +0530 Subject: [PATCH 243/349] bug#14765606: ensure select is active before killing it else kill signal is ignored --- .../suite/innodb/r/innodb_bug14704286.result | 20 ++++++++++++++----- .../suite/innodb/t/innodb_bug14704286.test | 12 ++++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug14704286.result b/mysql-test/suite/innodb/r/innodb_bug14704286.result index 9703955cfa7..9de42cb01c8 100644 --- a/mysql-test/suite/innodb/r/innodb_bug14704286.result +++ b/mysql-test/suite/innodb/r/innodb_bug14704286.result @@ -1,7 +1,5 @@ use test; drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' create table t1 (id int primary key, value int, value2 int, value3 int, index(value,value2)) engine=innodb; insert into t1 values @@ -19,6 +17,7 @@ update test.t1 set value2=value2+1, value3=value3+1 where id=12; SET i = i + 1; END WHILE; END| +set autocommit=0; CALL update_t1(); select * from t1; id value value2 value3 @@ -33,11 +32,22 @@ id value value2 value3 18 18 18 18 19 19 19 19 20 20 20 20 +set autocommit=1; +select * from t1; +id value value2 value3 +10 10 10 10 +11 11 11 11 +12 12 5012 5012 +13 13 13 13 +14 14 14 14 +15 15 15 15 +16 16 16 16 +17 17 17 17 +18 18 18 18 +19 19 19 19 +20 20 20 20 select * from t1 force index(value) where value=12; kill query @id; ERROR 70100: Query execution was interrupted -select * from t1 where value = 12; -id value value2 value3 -12 12 12 12 drop procedure if exists update_t1; drop table if exists t1; diff --git a/mysql-test/suite/innodb/t/innodb_bug14704286.test b/mysql-test/suite/innodb/t/innodb_bug14704286.test index bdc2ab94b01..fb5e6b829a1 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14704286.test +++ b/mysql-test/suite/innodb/t/innodb_bug14704286.test @@ -4,8 +4,9 @@ # create test-bed to run test # use test; - +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int primary key, value int, value2 int, value3 int, index(value,value2)) engine=innodb; @@ -47,9 +48,11 @@ BEGIN END| delimiter ;| - +set autocommit=0; CALL update_t1(); select * from t1; +set autocommit=1; +select * from t1; # # Now try to fire select query from connection-1 enforcing @@ -65,6 +68,10 @@ select * from t1 force index(value) where value=12; # select is going to take good time so let's kill query. # connection conn3; +let $wait_condition= + select * from information_schema.processlist where state = 'Sending data' and + info = 'select * from t1 force index(value) where value=12'; +--source include/wait_condition.inc let $ignore= `SELECT @id := $ID`; kill query @id; @@ -74,7 +81,6 @@ kill query @id; connection conn1; --error ER_QUERY_INTERRUPTED reap; -select * from t1 where value = 12; # # clean test-bed. From 500d2ebe6f3aa74daefa3dbc9d84b0cba44a620f Mon Sep 17 00:00:00 2001 From: "Krunal Bauskar krunal.bauskar@oracle.com" Date: Wed, 17 Oct 2012 14:48:19 +0530 Subject: [PATCH 244/349] removing .... will re-add using merge. for some reason initial mysql-5.1 version is not connected to mysql-5.5 --- .../suite/innodb/r/innodb_bug14704286.result | 41 --------- .../suite/innodb/t/innodb_bug14704286.test | 90 ------------------- 2 files changed, 131 deletions(-) delete mode 100644 mysql-test/suite/innodb/r/innodb_bug14704286.result delete mode 100644 mysql-test/suite/innodb/t/innodb_bug14704286.test diff --git a/mysql-test/suite/innodb/r/innodb_bug14704286.result b/mysql-test/suite/innodb/r/innodb_bug14704286.result deleted file mode 100644 index f1acbb2685e..00000000000 --- a/mysql-test/suite/innodb/r/innodb_bug14704286.result +++ /dev/null @@ -1,41 +0,0 @@ -use test; -drop table if exists t1; -create table t1 (id int primary key, value int, value2 int, -value3 int, index(value,value2)) engine=innodb; -insert into t1 values -(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), -(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), -(20,20,20,20); -use test; -start transaction with consistent snapshot; -use test; -CREATE PROCEDURE update_t1() -BEGIN -DECLARE i INT DEFAULT 1; -while (i <= 5000) DO -update test.t1 set value2=value2+1, value3=value3+1 where id=12; -SET i = i + 1; -END WHILE; -END| -CALL update_t1(); -select * from t1; -id value value2 value3 -10 10 10 10 -11 11 11 11 -12 12 5012 5012 -13 13 13 13 -14 14 14 14 -15 15 15 15 -16 16 16 16 -17 17 17 17 -18 18 18 18 -19 19 19 19 -20 20 20 20 -select * from t1 force index(value) where value=12; -kill query @id; -ERROR 70100: Query execution was interrupted -select * from t1 where value = 12; -id value value2 value3 -12 12 12 12 -drop procedure if exists update_t1; -drop table if exists t1; diff --git a/mysql-test/suite/innodb/t/innodb_bug14704286.test b/mysql-test/suite/innodb/t/innodb_bug14704286.test deleted file mode 100644 index 68a4fb62c5d..00000000000 --- a/mysql-test/suite/innodb/t/innodb_bug14704286.test +++ /dev/null @@ -1,90 +0,0 @@ ---source include/have_innodb.inc - -# -# create test-bed to run test -# -use test; ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (id int primary key, value int, value2 int, -value3 int, index(value,value2)) engine=innodb; - -insert into t1 values -(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), -(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), -(20,20,20,20); -let $ID= `SELECT @id := CONNECTION_ID()`; - -# -# we need multiple connections as we need to keep one connection -# active with trx requesting consistent read. -# -connect (conn1, localhost, root,,); -connect (conn2, localhost, root,,); -connect (conn3, localhost, root,,); - -# -# start trx with consistent read -# -connection conn1; -use test; - -start transaction with consistent snapshot; - -# -# update table such that secondary index is updated. -# -connection conn2; -use test; -delimiter |; -CREATE PROCEDURE update_t1() -BEGIN - DECLARE i INT DEFAULT 1; - while (i <= 5000) DO - update test.t1 set value2=value2+1, value3=value3+1 where id=12; - SET i = i + 1; - END WHILE; -END| - -delimiter ;| - -CALL update_t1(); -select * from t1; - -# -# Now try to fire select query from connection-1 enforcing -# use of secondary index. -# -connection conn1; -let $ID= `SELECT @id := CONNECTION_ID()`; -#--error ER_QUERY_INTERRUPTED ---send -select * from t1 force index(value) where value=12; - -# -# select is going to take good time so let's kill query. -# -connection conn3; -let $ignore= `SELECT @id := $ID`; -kill query @id; - -# -# reap the value of connection-1 -# -connection conn1; ---error ER_QUERY_INTERRUPTED -reap; -select * from t1 where value = 12; - -# -# clean test-bed. -# -connection default; -disconnect conn1; -disconnect conn2; -disconnect conn3; -drop procedure if exists update_t1; -drop table if exists t1; - - From 52ea152294494a387a27350887aff2d11099544e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 18 Oct 2012 17:03:06 +0300 Subject: [PATCH 245/349] Bug#14758405: ALTER TABLE: ADDING SERIAL NULL DATATYPE: ASSERTION: LEN <= SIZEOF(ULONGLONG) This bug was caught in the WL#6255 ALTER TABLE...ADD COLUMN in MySQL 5.6, but there is a bug in all InnoDB versions that support auto-increment columns. row_search_autoinc_read_column(): When reading the maximum value of the auto-increment column, and the column only contains NULL values, return 0. This corresponds to the case when the table is empty in row_search_max_autoinc(). rb:1415 approved by Sunny Bains --- storage/innobase/row/row0sel.c | 19 ++++++++++++------- storage/innodb_plugin/ChangeLog | 6 ++++++ storage/innodb_plugin/row/row0sel.c | 19 ++++++++++++------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index c600fa62151..cf3b36fbac2 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -4660,14 +4660,18 @@ row_search_autoinc_read_column( /* TODO: We have to cast away the const of rec for now. This needs to be fixed later.*/ offsets = rec_get_offsets( - (rec_t*) rec, index, offsets, ULINT_UNDEFINED, &heap); + (rec_t*) rec, index, offsets, col_no + 1, &heap); + + if (rec_offs_nth_sql_null(offsets, col_no)) { + /* There is no non-NULL value in the auto-increment column. */ + value = 0; + goto func_exit; + } /* TODO: We have to cast away the const of rec for now. This needs to be fixed later.*/ data = rec_get_nth_field((rec_t*)rec, offsets, col_no, &len); - ut_a(len != UNIV_SQL_NULL); - switch (mtype) { case DATA_INT: ut_a(len <= sizeof value); @@ -4688,15 +4692,16 @@ row_search_autoinc_read_column( ut_error; } - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - /* We assume that the autoinc counter can't be negative. */ if (!unsigned_type && (ib_longlong) value < 0) { value = 0; } +func_exit: + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + return(value); } diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 35795e10dd4..f69f9e16904 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2012-10-18 The InnoDB Team + + * row/row0sel.c: + Fix Bug#14758405: ALTER TABLE: ADDING SERIAL NULL DATATYPE: ASSERTION: + LEN <= SIZEOF(ULONGLONG) + 2012-10-16 The InnoDB Team * dict/dict0dict.c, handler/handler0alter.cc, include/dict0dict.h: diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index c70a477db1d..d825d799a3c 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -4833,12 +4833,16 @@ row_search_autoinc_read_column( rec_offs_init(offsets_); - offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); + offsets = rec_get_offsets(rec, index, offsets, col_no + 1, &heap); + + if (rec_offs_nth_sql_null(offsets, col_no)) { + /* There is no non-NULL value in the auto-increment column. */ + value = 0; + goto func_exit; + } data = rec_get_nth_field(rec, offsets, col_no, &len); - ut_a(len != UNIV_SQL_NULL); - switch (mtype) { case DATA_INT: ut_a(len <= sizeof value); @@ -4859,14 +4863,15 @@ row_search_autoinc_read_column( ut_error; } - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - if (!unsigned_type && (ib_int64_t) value < 0) { value = 0; } +func_exit: + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + return(value); } From eef1a1957e75a4153e44be26e0e32dee5f6069ad Mon Sep 17 00:00:00 2001 From: Neeraj Bisht Date: Thu, 18 Oct 2012 23:45:15 +0530 Subject: [PATCH 246/349] Bug#13726751 - 8 BYTE MEMORY LEAK IN DO_SAVE_BLOB Problem:- When we execute a query which has subquery with GROUP BY, ORDER BY and have a BLOB column,results a memory leak. Analysis:- In case of subquery, which have GROUP BY on BLOB and a ORDER BY on other field and BLOB is not a key. We allocate a tmp buffer to copy_field to take care of BLOB value.This copy_field value can have copies of its in two join(objects), so while freeing this copy_field we have to take care that it is not deleted twice. The double deletion of tmp_table_param.copy_field is handled by two patches. One by Kostja : revid:sp1r-konstantin@mysql.com-20050627101056-55153 Fix the broken test suite in -debug build. and other by Oleksandr revid:sp1r-bell@sanja.is.com.ua-20060118114857-19905 Excluded posibility of tmp_table_param.copy_field double deletion (BUG#14851). both of this patches are commited in different branch and while merging they both get placed,but there is no need for Kostja patch as Oleksandr patch handle this. sql/sql_select.cc: Bug13726751, tmp_join clean up is not necessary as later in the code we are taking care of cleaning up of tmp_join copy_field. --- sql/sql_select.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bcf601e5142..de9f0ead7a3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7084,15 +7084,8 @@ void JOIN::cleanup(bool full) } } } - /* - We are not using tables anymore - Unlock all tables. We may be in an INSERT .... SELECT statement. - */ if (full) { - if (tmp_join) - tmp_table_param.copy_field= 0; - /* Ensure that the following delete_elements() would not be called twice for the same list. From 6ff71d0dd38e39e67580f598b400fa3fb8888da3 Mon Sep 17 00:00:00 2001 From: Annamalai Gurusami Date: Fri, 19 Oct 2012 16:43:48 +0530 Subject: [PATCH 247/349] Bug #14226171 EXCESSIVE ROW LOCKING WITH UPDATE IN 5.5.25 When a DML statement is issued, and if the index merge access method is chosen, then many rows from the storage engine will be locked because of the way the algorithm works. Many rows will be locked, but they will not be part of the final result set. To reduce the excessive locking, the locks of unmatched rows are released by this patch. This patch will affect only transactions with isolation level equal to or less stricter than READ COMMITTED. This is because of the behaviour of ha_innobase::unlock_row(). rb://1296 approved by jorgen and olav. --- sql/opt_range.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ffd66253eaa..ce87bdd5381 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8412,6 +8412,13 @@ int QUICK_INDEX_MERGE_SELECT::get_next() If a Clustered PK scan is present, it is used only to check if row satisfies its condition (and never used for row retrieval). + Locking: to ensure that exclusive locks are only set on records that + are included in the final result we must release the lock + on all rows we read but do not include in the final result. This + must be done on each index that reads the record and the lock + must be released using the same handler (the same quick object) as + used when reading the record. + RETURN 0 - Ok other - Error code if any error occurred. @@ -8421,6 +8428,12 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() { List_iterator_fast quick_it(quick_selects); QUICK_RANGE_SELECT* quick; + + /* quick that reads the given rowid first. This is needed in order + to be able to unlock the row using the same handler object that locked + it */ + QUICK_RANGE_SELECT* quick_with_last_rowid; + int error, cmp; uint last_rowid_count=0; DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::get_next"); @@ -8433,7 +8446,10 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() if (cpk_quick) { while (!error && !cpk_quick->row_in_ranges()) + { + quick->file->unlock_row(); /* row not in range; unlock */ error= quick->get_next(); + } } if (error) DBUG_RETURN(error); @@ -8441,6 +8457,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() quick->file->position(quick->record); memcpy(last_rowid, quick->file->ref, head->file->ref_length); last_rowid_count= 1; + quick_with_last_rowid= quick; while (last_rowid_count < quick_selects.elements) { @@ -8453,9 +8470,17 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() do { if ((error= quick->get_next())) + { + quick_with_last_rowid->file->unlock_row(); DBUG_RETURN(error); + } quick->file->position(quick->record); cmp= head->file->cmp_ref(quick->file->ref, last_rowid); + if (cmp < 0) + { + /* This row is being skipped. Release lock on it. */ + quick->file->unlock_row(); + } } while (cmp < 0); /* Ok, current select 'caught up' and returned ref >= cur_ref */ @@ -8466,13 +8491,19 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() { while (!cpk_quick->row_in_ranges()) { + quick->file->unlock_row(); /* row not in range; unlock */ if ((error= quick->get_next())) + { + quick_with_last_rowid->file->unlock_row(); DBUG_RETURN(error); + } } quick->file->position(quick->record); } memcpy(last_rowid, quick->file->ref, head->file->ref_length); + quick_with_last_rowid->file->unlock_row(); last_rowid_count= 1; + quick_with_last_rowid= quick; } else { From 4828c75af1878cc6a970bbdb29fe9da600ee8bc3 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Fri, 19 Oct 2012 20:31:22 +0200 Subject: [PATCH 248/349] Fix formatting in 'INFO_BIN' on Windows - backport. --- cmake/info_macros.cmake.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/info_macros.cmake.in b/cmake/info_macros.cmake.in index 9e08cffb2bf..9f40a419c61 100644 --- a/cmake/info_macros.cmake.in +++ b/cmake/info_macros.cmake.in @@ -1,4 +1,4 @@ -# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -82,9 +82,11 @@ MACRO(CREATE_INFO_BIN) FILE(WRITE ${INFO_BIN} "===== Information about the build process: =====\n") IF (WIN32) - EXECUTE_PROCESS(COMMAND cmd /c date /T OUTPUT_VARIABLE TMP_DATE) + EXECUTE_PROCESS(COMMAND cmd /c date /T + OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) ELSEIF(UNIX) - EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S" + OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) ELSE() SET(TMP_DATE "(no date command known for this platform)") ENDIF() From 62503f9cf5af989107e887925816add9b4aec950 Mon Sep 17 00:00:00 2001 From: Nuno Carvalho Date: Sun, 21 Oct 2012 20:28:19 +0100 Subject: [PATCH 249/349] BUG#14629727: USER_VAR_EVENT IS MISSING RANGE CHECKS Moved explicit instantiation of available_buffer and valid_buffer_range template functions to sql/log_event.cc. --- sql/log_event.cc | 16 ++++++++++++++++ sql/mysql_priv.h | 9 --------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 0ad258f7073..58de0d310d7 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -54,6 +54,22 @@ */ #define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1) +/* + Explicit instantiation to unsigned int of template available_buffer + function. +*/ +template unsigned int available_buffer(const char*, + const char*, + unsigned int); + +/* + Explicit instantiation to unsigned int of template valid_buffer_range + function. +*/ +template bool valid_buffer_range(unsigned int, + const char*, + const char*, + unsigned int); #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 05a37228e17..4741562cab3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -516,10 +516,6 @@ template T available_buffer(const char* buf_start, { return buf_len - (buf_current - buf_start); } -/* Explicit instantion to unsigned int. */ -template unsigned int available_buffer(const char*, - const char*, - unsigned int); /* Check if jump value is within buffer limits. @@ -539,11 +535,6 @@ template bool valid_buffer_range(T jump, { return (jump <= available_buffer(buf_start, buf_current, buf_len)); } -/* Explicit instantion to unsigned int. */ -template bool valid_buffer_range(unsigned int, - const char*, - const char*, - unsigned int); /* The rest of the file is included in the server only */ #ifndef MYSQL_CLIENT From d13554b1f90f7bef1d31ef66dc90eb6738a9f90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 22 Oct 2012 22:10:33 +0300 Subject: [PATCH 250/349] Backport from 5.6: Bug#14769820 ASSERT FLEN == LEN IN ALTER TABLE ... ADD UNIQUE KEY A bogus debug assertion failure occurred when reporting a duplicate key on a column prefix of a CHAR column. This is a regression from Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF REAL DUPLICATE VALUE FOR PREFIX KEYS. The assertion is only present when UNIV_DEBUG is defined (which it is in debug builds starting from MySQL 5.5). It is a case of overasserting. Fix approved by Inaam Rana on IM. --- storage/innodb_plugin/handler/handler0alter.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc index 7095077b788..0422abb0021 100644 --- a/storage/innodb_plugin/handler/handler0alter.cc +++ b/storage/innodb_plugin/handler/handler0alter.cc @@ -108,13 +108,17 @@ innobase_col_to_mysql( /* These column types should never be shipped to MySQL. */ ut_ad(0); - case DATA_CHAR: case DATA_FIXBINARY: case DATA_FLOAT: case DATA_DOUBLE: case DATA_DECIMAL: /* Above are the valid column types for MySQL data. */ ut_ad(flen == len); + /* fall through */ + case DATA_CHAR: + /* We may have flen > len when there is a shorter + prefix on a CHAR column. */ + ut_ad(flen >= len); #else /* UNIV_DEBUG */ default: #endif /* UNIV_DEBUG */ From 7873a6e4d71a5fe7b8dcfb850d65c81ee7a282c5 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 23 Oct 2012 13:41:34 +0200 Subject: [PATCH 251/349] Use MESSAGE(STATUS ...) as we don't want any popup from the build system. --- cmake/mysql_version.cmake | 2 +- cmake/package_name.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 59ee318f47b..566d5ce416d 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -54,7 +54,7 @@ MACRO(GET_MYSQL_VERSION) ENDIF() SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}") - MESSAGE("-- MySQL ${VERSION}") + MESSAGE(STATUS "MySQL ${VERSION}") SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") # Use NDBVERSION irregardless of whether this is Cluster or not, if not diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake index d9e0902c921..43ad794e77b 100644 --- a/cmake/package_name.cmake +++ b/cmake/package_name.cmake @@ -123,7 +123,7 @@ IF(NOT VERSION) SET(package_name "mysql${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") ENDIF() - MESSAGE("-- Packaging as: ${package_name}") + MESSAGE(STATUS "Packaging as: ${package_name}") # Sometimes package suffix is added (something like "-icc-glibc23") IF(PACKAGE_SUFFIX) From 4baab59e93c7d02f33a711e1ee54ea324f6bd988 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 24 Oct 2012 17:06:43 +0200 Subject: [PATCH 252/349] Bug#14737559 BZR JOIN PLUGIN TREES INTO INTERNAL/PLUGIN Part three: Fix some search paths. --- cmake/install_layout.cmake | 5 ++++- cmake/plugin.cmake | 1 + mysql-test/lib/mtr_cases.pm | 1 + mysql-test/mysql-test-run.pl | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 036164d868b..18c7afd8037 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -104,7 +104,10 @@ ENDIF() # just use if(INSTALL_PLUGINTESTDIR). # The plugin must set its own install path for tests # -FILE(GLOB plugin_tests ${CMAKE_SOURCE_DIR}/plugin/*/tests) +FILE(GLOB plugin_tests + ${CMAKE_SOURCE_DIR}/plugin/*/tests + ${CMAKE_SOURCE_DIR}/internal/plugin/*/tests +) # # STANDALONE layout diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index e3e3c584d47..9736887bb7e 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -39,6 +39,7 @@ MACRO(PLUGIN_APPEND_COLLECTIONS plugin) GET_FILENAME_COMPONENT(fname ${cfile} NAME) FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}") FILE(APPEND ${fcopied} "${fname}\n") + MESSAGE(STATUS "Appended ${cfile}") ENDFOREACH() ENDIF() ENDMACRO() diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 2f68b70e3e2..af059af7121 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -295,6 +295,7 @@ sub collect_one_suite($) "storage/*/mtr", # Look in plugin specific suite dir "plugin/$suite/tests", + "internal/plugin/$suite/tests", ], [$suite, "mtr"], ($suite =~ /^i_/)); return unless $suitedir; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 927a2ebfa91..a9add9be394 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -459,6 +459,7 @@ sub main { # Also read from any plugin local or suite specific plugin.defs for (glob "$basedir/plugin/*/tests/mtr/plugin.defs". + " $basedir/internal/plugin/*/tests/mtr/plugin.defs". " suite/*/plugin.defs") { read_plugin_defs($_); } From 6b7419d3d089694b6cfe47e7e7f23e9bc436c696 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 29 Oct 2012 12:47:01 +0400 Subject: [PATCH 253/349] Fix sp_notembedded.test. --- mysql-test/r/sp_notembedded.result | 2 +- mysql-test/t/sp_notembedded.test | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index 0e74677db02..7d350cbe06c 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -248,7 +248,6 @@ CREATE PROCEDURE p1(i INT) BEGIN END; DROP PROCEDURE p1; DELETE FROM mysql.user WHERE User='mysqltest_1'; FLUSH PRIVILEGES; -set @@global.concurrent_insert= @old_concurrent_insert; # # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. # @@ -302,3 +301,4 @@ DROP EVENT teste_bug11763507; # ------------------------------------------------------------------ # -- End of 5.1 tests # ------------------------------------------------------------------ +set @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index 396c9791c34..9d59eab70eb 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -371,16 +371,6 @@ DELETE FROM mysql.user WHERE User='mysqltest_1'; FLUSH PRIVILEGES; -# -# Restore global concurrent_insert value. Keep in the end of the test file. -# - -set @@global.concurrent_insert= @old_concurrent_insert; - -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc - - --echo # --echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. --echo # @@ -476,3 +466,13 @@ DROP EVENT teste_bug11763507; --echo # ------------------------------------------------------------------ --echo # -- End of 5.1 tests --echo # ------------------------------------------------------------------ + + +# +# Restore global concurrent_insert value. Keep in the end of the test file. +# + +set @@global.concurrent_insert= @old_concurrent_insert; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc From 4f4632341f3479c0e7f4750c76aa09e5bf5b28c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Oct 2012 15:50:04 +0530 Subject: [PATCH 254/349] From 7de6a91bfa3a040137ba5f5e54e232ed8b58558b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Oct 2012 14:52:17 +0100 Subject: [PATCH 255/349] From b5ee1cf5498eda48f8b3d3c2b9f51abd741be8ae Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Oct 2012 16:20:57 +0100 Subject: [PATCH 256/349] From 7c7de142a3816c787d82aa0be42a410c18880466 Mon Sep 17 00:00:00 2001 From: Shivji Kumar Jha Date: Tue, 30 Oct 2012 10:40:07 +0530 Subject: [PATCH 257/349] BUG#14659685 - main.mysqlbinlog_row_myisam and main.mysqlbinlog_row_innodb are skipped by mtr === Problem === The following tests are wrongly placed in main suite and as a result these are not run with proper binlog format combinations. Some are always skipped by mtr. 1) mysqlbinlog_row_myisam 2) mysqlbinlog_row_innodb 3) mysqlbinlog_row.test 4) mysqlbinlog_row_trans.test 5) mysqlbinlog-cp932 6) mysqlbinlog2 7) mysqlbinlog_base64 === Background === mtr runs the tests placed in main suite with binlog format=stmt. Those that need to be tested against binlog format=row or mixed or more than one binlog format and require only one mysql server are placed in binlog suite. mtr runs tests in binlog suite with all three binlog formats(stmt,row and mixed). === Fix === 1) Moved the test listed in problem section above to binlog suite. 2) Added prefix "binlog_" to the name of each test case moved. Renamed the coresponding result files and option files accordingly. mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc: include file for mysqlbinlog_row_myisam.test and mysqlbinlog_row_myisam.test which are being moved to binlog suite. mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result: result file for mysqlbinlog-cp932.test which is being moved to binlog suite. mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result: result file for mysqlbinlog2.test which is being moved to binlog suite. mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result: result file for mysqlbinlog_base64.test which is being moved to binlog suite. mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result: result file for mysqlbinlog_row.test which is being moved to binlog suite. mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result: result file for mysqlbinlog_row_innodb.test which is being moved to binlog suite. mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result: result file for mysqlbinlog_row_myisam.test which is being moved to binlog suite. mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result: result file for mysqlbinlog_row_trans.test which is being moved to binlog suite. mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt: option file for mysqlbinlog-cp932.test which is being moved to binlog suite. mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test: the test requires binlog format=stmt or mixed. Since, it was placed in main suite earlier, it was only run with binlog format=stmt, and hence this test was never run with binlog format=mixed. mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test: the test requires binlog format=stmt or mixed. Since, it was placed in main suite earlier, it was only run with binlog format=stmt, and hence this test was never run with binlog format=mixed. mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test: the test requires binlog format=row. Since, it was placed in main suite earlier, it was only run with binlog format=stmt, and hence this test was always skipped by mtr. mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test: the test requires binlog format=row. Since, it was placed in main suite earlier, it was only run with binlog format=stmt, and hence this test was always skipped by mtr. mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test: the test requires binlog format=row. Since, it was placed in main suite earlier, it was only run with binlog format=stmt, and hence this test was always skipped by mtr. mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test: the test requires binlog format=row. Since, it was placed in main suite earlier, it was only run with binlog format=stmt, and hence this test was always skipped by mtr. mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test: the test requires binlog format=row. Since, it was placed in main suite earlier, it was only run with binlog format=stmt, and hence this test was always skipped by mtr. --- .../{include => extra/binlog_tests}/mysqlbinlog_row_engine.inc | 0 .../binlog/r/binlog_mysqlbinlog-cp932.result} | 0 .../binlog/r/binlog_mysqlbinlog2.result} | 0 .../binlog/r/binlog_mysqlbinlog_base64.result} | 0 .../binlog/r/binlog_mysqlbinlog_row.result} | 0 .../binlog/r/binlog_mysqlbinlog_row_innodb.result} | 0 .../binlog/r/binlog_mysqlbinlog_row_myisam.result} | 0 .../binlog/r/binlog_mysqlbinlog_row_trans.result} | 0 .../binlog/t/binlog_mysqlbinlog-cp932-master.opt} | 0 .../binlog/t/binlog_mysqlbinlog-cp932.test} | 0 .../binlog/t/binlog_mysqlbinlog2.test} | 0 .../binlog/t/binlog_mysqlbinlog_base64.test} | 0 .../binlog/t/binlog_mysqlbinlog_row.test} | 0 .../binlog/t/binlog_mysqlbinlog_row_innodb.test} | 2 +- .../binlog/t/binlog_mysqlbinlog_row_myisam.test} | 2 +- .../binlog/t/binlog_mysqlbinlog_row_trans.test} | 0 16 files changed, 2 insertions(+), 2 deletions(-) rename mysql-test/{include => extra/binlog_tests}/mysqlbinlog_row_engine.inc (100%) rename mysql-test/{r/mysqlbinlog-cp932.result => suite/binlog/r/binlog_mysqlbinlog-cp932.result} (100%) rename mysql-test/{r/mysqlbinlog2.result => suite/binlog/r/binlog_mysqlbinlog2.result} (100%) rename mysql-test/{r/mysqlbinlog_base64.result => suite/binlog/r/binlog_mysqlbinlog_base64.result} (100%) rename mysql-test/{r/mysqlbinlog_row.result => suite/binlog/r/binlog_mysqlbinlog_row.result} (100%) rename mysql-test/{r/mysqlbinlog_row_innodb.result => suite/binlog/r/binlog_mysqlbinlog_row_innodb.result} (100%) rename mysql-test/{r/mysqlbinlog_row_myisam.result => suite/binlog/r/binlog_mysqlbinlog_row_myisam.result} (100%) rename mysql-test/{r/mysqlbinlog_row_trans.result => suite/binlog/r/binlog_mysqlbinlog_row_trans.result} (100%) rename mysql-test/{t/mysqlbinlog-cp932-master.opt => suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt} (100%) rename mysql-test/{t/mysqlbinlog-cp932.test => suite/binlog/t/binlog_mysqlbinlog-cp932.test} (100%) rename mysql-test/{t/mysqlbinlog2.test => suite/binlog/t/binlog_mysqlbinlog2.test} (100%) rename mysql-test/{t/mysqlbinlog_base64.test => suite/binlog/t/binlog_mysqlbinlog_base64.test} (100%) rename mysql-test/{t/mysqlbinlog_row.test => suite/binlog/t/binlog_mysqlbinlog_row.test} (100%) rename mysql-test/{t/mysqlbinlog_row_innodb.test => suite/binlog/t/binlog_mysqlbinlog_row_innodb.test} (91%) rename mysql-test/{t/mysqlbinlog_row_myisam.test => suite/binlog/t/binlog_mysqlbinlog_row_myisam.test} (91%) rename mysql-test/{t/mysqlbinlog_row_trans.test => suite/binlog/t/binlog_mysqlbinlog_row_trans.test} (100%) diff --git a/mysql-test/include/mysqlbinlog_row_engine.inc b/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc similarity index 100% rename from mysql-test/include/mysqlbinlog_row_engine.inc rename to mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc diff --git a/mysql-test/r/mysqlbinlog-cp932.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result similarity index 100% rename from mysql-test/r/mysqlbinlog-cp932.result rename to mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result similarity index 100% rename from mysql-test/r/mysqlbinlog2.result rename to mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result similarity index 100% rename from mysql-test/r/mysqlbinlog_base64.result rename to mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result similarity index 100% rename from mysql-test/r/mysqlbinlog_row.result rename to mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result diff --git a/mysql-test/r/mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result similarity index 100% rename from mysql-test/r/mysqlbinlog_row_innodb.result rename to mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result diff --git a/mysql-test/r/mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result similarity index 100% rename from mysql-test/r/mysqlbinlog_row_myisam.result rename to mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result diff --git a/mysql-test/r/mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result similarity index 100% rename from mysql-test/r/mysqlbinlog_row_trans.result rename to mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result diff --git a/mysql-test/t/mysqlbinlog-cp932-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt similarity index 100% rename from mysql-test/t/mysqlbinlog-cp932-master.opt rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test similarity index 100% rename from mysql-test/t/mysqlbinlog-cp932.test rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test similarity index 100% rename from mysql-test/t/mysqlbinlog2.test rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test similarity index 100% rename from mysql-test/t/mysqlbinlog_base64.test rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test diff --git a/mysql-test/t/mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test similarity index 100% rename from mysql-test/t/mysqlbinlog_row.test rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test diff --git a/mysql-test/t/mysqlbinlog_row_innodb.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test similarity index 91% rename from mysql-test/t/mysqlbinlog_row_innodb.test rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test index cef1a712f7d..e8ba283807b 100644 --- a/mysql-test/t/mysqlbinlog_row_innodb.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test @@ -20,5 +20,5 @@ let $engine_type=InnoDB; --source include/have_binlog_format_row.inc --source include/have_ucs2.inc ---source include/mysqlbinlog_row_engine.inc +--source extra/binlog_tests/mysqlbinlog_row_engine.inc diff --git a/mysql-test/t/mysqlbinlog_row_myisam.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test similarity index 91% rename from mysql-test/t/mysqlbinlog_row_myisam.test rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test index e7b0335812a..9b941282399 100644 --- a/mysql-test/t/mysqlbinlog_row_myisam.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test @@ -20,4 +20,4 @@ let $engine_type=MyISAM; --source include/have_binlog_format_row.inc --source include/have_ucs2.inc ---source include/mysqlbinlog_row_engine.inc +--source extra/binlog_tests/mysqlbinlog_row_engine.inc diff --git a/mysql-test/t/mysqlbinlog_row_trans.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test similarity index 100% rename from mysql-test/t/mysqlbinlog_row_trans.test rename to mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test From 84d87d938a24e19db91f110699fc7d71dc82f64b Mon Sep 17 00:00:00 2001 From: Anirudh Mangipudi Date: Tue, 30 Oct 2012 16:53:55 +0530 Subject: [PATCH 258/349] BUG#11754894: MYISAMCHK ERROR HAS INCORRECT REFERENCE TO 'MYISAM_SORT_BUFFER_SIZE' Problem: 'myisam_sort_buffer_size' is a parameter used by mysqld program only whereas 'sort_buffer_size' is used by mysqld and myisamchk programs. But the error message printed when myisamchk program is run with insufficient buffer size is myisam_sort_buffer_size is too small which may mislead to the server parameter myisam_sort_buffer_size. SOLUTION: A parameter 'myisam_sort_buffer_size' is added as an alias for 'sort_buffer_size' and the 'sort_buffer_size' parameter is marked as deprecated. So myisamchk also has both the parameters with the same role. --- storage/myisam/myisamchk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 145c6b9b85a..8ab804cbaa2 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -310,7 +310,14 @@ static struct my_option my_long_options[] = &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, - { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", + { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, + "Deprecated. myisam_sort_buffer_size alias is being used", + &check_param.sort_buffer_length, + &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), + ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + { "myisam_sort_buffer_size", OPT_SORT_BUFFER_SIZE, + "Alias of sort_buffer_size parameter", &check_param.sort_buffer_length, &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), From 40b8b951428bd91275234d67ebba858bdfb844cd Mon Sep 17 00:00:00 2001 From: Anirudh Mangipudi Date: Tue, 30 Oct 2012 18:49:15 +0530 Subject: [PATCH 259/349] BUG#11754894: MYISAMCHK ERROR HAS INCORRECT REFERENCE TO 'MYISAM_SORT_BUFFER_SIZE' Problem: 'myisam_sort_buffer_size' is a parameter used by mysqld program only whereas 'sort_buffer_size' is used by mysqld and myisamchk programs. But the error message printed when myisamchk program is run with insufficient buffer size is myisam_sort_buffer_size is too small which may mislead to the server parameter myisam_sort_buffer_size. SOLUTION: A parameter 'myisam_sort_buffer_size' is added as an alias for 'sort_buffer_size' and the 'sort_buffer_size' parameter is marked as deprecated. So myisamchk also has both the parameters with the same role. --- storage/myisam/myisamchk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 145c6b9b85a..8ab804cbaa2 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -310,7 +310,14 @@ static struct my_option my_long_options[] = &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, - { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", + { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, + "Deprecated. myisam_sort_buffer_size alias is being used", + &check_param.sort_buffer_length, + &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), + ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + { "myisam_sort_buffer_size", OPT_SORT_BUFFER_SIZE, + "Alias of sort_buffer_size parameter", &check_param.sort_buffer_length, &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), From 154860eab5499cf44160f253694a87b8147a2965 Mon Sep 17 00:00:00 2001 From: Ashish Agarwal Date: Wed, 31 Oct 2012 12:40:48 +0530 Subject: [PATCH 260/349] BUG#14485479: INSTALL AUDIT PLUGIN HANGS IF WE TRY TO DISABLE AND ENABLED DURING DDL OPERATION PROBLEM: Same thread trying to acquire the same mutex second time leads to hang/server crash. While [un]installing audit_log plugin a thread acquires the LOCK_plugin mutex and after successful initialization tries to write in mysql.plugin table. It holds this mutex for a long time. If some how plugin table is corrupted then a write to plugin table will throw an error, thread try to log this error in the audit_log plugin, doing so it tries to acquire the mutex again and results is server hang/crash. SOLUTION: Releasing the LOCK_plugin mutex before writing in mysql.plugin table. We dont need to hold this mutex as thread already acquired a TL_WRITE lock on mysql.plugin table. --- mysql-test/include/have_null_audit_plugin.inc | 22 +++++++++++++++++++ mysql-test/include/plugin.defs | 1 + sql/sql_plugin.cc | 5 +++-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 mysql-test/include/have_null_audit_plugin.inc diff --git a/mysql-test/include/have_null_audit_plugin.inc b/mysql-test/include/have_null_audit_plugin.inc new file mode 100644 index 00000000000..aa558cf18dd --- /dev/null +++ b/mysql-test/include/have_null_audit_plugin.inc @@ -0,0 +1,22 @@ +disable_query_log; +# +# Check if server has support for loading plugins +# +if (`SELECT @@have_dynamic_loading != 'YES'`) { + --skip Null audit plugin requires dynamic loading +} + +# +# Check if the variable AUDIT_NULL is set +# +if (!$AUDIT_NULL) { + --skip Audit_null plugin requires the environment variable \$AUDIT_NULL to be set (normally done by mtr) +} + +# +# Check if --plugin-dir was setup for null_audit db +# +if (`SELECT CONCAT('--plugin-dir=', REPLACE(@@plugin_dir, '\\\\', '/')) != '$AUDIT_NULL_OPT/'`) { + --skip null audit plugin requires that --plugin-dir is set to the null audit plugin dir (either the .opt file does not contain \$AUDIT_NULL_OPT or another plugin is in use) +} +enable_query_log; diff --git a/mysql-test/include/plugin.defs b/mysql-test/include/plugin.defs index 6fbe4f68328..45fdfdb9a41 100644 --- a/mysql-test/include/plugin.defs +++ b/mysql-test/include/plugin.defs @@ -40,3 +40,4 @@ ha_blackhole storage/blackhole BLACKHOLE_PLUGIN ha_federated storage/federated FEDERATED_PLUGIN mypluglib plugin/fulltext SIMPLE_PARSER libdaemon_example plugin/daemon_example DAEMONEXAMPLE +adt_null plugin/audit_null AUDIT_NULL diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 4c42f3798dd..13623078265 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1820,6 +1820,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl { if (plugin_initialize(tmp)) { + mysql_mutex_unlock(&LOCK_plugin); my_error(ER_CANT_INITIALIZE_UDF, MYF(0), name->str, "Plugin initialization function failed."); goto deinit; @@ -1831,6 +1832,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl of the insert into the plugin table, so that it is not replicated in row based mode. */ + mysql_mutex_unlock(&LOCK_plugin); tmp_disable_binlog(thd); table->use_all_columns(); restore_record(table, s->default_values); @@ -1843,10 +1845,9 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl table->file->print_error(error, MYF(0)); goto deinit; } - - mysql_mutex_unlock(&LOCK_plugin); DBUG_RETURN(FALSE); deinit: + mysql_mutex_lock(&LOCK_plugin); tmp->state= PLUGIN_IS_DELETED; reap_needed= true; reap_plugins(); From 02501a0f9762c42b8d60ee754979bc60afe3ee36 Mon Sep 17 00:00:00 2001 From: Venkata Sidagam Date: Wed, 31 Oct 2012 18:32:53 +0530 Subject: [PATCH 261/349] BUG#13556441: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST [4] Problem description: mysql server crashes when we run repair table on currupted table. Analysis: The problem with this bug seem to be key_reflength out of bounds (186 according to debugger). We read this value from meta-data segment of .MYI file while doing mi_open(). If you look into _mi_kpointer() you can see that the upper limit for key_reflength is 7. Solution: In mi_open() there is a line like: if (share->base.keystart > 65535 || share->base.rec_reflength > 8) we should verify key_reflength here as well. --- storage/myisam/mi_open.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 86cf25b59ef..5951aef6d4f 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -232,7 +232,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) } /* sanity check */ - if (share->base.keystart > 65535 || share->base.rec_reflength > 8) + if (share->base.keystart > 65535 || + share->base.rec_reflength > 8 || share->base.key_reflength > 7) { my_errno=HA_ERR_CRASHED; goto err; From 86c0a80b0dc961530d3376d21028510c180d2cbc Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Thu, 1 Nov 2012 17:23:06 +0100 Subject: [PATCH 262/349] Bug#14840488 VALGRIND ERRORS IN MYSQL_CLIENT_TEST Add missing DBUG_RETURNs, otherwise the debug-stack gets messed up, and _db_enter_ and _db_exit_ will access data outside the current stack frame. --- libmysql/libmysql.c | 2 +- tests/mysql_client_test.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 5d153317150..f7eb19520b7 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -4653,7 +4653,7 @@ int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *my_bind, if ((int) stmt->state < (int) MYSQL_STMT_FETCH_DONE) { set_stmt_error(stmt, CR_NO_DATA, unknown_sqlstate, NULL); - return 1; + DBUG_RETURN(1); } if (column >= stmt->field_count) { diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index c38695db1b1..e6544e99c7e 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -15278,6 +15278,7 @@ static void test_bug27876() rc= mysql_query(mysql, "set names default"); myquery(rc); + DBUG_VOID_RETURN; } From 6a875b24c37101d91e9afd1bb8bdfab0fde73155 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 8 Nov 2012 19:06:44 +0100 Subject: [PATCH 263/349] Placement change: Top level "SPECIFIC-ULN/" was inappropriate, put the files to create RPMs for ULN into "packaging/rpm-uln/". --- CMakeLists.txt | 2 +- cmake/install_layout.cmake | 2 +- {SPECIFIC-ULN => packaging/rpm-uln}/CMakeLists.txt | 0 {SPECIFIC-ULN => packaging/rpm-uln}/README-ULN | 0 {SPECIFIC-ULN => packaging/rpm-uln}/README.mysql-docs | 0 {SPECIFIC-ULN => packaging/rpm-uln}/filter-requires-mysql.sh | 0 {SPECIFIC-ULN => packaging/rpm-uln}/generate-tarball.sh | 0 {SPECIFIC-ULN => packaging/rpm-uln}/my.cnf | 0 {SPECIFIC-ULN => packaging/rpm-uln}/my_config.h | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-errno.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-fix-tests.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-libdir.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-mtr1.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-stack-guard.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-testing.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-chain-certs.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-embedded-check.c | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-expired-certs.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-install-test.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql-strmov.patch | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql.init | 0 {SPECIFIC-ULN => packaging/rpm-uln}/mysql.spec.sh | 0 {SPECIFIC-ULN => packaging/rpm-uln}/scriptstub.c | 0 23 files changed, 2 insertions(+), 2 deletions(-) rename {SPECIFIC-ULN => packaging/rpm-uln}/CMakeLists.txt (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/README-ULN (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/README.mysql-docs (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/filter-requires-mysql.sh (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/generate-tarball.sh (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/my.cnf (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/my_config.h (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-errno.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-fix-tests.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-libdir.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-mtr1.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-stack-guard.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-5.5-testing.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-chain-certs.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-embedded-check.c (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-expired-certs.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-install-test.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql-strmov.patch (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql.init (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/mysql.spec.sh (100%) rename {SPECIFIC-ULN => packaging/rpm-uln}/scriptstub.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85a01a8b399..7429a335009 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,7 +328,7 @@ IF(NOT WITHOUT_SERVER) IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt) ADD_SUBDIRECTORY(internal) ENDIF() - ADD_SUBDIRECTORY(SPECIFIC-ULN) + ADD_SUBDIRECTORY(packaging/rpm-uln) ENDIF() INCLUDE(cmake/abi_check.cmake) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 18c7afd8037..4adda0b6eac 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -138,7 +138,7 @@ SET(INSTALL_PLUGINTESTDIR_STANDALONE ${plugin_tests}) # # RPM layout # -# See "SPECIFIC-ULN/mysql-5.5-libdir.patch" for the differences +# See "packaging/rpm-uln/mysql-5.5-libdir.patch" for the differences # which apply to RPMs in ULN (Oracle Linux), that patch file will # be applied at build time via "rpmbuild". # diff --git a/SPECIFIC-ULN/CMakeLists.txt b/packaging/rpm-uln/CMakeLists.txt similarity index 100% rename from SPECIFIC-ULN/CMakeLists.txt rename to packaging/rpm-uln/CMakeLists.txt diff --git a/SPECIFIC-ULN/README-ULN b/packaging/rpm-uln/README-ULN similarity index 100% rename from SPECIFIC-ULN/README-ULN rename to packaging/rpm-uln/README-ULN diff --git a/SPECIFIC-ULN/README.mysql-docs b/packaging/rpm-uln/README.mysql-docs similarity index 100% rename from SPECIFIC-ULN/README.mysql-docs rename to packaging/rpm-uln/README.mysql-docs diff --git a/SPECIFIC-ULN/filter-requires-mysql.sh b/packaging/rpm-uln/filter-requires-mysql.sh similarity index 100% rename from SPECIFIC-ULN/filter-requires-mysql.sh rename to packaging/rpm-uln/filter-requires-mysql.sh diff --git a/SPECIFIC-ULN/generate-tarball.sh b/packaging/rpm-uln/generate-tarball.sh similarity index 100% rename from SPECIFIC-ULN/generate-tarball.sh rename to packaging/rpm-uln/generate-tarball.sh diff --git a/SPECIFIC-ULN/my.cnf b/packaging/rpm-uln/my.cnf similarity index 100% rename from SPECIFIC-ULN/my.cnf rename to packaging/rpm-uln/my.cnf diff --git a/SPECIFIC-ULN/my_config.h b/packaging/rpm-uln/my_config.h similarity index 100% rename from SPECIFIC-ULN/my_config.h rename to packaging/rpm-uln/my_config.h diff --git a/SPECIFIC-ULN/mysql-5.5-errno.patch b/packaging/rpm-uln/mysql-5.5-errno.patch similarity index 100% rename from SPECIFIC-ULN/mysql-5.5-errno.patch rename to packaging/rpm-uln/mysql-5.5-errno.patch diff --git a/SPECIFIC-ULN/mysql-5.5-fix-tests.patch b/packaging/rpm-uln/mysql-5.5-fix-tests.patch similarity index 100% rename from SPECIFIC-ULN/mysql-5.5-fix-tests.patch rename to packaging/rpm-uln/mysql-5.5-fix-tests.patch diff --git a/SPECIFIC-ULN/mysql-5.5-libdir.patch b/packaging/rpm-uln/mysql-5.5-libdir.patch similarity index 100% rename from SPECIFIC-ULN/mysql-5.5-libdir.patch rename to packaging/rpm-uln/mysql-5.5-libdir.patch diff --git a/SPECIFIC-ULN/mysql-5.5-mtr1.patch b/packaging/rpm-uln/mysql-5.5-mtr1.patch similarity index 100% rename from SPECIFIC-ULN/mysql-5.5-mtr1.patch rename to packaging/rpm-uln/mysql-5.5-mtr1.patch diff --git a/SPECIFIC-ULN/mysql-5.5-stack-guard.patch b/packaging/rpm-uln/mysql-5.5-stack-guard.patch similarity index 100% rename from SPECIFIC-ULN/mysql-5.5-stack-guard.patch rename to packaging/rpm-uln/mysql-5.5-stack-guard.patch diff --git a/SPECIFIC-ULN/mysql-5.5-testing.patch b/packaging/rpm-uln/mysql-5.5-testing.patch similarity index 100% rename from SPECIFIC-ULN/mysql-5.5-testing.patch rename to packaging/rpm-uln/mysql-5.5-testing.patch diff --git a/SPECIFIC-ULN/mysql-chain-certs.patch b/packaging/rpm-uln/mysql-chain-certs.patch similarity index 100% rename from SPECIFIC-ULN/mysql-chain-certs.patch rename to packaging/rpm-uln/mysql-chain-certs.patch diff --git a/SPECIFIC-ULN/mysql-embedded-check.c b/packaging/rpm-uln/mysql-embedded-check.c similarity index 100% rename from SPECIFIC-ULN/mysql-embedded-check.c rename to packaging/rpm-uln/mysql-embedded-check.c diff --git a/SPECIFIC-ULN/mysql-expired-certs.patch b/packaging/rpm-uln/mysql-expired-certs.patch similarity index 100% rename from SPECIFIC-ULN/mysql-expired-certs.patch rename to packaging/rpm-uln/mysql-expired-certs.patch diff --git a/SPECIFIC-ULN/mysql-install-test.patch b/packaging/rpm-uln/mysql-install-test.patch similarity index 100% rename from SPECIFIC-ULN/mysql-install-test.patch rename to packaging/rpm-uln/mysql-install-test.patch diff --git a/SPECIFIC-ULN/mysql-strmov.patch b/packaging/rpm-uln/mysql-strmov.patch similarity index 100% rename from SPECIFIC-ULN/mysql-strmov.patch rename to packaging/rpm-uln/mysql-strmov.patch diff --git a/SPECIFIC-ULN/mysql.init b/packaging/rpm-uln/mysql.init similarity index 100% rename from SPECIFIC-ULN/mysql.init rename to packaging/rpm-uln/mysql.init diff --git a/SPECIFIC-ULN/mysql.spec.sh b/packaging/rpm-uln/mysql.spec.sh similarity index 100% rename from SPECIFIC-ULN/mysql.spec.sh rename to packaging/rpm-uln/mysql.spec.sh diff --git a/SPECIFIC-ULN/scriptstub.c b/packaging/rpm-uln/scriptstub.c similarity index 100% rename from SPECIFIC-ULN/scriptstub.c rename to packaging/rpm-uln/scriptstub.c From fbce7ac218e48b7f18f582ae5738746bbc5188fc Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 8 Nov 2012 19:09:52 +0100 Subject: [PATCH 264/349] Building RPMs for ULN: The patch "mysql-chain-certs.patch" needs to be adapted to code changes in "vio/viosslfactories.c" which were done in MySQL 5.5. --- packaging/rpm-uln/mysql-chain-certs.patch | 26 +++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packaging/rpm-uln/mysql-chain-certs.patch b/packaging/rpm-uln/mysql-chain-certs.patch index 3b20a28031d..4e26af16cb0 100644 --- a/packaging/rpm-uln/mysql-chain-certs.patch +++ b/packaging/rpm-uln/mysql-chain-certs.patch @@ -9,19 +9,23 @@ Fedora builds, I'm not feeling motivated to try to fix yassl for this. See RH bug #598656. Filed upstream at http://bugs.mysql.com/bug.php?id=54158 + === -diff -Naur mysql-5.1.47.orig/vio/viosslfactories.c mysql-5.1.47/vio/viosslfactories.c ---- mysql-5.1.47.orig/vio/viosslfactories.c 2010-05-06 11:28:07.000000000 -0400 -+++ mysql-5.1.47/vio/viosslfactories.c 2010-05-26 23:23:46.000000000 -0400 -@@ -100,7 +100,7 @@ - (long) ctx, cert_file, key_file)); - if (cert_file) +Joerg Bruehe, MySQL Build Team at Oracle: First patch adapted to code changes in MySQL 5.5 + + +diff -Naur mysql-5.5.29.orig/vio/viosslfactories.c mysql-5.5.29/vio/viosslfactories.c +--- mysql-5.5.29.orig/vio/viosslfactories.c 2010-05-06 11:28:07.000000000 -0400 ++++ mysql-5.5.29/vio/viosslfactories.c 2010-05-26 23:23:46.000000000 -0400 +@@ -106,7 +106,7 @@ + key_file= cert_file; + + if (cert_file && +- SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) ++ SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) { -- if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) -+ if (SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) - { - *error= SSL_INITERR_CERT; - DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file)); + *error= SSL_INITERR_CERT; + DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file)); diff -Naur mysql-5.1.47.orig/extra/yassl/src/ssl.cpp mysql-5.1.47/extra/yassl/src/ssl.cpp --- mysql-5.1.47.orig/extra/yassl/src/ssl.cpp 2010-05-06 11:24:26.000000000 -0400 +++ mysql-5.1.47/extra/yassl/src/ssl.cpp 2010-05-26 23:29:13.000000000 -0400 From db1db8fa8cbcf95fdc2c77a744be7b2f9f31b170 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 21 Nov 2012 21:55:04 -0800 Subject: [PATCH 265/349] Fixed LP bug #1002146 (bug mdev-645). If the setting of system variables does not allow to use join buffer for a join query with GROUP BY / ORDER BY then filesort is not needed if the first joined table is scanned in the order compatible with order specified by the list . --- mysql-test/r/group_by.result | 41 +++++++++++++++++++++++++++ mysql-test/r/subselect_sj_jcl6.result | 4 +-- mysql-test/t/group_by.test | 36 +++++++++++++++++++++++ sql/sql_select.cc | 9 ++++-- 4 files changed, 85 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 68ddcd39e92..6d6e11fa091 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2111,4 +2111,45 @@ FROM t2 GROUP BY 1; a DROP TABLE t1, t2; +# +# Bug #1002146: Unneeded filesort if usage of join buffer is not allowed +# (bug mdev-645) +# +CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a)); +INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4); +CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a)); +INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200); +set join_cache_level=0; +EXPLAIN +SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 +GROUP BY t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 +GROUP BY t2.a; +a +3 +4 +100 +200 +set join_cache_level=default; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='outer_join_with_cache=off'; +EXPLAIN +SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 +GROUP BY t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using where; Using index +SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 +GROUP BY t2.a; +a +0 +3 +4 +100 +200 +set optimizer_switch=@save_optimizer_switch; +DROP TABLE t1,t2; # End of 5.3 tests diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 34388db5c3b..a189132b11a 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2978,7 +2978,7 @@ EXPLAIN SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index; Using temporary; Using filesort +1 PRIMARY t index idx_a idx_a 4 NULL 1 Using index 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where 2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index @@ -2992,7 +2992,7 @@ EXPLAIN SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index; Using temporary; Using filesort +1 PRIMARY t index idx_a idx_a 4 NULL 1 Using index 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where 2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index d4214442709..ec20cd8aa76 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1472,4 +1472,40 @@ WHERE a = ( GROUP BY 1; DROP TABLE t1, t2; +--echo # +--echo # Bug #1002146: Unneeded filesort if usage of join buffer is not allowed +--echo # (bug mdev-645) +--echo # + +CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a)); +INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4); + +CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a)); +INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200); + +set join_cache_level=0; + +EXPLAIN +SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; +SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; + +set join_cache_level=default; + +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='outer_join_with_cache=off'; + +EXPLAIN +SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; +SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 + GROUP BY t2.a; + +set optimizer_switch=@save_optimizer_switch; + + +DROP TABLE t1,t2; + + --echo # End of 5.3 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1e57f11e399..a3d3f84806c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7422,8 +7422,9 @@ get_best_combination(JOIN *join) if ( !(keyuse= join->best_positions[tablenr].key)) { j->type=JT_ALL; - if (tablenr != join->const_tables) - join->full_join=1; + if (join->best_positions[tablenr].use_join_buffer && + tablenr != join->const_tables) + join->full_join= 1; } /*if (join->best_positions[tablenr].sj_strategy == SJ_OPT_LOOSE_SCAN) @@ -8436,7 +8437,9 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) We will use join cache here : prevent sorting of the first table only and sort at the end. */ - if (i != join->const_tables && join->table_count > join->const_tables + 1) + if (i != join->const_tables && + join->table_count > join->const_tables + 1 && + join->best_positions[i].use_join_buffer) join->full_join= 1; } From 3fa356106694857a2e89e3aa135679799cbe7543 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 22 Nov 2012 18:27:02 +0100 Subject: [PATCH 266/349] Feedback plugin now recognizes Windows 8 / Windows Server 2012. --- plugin/feedback/utils.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc index 48bbd72d530..708cc04f33e 100644 --- a/plugin/feedback/utils.cc +++ b/plugin/feedback/utils.cc @@ -44,6 +44,12 @@ static const char *get_os_version_name(OSVERSIONINFOEX *ver) DWORD major = ver->dwMajorVersion; DWORD minor = ver->dwMinorVersion; + if (major == 6 && minor == 2) + { + return (ver->wProductType == VER_NT_WORKSTATION)? + "Windows 8":"Windows Server 2012"; + } + if (major == 6 && minor == 1) { return (ver->wProductType == VER_NT_WORKSTATION)? From b01fbb8e48327300b09c90ca94b9ba7b655adbb6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 23 Nov 2012 13:11:31 +0100 Subject: [PATCH 267/349] bump the version to 5.3.11 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index ef5321e7b8e..4667a8456e0 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,7 @@ dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MariaDB Server], [5.3.10-MariaDB], [], [mysql]) +AC_INIT([MariaDB Server], [5.3.11-MariaDB], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 3b572cd1197c7aa84010fd848908e41627f21a6d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 23 Nov 2012 13:50:46 +0100 Subject: [PATCH 268/349] MDEV-712 - LP:1024239 - Mysqlclient exports the same symbols as openssl Compile yassl and taocrypt using -fvisibility=hidden, when possible. This prevent symbols from being exported. --- configure.in | 12 ++++++++++++ extra/yassl/src/Makefile.am | 3 ++- extra/yassl/taocrypt/src/Makefile.am | 5 +++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index 30802725ffc..6e82a05a624 100644 --- a/configure.in +++ b/configure.in @@ -2513,6 +2513,18 @@ if test "x$mysql_cv_bss_start" = xyes; then [Define to 1 if compiler defines __bss_start.]) fi +# check for -fvisibility=hidden compiler support (GCC >= 4) +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" +AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden -fvisibility-inlines-hidden]) +AC_COMPILE_IFELSE([char foo;], + [ AC_MSG_RESULT([yes]) + SYMBOL_VISIBILITY="-fvisibility=hidden" SYMBOL_VISIBILITY_INLINES="-fvisibility-inlines-hidden" ], + AC_MSG_RESULT([no])) +CFLAGS="$saved_CFLAGS" +AC_SUBST(SYMBOL_VISIBILITY) +AC_SUBST(SYMBOL_VISIBILITY_INLINES) + AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_CHECK_HEADERS(cxxabi.h) diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am index 300cdcd096f..fa45704f949 100644 --- a/extra/yassl/src/Makefile.am +++ b/extra/yassl/src/Makefile.am @@ -5,4 +5,5 @@ libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \ template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h) -AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX @yassl_thread_cxxflags@ +AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX @yassl_thread_cxxflags@ \ + @SYMBOL_VISIBILITY@ @SYMBOL_VISIBILITY_INLINES@ diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am index bfc9bfe7084..eedbff3a759 100644 --- a/extra/yassl/taocrypt/src/Makefile.am +++ b/extra/yassl/taocrypt/src/Makefile.am @@ -9,6 +9,7 @@ libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \ tftables.cpp twofish.cpp rabbit.cpp hc128.cpp libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C \ - @yassl_thread_cxxflags@ - + @yassl_thread_cxxflags@ \ + @SYMBOL_VISIBILITY@ @SYMBOL_VISIBILITY_INLINES@ + EXTRA_DIST = $(wildcard ../include/*.hpp) From f8f2cdf21ff47cdbf7d81c5445281288b51c0298 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 26 Nov 2012 13:33:24 +0100 Subject: [PATCH 269/349] Fix broken feedback plugin after MDEV-712. Link feedback plugin with yassl libraries, if with-ssl=bundled is used, since mysqld does not export SSL symbols anymore. --- plugin/feedback/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin/feedback/Makefile.am b/plugin/feedback/Makefile.am index 7d2a61d593f..339aabf0efc 100644 --- a/plugin/feedback/Makefile.am +++ b/plugin/feedback/Makefile.am @@ -5,6 +5,9 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ EXTRA_LTLIBRARIES = feedback.la libfeedback.la pkgplugin_LTLIBRARIES = @plugin_feedback_shared_target@ feedback_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices +if HAVE_YASSL +feedback_la_LIBADD = @yassl_libs@ +endif feedback_la_CXXFLAGS = -shared -DMYSQL_DYNAMIC_PLUGIN feedback_la_SOURCES = feedback.cc utils.cc url_base.cc url_http.cc \ sender_thread.cc From 2cbf2e643bc9b6e048905ba4d49da875f45018e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Nov 2012 19:34:47 +0100 Subject: [PATCH 270/349] applying patch for BUG15912213 --- sql/sql_acl.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e07f668b1cf..80662832140 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1356,10 +1356,19 @@ ulong acl_get(const char *host, const char *ip, { ulong host_access= ~(ulong)0, db_access= 0; uint i; - size_t key_length; + size_t key_length, copy_length; char key[ACL_KEY_LENGTH],*tmp_db,*end; acl_entry *entry; DBUG_ENTER("acl_get"); + + copy_length= (size_t) (strlen(ip ? ip : "") + + strlen(user ? user : "") + + strlen(db ? db : "")); + /* + Make sure that strmov() operations do not result in buffer overflow. + */ + if (copy_length >= ACL_KEY_LENGTH) + DBUG_RETURN(0); VOID(pthread_mutex_lock(&acl_cache->lock)); end=strmov((tmp_db=strmov(strmov(key, ip ? ip : "")+1,user)+1),db); @@ -4340,6 +4349,16 @@ bool check_grant_db(THD *thd,const char *db) char helping [NAME_LEN+USERNAME_LENGTH+2]; uint len; bool error= TRUE; + size_t copy_length; + + copy_length= (size_t) (strlen(sctx->priv_user ? sctx->priv_user : "") + + strlen(db ? db : "")); + + /* + Make sure that strmov() operations do not result in buffer overflow. + */ + if (copy_length >= (NAME_LEN+USERNAME_LENGTH+2)) + return 1; len= (uint) (strmov(strmov(helping, sctx->priv_user) + 1, db) - helping) + 1; From eff07bf08e29afab76c7688ec063ef6881ee464f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 4 Dec 2012 17:08:02 +0100 Subject: [PATCH 271/349] proactive s/strmov/strnmov/ in sql_acl.cc and related test cases --- mysql-test/r/grant_lowercase.result | 20 ++++++++++++++++ mysql-test/t/grant_lowercase.opt | 1 + mysql-test/t/grant_lowercase.test | 30 +++++++++++++++++++++++ sql/sql_acl.cc | 37 +++++++++++++++++++++++------ 4 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 mysql-test/r/grant_lowercase.result create mode 100644 mysql-test/t/grant_lowercase.opt create mode 100644 mysql-test/t/grant_lowercase.test diff --git a/mysql-test/r/grant_lowercase.result b/mysql-test/r/grant_lowercase.result new file mode 100644 index 00000000000..489f990daf1 --- /dev/null +++ b/mysql-test/r/grant_lowercase.result @@ -0,0 +1,20 @@ +grant file on *.* to user1@localhost with grant option; +grant select on `a%`.* to user1@localhost with grant option; +grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret'; +ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +drop user user1@localhost; +call mtr.add_suppression("Incorrect database name"); +alter table mysql.host modify Db varchar(200); +alter table mysql.db modify Db varchar(200); +insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200)); +Warnings: +Warning 1265 Data truncated for column 'Db' at row 1 +insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200)); +Warnings: +Warning 1265 Data truncated for column 'Db' at row 1 +flush privileges; +delete from mysql.host where db like '=>%'; +delete from mysql.db where db like '=>%'; +alter table mysql.host modify Db char(64); +alter table mysql.db modify Db char(64); +flush privileges; diff --git a/mysql-test/t/grant_lowercase.opt b/mysql-test/t/grant_lowercase.opt new file mode 100644 index 00000000000..5b0a3d41b41 --- /dev/null +++ b/mysql-test/t/grant_lowercase.opt @@ -0,0 +1 @@ +--lower-case-table-names=1 diff --git a/mysql-test/t/grant_lowercase.test b/mysql-test/t/grant_lowercase.test new file mode 100644 index 00000000000..157e13449c2 --- /dev/null +++ b/mysql-test/t/grant_lowercase.test @@ -0,0 +1,30 @@ +# test cases for strmov(tmp_db, db) -> strnmov replacement in sql_acl.cc + +# +# http://seclists.org/fulldisclosure/2012/Dec/4 +# + +# in acl_get(), check_grant_db(), mysql_grant() +grant file on *.* to user1@localhost with grant option; +grant select on `a%`.* to user1@localhost with grant option; +connect (conn1,localhost,user1,,); +connection conn1; +--error ER_WRONG_DB_NAME +grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret'; +connection default; +disconnect conn1; +drop user user1@localhost; + +# in acl_load() +call mtr.add_suppression("Incorrect database name"); +alter table mysql.host modify Db varchar(200); +alter table mysql.db modify Db varchar(200); +insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200)); +insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200)); +flush privileges; # shouldn't crash here +delete from mysql.host where db like '=>%'; +delete from mysql.db where db like '=>%'; +alter table mysql.host modify Db char(64); +alter table mysql.db modify Db char(64); +flush privileges; + diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 020aa042722..4f4c0eeb06b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -341,7 +341,12 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) convert db to lower case and give a warning if the db wasn't already in lower case */ - (void) strmov(tmp_name, host.db); + char *end = strnmov(tmp_name, host.db, sizeof(tmp_name)); + if (end >= tmp_name + sizeof(tmp_name)) + { + sql_print_warning(ER(ER_WRONG_DB_NAME), host.db); + continue; + } my_casedn_str(files_charset_info, host.db); if (strcmp(host.db, tmp_name) != 0) sql_print_warning("'host' entry '%s|%s' had database in mixed " @@ -595,7 +600,12 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) convert db to lower case and give a warning if the db wasn't already in lower case */ - (void)strmov(tmp_name, db.db); + char *end = strnmov(tmp_name, db.db, sizeof(tmp_name)); + if (end >= tmp_name + sizeof(tmp_name)) + { + sql_print_warning(ER(ER_WRONG_DB_NAME), db.db); + continue; + } my_casedn_str(files_charset_info, db.db); if (strcmp(db.db, tmp_name) != 0) { @@ -2474,15 +2484,23 @@ static GRANT_NAME *name_hash_search(HASH *name_hash, const char *user, const char *tname, bool exact, bool name_tolower) { - char helping [SAFE_NAME_LEN*2+USERNAME_LENGTH+3], *name_ptr; + char helping[SAFE_NAME_LEN*2+USERNAME_LENGTH+3]; + char *hend = helping + sizeof(helping); uint len; GRANT_NAME *grant_name,*found=0; HASH_SEARCH_STATE state; - name_ptr= strmov(strmov(helping, user) + 1, db) + 1; - len = (uint) (strmov(name_ptr, tname) - helping) + 1; + char *db_ptr= strmov(helping, user) + 1; + char *tname_ptr= strnmov(db_ptr, db, hend - db_ptr) + 1; + if (tname_ptr > hend) + return 0; // invalid name = not found + char *end= strnmov(tname_ptr, tname, hend - tname_ptr) + 1; + if (end > hend) + return 0; // invalid name = not found + + len = (uint) (end - helping); if (name_tolower) - my_casedn_str(files_charset_info, name_ptr); + my_casedn_str(files_charset_info, tname_ptr); for (grant_name= (GRANT_NAME*) hash_first(name_hash, (uchar*) helping, len, &state); grant_name ; @@ -3466,7 +3484,12 @@ bool mysql_grant(THD *thd, const char *db, List &list, if (lower_case_table_names && db) { - strmov(tmp_db,db); + char *end= strnmov(tmp_db,db, sizeof(tmp_db)); + if (end >= tmp_db + sizeof(tmp_db)) + { + my_error(ER_WRONG_DB_NAME ,MYF(0), db); + DBUG_RETURN(TRUE); + } my_casedn_str(files_charset_info, tmp_db); db=tmp_db; } From d538d394b86d4095e78c891e40876f4b9e031d7f Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Wed, 5 Dec 2012 17:24:45 +0400 Subject: [PATCH 272/349] Bug #15948123: SERVER WORKS INCORRECT WITH LONG TABLE ALIASES Code in MDL subsystem assumes that identifiers of objects can't be longer than NAME_LEN characters. This assumption was broken when one tried to construct MDL_key based on table alias, which can have arbitrary length. Since MDL_key's (and MDL locks) are not really used for table aliases this patch changes code to not initialize MDL_key object for table list element representing aliases. --- sql/mdl.h | 2 ++ sql/sql_parse.cc | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sql/mdl.h b/sql/mdl.h index d30d30ac2fa..6d29ad968c6 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -246,6 +246,8 @@ public: } void mdl_key_init(const MDL_key *rhs) { + DBUG_ASSERT(rhs->m_length <= NAME_LEN); + DBUG_ASSERT(rhs->m_db_name_length <= NAME_LEN); memcpy(m_ptr, rhs->m_ptr, rhs->m_length); m_length= rhs->m_length; m_db_name_length= rhs->m_db_name_length; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ea07bfce0cb..2e995f58c5c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6000,8 +6000,13 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ptr->next_name_resolution_table= NULL; /* Link table in global list (all used tables) */ lex->add_to_query_tables(ptr); - ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type, - MDL_TRANSACTION); + + // Pure table aliases do not need to be locked: + if (!test(table_options & TL_OPTION_ALIAS)) + { + ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type, + MDL_TRANSACTION); + } DBUG_RETURN(ptr); } From e5424d196b9c392b71fc1b2c8dcf67f610f6a746 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Wed, 5 Dec 2012 20:47:21 +0400 Subject: [PATCH 273/349] Bug #15948123: SERVER WORKS INCORRECT WITH LONG TABLE ALIASES After-push cleanup: removal of unneeded assertions. --- sql/mdl.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/mdl.h b/sql/mdl.h index 6d29ad968c6..d30d30ac2fa 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -246,8 +246,6 @@ public: } void mdl_key_init(const MDL_key *rhs) { - DBUG_ASSERT(rhs->m_length <= NAME_LEN); - DBUG_ASSERT(rhs->m_db_name_length <= NAME_LEN); memcpy(m_ptr, rhs->m_ptr, rhs->m_length); m_length= rhs->m_length; m_db_name_length= rhs->m_db_name_length; From 0aad592f49f0fb790f712aa6a644653cf9a0218f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Dec 2012 21:06:00 +0200 Subject: [PATCH 274/349] MDEV-3914 fix. Fixed algorithm of detecting of first real table in view/subquery-in-the-FROM-clase. --- mysql-test/r/view.result | 24 ++++++++++++++++++++++++ mysql-test/t/view.test | 26 ++++++++++++++++++++++++++ sql/table.cc | 36 +++++++++++++++++++++++++----------- 3 files changed, 75 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index c12bf8ada06..74c36a2d394 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -4568,6 +4568,30 @@ id id bbb iddqd val1 drop view v2; drop table t1,t2; # +# MDEV-3914: Wrong result (NULLs instead of real values) +# with INNER and RIGHT JOIN in a FROM subquery, derived_merge=on +# (fix of above MDEV-486 fix) +# +SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (5),(6); +SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias; +c +5 +6 +SET optimizer_switch = 'derived_merge=off'; +SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias; +c +5 +6 +SET optimizer_switch=@save_optimizer_switch_MDEV_3914; +drop table t1,t2,t3; +# # MDEV-589 (LP BUG#1007647) : # Assertion `vcol_table == 0 || vcol_table == table' failed in # fill_record(THD*, List&, List&, bool) diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 3bed7d5dd93..5f3bf031f8c 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -4504,6 +4504,32 @@ select t1.*, v2.* from t1 left join v2 on t1.id = v2.id; drop view v2; drop table t1,t2; +--echo # +--echo # MDEV-3914: Wrong result (NULLs instead of real values) +--echo # with INNER and RIGHT JOIN in a FROM subquery, derived_merge=on +--echo # (fix of above MDEV-486 fix) +--echo # +SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); + +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (5),(6); + +SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias; + +SET optimizer_switch = 'derived_merge=off'; + +SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias; + +SET optimizer_switch=@save_optimizer_switch_MDEV_3914; +drop table t1,t2,t3; + --echo # --echo # MDEV-589 (LP BUG#1007647) : --echo # Assertion `vcol_table == 0 || vcol_table == table' failed in diff --git a/sql/table.cc b/sql/table.cc index d42fd14120c..abdd0b0f9e6 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4457,19 +4457,33 @@ TABLE *TABLE_LIST::get_real_join_table() DBUG_ASSERT(tbl->derived == NULL || tbl->derived->first_select()->next_select() == NULL); - if (tbl->table) - table= tbl->table; - tbl= (tbl->view != NULL ? - tbl->view->select_lex.get_table_list() : - tbl->derived->first_select()->get_table_list()); - - /* find left table in outer join on this level */ - while(tbl->outer_join & JOIN_TYPE_RIGHT) { - DBUG_ASSERT(tbl->next_local); - tbl= tbl->next_local; + List_iterator_fast ti; + { + List_iterator_fast + ti(tbl->view != NULL ? + tbl->view->select_lex.top_join_list : + tbl->derived->first_select()->top_join_list); + for (;;) + { + tbl= NULL; + /* + Find left table in outer join on this level + (the list is reverted). + */ + for (TABLE_LIST *t= ti++; t; t= ti++) + tbl= t; + /* + It is impossible that the list is empty + so tbl can't be NULL after above loop. + */ + if (!tbl->nested_join) + break; + /* go deeper if we've found nested join */ + ti= tbl->nested_join->join_list; + } + } } - } return tbl->table; From c4b35f92798f8612edc2d197ecf8a283a9269436 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 6 Dec 2012 00:37:06 +0100 Subject: [PATCH 275/349] MDEV-3918: myisamchk bogus error for files larger than 4GB. The failure is caused by failing stat() call . C Runtime function stat() uses old struct with 32bit st_size member, and since Visual Studio 2010 , it returns an error on st_size overflow (i.e on files larger than 4GB) Fix replaces stat() by my_stat(), the later is backed by 64bit-able stat64(). --- mysys/my_redel.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mysys/my_redel.c b/mysys/my_redel.c index e06511542a3..b048c24d942 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -89,15 +89,11 @@ end: int my_copystat(const char *from, const char *to, int MyFlags) { - struct stat statbuf; + MY_STAT statbuf; - if (stat(from, &statbuf)) - { - my_errno=errno; - if (MyFlags & (MY_FAE+MY_WME)) - my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),from,errno); + if (my_stat(from, &statbuf, MyFlags) == NULL) return -1; /* Can't get stat on input file */ - } + if ((statbuf.st_mode & S_IFMT) != S_IFREG) return 1; From d8876ff2fb2fac75a23678bd5b251780c66756a1 Mon Sep 17 00:00:00 2001 From: Harin Vadodaria Date: Thu, 6 Dec 2012 17:02:09 +0530 Subject: [PATCH 276/349] Bug#15912213: BUFFER OVERFLOW IN ACL_GET() Description: A very large database name causes buffer overflow in functions acl_get() and check_grant_db() in sql_acl.cc. It happens due to an unguarded string copy operation. This puts required sanity checks before copying db string to destination buffer. --- sql/sql_acl.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index d99ca3ceb99..fdd9b107bf2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1581,11 +1581,20 @@ ulong acl_get(const char *host, const char *ip, { ulong host_access= ~(ulong)0, db_access= 0; uint i; - size_t key_length; + size_t key_length, copy_length; char key[ACL_KEY_LENGTH],*tmp_db,*end; acl_entry *entry; DBUG_ENTER("acl_get"); + copy_length= (size_t) (strlen(ip ? ip : "") + + strlen(user ? user : "") + + strlen(db ? db : "")); + /* + Make sure that strmov() operations do not result in buffer overflow. + */ + if (copy_length >= ACL_KEY_LENGTH) + DBUG_RETURN(0); + mysql_mutex_lock(&acl_cache->lock); end=strmov((tmp_db=strmov(strmov(key, ip ? ip : "")+1,user)+1),db); if (lower_case_table_names) @@ -4942,6 +4951,16 @@ bool check_grant_db(THD *thd,const char *db) char helping [NAME_LEN+USERNAME_LENGTH+2]; uint len; bool error= TRUE; + size_t copy_length; + + copy_length= (size_t) (strlen(sctx->priv_user ? sctx->priv_user : "") + + strlen(db ? db : "")); + + /* + Make sure that strmov() operations do not result in buffer overflow. + */ + if (copy_length >= (NAME_LEN+USERNAME_LENGTH+2)) + return 1; len= (uint) (strmov(strmov(helping, sctx->priv_user) + 1, db) - helping) + 1; From d07b5f1ca295d4eb6eeba0b88c93f04e9e21cb5c Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Fri, 7 Dec 2012 10:47:57 +0100 Subject: [PATCH 277/349] Last-minute fix to 5.1.67, taking a change done to main 5.1 by Dmitri Lenev. This is the original comment: > committer: Dmitry Lenev > branch nick: mysql-5.1-15954896 > timestamp: Wed 2012-12-05 19:26:56 +0400 > message: > Bug #15954896 "SP, MULTI-TABLE DELETE AND LONG ALIAS". Using too long table aliases in stored routines might have caused server crashes. Code in sp_head::merge_table_list() which is responsible for collecting information about tables used in stored routine was not aware of the fact that table alias might have arbitrary length. I.e. it assumed that table alias can't be longer than NAME_LEN bytes and allocated buffer for a key identifying table accordingly. This patch fixes the issue by ensuring that we use dynamically allocated buffer for table key when table alias is too long. By default stack based buffer is used in which NAME_LEN bytes are reserved for table alias. --- sql/sp_head.cc | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 7eef9f5ab28..054fc5e223e 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -3839,8 +3839,6 @@ typedef struct st_sp_table Multi-set key: db_name\0table_name\0alias\0 - for normal tables db_name\0table_name\0 - for temporary tables - Note that in both cases we don't take last '\0' into account when - we count length of key. */ LEX_STRING qname; uint db_length, table_name_length; @@ -3897,19 +3895,26 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) for (; table ; table= table->next_global) if (!table->derived && !table->schema_table) { - char tname[(NAME_LEN + 1) * 3]; // db\0table\0alias\0 - uint tlen, alen; + /* + Structure of key for the multi-set is "db\0table\0alias\0". + Since "alias" part can have arbitrary length we use String + object to construct the key. By default String will use + buffer allocated on stack with NAME_LEN bytes reserved for + alias, since in most cases it is going to be smaller than + NAME_LEN bytes. + */ + char tname_buff[(NAME_LEN + 1) * 3]; + String tname(tname_buff, sizeof(tname_buff), &my_charset_bin); + uint temp_table_key_length; - tlen= table->db_length; - memcpy(tname, table->db, tlen); - tname[tlen++]= '\0'; - memcpy(tname+tlen, table->table_name, table->table_name_length); - tlen+= table->table_name_length; - tname[tlen++]= '\0'; - alen= strlen(table->alias); - memcpy(tname+tlen, table->alias, alen); - tlen+= alen; - tname[tlen]= '\0'; + tname.length(0); + tname.append(table->db, table->db_length); + tname.append('\0'); + tname.append(table->table_name, table->table_name_length); + tname.append('\0'); + temp_table_key_length= tname.length(); + tname.append(table->alias); + tname.append('\0'); /* Upgrade the lock type because this table list will be used @@ -3924,9 +3929,10 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) (and therefore should not be prelocked). Otherwise we will erroneously treat table with same name but with different alias as non-temporary. */ - if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) || - ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, - tlen - alen - 1)) && + if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(), + tname.length())) || + ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(), + temp_table_key_length)) && tab->temp)) { if (tab->lock_type < table->lock_type) @@ -3945,11 +3951,11 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE) { tab->temp= TRUE; - tab->qname.length= tlen - alen - 1; + tab->qname.length= temp_table_key_length; } else - tab->qname.length= tlen; - tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1); + tab->qname.length= tname.length(); + tab->qname.str= (char*) thd->memdup(tname.ptr(), tab->qname.length); if (!tab->qname.str) return FALSE; tab->table_name_length= table->table_name_length; @@ -4018,7 +4024,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * stab->lock_count)) || !(key_buff= (char*)thd->memdup(stab->qname.str, - stab->qname.length + 1))) + stab->qname.length))) DBUG_RETURN(FALSE); for (uint j= 0; j < stab->lock_count; j++) From e06cd80415dddc8a52b64aadc2ddc16c994a61b3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Dec 2012 19:10:20 +0530 Subject: [PATCH 278/349] From 14ba37f76f87cc48cae62eb6bdf3cda294dff78d Mon Sep 17 00:00:00 2001 From: Dmitry Lenev Date: Mon, 10 Dec 2012 10:06:37 +0400 Subject: [PATCH 279/349] Bug #15954896 "SP, MULTI-TABLE DELETE AND LONG ALIAS". Using too long table aliases in stored routines might have caused server crashes. Code in sp_head::merge_table_list() which is responsible for collecting information about tables used in stored routine was not aware of the fact that table alias might have arbitrary length. I.e. it assumed that table alias can't be longer than NAME_LEN bytes and allocated buffer for a key identifying table accordingly. This patch fixes the issue by ensuring that we use dynamically allocated buffer for table key when table alias is too long. By default stack based buffer is used in which NAME_LEN bytes are reserved for table alias. --- sql/sp_head.cc | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 09795156102..f20c205886d 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -4022,8 +4022,6 @@ typedef struct st_sp_table Multi-set key: db_name\0table_name\0alias\0 - for normal tables db_name\0table_name\0 - for temporary tables - Note that in both cases we don't take last '\0' into account when - we count length of key. */ LEX_STRING qname; uint db_length, table_name_length; @@ -4080,19 +4078,26 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) for (; table ; table= table->next_global) if (!table->derived && !table->schema_table) { - char tname[(NAME_LEN + 1) * 3]; // db\0table\0alias\0 - uint tlen, alen; + /* + Structure of key for the multi-set is "db\0table\0alias\0". + Since "alias" part can have arbitrary length we use String + object to construct the key. By default String will use + buffer allocated on stack with NAME_LEN bytes reserved for + alias, since in most cases it is going to be smaller than + NAME_LEN bytes. + */ + char tname_buff[(NAME_LEN + 1) * 3]; + String tname(tname_buff, sizeof(tname_buff), &my_charset_bin); + uint temp_table_key_length; - tlen= table->db_length; - memcpy(tname, table->db, tlen); - tname[tlen++]= '\0'; - memcpy(tname+tlen, table->table_name, table->table_name_length); - tlen+= table->table_name_length; - tname[tlen++]= '\0'; - alen= strlen(table->alias); - memcpy(tname+tlen, table->alias, alen); - tlen+= alen; - tname[tlen]= '\0'; + tname.length(0); + tname.append(table->db, table->db_length); + tname.append('\0'); + tname.append(table->table_name, table->table_name_length); + tname.append('\0'); + temp_table_key_length= tname.length(); + tname.append(table->alias); + tname.append('\0'); /* Upgrade the lock type because this table list will be used @@ -4107,9 +4112,10 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) (and therefore should not be prelocked). Otherwise we will erroneously treat table with same name but with different alias as non-temporary. */ - if ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname, tlen)) || - ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname, - tlen - alen - 1)) && + if ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname.ptr(), + tname.length())) || + ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname.ptr(), + temp_table_key_length)) && tab->temp)) { if (tab->lock_type < table->lock_type) @@ -4128,11 +4134,11 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE) { tab->temp= TRUE; - tab->qname.length= tlen - alen - 1; + tab->qname.length= temp_table_key_length; } else - tab->qname.length= tlen; - tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1); + tab->qname.length= tname.length(); + tab->qname.str= (char*) thd->memdup(tname.ptr(), tab->qname.length); if (!tab->qname.str) return FALSE; tab->table_name_length= table->table_name_length; @@ -4201,7 +4207,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * stab->lock_count)) || !(key_buff= (char*)thd->memdup(stab->qname.str, - stab->qname.length + 1))) + stab->qname.length))) DBUG_RETURN(FALSE); for (uint j= 0; j < stab->lock_count; j++) From 532d9c30283db4a35d92e40f3df9f4e7f86d45c6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 11 Dec 2012 09:50:48 +0100 Subject: [PATCH 280/349] one-byte overflow with old passwords --- sql-common/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-common/client.c b/sql-common/client.c index b37b63aaaf1..d9444a7d976 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -3934,8 +3934,8 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) return CR_SERVER_HANDSHAKE_ERR; /* save it in MYSQL */ - memcpy(mysql->scramble, pkt, pkt_len); - mysql->scramble[pkt_len] = 0; + memcpy(mysql->scramble, pkt, pkt_len - 1); + mysql->scramble[pkt_len - 1] = 0; } if (mysql->passwd[0]) From e99aa91e90adfd54cc1f460dd8cdd19614f30abc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Dec 2012 15:56:57 +0200 Subject: [PATCH 281/349] MDEV-3928: Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery Analysis: The following call stack shows that it is possible to set Item_cache::value_cached, and the relevant value without setting Item_cache::example. #0 Item_cache_temporal::store_packed at item.cc:8395 #1 get_datetime_value at item_cmpfunc.cc:915 #2 resolve_const_item at item.cc:7987 #3 propagate_cond_constants at sql_select.cc:12264 #4 propagate_cond_constants at sql_select.cc:12227 #5 optimize_cond at sql_select.cc:13026 #6 JOIN::optimize at sql_select.cc:1016 #7 st_select_lex::optimize_unflattened_subqueries at sql_lex.cc:3161 #8 JOIN::optimize_unflattened_subqueries at opt_subselect.cc:4880 #9 JOIN::optimize at sql_select.cc:1554 The fix is to set Item_cache_temporal::example even when the value is set directly by Item_cache_temporal::store_packed. This makes the Item_cache_temporal object consistent. --- mysql-test/r/subselect4.result | 26 ++++++++++++++++++++++++++ mysql-test/t/subselect4.test | 28 ++++++++++++++++++++++++++++ sql/item.cc | 3 ++- sql/item.h | 4 ++-- sql/item_cmpfunc.cc | 2 +- 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 2b173dbd208..bd64aca7d95 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -2279,5 +2279,31 @@ MAX(a) bb NULL NULL drop table t1, t2; set optimizer_switch=@subselect4_tmp; +# +# MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery +# +CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38'); +CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8, '06:17:39'); +CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02'); +EXPLAIN +SELECT * FROM t1 WHERE a1 IN ( +SELECT a2 FROM t2 WHERE a2 IN ( +SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 +) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 system NULL NULL NULL NULL 1 +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +SELECT * FROM t1 WHERE a1 IN ( +SELECT a2 FROM t2 WHERE a2 IN ( +SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 +) +); +a1 b1 +drop table t1, t2, t3; SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index c9fe4f3d3d5..5e1f3db2f4a 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -1858,5 +1858,33 @@ drop table t1, t2; set optimizer_switch=@subselect4_tmp; +--echo # +--echo # MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery +--echo # + +CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38'); + +CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8, '06:17:39'); + +CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02'); + +EXPLAIN +SELECT * FROM t1 WHERE a1 IN ( + SELECT a2 FROM t2 WHERE a2 IN ( + SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 + ) +); + +SELECT * FROM t1 WHERE a1 IN ( + SELECT a2 FROM t2 WHERE a2 IN ( + SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 + ) +); + +drop table t1, t2, t3; + SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; diff --git a/sql/item.cc b/sql/item.cc index 98c27266415..16dbd011f22 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -8388,9 +8388,10 @@ int Item_cache_temporal::save_in_field(Field *field, bool no_conversions) } -void Item_cache_temporal::store_packed(longlong val_arg) +void Item_cache_temporal::store_packed(longlong val_arg, Item *example) { /* An explicit values is given, save it. */ + store(example); value_cached= true; value= val_arg; null_value= false; diff --git a/sql/item.h b/sql/item.h index 6324e900f24..0852287cc7f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -3799,7 +3799,7 @@ public: bool cache_value(); bool get_date(MYSQL_TIME *ltime, uint fuzzydate); int save_in_field(Field *field, bool no_conversions); - void store_packed(longlong val_arg); + void store_packed(longlong val_arg, Item *example); /* Having a clone_item method tells optimizer that this object is a constant and need not be optimized further. @@ -3808,7 +3808,7 @@ public: Item *clone_item() { Item_cache_temporal *item= new Item_cache_temporal(cached_field_type); - item->store_packed(value); + item->store_packed(value, example); return item; } }; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index fed246ef812..b3b20a55ed9 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -912,7 +912,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, if (save_arena) thd->set_query_arena(save_arena); - cache->store_packed(value); + cache->store_packed(value, item); *cache_arg= cache; *item_arg= cache_arg; } From 7885b38cbb22df3c2d22a57ecb8993d540a36652 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 21 Dec 2012 15:17:26 +0100 Subject: [PATCH 282/349] Support VS2012. Exclude compiler-defined symbols from being exported by mysqld.exe --- win/create_def_file.js | 1 + 1 file changed, 1 insertion(+) diff --git a/win/create_def_file.js b/win/create_def_file.js index b6946ac85f1..79ccf1ba817 100644 --- a/win/create_def_file.js +++ b/win/create_def_file.js @@ -169,6 +169,7 @@ function ScrubSymbol(symbol) function IsCompilerDefinedSymbol(symbol) { return ((symbol.indexOf("__real@") != -1) || + (symbol.indexOf("_xmm@") != -1) || (symbol.indexOf("_RTC_") != -1) || (symbol.indexOf("??_C@_") != -1) || (symbol.indexOf("??_R") != -1) || From 6f26aac9409e3456798e58a4ee4306e43c7ebf7b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Dec 2012 14:41:46 +0200 Subject: [PATCH 283/349] MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery from a MERGE view. The problem was in the lost ability to be null for the table of a left join if it is a view/derived table. It hapenned because setup_table_map(), was called earlier then we merged the view or derived. Fixed by propagating new maybe_null flag during Item::update_used_tables(). Change in join_outer.test and join_outer_jcl6.test appeared because IS NULL reported no used tables (i.e. constant) for argument which could not be NULL and new maybe_null flag was propagated for IS NULL argument (Item_field) because table the Item_field belonged to changed its maybe_null status. --- mysql-test/r/derived_view.result | 49 +++++++++++++++++++++++ mysql-test/r/join_outer.result | 8 ++-- mysql-test/r/join_outer_jcl6.result | 8 ++-- mysql-test/r/view.result | 17 ++++++++ mysql-test/t/derived_view.test | 61 +++++++++++++++++++++++++++++ mysql-test/t/view.test | 21 ++++++++++ sql/item.cc | 11 +++++- sql/item.h | 16 ++++++-- sql/item_cmpfunc.cc | 20 ++++++---- sql/item_cmpfunc.h | 28 +++++++++++-- sql/item_func.cc | 25 ++++++------ sql/item_func.h | 48 ++++++++++++++--------- sql/item_geofunc.cc | 4 +- sql/item_geofunc.h | 30 +++++++------- sql/item_strfunc.cc | 26 ++++++------ sql/item_strfunc.h | 28 +++++++------ sql/item_timefunc.cc | 10 ++--- sql/item_timefunc.h | 40 +++++++++---------- sql/item_xmlfunc.cc | 1 + sql/item_xmlfunc.h | 8 +--- 20 files changed, 331 insertions(+), 128 deletions(-) diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index a4f7a71dcb5..030b8798fad 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2105,6 +2105,55 @@ a 4 drop table t1,t2; # +# MDEV-3873: Wrong result (extra rows) with NOT IN and +# a subquery from a MERGE view +# +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(7),(0); +CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t3 VALUES (4),(6),(3); +CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t4 VALUES (4),(5),(3); +CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM; +INSERT INTO tv VALUES (1),(3); +CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv; +CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b; +a b +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b; +a b +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b; +a b +drop view v_temptable, v_merge; +drop table t1,t2,t3,t4,tv; +# +# MDEV-3912: Wrong result (extra rows) with FROM subquery inside +# ALL subquery, LEFT JOIN, derived_merge. +# (duplicate of MDEV-3873 (above)) +# +SET @save3912_optimizer_switch=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on,in_to_exists=on'; +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(8); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7),(0); +CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t3 VALUES (0,4),(8,6); +SELECT * FROM t1 +WHERE a >= ALL ( +SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b ) +WHERE b >= a +); +a +8 +set optimizer_switch=@save3912_optimizer_switch; +drop table t1, t2, t3; +# # end of 5.3 tests # set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 17bc705b4f3..4541cdbc752 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1770,10 +1770,10 @@ SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where ((((1 between 5 and 6) and isnull(5)) or 1)) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; @@ -1809,10 +1809,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 981e8002ea0..3272186d12f 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -1781,10 +1781,10 @@ SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where ((((1 between 5 and 6) and isnull(5)) or 1)) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; @@ -1820,10 +1820,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 74c36a2d394..4172c1620bd 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -4634,6 +4634,23 @@ f2 f1 7 NULL 8 NULL drop tables t1,t2; +# +# MDEV-3876 Wrong result (extra rows) with ALL subquery +# from a MERGE view (duplicate of MDEV-3873) +# +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(3); +CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2; +SELECT a FROM t1 AS alias +WHERE a >= ALL ( +SELECT b FROM t1 LEFT JOIN v1 ON (a = b) +WHERE a = alias.a ); +a +1 +drop view v1; +drop table t1,t2; # ----------------------------------------------------------------- # -- End of 5.3 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index 30811be2934..c7705294ef2 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1450,6 +1450,67 @@ INSERT INTO t1 SELECT * FROM ( SELECT * FROM t1 ) AS alias UNION SELECT * FROM t select * from t1; drop table t1,t2; +--echo # +--echo # MDEV-3873: Wrong result (extra rows) with NOT IN and +--echo # a subquery from a MERGE view +--echo # + +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(7),(0); + +CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); + +CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t3 VALUES (4),(6),(3); + +CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t4 VALUES (4),(5),(3); + +CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM; +INSERT INTO tv VALUES (1),(3); + +CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv; +CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; + +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b; + +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b; + +SELECT * FROM t1, t2 +WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b; + +drop view v_temptable, v_merge; +drop table t1,t2,t3,t4,tv; + +--echo # +--echo # MDEV-3912: Wrong result (extra rows) with FROM subquery inside +--echo # ALL subquery, LEFT JOIN, derived_merge. +--echo # (duplicate of MDEV-3873 (above)) +--echo # + +SET @save3912_optimizer_switch=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on,in_to_exists=on'; + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(8); + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7),(0); + +CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t3 VALUES (0,4),(8,6); + +SELECT * FROM t1 +WHERE a >= ALL ( +SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b ) +WHERE b >= a +); +set optimizer_switch=@save3912_optimizer_switch; +drop table t1, t2, t3; + --echo # --echo # end of 5.3 tests --echo # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 5f3bf031f8c..2a230e65493 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -4575,6 +4575,27 @@ SELECT * FROM ( drop tables t1,t2; +--echo # +--echo # MDEV-3876 Wrong result (extra rows) with ALL subquery +--echo # from a MERGE view (duplicate of MDEV-3873) +--echo # + +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(3); + +CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2; + +SELECT a FROM t1 AS alias +WHERE a >= ALL ( +SELECT b FROM t1 LEFT JOIN v1 ON (a = b) +WHERE a = alias.a ); + +drop view v1; +drop table t1,t2; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.3 tests. --echo # ----------------------------------------------------------------- diff --git a/sql/item.cc b/sql/item.cc index 16dbd011f22..aee35b611e7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9166,11 +9166,18 @@ table_map Item_ref::used_tables() const void Item_ref::update_used_tables() -{ +{ if (!get_depended_from()) - (*ref)->update_used_tables(); + (*ref)->update_used_tables(); + maybe_null= (*ref)->maybe_null; } +void Item_direct_view_ref::update_used_tables() +{ + Item_ref::update_used_tables(); + if (view->table && view->table->maybe_null) + maybe_null= TRUE; +} table_map Item_direct_view_ref::used_tables() const { diff --git a/sql/item.h b/sql/item.h index 0852287cc7f..2b5e867feb7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1849,9 +1849,14 @@ public: bitmap_fast_test_and_set(tab->read_set, field->field_index); if (field->vcol_info) tab->mark_virtual_col(field); - } + } + } + void update_used_tables() + { + update_table_bitmaps(); + if (field && field->table) + maybe_null= field->maybe_null(); } - void update_used_tables() { update_table_bitmaps(); } Item *get_tmp_table_item(THD *thd); bool collect_item_field_processor(uchar * arg); bool add_field_to_set_processor(uchar * arg); @@ -2874,7 +2879,11 @@ public: enum Item_result result_type () const { return orig_item->result_type(); } enum_field_types field_type() const { return orig_item->field_type(); } table_map used_tables() const { return orig_item->used_tables(); } - void update_used_tables() { orig_item->update_used_tables(); } + void update_used_tables() + { + orig_item->update_used_tables(); + maybe_null= orig_item->maybe_null; + } bool const_item() const { return orig_item->const_item(); } table_map not_null_tables() const { return orig_item->not_null_tables(); } bool walk(Item_processor processor, bool walk_subquery, uchar *arg) @@ -2966,6 +2975,7 @@ public: Item *replace_equal_field(uchar *arg); table_map used_tables() const; table_map not_null_tables() const; + void update_used_tables(); bool walk(Item_processor processor, bool walk_subquery, uchar *arg) { return (*ref)->walk(processor, walk_subquery, arg) || diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index b3b20a55ed9..75d3f31d4cd 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1351,7 +1351,7 @@ int Arg_comparator::compare_e_row() void Item_func_truth::fix_length_and_dec() { - maybe_null= 0; + set_persist_maybe_null(0); null_value= 0; decimals= 0; max_length= 1; @@ -1859,7 +1859,8 @@ longlong Item_func_eq::val_int() void Item_func_equal::fix_length_and_dec() { Item_bool_func2::fix_length_and_dec(); - maybe_null=null_value=0; + set_persist_maybe_null(0); + null_value= 0; } longlong Item_func_equal::val_int() @@ -1999,7 +2000,7 @@ void Item_func_interval::fix_length_and_dec() } } } - maybe_null= 0; + set_persist_maybe_null(0); max_length= 2; used_tables_cache|= row->used_tables(); not_null_tables_cache= row->not_null_tables(); @@ -2670,7 +2671,7 @@ void Item_func_nullif::fix_length_and_dec() { Item_bool_func2::fix_length_and_dec(); - maybe_null=1; + set_persist_maybe_null(1); if (args[0]) // Only false if EOM { max_length=args[0]->max_length; @@ -4465,6 +4466,8 @@ void Item_cond::update_used_tables() item->update_used_tables(); used_tables_cache|= item->used_tables(); const_item_cache&= item->const_item(); + if (!persistent_maybe_null && item->maybe_null) + maybe_null= 1; } } @@ -4639,10 +4642,9 @@ longlong Item_is_not_null_test::val_int() */ void Item_is_not_null_test::update_used_tables() { + args[0]->update_used_tables(); if (!args[0]->maybe_null) used_tables_cache= 0; /* is always true */ - else - args[0]->update_used_tables(); } @@ -4925,7 +4927,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref) int comp_res= regcomp(TRUE); if (comp_res == -1) { // Will always return NULL - maybe_null=1; + set_persist_maybe_null(1); fixed= 1; return FALSE; } @@ -4935,7 +4937,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref) maybe_null= args[0]->maybe_null; } else - maybe_null=1; + set_persist_maybe_null(1); fixed= 1; return FALSE; } @@ -5729,6 +5731,8 @@ void Item_equal::update_used_tables() item->update_used_tables(); used_tables_cache|= item->used_tables(); const_item_cache&= item->const_item(); + if (!persistent_maybe_null && item->maybe_null) + maybe_null= 1; } } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 143fef87abd..dca139e6321 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -757,6 +757,11 @@ public: my_decimal *decimal_op(my_decimal *); enum_field_types field_type() const; void fix_length_and_dec(); + void update_used_tables() + { + Item_func_coalesce::update_used_tables(); + maybe_null= args[1]->maybe_null; + } const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); uint decimal_precision() const; @@ -779,6 +784,11 @@ public: enum_field_types field_type() const { return cached_field_type; } bool fix_fields(THD *, Item **); void fix_length_and_dec(); + void update_used_tables() + { + Item_func::update_used_tables(); + maybe_null= args[1]->maybe_null || args[2]->maybe_null; + } uint decimal_precision() const; const char *func_name() const { return "if"; } bool eval_not_null_tables(uchar *opt_arg); @@ -1242,6 +1252,12 @@ public: my_decimal *val_decimal(my_decimal *); bool fix_fields(THD *thd, Item **ref); void fix_length_and_dec(); + void update_used_tables() + { + Item_func::update_used_tables(); + if (else_expr_num == -1 || args[else_expr_num]->maybe_null) + maybe_null= 1; + } uint decimal_precision() const; table_map not_null_tables() const { return 0; } enum Item_result result_type () const { return cached_result_type; } @@ -1363,13 +1379,14 @@ public: enum Functype functype() const { return ISNULL_FUNC; } void fix_length_and_dec() { - decimals=0; max_length=1; maybe_null=0; + decimals=0; max_length=1; set_persist_maybe_null(0); update_used_tables(); } const char *func_name() const { return "isnull"; } /* Optimize case of not_null_column IS NULL */ virtual void update_used_tables() { + args[0]->update_used_tables(); if (!args[0]->maybe_null) { used_tables_cache= 0; /* is always false */ @@ -1377,7 +1394,6 @@ public: } else { - args[0]->update_used_tables(); used_tables_cache= args[0]->used_tables(); const_item_cache= args[0]->const_item(); } @@ -1424,7 +1440,7 @@ public: enum Functype functype() const { return ISNOTNULL_FUNC; } void fix_length_and_dec() { - decimals=0; max_length=1; maybe_null=0; + decimals=0; max_length=1; set_persist_maybe_null(0); } const char *func_name() const { return "isnotnull"; } optimize_type select_optimize() const { return OPTIMIZE_NULL; } @@ -1495,6 +1511,12 @@ public: void cleanup(); longlong val_int(); bool fix_fields(THD *thd, Item **ref); + void update_used_tables() + { + Item_bool_func::update_used_tables(); + if (regex_is_const) + maybe_null= 1; + } const char *func_name() const { return "regexp"; } virtual inline void print(String *str, enum_query_type query_type) diff --git a/sql/item_func.cc b/sql/item_func.cc index 42332d6b1b2..0cd96619023 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -86,7 +86,7 @@ void Item_func::set_arguments(List &list) } Item_func::Item_func(List &list) - :allowed_arg_cols(1) + :allowed_arg_cols(1), persistent_maybe_null(0) { set_arguments(list); } @@ -94,6 +94,7 @@ Item_func::Item_func(List &list) Item_func::Item_func(THD *thd, Item_func *item) :Item_result_field(thd, item), allowed_arg_cols(item->allowed_arg_cols), + persistent_maybe_null(0), arg_count(item->arg_count), used_tables_cache(item->used_tables_cache), not_null_tables_cache(item->not_null_tables_cache), @@ -423,6 +424,8 @@ void Item_func::update_used_tables() args[i]->update_used_tables(); used_tables_cache|=args[i]->used_tables(); const_item_cache&=args[i]->const_item(); + if (!persistent_maybe_null && args[i]->maybe_null) + maybe_null= 1; } } @@ -1496,7 +1499,7 @@ void Item_func_div::fix_length_and_dec() case IMPOSSIBLE_RESULT: DBUG_ASSERT(0); } - maybe_null= 1; // devision by zero + set_persist_maybe_null(1); // devision by zero DBUG_VOID_RETURN; } @@ -1531,7 +1534,7 @@ void Item_func_int_div::fix_length_and_dec() max_length=args[0]->max_length - (argtype == DECIMAL_RESULT || argtype == INT_RESULT ? args[0]->decimals : 0); - maybe_null=1; + set_persist_maybe_null(1); unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag; } @@ -1612,7 +1615,7 @@ void Item_func_mod::result_precision() void Item_func_mod::fix_length_and_dec() { Item_num_op::fix_length_and_dec(); - maybe_null= 1; + set_persist_maybe_null(1); unsigned_flag= args[0]->unsigned_flag; } @@ -2778,7 +2781,7 @@ longlong Item_func_field::val_int() void Item_func_field::fix_length_and_dec() { - maybe_null=0; max_length=3; + set_persist_maybe_null(0); max_length=3; cmp_type= args[0]->result_type(); for (uint i=1; i < arg_count ; i++) cmp_type= item_cmp_type(cmp_type, args[i]->result_type()); @@ -4843,7 +4846,7 @@ void Item_func_get_user_var::fix_length_and_dec() { THD *thd=current_thd; int error; - maybe_null=1; + set_persist_maybe_null(1); decimals=NOT_FIXED_DEC; max_length=MAX_BLOB_WIDTH; @@ -5049,7 +5052,7 @@ void Item_func_get_system_var::update_null_value() void Item_func_get_system_var::fix_length_and_dec() { char *cptr; - maybe_null= TRUE; + set_persist_maybe_null(1); max_length= 0; if (var->check_type(var_type)) @@ -5580,7 +5583,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref) DBUG_ASSERT(fixed == 0); Item *UNINIT_VAR(item); // Safe as arg_count is > 1 - maybe_null=1; + set_persist_maybe_null(1); join_key=0; /* @@ -5914,7 +5917,7 @@ longlong Item_func_row_count::val_int() Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name) :Item_func(), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL) { - maybe_null= 1; + set_persist_maybe_null(1); m_name->init_qname(current_thd); dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE)); dummy_table->s= (TABLE_SHARE*) (dummy_table+1); @@ -5925,7 +5928,7 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name, List &list) :Item_func(list), context(context_arg), m_name(name), m_sp(NULL),sp_result_field(NULL) { - maybe_null= 1; + set_persist_maybe_null(1); m_name->init_qname(current_thd); dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE)); dummy_table->s= (TABLE_SHARE*) (dummy_table+1); @@ -6066,7 +6069,7 @@ void Item_func_sp::fix_length_and_dec() decimals= sp_result_field->decimals(); max_length= sp_result_field->field_length; collation.set(sp_result_field->charset()); - maybe_null= 1; + set_persist_maybe_null(1); unsigned_flag= test(sp_result_field->flags & UNSIGNED_FLAG); DBUG_VOID_RETURN; diff --git a/sql/item_func.h b/sql/item_func.h index 082c9b83296..3ab1fbad4e3 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -38,6 +38,8 @@ protected: 0 means get this number from first argument */ uint allowed_arg_cols; + /* maybe_null can't be changed by parameters or used table state */ + bool persistent_maybe_null; public: uint arg_count; table_map used_tables_cache, not_null_tables_cache; @@ -63,13 +65,13 @@ public: enum Type type() const { return FUNC_ITEM; } virtual enum Functype functype() const { return UNKNOWN_FUNC; } Item_func(void): - allowed_arg_cols(1), arg_count(0) + allowed_arg_cols(1), persistent_maybe_null(0), arg_count(0) { with_sum_func= 0; with_field= 0; } Item_func(Item *a): - allowed_arg_cols(1), arg_count(1) + allowed_arg_cols(1), persistent_maybe_null(0), arg_count(1) { args= tmp_arg; args[0]= a; @@ -77,7 +79,7 @@ public: with_field= a->with_field; } Item_func(Item *a,Item *b): - allowed_arg_cols(1), arg_count(2) + allowed_arg_cols(1), persistent_maybe_null(0), arg_count(2) { args= tmp_arg; args[0]= a; args[1]= b; @@ -85,7 +87,7 @@ public: with_field= a->with_field || b->with_field; } Item_func(Item *a,Item *b,Item *c): - allowed_arg_cols(1) + allowed_arg_cols(1), persistent_maybe_null(0) { arg_count= 0; if ((args= (Item**) sql_alloc(sizeof(Item*)*3))) @@ -97,7 +99,7 @@ public: } } Item_func(Item *a,Item *b,Item *c,Item *d): - allowed_arg_cols(1) + allowed_arg_cols(1), persistent_maybe_null(0) { arg_count= 0; if ((args= (Item**) sql_alloc(sizeof(Item*)*4))) @@ -111,7 +113,7 @@ public: } } Item_func(Item *a,Item *b,Item *c,Item *d,Item* e): - allowed_arg_cols(1) + allowed_arg_cols(1), persistent_maybe_null(0) { arg_count= 5; if ((args= (Item**) sql_alloc(sizeof(Item*)*5))) @@ -300,6 +302,11 @@ public: info.bool_function= &Item::restore_to_before_no_rows_in_result; walk(&Item::call_bool_func_processor, FALSE, (uchar*) &info); } + inline void set_persist_maybe_null(bool mb_null) + { + maybe_null= mb_null; + persistent_maybe_null= 1; + } }; @@ -506,7 +513,7 @@ public: } double val_real(); enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; } - void fix_length_and_dec() { maybe_null= 1; } + void fix_length_and_dec() { set_persist_maybe_null(1); } const char *func_name() const { return "double_typecast"; } virtual void print(String *str, enum_query_type query_type); }; @@ -647,7 +654,7 @@ class Item_dec_func :public Item_real_func void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); - maybe_null=1; + set_persist_maybe_null(1); } }; @@ -971,7 +978,7 @@ public: Item_func_coercibility(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "coercibility"; } - void fix_length_and_dec() { max_length=10; maybe_null= 0; } + void fix_length_and_dec() { max_length=10; set_persist_maybe_null(0); } table_map not_null_tables() const { return 0; } }; @@ -1132,7 +1139,7 @@ public: {} longlong val_int(); const char *func_name() const { return "benchmark"; } - void fix_length_and_dec() { max_length=1; maybe_null=0; } + void fix_length_and_dec() { max_length=1; set_persist_maybe_null(0); } virtual void print(String *str, enum_query_type query_type); bool check_vcol_func_processor(uchar *int_arg) { @@ -1385,7 +1392,7 @@ public: double val_real() { DBUG_ASSERT(fixed == 1); null_value= 1; return 0.0; } longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; } enum Item_result result_type () const { return STRING_RESULT; } - void fix_length_and_dec() { maybe_null=1; max_length=0; } + void fix_length_and_dec() { set_persist_maybe_null(1); max_length=0; } }; #endif /* HAVE_DLOPEN */ @@ -1406,7 +1413,7 @@ class Item_func_get_lock :public Item_int_func Item_func_get_lock(Item *a,Item *b) :Item_int_func(a,b) {} longlong val_int(); const char *func_name() const { return "get_lock"; } - void fix_length_and_dec() { max_length=1; maybe_null=1;} + void fix_length_and_dec() { max_length=1; set_persist_maybe_null(1);} bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); @@ -1420,7 +1427,7 @@ public: Item_func_release_lock(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "release_lock"; } - void fix_length_and_dec() { max_length=1; maybe_null=1;} + void fix_length_and_dec() { max_length=1; set_persist_maybe_null(1);} bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); @@ -1437,7 +1444,7 @@ public: Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {} longlong val_int(); const char *func_name() const { return "master_pos_wait"; } - void fix_length_and_dec() { max_length=21; maybe_null=1;} + void fix_length_and_dec() { max_length=21; set_persist_maybe_null(1);} bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); @@ -1653,7 +1660,8 @@ public: Item_func_inet_aton(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "inet_aton"; } - void fix_length_and_dec() { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;} + void fix_length_and_dec() + { decimals= 0; max_length= 21; set_persist_maybe_null(1); unsigned_flag= 1; } }; @@ -1722,7 +1730,8 @@ public: Item_func_is_free_lock(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "is_free_lock"; } - void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;} + void fix_length_and_dec() + { decimals= 0; max_length= 1; set_persist_maybe_null(1); } bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); @@ -1736,7 +1745,8 @@ public: Item_func_is_used_lock(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "is_used_lock"; } - void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;} + void fix_length_and_dec() + { decimals= 0; max_length= 10; set_persist_maybe_null(1);} bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); @@ -1759,7 +1769,7 @@ public: Item_func_row_count() :Item_int_func() {} longlong val_int(); const char *func_name() const { return "row_count"; } - void fix_length_and_dec() { decimals= 0; maybe_null=0; } + void fix_length_and_dec() { decimals= 0; set_persist_maybe_null(0); } bool check_vcol_func_processor(uchar *int_arg) { @@ -1893,7 +1903,7 @@ public: Item_func_found_rows() :Item_int_func() {} longlong val_int(); const char *func_name() const { return "found_rows"; } - void fix_length_and_dec() { decimals= 0; maybe_null=0; } + void fix_length_and_dec() { decimals= 0; set_persist_maybe_null(0); } bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 522be28558f..ba330ba3b96 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -52,7 +52,7 @@ void Item_geometry_func::fix_length_and_dec() collation.set(&my_charset_bin); decimals=0; max_length= (uint32) 4294967295U; - maybe_null= 1; + set_persist_maybe_null(1); } @@ -145,7 +145,7 @@ void Item_func_as_wkt::fix_length_and_dec() { collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); max_length=MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index d2030ee7bb9..eae6f425f4d 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -89,7 +89,7 @@ public: { // "GeometryCollection" is the longest max_length= 20; - maybe_null= 1; + set_persist_maybe_null(1); }; }; @@ -224,7 +224,7 @@ public: { Item_func::print(str, query_type); } - void fix_length_and_dec() { maybe_null= 1; } + void fix_length_and_dec() { set_persist_maybe_null(1); } bool is_null() { (void) val_int(); return null_value; } }; @@ -251,7 +251,7 @@ public: Item_func::print(str, query_type); } - void fix_length_and_dec() { maybe_null= 1; } + void fix_length_and_dec() { set_persist_maybe_null(1); } bool is_null() { (void) val_int(); return null_value; } }; @@ -342,7 +342,7 @@ public: longlong val_int(); optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "st_isempty"; } - void fix_length_and_dec() { maybe_null= 1; } + void fix_length_and_dec() { set_persist_maybe_null(1); } }; class Item_func_issimple: public Item_bool_func @@ -356,7 +356,7 @@ public: longlong val_int(); optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "st_issimple"; } - void fix_length_and_dec() { maybe_null= 1; } + void fix_length_and_dec() { set_persist_maybe_null(1); } }; class Item_func_isclosed: public Item_bool_func @@ -366,7 +366,7 @@ public: longlong val_int(); optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "st_isclosed"; } - void fix_length_and_dec() { maybe_null= 1; } + void fix_length_and_dec() { set_persist_maybe_null(1); } }; class Item_func_dimension: public Item_int_func @@ -376,7 +376,7 @@ public: Item_func_dimension(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "st_dimension"; } - void fix_length_and_dec() { max_length= 10; maybe_null= 1; } + void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); } }; class Item_func_x: public Item_real_func @@ -389,7 +389,7 @@ public: void fix_length_and_dec() { Item_real_func::fix_length_and_dec(); - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -404,7 +404,7 @@ public: void fix_length_and_dec() { Item_real_func::fix_length_and_dec(); - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -416,7 +416,7 @@ public: Item_func_numgeometries(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "st_numgeometries"; } - void fix_length_and_dec() { max_length= 10; maybe_null= 1; } + void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); } }; @@ -427,7 +427,7 @@ public: Item_func_numinteriorring(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "st_numinteriorrings"; } - void fix_length_and_dec() { max_length= 10; maybe_null= 1; } + void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); } }; @@ -438,7 +438,7 @@ public: Item_func_numpoints(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "st_numpoints"; } - void fix_length_and_dec() { max_length= 10; maybe_null= 1; } + void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); } }; @@ -452,7 +452,7 @@ public: void fix_length_and_dec() { Item_real_func::fix_length_and_dec(); - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -467,7 +467,7 @@ public: void fix_length_and_dec() { Item_real_func::fix_length_and_dec(); - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -479,7 +479,7 @@ public: Item_func_srid(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "srid"; } - void fix_length_and_dec() { max_length= 10; maybe_null= 1; } + void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); } }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 1b228a344f4..d0b284a363d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -272,7 +272,7 @@ String *Item_func_aes_decrypt::val_str(String *str) void Item_func_aes_decrypt::fix_length_and_dec() { max_length=args[0]->max_length; - maybe_null= 1; + set_persist_maybe_null(1); } @@ -435,7 +435,7 @@ void Item_func_concat::fix_length_and_dec() if (max_result_length >= MAX_BLOB_WIDTH) { max_result_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } max_length= (ulong) max_result_length; } @@ -795,7 +795,7 @@ void Item_func_concat_ws::fix_length_and_dec() if (max_result_length >= MAX_BLOB_WIDTH) { max_result_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } max_length= (ulong) max_result_length; } @@ -997,7 +997,7 @@ void Item_func_replace::fix_length_and_dec() if (max_result_length >= MAX_BLOB_WIDTH) { max_result_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } max_length= (ulong) max_result_length; @@ -1081,7 +1081,7 @@ void Item_func_insert::fix_length_and_dec() if (max_result_length >= MAX_BLOB_WIDTH) { max_result_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } max_length= (ulong) max_result_length; } @@ -2184,7 +2184,7 @@ void Item_func_elt::fix_length_and_dec() set_if_bigger(max_length,args[i]->max_length); set_if_bigger(decimals,args[i]->decimals); } - maybe_null=1; // NULL if wrong first arg + set_persist_maybe_null(1); // NULL if wrong first arg } @@ -2419,14 +2419,14 @@ void Item_func_repeat::fix_length_and_dec() if (max_result_length >= MAX_BLOB_WIDTH) { max_result_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } max_length= (ulong) max_result_length; } else { max_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } } @@ -2509,14 +2509,14 @@ void Item_func_rpad::fix_length_and_dec() if (length >= MAX_BLOB_WIDTH) { length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } max_length= (ulong) length; } else { max_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } } @@ -2626,14 +2626,14 @@ void Item_func_lpad::fix_length_and_dec() if (length >= MAX_BLOB_WIDTH) { length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } max_length= (ulong) length; } else { max_length= MAX_BLOB_WIDTH; - maybe_null= 1; + set_persist_maybe_null(1); } } @@ -3548,7 +3548,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref) void Item_func_dyncol_create::fix_length_and_dec() { - maybe_null= TRUE; + set_persist_maybe_null(1); collation.set(&my_charset_bin); decimals= 0; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index fc4e888e6ea..e3b040a2e55 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -319,7 +319,7 @@ public: String *val_str(String *); void fix_length_and_dec() { - maybe_null=1; + set_persist_maybe_null(1); /* 9 = MAX ((8- (arg_len % 8)) + 1) */ max_length = args[0]->max_length + 9; } @@ -335,7 +335,7 @@ public: String *val_str(String *); void fix_length_and_dec() { - maybe_null=1; + set_persist_maybe_null(1); /* 9 = MAX ((8- (arg_len % 8)) + 1) */ max_length = args[0]->max_length - 9; } @@ -361,7 +361,7 @@ public: constructor_helper(); } String *val_str(String *); - void fix_length_and_dec() { maybe_null=1; max_length = 13; } + void fix_length_and_dec() { set_persist_maybe_null(1); max_length = 13; } const char *func_name() const { return "encrypt"; } bool check_vcol_func_processor(uchar *int_arg) { @@ -431,7 +431,7 @@ public: void fix_length_and_dec() { max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen; - maybe_null=1; + set_persist_maybe_null(1); } const char *func_name() const { return "database"; } const char *fully_qualified_func_name() const { return "database()"; } @@ -607,7 +607,7 @@ public: { collation.set(default_charset()); max_length=64; - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -634,7 +634,7 @@ public: Item_func_unhex(Item *a) :Item_str_func(a) { /* there can be bad hex strings */ - maybe_null= 1; + set_persist_maybe_null(1); } const char *func_name() const { return "unhex"; } String *val_str(String *); @@ -680,7 +680,7 @@ public: void fix_length_and_dec() { collation.set(&my_charset_bin, DERIVATION_COERCIBLE); - maybe_null=1; + set_persist_maybe_null(1); max_length=MAX_BLOB_WIDTH; } bool check_vcol_func_processor(uchar *int_arg) @@ -713,7 +713,7 @@ public: { decimals= 0; max_length= 3 * 8 + 7; - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -804,7 +804,7 @@ public: { collation.set(system_charset_info); max_length= 64 * collation.collation->mbmaxlen; // should be enough - maybe_null= 0; + set_persist_maybe_null(0); }; table_map not_null_tables() const { return 0; } }; @@ -819,7 +819,7 @@ public: { collation.set(system_charset_info); max_length= 64 * collation.collation->mbmaxlen; // should be enough - maybe_null= 0; + set_persist_maybe_null(0); }; table_map not_null_tables() const { return 0; } }; @@ -865,7 +865,8 @@ class Item_func_uncompress: public Item_str_func String buffer; public: Item_func_uncompress(Item *a): Item_str_func(a){} - void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; } + void fix_length_and_dec() + { set_persist_maybe_null(1); max_length= MAX_BLOB_WIDTH; } const char *func_name() const{return "uncompress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION }; @@ -937,7 +938,7 @@ public: max_length= MAX_DYNAMIC_COLUMN_LENGTH; } void fix_length_and_dec() - { maybe_null= 1; } + { set_persist_maybe_null(1); } /* Mark that collation can change between calls */ bool dynamic_result() { return 1; } @@ -956,7 +957,8 @@ class Item_func_dyncol_list: public Item_str_func { public: Item_func_dyncol_list(Item *str) :Item_str_func(str) {}; - void fix_length_and_dec() { maybe_null= 1; max_length= MAX_BLOB_WIDTH; }; + void fix_length_and_dec() + { set_persist_maybe_null(1); max_length= MAX_BLOB_WIDTH; }; const char *func_name() const{ return "column_list"; } String *val_str(String *); }; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index bdad96f12ef..eaddd39fa58 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -877,7 +877,7 @@ void Item_func_monthname::fix_length_and_dec() collation.set(cs, DERIVATION_COERCIBLE, repertoire); decimals=0; max_length= locale->max_month_name_length * collation.collation->mbmaxlen; - maybe_null=1; + set_persist_maybe_null(1); } @@ -1030,7 +1030,7 @@ void Item_func_dayname::fix_length_and_dec() collation.set(cs, DERIVATION_COERCIBLE, repertoire); decimals=0; max_length= locale->max_day_name_length * collation.collation->mbmaxlen; - maybe_null=1; + set_persist_maybe_null(1); } @@ -1404,7 +1404,7 @@ void Item_func_curdate::fix_length_and_dec() ltime.hour= ltime.minute= ltime.second= 0; ltime.time_type= MYSQL_TIMESTAMP_DATE; Item_datefunc::fix_length_and_dec(); - maybe_null= false; + set_persist_maybe_null(0); } /** @@ -1643,7 +1643,7 @@ void Item_func_date_format::fix_length_and_dec() collation.collation->mbmaxlen; set_if_smaller(max_length,MAX_BLOB_WIDTH); } - maybe_null=1; // If wrong date + set_persist_maybe_null(1); // If wrong date } @@ -1992,7 +1992,7 @@ void Item_extract::print(String *str, enum_query_type query_type) void Item_extract::fix_length_and_dec() { - maybe_null=1; // If wrong date + set_persist_maybe_null(1); // If wrong date switch (int_type) { case INTERVAL_YEAR: max_length=4; date_value=1; break; case INTERVAL_YEAR_MONTH: max_length=6; date_value=1; break; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 8d19e59ddfb..25a160d91f6 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -67,7 +67,7 @@ public: { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } enum_monotonicity_info get_monotonicity_info() const; longlong val_int_endpoint(bool left_endp, bool *incl_endp); @@ -90,7 +90,7 @@ public: { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -123,7 +123,7 @@ public: collation.set(&my_charset_bin); decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -158,7 +158,7 @@ public: { decimals=0; max_length=3*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -179,7 +179,7 @@ public: { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -200,7 +200,7 @@ public: { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -221,7 +221,7 @@ public: { decimals=0; max_length=1*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -242,7 +242,7 @@ public: { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -263,7 +263,7 @@ public: { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } }; @@ -277,7 +277,7 @@ public: { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -300,7 +300,7 @@ public: { decimals=0; max_length=4*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -335,7 +335,7 @@ public: collation.set(&my_charset_bin); decimals=0; max_length=1*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -415,7 +415,7 @@ public: const char *func_name() const { return "time_to_sec"; } void fix_num_length_and_dec() { - maybe_null= true; + set_persist_maybe_null(1); Item_func_seconds_hybrid::fix_num_length_and_dec(); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} @@ -454,7 +454,7 @@ public: { MAX_DATETIME_WIDTH, MAX_DATETIME_WIDTH, MAX_DATE_WIDTH, MAX_DATETIME_WIDTH, MIN_TIME_WIDTH }; - maybe_null= true; + set_persist_maybe_null(1); max_length= max_time_type_width[mysql_type_to_time_type(field_type())+2]; if (decimals) { @@ -470,7 +470,7 @@ public: We set maybe_null to 1 as default as any bad argument with date or time can get us to return NULL. */ - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -507,7 +507,7 @@ public: { store_now_in_TIME(<ime); Item_timefunc::fix_length_and_dec(); - maybe_null= false; + set_persist_maybe_null(0); } bool get_date(MYSQL_TIME *res, uint fuzzy_date); /* @@ -589,7 +589,7 @@ public: { store_now_in_TIME(<ime); Item_temporal_func::fix_length_and_dec(); - maybe_null= false; + set_persist_maybe_null(0); } bool get_date(MYSQL_TIME *res, uint fuzzy_date); virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0; @@ -930,7 +930,7 @@ public: void fix_length_and_dec() { decimals=0; - maybe_null=1; + set_persist_maybe_null(1); } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return FALSE;} @@ -952,7 +952,7 @@ public: void fix_length_and_dec() { decimals=0; - maybe_null=1; + set_persist_maybe_null(1); } virtual void print(String *str, enum_query_type query_type); }; @@ -974,7 +974,7 @@ public: const char *func_name() const { return "get_format"; } void fix_length_and_dec() { - maybe_null= 1; + set_persist_maybe_null(1); decimals=0; max_length=17*MY_CHARSET_BIN_MB_MAXLEN; } diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 57995b2b643..faf5f345171 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2579,6 +2579,7 @@ void Item_xml_str_func::fix_length_and_dec() int rc; nodeset_func= 0; + set_persist_maybe_null(1); if (agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1)) return; diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index ce33d161c79..be56a83349f 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -30,14 +30,10 @@ protected: public: Item_xml_str_func(Item *a, Item *b): Item_str_func(a,b) - { - maybe_null= TRUE; - } + {} Item_xml_str_func(Item *a, Item *b, Item *c): Item_str_func(a,b,c) - { - maybe_null= TRUE; - } + {} void fix_length_and_dec(); String *parse_xml(String *raw_xml, String *parsed_xml_buf); bool check_vcol_func_processor(uchar *int_arg) From 78d9fdb134c58ccf792fdec2bb745cb5ff6ec2ec Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 7 Jan 2013 20:21:05 +0100 Subject: [PATCH 284/349] non-functional cleanup, clarifying CONVERT_IF_BIGGER_TO_BLOB --- mysql-test/r/ctype_utf16.result | 8 ++++++++ mysql-test/r/ctype_utf8.result | 8 ++++++++ mysql-test/t/ctype_utf16.test | 4 ++++ mysql-test/t/ctype_utf8.test | 5 +++++ mysql-test/t/func_gconcat.test | 2 +- sql/item.cc | 6 +++--- sql/item.h | 2 ++ sql/item_sum.h | 2 +- sql/opt_subselect.cc | 4 ++-- sql/sql_const.h | 4 ++-- sql/sql_select.cc | 2 +- 11 files changed, 37 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index f0e6ea5f1ad..2eb0f8e9ba6 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -1140,6 +1140,14 @@ id l a 512 Warnings: Warning 1260 Row 1 was cut by GROUP_CONCAT() +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; +id l +a 512 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() # # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 69e32977103..d25c454913d 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5055,6 +5055,14 @@ id l a 1024 Warnings: Warning 1260 Row 2 was cut by GROUP_CONCAT() +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; +id l +a 1024 +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() # # End of 5.5 tests # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index 847e302e615..f42d30e1f00 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -777,6 +777,10 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 GROUP BY id ORDER BY l DESC; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; # ## TODO: add tests for all engines diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 210589adc81..0b90f222593 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1590,6 +1590,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 GROUP BY id ORDER BY l DESC; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index e4a1206fa9c..f84c112d303 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -375,7 +375,7 @@ select group_concat('x') UNION ALL select 1; drop table t1; # -# Bug #12863 : missing separators after first empty cancatanated elements +# Bug #12863 : missing separators after first empty concatenated elements # CREATE TABLE t1 (id int, a varchar(9)); diff --git a/sql/item.cc b/sql/item.cc index bc98a9a3184..8be339541e1 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5579,7 +5579,7 @@ bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs) /** Create a field to hold a string value from an item. - If max_length > CONVERT_IF_BIGGER_TO_BLOB create a blob @n + If too_big_for_varchar() create a blob @n If max_length > 0 create a varchar @n If max_length == 0 create a CHAR(0) @@ -5594,7 +5594,7 @@ Field *Item::make_string_field(TABLE *table) Note: the following check is repeated in subquery_types_allow_materialization(): */ - if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB) + if (too_big_for_varchar()) field= new Field_blob(max_length, maybe_null, name, collation.collation, TRUE); /* Item_type_holder holds the exact type, do not change it */ @@ -5699,7 +5699,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) DBUG_ASSERT(0); /* If something goes awfully wrong, it's better to get a string than die */ case MYSQL_TYPE_STRING: - if (fixed_length && max_length < CONVERT_IF_BIGGER_TO_BLOB) + if (fixed_length && !too_big_for_varchar()) { field= new Field_string(max_length, maybe_null, name, collation.collation); diff --git a/sql/item.h b/sql/item.h index 3136bb00394..42815c34286 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1424,6 +1424,8 @@ public: bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs); uint32 max_char_length() const { return max_length / collation.collation->mbmaxlen; } + bool too_big_for_varchar() const + { return max_char_length() > CONVERT_IF_BIGGER_TO_BLOB; } void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs) { max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen); diff --git a/sql/item_sum.h b/sql/item_sum.h index c8dce60c7d4..40a28d8beae 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1439,7 +1439,7 @@ public: virtual Field *make_string_field(TABLE *table); enum_field_types field_type() const { - if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB ) + if (too_big_for_varchar()) return MYSQL_TYPE_BLOB; else return MYSQL_TYPE_VARCHAR; diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index e70e5a784ba..753722fac08 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -853,8 +853,7 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs) create a blob column because item->max_length is too big. The following check is copied from Item::make_string_field(): */ - if (inner->max_length / inner->collation.collation->mbmaxlen > - CONVERT_IF_BIGGER_TO_BLOB) + if (inner->too_big_for_varchar()) { DBUG_RETURN(FALSE); } @@ -3865,6 +3864,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME); /* STEP 2: Figure if we'll be using a key or blob+constraint */ + /* it always has my_charset_bin, so mbmaxlen==1 */ if (uniq_tuple_length_arg >= CONVERT_IF_BIGGER_TO_BLOB) using_unique_constraint= TRUE; diff --git a/sql/sql_const.h b/sql/sql_const.h index cfbf077bd91..de2704a8553 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -42,8 +42,8 @@ #define MAX_MBWIDTH 3 /* Max multibyte sequence */ #define MAX_FIELD_CHARLENGTH 255 #define MAX_FIELD_VARCHARLENGTH 65535 -#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */ -#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */ +#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */ +#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Threshold *in characters* */ /* Max column width +1 */ #define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8914341e0f3..424d2d4a56b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -14185,7 +14185,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, can't index BIT fields. */ (*tmp->item)->marker=4; // Store null in key - if ((*tmp->item)->max_length >= CONVERT_IF_BIGGER_TO_BLOB) + if ((*tmp->item)->too_big_for_varchar()) using_unique_constraint=1; } if (param->group_length >= MAX_BLOB_WIDTH) From 8aaacc9102b3d536cc2682fe429c5023956a6eea Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Jan 2013 21:21:28 +0100 Subject: [PATCH 285/349] MDEV-3987 uninitialized read in Item_cond::fix_fields leads to crash: select .. where .. in ( select ... ) change Item_func_group_concat to use max_length according to the expected semantics --- mysql-test/r/func_gconcat.result | 5 +++++ mysql-test/t/func_gconcat.test | 8 ++++++++ sql/item.h | 8 ++++++-- sql/item_sum.cc | 25 ++++++++++--------------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index bc72e04b5a0..b60deae1c80 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1086,3 +1086,8 @@ ERROR HY000: Row 3 was cut by GROUP_CONCAT() SET group_concat_max_len = DEFAULT; SET @@sql_mode = @old_sql_mode; DROP TABLE t1, t2; +create table t1 (a char(1) character set utf8); +insert into t1 values ('a'),('b'); +select 1 from t1 where a in (select group_concat(a) from t1); +1 +drop table t1; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index f84c112d303..936b93b49c9 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -795,3 +795,11 @@ INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; SET group_concat_max_len = DEFAULT; SET @@sql_mode = @old_sql_mode; DROP TABLE t1, t2; + +# +# MDEV-3987 uninitialized read in Item_cond::fix_fields leads to crash: select .. where .. in ( select ... ) +# +create table t1 (a char(1) character set utf8); +insert into t1 values ('a'),('b'); +select 1 from t1 where a in (select group_concat(a) from t1); +drop table t1; diff --git a/sql/item.h b/sql/item.h index 42815c34286..0d38c5eb5f8 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2,7 +2,7 @@ #define SQL_ITEM_INCLUDED /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2009-2011 Monty Program Ab + Copyright (c) 2009, 2013 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -611,7 +611,11 @@ public: @see Query_arena::free_list */ Item *next; - uint32 max_length; /* Maximum length, in bytes */ + /* + The maximum value length in characters multiplied by collation->mbmaxlen. + Almost always it's the maximum value length in bytes. + */ + uint32 max_length; /* TODO: convert name and name_length fields into LEX_STRING to keep them in sync (see bug #11829681/60295 etc). Then also remove some strlen(name) diff --git a/sql/item_sum.cc b/sql/item_sum.cc index b04fda55736..e00ef3e592c 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2008-2011 Monty Program Ab + Copyright (c) 2008, 2013 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2986,6 +2986,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), { Item_func_group_concat *item= (Item_func_group_concat *) item_arg; TABLE *table= item->table; + uint max_length= table->in_use->variables.group_concat_max_len; String tmp((char *)table->record[1], table->s->reclength, default_charset_info); String tmp2; @@ -3028,7 +3029,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), item->row_count++; /* stop if length of result more than max_length */ - if (result->length() > item->max_length) + if (result->length() > max_length) { int well_formed_error; CHARSET_INFO *cs= item->collation.collation; @@ -3041,7 +3042,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), */ add_length= cs->cset->well_formed_len(cs, ptr + old_length, - ptr + item->max_length, + ptr + max_length, result->length(), &well_formed_error); result->length(old_length + add_length); @@ -3205,19 +3206,11 @@ Field *Item_func_group_concat::make_string_field(TABLE *table) { Field *field; DBUG_ASSERT(collation.collation); - /* - max_characters is maximum number of characters - what can fit into max_length size. It's necessary - to use field size what allows to store group_concat - result without truncation. For this purpose we use - max_characters * CS->mbmaxlen. - */ - const uint32 max_characters= max_length / collation.collation->mbminlen; - if (max_characters > CONVERT_IF_BIGGER_TO_BLOB) - field= new Field_blob(max_characters * collation.collation->mbmaxlen, + if (too_big_for_varchar()) + field= new Field_blob(max_length, maybe_null, name, collation.collation, TRUE); else - field= new Field_varstring(max_characters * collation.collation->mbmaxlen, + field= new Field_varstring(max_length, maybe_null, name, table->s, collation.collation); if (field) @@ -3332,7 +3325,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) result.set_charset(collation.collation); result_field= 0; null_value= 1; - max_length= thd->variables.group_concat_max_len; + max_length= thd->variables.group_concat_max_len + / collation.collation->mbminlen + * collation.collation->mbmaxlen; uint32 offset; if (separator->needs_conversion(separator->length(), separator->charset(), From b0ee31c89480519490537b89dca1e8cc65e2b73b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Jan 2013 21:23:03 +0100 Subject: [PATCH 286/349] MDEV-3942 FROM_DAYS() returns different result in MariaDB comparing to MySQL: NULL vs 0000-00-00 fixed a regression, introduced while fixing MDEV-456 --- mysql-test/r/datetime_456.result | 2 +- mysql-test/r/func_time.result | 2 +- sql/item_timefunc.cc | 8 +++----- sql/time.cc | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/datetime_456.result b/mysql-test/r/datetime_456.result index ba020a250b7..44351a821bc 100644 --- a/mysql-test/r/datetime_456.result +++ b/mysql-test/r/datetime_456.result @@ -4,5 +4,5 @@ insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')), select * from t1; d NULL -NULL +0000-00-00 00:00:00 drop table t1; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 2df0c691083..14d2729e952 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1453,7 +1453,7 @@ MAKEDATE(11111111,1) NULL SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1); WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1) -NULL +0 # # Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0, # diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index eaddd39fa58..9f2f9b2950d 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1,5 +1,6 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. + Copyright (c) 2010, 2013, Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1386,13 +1387,10 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date) if (get_date_from_daynr((long) value, <ime->year, <ime->month, <ime->day)) - return (null_value= 1); - - if ((fuzzy_date & TIME_NO_ZERO_DATE) && ltime->year == 0) - return (null_value= 1); + return 0; ltime->time_type= MYSQL_TIMESTAMP_DATE; - return (null_value= 0); + return 0; } diff --git a/sql/time.cc b/sql/time.cc index 21ecc3f8050..3b1613282fb 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc. - Copyright (c) 2009-2011 Monty Program Ab + Copyright (c) 2009-2013 Monty Program Ab Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -153,7 +153,7 @@ bool get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month, uchar *month_pos; DBUG_ENTER("get_date_from_daynr"); - if (daynr < 365 || daynr > MAX_DAY_NUMBER) + if (daynr < 366 || daynr > MAX_DAY_NUMBER) DBUG_RETURN(1); year= (uint) (daynr*100 / 36525L); From a128c50ac1b0d93f804aee98066588183c347607 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Jan 2013 21:23:40 +0100 Subject: [PATCH 287/349] MDEV-3883 Show global status not in order --- client/mysqldump.c | 6 +++--- .../suite/innodb/r/binlog_consistent.result | 16 ++++++++-------- mysql-test/suite/sphinx/sphinx.result | 13 +++++-------- sql/log.cc | 4 ++-- storage/sphinx/ha_sphinx.cc | 12 ++++++------ 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 46d152f7ed1..a2f6087f09b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2012, Monty Program Ab. + Copyright (c) 2010, 2013, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1182,13 +1182,13 @@ check_consistent_binlog_pos(char *binlog_pos_file, char *binlog_pos_offset) found= 0; while ((row= mysql_fetch_row(res))) { - if (0 == strcmp(row[0], "binlog_snapshot_file")) + if (0 == strcmp(row[0], "Binlog_snapshot_file")) { if (binlog_pos_file) strmake(binlog_pos_file, row[1], FN_REFLEN-1); found++; } - else if (0 == strcmp(row[0], "binlog_snapshot_position")) + else if (0 == strcmp(row[0], "Binlog_snapshot_position")) { if (binlog_pos_offset) strmake(binlog_pos_offset, row[1], LONGLONG_LEN); diff --git a/mysql-test/suite/innodb/r/binlog_consistent.result b/mysql-test/suite/innodb/r/binlog_consistent.result index 2e523c40a5b..c07719da297 100644 --- a/mysql-test/suite/innodb/r/binlog_consistent.result +++ b/mysql-test/suite/innodb/r/binlog_consistent.result @@ -6,8 +6,8 @@ File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 380 SHOW STATUS LIKE 'binlog_snapshot_%'; Variable_name Value -binlog_snapshot_file master-bin.000001 -binlog_snapshot_position 380 +Binlog_snapshot_file master-bin.000001 +Binlog_snapshot_position 380 BEGIN; INSERT INTO t1 VALUES (0, ""); # Connection con1 @@ -37,8 +37,8 @@ a b 0 SHOW STATUS LIKE 'binlog_snapshot_%'; Variable_name Value -binlog_snapshot_file master-bin.000001 -binlog_snapshot_position 904 +Binlog_snapshot_file master-bin.000001 +Binlog_snapshot_position 904 SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 1316 @@ -59,16 +59,16 @@ a b 0 SHOW STATUS LIKE 'binlog_snapshot_%'; Variable_name Value -binlog_snapshot_file master-bin.000001 -binlog_snapshot_position 904 +Binlog_snapshot_file master-bin.000001 +Binlog_snapshot_position 904 SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000002 245 COMMIT; SHOW STATUS LIKE 'binlog_snapshot_%'; Variable_name Value -binlog_snapshot_file master-bin.000002 -binlog_snapshot_position 245 +Binlog_snapshot_file master-bin.000002 +Binlog_snapshot_position 245 SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000002 245 diff --git a/mysql-test/suite/sphinx/sphinx.result b/mysql-test/suite/sphinx/sphinx.result index a671028bbe2..82c76335e0b 100644 --- a/mysql-test/suite/sphinx/sphinx.result +++ b/mysql-test/suite/sphinx/sphinx.result @@ -48,15 +48,12 @@ SET optimizer_switch=@save_optimizer_switch; drop table ts; show status like "sphinx_error%"; Variable_name Value -sphinx_error_commits 0 -sphinx_error_group_commits 0 -sphinx_error_snapshot_file -sphinx_error_snapshot_position 0 +Sphinx_error OFF show status like "sphinx_total%"; Variable_name Value -sphinx_total 2 -sphinx_total_found 2 +Sphinx_total 2 +Sphinx_total_found 2 show status like "sphinx_word%"; Variable_name Value -sphinx_word_count 0 -sphinx_words +Sphinx_word_count 0 +Sphinx_words diff --git a/sql/log.cc b/sql/log.cc index 70e74de5a31..b7218615f58 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2010-2011 Monty Program Ab + Copyright (c) 2010, 2013 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -7665,7 +7665,7 @@ static int show_binlog_vars(THD *thd, SHOW_VAR *var, char *buff) } static SHOW_VAR binlog_status_vars_top[]= { - {"binlog", (char *) &show_binlog_vars, SHOW_FUNC}, + {"Binlog", (char *) &show_binlog_vars, SHOW_FUNC}, {NullS, NullS, SHOW_LONG} }; diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 27a463bf61f..93cb43f3a92 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -3591,12 +3591,12 @@ struct st_mysql_storage_engine sphinx_storage_engine = struct st_mysql_show_var sphinx_status_vars[] = { - {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_FUNC}, - {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_FUNC}, - {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_FUNC}, - {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_FUNC}, - {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_FUNC}, - {"sphinx_error", (char *)sphinx_showfunc_error, SHOW_FUNC}, + {"Sphinx_total", (char *)sphinx_showfunc_total, SHOW_FUNC}, + {"Sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_FUNC}, + {"Sphinx_time", (char *)sphinx_showfunc_time, SHOW_FUNC}, + {"Sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_FUNC}, + {"Sphinx_words", (char *)sphinx_showfunc_words, SHOW_FUNC}, + {"Sphinx_error", (char *)sphinx_showfunc_error, SHOW_FUNC}, {0, 0, (enum_mysql_show_type)0} }; From c9ff25f568df9112cb581348e865c79d8d663b4a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 9 Jan 2013 17:29:51 +0100 Subject: [PATCH 288/349] MDEV-3985 crash: uninstall soname 'a' --- mysql-test/r/plugin.result | 2 ++ mysql-test/t/plugin.test | 18 ++++++++++++------ sql/sql_plugin.cc | 18 +++++++++++++----- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index b5addf16147..6d8efe2615b 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -69,6 +69,8 @@ UNINSTALL PLUGIN EXAMPLE; ERROR 42000: PLUGIN EXAMPLE does not exist UNINSTALL PLUGIN non_exist; ERROR 42000: PLUGIN non_exist does not exist +UNINSTALL SONAME 'non_exist'; +ERROR 42000: SONAME non_exist.so does not exist # # Bug#32034: check_func_enum() does not check correct values but set it # to impossible int val diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 2b234b64047..4412383f837 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -4,14 +4,14 @@ CREATE TABLE t1(a int) ENGINE=EXAMPLE; DROP TABLE t1; -eval INSTALL PLUGIN example SONAME 'ha_example'; +INSTALL PLUGIN example SONAME 'ha_example'; --replace_regex /\.dll/.so/ --error 1125 -eval INSTALL PLUGIN EXAMPLE SONAME 'ha_example'; +INSTALL PLUGIN EXAMPLE SONAME 'ha_example'; UNINSTALL PLUGIN example; -eval INSTALL SONAME 'ha_example'; +INSTALL SONAME 'ha_example'; --replace_column 5 # --replace_regex /\.dll/.so/ --query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%' @@ -28,7 +28,7 @@ set global example_enum_var= e1; show status like 'example%'; show variables like 'example%'; -eval UNINSTALL SONAME 'ha_example'; +UNINSTALL SONAME 'ha_example'; --replace_column 5 # --replace_regex /\.dll/.so/ --query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%' @@ -41,12 +41,18 @@ UNINSTALL PLUGIN EXAMPLE; --error 1305 UNINSTALL PLUGIN non_exist; +# +# MDEV-3985 crash: uninstall soname 'a' +# +--replace_regex /\.dll/.so/ +--error 1305 +UNINSTALL SONAME 'non_exist'; --echo # --echo # Bug#32034: check_func_enum() does not check correct values but set it --echo # to impossible int val --echo # -eval INSTALL PLUGIN example SONAME 'ha_example'; +INSTALL PLUGIN example SONAME 'ha_example'; SET GLOBAL example_enum_var= e1; SET GLOBAL example_enum_var= e2; @@ -60,7 +66,7 @@ UNINSTALL PLUGIN example; # # Bug #32757 hang with sql_mode set when setting some global variables # -eval INSTALL PLUGIN example SONAME 'ha_example'; +INSTALL PLUGIN example SONAME 'ha_example'; select @@session.sql_mode into @old_sql_mode; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index dee48a28037..3d529c7a332 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2011, Monty Program Ab + Copyright (c) 2010, 2013, Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2260,11 +2260,19 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name, { fix_dl_name(thd->mem_root, &dl); st_plugin_dl *plugin_dl= plugin_dl_find(&dl); - struct st_maria_plugin *plugin; - for (plugin= plugin_dl->plugins; plugin->info; plugin++) + if (plugin_dl) { - LEX_STRING str= { const_cast(plugin->name), strlen(plugin->name) }; - error|= do_uninstall(thd, table, &str); + for (struct st_maria_plugin *plugin= plugin_dl->plugins; + plugin->info; plugin++) + { + LEX_STRING str= { const_cast(plugin->name), strlen(plugin->name) }; + error|= do_uninstall(thd, table, &str); + } + } + else + { + my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "SONAME", dl.str); + error= true; } } reap_plugins(); From f6d22b3915dc930ef9d33cbfa33ed28fd6484b7f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 9 Jan 2013 17:30:20 +0100 Subject: [PATCH 289/349] MDEV-3846 REFRESH_CHECKPOINT and REFRESH_TABLE_STATS tokens share the same value --- include/mysql_com.h | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/include/mysql_com.h b/include/mysql_com.h index 6e8a2b23de0..c0f350d2bcf 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2010, 2011, Monty Program Ab + Copyright (c) 2010, 2013, Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -126,39 +126,39 @@ enum enum_server_command #define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25, reserved by MySQL Cluster */ -#define REFRESH_GRANT 1 /* Refresh grant tables */ -#define REFRESH_LOG 2 /* Start on new log file */ -#define REFRESH_TABLES 4 /* close all tables */ -#define REFRESH_HOSTS 8 /* Flush host cache */ -#define REFRESH_STATUS 16 /* Flush status variables */ -#define REFRESH_THREADS 32 /* Flush thread cache */ -#define REFRESH_SLAVE 64 /* Reset master info and restart slave - thread */ -#define REFRESH_MASTER 128 /* Remove all bin logs in the index - and truncate the index */ +#define REFRESH_GRANT (1UL << 0) /* Refresh grant tables */ +#define REFRESH_LOG (1UL << 1) /* Start on new log file */ +#define REFRESH_TABLES (1UL << 2) /* close all tables */ +#define REFRESH_HOSTS (1UL << 3) /* Flush host cache */ +#define REFRESH_STATUS (1UL << 4) /* Flush status variables */ +#define REFRESH_THREADS (1UL << 5) /* Flush thread cache */ +#define REFRESH_SLAVE (1UL << 6) /* Reset master info and restart slave + thread */ +#define REFRESH_MASTER (1UL << 7) /* Remove all bin logs in the index + and truncate the index */ /* The following can't be set with mysql_refresh() */ -#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */ -#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */ -#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */ -#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */ -#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */ -#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */ +#define REFRESH_ERROR_LOG (1UL << 8) /* Rotate only the erorr log */ +#define REFRESH_ENGINE_LOG (1UL << 9) /* Flush all storage engine logs */ +#define REFRESH_BINARY_LOG (1UL << 10) /* Flush the binary log */ +#define REFRESH_RELAY_LOG (1UL << 11) /* Flush the relay log */ +#define REFRESH_GENERAL_LOG (1UL << 12) /* Flush the general log */ +#define REFRESH_SLOW_LOG (1UL << 13) /* Flush the slow query log */ -#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ -#define REFRESH_FAST 32768 /* Intern flag */ +#define REFRESH_READ_LOCK (1UL << 14) /* Lock tables for read */ +#define REFRESH_CHECKPOINT (1UL << 15) /* With REFRESH_READ_LOCK: block checkpoints too */ -/* RESET (remove all queries) from query cache */ -#define REFRESH_QUERY_CACHE 65536 -#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ -#define REFRESH_DES_KEY_FILE 0x40000L -#define REFRESH_USER_RESOURCES 0x80000L -#define REFRESH_CHECKPOINT 0x100000L /* Don't do checkpoints */ +#define REFRESH_QUERY_CACHE (1UL << 16) /* clear the query cache */ +#define REFRESH_QUERY_CACHE_FREE (1UL << 17) /* pack query cache */ +#define REFRESH_DES_KEY_FILE (1UL << 18) +#define REFRESH_USER_RESOURCES (1UL << 19) -#define REFRESH_TABLE_STATS (1L << 20) /* Refresh table stats hash table */ -#define REFRESH_INDEX_STATS (1L << 21) /* Refresh index stats hash table */ -#define REFRESH_USER_STATS (1L << 22) /* Refresh user stats hash table */ -#define REFRESH_CLIENT_STATS (1L << 23) /* Refresh client stats hash table */ +#define REFRESH_TABLE_STATS (1UL << 20) /* Refresh table stats hash table */ +#define REFRESH_INDEX_STATS (1UL << 21) /* Refresh index stats hash table */ +#define REFRESH_USER_STATS (1UL << 22) /* Refresh user stats hash table */ +#define REFRESH_CLIENT_STATS (1UL << 23) /* Refresh client stats hash table */ + +#define REFRESH_FAST (1UL << 31) /* Intern flag */ #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ From 396f4d62c69335b8f7aefd43bbe099e8bb9e6905 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 10 Jan 2013 23:40:18 +0200 Subject: [PATCH 290/349] Fix for MDEV-4009: main.delayed sporadically fails with "query 'REPLACE DELAYED t1 VALUES (5)' failed: 1317: Query execution was interrupted" - Fixed broadcast without a proper mutex - Don't break existing locks if we are just testing if we can get the lock mysql-test/r/create_delayed.result: Added test case for failures with INSERT DELAYED with CREATE and DROP TABLE mysql-test/t/create_delayed.test: Added test case for failures with INSERT DELAYED with CREATE and DROP TABLE sql/mdl.cc: Don't break existing locks for timeout=0 (ie, just check if there are conflicting locks). This fixed the bug that INSERT DELAYED didn't work properly with CREATE TABLE sql/sql_base.cc: One neads to hold the mutex before doing a mysql_cond_broadcast() This fixed the bug that INSERT DELAYED didn't work properly with DROP TABLE sql/sql_insert.cc: Protect setting of mysys_var->current_mutex. --- mysql-test/r/create_delayed.result | 3 +++ mysql-test/t/create_delayed.test | 34 ++++++++++++++++++++++++++++++ sql/mdl.cc | 6 +++++- sql/sql_base.cc | 4 ++++ sql/sql_insert.cc | 4 ++++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/create_delayed.result create mode 100644 mysql-test/t/create_delayed.test diff --git a/mysql-test/r/create_delayed.result b/mysql-test/r/create_delayed.result new file mode 100644 index 00000000000..c36a8e60cbb --- /dev/null +++ b/mysql-test/r/create_delayed.result @@ -0,0 +1,3 @@ +drop table if exists t1; +Starting test +# All done diff --git a/mysql-test/t/create_delayed.test b/mysql-test/t/create_delayed.test new file mode 100644 index 00000000000..e99886d97d1 --- /dev/null +++ b/mysql-test/t/create_delayed.test @@ -0,0 +1,34 @@ +# +# Ensure that INSERT DELAYED works with CREATE TABLE on existing table +# + +-- source include/big_test.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +--disable_query_log +--disable_result_log + +--let $run=1000 + +--echo Starting test + +while ($run) +{ +# --echo # $run attempts left... + CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1)) ENGINE=MyISAM; + INSERT DELAYED t1 VALUES (4); +--error ER_TABLE_EXISTS_ERROR + CREATE TABLE t1 AS SELECT 1 AS f1; + + REPLACE DELAYED t1 VALUES (5); + DROP TABLE t1; +--dec $run +} + +--enable_query_log +--enable_result_log + +--echo # All done diff --git a/sql/mdl.cc b/sql/mdl.cc index 5e297051377..a2113909116 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -2078,7 +2078,11 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout) */ m_wait.reset_status(); - if (lock->needs_notification(ticket)) + /* + Don't break conflicting locks if timeout is 0 as 0 is used + To check if there is any conflicting locks... + */ + if (lock->needs_notification(ticket) && lock_wait_timeout) lock->notify_conflicting_locks(this); mysql_prlock_unlock(&lock->m_rwlock); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index c7f93c955f3..83ed29064b5 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -9299,7 +9299,11 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use, in_use->killed= KILL_SYSTEM_THREAD; mysql_mutex_lock(&in_use->mysys_var->mutex); if (in_use->mysys_var->current_cond) + { + mysql_mutex_lock(in_use->mysys_var->current_mutex); mysql_cond_broadcast(in_use->mysys_var->current_cond); + mysql_mutex_unlock(in_use->mysys_var->current_mutex); + } mysql_mutex_unlock(&in_use->mysys_var->mutex); signalled= TRUE; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 231671d172b..f18a9548704 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2823,8 +2823,12 @@ pthread_handler_t handle_delayed_insert(void *arg) set_timespec(abstime, delayed_insert_timeout); /* Information for pthread_kill */ + mysql_mutex_unlock(&di->mutex); + mysql_mutex_lock(&di->thd.mysys_var->mutex); di->thd.mysys_var->current_mutex= &di->mutex; di->thd.mysys_var->current_cond= &di->cond; + mysql_mutex_unlock(&di->thd.mysys_var->mutex); + mysql_mutex_lock(&di->mutex); thd_proc_info(&(di->thd), "Waiting for INSERT"); DBUG_PRINT("info",("Waiting for someone to insert rows")); From 6e9a48b67fceab17089ca4cd1406e302386a601b Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 11 Jan 2013 00:22:14 +0200 Subject: [PATCH 291/349] Fixed some race conditons and bugs related to killed queries KILL now breaks locks inside InnoDB Fixed possible deadlock when running INNODB STATUS Added ha_kill_query() and kill_query() to send kill signal to all storage engines Added reset_killed() to ensure we don't reset killed state while awake() is getting called include/mysql/plugin.h: Added thd_mark_as_hard_kill() include/mysql/plugin_audit.h.pp: Added thd_mark_as_hard_kill() include/mysql/plugin_auth.h.pp: Added thd_mark_as_hard_kill() include/mysql/plugin_ftparser.h.pp: Added thd_mark_as_hard_kill() sql/handler.cc: Added ha_kill_query() to send kill signal to all storage engines sql/handler.h: Added ha_kill_query() and kill_query() to send kill signal to all storage engines sql/log_event.cc: Use reset_killed() sql/mdl.cc: use thd->killed instead of thd_killed() to abort on soft kill sql/sp_rcontext.cc: Use reset_killed() sql/sql_class.cc: Fixed possible deadlock in INNODB STATUS by not getting thd->LOCK_thd_data if it's locked. Use reset_killed() Tell storge engines that KILL has been sent sql/sql_class.h: Added reset_killed() to ensure we don't reset killed state while awake() is getting called. Added mark_as_hard_kill() sql/sql_insert.cc: Use reset_killed() sql/sql_parse.cc: Simplify detection of killed queries. Use reset_killed() sql/sql_select.cc: Use reset_killed() sql/sql_union.cc: Use reset_killed() storage/innobase/handler/ha_innodb.cc: Added innobase_kill_query() Fixed error reporting for interrupted queries. storage/xtradb/handler/ha_innodb.cc: Added innobase_kill_query() Fixed error reporting for interrupted queries. --- include/mysql/plugin.h | 11 +++++++ include/mysql/plugin_audit.h.pp | 1 + include/mysql/plugin_auth.h.pp | 1 + include/mysql/plugin_ftparser.h.pp | 1 + sql/handler.cc | 21 ++++++++++++- sql/handler.h | 8 +++++ sql/log_event.cc | 2 +- sql/mdl.cc | 6 ++-- sql/sp_rcontext.cc | 2 +- sql/sql_class.cc | 44 ++++++++++++++++++--------- sql/sql_class.h | 24 +++++++++++++++ sql/sql_insert.cc | 5 ++- sql/sql_parse.cc | 22 ++++++++------ sql/sql_select.cc | 4 +-- sql/sql_union.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 35 +++++++++++++++++++-- storage/xtradb/handler/ha_innodb.cc | 33 ++++++++++++++++++-- 17 files changed, 185 insertions(+), 37 deletions(-) diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index b73f2d75193..7617f5968d9 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -641,6 +641,17 @@ int mysql_tmpfile(const char *prefix); */ int thd_killed(const MYSQL_THD thd); +/** + Increase level of kill ; Ensures that thd_killed() returns true. + + @param thd Thread connection handle + + @details + Needed if storage engine wants to abort things because of a 'soft' (ie, + safe) kill but still uses thd_killed() to check if it's killed. +**/ + +void thd_mark_as_hard_kill(MYSQL_THD thd); /** Return the thread id of a user thread diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index b987f690592..ea3447762ca 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -227,6 +227,7 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); +void thd_mark_as_hard_kill(void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 113aaf62d19..45999056435 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -227,6 +227,7 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); +void thd_mark_as_hard_kill(void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index 6011e7f7519..84299c77d9b 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -180,6 +180,7 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); +void thd_mark_as_hard_kill(void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/sql/handler.cc b/sql/handler.cc index 356ae330201..5108e3abc40 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -663,7 +663,6 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin, return FALSE; } - /** @note don't bother to rollback here, it's done already @@ -673,6 +672,26 @@ void ha_close_connection(THD* thd) plugin_foreach(thd, closecon_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0); } +static my_bool kill_handlerton(THD *thd, plugin_ref plugin, + void *hard_kill) +{ + handlerton *hton= plugin_data(plugin, handlerton *); + + if (hton->state == SHOW_OPTION_YES && hton->kill_query && + thd_get_ha_data(thd, hton)) + hton->kill_query(hton, thd, * (my_bool*) hard_kill); + return FALSE; +} + +void ha_kill_query(THD* thd, my_bool hard_kill) +{ + DBUG_ENTER("ha_kill_query"); + plugin_foreach(thd, kill_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, + &hard_kill); + DBUG_VOID_RETURN; +} + + /* ======================================================================== ======================= TRANSACTIONS ===================================*/ diff --git a/sql/handler.h b/sql/handler.h index 4a6fc2f1bd5..e5da92b0d40 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -864,6 +864,13 @@ struct handlerton this storage engine was accessed in this connection */ int (*close_connection)(handlerton *hton, THD *thd); + /* + Tell handler that query has been killed. + hard_kill is set in case of HARD KILL (abort query even if + it may corrupt table). + Return 1 if the handler wants to upgrade the kill to a hard kill + */ + void (*kill_query)(handlerton *hton, THD *thd, my_bool hard_kill); /* sv points to an uninitialized storage area of requested size (see savepoint_offset description) @@ -2975,6 +2982,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin); TYPELIB *ha_known_exts(void); int ha_panic(enum ha_panic_function flag); void ha_close_connection(THD* thd); +void ha_kill_query(THD* thd, my_bool hard_kill); bool ha_flush_logs(handlerton *db_type); void ha_drop_database(char* path); void ha_checkpoint_state(bool disable); diff --git a/sql/log_event.cc b/sql/log_event.cc index 6fc116d2b92..a46da2304b2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3884,7 +3884,7 @@ Default database: '%s'. Query: '%s'", { DBUG_PRINT("info",("error ignored")); clear_all_errors(thd, const_cast(rli)); - thd->killed= NOT_KILLED; + thd->reset_killed(); } /* Other cases: mostly we expected no error and get one. diff --git a/sql/mdl.cc b/sql/mdl.cc index a2113909116..415d56887d5 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -14,7 +14,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "mdl.h" +#include "sql_class.h" #include "debug_sync.h" #include #include @@ -1185,7 +1185,7 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout, wait_state_name); thd_wait_begin(thd, THD_WAIT_META_DATA_LOCK); - while (!m_wait_status && !thd_killed(thd) && + while (!m_wait_status && !thd->killed && wait_result != ETIMEDOUT && wait_result != ETIME) { wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status, @@ -1207,7 +1207,7 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout, false, which means that the caller intends to restart the wait. */ - if (thd_killed(thd)) + if (thd->killed) m_wait_status= KILLED; else if (set_status_on_timeout) m_wait_status= TIMEOUT; diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 6fe4be989db..d78f2a162f5 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -419,7 +419,7 @@ sp_rcontext::activate_handler(THD *thd, /* Reset error state. */ thd->clear_error(); - thd->killed= NOT_KILLED; // Some errors set thd->killed + thd->reset_killed(); // Some errors set thd->killed // (e.g. "bad data"). /* Return IP of the activated SQL handler. */ diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 42952585e07..312de8c74e4 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -701,7 +701,7 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length, values doesn't have to very accurate and the memory it points to is static, but we need to attempt a snapshot on the pointer values to avoid using NULL values. The pointer to thd->query however, doesn't point to static memory - and has to be protected by LOCK_thread_count or risk pointing to + and has to be protected by thd->LOCK_thd_data or risk pointing to uninitialized memory. */ const char *proc_info= thd->proc_info; @@ -736,20 +736,21 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length, str.append(proc_info); } - mysql_mutex_lock(&thd->LOCK_thd_data); - - if (thd->query()) + /* Don't wait if LOCK_thd_data is used as this could cause a deadlock */ + if (!mysql_mutex_trylock(&thd->LOCK_thd_data)) { - if (max_query_len < 1) - len= thd->query_length(); - else - len= min(thd->query_length(), max_query_len); - str.append('\n'); - str.append(thd->query(), len); + if (thd->query()) + { + if (max_query_len < 1) + len= thd->query_length(); + else + len= min(thd->query_length(), max_query_len); + str.append('\n'); + str.append(thd->query(), len); + } + mysql_mutex_unlock(&thd->LOCK_thd_data); } - mysql_mutex_unlock(&thd->LOCK_thd_data); - if (str.c_ptr_safe() == buffer) return buffer; @@ -1355,7 +1356,7 @@ void THD::change_user(void) mysql_mutex_unlock(&LOCK_status); cleanup(); - killed= NOT_KILLED; + reset_killed(); cleanup_done= 0; init(); stmt_map.reset(); @@ -1610,6 +1611,10 @@ void THD::awake(killed_state state_to_set) MYSQL_CALLBACK(scheduler, post_kill_notification, (this)); } + /* Interrupt target waiting inside a storage engine. */ + if (state_to_set != NOT_KILLED) + ha_kill_query(this, test(state_to_set & KILL_HARD_BIT)); + /* Broadcast a condition to kick the target if it is waiting on it. */ if (mysys_var) { @@ -3848,6 +3853,18 @@ extern "C" int thd_killed(const MYSQL_THD thd) return thd->killed; } +/** + Change kill level to hard. + This ensures that thd_killed() will return true. + This is important for storage engines that uses thd_killed() to + verify if thread is killed. +*/ + +extern "C" void thd_mark_as_hard_kill(MYSQL_THD thd) +{ + thd->mark_as_hard_kill(); +} + /** Send an out-of-band progress report to the client @@ -5603,4 +5620,3 @@ bool Discrete_intervals_list::append(Discrete_interval *new_interval) } #endif /* !defined(MYSQL_CLIENT) */ - diff --git a/sql/sql_class.h b/sql/sql_class.h index f50d1442a3f..2561effb478 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2703,6 +2703,19 @@ public: { return ::killed_errno(killed); } + inline void reset_killed() + { + /* + Resetting killed has to be done under a mutex to ensure + its not done during an awake() call. + */ + if (killed != NOT_KILLED) + { + mysql_mutex_lock(&LOCK_thd_data); + killed= NOT_KILLED; + mysql_mutex_unlock(&LOCK_thd_data); + } + } inline void send_kill_message() const { int err= killed_errno(); @@ -2716,6 +2729,17 @@ public: (!transaction.stmt.modified_non_trans_table || (variables.sql_mode & MODE_STRICT_ALL_TABLES))); } + /* + Increase level of kill ; Ensures that thd_killed() returns true. + + Needed if storage engine wants to abort things because of a 'soft' (ie, + safe) kill but still uses thd_killed() to check if it's killed. + */ + inline void mark_as_hard_kill() + { + DBUG_ASSERT(killed != NOT_KILLED); + killed= (killed_state) (killed | KILL_HARD_BIT); + } void set_status_var_init(); void reset_n_backup_open_tables_state(Open_tables_backup *backup); void restore_backup_open_tables_state(Open_tables_backup *backup); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f18a9548704..ef3f81f18c5 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2724,7 +2724,10 @@ pthread_handler_t handle_delayed_insert(void *arg) thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; thd->set_current_time(); threads.append(thd); - thd->killed=abort_loop ? KILL_CONNECTION : NOT_KILLED; + if (abort_loop) + thd->killed= KILL_CONNECTION; + else + thd->reset_killed(); mysql_mutex_unlock(&LOCK_thread_count); mysql_thread_set_psi_id(thd->thread_id); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index de35d2f3d27..2ae4adb4e33 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4495,16 +4495,20 @@ finish: if (! thd->in_sub_stmt) { - /* report error issued during command execution */ - if (thd->killed_errno()) + if (thd->killed != NOT_KILLED) { - if (! thd->stmt_da->is_set()) - thd->send_kill_message(); - } - if (thd->killed < KILL_CONNECTION) - { - thd->killed= NOT_KILLED; - thd->mysys_var->abort= 0; + /* report error issued during command execution */ + if (thd->killed_errno()) + { + /* If we already sent 'ok', we can ignore any kill query statements */ + if (! thd->stmt_da->is_set()) + thd->send_kill_message(); + } + if (thd->killed < KILL_CONNECTION) + { + thd->reset_killed(); + thd->mysys_var->abort= 0; + } } if (thd->is_error() || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR)) trans_rollback_stmt(thd); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 424d2d4a56b..9bbc139927e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -331,7 +331,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result, ER(ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT), thd->accessed_rows_and_keys, thd->lex->limit_rows_examined->val_uint()); - thd->killed= NOT_KILLED; + thd->reset_killed(); } /* Disable LIMIT ROWS EXAMINED after query execution. */ thd->lex->limit_rows_examined_cnt= ULONGLONG_MAX; @@ -19213,7 +19213,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List &fields, Item *having) */ thd->lex->limit_rows_examined_cnt= ULONGLONG_MAX; if (thd->killed == ABORT_QUERY) - thd->killed= NOT_KILLED; + thd->reset_killed(); free_io_cache(entry); // Safety entry->file->info(HA_STATUS_VARIABLE); if (entry->s->db_type() == heap_hton || diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 8dcae907926..77d4df1b398 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -716,7 +716,7 @@ bool st_select_lex_unit::exec() ER(ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT), thd->accessed_rows_and_keys, thd->lex->limit_rows_examined->val_uint()); - thd->killed= NOT_KILLED; + thd->reset_killed(); break; } } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4ae98723c69..826662b52c6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -339,6 +339,7 @@ static PSI_file_info all_innodb_files[] = { static INNOBASE_SHARE *get_share(const char *table_name); static void free_share(INNOBASE_SHARE *share); static int innobase_close_connection(handlerton *hton, THD* thd); +static void innobase_kill_query(handlerton *hton, THD* thd, my_bool hard_kill); static void innobase_commit_ordered(handlerton *hton, THD* thd, bool all); static int innobase_commit(handlerton *hton, THD* thd, bool all); static int innobase_rollback(handlerton *hton, THD* thd, bool all); @@ -917,8 +918,7 @@ convert_error_code_to_mysql( return(0); case DB_INTERRUPTED: - my_error(ER_QUERY_INTERRUPTED, MYF(0)); - /* fall through */ + return(HA_ERR_ABORTED_BY_USER); case DB_FOREIGN_EXCEED_MAX_CASCADE: push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -2271,6 +2271,7 @@ innobase_init( innobase_hton->flags=HTON_NO_FLAGS; innobase_hton->release_temporary_latches=innobase_release_temporary_latches; innobase_hton->alter_table_flags = innobase_alter_table_flags; + innobase_hton->kill_query = innobase_kill_query; ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); @@ -3174,6 +3175,36 @@ innobase_close_connection( } +/*****************************************************************//** +Cancel any pending lock request associated with the current THD. */ +static +void +innobase_kill_query( +/*======================*/ + handlerton* hton, /*!< in: innobase handlerton */ + THD* thd, /*!< in: handle to the MySQL thread being killed */ + my_bool hard_kill) /*!< in: If hard kill */ +{ + trx_t* trx; + DBUG_ENTER("innobase_kill_query"); + DBUG_ASSERT(hton == innodb_hton_ptr); + + mutex_enter(&kernel_mutex); + + trx = thd_to_trx(thd); + + /* Cancel a pending lock request. */ + if (trx && trx->wait_lock) { + thd_mark_as_hard_kill(thd); + lock_cancel_waiting_and_release(trx->wait_lock); + } + + mutex_exit(&kernel_mutex); + + DBUG_VOID_RETURN; +} + + /*************************************************************************//** ** InnoDB database tables *****************************************************************************/ diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 5cf3b021510..ba07b414c65 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -378,6 +378,7 @@ static PSI_file_info all_innodb_files[] = { static INNOBASE_SHARE *get_share(const char *table_name); static void free_share(INNOBASE_SHARE *share); static int innobase_close_connection(handlerton *hton, THD* thd); +static void innobase_kill_query(handlerton *hton, THD* thd, my_bool hard_kill); static void innobase_commit_ordered(handlerton *hton, THD* thd, bool all); static int innobase_commit(handlerton *hton, THD* thd, bool all); static int innobase_rollback(handlerton *hton, THD* thd, bool all); @@ -1106,8 +1107,7 @@ convert_error_code_to_mysql( return(0); case DB_INTERRUPTED: - my_error(ER_QUERY_INTERRUPTED, MYF(0)); - /* fall through */ + return(HA_ERR_ABORTED_BY_USER); case DB_FOREIGN_EXCEED_MAX_CASCADE: push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -2627,6 +2627,7 @@ innobase_init( innobase_hton->flags=HTON_NO_FLAGS; innobase_hton->release_temporary_latches=innobase_release_temporary_latches; innobase_hton->alter_table_flags = innobase_alter_table_flags; + innobase_hton->kill_query = innobase_kill_query; ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); @@ -3758,6 +3759,34 @@ innobase_close_connection( DBUG_RETURN(0); } +/*****************************************************************//** +Cancel any pending lock request associated with the current THD. */ +static +void +innobase_kill_query( +/*======================*/ + handlerton* hton, /*!< in: innobase handlerton */ + THD* thd, /*!< in: handle to the MySQL thread being killed */ + my_bool hard_kill) /*!< in: If hard kill */ +{ + trx_t* trx; + DBUG_ENTER("innobase_kill_query"); + DBUG_ASSERT(hton == innodb_hton_ptr); + + mutex_enter(&kernel_mutex); + + trx = thd_to_trx(thd); + + /* Cancel a pending lock request. */ + if (trx && trx->wait_lock) { + thd_mark_as_hard_kill(thd); + lock_cancel_waiting_and_release(trx->wait_lock); + } + + mutex_exit(&kernel_mutex); + + DBUG_VOID_RETURN; +} /*************************************************************************//** ** InnoDB database tables From a42e1e3885ce4519bb5db2f02f2448d0a29cd7a7 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 11 Jan 2013 00:35:33 +0200 Subject: [PATCH 292/349] Fixed MDEV-4013: Password length in replication setup Give error for wrong parameters to CHANGE MASTER Extend MASTER_PASSWORD and MASTER_HOST lengths mysql-test/suite/rpl/r/rpl_password_boundaries.result: Test length of MASTER_PASSWORD, MASTER_HOST and MASTER_USER mysql-test/suite/rpl/r/rpl_semi_sync.result: Use different password than user name for better test coverage mysql-test/suite/rpl/t/rpl_password_boundaries.test: Test length of MASTER_PASSWORD, MASTER_HOST and MASTER_USER mysql-test/suite/rpl/t/rpl_semi_sync.test: Use different password than user name for better test coverage sql/rpl_mi.h: Extend MASTER_PASSWORD and MASTER_HOST lengths sql/sql_repl.cc: Give error for wrong parameters to CHANGE MASTER sql/sql_repl.h: Extend MASTER_PASSWORD and MASTER_HOST lengths --- .../rpl/r/rpl_password_boundaries.result | 59 +++++++++ mysql-test/suite/rpl/r/rpl_semi_sync.result | 6 +- .../suite/rpl/t/rpl_password_boundaries.test | 112 ++++++++++++++++++ mysql-test/suite/rpl/t/rpl_semi_sync.test | 6 +- sql/rpl_mi.h | 6 +- sql/sql_repl.cc | 42 ++++++- sql/sql_repl.h | 4 +- 7 files changed, 218 insertions(+), 17 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_password_boundaries.result create mode 100644 mysql-test/suite/rpl/t/rpl_password_boundaries.test diff --git a/mysql-test/suite/rpl/r/rpl_password_boundaries.result b/mysql-test/suite/rpl/r/rpl_password_boundaries.result new file mode 100644 index 00000000000..71f32f492a2 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_password_boundaries.result @@ -0,0 +1,59 @@ +include/master-slave.inc +[connection master] +include/rpl_reset.inc +[ on master ] +set sql_log_bin=0; +grant replication slave on *.* to rpl32@127.0.0.1 identified by '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; +set sql_log_bin=1; +[ on slave ] +include/stop_slave.inc +change master to master_user='rpl32',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; +include/start_slave.inc +[ on master ] +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (i int); +insert into t1 values (1); +[ on slave: synchronized ] +[ on master ] +set sql_log_bin=0; +grant replication slave on *.* to rpl33@127.0.0.1 identified by '0123456789abcdef0123456789abcdef!'; +set sql_log_bin=1; +[ on slave ] +include/stop_slave.inc +change master to master_user='rpl33',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef!'; +ERROR HY000: String '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345' is too long for MASTER_PASSWORD (should be no longer than 96) +change master to master_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; +ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long for MASTER_USER (should be no longer than 47) +change master to master_host='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'; +ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbb' is too long for MASTER_HOST (should be no longer than 180) +[ on master ] +set sql_log_bin=0; +grant replication slave on *.* to rpl16cyr@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль'; +set sql_log_bin=1; +[ on slave ] +SET NAMES utf8; +change master to master_user='rpl16cyr',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль'; +include/start_slave.inc +[ on master ] +drop table if exists t1; +create table t1 (i int); +insert into t1 values (1); +[ on slave: synchronized ] +[ on master ] +set sql_log_bin=0; +grant replication slave on *.* to rpl17mix@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль!'; +set sql_log_bin=1; +[ on slave ] +include/stop_slave.inc +change master to master_user='rpl17mix',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль!'; +ERROR HY000: String 'воттакойужпарольвоттакойужпарольвот' is too long for MASTER_PASSWORD (should be no longer than 96) +[ on master ] +set sql_log_bin=0; +drop user rpl32@127.0.0.1, rpl33@127.0.0.1, rpl16cyr@127.0.0.1, rpl17mix@127.0.0.1; +set sql_log_bin=1; +change master to master_user='root',master_password=''; +include/start_slave.inc +drop table if exists t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index bb037de4e6d..2082b4bf61c 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -307,13 +307,13 @@ reset slave; [ on master ] reset master; set sql_log_bin=0; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; set sql_log_bin=1; [ on slave ] -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; -change master to master_user='rpl',master_password='rpl'; +change master to master_user='rpl',master_password='rpl_password'; include/start_slave.inc show status like 'Rpl_semi_sync_slave_status'; Variable_name Value diff --git a/mysql-test/suite/rpl/t/rpl_password_boundaries.test b/mysql-test/suite/rpl/t/rpl_password_boundaries.test new file mode 100644 index 00000000000..cf8abfbda11 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_password_boundaries.test @@ -0,0 +1,112 @@ +source include/not_embedded.inc; +source include/master-slave.inc; +source include/rpl_reset.inc; + +# Suppress warnings that might be generated during the test +disable_query_log; +connection master; +call mtr.add_suppression("Timeout waiting for reply of binlog"); +connection slave; +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +enable_query_log; + +connection master; +echo [ on master ]; + +# wait for dying connections (if any) to disappear +let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed'; +--source include/wait_condition.inc + +# 32*3-character ASCII password should work all right + +set sql_log_bin=0; +grant replication slave on *.* to rpl32@127.0.0.1 identified by '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; +set sql_log_bin=1; + +connection slave; +echo [ on slave ]; +source include/stop_slave.inc; +change master to master_user='rpl32',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; +source include/start_slave.inc; + +connection master; +echo [ on master ]; +drop table if exists t1; +create table t1 (i int); +insert into t1 values (1); +sync_slave_with_master; +echo [ on slave: synchronized ]; + +connection master; +echo [ on master ]; + +# 32*3+1 -character ASCII password expected to fail +set sql_log_bin=0; +grant replication slave on *.* to rpl33@127.0.0.1 identified by '0123456789abcdef0123456789abcdef!'; +set sql_log_bin=1; + +connection slave; +echo [ on slave ]; +source include/stop_slave.inc; +--error ER_WRONG_STRING_LENGTH +change master to master_user='rpl33',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef!'; + +# Check also master_user and master_host +--error ER_WRONG_STRING_LENGTH +change master to master_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; +--error ER_WRONG_STRING_LENGTH +change master to master_host='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'; + +# 48-character cyrillic password should work all right +connection master; +echo [ on master ]; +set sql_log_bin=0; +grant replication slave on *.* to rpl16cyr@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль'; +set sql_log_bin=1; + +connection slave; +echo [ on slave ]; +SET NAMES utf8; +change master to master_user='rpl16cyr',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль'; +source include/start_slave.inc; + +connection master; +echo [ on master ]; +drop table if exists t1; +create table t1 (i int); +insert into t1 values (1); +sync_slave_with_master; +echo [ on slave: synchronized ]; + +# 48+1-character cyrillic password should fail + +connection master; +echo [ on master ]; +set sql_log_bin=0; +grant replication slave on *.* to rpl17mix@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль!'; +set sql_log_bin=1; + +connection slave; +echo [ on slave ]; +source include/stop_slave.inc; +--error ER_WRONG_STRING_LENGTH +change master to master_user='rpl17mix',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль!'; + +# Cleanup + +connection master; +echo [ on master ]; +set sql_log_bin=0; +drop user rpl32@127.0.0.1, rpl33@127.0.0.1, rpl16cyr@127.0.0.1, rpl17mix@127.0.0.1; +set sql_log_bin=1; + +connection slave; +change master to master_user='root',master_password=''; +source include/start_slave.inc; + +connection master; +drop table if exists t1; +sync_slave_with_master; + +connection master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 42adeed06a7..c42505241c1 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -462,14 +462,14 @@ if ($_tid) # Do not binlog the following statement because it will generate # different events for ROW and STATEMENT format set sql_log_bin=0; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; set sql_log_bin=1; connection slave; echo [ on slave ]; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; -change master to master_user='rpl',master_password='rpl'; +change master to master_user='rpl',master_password='rpl_password'; source include/start_slave.inc; show status like 'Rpl_semi_sync_slave_status'; connection master; diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index a885576ef1c..64525f81603 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -66,9 +66,9 @@ class Master_info : public Slave_reporting_capability /* the variables below are needed because we can change masters on the fly */ char master_log_name[FN_REFLEN]; - char host[HOSTNAME_LENGTH+1]; - char user[USERNAME_LENGTH+1]; - char password[MAX_PASSWORD_LENGTH+1]; + char host[HOSTNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1]; + char user[USERNAME_LENGTH*+1]; + char password[MAX_PASSWORD_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1]; bool ssl; // enables use of SSL connection if true char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN]; char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN]; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 53ac103dda1..631825f0527 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1541,6 +1541,31 @@ void kill_zombie_dump_threads(uint32 slave_server_id) } } +/** + Get value for a string parameter with error checking + + Note that in case of error the original string should not be updated! + + @ret 0 ok + @ret 1 error +*/ + +static bool get_string_parameter(char *to, const char *from, size_t length, + const char *name) +{ + if (from) // Empty paramaters allowed + { + size_t from_length; + if ((from_length= strlen(from)) > length) + { + my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name, (int) length); + return 1; + } + memcpy(to, from, from_length+1); + } + return 0; +} + /** Execute a CHANGE MASTER statement. @@ -1633,12 +1658,17 @@ bool change_master(THD* thd, Master_info* mi) } DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); - if (lex_mi->host) - strmake(mi->host, lex_mi->host, sizeof(mi->host)-1); - if (lex_mi->user) - strmake(mi->user, lex_mi->user, sizeof(mi->user)-1); - if (lex_mi->password) - strmake(mi->password, lex_mi->password, sizeof(mi->password)-1); + if (get_string_parameter(mi->host, lex_mi->host, sizeof(mi->host)-1, + "MASTER_HOST") || + get_string_parameter(mi->user, lex_mi->user, sizeof(mi->user)-1, + "MASTER_USER") || + get_string_parameter(mi->password, lex_mi->password, + sizeof(mi->password)-1, "MASTER_PASSWORD")) + { + ret= TRUE; + goto err; + } + if (lex_mi->port) mi->port = lex_mi->port; if (lex_mi->connect_retry) diff --git a/sql/sql_repl.h b/sql/sql_repl.h index 7dc58c47d52..c5a0b31388e 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -25,9 +25,9 @@ typedef struct st_slave_info { uint32 server_id; uint32 rpl_recovery_rank, master_id; - char host[HOSTNAME_LENGTH+1]; + char host[HOSTNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1]; char user[USERNAME_LENGTH+1]; - char password[MAX_PASSWORD_LENGTH+1]; + char password[MAX_PASSWORD_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1]; uint16 port; THD* thd; } SLAVE_INFO; From 5f68820cd4da742adee9d832603bae717c25b1fa Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 11 Jan 2013 00:53:07 +0200 Subject: [PATCH 293/349] Fixed problem with failing mysql_upgrade when proc table was not correct. Moved out creation of performance schema tables from mysql_system_tables.sql as the performance_tables creation scripts needs a working mysql.proc to work. client/mysql_upgrade.c: Added option -V, --version debian/dist/Debian/mariadb-server-5.5.files: Added mysql_performance_tables.sql debian/dist/Ubuntu/mariadb-server-5.5.files: Added mysql_performance_tables.sql mysql-test/lib/v1/mysql-test-run.pl: Added mysql_performance_tables.sql mysql-test/mysql-test-run.pl: Added mysql_performance_tables.sql scripts/CMakeLists.txt: Moved out creation of performance schema tables from mysql_system_tables.sql as the performance_tables creation scripts needs a working mysql.proc to work scripts/mysql_install_db.sh: Added mysql_performance_tables.sql scripts/mysql_performance_tables.sql: Moved out creation of performance schema tables from mysql_system_tables.sql as the performance_tables creation scripts needs a working mysql.proc to work scripts/mysql_system_tables.sql: Move creation of performance schema tables to mysql_performance_tables.sql Added 'flush tables' to get things to work if someone deletes a table like mysql.proc before run scripts/mysql_system_tables_fix.sql: ove performance table things to mysql_performance_tables.sql storage/perfschema/pfs.cc: Fixed comment --- client/mysql_upgrade.c | 9 +- debian/dist/Debian/mariadb-server-5.5.files | 1 + debian/dist/Ubuntu/mariadb-server-5.5.files | 1 + mysql-test/lib/v1/mysql-test-run.pl | 2 + mysql-test/mysql-test-run.pl | 5 + scripts/CMakeLists.txt | 6 +- scripts/mysql_install_db.sh | 7 +- scripts/mysql_performance_tables.sql | 402 ++++++++++++++++++++ scripts/mysql_system_tables.sql | 379 +----------------- scripts/mysql_system_tables_fix.sql | 23 -- storage/perfschema/pfs.cc | 2 +- 11 files changed, 429 insertions(+), 408 deletions(-) create mode 100644 scripts/mysql_performance_tables.sql diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 71bc936cfe6..7aaad96e985 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -22,7 +22,7 @@ #include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ -#define VER "1.2" +#define VER "1.3" #ifdef HAVE_SYS_WAIT_H #include @@ -148,6 +148,8 @@ static struct my_option my_long_options[]= &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Display more output about the process.", &opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"version", 'V', "Output version information and exit.", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"write-binlog", OPT_WRITE_BINLOG, "All commands including mysqlcheck are binlogged. Enabled by default;" "use --skip-write-binlog when commands should not be sent to replication slaves.", @@ -298,6 +300,11 @@ get_one_option(int optid, const struct my_option *opt, } add_option= 0; break; + case 'V': + printf("%s Ver %s Distrib %s, for %s (%s)\n", + my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); + die(0); + break; case OPT_SILENT: opt_verbose= 0; add_option= 0; diff --git a/debian/dist/Debian/mariadb-server-5.5.files b/debian/dist/Debian/mariadb-server-5.5.files index b236d19a2c5..ad2153fe28b 100644 --- a/debian/dist/Debian/mariadb-server-5.5.files +++ b/debian/dist/Debian/mariadb-server-5.5.files @@ -61,4 +61,5 @@ usr/share/mysql/errmsg-utf8.txt usr/share/mysql/fill_help_tables.sql usr/share/mysql/mysql_system_tables_data.sql usr/share/mysql/mysql_system_tables.sql +usr/share/mysql/mysql_performance_tables.sql usr/share/mysql/mysql_test_data_timezone.sql diff --git a/debian/dist/Ubuntu/mariadb-server-5.5.files b/debian/dist/Ubuntu/mariadb-server-5.5.files index e88e52689ae..d201577f7cf 100644 --- a/debian/dist/Ubuntu/mariadb-server-5.5.files +++ b/debian/dist/Ubuntu/mariadb-server-5.5.files @@ -63,4 +63,5 @@ usr/share/mysql/errmsg-utf8.txt usr/share/mysql/fill_help_tables.sql usr/share/mysql/mysql_system_tables_data.sql usr/share/mysql/mysql_system_tables.sql +usr/share/mysql/mysql_performance_tables.sql usr/share/mysql/mysql_test_data_timezone.sql diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index f20eab80ae9..4e1625db093 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -3229,6 +3229,8 @@ sub install_db ($$) { # for a production system mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", $bootstrap_sql_file); + mtr_appendfile_to_file("$path_sql_dir/mysql_performance_tables.sql", + $bootstrap_sql_file); # Add the mysql system tables initial data # for a production system diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d78a0254156..e2331e2e454 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3522,6 +3522,11 @@ sub mysql_install_db { mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql", $bootstrap_sql_file); + # Add the performance tables + # for a production system + mtr_appendfile_to_file("$sql_dir/mysql_performance_tables.sql", + $bootstrap_sql_file); + # Add the mysql system tables initial data # for a production system mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql", diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 91a47bf3d48..8f306abcb32 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -29,7 +29,7 @@ ENDIF() IF(CAT_EXECUTABLE) SET(CAT_COMMAND COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} - ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql > + ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql mysql_performance_tables.sql > ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql ) ELSEIF(WIN32) @@ -37,7 +37,7 @@ ELSEIF(WIN32) native_outfile ) SET(CAT_COMMAND COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} - cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql + cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql + mysql_performance_tables.sql ${native_outfile} ) ELSE() MESSAGE(FATAL_ERROR "Cannot concatenate files") @@ -55,6 +55,7 @@ ADD_CUSTOM_COMMAND( DEPENDS comp_sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql + ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql ) # Add target for the above to be built @@ -74,6 +75,7 @@ ENDIF() INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql + ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql ${FIX_PRIVILEGES_SQL} diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 91780570194..b28e8a3ba1c 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -1,6 +1,6 @@ #!/bin/sh # Copyright (c) 2000, 2011, Oracle and/or its affiliates. -# Copyright (c) 2009, 2011, Monty Program Ab +# Copyright (c) 2009, 2011,2013 Monty Program Ab # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -305,9 +305,10 @@ fi # Set up paths to SQL scripts required for bootstrap fill_help_tables="$pkgdatadir/fill_help_tables.sql" create_system_tables="$pkgdatadir/mysql_system_tables.sql" +create_system_tables2="$pkgdatadir/mysql_performance_tables.sql" fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql" -for f in "$fill_help_tables" "$create_system_tables" "$fill_system_tables" +for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables" do if test ! -f "$f" then @@ -424,7 +425,7 @@ mysqld_install_cmd_line() # Create the system and help tables by passing them to "mysqld --bootstrap" s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..." -if { echo "use mysql;"; cat "$create_system_tables" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null +if { echo "use mysql;"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null then s_echo "OK" else diff --git a/scripts/mysql_performance_tables.sql b/scripts/mysql_performance_tables.sql new file mode 100644 index 00000000000..193d79bb502 --- /dev/null +++ b/scripts/mysql_performance_tables.sql @@ -0,0 +1,402 @@ +-- +-- PERFORMANCE SCHEMA INSTALLATION +-- Note that this script is also reused by mysql_upgrade, +-- so we have to be very careful here to not destroy any +-- existing database named 'performance_schema' if it +-- can contain user data. +-- In case of downgrade, it's ok to drop unknown tables +-- from a future version, as long as they belong to the +-- performance schema engine. +-- + +set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema'); + +SET @l1="SET @broken_tables = (select count(*) from information_schema.tables"; +SET @l2=" where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')"; +SET @cmd=concat(@l1,@l2); + +-- Work around for bug#49542 +SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +SET @l1="SET @broken_views = (select count(*) from information_schema.views"; +SET @l2=" where table_schema='performance_schema')"; +SET @cmd=concat(@l1,@l2); + +-- Work around for bug#49542 +SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema'); + +SET @broken_events = (select count(*) from mysql.event where db='performance_schema'); + +SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events); + +-- +-- The performance schema database. +-- Only drop and create the database if this is safe (no broken_pfs). +-- This database is created, even in --without-perfschema builds, +-- so that the database name is always reserved by the MySQL implementation. +-- This script must be executed AFTER we have fixed the proc table, to +-- avoid errors with old proc tables. +-- + +SET @cmd= "DROP DATABASE IF EXISTS performance_schema"; + +SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +SET @cmd= "CREATE DATABASE performance_schema character set utf8"; + +SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- From this point, only create the performance schema tables +-- if the server is build with performance schema +-- + +set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO'); + +-- +-- TABLE COND_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.cond_instances("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null"; +SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_CURRENT +-- + +SET @l1="CREATE TABLE performance_schema.events_waits_current("; +SET @l2="THREAD_ID INTEGER not null,"; +SET @l3="EVENT_ID BIGINT unsigned not null,"; +SET @l4="EVENT_NAME VARCHAR(128) not null,"; +SET @l5="SOURCE VARCHAR(64),"; +SET @l6="TIMER_START BIGINT unsigned,"; +SET @l7="TIMER_END BIGINT unsigned,"; +SET @l8="TIMER_WAIT BIGINT unsigned,"; +SET @l9="SPINS INTEGER unsigned,"; +SET @l10="OBJECT_SCHEMA VARCHAR(64),"; +SET @l11="OBJECT_NAME VARCHAR(512),"; +SET @l12="OBJECT_TYPE VARCHAR(64),"; +SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l14="NESTING_EVENT_ID BIGINT unsigned,"; +SET @l15="OPERATION VARCHAR(16) not null,"; +SET @l16="NUMBER_OF_BYTES BIGINT unsigned,"; +SET @l17="FLAGS INTEGER unsigned"; +SET @l18=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_HISTORY +-- + +SET @l1="CREATE TABLE performance_schema.events_waits_history("; +-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_HISTORY_LONG +-- + +SET @l1="CREATE TABLE performance_schema.events_waits_history_long("; +-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE +-- + +SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_instance("; +SET @l2="EVENT_NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l4="COUNT_STAR BIGINT unsigned not null,"; +SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,"; +SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,"; +SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,"; +SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null"; +SET @l9=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +-- + +SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name("; +SET @l2="THREAD_ID INTEGER not null,"; +SET @l3="EVENT_NAME VARCHAR(128) not null,"; +SET @l4="COUNT_STAR BIGINT unsigned not null,"; +SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,"; +SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,"; +SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,"; +SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null"; +SET @l9=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME +-- + +SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name("; +SET @l2="EVENT_NAME VARCHAR(128) not null,"; +SET @l3="COUNT_STAR BIGINT unsigned not null,"; +SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,"; +SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,"; +SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,"; +SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null"; +SET @l8=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.file_instances("; +SET @l2="FILE_NAME VARCHAR(512) not null,"; +SET @l3="EVENT_NAME VARCHAR(128) not null,"; +SET @l4="OPEN_COUNT INTEGER unsigned not null"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_SUMMARY_BY_EVENT_NAME +-- + +SET @l1="CREATE TABLE performance_schema.file_summary_by_event_name("; +SET @l2="EVENT_NAME VARCHAR(128) not null,"; +SET @l3="COUNT_READ BIGINT unsigned not null,"; +SET @l4="COUNT_WRITE BIGINT unsigned not null,"; +SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"; +SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"; +SET @l7=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_SUMMARY_BY_INSTANCE +-- + +SET @l1="CREATE TABLE performance_schema.file_summary_by_instance("; +SET @l2="FILE_NAME VARCHAR(512) not null,"; +SET @l3="EVENT_NAME VARCHAR(128) not null,"; +SET @l4="COUNT_READ BIGINT unsigned not null,"; +SET @l5="COUNT_WRITE BIGINT unsigned not null,"; +SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"; +SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"; +SET @l8=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE MUTEX_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.mutex_instances("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l4="LOCKED_BY_THREAD_ID INTEGER"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE PERFORMANCE_TIMERS +-- + +SET @l1="CREATE TABLE performance_schema.performance_timers("; +SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,"; +SET @l3="TIMER_FREQUENCY BIGINT,"; +SET @l4="TIMER_RESOLUTION BIGINT,"; +SET @l5="TIMER_OVERHEAD BIGINT"; +SET @l6=") ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE RWLOCK_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.rwlock_instances("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,"; +SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null"; +SET @l6=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_CONSUMERS +-- + +SET @l1="CREATE TABLE performance_schema.setup_consumers("; +SET @l2="NAME VARCHAR(64) not null,"; +SET @l3="ENABLED ENUM ('YES', 'NO') not null"; +SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_INSTRUMENTS +-- + +SET @l1="CREATE TABLE performance_schema.setup_instruments("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="ENABLED ENUM ('YES', 'NO') not null,"; +SET @l4="TIMED ENUM ('YES', 'NO') not null"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_TIMERS +-- + +SET @l1="CREATE TABLE performance_schema.setup_timers("; +SET @l2="NAME VARCHAR(64) not null,"; +SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null"; +SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE THREADS +-- + +SET @l1="CREATE TABLE performance_schema.threads("; +SET @l2="THREAD_ID INTEGER not null,"; +SET @l3="PROCESSLIST_ID INTEGER,"; +SET @l4="NAME VARCHAR(128) not null"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- Unlike 'performance_schema', the 'mysql' database is reserved already, +-- so no user procedure is supposed to be there. +-- +-- NOTE: until upgrade is finished, stored routines are not available, +-- because system tables (e.g. mysql.proc) might be not usable. +-- +drop procedure if exists mysql.die; +create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.'; + +-- +-- For broken upgrades, SIGNAL the error +-- + +SET @cmd="call mysql.die()"; + +SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +drop procedure mysql.die; diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 2e97d2b8272..288f67dc45a 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -21,6 +21,7 @@ set sql_mode=''; set storage_engine=myisam; +flush tables; CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; @@ -100,384 +101,6 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; --- --- PERFORMANCE SCHEMA INSTALLATION --- Note that this script is also reused by mysql_upgrade, --- so we have to be very careful here to not destroy any --- existing database named 'performance_schema' if it --- can contain user data. --- In case of downgrade, it's ok to drop unknown tables --- from a future version, as long as they belong to the --- performance schema engine. --- - -set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema'); - -SET @l1="SET @broken_tables = (select count(*) from information_schema.tables"; -SET @l2=" where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')"; -SET @cmd=concat(@l1,@l2); - --- Work around for bug#49542 -SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -SET @l1="SET @broken_views = (select count(*) from information_schema.views"; -SET @l2=" where table_schema='performance_schema')"; -SET @cmd=concat(@l1,@l2); - --- Work around for bug#49542 -SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema'); - -SET @broken_events = (select count(*) from mysql.event where db='performance_schema'); - -SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events); - --- --- The performance schema database. --- Only drop and create the database if this is safe (no broken_pfs). --- This database is created, even in --without-perfschema builds, --- so that the database name is always reserved by the MySQL implementation. --- - -SET @cmd= "DROP DATABASE IF EXISTS performance_schema"; - -SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -SET @cmd= "CREATE DATABASE performance_schema character set utf8"; - -SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- From this point, only create the performance schema tables --- if the server is build with performance schema --- - -set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO'); - --- --- TABLE COND_INSTANCES --- - -SET @l1="CREATE TABLE performance_schema.cond_instances("; -SET @l2="NAME VARCHAR(128) not null,"; -SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null"; -SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_CURRENT --- - -SET @l1="CREATE TABLE performance_schema.events_waits_current("; -SET @l2="THREAD_ID INTEGER not null,"; -SET @l3="EVENT_ID BIGINT unsigned not null,"; -SET @l4="EVENT_NAME VARCHAR(128) not null,"; -SET @l5="SOURCE VARCHAR(64),"; -SET @l6="TIMER_START BIGINT unsigned,"; -SET @l7="TIMER_END BIGINT unsigned,"; -SET @l8="TIMER_WAIT BIGINT unsigned,"; -SET @l9="SPINS INTEGER unsigned,"; -SET @l10="OBJECT_SCHEMA VARCHAR(64),"; -SET @l11="OBJECT_NAME VARCHAR(512),"; -SET @l12="OBJECT_TYPE VARCHAR(64),"; -SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,"; -SET @l14="NESTING_EVENT_ID BIGINT unsigned,"; -SET @l15="OPERATION VARCHAR(16) not null,"; -SET @l16="NUMBER_OF_BYTES BIGINT unsigned,"; -SET @l17="FLAGS INTEGER unsigned"; -SET @l18=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_HISTORY --- - -SET @l1="CREATE TABLE performance_schema.events_waits_history("; --- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_HISTORY_LONG --- - -SET @l1="CREATE TABLE performance_schema.events_waits_history_long("; --- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE --- - -SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_instance("; -SET @l2="EVENT_NAME VARCHAR(128) not null,"; -SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; -SET @l4="COUNT_STAR BIGINT unsigned not null,"; -SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,"; -SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,"; -SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,"; -SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null"; -SET @l9=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME --- - -SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name("; -SET @l2="THREAD_ID INTEGER not null,"; -SET @l3="EVENT_NAME VARCHAR(128) not null,"; -SET @l4="COUNT_STAR BIGINT unsigned not null,"; -SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,"; -SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,"; -SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,"; -SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null"; -SET @l9=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME --- - -SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name("; -SET @l2="EVENT_NAME VARCHAR(128) not null,"; -SET @l3="COUNT_STAR BIGINT unsigned not null,"; -SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,"; -SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,"; -SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,"; -SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null"; -SET @l8=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE FILE_INSTANCES --- - -SET @l1="CREATE TABLE performance_schema.file_instances("; -SET @l2="FILE_NAME VARCHAR(512) not null,"; -SET @l3="EVENT_NAME VARCHAR(128) not null,"; -SET @l4="OPEN_COUNT INTEGER unsigned not null"; -SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE FILE_SUMMARY_BY_EVENT_NAME --- - -SET @l1="CREATE TABLE performance_schema.file_summary_by_event_name("; -SET @l2="EVENT_NAME VARCHAR(128) not null,"; -SET @l3="COUNT_READ BIGINT unsigned not null,"; -SET @l4="COUNT_WRITE BIGINT unsigned not null,"; -SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"; -SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"; -SET @l7=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE FILE_SUMMARY_BY_INSTANCE --- - -SET @l1="CREATE TABLE performance_schema.file_summary_by_instance("; -SET @l2="FILE_NAME VARCHAR(512) not null,"; -SET @l3="EVENT_NAME VARCHAR(128) not null,"; -SET @l4="COUNT_READ BIGINT unsigned not null,"; -SET @l5="COUNT_WRITE BIGINT unsigned not null,"; -SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"; -SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"; -SET @l8=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE MUTEX_INSTANCES --- - -SET @l1="CREATE TABLE performance_schema.mutex_instances("; -SET @l2="NAME VARCHAR(128) not null,"; -SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; -SET @l4="LOCKED_BY_THREAD_ID INTEGER"; -SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE PERFORMANCE_TIMERS --- - -SET @l1="CREATE TABLE performance_schema.performance_timers("; -SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,"; -SET @l3="TIMER_FREQUENCY BIGINT,"; -SET @l4="TIMER_RESOLUTION BIGINT,"; -SET @l5="TIMER_OVERHEAD BIGINT"; -SET @l6=") ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE RWLOCK_INSTANCES --- - -SET @l1="CREATE TABLE performance_schema.rwlock_instances("; -SET @l2="NAME VARCHAR(128) not null,"; -SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; -SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,"; -SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null"; -SET @l6=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_CONSUMERS --- - -SET @l1="CREATE TABLE performance_schema.setup_consumers("; -SET @l2="NAME VARCHAR(64) not null,"; -SET @l3="ENABLED ENUM ('YES', 'NO') not null"; -SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_INSTRUMENTS --- - -SET @l1="CREATE TABLE performance_schema.setup_instruments("; -SET @l2="NAME VARCHAR(128) not null,"; -SET @l3="ENABLED ENUM ('YES', 'NO') not null,"; -SET @l4="TIMED ENUM ('YES', 'NO') not null"; -SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE SETUP_TIMERS --- - -SET @l1="CREATE TABLE performance_schema.setup_timers("; -SET @l2="NAME VARCHAR(64) not null,"; -SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null"; -SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - --- --- TABLE THREADS --- - -SET @l1="CREATE TABLE performance_schema.threads("; -SET @l2="THREAD_ID INTEGER not null,"; -SET @l3="PROCESSLIST_ID INTEGER,"; -SET @l4="NAME VARCHAR(128) not null"; -SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; - -SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); - -SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges'; -- Remember for later if proxies_priv table already existed diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index cc697092e6e..c2d63f12399 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -621,29 +621,6 @@ ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_genera UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0; --- --- Unlike 'performance_schema', the 'mysql' database is reserved already, --- so no user procedure is supposed to be there. --- --- NOTE: until upgrade is finished, stored routines are not available, --- because system tables (e.g. mysql.proc) might be not usable. --- -drop procedure if exists mysql.die; -create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.'; - --- --- For broken upgrades, SIGNAL the error --- - -SET @cmd="call mysql.die()"; - -SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0'); -PREPARE stmt FROM @str; -EXECUTE stmt; -DROP PREPARE stmt; - -drop procedure mysql.die; - ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT; ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL; ALTER TABLE user MODIFY authentication_string TEXT NOT NULL; diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 9a6ada2f814..104fecb2d1e 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -119,7 +119,7 @@ mode when a server is installed. The implementation of the database creation script is located in - @verbatim ./scripts/mysql_system_tables.sql @endverbatim + @verbatim ./scripts/mysql_performance_tables.sql @endverbatim @subsection INT_CONFIG Runtime configuration interface From 9684140f02981f78a3fd0bbf0bd886a1ee2abbd4 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 11 Jan 2013 01:31:50 +0200 Subject: [PATCH 294/349] Fixed crashing bug in GROUP_CONCAT with ROLLUP Fixed MDEV-4002: Server crash or valgrind errors in Item_func_group_concat::setup and Item_func_group_concat::add mysql-test/r/group_by.result: Added test case for failing GROUP_CONCAT ... ROLLUP queries mysql-test/t/group_by.test: Added test case for failing GROUP_CONCAT ... ROLLUP queries sql/item_sum.cc: Fixed issue where field->table pointed to different temporary table than expected. Ensure that order->next points to the right object (could cause problems with setup_order()) --- mysql-test/r/group_by.result | 45 ++++++++++++++++++++++++++++++++++++ mysql-test/t/group_by.test | 43 ++++++++++++++++++++++++++++++++++ sql/item_sum.cc | 29 +++++++++++++++-------- 3 files changed, 108 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 9f942747594..9455efbc0a6 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2160,3 +2160,48 @@ f1 MIN(f2) MAX(f2) 4 00:25:00 00:25:00 DROP TABLE t1; #End of test#49771 +# +# Test of bug in GROUP_CONCAT with ROLLUP +# +CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM; +INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v'); +CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('v',6),('c',4),('v',3); +SELECT b, GROUP_CONCAT( a, b ORDER BY a, b ) +FROM t1 JOIN t2 ON c = b GROUP BY b; +b GROUP_CONCAT( a, b ORDER BY a, b ) +c 1c +v 2v,2v +SELECT b, GROUP_CONCAT( a, b ORDER BY a, b ) +FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP; +b GROUP_CONCAT( a, b ORDER BY a, b ) +c 1c +v 2v,2v +NULL 1c,2v,2v +DROP TABLE t1,t2; +# +# Test of MDEV-4002 +# +CREATE TABLE t1 ( +pk INT NOT NULL PRIMARY KEY, +d1 DOUBLE, +d2 DOUBLE, +i INT NOT NULL DEFAULT '0', +KEY (i) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2); +PREPARE stmt FROM " +SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP +"; +EXECUTE stmt; +i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +1 11.1 +2 22.2 +NULL 11.1,22.2 +EXECUTE stmt; +i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +1 11.1 +2 22.2 +NULL 11.1,22.2 +DROP TABLE t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 3af531418c5..4a7a4765385 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc # Initialise --disable_warnings @@ -1507,3 +1508,45 @@ SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1; DROP TABLE t1; --echo #End of test#49771 + +--echo # +--echo # Test of bug in GROUP_CONCAT with ROLLUP +--echo # + +CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM; +INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v'); + +CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('v',6),('c',4),('v',3); + +SELECT b, GROUP_CONCAT( a, b ORDER BY a, b ) +FROM t1 JOIN t2 ON c = b GROUP BY b; + +SELECT b, GROUP_CONCAT( a, b ORDER BY a, b ) +FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP; + +DROP TABLE t1,t2; + +--echo # +--echo # Test of MDEV-4002 +--echo # + +CREATE TABLE t1 ( + pk INT NOT NULL PRIMARY KEY, + d1 DOUBLE, + d2 DOUBLE, + i INT NOT NULL DEFAULT '0', + KEY (i) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2); + +PREPARE stmt FROM " +SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP +"; + +EXECUTE stmt; +EXECUTE stmt; + +DROP TABLE t1; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index e00ef3e592c..58d605478af 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2905,13 +2905,12 @@ int group_concat_key_cmp_with_distinct(void* arg, const void* key1, const void* key2) { Item_func_group_concat *item_func= (Item_func_group_concat*)arg; - TABLE *table= item_func->table; for (uint i= 0; i < item_func->arg_count_field; i++) { Item *item= item_func->args[i]; /* - If field_item is a const item then either get_tp_table_field returns 0 + If field_item is a const item then either get_tmp_table_field returns 0 or it is an item over a const table. */ if (item->const_item()) @@ -2923,7 +2922,8 @@ int group_concat_key_cmp_with_distinct(void* arg, const void* key1, */ Field *field= item->get_tmp_table_field(); int res; - uint offset= field->offset(field->table->record[0])-table->s->null_bytes; + uint offset= (field->offset(field->table->record[0]) - + field->table->s->null_bytes); if((res= field->cmp((uchar*)key1 + offset, (uchar*)key2 + offset))) return res; } @@ -2941,28 +2941,37 @@ int group_concat_key_cmp_with_order(void* arg, const void* key1, { Item_func_group_concat* grp_item= (Item_func_group_concat*) arg; ORDER **order_item, **end; - TABLE *table= grp_item->table; for (order_item= grp_item->order, end=order_item+ grp_item->arg_count_order; order_item < end; order_item++) { Item *item= *(*order_item)->item; + /* + If field_item is a const item then either get_tmp_table_field returns 0 + or it is an item over a const table. + */ + if (item->const_item()) + continue; /* We have to use get_tmp_table_field() instead of real_item()->get_tmp_table_field() because we want the field in the temporary table, not the original field + + Note that for the case of ROLLUP, field may point to another table + tham grp_item->table. This is howver ok as the table definitions are + the same. */ Field *field= item->get_tmp_table_field(); /* - If item is a const item then either get_tp_table_field returns 0 + If item is a const item then either get_tmp_table_field returns 0 or it is an item over a const table. */ - if (field && !item->const_item()) + if (field) { int res; uint offset= (field->offset(field->table->record[0]) - - table->s->null_bytes); + field->table->s->null_bytes); if ((res= field->cmp((uchar*)key1 + offset, (uchar*)key2 + offset))) return (*order_item)->asc ? res : -res; } @@ -3156,12 +3165,13 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, */ ORDER *tmp; if (!(tmp= (ORDER *) thd->alloc(sizeof(ORDER *) * arg_count_order + - sizeof(ORDER) * arg_count_order))) + sizeof(ORDER) * arg_count_order))) return; order= (ORDER **)(tmp + arg_count_order); for (uint i= 0; i < arg_count_order; i++, tmp++) { memcpy(tmp, item->order[i], sizeof(ORDER)); + tmp->next= i == arg_count_order-1 ? 0 : tmp+1; order[i]= tmp; } } @@ -3445,7 +3455,8 @@ bool Item_func_group_concat::setup(THD *thd) */ if (!(table= create_tmp_table(thd, tmp_table_param, all_fields, (ORDER*) 0, 0, TRUE, - (select_lex->options | thd->variables.option_bits), + (select_lex->options | + thd->variables.option_bits), HA_POS_ERROR, (char*) ""))) DBUG_RETURN(TRUE); table->file->extra(HA_EXTRA_NO_ROWS); From edc89f7511ac924f1c3ce14b356894939dea58c0 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 11 Jan 2013 02:03:43 +0200 Subject: [PATCH 295/349] Buildbot fixes and cleanups: - Added --verbose to BUILD scripts to get make to write out compile commands. - Detect if AM_EXTRA_MAKEFLAGS=VERBOSE=1 was used with build scripts. - Don't write warnings about replication variables when doing bootstrap. - Fixed that mysql_cond_wait() and mysql_cond_timedwait() will report original source file in case of errors. - Ignore some compiler warnings BUILD/FINISH.sh: Detect if AM_EXTRA_MAKEFLAGS=VERBOSE=1 or --verbose was used BUILD/SETUP.sh: Added --verbose to print out the full compile lines Updated help message client/mysqltest.cc: Fixed that one can use 'replace' with cat_file cmake/configure.pl: If --verbose is used, get make to write out compile commands debian/dist/Debian/rules: Added $AM_EXTRA_MAKEFLAGS to get VERBOSE=1 on buildbot builds debian/dist/Ubuntu/rules: Added $AM_EXTRA_MAKEFLAGS to get VERBOSE=1 on buildbot builds include/my_pthread.h: Made set_timespec_time_nsec() more portable. include/mysql/psi/mysql_thread.h: Fixed that mysql_cond_wait() and mysql_cond_timedwait() will report original source file in case of errors. mysql-test/suite/innodb/r/auto_increment_dup.result: Fixed wrong DBUG_SYNC mysql-test/suite/innodb/t/auto_increment_dup.test: Fixed wrong DBUG_SYNC mysql-test/suite/perfschema/include/upgrade_check.inc: Make test more portable for changes in *.sql files mysql-test/suite/perfschema/r/pfs_upgrade.result: Updated test results mysql-test/valgrind.supp: Ignore running Aria checkpoint thread scripts/mysqlaccess.sh: Changed reference of bugs database Ensure that also client-server group is read. sql/handler.cc: Added missing syncpoint sql/mysqld.cc: Don't write warnings about replication variables when doing bootstrap sql/mysqld.h: Don't write warnings about replication variables when doing bootstrap sql/rpl_rli.cc: Don't write warnings about replication variables when doing bootstrap sql/sql_insert.cc: Don't mask SERVER_SHUTDOWN in insert_delayed This is done to be able to distingush between shutdown and interrupt errors support-files/compiler_warnings.supp: Ignore some compiler warnings in xtradb,innobase, oqgraph, yassl, string3.h --- BUILD/FINISH.sh | 7 +- BUILD/SETUP.sh | 8 + client/mysqltest.cc | 10 +- cmake/configure.pl | 5 + debian/dist/Debian/rules | 2 +- debian/dist/Ubuntu/rules | 2 +- include/my_pthread.h | 6 +- include/mysql/psi/mysql_thread.h | 17 +- .../suite/innodb/r/auto_increment_dup.result | 2 +- .../suite/innodb/t/auto_increment_dup.test | 2 +- .../perfschema/include/upgrade_check.inc | 2 + .../suite/perfschema/r/pfs_upgrade.result | 180 +++++++++--------- mysql-test/valgrind.supp | 8 + scripts/mysqlaccess.sh | 6 +- sql/handler.cc | 1 + sql/mysqld.cc | 4 +- sql/mysqld.h | 2 +- sql/rpl_rli.cc | 3 +- sql/sql_insert.cc | 9 +- support-files/compiler_warnings.supp | 13 +- 20 files changed, 168 insertions(+), 121 deletions(-) diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index 7f8859dde54..e29b6936849 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -27,6 +27,11 @@ then configure="$configure --print" fi +if test "$AM_EXTRA_MAKEFLAGS" = "VERBOSE=1" -o "$verbose_make" = "1" +then + configure="$configure --verbose" +fi + commands="\ /bin/rm -rf configure; /bin/rm -rf CMakeCache.txt CMakeFiles/ @@ -45,7 +50,7 @@ if [ -z "$just_configure" -a -z "$just_clean" ] then commands="$commands -$make $AM_MAKEFLAGS" +$make $AM_MAKEFLAGS $AM_EXTRA_MAKEFLAGS" if [ "x$strip" = "xyes" ] then diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 9f552f1ca5e..802c5788c08 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -30,6 +30,11 @@ Usage: $0 [-h|-n] [configure-options] -h, --help Show this help message. -n, --just-print Don't actually run any commands; just print them. -c, --just-configure Stop after running configure. + --extra-configs=xxx Add this to configure options + --extra-flags=xxx Add this C and CXX flags + --extra-cflags=xxx Add this to C flags + --extra-cxxflags=xxx Add this to CXX flags + --verbose Print out full compile lines --with-debug=full Build with full debug(no optimizations, keep call stack). --warning-mode=[old|pedantic|maintainer] Influences the debug flags. Old is default. @@ -62,6 +67,8 @@ parse_options() just_configure=1;; -n | --just-print | --print) just_print=1;; + --verbose) + verbose_make=1;; -h | --help) usage exit 0;; @@ -87,6 +94,7 @@ just_configure= warning_mode= maintainer_mode= full_debug= +verbose_make= parse_options "$@" diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 5415b653615..7bc52941700 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1654,12 +1654,12 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename) { int fd; size_t len; - char buff[512]; + char buff[16384]; if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0) return 1; while((len= my_read(fd, (uchar*)&buff, - sizeof(buff), MYF(0))) > 0) + sizeof(buff)-1, MYF(0))) > 0) { char *p= buff, *start= buff; while (p < buff+len) @@ -1670,7 +1670,8 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename) /* Add fake newline instead of cr and output the line */ *p= '\n'; p++; /* Step past the "fake" newline */ - dynstr_append_mem(ds, start, p-start); + *p= 0; + replace_dynstr_append_mem(ds, start, p-start); p++; /* Step past the "fake" newline */ start= p; } @@ -1678,7 +1679,8 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename) p++; } /* Output any chars that migh be left */ - dynstr_append_mem(ds, start, p-start); + *p= 0; + replace_dynstr_append_mem(ds, start, p-start); } my_close(fd, MYF(0)); return 0; diff --git a/cmake/configure.pl b/cmake/configure.pl index 3a7d187c0be..1217d314d72 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -222,6 +222,11 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DENABLE_GCOV=ON"; next; } + if ($option =~ /verbose/) + { + $cmakeargs = $cmakeargs." -DCMAKE_VERBOSE_MAKEFILE=1"; + next; + } $option = uc($option); $option =~ s/-/_/g; diff --git a/debian/dist/Debian/rules b/debian/dist/Debian/rules index 96ad527542d..feef863c5eb 100755 --- a/debian/dist/Debian/rules +++ b/debian/dist/Debian/rules @@ -84,7 +84,7 @@ build-stamp: configure @echo "RULES.$@" dh_testdir - cd $(builddir) && $(MAKE) $(MAKE_J) + cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS) ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),) # Don't know why the following is necessary... diff --git a/debian/dist/Ubuntu/rules b/debian/dist/Ubuntu/rules index bb413ad83cc..2852864c5a0 100755 --- a/debian/dist/Ubuntu/rules +++ b/debian/dist/Ubuntu/rules @@ -84,7 +84,7 @@ build-stamp: configure @echo "RULES.$@" dh_testdir - cd $(builddir) && $(MAKE) $(MAKE_J) + cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS) ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),) # Don't know why the following is necessary... diff --git a/include/my_pthread.h b/include/my_pthread.h index 404d5fb5258..5a921fe0f26 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -350,9 +350,9 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); #ifndef set_timespec_time_nsec #define set_timespec_time_nsec(ABSTIME,NSEC) do { \ - ulonglong now= (NSEC); \ - (ABSTIME).MY_tv_sec= (now / 1000000000ULL); \ - (ABSTIME).MY_tv_nsec= (now % 1000000000ULL); \ + ulonglong _now_= (NSEC); \ + (ABSTIME).MY_tv_sec= (_now_ / 1000000000ULL); \ + (ABSTIME).MY_tv_nsec= (_now_ % 1000000000ULL); \ } while(0) #endif /* !set_timespec_time_nsec */ diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 18b4fde8c5c..7615985ec24 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -477,7 +477,7 @@ typedef struct st_mysql_cond mysql_cond_t; Instrumented cond_wait. @c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait. */ -#ifdef HAVE_PSI_INTERFACE +#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX) #define mysql_cond_wait(C, M) \ inline_mysql_cond_wait(C, M, __FILE__, __LINE__) #else @@ -491,7 +491,7 @@ typedef struct st_mysql_cond mysql_cond_t; @c mysql_cond_timedwait is a drop-in replacement for @c pthread_cond_timedwait. */ -#ifdef HAVE_PSI_INTERFACE +#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX) #define mysql_cond_timedwait(C, M, W) \ inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__) #else @@ -963,7 +963,7 @@ static inline int inline_mysql_cond_destroy( static inline int inline_mysql_cond_wait( mysql_cond_t *that, mysql_mutex_t *mutex -#ifdef HAVE_PSI_INTERFACE +#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX) , const char *src_file, uint src_line #endif ) @@ -980,7 +980,11 @@ static inline int inline_mysql_cond_wait( PSI_server->start_cond_wait(locker, src_file, src_line); } #endif +#ifdef SAFE_MUTEX + result= safe_cond_wait(&that->m_cond, &mutex->m_mutex, src_file, src_line); +#else result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex); +#endif #ifdef HAVE_PSI_INTERFACE if (likely(locker != NULL)) PSI_server->end_cond_wait(locker, result); @@ -992,7 +996,7 @@ static inline int inline_mysql_cond_timedwait( mysql_cond_t *that, mysql_mutex_t *mutex, struct timespec *abstime -#ifdef HAVE_PSI_INTERFACE +#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX) , const char *src_file, uint src_line #endif ) @@ -1009,7 +1013,12 @@ static inline int inline_mysql_cond_timedwait( PSI_server->start_cond_wait(locker, src_file, src_line); } #endif +#ifdef SAFE_MUTEX + result= safe_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime, + src_file, src_line); +#else result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime); +#endif #ifdef HAVE_PSI_INTERFACE if (likely(locker != NULL)) PSI_server->end_cond_wait(locker, result); diff --git a/mysql-test/suite/innodb/r/auto_increment_dup.result b/mysql-test/suite/innodb/r/auto_increment_dup.result index 5bf901cb212..def975af6dd 100644 --- a/mysql-test/suite/innodb/r/auto_increment_dup.result +++ b/mysql-test/suite/innodb/r/auto_increment_dup.result @@ -13,7 +13,7 @@ INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'; # # Connection 2 # -SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2'; +SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2'; affected rows: 0 SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1'; affected rows: 0 diff --git a/mysql-test/suite/innodb/t/auto_increment_dup.test b/mysql-test/suite/innodb/t/auto_increment_dup.test index ad439024f65..abbff46075a 100644 --- a/mysql-test/suite/innodb/t/auto_increment_dup.test +++ b/mysql-test/suite/innodb/t/auto_increment_dup.test @@ -33,7 +33,7 @@ SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1'; --echo # --echo # Connection 2 --echo # -SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2'; +SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2'; SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1'; INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2'; diff --git a/mysql-test/suite/perfschema/include/upgrade_check.inc b/mysql-test/suite/perfschema/include/upgrade_check.inc index 440eb8f7123..52d4cfd1e63 100644 --- a/mysql-test/suite/perfschema/include/upgrade_check.inc +++ b/mysql-test/suite/perfschema/include/upgrade_check.inc @@ -8,6 +8,8 @@ --source include/wait_until_count_sessions.inc # Verify that mysql_upgrade complained about the performance_schema + +--replace_regex /at line [0-9]+/at line ###/ --cat_file $err_file --error 0,1 --remove_file $out_file diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result index 4d7d9e28fe8..97c67e45ad3 100644 --- a/mysql-test/suite/perfschema/r/pfs_upgrade.result +++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result @@ -8,24 +8,24 @@ use performance_schema; show tables like "user_table"; Tables_in_performance_schema (user_table) user_table -ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists -ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists -ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists -ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists -ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists -ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists -ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists -ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists -ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists -ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists -ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists -ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists -ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists -ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists -ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists -ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists -ERROR 1050 (42S01) at line 478: Table 'threads' already exists -ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database. +ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'threads' already exists +ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_table"; Tables_in_performance_schema (user_table) @@ -38,24 +38,24 @@ use performance_schema; show tables like "user_view"; Tables_in_performance_schema (user_view) user_view -ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists -ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists -ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists -ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists -ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists -ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists -ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists -ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists -ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists -ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists -ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists -ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists -ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists -ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists -ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists -ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists -ERROR 1050 (42S01) at line 478: Table 'threads' already exists -ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database. +ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'threads' already exists +ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_view"; Tables_in_performance_schema (user_view) @@ -66,24 +66,24 @@ drop view test.user_view; create procedure test.user_proc() select "Not supposed to be here"; update mysql.proc set db='performance_schema' where name='user_proc'; -ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists -ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists -ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists -ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists -ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists -ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists -ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists -ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists -ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists -ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists -ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists -ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists -ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists -ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists -ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists -ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists -ERROR 1050 (42S01) at line 478: Table 'threads' already exists -ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database. +ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'threads' already exists +ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; name @@ -94,24 +94,24 @@ drop procedure test.user_proc; create function test.user_func() returns integer return 0; update mysql.proc set db='performance_schema' where name='user_func'; -ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists -ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists -ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists -ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists -ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists -ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists -ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists -ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists -ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists -ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists -ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists -ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists -ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists -ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists -ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists -ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists -ERROR 1050 (42S01) at line 478: Table 'threads' already exists -ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database. +ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'threads' already exists +ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; name @@ -122,24 +122,24 @@ drop function test.user_func; create event test.user_event on schedule every 1 day do select "not supposed to be here"; update mysql.event set db='performance_schema' where name='user_event'; -ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists -ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists -ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists -ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists -ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists -ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists -ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists -ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists -ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists -ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists -ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists -ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists -ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists -ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists -ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists -ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists -ERROR 1050 (42S01) at line 478: Table 'threads' already exists -ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database. +ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists +ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists +ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists +ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists +ERROR 1050 (42S01) at line ###: Table 'threads' already exists +ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.event where db='performance_schema'; name diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 800a5a90b39..39748edd476 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -637,6 +637,14 @@ fun:kill_server } +{ + Aria checkpoint background thread not dying fast enough + Memcheck:Leak + fun:calloc + fun:my_thread_init + fun:ma_checkpoint_background +} + # # Warning caused by small memory leak in threaded dlopen # diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh index 9fb9e78e753..43844e5ec68 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -930,7 +930,7 @@ sub MergeConfigFile { $unsafeConfig = $fname; } } - if ( $group eq 'client' ) { + if ( $group eq 'client' || $group eq "client-server") { $MYSQL_CNF{'mysql'}{$item} = $value; $MYSQL_CNF{'mysqldump'}{$item} = $value; } else { @@ -2423,7 +2423,7 @@ sub Print_Header { sub Print_Footer { if ($MySQLaccess::CMD) { #command-line mode print "\n" - ."BUGs can be reported by email to bugs\@mysql.com\n"; + ."BUGs can be reported trough https://mariadb.atlassian.net/browse/MDEV\n"; } if ($MySQLaccess::CGI) { #CGI-BIN mode if ($MySQLaccess::Param{'brief'}) { @@ -2431,7 +2431,7 @@ sub Print_Footer { } print "
\n" ."
\n" - ."BUGs can be reported by email to bugs\@mysql.com
\n" + ."BUGs can be reported through MariaDB JIRA
\n" # ."Don't forget to mention the version $VERSION!
\n" ."
\n" ."\n" diff --git a/sql/handler.cc b/sql/handler.cc index 5108e3abc40..679ef346fbb 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -5125,6 +5125,7 @@ int handler::ha_write_row(uchar *buf) int error; Log_func *log_func= Write_rows_log_event::binlog_row_logging_function; DBUG_ENTER("handler::ha_write_row"); + DEBUG_SYNC_C("ha_write_row_start"); MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str); mark_trx_read_write(); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c4c65977e60..37e54a6638c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -706,8 +706,8 @@ char *opt_logname, *opt_slow_logname, *opt_bin_logname; static volatile sig_atomic_t kill_in_progress; my_bool opt_stack_trace; -my_bool opt_expect_abort= 0; -static my_bool opt_bootstrap, opt_myisam_log; +my_bool opt_expect_abort= 0, opt_bootstrap= 0; +static my_bool opt_myisam_log; static int cleanup_done; static ulong opt_specialflag; static char *opt_binlog_index_name; diff --git a/sql/mysqld.h b/sql/mysqld.h index 554c662e90f..293c20ade55 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -77,7 +77,7 @@ extern CHARSET_INFO *character_set_filesystem; extern MY_BITMAP temp_pool; extern bool opt_large_files, server_id_supplied; extern bool opt_update_log, opt_bin_log, opt_error_log; -extern my_bool opt_log, opt_slow_log; +extern my_bool opt_log, opt_slow_log, opt_bootstrap; extern my_bool opt_backup_history_log; extern my_bool opt_backup_progress_log; extern ulonglong log_output_options; diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 252b4f3f5b9..cbd7ac8f5ef 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -188,7 +188,8 @@ a file name for --relay-log-index option", opt_relaylog_index_name); ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin", 1, buf); /* We send the warning only at startup, not after every RESET SLAVE */ - if (!opt_relay_logname && !opt_relaylog_index_name && !name_warning_sent) + if (!opt_relay_logname && !opt_relaylog_index_name && !name_warning_sent && + !opt_bootstrap) { /* User didn't give us info to name the relay log index file. diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index ef3f81f18c5..45cc7357155 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2269,11 +2269,8 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request, want to send "Server shutdown in progress" in the INSERT THREAD. */ - if (di->thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN) - my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0)); - else - my_message(di->thd.stmt_da->sql_errno(), di->thd.stmt_da->message(), - MYF(0)); + my_message(di->thd.stmt_da->sql_errno(), di->thd.stmt_da->message(), + MYF(0)); } di->unlock(); goto end_create; @@ -2358,7 +2355,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) killed using mysql_notify_thread_having_shared_lock() or kill_delayed_threads_for_table(). */ - if (!thd.is_error() || thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN) + if (!thd.is_error()) my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0)); else my_message(thd.stmt_da->sql_errno(), thd.stmt_da->message(), MYF(0)); diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index a4640f843a1..809369bc436 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -136,6 +136,11 @@ xaction_xt\.cc: may be used uninitialized in this function lock_xt\.cc : uninitialized local variable .* used restart_xt\.cc : dereferencing pointer .* does break strict-aliasing +# +# oqgraph errors that are hard to fix +# +oqgraph/graphcore\.cc : may be used uninitialized in this function + # # I think these are due to mix of C and C++. # @@ -152,6 +157,7 @@ include/runtime.hpp: .*pure_error.* .*/extra/yassl/taocrypt/src/file\.cpp: ignoring return value .*/extra/yassl/taocrypt/src/integer\.cpp: control reaches end of non-void function mySTL/algorithm\.hpp: is used uninitialized in this function +include/pwdbased\.hpp: comparison of unsigned expression # # Groff warnings on OpenSUSE. @@ -176,6 +182,7 @@ net_serv.cc : .*conversion from 'SOCKET' to 'int'.* # Ignorable warnings from header files # backward_warning\.h : This file includes at least one +/usr/include/i386-linux-gnu/bits/string3\.h: memset used with constant zero length parameter # allow a little moving space for the warning below mi_packrec\.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 560-600 @@ -190,8 +197,9 @@ ctype-simple\.c : .*unary minus operator applied to unsigned type, result still # Wrong warning due to GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478 regexec\.c : passing argument 3 of.*matcher.* discards qualifiers from pointer target type libmysql\.c: passing argument 2 of .*memcpy.* discards qualifiers from pointer target type : 3000-4000 -storage/xtradb/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifiers from pointer target type : 2500-3500 -storage/xtradb/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300 +storage/.*/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifiers from pointer target type : 2500-3500 +storage/.*/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300 +storage/.*/btr/btr0sea\.c : passing argument 2 of .*btr_cur_position.* discards qualifiers from pointer # # Strange things from autoconf that is probably safe to ignore @@ -199,3 +207,4 @@ storage/xtradb/sync/sync0rw\.c : passing argument 1 of .*memset.* discards quali configure.in : warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body configure.in : config/ac-macros/character_sets.m4.*prefer named diversions +warning: File listed twice From d8acafcbf273120726dea27507a1a3ab7b0bd821 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 11 Jan 2013 12:44:21 +0100 Subject: [PATCH 296/349] MDEV-4020 : Make sure strmov symbol is exported by client library on Linux (even if the server and libraries itself use stpcpy instead of it) It is a workaround that allows myodbc built by certain distributions' (CentOS,Fedora) to peacefully coexist with mariadb client libraries. The problem is that MyODBC in these distros needs strmov() to be exported by mysql client shared library, or else myodbc fails to load. --- strings/strmov.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/strings/strmov.c b/strings/strmov.c index 1a945ad2a6f..7a3f2d02dcf 100644 --- a/strings/strmov.c +++ b/strings/strmov.c @@ -34,10 +34,6 @@ into dst, which seems useful. */ -#include "strings_def.h" - -#ifndef strmov - #if !defined(MC68000) && !defined(DS90) char *strmov(register char *dst, register const char *src) @@ -60,5 +56,3 @@ char *strmov(dst, src) } #endif - -#endif /* strmov */ From 12bf6fe85893f6a69a74ec1c733e533051058dd3 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 11 Jan 2013 20:26:34 -0800 Subject: [PATCH 297/349] Fixed bug mdev-4025. The bug could lead to a wrong estimate of the number of expected rows in the output of the EXPLAIN commands for queries with GROUP BY. This could be observed in the test case for LP bug 934348. --- mysql-test/r/subselect_sj_jcl6.result | 4 ++-- sql/sql_select.cc | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index a189132b11a..6247688d635 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2978,7 +2978,7 @@ EXPLAIN SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t index idx_a idx_a 4 NULL 1 Using index +1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where 2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index @@ -2992,7 +2992,7 @@ EXPLAIN SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t index idx_a idx_a 4 NULL 1 Using index +1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where 2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ca7e1bf2a66..aa47793df8f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -18371,8 +18371,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg, and as result we'll choose an index scan when using ref/range access + filesort will be cheaper. */ - select_limit= (ha_rows) (select_limit < fanout ? - 1 : select_limit/fanout); + if (select_limit_arg != HA_POS_ERROR) + select_limit= (ha_rows) (select_limit < fanout ? + 1 : select_limit/fanout); /* We assume that each of the tested indexes is not correlated with ref_key. Thus, to select first N records we have to scan From cf79c01cc7b9071c68055c90659da58c3b3b7363 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Jan 2013 15:05:05 +0200 Subject: [PATCH 298/349] Fix for bug MDEV-3992 Analysis: The crash is a result of incorrect analysis of whether a secondary key can be extended with a primary in order to compute ORDER BY. The analysis is done in test_if_order_by_key(). This function doesn't take into account that the primary key may in fact index the same columns as the secondary key. For the test query test_if_order_by_key says that there is an extended key with total 2 keyparts. At the same time, the condition if (pkinfo->key_part[i].field->key_start.is_set(nr)) in test_if_cheaper_oredring() becomes true for (i == 0), which results in an invalid access to rec_per_key[-1]. Solution: The best solution would be to reuse KEY::ext_key_parts that is already computed by open_binary_frm(), however after detailed analysis the conclusion is that the change would be too intrusive for a GA release. The solution for 5.5 is to add a guard for the case when the 0-th key part is considered, and to assume that all keys will be scanned in this case. --- mysql-test/r/group_by_innodb.result | 30 +++++++++++++++++++++++ mysql-test/t/group_by_innodb.test | 38 +++++++++++++++++++++++++++++ sql/sql_select.cc | 13 ++++++++-- 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 mysql-test/r/group_by_innodb.result create mode 100644 mysql-test/t/group_by_innodb.test diff --git a/mysql-test/r/group_by_innodb.result b/mysql-test/r/group_by_innodb.result new file mode 100644 index 00000000000..d165834cbe3 --- /dev/null +++ b/mysql-test/r/group_by_innodb.result @@ -0,0 +1,30 @@ +# +# MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering +# on GROUP BY with indexes on InnoDB table +# +CREATE TABLE t1 ( +pk INT PRIMARY KEY, +a VARCHAR(1) NOT NULL, +KEY (pk) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'a'),(2,'b'); +EXPLAIN +SELECT COUNT(*), pk field1, pk AS field2 +FROM t1 WHERE a = 'r' OR pk = 183 +GROUP BY field1, field2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where +SELECT COUNT(*), pk field1, pk AS field2 +FROM t1 WHERE a = 'r' OR pk = 183 +GROUP BY field1, field2; +COUNT(*) field1 field2 +EXPLAIN +SELECT COUNT(*), pk field1 FROM t1 +WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where +SELECT COUNT(*), pk field1 FROM t1 +WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; +COUNT(*) field1 +drop table t1; +End of 5.5 tests diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test new file mode 100644 index 00000000000..0d5e5e9ae30 --- /dev/null +++ b/mysql-test/t/group_by_innodb.test @@ -0,0 +1,38 @@ +# +# Test GROUP BY queries that utilize InnoDB extended keys +# + +--source include/have_innodb.inc + +--echo # +--echo # MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering +--echo # on GROUP BY with indexes on InnoDB table +--echo # + +CREATE TABLE t1 ( + pk INT PRIMARY KEY, + a VARCHAR(1) NOT NULL, + KEY (pk) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (1,'a'),(2,'b'); + +EXPLAIN +SELECT COUNT(*), pk field1, pk AS field2 +FROM t1 WHERE a = 'r' OR pk = 183 +GROUP BY field1, field2; + +SELECT COUNT(*), pk field1, pk AS field2 +FROM t1 WHERE a = 'r' OR pk = 183 +GROUP BY field1, field2; + +EXPLAIN +SELECT COUNT(*), pk field1 FROM t1 +WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; + +SELECT COUNT(*), pk field1 FROM t1 +WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; + +drop table t1; + +--echo End of 5.5 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9bbc139927e..cb9faecb772 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -18144,7 +18144,15 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, key_part_end=key_part+table->key_info[table->s->primary_key].key_parts; const_key_parts=table->const_key_parts[table->s->primary_key]; - for (; const_key_parts & 1 ; const_key_parts>>= 1) + /* + Check for constness only those keyparts of the PK suffix, that will + be used to extend the secondary key 'idx'. This handles the case when + some columns of the PK are used in the secondary index. + */ + for (uint pk_part_idx= 0; + ((const_key_parts & 1) && + (table->key_info[idx].ext_key_part_map & (1 << pk_part_idx))); + const_key_parts>>= 1, pk_part_idx++) key_part++; /* The primary and secondary key parts were all const (i.e. there's @@ -23009,7 +23017,8 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, if rec_per_key[0] != 0. */ DBUG_ASSERT(pkinfo->rec_per_key[i]); - rec_per_key*= pkinfo->rec_per_key[i-1]; + rec_per_key*= (i == 0) ? table_records : + pkinfo->rec_per_key[i-1]; rec_per_key/= pkinfo->rec_per_key[i]; } } From a87eab6061068491ec9004ae54c46630619cb531 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Jan 2013 14:33:08 +0200 Subject: [PATCH 299/349] Fix for bug MDEV-3992, second attempt The previous fix for MDEV-3992 was incomplete, because it still computed incorrectly the number of keyparts of the extended secondary key in the case when columns of the PK participate in the secondary key. This patch by Monty corrects the above problem. --- sql/sql_select.cc | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index cb9faecb772..79cef2c3538 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -18139,26 +18139,36 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, table->s->primary_key != MAX_KEY && table->s->primary_key != idx) { + KEY_PART_INFO *start,*end; + uint pk_part_idx= 0; on_pk_suffix= TRUE; - key_part= table->key_info[table->s->primary_key].key_part; - key_part_end=key_part+table->key_info[table->s->primary_key].key_parts; + start= key_part= table->key_info[table->s->primary_key].key_part; const_key_parts=table->const_key_parts[table->s->primary_key]; /* - Check for constness only those keyparts of the PK suffix, that will - be used to extend the secondary key 'idx'. This handles the case when - some columns of the PK are used in the secondary index. + Calculate true key_part_end and const_key_parts + (we have to stop as first not continous primary key part) */ - for (uint pk_part_idx= 0; - ((const_key_parts & 1) && - (table->key_info[idx].ext_key_part_map & (1 << pk_part_idx))); - const_key_parts>>= 1, pk_part_idx++) - key_part++; + for (key_part_end= key_part, + end= key_part+table->key_info[table->s->primary_key].key_parts; + key_part_end < end; key_part_end++, pk_part_idx++) + { + /* Found hole in the pk_parts; Abort */ + if (!(table->key_info[idx].ext_key_part_map & + (((key_part_map) 1) << pk_part_idx))) + break; + } + /* Adjust const_key_parts */ + const_key_parts&= (((key_part_map) 1) << pk_part_idx) -1; + + for (; const_key_parts & 1 ; const_key_parts>>= 1) + key_part++; /* - The primary and secondary key parts were all const (i.e. there's - one row). The sorting doesn't matter. + Test if the primary key parts were all const (i.e. there's one row). + The sorting doesn't matter. */ - if (key_part == key_part_end && reverse == 0) + if (key_part == start+table->key_info[table->s->primary_key].key_parts && + reverse == 0) { key_parts= 0; reverse= 1; @@ -18178,7 +18188,8 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, if (reverse && flag != reverse) DBUG_RETURN(0); reverse=flag; // Remember if reverse - key_part++; + if (key_part < key_part_end) + key_part++; } if (on_pk_suffix) { @@ -22940,7 +22951,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, { int direction; ha_rows select_limit= select_limit_arg; - uint used_key_parts; + uint used_key_parts= 0; if (keys.is_set(nr) && (direction= test_if_order_by_key(order, table, nr, &used_key_parts))) @@ -23017,8 +23028,8 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, if rec_per_key[0] != 0. */ DBUG_ASSERT(pkinfo->rec_per_key[i]); - rec_per_key*= (i == 0) ? table_records : - pkinfo->rec_per_key[i-1]; + DBUG_ASSERT(i > 0); + rec_per_key*= pkinfo->rec_per_key[i-1]; rec_per_key/= pkinfo->rec_per_key[i]; } } From 750b9147fced7202b541be946e044eb739b20a03 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 15 Jan 2013 17:46:46 +0100 Subject: [PATCH 300/349] remove thd_mark_as_hard_kill() (because it's conceptually wrong. only the user can decide whether the kill is allowed to leave tables in the inconsistent state, storage engine has no say in that) --- include/mysql/plugin.h | 12 ------------ include/mysql/plugin_audit.h.pp | 1 - include/mysql/plugin_auth.h.pp | 1 - include/mysql/plugin_ftparser.h.pp | 1 - sql/handler.h | 1 - sql/sql_class.cc | 12 ------------ sql/sql_class.h | 11 ----------- storage/innobase/handler/ha_innodb.cc | 2 +- storage/xtradb/handler/ha_innodb.cc | 2 +- 9 files changed, 2 insertions(+), 41 deletions(-) diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 7617f5968d9..d30abb190d0 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -641,18 +641,6 @@ int mysql_tmpfile(const char *prefix); */ int thd_killed(const MYSQL_THD thd); -/** - Increase level of kill ; Ensures that thd_killed() returns true. - - @param thd Thread connection handle - - @details - Needed if storage engine wants to abort things because of a 'soft' (ie, - safe) kill but still uses thd_killed() to check if it's killed. -**/ - -void thd_mark_as_hard_kill(MYSQL_THD thd); - /** Return the thread id of a user thread diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index ea3447762ca..b987f690592 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -227,7 +227,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); -void thd_mark_as_hard_kill(void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 45999056435..113aaf62d19 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -227,7 +227,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); -void thd_mark_as_hard_kill(void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index 84299c77d9b..6011e7f7519 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -180,7 +180,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); -void thd_mark_as_hard_kill(void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/sql/handler.h b/sql/handler.h index e5da92b0d40..af5d7e6d606 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -868,7 +868,6 @@ struct handlerton Tell handler that query has been killed. hard_kill is set in case of HARD KILL (abort query even if it may corrupt table). - Return 1 if the handler wants to upgrade the kill to a hard kill */ void (*kill_query)(handlerton *hton, THD *thd, my_bool hard_kill); /* diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 312de8c74e4..616e827a552 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3853,18 +3853,6 @@ extern "C" int thd_killed(const MYSQL_THD thd) return thd->killed; } -/** - Change kill level to hard. - This ensures that thd_killed() will return true. - This is important for storage engines that uses thd_killed() to - verify if thread is killed. -*/ - -extern "C" void thd_mark_as_hard_kill(MYSQL_THD thd) -{ - thd->mark_as_hard_kill(); -} - /** Send an out-of-band progress report to the client diff --git a/sql/sql_class.h b/sql/sql_class.h index 2561effb478..f1b3652c15c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2729,17 +2729,6 @@ public: (!transaction.stmt.modified_non_trans_table || (variables.sql_mode & MODE_STRICT_ALL_TABLES))); } - /* - Increase level of kill ; Ensures that thd_killed() returns true. - - Needed if storage engine wants to abort things because of a 'soft' (ie, - safe) kill but still uses thd_killed() to check if it's killed. - */ - inline void mark_as_hard_kill() - { - DBUG_ASSERT(killed != NOT_KILLED); - killed= (killed_state) (killed | KILL_HARD_BIT); - } void set_status_var_init(); void reset_n_backup_open_tables_state(Open_tables_backup *backup); void restore_backup_open_tables_state(Open_tables_backup *backup); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 826662b52c6..4553df05550 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3195,7 +3195,7 @@ innobase_kill_query( /* Cancel a pending lock request. */ if (trx && trx->wait_lock) { - thd_mark_as_hard_kill(thd); + //trx->killed= 1; lock_cancel_waiting_and_release(trx->wait_lock); } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index ba07b414c65..a9f754c23cf 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -3779,7 +3779,7 @@ innobase_kill_query( /* Cancel a pending lock request. */ if (trx && trx->wait_lock) { - thd_mark_as_hard_kill(thd); + //trx->killed= 1; lock_cancel_waiting_and_release(trx->wait_lock); } From 85ea99dcaf8fd91fa566a78062dbfa416c2309fe Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 15 Jan 2013 19:08:49 +0100 Subject: [PATCH 301/349] update debian patch to apply --- ...38_scripts__mysqld_safe.sh__signals.dpatch | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch b/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch index 4a51eac8a45..81c1baf4375 100755 --- a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch +++ b/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch @@ -7,18 +7,17 @@ @DPATCH@ ---- old/scripts/mysqld_safe.sh 2006-07-29 13:12:34.000000000 +0200 -+++ old/scripts/mysqld_safe.sh 2006-07-29 13:14:08.000000000 +0200 -@@ -16,8 +16,6 @@ - # This command can be used as pipe to syslog. With "-s" it also logs to stderr. - ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i" +--- a/scripts/mysqld_safe.sh 2013-01-11 16:02:41 +0000 ++++ b/scripts/mysqld_safe.sh 2013-01-11 16:03:14 +0000 +@@ -30,7 +30,6 @@ + syslog_tag_mysqld=mysqld + syslog_tag_mysqld_safe=mysqld_safe -trap '' 1 2 3 15 # we shouldn't let anyone kill us -- - umask 007 - defaults= -@@ -122,7 +122,7 @@ + # MySQL-specific environment variable. First off, it's not really a umask, + # it's the desired mode. Second, it follows umask(2), not umask(3) in that +@@ -156,7 +155,7 @@ # sed buffers output (only GNU sed supports a -u (unbuffered) option) # which means that messages may not get sent to syslog until the # mysqld process quits. @@ -27,7 +26,7 @@ ;; *) echo "Internal program error (non-fatal):" \ -@@ -352,6 +350,13 @@ +@@ -758,6 +757,13 @@ fi # @@ -41,3 +40,4 @@ # Uncomment the following lines if you want all tables to be automatically # checked and repaired during startup. You should add sensible key_buffer # and sort_buffer values to my.cnf to improve check performance or require + From 1f0e6837d1a38b87a323972ee3fb432f463f6bc7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 15 Jan 2013 19:15:51 +0100 Subject: [PATCH 302/349] backport a test case for a 5.5 bug fix from the 5.6 tree --- mysql-test/r/subselect_sj.result | 60 +++++++++++++++++++++++++++ mysql-test/r/subselect_sj_jcl6.result | 60 +++++++++++++++++++++++++++ mysql-test/t/subselect_sj.test | 50 ++++++++++++++++++++++ 3 files changed, 170 insertions(+) diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index 660137affec..972725e30a4 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -2767,4 +2767,64 @@ GROUP BY b HAVING t1sum <> 1; t1sum b DROP TABLE t1, t2; +# +# MySQL Bug#13340270: assertion table->sort.record_pointers == __null +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_key int DEFAULT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +col_varchar_nokey varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_varchar_key (col_varchar_key, col_int_key) +) ENGINE=InnoDB; +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1266 Using storage engine MyISAM for table 't1' +INSERT INTO t1 VALUES +(10,8,'x','x'), +(11,7,'d','d'), +(12,1,'r','r'), +(13,7,'f','f'), +(14,9,'y','y'), +(15,NULL,'u','u'), +(16,1,'m','m'), +(17,9,NULL,NULL), +(18,2,'o','o'), +(19,9,'w','w'), +(20,2,'m','m'), +(21,4,'q','q'); +CREATE TABLE t2 +SELECT alias1.col_varchar_nokey AS field1 +FROM t1 AS alias1 JOIN t1 AS alias2 +ON alias2.col_int_key = alias1.pk OR +alias2.col_int_key = alias1.col_int_key +WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' + +; +EXPLAIN SELECT * +FROM t2 +WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 +FROM t1 AS alias1 JOIN t1 AS alias2 +ON alias2.col_int_key = alias1.pk OR +alias2.col_int_key = alias1.col_int_key +WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 +1 PRIMARY alias1 index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where +1 PRIMARY alias2 ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); FirstMatch(t2) +SELECT * +FROM t2 +WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 +FROM t1 AS alias1 JOIN t1 AS alias2 +ON alias2.col_int_key = alias1.pk OR +alias2.col_int_key = alias1.col_int_key +WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' +); +field1 +o +o +DROP TABLE t1, t2; set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 959ee9f765e..125d58956f8 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2781,6 +2781,66 @@ GROUP BY b HAVING t1sum <> 1; t1sum b DROP TABLE t1, t2; +# +# MySQL Bug#13340270: assertion table->sort.record_pointers == __null +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_key int DEFAULT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +col_varchar_nokey varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_varchar_key (col_varchar_key, col_int_key) +) ENGINE=InnoDB; +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1266 Using storage engine MyISAM for table 't1' +INSERT INTO t1 VALUES +(10,8,'x','x'), +(11,7,'d','d'), +(12,1,'r','r'), +(13,7,'f','f'), +(14,9,'y','y'), +(15,NULL,'u','u'), +(16,1,'m','m'), +(17,9,NULL,NULL), +(18,2,'o','o'), +(19,9,'w','w'), +(20,2,'m','m'), +(21,4,'q','q'); +CREATE TABLE t2 +SELECT alias1.col_varchar_nokey AS field1 +FROM t1 AS alias1 JOIN t1 AS alias2 +ON alias2.col_int_key = alias1.pk OR +alias2.col_int_key = alias1.col_int_key +WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' + +; +EXPLAIN SELECT * +FROM t2 +WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 +FROM t1 AS alias1 JOIN t1 AS alias2 +ON alias2.col_int_key = alias1.pk OR +alias2.col_int_key = alias1.col_int_key +WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 +1 PRIMARY alias1 index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where +1 PRIMARY alias2 ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); FirstMatch(t2) +SELECT * +FROM t2 +WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 +FROM t1 AS alias1 JOIN t1 AS alias2 +ON alias2.col_int_key = alias1.pk OR +alias2.col_int_key = alias1.col_int_key +WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' +); +field1 +o +o +DROP TABLE t1, t2; set optimizer_switch=@subselect_sj_tmp; # # BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index 2facb089718..4e93e07c1e3 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2462,5 +2462,55 @@ HAVING t1sum <> 1; DROP TABLE t1, t2; +--echo # +--echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null +--echo # + +CREATE TABLE t1 ( + pk int NOT NULL, + col_int_key int DEFAULT NULL, + col_varchar_key varchar(1) DEFAULT NULL, + col_varchar_nokey varchar(1) DEFAULT NULL, + PRIMARY KEY (pk), + KEY col_int_key (col_int_key), + KEY col_varchar_key (col_varchar_key, col_int_key) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(10,8,'x','x'), +(11,7,'d','d'), +(12,1,'r','r'), +(13,7,'f','f'), +(14,9,'y','y'), +(15,NULL,'u','u'), +(16,1,'m','m'), +(17,9,NULL,NULL), +(18,2,'o','o'), +(19,9,'w','w'), +(20,2,'m','m'), +(21,4,'q','q'); + +let $query= + SELECT alias1.col_varchar_nokey AS field1 + FROM t1 AS alias1 JOIN t1 AS alias2 + ON alias2.col_int_key = alias1.pk OR + alias2.col_int_key = alias1.col_int_key + WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' +; + +eval CREATE TABLE t2 + $query +; + +eval EXPLAIN SELECT * +FROM t2 +WHERE (field1) IN ($query); + +eval SELECT * +FROM t2 +WHERE (field1) IN ($query); + +DROP TABLE t1, t2; + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; From 9b9c138e2aaa036c0cb4e833e45be3f612b7d131 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 15 Jan 2013 19:16:18 +0100 Subject: [PATCH 303/349] small cleanups --- mysql-test/r/lowercase_table4.result | 0 mysql-test/suite/innodb/r/innodb_bug60196.result | 0 ...innodb-autoinc-master.opt => innodb-autoinc.opt} | 0 mysql-test/suite/innodb/t/innodb_bug57904.test | 0 .../suite/innodb/t/innodb_bug60196-master.opt | 0 mysql-test/suite/innodb/t/innodb_bug60196.test | 0 mysql-test/t/lowercase_table4-master.opt | 0 mysql-test/t/lowercase_table4.test | 0 mysql-test/t/range_vs_index_merge.test | 0 mysql-test/t/range_vs_index_merge_innodb.test | 0 sql/log.cc | 13 ++++++++----- sql/sql_load.cc | 4 ++-- 12 files changed, 10 insertions(+), 7 deletions(-) mode change 100755 => 100644 mysql-test/r/lowercase_table4.result mode change 100755 => 100644 mysql-test/suite/innodb/r/innodb_bug60196.result rename mysql-test/suite/innodb/t/{innodb-autoinc-master.opt => innodb-autoinc.opt} (100%) mode change 100755 => 100644 mysql-test/suite/innodb/t/innodb_bug57904.test mode change 100755 => 100644 mysql-test/suite/innodb/t/innodb_bug60196-master.opt mode change 100755 => 100644 mysql-test/suite/innodb/t/innodb_bug60196.test mode change 100755 => 100644 mysql-test/t/lowercase_table4-master.opt mode change 100755 => 100644 mysql-test/t/lowercase_table4.test mode change 100755 => 100644 mysql-test/t/range_vs_index_merge.test mode change 100755 => 100644 mysql-test/t/range_vs_index_merge_innodb.test diff --git a/mysql-test/r/lowercase_table4.result b/mysql-test/r/lowercase_table4.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/innodb/r/innodb_bug60196.result b/mysql-test/suite/innodb/r/innodb_bug60196.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-master.opt b/mysql-test/suite/innodb/t/innodb-autoinc.opt similarity index 100% rename from mysql-test/suite/innodb/t/innodb-autoinc-master.opt rename to mysql-test/suite/innodb/t/innodb-autoinc.opt diff --git a/mysql-test/suite/innodb/t/innodb_bug57904.test b/mysql-test/suite/innodb/t/innodb_bug57904.test old mode 100755 new mode 100644 diff --git a/mysql-test/suite/innodb/t/innodb_bug60196-master.opt b/mysql-test/suite/innodb/t/innodb_bug60196-master.opt old mode 100755 new mode 100644 diff --git a/mysql-test/suite/innodb/t/innodb_bug60196.test b/mysql-test/suite/innodb/t/innodb_bug60196.test old mode 100755 new mode 100644 diff --git a/mysql-test/t/lowercase_table4-master.opt b/mysql-test/t/lowercase_table4-master.opt old mode 100755 new mode 100644 diff --git a/mysql-test/t/lowercase_table4.test b/mysql-test/t/lowercase_table4.test old mode 100755 new mode 100644 diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test old mode 100755 new mode 100644 diff --git a/mysql-test/t/range_vs_index_merge_innodb.test b/mysql-test/t/range_vs_index_merge_innodb.test old mode 100755 new mode 100644 diff --git a/sql/log.cc b/sql/log.cc index abda8c52d88..567b3c69833 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2070,15 +2070,17 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv) binlog_trans_log_savepos(thd, (my_off_t*) sv); /* Write it to the binary log */ - String log_query; - if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) || + char buf[1024]; + String log_query(buf, sizeof(buf), &my_charset_bin); + if (log_query.copy(STRING_WITH_LEN("SAVEPOINT "), &my_charset_bin) || append_identifier(thd, &log_query, thd->lex->ident.str, thd->lex->ident.length)) DBUG_RETURN(1); int errcode= query_error_code(thd, thd->killed == NOT_KILLED); Query_log_event qinfo(thd, log_query.ptr(), log_query.length(), TRUE, FALSE, TRUE, errcode); - DBUG_RETURN(mysql_bin_log.write(&qinfo)); + int ret= mysql_bin_log.write(&qinfo); + DBUG_RETURN(ret); } static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv) @@ -2093,8 +2095,9 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv) if (unlikely(trans_has_updated_non_trans_table(thd) || (thd->variables.option_bits & OPTION_KEEP_LOG))) { - String log_query; - if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) || + char buf[1024]; + String log_query(buf, sizeof(buf), &my_charset_bin); + if (log_query.copy(STRING_WITH_LEN("ROLLBACK TO "), &my_charset_bin) || append_identifier(thd, &log_query, thd->lex->ident.str, thd->lex->ident.length)) DBUG_RETURN(1); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 98031c96225..6c27a9d123a 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -741,14 +741,14 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, List_iterator lu(thd->lex->update_list); List_iterator lv(thd->lex->value_list); - query_str.append(" SET "); + query_str.append(STRING_WITH_LEN(" SET ")); n= 0; while ((item= lu++)) { val= lv++; if (n++) - query_str.append(", "); + query_str.append(STRING_WITH_LEN(", ")); append_identifier(thd, &query_str, item->name, strlen(item->name)); query_str.append(val->name); } From 4ce53556ce5f31ec6b811c0803285cf0c29f4540 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 15 Jan 2013 19:16:29 +0100 Subject: [PATCH 304/349] Test case and a different fix for MySQL bug#14485479 --- .../suite/plugins/r/audit_null_debug.result | 12 +++++ .../suite/plugins/t/audit_null_debug.test | 27 +++++++++++ sql/sql_audit.cc | 45 ++++++++++++++----- sql/sql_audit.h | 2 +- sql/sql_plugin.cc | 17 +++++-- 5 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 mysql-test/suite/plugins/r/audit_null_debug.result create mode 100644 mysql-test/suite/plugins/t/audit_null_debug.test diff --git a/mysql-test/suite/plugins/r/audit_null_debug.result b/mysql-test/suite/plugins/r/audit_null_debug.result new file mode 100644 index 00000000000..2b5fa291f24 --- /dev/null +++ b/mysql-test/suite/plugins/r/audit_null_debug.result @@ -0,0 +1,12 @@ +call mtr.add_suppression("mysql/plugin.MYI"); +SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage'; +install plugin audit_null soname 'adt_null'; +ERROR HY000: Incorrect key file for table './mysql/plugin.MYI'; try to repair it +SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage'; +install plugin audit_null soname 'adt_null'; +SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage'; +uninstall plugin audit_null; +ERROR HY000: Incorrect key file for table './mysql/plugin.MYI'; try to repair it +SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage'; +uninstall plugin audit_null; +ERROR 42000: PLUGIN audit_null does not exist diff --git a/mysql-test/suite/plugins/t/audit_null_debug.test b/mysql-test/suite/plugins/t/audit_null_debug.test new file mode 100644 index 00000000000..d9e6cad5524 --- /dev/null +++ b/mysql-test/suite/plugins/t/audit_null_debug.test @@ -0,0 +1,27 @@ +--source include/have_debug.inc +--source include/not_embedded.inc + +if (!$ADT_NULL_SO) { + skip No NULL_AUDIT plugin; +} + +call mtr.add_suppression("mysql/plugin.MYI"); + +# +# MySQL BUG#14485479 - INSTALL AUDIT PLUGIN HANGS IF WE TRY TO DISABLE AND ENABLED DURING DDL OPERATION +# (a.k.a. audit event caused by the table access during audit plugin initialization) +# +SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage'; +--error 126 +install plugin audit_null soname 'adt_null'; +SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage'; + +install plugin audit_null soname 'adt_null'; +SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage'; +--error 126 +uninstall plugin audit_null; +SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage'; + +--error 1305 +uninstall plugin audit_null; + diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc index 131a71c1d6b..523f07592bc 100644 --- a/sql/sql_audit.cc +++ b/sql/sql_audit.cc @@ -132,12 +132,9 @@ static const uint audit_handlers_count= static my_bool acquire_plugins(THD *thd, plugin_ref plugin, void *arg) { - uint event_class= *(uint*) arg; - unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; + ulong *event_class_mask= (ulong*) arg; st_mysql_audit *data= plugin_data(plugin, struct st_mysql_audit *); - set_audit_mask(event_class_mask, event_class); - /* Check if this plugin is interested in the event */ if (check_audit_mask(data->class_mask, event_class_mask)) return 0; @@ -176,15 +173,13 @@ static my_bool acquire_plugins(THD *thd, plugin_ref plugin, void *arg) @details Ensure that audit plugins interested in given event class are locked by current thread. */ -void mysql_audit_acquire_plugins(THD *thd, uint event_class) +void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask) { - unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; DBUG_ENTER("mysql_audit_acquire_plugins"); - set_audit_mask(event_class_mask, event_class); if (thd && !check_audit_mask(mysql_global_audit_mask, event_class_mask) && check_audit_mask(thd->audit_class_mask, event_class_mask)) { - plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, &event_class); + plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, event_class_mask); add_audit_mask(thd->audit_class_mask, event_class_mask); } DBUG_VOID_RETURN; @@ -206,7 +201,9 @@ void mysql_audit_notify(THD *thd, uint event_class, uint event_subtype, ...) va_list ap; audit_handler_t *handlers= audit_handlers + event_class; DBUG_ASSERT(event_class < audit_handlers_count); - mysql_audit_acquire_plugins(thd, event_class); + unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; + set_audit_mask(event_class_mask, event_class); + mysql_audit_acquire_plugins(thd, event_class_mask); va_start(ap, event_subtype); (*handlers)(thd, event_subtype, ap); va_end(ap); @@ -364,6 +361,34 @@ int initialize_audit_plugin(st_plugin_int *plugin) add_audit_mask(mysql_global_audit_mask, data->class_mask); mysql_mutex_unlock(&LOCK_audit_mask); + /* + Pre-acquire the newly inslalled audit plugin for events that + may potentially occur further during INSTALL PLUGIN. + + When audit event is triggered, audit subsystem acquires interested + plugins by walking through plugin list. Evidently plugin list + iterator protects plugin list by acquiring LOCK_plugin, see + plugin_foreach_with_mask(). + + On the other hand [UN]INSTALL PLUGIN is acquiring LOCK_plugin + rather for a long time. + + When audit event is triggered during [UN]INSTALL PLUGIN, plugin + list iterator acquires the same lock (within the same thread) + second time. + + This hack should be removed when LOCK_plugin is fixed so it + protects only what it supposed to protect. + + See also mysql_install_plugin() and mysql_uninstall_plugin() + */ + THD *thd= current_thd; + if (thd) + { + acquire_plugins(thd, plugin_int_to_ref(plugin), data->class_mask); + add_audit_mask(thd->audit_class_mask, data->class_mask); + } + return 0; } @@ -494,7 +519,7 @@ static void event_class_dispatch(THD *thd, unsigned int event_class, #else /* EMBEDDED_LIBRARY */ -void mysql_audit_acquire_plugins(THD *thd, uint event_class) +void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask) { } diff --git a/sql/sql_audit.h b/sql/sql_audit.h index b2ce31f1d26..46afe4b7596 100644 --- a/sql/sql_audit.h +++ b/sql/sql_audit.h @@ -31,7 +31,7 @@ extern void mysql_audit_finalize(); extern void mysql_audit_init_thd(THD *thd); extern void mysql_audit_free_thd(THD *thd); -extern void mysql_audit_acquire_plugins(THD *thd, uint event_class); +extern void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask); #ifndef EMBEDDED_LIBRARY diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 3d529c7a332..cec577b2273 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -2018,7 +2018,7 @@ static bool finalize_install(THD *thd, TABLE *table, const LEX_STRING *name) struct st_plugin_int *tmp= plugin_find_internal(name, MYSQL_ANY_PLUGIN); int error; DBUG_ASSERT(tmp); - mysql_mutex_assert_owner(&LOCK_plugin); + mysql_mutex_assert_owner(&LOCK_plugin); // because of tmp->state if (tmp->state == PLUGIN_IS_DISABLED) { @@ -2105,8 +2105,12 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, This hack should be removed when LOCK_plugin is fixed so it protects only what it supposed to protect. + + See also mysql_uninstall_plugin() and initialize_audit_plugin() */ - mysql_audit_acquire_plugins(thd, MYSQL_AUDIT_GENERAL_CLASS); + unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] = + { MYSQL_AUDIT_GENERAL_CLASSMASK }; + mysql_audit_acquire_plugins(thd, event_class_mask); mysql_mutex_lock(&LOCK_plugin); mysql_rwlock_wrlock(&LOCK_system_variables_hash); @@ -2249,8 +2253,15 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name, When audit event is triggered during [UN]INSTALL PLUGIN, plugin list iterator acquires the same lock (within the same thread) second time. + + This hack should be removed when LOCK_plugin is fixed so it + protects only what it supposed to protect. + + See also mysql_install_plugin() and initialize_audit_plugin() */ - mysql_audit_acquire_plugins(thd, MYSQL_AUDIT_GENERAL_CLASS); + unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] = + { MYSQL_AUDIT_GENERAL_CLASSMASK }; + mysql_audit_acquire_plugins(thd, event_class_mask); mysql_mutex_lock(&LOCK_plugin); From 37a5a54a01ab00fb334c89b6ed5e7dc6cef22fe5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 15 Jan 2013 22:22:49 +0100 Subject: [PATCH 305/349] Percona-Server-5.5.28-rel29.3 --- btr/btr0cur.c | 68 +++- btr/btr0pcur.c | 1 + buf/buf0lru.c | 40 +-- fsp/fsp0fsp.c | 6 +- handler/ha_innodb.cc | 43 ++- handler/ha_innodb.h | 1 + handler/i_s.cc | 274 ++++++++------ ibuf/ibuf0ibuf.c | 2 +- include/btr0btr.h | 5 +- include/btr0cur.h | 5 +- include/log0online.h | 104 ++++-- include/srv0srv.h | 7 +- include/univ.i | 2 +- include/ut0ut.h | 9 + include/ut0ut.ic | 13 + lock/lock0lock.c | 18 +- log/log0log.c | 4 +- log/log0online.c | 829 ++++++++++++++++++++++++++++++++----------- os/os0file.c | 6 +- row/row0ins.c | 7 +- row/row0mysql.c | 28 +- row/row0upd.c | 3 +- srv/srv0srv.c | 6 + srv/srv0start.c | 35 +- 24 files changed, 1103 insertions(+), 413 deletions(-) diff --git a/btr/btr0cur.c b/btr/btr0cur.c index 61c07ac792e..687853a422e 100644 --- a/btr/btr0cur.c +++ b/btr/btr0cur.c @@ -239,6 +239,7 @@ btr_cur_latch_leaves( mtr_t* mtr) /*!< in: mtr */ { ulint mode; + ulint sibling_mode; ulint left_page_no; ulint right_page_no; buf_block_t* get_block; @@ -261,14 +262,21 @@ btr_cur_latch_leaves( #endif /* UNIV_BTR_DEBUG */ get_block->check_index_page_at_flush = TRUE; return; + case BTR_SEARCH_TREE: case BTR_MODIFY_TREE: - /* x-latch also brothers from left to right */ + if (UNIV_UNLIKELY(latch_mode == BTR_SEARCH_TREE)) { + mode = RW_S_LATCH; + sibling_mode = RW_NO_LATCH; + } else { + mode = sibling_mode = RW_X_LATCH; + } + /* Fetch and possibly latch also brothers from left to right */ left_page_no = btr_page_get_prev(page, mtr); if (left_page_no != FIL_NULL) { get_block = btr_block_get( space, zip_size, left_page_no, - RW_X_LATCH, cursor->index, mtr); + sibling_mode, cursor->index, mtr); if (srv_pass_corrupt_table && !get_block) { return; @@ -280,12 +288,21 @@ btr_cur_latch_leaves( ut_a(btr_page_get_next(get_block->frame, mtr) == page_get_page_no(page)); #endif /* UNIV_BTR_DEBUG */ - get_block->check_index_page_at_flush = TRUE; + if (sibling_mode == RW_NO_LATCH) { + /* btr_block_get() called with RW_NO_LATCH will + fix the read block in the buffer. This serves + no purpose for the fake changes prefetching, + thus we unfix the sibling blocks immediately.*/ + mtr_memo_release(mtr, get_block, + MTR_MEMO_BUF_FIX); + } else { + get_block->check_index_page_at_flush = TRUE; + } } get_block = btr_block_get( space, zip_size, page_no, - RW_X_LATCH, cursor->index, mtr); + mode, cursor->index, mtr); if (srv_pass_corrupt_table && !get_block) { return; @@ -301,7 +318,7 @@ btr_cur_latch_leaves( if (right_page_no != FIL_NULL) { get_block = btr_block_get( space, zip_size, right_page_no, - RW_X_LATCH, cursor->index, mtr); + sibling_mode, cursor->index, mtr); if (srv_pass_corrupt_table && !get_block) { return; @@ -313,7 +330,12 @@ btr_cur_latch_leaves( ut_a(btr_page_get_prev(get_block->frame, mtr) == page_get_page_no(page)); #endif /* UNIV_BTR_DEBUG */ - get_block->check_index_page_at_flush = TRUE; + if (sibling_mode == RW_NO_LATCH) { + mtr_memo_release(mtr, get_block, + MTR_MEMO_BUF_FIX); + } else { + get_block->check_index_page_at_flush = TRUE; + } } return; @@ -1566,6 +1588,9 @@ btr_cur_pessimistic_insert( } if (!(flags & BTR_NO_UNDO_LOG_FLAG)) { + + ut_a(cursor->tree_height != ULINT_UNDEFINED); + /* First reserve enough free space for the file segments of the index tree, so that the insert will not fail because of lack of space */ @@ -1860,7 +1885,8 @@ btr_cur_update_alloc_zip( ulint length, /*!< in: size needed */ ibool create, /*!< in: TRUE=delete-and-insert, FALSE=update-in-place */ - mtr_t* mtr) /*!< in: mini-transaction */ + mtr_t* mtr, /*!< in: mini-transaction */ + trx_t* trx) /*!< in: NULL or transaction */ { ut_a(page_zip == buf_block_get_page_zip(block)); ut_ad(page_zip); @@ -1877,6 +1903,14 @@ btr_cur_update_alloc_zip( return(FALSE); } + if (trx && trx->fake_changes) { + /* Don't call page_zip_compress_write_log_no_data as that has + assert which would fail. Assume there won't be a compression + failure. */ + + return TRUE; + } + if (!page_zip_compress(page_zip, buf_block_get_frame(block), index, mtr)) { /* Unable to compress the page */ @@ -1960,7 +1994,8 @@ btr_cur_update_in_place( /* Check that enough space is available on the compressed page. */ if (page_zip && !btr_cur_update_alloc_zip(page_zip, block, index, - rec_offs_size(offsets), FALSE, mtr)) { + rec_offs_size(offsets), FALSE, mtr, + trx)) { return(DB_ZIP_OVERFLOW); } @@ -2159,7 +2194,8 @@ any_extern: if (page_zip && !btr_cur_update_alloc_zip(page_zip, block, index, - new_rec_size, TRUE, mtr)) { + new_rec_size, TRUE, mtr, + thr_get_trx(thr))) { err = DB_ZIP_OVERFLOW; goto err_exit; } @@ -2402,7 +2438,15 @@ btr_cur_pessimistic_update( of the index tree, so that the update will not fail because of lack of space */ - n_extents = cursor->tree_height / 16 + 3; + if (UNIV_UNLIKELY(cursor->tree_height == ULINT_UNDEFINED)) { + /* When the tree height is uninitialized due to fake + changes, reserve some hardcoded number of extents. */ + ut_a(thr && thr_get_trx(thr)->fake_changes); + n_extents = 3; + } + else { + n_extents = cursor->tree_height / 16 + 3; + } if (flags & BTR_NO_UNDO_LOG_FLAG) { reserve_flag = FSP_CLEANING; @@ -2439,7 +2483,7 @@ btr_cur_pessimistic_update( itself. Thus the following call is safe. */ row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update, FALSE, *heap); - if (!(flags & BTR_KEEP_SYS_FLAG)) { + if (!(flags & BTR_KEEP_SYS_FLAG) && !trx->fake_changes) { row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR, roll_ptr); row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID, @@ -3210,6 +3254,8 @@ btr_cur_pessimistic_delete( of the index tree, so that the node pointer updates will not fail because of lack of space */ + ut_a(cursor->tree_height != ULINT_UNDEFINED); + n_extents = cursor->tree_height / 32 + 1; success = fsp_reserve_free_extents(&n_reserved, diff --git a/btr/btr0pcur.c b/btr/btr0pcur.c index b335e2c8aee..a1b7affdeb7 100644 --- a/btr/btr0pcur.c +++ b/btr/btr0pcur.c @@ -47,6 +47,7 @@ btr_pcur_create_for_mysql(void) pcur->btr_cur.index = NULL; btr_pcur_init(pcur); + pcur->btr_cur.tree_height = ULINT_UNDEFINED; return(pcur); } diff --git a/buf/buf0lru.c b/buf/buf0lru.c index f919d48c479..9f221e3eb82 100644 --- a/buf/buf0lru.c +++ b/buf/buf0lru.c @@ -239,9 +239,11 @@ buf_LRU_drop_page_hash_batch( When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page hash index entries belonging to that table. This function tries to do that in batch. Note that this is a 'best effort' attempt and does -not guarantee that ALL hash entries will be removed. */ +not guarantee that ALL hash entries will be removed. + +@return number of hashed pages found*/ static -void +ulint buf_LRU_drop_page_hash_for_tablespace( /*==================================*/ buf_pool_t* buf_pool, /*!< in: buffer pool instance */ @@ -251,13 +253,14 @@ buf_LRU_drop_page_hash_for_tablespace( ulint* page_arr; ulint num_entries; ulint zip_size; + ulint num_found = 0; zip_size = fil_space_get_zip_size(id); if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) { /* Somehow, the tablespace does not exist. Nothing to drop. */ ut_ad(0); - return; + return num_found; } page_arr = ut_malloc( @@ -315,6 +318,7 @@ next_page: ut_a(num_entries < BUF_LRU_DROP_SEARCH_SIZE); ++num_entries; + ++num_found; if (num_entries < BUF_LRU_DROP_SEARCH_SIZE) { goto next_page; @@ -370,6 +374,8 @@ next_page: /* Drop any remaining batch of search hashed pages. */ buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries); ut_free(page_arr); + + return num_found; } /******************************************************************//** @@ -814,8 +820,6 @@ buf_LRU_mark_space_was_deleted( for (i = 0; i < srv_buf_pool_instances; i++) { buf_pool_t* buf_pool; buf_page_t* bpage; - buf_chunk_t* chunk; - ulint j, k; buf_pool = buf_pool_from_array(i); @@ -832,28 +836,10 @@ buf_LRU_mark_space_was_deleted( mutex_exit(&buf_pool->LRU_list_mutex); - btr_search_s_lock_all(); - chunk = buf_pool->chunks; - for (j = buf_pool->n_chunks; j--; chunk++) { - buf_block_t* block = chunk->blocks; - for (k = chunk->size; k--; block++) { - if (buf_block_get_state(block) - != BUF_BLOCK_FILE_PAGE - || !block->index - || buf_page_get_space(&block->page) != id) { - continue; - } - - btr_search_s_unlock_all(); - - rw_lock_x_lock(&block->lock); - btr_search_drop_page_hash_index(block); - rw_lock_x_unlock(&block->lock); - - btr_search_s_lock_all(); - } - } - btr_search_s_unlock_all(); + /* The AHI entries for the tablespace being deleted should be + removed by now. */ + ut_ad(buf_LRU_drop_page_hash_for_tablespace(buf_pool, id) + == 0); } } diff --git a/fsp/fsp0fsp.c b/fsp/fsp0fsp.c index 858721e62b9..cf066404555 100644 --- a/fsp/fsp0fsp.c +++ b/fsp/fsp0fsp.c @@ -3034,7 +3034,11 @@ try_again: some of them will contain extent descriptor pages, and therefore will not be free extents */ - n_free_up = (size - free_limit) / FSP_EXTENT_SIZE; + if (size <= free_limit) { + n_free_up = 0; + } else { + n_free_up = (size - free_limit) / FSP_EXTENT_SIZE; + } if (n_free_up > 0) { n_free_up--; diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index f244cd94fdd..2d476d1bdf5 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -1050,6 +1050,13 @@ thd_to_trx( return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr)); } +my_bool +ha_innobase::is_fake_change_enabled(THD* thd) +{ + trx_t* trx = thd_to_trx(thd); + return(trx && trx->fake_changes); +} + /********************************************************************//** Call this function when mysqld passes control to the client. That is to avoid deadlocks on the adaptive hash S-latch possibly held by thd. For more @@ -3057,6 +3064,14 @@ innobase_change_buffering_inited_ok: srv_use_checksums = (ibool) innobase_use_checksums; srv_fast_checksum = (ibool) innobase_fast_checksum; + if (innobase_fast_checksum) { + fprintf(stderr, + "InnoDB: Warning: innodb_fast_checksum is DEPRECATED " + "and *WILL* be removed in Percona Server 5.6. Please " + "consult the Percona Server 5.6 documentation for " + "help in upgrading.\n"); + } + srv_blocking_lru_restore = (ibool) innobase_blocking_lru_restore; #ifdef HAVE_LARGE_PAGES @@ -5991,7 +6006,9 @@ no_commit: error = row_insert_for_mysql((byte*) record, prebuilt); #ifdef EXTENDED_FOR_USERSTAT - if (error == DB_SUCCESS) rows_changed++; + if (UNIV_LIKELY(error == DB_SUCCESS && !trx->fake_changes)) { + rows_changed++; + } #endif /* Handle duplicate key errors */ @@ -6355,7 +6372,9 @@ ha_innobase::update_row( } #ifdef EXTENDED_FOR_USERSTAT - if (error == DB_SUCCESS) rows_changed++; + if (UNIV_LIKELY(error == DB_SUCCESS && !trx->fake_changes)) { + rows_changed++; + } #endif innodb_srv_conc_exit_innodb(trx); @@ -6420,7 +6439,9 @@ ha_innobase::delete_row( error = row_update_for_mysql((byte*) record, prebuilt); #ifdef EXTENDED_FOR_USERSTAT - if (error == DB_SUCCESS) rows_changed++; + if (UNIV_LIKELY(error == DB_SUCCESS && !trx->fake_changes)) { + rows_changed++; + } #endif innodb_srv_conc_exit_innodb(trx); @@ -12351,6 +12372,8 @@ static MYSQL_SYSVAR_BOOL(checksums, innobase_use_checksums, static MYSQL_SYSVAR_BOOL(fast_checksum, innobase_fast_checksum, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "DEPRECATED. #### WARNING #### : This feature is DEPRECATED and WILL " + "be removed in Percona Server 5.6. " "Change the algorithm of checksum for the whole of datapage to 4-bytes word based. " "The original checksum is checked after the new one. It may be slow for reading page" " which has orginal checksum. Overwrite the page or recreate the InnoDB database, " @@ -12785,6 +12808,11 @@ static MYSQL_SYSVAR_BOOL(track_changed_pages, srv_track_changed_pages, "Track the redo log for changed pages and output a changed page bitmap", NULL, NULL, FALSE); +static MYSQL_SYSVAR_ULONGLONG(max_bitmap_file_size, srv_max_bitmap_file_size, + PLUGIN_VAR_RQCMDARG, + "The maximum size of changed page bitmap files", + NULL, NULL, 100*1024*1024ULL, 4096ULL, ULONGLONG_MAX, 0); + static MYSQL_SYSVAR_ULONGLONG(changed_pages_limit, srv_changed_pages_limit, PLUGIN_VAR_RQCMDARG, "The maximum number of rows for " @@ -12987,6 +13015,13 @@ static MYSQL_SYSVAR_ULONG(lazy_drop_table, srv_lazy_drop_table, "e.g. for http://bugs.mysql.com/51325", NULL, NULL, 0, 0, 1, 0); +static MYSQL_SYSVAR_BOOL(locking_fake_changes, srv_fake_changes_locks, + PLUGIN_VAR_NOCMDARG, + "###EXPERIMENTAL### if enabled, transactions will get S row locks instead " + "of X locks for fake changes. If disabled, fake change transactions will " + "not take any locks at all.", + NULL, NULL, TRUE); + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(page_size), MYSQL_SYSVAR(log_block_size), @@ -13078,6 +13113,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(use_native_aio), MYSQL_SYSVAR(change_buffering), MYSQL_SYSVAR(track_changed_pages), + MYSQL_SYSVAR(max_bitmap_file_size), MYSQL_SYSVAR(changed_pages_limit), #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG MYSQL_SYSVAR(change_buffering_debug), @@ -13096,6 +13132,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(corrupt_table_action), MYSQL_SYSVAR(lazy_drop_table), MYSQL_SYSVAR(fake_changes), + MYSQL_SYSVAR(locking_fake_changes), MYSQL_SYSVAR(merge_sort_block_size), NULL }; diff --git a/handler/ha_innodb.h b/handler/ha_innodb.h index abaafcf7978..7645f537f33 100644 --- a/handler/ha_innodb.h +++ b/handler/ha_innodb.h @@ -138,6 +138,7 @@ class ha_innobase: public handler int close(void); double scan_time(); double read_time(uint index, uint ranges, ha_rows rows); + my_bool is_fake_change_enabled(THD *thd); bool is_corrupt() const; int write_row(uchar * buf); diff --git a/handler/i_s.cc b/handler/i_s.cc index 826225880de..8a95840ddaf 100644 --- a/handler/i_s.cc +++ b/handler/i_s.cc @@ -7287,29 +7287,38 @@ static ST_FIELD_INFO i_s_innodb_changed_pages_info[] = }; /*********************************************************************** - This function parses condition and gets upper bounds for start and end LSN's - if condition corresponds to certain pattern. + This function implements ICP for I_S.INNODB_CHANGED_PAGES by parsing a + condition and getting lower and upper bounds for start and end LSNs if the + condition corresponds to a certain pattern. - We can't know right position to avoid scanning bitmap files from the beginning - to the lower bound. But we can stop scanning bitmap files if we reach upper bound. + In the most general form, we understand queries like - It's expected the most used queries will be like the following: + SELECT * FROM INNODB_CHANGED_PAGES + WHERE START_LSN > num1 AND START_LSN < num2 + AND END_LSN > num3 AND END_LSN < num4; - SELECT * FROM INNODB_CHANGED_PAGES WHERE START_LSN > num1 AND start_lsn < num2; - - That's why the pattern is: + That's why the pattern syntax is: pattern: comp | and_comp; comp: lsn < int_num | lsn <= int_num | int_num > lsn | int_num >= lsn; lsn: start_lsn | end_lsn; - and_comp: some_expression AND some_expression | some_expression AND and_comp; - some_expression: comp | any_other_expression; + and_comp: expression AND expression | expression AND and_comp; + expression: comp | any_other_expression; - Suppose the condition is start_lsn < 100, this means we have to read all - blocks with start_lsn < 100. Which is equivalent to reading all the blocks - with end_lsn <= 99, or just end_lsn < 100. That's why it's enough to find - maximum lsn value, doesn't matter if this is start or end lsn and compare - it with "start_lsn" field. + The two bounds are handled differently: the lower bound is used to find the + correct starting _file_, the upper bound the last _block_ that needs reading. + + Lower bound conditions are handled in the following way: start_lsn >= X + specifies that the reading must start from the file that has the highest + starting LSN less than or equal to X. start_lsn > X is equivalent to + start_lsn >= X + 1. For end_lsn, end_lsn >= X is treated as + start_lsn >= X - 1 and end_lsn > X as start_lsn >= X. + + For the upper bound, suppose the condition is start_lsn < 100, this means we + have to read all blocks with start_lsn < 100. Which is equivalent to reading + all the blocks with end_lsn <= 99, or just end_lsn < 100. That's why it's + enough to find maximum lsn value, doesn't matter if this is start or end lsn + and compare it with "start_lsn" field. LSN <= 100 is treated as LSN < 101. Example: @@ -7320,92 +7329,130 @@ static ST_FIELD_INFO i_s_innodb_changed_pages_info[] = 555 > end_lsn AND page_id = 100; - max_lsn will be set to 555. + end_lsn will be set to 555, start_lsn will be set 11. + + Support for other functions (equal, NULL-safe equal, BETWEEN, IN, etc.) will + be added on demand. + */ static void limit_lsn_range_from_condition( /*===========================*/ - TABLE* table, /*!type() != Item::COND_ITEM && cond->type() != Item::FUNC_ITEM) return; - switch (((Item_func*) cond)->functype()) + func_type = ((Item_func*) cond)->functype(); + + switch (func_type) { - case Item_func::COND_AND_FUNC: - { - List_iterator li(*((Item_cond*) cond)-> - argument_list()); - Item *item; - while ((item= li++)) - limit_lsn_range_from_condition(table, - item, - max_lsn); - break; + case Item_func::COND_AND_FUNC: + { + List_iterator li(*((Item_cond*) cond) + ->argument_list()); + Item *item; + + while ((item= li++)) { + limit_lsn_range_from_condition(table, item, start_lsn, + end_lsn); } - case Item_func::LT_FUNC: - case Item_func::LE_FUNC: - case Item_func::GT_FUNC: - case Item_func::GE_FUNC: - { - Item *left; - Item *right; - Item_field *item_field; - ib_uint64_t tmp_result; + break; + } + case Item_func::LT_FUNC: + case Item_func::LE_FUNC: + case Item_func::GT_FUNC: + case Item_func::GE_FUNC: + { + Item *left; + Item *right; + Item_field *item_field; + ib_uint64_t tmp_result; + ibool is_end_lsn; - /* - a <= b equals to b >= a that's why we just exchange - "left" and "right" in the case of ">" or ">=" - function - */ - if (((Item_func*) cond)->functype() == - Item_func::LT_FUNC || - ((Item_func*) cond)->functype() == - Item_func::LE_FUNC) - { - left = ((Item_func*) cond)->arguments()[0]; - right = ((Item_func*) cond)->arguments()[1]; - } else { - left = ((Item_func*) cond)->arguments()[1]; - right = ((Item_func*) cond)->arguments()[0]; - } + /* a <= b equals to b >= a that's why we just exchange "left" + and "right" in the case of ">" or ">=" function. We don't + touch the operation itself. */ + if (((Item_func*) cond)->functype() == Item_func::LT_FUNC + || ((Item_func*) cond)->functype() == Item_func::LE_FUNC) { + left = ((Item_func*) cond)->arguments()[0]; + right = ((Item_func*) cond)->arguments()[1]; + } else { + left = ((Item_func*) cond)->arguments()[1]; + right = ((Item_func*) cond)->arguments()[0]; + } - if (!left || !right) - return; - if (left->type() != Item::FIELD_ITEM) - return; - if (right->type() != Item::INT_ITEM) - return; + if (left->type() == Item::FIELD_ITEM) { + item_field = (Item_field *)left; + } else if (right->type() == Item::FIELD_ITEM) { + item_field = (Item_field *)right; + } else { + return; + } - item_field = (Item_field*)left; + /* Check if the current field belongs to our table */ + if (table != item_field->field->table) { + return; + } - if (/* START_LSN */ - table->field[2] != item_field->field && - /* END_LSN */ - table->field[3] != item_field->field) - { - return; - } + /* Check if the field is START_LSN or END_LSN */ + /* END_LSN */ + is_end_lsn = table->field[3]->eq(item_field->field); - /* Check if the current field belongs to our table */ - if (table != item_field->field->table) - return; + if (/* START_LSN */ !table->field[2]->eq(item_field->field) + && !is_end_lsn) { + return; + } + + if (left->type() == Item::FIELD_ITEM + && right->type() == Item::INT_ITEM) { + + /* The case of start_lsn|end_lsn <|<= const, i.e. the + upper bound. */ tmp_result = right->val_int(); - if (tmp_result < *max_lsn) - *max_lsn = tmp_result; + if (((func_type == Item_func::LE_FUNC) + || (func_type == Item_func::GE_FUNC)) + && (tmp_result != IB_ULONGLONG_MAX)) { - break; + tmp_result++; + } + if (tmp_result < *end_lsn) { + *end_lsn = tmp_result; + } + + } else if (left->type() == Item::INT_ITEM + && right->type() == Item::FIELD_ITEM) { + + /* The case of const <|<= start_lsn|end_lsn, i.e. the + lower bound */ + + tmp_result = left->val_int(); + if (is_end_lsn && tmp_result != 0) { + tmp_result--; + } + if (((func_type == Item_func::LT_FUNC) + || (func_type == Item_func::GT_FUNC)) + && (tmp_result != IB_ULONGLONG_MAX)) { + + tmp_result++; + } + if (tmp_result > *start_lsn) { + *start_lsn = tmp_result; + } } - default:; - } + break; + } + default:; + } } /*********************************************************************** @@ -7422,40 +7469,55 @@ i_s_innodb_changed_pages_fill( TABLE* table = (TABLE *) tables->table; log_bitmap_iterator_t i; ib_uint64_t output_rows_num = 0UL; - ib_uint64_t max_lsn = ~0ULL; + ib_uint64_t max_lsn = IB_ULONGLONG_MAX; + ib_uint64_t min_lsn = 0ULL; - if (!srv_track_changed_pages) - return 0; + DBUG_ENTER("i_s_innodb_changed_pages_fill"); - if (!log_online_bitmap_iterator_init(&i)) - return 1; + /* deny access to non-superusers */ + if (check_global_access(thd, PROCESS_ACL)) { - if (cond) - limit_lsn_range_from_condition(table, cond, &max_lsn); + DBUG_RETURN(0); + } + + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + + if (!srv_track_changed_pages) { + DBUG_RETURN(0); + } + + if (cond) { + limit_lsn_range_from_condition(table, cond, &min_lsn, + &max_lsn); + } + + if (!log_online_bitmap_iterator_init(&i, min_lsn, max_lsn)) { + DBUG_RETURN(1); + } while(log_online_bitmap_iterator_next(&i) && (!srv_changed_pages_limit || output_rows_num < srv_changed_pages_limit) && /* - There is no need to compare both start LSN and end LSN fields - with maximum value. It's enough to compare only start LSN. - Example: + There is no need to compare both start LSN and end LSN fields + with maximum value. It's enough to compare only start LSN. + Example: - max_lsn = 100 - \\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\ - Query 1 - I------I I-------I I-------------I I----I - ////////////////// | - Query 2 - 1 2 3 4 + max_lsn = 100 + \\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\ - Query 1 + I------I I-------I I-------------I I----I + ////////////////// | - Query 2 + 1 2 3 4 - Query 1: - SELECT * FROM INNODB_CHANGED_PAGES WHERE start_lsn < 100 - will select 1,2,3 bitmaps - Query 2: - SELECT * FROM INNODB_CHANGED_PAGES WHERE end_lsn < 100 - will select 1,2 bitmaps + Query 1: + SELECT * FROM INNODB_CHANGED_PAGES WHERE start_lsn < 100 + will select 1,2,3 bitmaps + Query 2: + SELECT * FROM INNODB_CHANGED_PAGES WHERE end_lsn < 100 + will select 1,2 bitmaps - The condition start_lsn <= 100 will be false after reading - 1,2,3 bitmaps which suits for both cases. + The condition start_lsn <= 100 will be false after reading + 1,2,3 bitmaps which suits for both cases. */ LOG_BITMAP_ITERATOR_START_LSN(i) <= max_lsn) { @@ -7470,10 +7532,10 @@ i_s_innodb_changed_pages_fill( LOG_BITMAP_ITERATOR_PAGE_NUM(i)); /* START_LSN */ table->field[2]->store( - LOG_BITMAP_ITERATOR_START_LSN(i)); + LOG_BITMAP_ITERATOR_START_LSN(i), true); /* END_LSN */ table->field[3]->store( - LOG_BITMAP_ITERATOR_END_LSN(i)); + LOG_BITMAP_ITERATOR_END_LSN(i), true); /* I_S tables are in-memory tables. If bitmap file is big enough @@ -7493,14 +7555,14 @@ i_s_innodb_changed_pages_fill( if (schema_table_store_record(thd, table)) { log_online_bitmap_iterator_release(&i); - return 1; + DBUG_RETURN(1); } ++output_rows_num; } log_online_bitmap_iterator_release(&i); - return 0; + DBUG_RETURN(0); } static diff --git a/ibuf/ibuf0ibuf.c b/ibuf/ibuf0ibuf.c index 78cb6e20176..77305e42fb1 100644 --- a/ibuf/ibuf0ibuf.c +++ b/ibuf/ibuf0ibuf.c @@ -4044,7 +4044,7 @@ updated_in_place: update) && (!page_zip || btr_cur_update_alloc_zip( page_zip, block, index, - rec_offs_size(offsets), FALSE, mtr))) { + rec_offs_size(offsets), FALSE, mtr, NULL))) { /* This is the easy case. Do something similar to btr_cur_update_in_place(). */ row_upd_rec_in_place(rec, index, offsets, diff --git a/include/btr0btr.h b/include/btr0btr.h index 03e89ae3f7d..fb06a774b82 100644 --- a/include/btr0btr.h +++ b/include/btr0btr.h @@ -65,7 +65,10 @@ enum btr_latch_mode { /** Search the previous record. */ BTR_SEARCH_PREV = 35, /** Modify the previous record. */ - BTR_MODIFY_PREV = 36 + BTR_MODIFY_PREV = 36, + /** Weaker BTR_MODIFY_TREE that does not lock the leaf page siblings, + used for fake changes. */ + BTR_SEARCH_TREE = 37 /* BTR_MODIFY_TREE | 4 */ }; /* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually exclusive. */ diff --git a/include/btr0cur.h b/include/btr0cur.h index cbc6103c2ee..cb44129aeb5 100644 --- a/include/btr0cur.h +++ b/include/btr0cur.h @@ -259,8 +259,9 @@ btr_cur_update_alloc_zip( ulint length, /*!< in: size needed */ ibool create, /*!< in: TRUE=delete-and-insert, FALSE=update-in-place */ - mtr_t* mtr) /*!< in: mini-transaction */ - __attribute__((nonnull, warn_unused_result)); + mtr_t* mtr, /*!< in: mini-transaction */ + trx_t* trx) /*!< in: NULL or transaction */ + __attribute__((nonnull (1, 2, 3, 6), warn_unused_result)); /*************************************************************//** Updates a record when the update causes no size changes in its fields. @return DB_SUCCESS or error number */ diff --git a/include/log0online.h b/include/log0online.h index 0e0ca169f6f..e7c3f301e45 100644 --- a/include/log0online.h +++ b/include/log0online.h @@ -27,6 +27,16 @@ Online database log parsing for changed page tracking #include "univ.i" #include "os0file.h" +/** Single bitmap file information */ +typedef struct log_online_bitmap_file_struct log_online_bitmap_file_t; + +/** A set of bitmap files containing some LSN range */ +typedef struct log_online_bitmap_file_range_struct +log_online_bitmap_file_range_t; + +/** An iterator over changed page info */ +typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t; + /*********************************************************************//** Initializes the online log following subsytem. */ UNIV_INTERN @@ -49,45 +59,32 @@ void log_online_follow_redo_log(); /*=========================*/ -/** The iterator through all bits of changed pages bitmap blocks */ -struct log_bitmap_iterator_struct -{ - char in_name[FN_REFLEN]; /*!< the file name for bitmap - input */ - os_file_t in; /*!< the bitmap input file */ - ib_uint64_t in_offset; /*!< the next write position in the - bitmap output file */ - ib_uint32_t bit_offset; /*!< bit offset inside of bitmap - block*/ - ib_uint64_t start_lsn; /*!< Start lsn of the block */ - ib_uint64_t end_lsn; /*!< End lsn of the block */ - ib_uint32_t space_id; /*!< Block space id */ - ib_uint32_t first_page_id; /*!< First block page id */ - ibool changed; /*!< true if current page was changed */ - byte* page; /*!< Bitmap block */ -}; - -typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t; - #define LOG_BITMAP_ITERATOR_START_LSN(i) \ - ((i).start_lsn) + ((i).start_lsn) #define LOG_BITMAP_ITERATOR_END_LSN(i) \ - ((i).end_lsn) + ((i).end_lsn) #define LOG_BITMAP_ITERATOR_SPACE_ID(i) \ - ((i).space_id) + ((i).space_id) #define LOG_BITMAP_ITERATOR_PAGE_NUM(i) \ - ((i).first_page_id + (i).bit_offset) + ((i).first_page_id + (i).bit_offset) #define LOG_BITMAP_ITERATOR_PAGE_CHANGED(i) \ - ((i).changed) + ((i).changed) /*********************************************************************//** -Initializes log bitmap iterator. +Initializes log bitmap iterator. The minimum LSN is used for finding the +correct starting file with records and it there may be records returned by +the iterator that have LSN less than start_lsn. + @return TRUE if the iterator is initialized OK, FALSE otherwise. */ UNIV_INTERN ibool log_online_bitmap_iterator_init( /*============================*/ - log_bitmap_iterator_t *i); /*!fake_changes && mode == LOCK_X) { - mode = LOCK_S; + if (UNIV_UNLIKELY((thr && thr_get_trx(thr)->fake_changes))) { + if (!srv_fake_changes_locks) { + return(DB_SUCCESS); + } + if (mode == LOCK_X) { + mode = LOCK_S; + } } heap_no = page_rec_get_heap_no(rec); @@ -5561,8 +5566,13 @@ lock_clust_rec_read_check_and_lock( return(DB_SUCCESS); } - if (thr && thr_get_trx(thr)->fake_changes && mode == LOCK_X) { - mode = LOCK_S; + if (UNIV_UNLIKELY((thr && thr_get_trx(thr)->fake_changes))) { + if (!srv_fake_changes_locks) { + return(DB_SUCCESS); + } + if (mode == LOCK_X) { + mode = LOCK_S; + } } heap_no = page_rec_get_heap_no(rec); diff --git a/log/log0log.c b/log/log0log.c index 8bff79ce85b..8fbf4b80df4 100644 --- a/log/log0log.c +++ b/log/log0log.c @@ -246,7 +246,7 @@ log_check_tracking_margin( checked for the already-written log. */ { ib_uint64_t tracked_lsn; - ulint tracked_lsn_age; + ib_uint64_t tracked_lsn_age; if (!srv_track_changed_pages) { return FALSE; @@ -458,7 +458,7 @@ log_close(void) ib_uint64_t oldest_lsn; ib_uint64_t lsn; ib_uint64_t tracked_lsn; - ulint tracked_lsn_age; + ib_uint64_t tracked_lsn_age; log_t* log = log_sys; ib_uint64_t checkpoint_age; diff --git a/log/log0online.c b/log/log0online.c index 1d478c467e6..55eb9d17c46 100644 --- a/log/log0online.c +++ b/log/log0online.c @@ -48,10 +48,8 @@ struct log_bitmap_struct { parsed, it points to the start, otherwise points immediatelly past the end of the incomplete log record. */ - char* out_name; /*!< the file name for bitmap output */ - os_file_t out; /*!< the bitmap output file */ - ib_uint64_t out_offset; /*!< the next write position in the - bitmap output file */ + log_online_bitmap_file_t out; /*!< The current bitmap file */ + ulint out_seq_num; /*!< the bitmap file sequence number */ ib_uint64_t start_lsn; /*!< the LSN of the next unparsed record and the start of the next LSN interval to be parsed. */ @@ -76,8 +74,13 @@ struct log_bitmap_struct { /* The log parsing and bitmap output struct instance */ static struct log_bitmap_struct* log_bmp_sys; -/* File name stem for modified page bitmaps */ -static const char* modified_page_stem = "ib_modified_log."; +/** File name stem for bitmap files. */ +static const char* bmp_file_name_stem = "ib_modified_log_"; + +/** File name template for bitmap files. The 1st format tag is a directory +name, the 2nd tag is the stem, the 3rd tag is a file sequence number, the 4th +tag is the start LSN for the file. */ +static const char* bmp_file_name_template = "%s%s%lu_%llu.xdb"; /* On server startup with empty database srv_start_lsn == 0, in which case the first LSN of actual log records will be this. */ @@ -85,7 +88,7 @@ which case the first LSN of actual log records will be this. */ /* Tests if num bit of bitmap is set */ #define IS_BIT_SET(bitmap, num) \ - (*((bitmap) + ((num) >> 3)) & (1UL << ((num) & 7UL))) + (*((bitmap) + ((num) >> 3)) & (1UL << ((num) & 7UL))) /** The bitmap file block size in bytes. All writes will be multiples of this. */ @@ -242,11 +245,70 @@ log_online_calc_checksum( return sum; } +/****************************************************************//** +Read one bitmap data page and check it for corruption. + +@return TRUE if page read OK, FALSE if I/O error */ +static +ibool +log_online_read_bitmap_page( +/*========================*/ + log_online_bitmap_file_t *bitmap_file, /*!offset & 0xFFFFFFFF); + ulint offset_high = (ulint)(bitmap_file->offset >> 32); + ulint checksum; + ulint actual_checksum; + ibool success; + + ut_a(bitmap_file->size >= MODIFIED_PAGE_BLOCK_SIZE); + ut_a(bitmap_file->offset + <= bitmap_file->size - MODIFIED_PAGE_BLOCK_SIZE); + ut_a(bitmap_file->offset % MODIFIED_PAGE_BLOCK_SIZE == 0); + + success = os_file_read(bitmap_file->file, page, offset_low, + offset_high, MODIFIED_PAGE_BLOCK_SIZE); + + if (UNIV_UNLIKELY(!success)) { + + /* The following call prints an error message */ + os_file_get_last_error(TRUE); + fprintf(stderr, + "InnoDB: Warning: failed reading changed page bitmap " + "file \'%s\'\n", bitmap_file->name); + return FALSE; + } + + bitmap_file->offset += MODIFIED_PAGE_BLOCK_SIZE; + ut_ad(bitmap_file->offset <= bitmap_file->size); + + checksum = mach_read_from_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM); + actual_checksum = log_online_calc_checksum(page); + *checksum_ok = (checksum == actual_checksum); + + return TRUE; +} + /****************************************************************//** Get the last tracked fully LSN from the bitmap file by reading backwards untile a correct end page is found. Detects incomplete writes and corrupted data. Sets the start output position for the written bitmap data. + +Multiple bitmap files are handled using the following assumptions: +1) Only the last file might be corrupted. In case where no good data was found +in the last file, assume that the next to last file is OK. This assumption +does not limit crash recovery capability in any way. +2) If the whole of the last file was corrupted, assume that the start LSN in +its name is correct and use it for (re-)tracking start. + @return the last fully tracked LSN */ static ib_uint64_t @@ -254,73 +316,46 @@ log_online_read_last_tracked_lsn() /*==============================*/ { byte page[MODIFIED_PAGE_BLOCK_SIZE]; - ib_uint64_t read_offset = log_bmp_sys->out_offset; - /* Initialize these to nonequal values so that file size == 0 case with - zero loop repetitions is handled correctly */ - ulint checksum = 0; - ulint actual_checksum = !checksum; ibool is_last_page = FALSE; + ibool checksum_ok = FALSE; ib_uint64_t result; + ib_uint64_t read_offset = log_bmp_sys->out.offset; - ut_ad(log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE == 0); - - while (checksum != actual_checksum && read_offset > 0 && !is_last_page) + while (!checksum_ok && read_offset > 0 && !is_last_page) { - - ulint offset_low, offset_high; - ibool success; - read_offset -= MODIFIED_PAGE_BLOCK_SIZE; - offset_high = (ulint)(read_offset >> 32); - offset_low = (ulint)(read_offset & 0xFFFFFFFF); + log_bmp_sys->out.offset = read_offset; - success = os_file_read(log_bmp_sys->out, page, offset_low, - offset_high, MODIFIED_PAGE_BLOCK_SIZE); - if (!success) { - - /* The following call prints an error message */ - os_file_get_last_error(TRUE); - /* Here and below assume that bitmap file names do not - contain apostrophes, thus no need for - ut_print_filename(). */ - fprintf(stderr, "InnoDB: Warning: failed reading " - "changed page bitmap file \'%s\'\n", - log_bmp_sys->out_name); - return MIN_TRACKED_LSN; + if (!log_online_read_bitmap_page(&log_bmp_sys->out, page, + &checksum_ok)) { + checksum_ok = FALSE; + result = 0; + break; } - is_last_page - = mach_read_from_4(page + MODIFIED_PAGE_IS_LAST_BLOCK); - checksum = mach_read_from_4(page - + MODIFIED_PAGE_BLOCK_CHECKSUM); - actual_checksum = log_online_calc_checksum(page); - if (checksum != actual_checksum) { + if (checksum_ok) { + is_last_page + = mach_read_from_4 + (page + MODIFIED_PAGE_IS_LAST_BLOCK); + } else { - fprintf(stderr, "InnoDB: Warning: corruption " - "detected in \'%s\' at offset %llu\n", - log_bmp_sys->out_name, read_offset); + fprintf(stderr, + "InnoDB: Warning: corruption detected in " + "\'%s\' at offset %llu\n", + log_bmp_sys->out.name, read_offset); } - }; - if (UNIV_LIKELY(checksum == actual_checksum && is_last_page)) { - - log_bmp_sys->out_offset = read_offset - + MODIFIED_PAGE_BLOCK_SIZE; - result = mach_read_from_8(page + MODIFIED_PAGE_END_LSN); - } - else { - log_bmp_sys->out_offset = read_offset; - result = 0; - } + result = (checksum_ok && is_last_page) + ? mach_read_from_8(page + MODIFIED_PAGE_END_LSN) : 0; /* Truncate the output file to discard the corrupted bitmap data, if any */ - if (!os_file_set_eof_at(log_bmp_sys->out, - log_bmp_sys->out_offset)) { + if (!os_file_set_eof_at(log_bmp_sys->out.file, + log_bmp_sys->out.offset)) { fprintf(stderr, "InnoDB: Warning: failed truncating " "changed page bitmap file \'%s\' to %llu bytes\n", - log_bmp_sys->out_name, log_bmp_sys->out_offset); + log_bmp_sys->out.name, log_bmp_sys->out.offset); result = 0; } return result; @@ -350,6 +385,37 @@ log_set_tracked_lsn( #endif } +/*********************************************************************//** +Check if missing, if any, LSN interval can be read and tracked using the +current LSN value, the LSN value where the tracking stopped, and the log group +capacity. + +@return TRUE if the missing interval can be tracked or if there's no missing +data. */ +static +ibool +log_online_can_track_missing( +/*=========================*/ + ib_uint64_t last_tracked_lsn, /*! tracking_start_lsn) { + fprintf(stderr, + "InnoDB: Error: last tracked LSN is in future. This " + "can be caused by mismatched bitmap files.\n"); + exit(1); + } + + return (last_tracked_lsn == tracking_start_lsn) + || (log_sys->lsn - last_tracked_lsn + <= log_sys->log_group_capacity); +} + + /****************************************************************//** Diagnose a gap in tracked LSN range on server startup due to crash or very fast shutdown and try to close it by tracking the data @@ -365,22 +431,20 @@ log_online_track_missing_on_startup( { ut_ad(last_tracked_lsn != tracking_start_lsn); - fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' is %llu, but " - "last checkpoint LSN is %llu. This might be due to a server " - "crash or a very fast shutdown. ", log_bmp_sys->out_name, - last_tracked_lsn, tracking_start_lsn); - - /* last_tracked_lsn might be < MIN_TRACKED_LSN in the case of empty - bitmap file, handle this too. */ - last_tracked_lsn = ut_max(last_tracked_lsn, MIN_TRACKED_LSN); + fprintf(stderr, "InnoDB: last tracked LSN is %llu, but the last " + "checkpoint LSN is %llu. This might be due to a server " + "crash or a very fast shutdown. ", last_tracked_lsn, + tracking_start_lsn); /* See if we can fully recover the missing interval */ - if (log_sys->lsn - last_tracked_lsn < log_sys->log_group_capacity) { + if (log_online_can_track_missing(last_tracked_lsn, + tracking_start_lsn)) { fprintf(stderr, "Reading the log to advance the last tracked LSN.\n"); - log_bmp_sys->start_lsn = last_tracked_lsn; + log_bmp_sys->start_lsn = ut_max_uint64(last_tracked_lsn, + MIN_TRACKED_LSN); log_set_tracked_lsn(log_bmp_sys->start_lsn); log_online_follow_redo_log(); ut_ad(log_bmp_sys->end_lsn >= tracking_start_lsn); @@ -405,6 +469,89 @@ log_online_track_missing_on_startup( } } +/*********************************************************************//** +Format a bitmap output file name to log_bmp_sys->out.name. */ +static +void +log_online_make_bitmap_name( +/*=========================*/ + ib_uint64_t start_lsn) /*!< in: the start LSN name part */ +{ + ut_snprintf(log_bmp_sys->out.name, FN_REFLEN, bmp_file_name_template, + srv_data_home, bmp_file_name_stem, + log_bmp_sys->out_seq_num, start_lsn); + +} + +/*********************************************************************//** +Create a new empty bitmap output file. */ +static +void +log_online_start_bitmap_file() +/*==========================*/ +{ + ibool success; + + log_bmp_sys->out.file + = os_file_create(innodb_file_bmp_key, log_bmp_sys->out.name, + OS_FILE_OVERWRITE, OS_FILE_NORMAL, + OS_DATA_FILE, &success); + if (UNIV_UNLIKELY(!success)) { + + /* The following call prints an error message */ + os_file_get_last_error(TRUE); + fprintf(stderr, + "InnoDB: Error: Cannot create \'%s\'\n", + log_bmp_sys->out.name); + exit(1); + } + + log_bmp_sys->out.offset = 0; +} + +/*********************************************************************//** +Close the current bitmap output file and create the next one. */ +static +void +log_online_rotate_bitmap_file( +/*===========================*/ + ib_uint64_t next_file_start_lsn) /*!out.file); + log_bmp_sys->out_seq_num++; + log_online_make_bitmap_name(next_file_start_lsn); + log_online_start_bitmap_file(); +} + +/*********************************************************************//** +Check the name of a given file if it's a changed page bitmap file and +return file sequence and start LSN name components if it is. If is not, +the values of output parameters are undefined. + +@return TRUE if a given file is a changed page bitmap file. */ +static +ibool +log_online_is_bitmap_file( +/*======================*/ + const os_file_stat_t* file_info, /*!name) < OS_FILE_MAX_PATH); + + return ((file_info->type == OS_FILE_TYPE_FILE + || file_info->type == OS_FILE_TYPE_LINK) + && (sscanf(file_info->name, "%[a-z_]%lu_%llu.xdb", stem, + bitmap_file_seq_num, bitmap_file_start_lsn) == 3) + && (!strcmp(stem, bmp_file_name_stem))); +} + /*********************************************************************//** Initialize the online log following subsytem. */ UNIV_INTERN @@ -412,10 +559,12 @@ void log_online_read_init() /*==================*/ { - char buf[FN_REFLEN]; ibool success; ib_uint64_t tracking_start_lsn - = ut_max(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN); + = ut_max_uint64(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN); + os_file_dir_t bitmap_dir; + os_file_stat_t bitmap_dir_file_info; + ib_uint64_t last_file_start_lsn = MIN_TRACKED_LSN; /* Assert (could be compile-time assert) that bitmap data start and end in a bitmap block is 8-byte aligned */ @@ -424,82 +573,120 @@ log_online_read_init() log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys)); - ut_snprintf(buf, FN_REFLEN, "%s%s%d", srv_data_home, - modified_page_stem, 1); - log_bmp_sys->out_name = ut_malloc(strlen(buf) + 1); - ut_strcpy(log_bmp_sys->out_name, buf); + /* Enumerate existing bitmap files to either open the last one to get + the last tracked LSN either to find that there are none and start + tracking from scratch. */ + log_bmp_sys->out.name[0] = '\0'; + log_bmp_sys->out_seq_num = 0; + + bitmap_dir = os_file_opendir(srv_data_home, TRUE); + ut_a(bitmap_dir); + while (!os_file_readdir_next_file(srv_data_home, bitmap_dir, + &bitmap_dir_file_info)) { + + ulong file_seq_num; + ib_uint64_t file_start_lsn; + + if (!log_online_is_bitmap_file(&bitmap_dir_file_info, + &file_seq_num, + &file_start_lsn)) { + continue; + } + + if (file_seq_num > log_bmp_sys->out_seq_num + && bitmap_dir_file_info.size > 0) { + log_bmp_sys->out_seq_num = file_seq_num; + last_file_start_lsn = file_start_lsn; + /* No dir component (srv_data_home) here, because + that's the cwd */ + strncpy(log_bmp_sys->out.name, + bitmap_dir_file_info.name, FN_REFLEN - 1); + log_bmp_sys->out.name[FN_REFLEN - 1] = '\0'; + } + } + + if (os_file_closedir(bitmap_dir)) { + os_file_get_last_error(TRUE); + fprintf(stderr, "InnoDB: Error: cannot close \'%s\'\n", + srv_data_home); + exit(1); + } + + if (!log_bmp_sys->out_seq_num) { + log_bmp_sys->out_seq_num = 1; + log_online_make_bitmap_name(0); + } log_bmp_sys->modified_pages = rbt_create(MODIFIED_PAGE_BLOCK_SIZE, log_online_compare_bmp_keys); log_bmp_sys->page_free_list = NULL; - log_bmp_sys->out + log_bmp_sys->out.file = os_file_create_simple_no_error_handling - (innodb_file_bmp_key, log_bmp_sys->out_name, OS_FILE_OPEN, + (innodb_file_bmp_key, log_bmp_sys->out.name, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success); if (!success) { /* New file, tracking from scratch */ - log_bmp_sys->out - = os_file_create_simple_no_error_handling - (innodb_file_bmp_key, log_bmp_sys->out_name, - OS_FILE_CREATE, OS_FILE_READ_WRITE, &success); - if (!success) { - - /* The following call prints an error message */ - os_file_get_last_error(TRUE); - fprintf(stderr, - "InnoDB: Error: Cannot create \'%s\'\n", - log_bmp_sys->out_name); - exit(1); - } - - log_bmp_sys->out_offset = 0; + log_online_start_bitmap_file(); } else { - /* Old file, read last tracked LSN and continue from there */ + /* Read the last tracked LSN from the last file */ ulint size_low; ulint size_high; ib_uint64_t last_tracked_lsn; - success = os_file_get_size(log_bmp_sys->out, &size_low, + success = os_file_get_size(log_bmp_sys->out.file, &size_low, &size_high); ut_a(success); - log_bmp_sys->out_offset + log_bmp_sys->out.size = ((ib_uint64_t)size_high << 32) | size_low; + log_bmp_sys->out.offset = log_bmp_sys->out.size; - if (log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE != 0) { + if (log_bmp_sys->out.offset % MODIFIED_PAGE_BLOCK_SIZE != 0) { fprintf(stderr, "InnoDB: Warning: truncated block detected " "in \'%s\' at offset %llu\n", - log_bmp_sys->out_name, - log_bmp_sys->out_offset); - log_bmp_sys->out_offset -= - log_bmp_sys->out_offset + log_bmp_sys->out.name, + log_bmp_sys->out.offset); + log_bmp_sys->out.offset -= + log_bmp_sys->out.offset % MODIFIED_PAGE_BLOCK_SIZE; } last_tracked_lsn = log_online_read_last_tracked_lsn(); + if (!last_tracked_lsn) { + last_tracked_lsn = last_file_start_lsn; + } + + /* Start a new file. Choose the LSN value in its name based on + if we can retrack any missing data. */ + if (log_online_can_track_missing(last_tracked_lsn, + tracking_start_lsn)) { + log_online_rotate_bitmap_file(last_tracked_lsn); + } + else { + log_online_rotate_bitmap_file(tracking_start_lsn); + } if (last_tracked_lsn < tracking_start_lsn) { - log_online_track_missing_on_startup(last_tracked_lsn, - tracking_start_lsn); + log_online_track_missing_on_startup + (last_tracked_lsn, tracking_start_lsn); return; } if (last_tracked_lsn > tracking_start_lsn) { - fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' " - "is %llu, but last checkpoint LSN is %llu. " + fprintf(stderr, "InnoDB: last tracked LSN is %llu, " + "but last the checkpoint LSN is %llu. " "The tracking-based incremental backups will " "work only from the latter LSN!\n", - log_bmp_sys->out_name, last_tracked_lsn, - tracking_start_lsn); + last_tracked_lsn, tracking_start_lsn); } } @@ -519,7 +706,7 @@ log_online_read_shutdown() { ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list; - os_file_close(log_bmp_sys->out); + os_file_close(log_bmp_sys->out.file); rbt_free(log_bmp_sys->modified_pages); @@ -529,7 +716,6 @@ log_online_read_shutdown() free_list_node = next; } - ut_free(log_bmp_sys->out_name); ut_free(log_bmp_sys); } @@ -746,8 +932,8 @@ log_online_follow_log_seg( /* The next parse LSN is inside the current block, skip data preceding it. */ skip_already_parsed_len - = log_bmp_sys->next_parse_lsn - - block_start_lsn; + = (ulint)(log_bmp_sys->next_parse_lsn + - block_start_lsn); } else { @@ -819,32 +1005,32 @@ log_online_write_bitmap_page( { ibool success; - success = os_file_write(log_bmp_sys->out_name,log_bmp_sys->out, + success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file, block, - (ulint)(log_bmp_sys->out_offset & 0xFFFFFFFF), - (ulint)(log_bmp_sys->out_offset << 32), + (ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF), + (ulint)(log_bmp_sys->out.offset << 32), MODIFIED_PAGE_BLOCK_SIZE); if (UNIV_UNLIKELY(!success)) { /* The following call prints an error message */ os_file_get_last_error(TRUE); fprintf(stderr, "InnoDB: Error: failed writing changed page " - "bitmap file \'%s\'\n", log_bmp_sys->out_name); + "bitmap file \'%s\'\n", log_bmp_sys->out.name); return; } - success = os_file_flush(log_bmp_sys->out, FALSE); + success = os_file_flush(log_bmp_sys->out.file, FALSE); if (UNIV_UNLIKELY(!success)) { /* The following call prints an error message */ os_file_get_last_error(TRUE); fprintf(stderr, "InnoDB: Error: failed flushing " "changed page bitmap file \'%s\'\n", - log_bmp_sys->out_name); + log_bmp_sys->out.name); return; } - log_bmp_sys->out_offset += MODIFIED_PAGE_BLOCK_SIZE; + log_bmp_sys->out.offset += MODIFIED_PAGE_BLOCK_SIZE; } /*********************************************************************//** @@ -858,6 +1044,10 @@ log_online_write_bitmap() ib_rbt_node_t *bmp_tree_node; const ib_rbt_node_t *last_bmp_tree_node; + if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) { + log_online_rotate_bitmap_file(log_bmp_sys->start_lsn); + } + bmp_tree_node = (ib_rbt_node_t *) rbt_first(log_bmp_sys->modified_pages); last_bmp_tree_node = rbt_last(log_bmp_sys->modified_pages); @@ -930,47 +1120,306 @@ log_online_follow_redo_log() } /*********************************************************************//** -Initializes log bitmap iterator. +List the bitmap files in srv_data_home and setup their range that contains the +specified LSN interval. This range, if non-empty, will start with a file that +has the greatest LSN equal to or less than the start LSN and will include all +the files up to the one with the greatest LSN less than the end LSN. Caller +must free bitmap_files->files when done if bitmap_files set to non-NULL and +this function returned TRUE. Field bitmap_files->count might be set to a +larger value than the actual count of the files, and space for the unused array +slots will be allocated but cleared to zeroes. + +@return TRUE if succeeded +*/ +static +ibool +log_online_setup_bitmap_file_range( +/*===============================*/ + log_online_bitmap_file_range_t *bitmap_files, /*!count = 0; + bitmap_files->files = NULL; + + /* 1st pass: size the info array */ + + bitmap_dir = os_file_opendir(srv_data_home, FALSE); + if (!bitmap_dir) { + fprintf(stderr, + "InnoDB: Error: " + "failed to open bitmap directory \'%s\'\n", + srv_data_home); + return FALSE; + } + + while (!os_file_readdir_next_file(srv_data_home, bitmap_dir, + &bitmap_dir_file_info)) { + + ulong file_seq_num; + ib_uint64_t file_start_lsn; + + if (!log_online_is_bitmap_file(&bitmap_dir_file_info, + &file_seq_num, + &file_start_lsn) + || file_start_lsn >= range_end) { + + continue; + } + + if (file_start_lsn >= range_start + || file_start_lsn == first_file_start_lsn + || first_file_start_lsn > range_start) { + + /* A file that falls into the range */ + bitmap_files->count++; + if (file_start_lsn < first_file_start_lsn) { + + first_file_start_lsn = file_start_lsn; + } + if (file_seq_num < first_file_seq_num) { + + first_file_seq_num = file_seq_num; + } + } else if (file_start_lsn > first_file_start_lsn) { + + /* A file that has LSN closer to the range start + but smaller than it, replacing another such file */ + first_file_start_lsn = file_start_lsn; + first_file_seq_num = file_seq_num; + } + } + + ut_a(first_file_seq_num != ULONG_MAX || bitmap_files->count == 0); + + if (os_file_closedir(bitmap_dir)) { + os_file_get_last_error(TRUE); + fprintf(stderr, "InnoDB: Error: cannot close \'%s\'\n", + srv_data_home); + return FALSE; + } + + if (!bitmap_files->count) { + return TRUE; + } + + /* 2nd pass: get the file names in the file_seq_num order */ + + bitmap_dir = os_file_opendir(srv_data_home, FALSE); + if (!bitmap_dir) { + fprintf(stderr, "InnoDB: Error: " + "failed to open bitmap directory \'%s\'\n", + srv_data_home); + return FALSE; + } + + bitmap_files->files = ut_malloc(bitmap_files->count + * sizeof(bitmap_files->files[0])); + memset(bitmap_files->files, 0, + bitmap_files->count * sizeof(bitmap_files->files[0])); + + while (!os_file_readdir_next_file(srv_data_home, bitmap_dir, + &bitmap_dir_file_info)) { + + ulong file_seq_num; + ib_uint64_t file_start_lsn; + size_t array_pos; + + if (!log_online_is_bitmap_file(&bitmap_dir_file_info, + &file_seq_num, + &file_start_lsn) + || file_start_lsn >= range_end + || file_start_lsn < first_file_start_lsn) { + continue; + } + + array_pos = file_seq_num - first_file_seq_num; + if (file_seq_num > bitmap_files->files[array_pos].seq_num) { + bitmap_files->files[array_pos].seq_num = file_seq_num; + strncpy(bitmap_files->files[array_pos].name, + bitmap_dir_file_info.name, FN_REFLEN); + bitmap_files->files[array_pos].name[FN_REFLEN - 1] + = '\0'; + bitmap_files->files[array_pos].start_lsn + = file_start_lsn; + } + } + + if (os_file_closedir(bitmap_dir)) { + os_file_get_last_error(TRUE); + fprintf(stderr, "InnoDB: Error: cannot close \'%s\'\n", + srv_data_home); + free(bitmap_files->files); + return FALSE; + } + +#ifdef UNIV_DEBUG + ut_ad(bitmap_files->files[0].seq_num == first_file_seq_num); + ut_ad(bitmap_files->files[0].start_lsn == first_file_start_lsn); + { + size_t i; + for (i = 1; i < bitmap_files->count; i++) { + if (!bitmap_files->files[i].seq_num) { + break; + } + ut_ad(bitmap_files->files[i].seq_num + > bitmap_files->files[i - 1].seq_num); + ut_ad(bitmap_files->files[i].start_lsn + >= bitmap_files->files[i - 1].start_lsn); + } + } +#endif + + return TRUE; +} + +/****************************************************************//** +Open a bitmap file for reading. + +@return TRUE if opened successfully */ +static +ibool +log_online_open_bitmap_file_read_only( +/*==================================*/ + const char* name, /*!name, FN_REFLEN, "%s%s", srv_data_home, name); + bitmap_file->file + = os_file_create_simple_no_error_handling(innodb_file_bmp_key, + bitmap_file->name, + OS_FILE_OPEN, + OS_FILE_READ_ONLY, + &success); + if (!success) { + /* Here and below assume that bitmap file names do not + contain apostrophes, thus no need for ut_print_filename(). */ + fprintf(stderr, + "InnoDB: Warning: error opening the changed page " + "bitmap \'%s\'\n", bitmap_file->name); + return FALSE; + } + + success = os_file_get_size(bitmap_file->file, &size_low, &size_high); + bitmap_file->size = (((ib_uint64_t)size_high) << 32) | size_low; + bitmap_file->offset = 0; + +#ifdef UNIV_LINUX + posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_SEQUENTIAL); + posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_NOREUSE); +#endif + + return TRUE; +} + +/****************************************************************//** +Diagnose one or both of the following situations if we read close to +the end of bitmap file: +1) Warn if the remainder of the file is less than one page. +2) Error if we cannot read any more full pages but the last read page +did not have the last-in-run flag set. + +@return FALSE for the error */ +static +ibool +log_online_diagnose_bitmap_eof( +/*===========================*/ + const log_online_bitmap_file_t* bitmap_file, /*!< in: bitmap file */ + ibool last_page_in_run)/*!< in: "last page in + run" flag value in the + last read page */ +{ + /* Check if we are too close to EOF to read a full page */ + if ((bitmap_file->size < MODIFIED_PAGE_BLOCK_SIZE) + || (bitmap_file->offset + > bitmap_file->size - MODIFIED_PAGE_BLOCK_SIZE)) { + + if (bitmap_file->offset != bitmap_file->size) { + /* If we are not at EOF and we have less than one page + to read, it's junk. This error is not fatal in + itself. */ + + fprintf(stderr, + "InnoDB: Warning: junk at the end of changed " + "page bitmap file \'%s\'.\n", + bitmap_file->name); + } + + if (!last_page_in_run) { + /* We are at EOF but the last read page did not finish + a run */ + /* It's a "Warning" here because it's not a fatal error + for the whole server */ + fprintf(stderr, + "InnoDB: Warning: changed page bitmap " + "file \'%s\' does not contain a complete run " + "at the end.\n", bitmap_file->name); + return FALSE; + } + } + return TRUE; +} + +/*********************************************************************//** +Initialize the log bitmap iterator for a given range. The records are +processed at a bitmap block granularity, i.e. all the records in the same block +share the same start and end LSN values, the exact LSN of each record is +unavailable (nor is it defined for blocks that are touched more than once in +the LSN interval contained in the block). Thus min_lsn and max_lsn should be +set at block boundaries or bigger, otherwise the records at the 1st and the +last blocks will not be returned. Also note that there might be returned +records with LSN < min_lsn, as min_lsn is used to select the correct starting +file but not block. + @return TRUE if the iterator is initialized OK, FALSE otherwise. */ UNIV_INTERN ibool log_online_bitmap_iterator_init( /*============================*/ - log_bitmap_iterator_t *i) /*!in_name, FN_REFLEN, "%s%s%d", srv_data_home, - modified_page_stem, 1); - i->in_offset = 0; - /* - Set up bit offset out of the reasonable limit - to intiate reading block from file in - log_online_bitmap_iterator_next() - */ - i->bit_offset = MODIFIED_PAGE_BLOCK_BITMAP_LEN; - i->in = - os_file_create_simple_no_error_handling(innodb_file_bmp_key, - i->in_name, - OS_FILE_OPEN, - OS_FILE_READ_ONLY, - &success); - if (!success) { - /* The following call prints an error message */ - os_file_get_last_error(TRUE); - fprintf(stderr, - "InnoDB: Error: Cannot open \'%s\'\n", - i->in_name); + if (!log_online_setup_bitmap_file_range(&i->in_files, min_lsn, + max_lsn)) { + + return FALSE; + } + + ut_a(i->in_files.count > 0); + + /* Open the 1st bitmap file */ + i->in_i = 0; + if (!log_online_open_bitmap_file_read_only(i->in_files.files[i->in_i]. + name, + &i->in)) { + i->in_i = i->in_files.count; + free(i->in_files.files); return FALSE; } i->page = ut_malloc(MODIFIED_PAGE_BLOCK_SIZE); - + i->bit_offset = MODIFIED_PAGE_BLOCK_BITMAP_LEN; i->start_lsn = i->end_lsn = 0; i->space_id = 0; i->first_page_id = 0; + i->last_page_in_run = TRUE; i->changed = FALSE; return TRUE; @@ -985,7 +1434,11 @@ log_online_bitmap_iterator_release( log_bitmap_iterator_t *i) /*!in); + + if (i->in_i < i->in_files.count) { + os_file_close(i->in.file); + } + ut_free(i->in_files.files); ut_free(i->page); } @@ -1000,14 +1453,7 @@ log_online_bitmap_iterator_next( /*============================*/ log_bitmap_iterator_t *i) /*!in, - &size_low, - &size_high); - if (!success) { - os_file_get_last_error(TRUE); - fprintf(stderr, - "InnoDB: Warning: can't get size of " - "page bitmap file \'%s\'\n", - i->in_name); - return FALSE; + while (i->in.size < MODIFIED_PAGE_BLOCK_SIZE + || (i->in.offset + > i->in.size - MODIFIED_PAGE_BLOCK_SIZE)) { + + /* Advance file */ + i->in_i++; + os_file_close(i->in.file); + log_online_diagnose_bitmap_eof(&i->in, + i->last_page_in_run); + if (i->in_i == i->in_files.count + || i->in_files.files[i->in_i].seq_num == 0) { + + return FALSE; + } + + if (!log_online_open_bitmap_file_read_only( + i->in_files.files[i->in_i].name, + &i->in)) { + return FALSE; + } } - if (i->in_offset >= - (ib_uint64_t)(size_low) + - ((ib_uint64_t)(size_high) << 32)) - return FALSE; - - offset_high = (ulint)(i->in_offset >> 32); - offset_low = (ulint)(i->in_offset & 0xFFFFFFFF); - - success = os_file_read( - i->in, - i->page, - offset_low, - offset_high, - MODIFIED_PAGE_BLOCK_SIZE); - - if (!success) { + if (!log_online_read_bitmap_page(&i->in, i->page, + &checksum_ok)) { os_file_get_last_error(TRUE); fprintf(stderr, "InnoDB: Warning: failed reading " "changed page bitmap file \'%s\'\n", - i->in_name); + i->in_files.files[i->in_i].name); return FALSE; } - - checksum = mach_read_from_4( - i->page + MODIFIED_PAGE_BLOCK_CHECKSUM); - - actual_checksum = log_online_calc_checksum(i->page); - - i->in_offset += MODIFIED_PAGE_BLOCK_SIZE; } - i->start_lsn = - mach_read_from_8(i->page + MODIFIED_PAGE_START_LSN); - i->end_lsn = - mach_read_from_8(i->page + MODIFIED_PAGE_END_LSN); - i->space_id = - mach_read_from_4(i->page + MODIFIED_PAGE_SPACE_ID); - i->first_page_id = - mach_read_from_4(i->page + MODIFIED_PAGE_1ST_PAGE_ID); - i->bit_offset = - 0; - i->changed = - IS_BIT_SET(i->page + MODIFIED_PAGE_BLOCK_BITMAP, - i->bit_offset); + i->start_lsn = mach_read_from_8(i->page + MODIFIED_PAGE_START_LSN); + i->end_lsn = mach_read_from_8(i->page + MODIFIED_PAGE_END_LSN); + i->space_id = mach_read_from_4(i->page + MODIFIED_PAGE_SPACE_ID); + i->first_page_id = mach_read_from_4(i->page + + MODIFIED_PAGE_1ST_PAGE_ID); + i->last_page_in_run = mach_read_from_4(i->page + + MODIFIED_PAGE_IS_LAST_BLOCK); + i->bit_offset = 0; + i->changed = IS_BIT_SET(i->page + MODIFIED_PAGE_BLOCK_BITMAP, + i->bit_offset); return TRUE; } - diff --git a/os/os0file.c b/os/os0file.c index 8aa911b4f42..f3dbef91242 100644 --- a/os/os0file.c +++ b/os/os0file.c @@ -2057,8 +2057,10 @@ os_file_set_eof_at( ib_uint64_t new_len)/*!< in: new file length */ { #ifdef __WIN__ - /* TODO: untested! */ - return(!_chsize_s(file, new_len)); + LARGE_INTEGER li, li2; + li.QuadPart = new_len; + return(SetFilePointerEx(file, li, &li2,FILE_BEGIN) + && SetEndOfFile(file)); #else /* TODO: works only with -D_FILE_OFFSET_BITS=64 ? */ return(!ftruncate(file, new_len)); diff --git a/row/row0ins.c b/row/row0ins.c index 3ae4c227ddc..61c3720fa2e 100644 --- a/row/row0ins.c +++ b/row/row0ins.c @@ -2012,7 +2012,10 @@ row_ins_index_entry_low( the function will return in both low_match and up_match of the cursor sensible values */ - if (dict_index_is_clust(index)) { + if (UNIV_UNLIKELY(thr_get_trx(thr)->fake_changes)) { + search_mode = (mode & BTR_MODIFY_TREE) + ? BTR_SEARCH_TREE : BTR_SEARCH_LEAF; + } else if (dict_index_is_clust(index)) { search_mode = mode; } else if (!(thr_get_trx(thr)->check_unique_secondary)) { search_mode = mode | BTR_INSERT | BTR_IGNORE_SEC_UNIQUE; @@ -2021,7 +2024,7 @@ row_ins_index_entry_low( } btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, - thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : search_mode, + search_mode, &cursor, 0, __FILE__, __LINE__, &mtr); if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) { diff --git a/row/row0mysql.c b/row/row0mysql.c index eb1eb095fd1..b52dfa06ce1 100644 --- a/row/row0mysql.c +++ b/row/row0mysql.c @@ -1276,17 +1276,19 @@ run_again: que_thr_stop_for_mysql_no_error(thr, trx); - prebuilt->table->stat_n_rows++; + if (UNIV_LIKELY(!(trx->fake_changes))) { - srv_n_rows_inserted++; + prebuilt->table->stat_n_rows++; - if (prebuilt->table->stat_n_rows == 0) { - /* Avoid wrap-over */ - prebuilt->table->stat_n_rows--; + if (prebuilt->table->stat_n_rows == 0) { + /* Avoid wrap-over */ + prebuilt->table->stat_n_rows--; + } + + srv_n_rows_inserted++; + row_update_statistics_if_needed(prebuilt->table); } - if (!(trx->fake_changes)) - row_update_statistics_if_needed(prebuilt->table); trx->op_info = ""; return((int) err); @@ -1533,6 +1535,11 @@ run_again: que_thr_stop_for_mysql_no_error(thr, trx); + if (UNIV_UNLIKELY(trx->fake_changes)) { + trx->op_info = ""; + return((int) err); + } + if (node->is_delete) { if (prebuilt->table->stat_n_rows > 0) { prebuilt->table->stat_n_rows--; @@ -1547,7 +1554,6 @@ run_again: that changes indexed columns, UPDATEs that change only non-indexed columns would not affect statistics. */ if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { - if (!(trx->fake_changes)) row_update_statistics_if_needed(prebuilt->table); } @@ -1755,6 +1761,11 @@ run_again: return(err); } + if (UNIV_UNLIKELY((trx->fake_changes))) { + + return(err); + } + if (node->is_delete) { if (table->stat_n_rows > 0) { table->stat_n_rows--; @@ -1765,7 +1776,6 @@ run_again: srv_n_rows_updated++; } - if (!(trx->fake_changes)) row_update_statistics_if_needed(table); return(err); diff --git a/row/row0upd.c b/row/row0upd.c index 28c770460ff..e73e946cc3c 100644 --- a/row/row0upd.c +++ b/row/row0upd.c @@ -2018,7 +2018,8 @@ row_upd_clust_rec( the same transaction do not modify the record in the meantime. Therefore we can assert that the restoration of the cursor succeeds. */ - ut_a(btr_pcur_restore_position(thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : BTR_MODIFY_TREE, + ut_a(btr_pcur_restore_position(thr_get_trx(thr)->fake_changes + ? BTR_SEARCH_TREE : BTR_MODIFY_TREE, pcur, mtr)); ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur), diff --git a/srv/srv0srv.c b/srv/srv0srv.c index 94eef213aaf..0864dd234d0 100644 --- a/srv/srv0srv.c +++ b/srv/srv0srv.c @@ -179,8 +179,14 @@ UNIV_INTERN ibool srv_recovery_stats = FALSE; UNIV_INTERN my_bool srv_track_changed_pages = TRUE; +UNIV_INTERN ib_uint64_t srv_max_bitmap_file_size = 100 * 1024 * 1024; + UNIV_INTERN ulonglong srv_changed_pages_limit = 0; +/** When TRUE, fake change transcations take S rather than X row locks. + When FALSE, row locks are not taken at all. */ +UNIV_INTERN my_bool srv_fake_changes_locks = TRUE; + /* if TRUE, then we auto-extend the last data file */ UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE; /* if != 0, this tells the max size auto-extending may increase the diff --git a/srv/srv0start.c b/srv/srv0start.c index 2bfbeed5cb0..9d47be44582 100644 --- a/srv/srv0start.c +++ b/srv/srv0start.c @@ -1148,6 +1148,24 @@ skip_size_check: return(DB_SUCCESS); } +/*********************************************************************//** +Initializes the log tracking subsystem and starts its thread. */ +static +void +init_log_online(void) +/*=================*/ +{ + if (srv_track_changed_pages) { + + log_online_read_init(); + + /* Create the thread that follows the redo log to output the + changed page bitmap */ + os_thread_create(&srv_redo_log_follow_thread, NULL, + thread_ids + 5 + SRV_MAX_N_IO_THREADS); + } +} + /******************************************************************** Starts InnoDB and creates a new database if database files are not found and the user wants. @@ -1791,6 +1809,8 @@ innobase_start_or_create_for_mysql(void) trx_sys_file_format_init(); if (create_new_db) { + init_log_online(); + mtr_start(&mtr); fsp_header_init(0, sum_of_new_sizes, &mtr); @@ -1890,6 +1910,8 @@ innobase_start_or_create_for_mysql(void) return(DB_ERROR); } + init_log_online(); + /* Since the insert buffer init is in dict_boot, and the insert buffer is needed in any disk i/o, first we call dict_boot(). Note that trx_sys_init_at_db_start() only needs @@ -2037,19 +2059,6 @@ innobase_start_or_create_for_mysql(void) if (srv_auto_lru_dump && srv_blocking_lru_restore) buf_LRU_file_restore(); - if (srv_track_changed_pages) { - - /* Initialize the log tracking subsystem here to block - server startup until it's completed due to the potential - need to re-read previous server run's log. */ - log_online_read_init(); - - /* Create the thread that follows the redo log to output the - changed page bitmap */ - os_thread_create(&srv_redo_log_follow_thread, NULL, - thread_ids + 6 + SRV_MAX_N_IO_THREADS); - } - srv_is_being_started = FALSE; err = dict_create_or_check_foreign_constraint_tables(); From f8f90aa75fbe8ab5c543d788f2afe55926ae34cb Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 15 Jan 2013 16:46:27 -0800 Subject: [PATCH 306/349] Fixed bug mdev-3938. The original patch with the implementation of virtual columns did not support INSERT DELAYED into tables with virtual columns. This patch fixes the problem. --- mysql-test/suite/vcol/r/vcol_misc.result | 10 ++++++++ mysql-test/suite/vcol/t/vcol_misc.test | 18 +++++++++++++++ sql/mysql_priv.h | 3 +++ sql/sql_base.cc | 3 ++- sql/sql_insert.cc | 29 ++++++++++++++++++++++++ sql/table.cc | 12 ++++++---- 6 files changed, 70 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index a4b2cee4bf6..f679d5eb671 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -182,3 +182,13 @@ a b c 2 3 y 0 1 y,n drop table t1,t2; +CREATE TABLE t1 ( +ts TIMESTAMP, +tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL +) ENGINE=MyISAM; +INSERT INTO t1 (tsv) VALUES (DEFAULT); +INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT); +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +DROP TABLE t1; diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 732003da992..53c04898648 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -178,3 +178,21 @@ insert into t2(a,b) values (7,0), (2,3), (0,1); select * from t2; drop table t1,t2; + +# +# Bug mdev-3938: INSERT DELAYED for a table with virtual columns +# + +CREATE TABLE t1 ( + ts TIMESTAMP, + tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL +) ENGINE=MyISAM; + +INSERT INTO t1 (tsv) VALUES (DEFAULT); + +INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT); + +SELECT COUNT(*) FROM t1; + +DROP TABLE t1; + diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index b40e40792f9..e9973f4c3de 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2292,6 +2292,9 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg); int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, uint db_stat, uint prgflag, uint ha_open_flags, TABLE *outparam, bool is_create_table); +bool unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, + TABLE *table, Field *field, + LEX_STRING *vcol_expr, bool *error_reported); int readfrm(const char *name, uchar **data, size_t *length); int writefrm(const char* name, const uchar* data, size_t len); int closefrm(TABLE *table, bool free_share); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 04198af84b9..f1257a3668f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8429,7 +8429,8 @@ fill_record(THD * thd, List &fields, List &values, rfield->field_name, table->s->table_name.str); thd->abort_on_warning= abort_on_warning_saved; } - if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors) + if ((!rfield->vcol_info || rfield->stored_in_db) && + (value->save_in_field(rfield, 0) < 0) && !ignore_errors) { my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0)); goto err; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9962789029e..f76c2252eb9 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2084,6 +2084,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) { my_ptrdiff_t adjust_ptrs; Field **field,**org_field, *found_next_number_field; + Field **vfield; TABLE *copy; TABLE_SHARE *share; uchar *bitmap; @@ -2127,12 +2128,20 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) if (!copy_tmp) goto error; + if (share->vfields) + { + vfield= (Field **) client_thd->alloc((share->vfields+1)*sizeof(Field*)); + if (!vfield) + goto error; + } + /* Copy the TABLE object. */ copy= new (copy_tmp) TABLE; *copy= *table; /* We don't need to change the file handler here */ /* Assign the pointers for the field pointers array and the record. */ field= copy->field= (Field**) (copy + 1); + copy->vfield= vfield; bitmap= (uchar*) (field + share->fields + 1); copy->record[0]= (bitmap + share->column_bitmap_size*3); memcpy((char*) copy->record[0], (char*) table->record[0], share->reclength); @@ -2156,6 +2165,26 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) } *field=0; + if (table->vfield) + { + for (field= copy->field; *field; field++) + { + if ((*field)->vcol_info) + { + bool error_reported= FALSE; + if (unpack_vcol_info_from_frm(client_thd, + client_thd->mem_root, + copy, + *field, + &(*field)->vcol_info->expr_str, + &error_reported)) + goto error; + *vfield++= *field; + } + } + *vfield= 0; + } + /* Adjust timestamp */ if (table->timestamp_field) { diff --git a/sql/table.cc b/sql/table.cc index 5c1e27b87c7..dfc9c2d933c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1925,8 +1925,10 @@ end: @brief Unpack the definition of a virtual column from its linear representation - @parm + @param thd The thread object + @param + mem_root The mem_root object where to allocated memory @param table The table containing the virtual column @param @@ -1956,6 +1958,7 @@ end: TRUE Otherwise */ bool unpack_vcol_info_from_frm(THD *thd, + MEM_ROOT *mem_root, TABLE *table, Field *field, LEX_STRING *vcol_expr, @@ -1981,7 +1984,7 @@ bool unpack_vcol_info_from_frm(THD *thd, "PARSE_VCOL_EXPR ()". */ - if (!(vcol_expr_str= (char*) alloc_root(&table->mem_root, + if (!(vcol_expr_str= (char*) alloc_root(mem_root, vcol_expr->length + parse_vcol_keyword.length + 3))) { @@ -2011,8 +2014,8 @@ bool unpack_vcol_info_from_frm(THD *thd, vcol_arena= table->expr_arena; if (!vcol_arena) { - Query_arena expr_arena(&table->mem_root, Query_arena::INITIALIZED); - if (!(vcol_arena= (Query_arena *) alloc_root(&table->mem_root, + Query_arena expr_arena(mem_root, Query_arena::INITIALIZED); + if (!(vcol_arena= (Query_arena *) alloc_root(mem_root, sizeof(Query_arena)))) goto err; *vcol_arena= expr_arena; @@ -2265,6 +2268,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, if ((*field_ptr)->vcol_info) { if (unpack_vcol_info_from_frm(thd, + &outparam->mem_root, outparam, *field_ptr, &(*field_ptr)->vcol_info->expr_str, From a716b061676d01920fa83298cd1fbb57725d6ad9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Jan 2013 15:11:13 +0200 Subject: [PATCH 307/349] MDEV-3988 fix. Subquery turned into constant too late to be excluded from grouping list so test for constant added to the create_temp_table(). --- mysql-test/r/subselect_innodb.result | 18 ++++++++++++++++++ mysql-test/t/subselect_innodb.test | 14 ++++++++++++++ sql/sql_select.cc | 10 ++++++++++ 3 files changed, 42 insertions(+) diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result index ee28a6cdb37..9750a53a76c 100644 --- a/mysql-test/r/subselect_innodb.result +++ b/mysql-test/r/subselect_innodb.result @@ -380,4 +380,22 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr 1 1 drop table t1; +# +# MDEV-3988 crash in create_tmp_table +# +drop table if exists `t1`,`t2`; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' +create table `t1`(`a` char(1) character set utf8)engine=innodb; +create table `t2`(`b` char(1) character set utf8)engine=memory; +select distinct (select 1 from `t2` where `a`) `d2` from `t1`; +d2 +select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`; +d2 a +select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`; +a d2 +select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`; +d2 +drop table t1,t2; set optimizer_switch=@subselect_innodb_tmp; diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index 26ff1072e30..f6ac5204c3e 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -368,4 +368,18 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr drop table t1; +--echo # +--echo # MDEV-3988 crash in create_tmp_table +--echo # + +drop table if exists `t1`,`t2`; +create table `t1`(`a` char(1) character set utf8)engine=innodb; +create table `t2`(`b` char(1) character set utf8)engine=memory; +select distinct (select 1 from `t2` where `a`) `d2` from `t1`; +select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`; +select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`; +select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`; + +drop table t1,t2; + set optimizer_switch=@subselect_innodb_tmp; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index aa47793df8f..0897aa287db 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13797,10 +13797,20 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, if (group) { + ORDER **prev= &group; if (!param->quick_group) group=0; // Can't use group key else for (ORDER *tmp=group ; tmp ; tmp=tmp->next) { + /* Exclude found constant from the list */ + if ((*tmp->item)->const_item()) + { + *prev= tmp->next; + param->group_parts--; + continue; + } + else + prev= &(tmp->next); /* marker == 4 means two things: - store NULLs in the key, and From 8a296e6ca2e55f9f1f3ce25d311291a20ee1c9e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Jan 2013 13:53:15 +0200 Subject: [PATCH 308/349] backport of: Don't reset maybe_null in update_used_tables(); This breaks ROLLUP This fixed failing test in group_by.test --- mysql-test/r/join_outer.result | 8 ++++---- mysql-test/r/join_outer_jcl6.result | 8 ++++---- sql/item.cc | 2 +- sql/item.h | 4 ++-- sql/item_cmpfunc.h | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 4541cdbc752..17bc705b4f3 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1770,10 +1770,10 @@ SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where ((((1 between 5 and 6) and isnull(5)) or 1)) order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; @@ -1809,10 +1809,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 3272186d12f..981e8002ea0 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -1781,10 +1781,10 @@ SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where ((((1 between 5 and 6) and isnull(5)) or 1)) order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; @@ -1820,10 +1820,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/sql/item.cc b/sql/item.cc index aee35b611e7..2e023168f34 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9169,7 +9169,7 @@ void Item_ref::update_used_tables() { if (!get_depended_from()) (*ref)->update_used_tables(); - maybe_null= (*ref)->maybe_null; + maybe_null|= (*ref)->maybe_null; } void Item_direct_view_ref::update_used_tables() diff --git a/sql/item.h b/sql/item.h index 2b5e867feb7..1e35c7839de 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1855,7 +1855,7 @@ public: { update_table_bitmaps(); if (field && field->table) - maybe_null= field->maybe_null(); + maybe_null|= field->maybe_null(); } Item *get_tmp_table_item(THD *thd); bool collect_item_field_processor(uchar * arg); @@ -2882,7 +2882,7 @@ public: void update_used_tables() { orig_item->update_used_tables(); - maybe_null= orig_item->maybe_null; + maybe_null|= orig_item->maybe_null; } bool const_item() const { return orig_item->const_item(); } table_map not_null_tables() const { return orig_item->not_null_tables(); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index dca139e6321..8c505b36758 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -760,7 +760,7 @@ public: void update_used_tables() { Item_func_coalesce::update_used_tables(); - maybe_null= args[1]->maybe_null; + maybe_null|= args[1]->maybe_null; } const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); @@ -787,7 +787,7 @@ public: void update_used_tables() { Item_func::update_used_tables(); - maybe_null= args[1]->maybe_null || args[2]->maybe_null; + maybe_null|= args[1]->maybe_null || args[2]->maybe_null; } uint decimal_precision() const; const char *func_name() const { return "if"; } From d51f96b16754cad5d2c9a91bb5b5e0673e59ded0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Jan 2013 16:08:05 +0200 Subject: [PATCH 309/349] MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements Analysis The reason for the less efficient plan was result of a prior design decision - to limit the eveluation of constant expressions during optimization to only non-expensive ones. With this approach all stored procedures were considered expensive, and were not evaluated during optimization. As a result, SPs didn't participate in range optimization, which resulted in a plan with table scan rather than index range scan. Solution Instead of considering all SPs expensive, consider expensive only those SPs that are non-deterministic. If an SP is deterministic, the optimizer will checj if it is constant, and may eventually evaluate it during optimization. --- mysql-test/r/sp.result | 36 +++++++++++++++++++++++++++++++++--- mysql-test/t/sp.test | 19 +++++++++++++++++++ sql/item_func.cc | 13 +++++++++++++ sql/item_func.h | 5 +++-- 4 files changed, 68 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 454be15a1ad..cc5a1f6f65a 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6420,16 +6420,16 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f1(); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 0 Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM v1 WHERE c1=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM v1 WHERE c1=f1(); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 0 Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(10); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 0 Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index @@ -7146,3 +7146,33 @@ c1 c2 count(c3) 2012-03-01 01:00:00 3 1 2012-03-01 02:00:00 3 1 DROP PROCEDURE p1; + +MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements + +CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now()); +CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM; +INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8); +INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5; +FLUSH TABLES; +FLUSH STATUS; +SHOW STATUS LIKE '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +UPDATE t1 SET a = '+' WHERE daynum=tdn(); +SHOW STATUS LIKE '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 2 +Handler_read_next 4097 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +drop function tdn; +drop table t1; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index dcfbe127f8a..0fce174ecb7 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -8478,3 +8478,22 @@ CALL p1(1); DROP PROCEDURE p1; +--echo +--echo MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements +--echo + +CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now()); + +CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM; +INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8); +INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5; + +FLUSH TABLES; +FLUSH STATUS; + +SHOW STATUS LIKE '%Handler_read%'; +UPDATE t1 SET a = '+' WHERE daynum=tdn(); +SHOW STATUS LIKE '%Handler_read%'; + +drop function tdn; +drop table t1; diff --git a/sql/item_func.cc b/sql/item_func.cc index 18d0ce3a822..c1767fb71ca 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -6056,6 +6056,19 @@ Item_func_sp::init_result_field(THD *thd) } +/** + @note + Deterministic stored procedures are considered inexpensive. + Consequently such procedures may be evaluated during optimization, + if they are constant (checked by the optimizer). +*/ + +bool Item_func_sp::is_expensive() +{ + return !(m_sp->m_chistics->detistic); +} + + /** @brief Initialize local members with values from the Field interface. diff --git a/sql/item_func.h b/sql/item_func.h index b144b393225..2db8ab76ffe 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1807,7 +1807,8 @@ private: bool init_result_field(THD *thd); protected: - bool is_expensive_processor(uchar *arg) { return TRUE; } + bool is_expensive_processor(uchar *arg) + { return is_expensive(); } public: @@ -1881,7 +1882,7 @@ public: bool fix_fields(THD *thd, Item **ref); void fix_length_and_dec(void); - bool is_expensive() { return 1; } + bool is_expensive(); inline Field *get_sp_result_field() { From 2255132f200940186c6e9dfcedae6edb85e7cee7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Jan 2013 21:07:26 +0200 Subject: [PATCH 310/349] MDEV-4056 fix. The problem was that maybe_null of Item_row and its componetes was unsynced after update_used_tables() (and so pushed_cond_guards was not initialized but then requested). Fix updates Item_row::maybe_null on update_used_tables(). --- mysql-test/r/subselect4.result | 21 +++++++++++++++++++++ mysql-test/t/subselect4.test | 26 ++++++++++++++++++++++++++ sql/item_row.cc | 2 ++ 3 files changed, 49 insertions(+) diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index bd64aca7d95..83716429efe 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -2305,5 +2305,26 @@ SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 ); a1 b1 drop table t1, t2, t3; +# +# MDEV-4056:Server crashes in Item_func_trig_cond::val_int +# with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists +# +set @optimizer_switch_MDEV4056 = @@optimizer_switch; +SET optimizer_switch = 'derived_merge=on,in_to_exists=on'; +CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('x'),('d'); +CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v'); +SELECT * FROM t1 LEFT JOIN ( +SELECT * FROM t2 WHERE ( pk, pk ) NOT IN ( +SELECT MIN(b), SUM(pk) FROM t1 +) +) AS alias1 ON (a = c) +WHERE b IS NULL OR a < 'u'; +a pk b c +x NULL NULL NULL +d NULL NULL NULL +drop table t1,t2; +set @@optimizer_switch = @optimizer_switch_MDEV4056; SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 5e1f3db2f4a..51247e2c3ea 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -1886,5 +1886,31 @@ SELECT * FROM t1 WHERE a1 IN ( drop table t1, t2, t3; +--echo # +--echo # MDEV-4056:Server crashes in Item_func_trig_cond::val_int +--echo # with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists +--echo # + +set @optimizer_switch_MDEV4056 = @@optimizer_switch; +SET optimizer_switch = 'derived_merge=on,in_to_exists=on'; + +CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('x'),('d'); + +CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v'); + +SELECT * FROM t1 LEFT JOIN ( + SELECT * FROM t2 WHERE ( pk, pk ) NOT IN ( + SELECT MIN(b), SUM(pk) FROM t1 + ) +) AS alias1 ON (a = c) +WHERE b IS NULL OR a < 'u'; + +drop table t1,t2; +set @@optimizer_switch = @optimizer_switch_MDEV4056; + + + SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; diff --git a/sql/item_row.cc b/sql/item_row.cc index 5136c0100d6..72bae6f0900 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -139,11 +139,13 @@ void Item_row::update_used_tables() { used_tables_cache= 0; const_item_cache= 1; + maybe_null= 0; for (uint i= 0; i < arg_count; i++) { items[i]->update_used_tables(); used_tables_cache|= items[i]->used_tables(); const_item_cache&= items[i]->const_item(); + maybe_null|= items[i]->maybe_null; } } From 63afbba419fcf9fe1fd2acb3355c112453c15a66 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 16 Jan 2013 11:17:58 -0800 Subject: [PATCH 311/349] Corrected the fix for bug mdev-3938. --- sql/sql_insert.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f76c2252eb9..f9179843810 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2141,7 +2141,6 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) /* We don't need to change the file handler here */ /* Assign the pointers for the field pointers array and the record. */ field= copy->field= (Field**) (copy + 1); - copy->vfield= vfield; bitmap= (uchar*) (field + share->fields + 1); copy->record[0]= (bitmap + share->column_bitmap_size*3); memcpy((char*) copy->record[0], (char*) table->record[0], share->reclength); @@ -2165,8 +2164,9 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) } *field=0; - if (table->vfield) + if (share->vfields) { + copy->vfield= vfield; for (field= copy->field; *field; field++) { if ((*field)->vcol_info) From c4e00d03e79c6202100f15244b10a74386d16568 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 17 Jan 2013 01:08:49 +0200 Subject: [PATCH 312/349] Fixed compiler warning --- strings/ctype-ucs2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 52eaece5528..6ebbae8fb5a 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -46,9 +46,10 @@ #define LFACTOR1 ULL(10000000000) #define LFACTOR2 ULL(100000000000) +#if defined(HAVE_CHARSET_utf32) || defined(HAVE_CHARSET_mb2) static unsigned long lfactor[9]= { 1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L, 100000000L }; - +#endif #ifdef HAVE_CHARSET_mb2_or_mb4 From c65f9a1914b8abd26dd7f31099ed09116e429b9d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 17 Jan 2013 02:27:10 +0200 Subject: [PATCH 313/349] Don't reset maybe_null in update_used_tables(); This breaks ROLLUP This fixed failing test in group_by.test mysql-test/r/join_outer.result: Updated test case mysql-test/r/join_outer_jcl6.result: Updated test case sql/item.cc: Don't reset maybe_null in update_used_tables(); This breaks ROLLUP sql/item.h: Don't reset maybe_null in update_used_tables(); This breaks ROLLUP sql/item_cmpfunc.h: Don't reset maybe_null in update_used_tables(); This breaks ROLLUP --- mysql-test/r/join_outer.result | 8 ++++---- mysql-test/r/join_outer_jcl6.result | 8 ++++---- sql/item.cc | 2 +- sql/item.h | 4 ++-- sql/item_cmpfunc.h | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 693b007c4b3..fd2a948847c 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2019,10 +2019,10 @@ SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where ((((1 between 5 and 6) and isnull(5)) or 1)) order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; @@ -2058,10 +2058,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 83415abf228..d891f5c49b2 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2030,10 +2030,10 @@ SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: -Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5 +Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where ((((1 between 5 and 6) and isnull(5)) or 1)) order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; @@ -2069,10 +2069,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; diff --git a/sql/item.cc b/sql/item.cc index e6462d1c070..2c435eb6a9f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9603,7 +9603,7 @@ void Item_ref::update_used_tables() { if (!get_depended_from()) (*ref)->update_used_tables(); - maybe_null= (*ref)->maybe_null; + maybe_null|= (*ref)->maybe_null; } void Item_direct_view_ref::update_used_tables() diff --git a/sql/item.h b/sql/item.h index baff64cac24..89cb9b76439 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2057,7 +2057,7 @@ public: { update_table_bitmaps(); if (field && field->table) - maybe_null= field->maybe_null(); + maybe_null|= field->maybe_null(); } Item *get_tmp_table_item(THD *thd); bool collect_item_field_processor(uchar * arg); @@ -3112,7 +3112,7 @@ public: void update_used_tables() { orig_item->update_used_tables(); - maybe_null= orig_item->maybe_null; + maybe_null|= orig_item->maybe_null; } bool const_item() const { return orig_item->const_item(); } table_map not_null_tables() const { return orig_item->not_null_tables(); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index e9b77152d12..eed9028a630 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -770,7 +770,7 @@ public: void update_used_tables() { Item_func_coalesce::update_used_tables(); - maybe_null= args[1]->maybe_null; + maybe_null|= args[1]->maybe_null; } const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); @@ -797,7 +797,7 @@ public: void update_used_tables() { Item_func::update_used_tables(); - maybe_null= args[1]->maybe_null || args[2]->maybe_null; + maybe_null|= args[1]->maybe_null || args[2]->maybe_null; } uint decimal_precision() const; const char *func_name() const { return "if"; } From 5649377b558d182a4856a86157070e0df93097a7 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 18 Jan 2013 18:49:07 +0100 Subject: [PATCH 314/349] Fix Windows installers' bootstrapper scripts , after mysql_performance_tables.sql was split off mysql_system_tables.sql --- cmake/create_initial_db.cmake.in | 2 +- sql/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in index fba6209d147..9888a7df7a2 100644 --- a/cmake/create_initial_db.cmake.in +++ b/cmake/create_initial_db.cmake.in @@ -31,7 +31,7 @@ ENDIF() # Create bootstrapper SQL script FILE(WRITE bootstrap.sql "use mysql;\n" ) -FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql) +FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql mysql_performance_tables.sql) FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS) FOREACH(STR ${CONTENTS}) IF(NOT STR MATCHES "@current_hostname") diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index a5f1fcb60ec..ad22446d0c9 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -321,11 +321,12 @@ IF(WIN32) ADD_CUSTOM_COMMAND(OUTPUT ${my_bootstrap_sql} COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts - cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql ${native_outfile} + cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql ${native_outfile} DEPENDS ${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables.sql ${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables_data.sql ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql + ${CMAKE_SOURCE_DIR}/scripts/mysql_performance_tables.sql ) ADD_CUSTOM_COMMAND( From d41d43f42165cafe87d361f473e226fee24e91ba Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Jan 2013 19:04:23 +0100 Subject: [PATCH 315/349] MDEV-4065 thd_kill_statement service --- include/mysql/plugin.h | 18 +------ include/mysql/plugin_audit.h.pp | 11 +++- include/mysql/plugin_auth.h.pp | 11 +++- include/mysql/plugin_ftparser.h.pp | 11 +++- include/mysql/service_kill_statement.h | 71 ++++++++++++++++++++++++++ include/mysql/services.h | 1 + include/service_versions.h | 14 ++--- libservices/CMakeLists.txt | 3 +- libservices/kill_statement_service.c | 18 +++++++ mysql-test/r/handlersocket.result | 2 +- mysql-test/r/plugin.result | 6 +-- sql/handler.cc | 13 ++--- sql/handler.h | 6 +-- sql/sql_class.cc | 33 ++++++++---- sql/sql_plugin.cc | 7 ++- sql/sql_plugin_services.h | 21 +++++--- storage/innobase/handler/ha_innodb.cc | 17 +++--- storage/xtradb/handler/ha_innodb.cc | 19 ++++--- 18 files changed, 203 insertions(+), 79 deletions(-) create mode 100644 include/mysql/service_kill_statement.h create mode 100644 libservices/kill_statement_service.c diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index d30abb190d0..d28b762ce37 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -72,7 +72,7 @@ typedef struct st_mysql_xid MYSQL_XID; #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103 /* MariaDB plugin interface version */ -#define MARIA_PLUGIN_INTERFACE_VERSION 0x0103 +#define MARIA_PLUGIN_INTERFACE_VERSION 0x0104 /* The allowable types of plugins @@ -625,22 +625,6 @@ void thd_inc_row_count(MYSQL_THD thd); */ int mysql_tmpfile(const char *prefix); -/** - Check the killed state of a connection - - @details - In MySQL support for the KILL statement is cooperative. The KILL - statement only sets a "killed" flag. This function returns the value - of that flag. A thread should check it often, especially inside - time-consuming loops, and gracefully abort the operation if it is - non-zero. - - @param thd user thread connection handle - @retval 0 the connection is active - @retval 1 the connection has been killed -*/ -int thd_killed(const MYSQL_THD thd); - /** Return the thread id of a user thread diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index b987f690592..f19d5fe797c 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func, const char *file, unsigned int line); #include extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t); +#include +enum thd_kill_levels { + THD_IS_NOT_KILLED=0, + THD_ABORT_SOFTLY=50, + THD_ABORT_ASAP=100, +}; +extern struct kill_statement_service_st { + enum thd_kill_levels (*thd_kill_level_func)(const void*); +} *thd_kill_statement_service; +enum thd_kill_levels thd_kill_level(const void*); struct st_mysql_xid { long formatID; long gtrid_length; @@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); -int thd_killed(const void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 113aaf62d19..23153198a7d 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func, const char *file, unsigned int line); #include extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t); +#include +enum thd_kill_levels { + THD_IS_NOT_KILLED=0, + THD_ABORT_SOFTLY=50, + THD_ABORT_ASAP=100, +}; +extern struct kill_statement_service_st { + enum thd_kill_levels (*thd_kill_level_func)(const void*); +} *thd_kill_statement_service; +enum thd_kill_levels thd_kill_level(const void*); struct st_mysql_xid { long formatID; long gtrid_length; @@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); -int thd_killed(const void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index 6011e7f7519..fb09a97618b 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func, const char *file, unsigned int line); #include extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t); +#include +enum thd_kill_levels { + THD_IS_NOT_KILLED=0, + THD_ABORT_SOFTLY=50, + THD_ABORT_ASAP=100, +}; +extern struct kill_statement_service_st { + enum thd_kill_levels (*thd_kill_level_func)(const void*); +} *thd_kill_statement_service; +enum thd_kill_levels thd_kill_level(const void*); struct st_mysql_xid { long formatID; long gtrid_length; @@ -179,7 +189,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); -int thd_killed(const void* thd); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, diff --git a/include/mysql/service_kill_statement.h b/include/mysql/service_kill_statement.h new file mode 100644 index 00000000000..995b21f0a9f --- /dev/null +++ b/include/mysql/service_kill_statement.h @@ -0,0 +1,71 @@ +/* Copyright (c) 2013, Monty Program Ab. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#ifndef MYSQL_SERVICE_KILL_STATEMENT_INCLUDED +#define MYSQL_SERVICE_KILL_STATEMENT_INCLUDED + +/** + @file + This service provides functions that allow plugins to support + the KILL statement. + + In MySQL support for the KILL statement is cooperative. The KILL + statement only sets a "killed" flag. This function returns the value + of that flag. A thread should check it often, especially inside + time-consuming loops, and gracefully abort the operation if it is + non-zero. + + thd_is_killed(thd) + @return 0 - no KILL statement was issued, continue normally + @return 1 - there was a KILL statement, abort the execution. + + thd_kill_level(thd) + @return thd_kill_levels_enum values +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +enum thd_kill_levels { + THD_IS_NOT_KILLED=0, + THD_ABORT_SOFTLY=50, /**< abort when possible, don't leave tables corrupted */ + THD_ABORT_ASAP=100, /**< abort asap */ +}; + +extern struct kill_statement_service_st { + enum thd_kill_levels (*thd_kill_level_func)(const MYSQL_THD); +} *thd_kill_statement_service; + +/* backward compatibility helper */ +#define thd_killed(THD) (thd_kill_level(THD) == THD_ABORT_ASAP) + +#ifdef MYSQL_DYNAMIC_PLUGIN + +#define thd_kill_level(THD) \ + thd_kill_statement_service->thd_kill_level_func(THD) + +#else + +enum thd_kill_levels thd_kill_level(const MYSQL_THD); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/mysql/services.h b/include/mysql/services.h index 8eb506e1c37..b5b331d4923 100644 --- a/include/mysql/services.h +++ b/include/mysql/services.h @@ -24,6 +24,7 @@ extern "C" { #include #include #include +#include #ifdef __cplusplus } diff --git a/include/service_versions.h b/include/service_versions.h index 436941643ec..9b41da7440e 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -19,9 +19,11 @@ #define SERVICE_VERSION void * #endif -#define VERSION_my_snprintf 0x0100 -#define VERSION_thd_alloc 0x0100 -#define VERSION_thd_wait 0x0100 -#define VERSION_my_thread_scheduler 0x0100 -#define VERSION_progress_report 0x0100 -#define VERSION_debug_sync 0x1000 +#define VERSION_my_snprintf 0x0100 +#define VERSION_thd_alloc 0x0100 +#define VERSION_thd_wait 0x0100 +#define VERSION_my_thread_scheduler 0x0100 +#define VERSION_progress_report 0x0100 +#define VERSION_debug_sync 0x1000 +#define VERSION_kill_statement 0x1000 + diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt index eb8ff7ffe09..1583d1ff792 100644 --- a/libservices/CMakeLists.txt +++ b/libservices/CMakeLists.txt @@ -21,7 +21,8 @@ SET(MYSQLSERVICES_SOURCES thd_wait_service.c my_thread_scheduler_service.c progress_report_service.c - debug_sync_service.c) + debug_sync_service.c + kill_statement_service.c) ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES}) INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development) diff --git a/libservices/kill_statement_service.c b/libservices/kill_statement_service.c new file mode 100644 index 00000000000..4c7cacb241d --- /dev/null +++ b/libservices/kill_statement_service.c @@ -0,0 +1,18 @@ +/* Copyright (c) 2013, Monty Program Ab. + Use is subject to license terms. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include +SERVICE_VERSION thd_kill_statement_service= (void*)VERSION_kill_statement; diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result index a415b12f92d..9e5d273cbb6 100644 --- a/mysql-test/r/handlersocket.result +++ b/mysql-test/r/handlersocket.result @@ -5,7 +5,7 @@ plugin_version 1.0 plugin_status ACTIVE plugin_type DAEMON plugin_library handlersocket.so -plugin_library_version 1.3 +plugin_library_version 1.4 plugin_author higuchi dot akira at dena dot jp plugin_description Direct access into InnoDB plugin_license BSD diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 6d8efe2615b..62864d0f16d 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -15,7 +15,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.3 +PLUGIN_LIBRARY_VERSION 1.4 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL @@ -28,7 +28,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE DAEMON PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.3 +PLUGIN_LIBRARY_VERSION 1.4 PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Unusable Daemon PLUGIN_LICENSE GPL @@ -57,7 +57,7 @@ PLUGIN_STATUS DELETED PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.3 +PLUGIN_LIBRARY_VERSION 1.4 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL diff --git a/sql/handler.cc b/sql/handler.cc index 11265abb9d0..058e219f76c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -673,21 +673,20 @@ void ha_close_connection(THD* thd) } static my_bool kill_handlerton(THD *thd, plugin_ref plugin, - void *hard_kill) + void *level) { handlerton *hton= plugin_data(plugin, handlerton *); if (hton->state == SHOW_OPTION_YES && hton->kill_query && thd_get_ha_data(thd, hton)) - hton->kill_query(hton, thd, * (my_bool*) hard_kill); + hton->kill_query(hton, thd, *(enum thd_kill_levels *) level); return FALSE; } -void ha_kill_query(THD* thd, my_bool hard_kill) +void ha_kill_query(THD* thd, enum thd_kill_levels level) { DBUG_ENTER("ha_kill_query"); - plugin_foreach(thd, kill_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, - &hard_kill); + plugin_foreach(thd, kill_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &level); DBUG_VOID_RETURN; } @@ -4721,7 +4720,9 @@ extern "C" enum icp_result handler_index_cond_check(void* h_arg) THD *thd= h->table->in_use; enum icp_result res; - if (thd_killed(thd)) + enum thd_kill_levels abort_at= h->has_transactions() ? + THD_ABORT_SOFTLY : THD_ABORT_ASAP; + if (thd_kill_level(thd) > abort_at) return ICP_ABORTED_BY_USER; if (h->end_range && h->compare_key2(h->end_range) > 0) diff --git a/sql/handler.h b/sql/handler.h index 9e390b2a62a..4a91d989e52 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -866,10 +866,8 @@ struct handlerton int (*close_connection)(handlerton *hton, THD *thd); /* Tell handler that query has been killed. - hard_kill is set in case of HARD KILL (abort query even if - it may corrupt table). */ - void (*kill_query)(handlerton *hton, THD *thd, my_bool hard_kill); + void (*kill_query)(handlerton *hton, THD *thd, enum thd_kill_levels level); /* sv points to an uninitialized storage area of requested size (see savepoint_offset description) @@ -2983,7 +2981,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin); TYPELIB *ha_known_exts(void); int ha_panic(enum ha_panic_function flag); void ha_close_connection(THD* thd); -void ha_kill_query(THD* thd, my_bool hard_kill); +void ha_kill_query(THD* thd, enum thd_kill_levels level); bool ha_flush_logs(handlerton *db_type); void ha_drop_database(char* path); void ha_checkpoint_state(bool disable); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 616e827a552..43e72973ab9 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1613,7 +1613,7 @@ void THD::awake(killed_state state_to_set) /* Interrupt target waiting inside a storage engine. */ if (state_to_set != NOT_KILLED) - ha_kill_query(this, test(state_to_set & KILL_HARD_BIT)); + ha_kill_query(this, thd_kill_level(this)); /* Broadcast a condition to kick the target if it is waiting on it. */ if (mysys_var) @@ -3834,15 +3834,13 @@ void THD::restore_backup_open_tables_state(Open_tables_backup *backup) DBUG_VOID_RETURN; } +#if MARIA_PLUGIN_INTERFACE_VERSION < 0x0200 /** - Check the killed state of a user thread - @param thd user thread - @retval 0 the user thread is active - @retval 1 the user thread has been killed - - This is used to signal a storage engine if it should be killed. + This is a backward compatibility method, made obsolete + by the thd_kill_statement service. Keep it here to avoid breaking the + ABI in case some binary plugins still use it. */ - +#undef thd_killed extern "C" int thd_killed(const MYSQL_THD thd) { if (!thd) @@ -3850,9 +3848,26 @@ extern "C" int thd_killed(const MYSQL_THD thd) if (!(thd->killed & KILL_HARD_BIT)) return 0; - return thd->killed; + return thd->killed != 0; } +#else +#error now thd_killed() function can go away +#endif +/* + return thd->killed status to the client, + mapped to the API enum thd_kill_levels values. +*/ +extern "C" enum thd_kill_levels thd_kill_level(const MYSQL_THD thd) +{ + if (!thd) + thd= current_thd; + + if (likely(thd->killed == NOT_KILLED)) + return THD_IS_NOT_KILLED; + + return thd->killed & KILL_HARD_BIT ? THD_ABORT_ASAP : THD_ABORT_SOFTLY; +} /** Send an out-of-band progress report to the client diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index cec577b2273..bf3537c0ed9 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1872,8 +1872,11 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, DBUG_RETURN(FALSE); error: mysql_mutex_unlock(&LOCK_plugin); - sql_print_error("Couldn't load plugin named '%s' with soname '%s'.", - name.str, dl.str); + if (name.str) + sql_print_error("Couldn't load plugin '%s' from '%s'.", + name.str, dl.str); + else + sql_print_error("Couldn't load plugins from '%s'.", dl.str); DBUG_RETURN(TRUE); } diff --git a/sql/sql_plugin_services.h b/sql/sql_plugin_services.h index c779547059d..e3ef338eaad 100644 --- a/sql/sql_plugin_services.h +++ b/sql/sql_plugin_services.h @@ -54,13 +54,18 @@ static struct progress_report_service_st progress_report_handler= { set_thd_proc_info }; -static struct st_service_ref list_of_services[]= -{ - { "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler }, - { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler }, - { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler }, - { "my_thread_scheduler_service", VERSION_my_thread_scheduler, &my_thread_scheduler_handler }, - { "progress_report_service", VERSION_progress_report, &progress_report_handler }, - { "debug_sync_service", VERSION_debug_sync, 0 } // updated in plugin_init() +static struct kill_statement_service_st thd_kill_statement_handler= { + thd_kill_level +}; + +static struct st_service_ref list_of_services[]= +{ + { "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler }, + { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler }, + { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler }, + { "my_thread_scheduler_service", VERSION_my_thread_scheduler, &my_thread_scheduler_handler }, + { "progress_report_service", VERSION_progress_report, &progress_report_handler }, + { "debug_sync_service", VERSION_debug_sync, 0 }, // updated in plugin_init() + { "thd_kill_statement_service", VERSION_kill_statement, &thd_kill_statement_handler } }; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 0c5cea37cfb..7c036d3b601 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -339,7 +339,7 @@ static PSI_file_info all_innodb_files[] = { static INNOBASE_SHARE *get_share(const char *table_name); static void free_share(INNOBASE_SHARE *share); static int innobase_close_connection(handlerton *hton, THD* thd); -static void innobase_kill_query(handlerton *hton, THD* thd, my_bool hard_kill); +static void innobase_kill_query(handlerton *hton, THD* thd, enum thd_kill_levels level); static void innobase_commit_ordered(handlerton *hton, THD* thd, bool all); static int innobase_commit(handlerton *hton, THD* thd, bool all); static int innobase_rollback(handlerton *hton, THD* thd, bool all); @@ -2153,7 +2153,7 @@ trx_is_interrupted( /*===============*/ trx_t* trx) /*!< in: transaction */ { - return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd)); + return(trx && trx->mysql_thd && thd_kill_level((THD*) trx->mysql_thd)); } /**********************************************************************//** @@ -2283,7 +2283,7 @@ innobase_init( innobase_hton->flags=HTON_NO_FLAGS; innobase_hton->release_temporary_latches=innobase_release_temporary_latches; innobase_hton->alter_table_flags = innobase_alter_table_flags; - innobase_hton->kill_query = innobase_kill_query; + innobase_hton->kill_query = innobase_kill_query; ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); @@ -3193,9 +3193,9 @@ static void innobase_kill_query( /*======================*/ - handlerton* hton, /*!< in: innobase handlerton */ - THD* thd, /*!< in: handle to the MySQL thread being killed */ - my_bool hard_kill) /*!< in: If hard kill */ + handlerton* hton, /*!< in: innobase handlerton */ + THD* thd, /*!< in: MySQL thread being killed */ + enum thd_kill_levels level) /*!< in: kill level */ { trx_t* trx; DBUG_ENTER("innobase_kill_query"); @@ -3207,7 +3207,6 @@ innobase_kill_query( /* Cancel a pending lock request. */ if (trx && trx->wait_lock) { - //trx->killed= 1; lock_cancel_waiting_and_release(trx->wait_lock); } @@ -8724,7 +8723,7 @@ ha_innobase::check( row_mysql_unlock_data_dictionary(prebuilt->trx); } - if (thd_killed(user_thd)) { + if (thd_kill_level(user_thd)) { break; } @@ -8781,7 +8780,7 @@ ha_innobase::check( mutex_exit(&kernel_mutex); prebuilt->trx->op_info = ""; - if (thd_killed(user_thd)) { + if (thd_kill_level(user_thd)) { my_error(ER_QUERY_INTERRUPTED, MYF(0)); } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index cef23d06923..269bf8436a0 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -378,7 +378,7 @@ static PSI_file_info all_innodb_files[] = { static INNOBASE_SHARE *get_share(const char *table_name); static void free_share(INNOBASE_SHARE *share); static int innobase_close_connection(handlerton *hton, THD* thd); -static void innobase_kill_query(handlerton *hton, THD* thd, my_bool hard_kill); +static void innobase_kill_query(handlerton *hton, THD* thd, enum thd_kill_levels level); static void innobase_commit_ordered(handlerton *hton, THD* thd, bool all); static int innobase_commit(handlerton *hton, THD* thd, bool all); static int innobase_rollback(handlerton *hton, THD* thd, bool all); @@ -2378,7 +2378,7 @@ trx_is_interrupted( /*===============*/ trx_t* trx) /*!< in: transaction */ { - return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd)); + return(trx && trx->mysql_thd && thd_kill_level((THD*) trx->mysql_thd)); } /**********************************************************************//** @@ -2634,7 +2634,7 @@ innobase_init( innobase_hton->flags=HTON_NO_FLAGS; innobase_hton->release_temporary_latches=innobase_release_temporary_latches; innobase_hton->alter_table_flags = innobase_alter_table_flags; - innobase_hton->kill_query = innobase_kill_query; + innobase_hton->kill_query = innobase_kill_query; ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); @@ -3780,9 +3780,9 @@ static void innobase_kill_query( /*======================*/ - handlerton* hton, /*!< in: innobase handlerton */ - THD* thd, /*!< in: handle to the MySQL thread being killed */ - my_bool hard_kill) /*!< in: If hard kill */ + handlerton* hton, /*!< in: innobase handlerton */ + THD* thd, /*!< in: MySQL thread being killed */ + enum thd_kill_levels level) /*!< in: kill level */ { trx_t* trx; DBUG_ENTER("innobase_kill_query"); @@ -3794,7 +3794,6 @@ innobase_kill_query( /* Cancel a pending lock request. */ if (trx && trx->wait_lock) { - //trx->killed= 1; lock_cancel_waiting_and_release(trx->wait_lock); } @@ -9731,7 +9730,7 @@ ha_innobase::check( row_mysql_unlock_data_dictionary(prebuilt->trx); } - if (thd_killed(user_thd)) { + if (thd_kill_level(user_thd)) { break; } @@ -9788,7 +9787,7 @@ ha_innobase::check( mutex_exit(&kernel_mutex); prebuilt->trx->op_info = ""; - if (thd_killed(user_thd)) { + if (thd_kill_level(user_thd)) { my_error(ER_QUERY_INTERRUPTED, MYF(0)); } @@ -13587,7 +13586,7 @@ int ha_innobase::multi_range_read_explain_info(uint mrr_mode, char *str, size_t bool ha_innobase::is_thd_killed() { - return thd_killed(user_thd); + return thd_kill_level(user_thd); } /** From fd9b911b7001dd74b27ec5e2ae6c4d5da24a4ea4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Jan 2013 19:04:51 +0100 Subject: [PATCH 316/349] MDEV-3908 crash in multi-table delete and mdl Add a test case. The fix comes with MySQL bug#15948123: SERVER WORKS INCORRECT WITH LONG TABLE ALIASES --- mysql-test/r/alias.result | 2 ++ mysql-test/t/alias.test | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/mysql-test/r/alias.result b/mysql-test/r/alias.result index 9e4ce9f84a9..9d826dd9bd7 100644 --- a/mysql-test/r/alias.result +++ b/mysql-test/r/alias.result @@ -212,3 +212,5 @@ drop table t4; create table t4 select t2.*, d as 'x', d as 'z' from t2; drop table t4; drop table t1,t2,t3; +DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1 WHERE 1=1' at line 1 diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test index 0e2d57598e2..c02ebe2f5ff 100644 --- a/mysql-test/t/alias.test +++ b/mysql-test/t/alias.test @@ -215,3 +215,14 @@ drop table t4; drop table t1,t2,t3; # End of 5.2 tests + +# +# MDEV-3908 crash in multi-table delete and mdl +# +connect (c1,localhost,root,,); +connection c1; +# this used to crash on disconnect +--error ER_PARSE_ERROR +DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1; +connection default; +disconnect c1; From 381f470936a84b899f9de6453ed8ec177e59bc69 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Jan 2013 19:07:59 +0100 Subject: [PATCH 317/349] simplify THD::binlog_setup_trx_data() usage --- sql/log.cc | 31 ++++++++++--------------------- sql/sql_class.cc | 2 +- sql/sql_class.h | 2 +- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 567b3c69833..d078d1dfda4 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1531,10 +1531,7 @@ binlog_trans_log_savepos(THD *thd, my_off_t *pos) { DBUG_ENTER("binlog_trans_log_savepos"); DBUG_ASSERT(pos != NULL); - if (thd_get_ha_data(thd, binlog_hton) == NULL) - thd->binlog_setup_trx_data(); - binlog_cache_mngr *const cache_mngr= - (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); + binlog_cache_mngr *const cache_mngr= thd->binlog_setup_trx_data(); DBUG_ASSERT(mysql_bin_log.is_open()); *pos= cache_mngr->trx_cache.get_byte_position(); DBUG_PRINT("return", ("*pos: %lu", (ulong) *pos)); @@ -4719,14 +4716,14 @@ bool stmt_has_updated_non_trans_table(const THD* thd) binlog_hton, which has internal linkage. */ -int THD::binlog_setup_trx_data() +binlog_cache_mngr *THD::binlog_setup_trx_data() { DBUG_ENTER("THD::binlog_setup_trx_data"); binlog_cache_mngr *cache_mngr= (binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton); if (cache_mngr) - DBUG_RETURN(0); // Already set up + DBUG_RETURN(cache_mngr); // Already set up cache_mngr= (binlog_cache_mngr*) my_malloc(sizeof(binlog_cache_mngr), MYF(MY_ZEROFILL)); if (!cache_mngr || @@ -4736,18 +4733,18 @@ int THD::binlog_setup_trx_data() LOG_PREFIX, binlog_cache_size, MYF(MY_WME))) { my_free(cache_mngr); - DBUG_RETURN(1); // Didn't manage to set it up + DBUG_RETURN(0); // Didn't manage to set it up } thd_set_ha_data(this, binlog_hton, cache_mngr); - cache_mngr= new (thd_get_ha_data(this, binlog_hton)) + cache_mngr= new (cache_mngr) binlog_cache_mngr(max_binlog_stmt_cache_size, max_binlog_cache_size, &binlog_stmt_cache_use, &binlog_stmt_cache_disk_use, &binlog_cache_use, &binlog_cache_disk_use); - DBUG_RETURN(0); + DBUG_RETURN(cache_mngr); } /* @@ -4830,9 +4827,7 @@ binlog_start_consistent_snapshot(handlerton *hton, THD *thd) int err= 0; DBUG_ENTER("binlog_start_consistent_snapshot"); - thd->binlog_setup_trx_data(); - binlog_cache_mngr *const cache_mngr= - (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); + binlog_cache_mngr *const cache_mngr= thd->binlog_setup_trx_data(); /* Server layer calls us with LOCK_commit_ordered locked, so this is safe. */ strmake(cache_mngr->last_commit_pos_file, mysql_bin_log.last_commit_pos_file, @@ -4944,11 +4939,7 @@ THD::binlog_get_pending_rows_event(bool is_transactional) const void THD::binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional) { - if (thd_get_ha_data(this, binlog_hton) == NULL) - binlog_setup_trx_data(); - - binlog_cache_mngr *const cache_mngr= - (binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton); + binlog_cache_mngr *const cache_mngr= binlog_setup_trx_data(); DBUG_ASSERT(cache_mngr); @@ -5119,12 +5110,10 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate) } else { - if (thd->binlog_setup_trx_data()) + binlog_cache_mngr *const cache_mngr= thd->binlog_setup_trx_data(); + if (!cache_mngr) goto err; - binlog_cache_mngr *const cache_mngr= - (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); - is_trans_cache= use_trans_cache(thd, using_trans); file= cache_mngr->get_binlog_cache_log(is_trans_cache); cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 43e72973ab9..9c53db45009 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4909,7 +4909,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, There is no good place to set up the transactional data, so we have to do it here. */ - if (binlog_setup_trx_data()) + if (binlog_setup_trx_data() == NULL) DBUG_RETURN(NULL); Rows_log_event* pending= binlog_get_pending_rows_event(is_transactional); diff --git a/sql/sql_class.h b/sql/sql_class.h index f1b3652c15c..e92ba129a29 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1734,7 +1734,7 @@ public: bool save_prep_leaf_list; #ifndef MYSQL_CLIENT - int binlog_setup_trx_data(); + binlog_cache_mngr * binlog_setup_trx_data(); /* Public interface to write RBR events to the binlog From 103c4c4906d0dc6cf1cfc807fd344d24c49b82ae Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Jan 2013 19:10:20 +0100 Subject: [PATCH 318/349] MDEV-633 lp:1024058 - mysqld XA crash in replication slave initialize cache_mngr and write the Xid into binlog even if binlog is disabled with SQL_LOG_BIN=0 or no --log-slave-updates in the slave thread --- sql/log.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index d078d1dfda4..6c04055cfc1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -7460,8 +7460,9 @@ TC_LOG_BINLOG::log_and_order(THD *thd, my_xid xid, bool all, int err; DBUG_ENTER("TC_LOG_BINLOG::log_and_order"); - binlog_cache_mngr *cache_mngr= - (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); + binlog_cache_mngr *cache_mngr= thd->binlog_setup_trx_data(); + if (!cache_mngr) + DBUG_RETURN(0); cache_mngr->using_xa= TRUE; cache_mngr->xa_xid= xid; From 48bf57b02e8792ac6f1c42aac4683b5fac93d9ad Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 19 Jan 2013 14:03:33 +0100 Subject: [PATCH 319/349] MDEV-3832 MariaDB conflicts with packages filesystem-3.1-2.fc18.i686 and jre-1.7.0_09-fcs.i586 on Fedora 18 fix the rpm packaging to work on Fedora18. Two problems: * conflicts on common directories with other packages. * more auto-generated requirements for mariadb-test.rpm --- cmake/cpack_rpm.cmake | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index f5017d6c984..f5ff7ab0fae 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -64,10 +64,29 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE} SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common") -SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d" "%config(noreplace) /etc/my.cnf.d/*") -SET(CPACK_RPM_common_USER_FILELIST "%config(noreplace) /etc/my.cnf") -SET(CPACK_RPM_shared_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*") -SET(CPACK_RPM_client_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*") +SET(ignored + "%ignore /etc" + "%ignore /etc/init.d" + "%ignore /etc/logrotate.d" + "%ignore /usr" + "%ignore /usr/bin" + "%ignore /usr/include" + "%ignore /usr/lib64" + "%ignore /usr/sbin" + "%ignore /usr/share" + "%ignore /usr/share/aclocal" + "%ignore /usr/share/doc" + "%ignore /usr/share/man" + "%ignore /usr/share/man/man1*" + "%ignore /usr/share/man/man8*" + ) + +SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*") +SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf") +SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*") +SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*") +SET(CPACK_RPM_devel_USER_FILELIST ${ignored}) +SET(CPACK_RPM_test_USER_FILELIST ${ignored}) SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client") SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client") @@ -97,7 +116,7 @@ SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MySQL-test MySQL-OurDelta-test" SET(CPACK_RPM_test_PACKAGE_PROVIDES "MariaDB-test MySQL-test mysql-test") # workaround for lots of perl dependencies added by rpmbuild -SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_misc.pl)") +SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_cases) perl(mtr_io.pl) perl(mtr_match) perl(mtr_misc.pl) perl(mtr_report) perl(mtr_results) perl(mtr_unique)") # If we want to build build MariaDB-shared-compat, # extract compat libraries from MariaDB-shared-5.3 rpm From cc74bb3178b0296e9865ebd42588709c984b722e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 20 Jan 2013 00:46:51 +0100 Subject: [PATCH 320/349] MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling Early evaluation of subqueries in the WHERE conditions on I_S.*_STATUS tables, otherwise the subquery on this same table will try to acquire LOCK_status twice. sql/item.h: remove unused method --- mysql-test/r/information_schema2.result | 8 ++++++++ mysql-test/t/information_schema2.test | 9 +++++++++ sql/item.h | 1 - sql/sql_show.cc | 18 ++++++++++++------ 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 mysql-test/r/information_schema2.result create mode 100644 mysql-test/t/information_schema2.test diff --git a/mysql-test/r/information_schema2.result b/mysql-test/r/information_schema2.result new file mode 100644 index 00000000000..60a20944839 --- /dev/null +++ b/mysql-test/r/information_schema2.result @@ -0,0 +1,8 @@ +select variable_name from information_schema.session_status where variable_name = +(select variable_name from information_schema.session_status where variable_name = 'uptime'); +variable_name +UPTIME +select variable_name from information_schema.session_variables where variable_name = +(select variable_name from information_schema.session_variables where variable_name = 'basedir'); +variable_name +BASEDIR diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test new file mode 100644 index 00000000000..c2479087f47 --- /dev/null +++ b/mysql-test/t/information_schema2.test @@ -0,0 +1,9 @@ + +# +# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling +# +select variable_name from information_schema.session_status where variable_name = +(select variable_name from information_schema.session_status where variable_name = 'uptime'); +select variable_name from information_schema.session_variables where variable_name = +(select variable_name from information_schema.session_variables where variable_name = 'basedir'); + diff --git a/sql/item.h b/sql/item.h index 89cb9b76439..bdf6fbe548e 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1445,7 +1445,6 @@ public: */ virtual bool is_outer_field() const { DBUG_ASSERT(fixed); return FALSE; } Item* set_expr_cache(THD *thd); - virtual Item *get_cached_item() { return NULL; } virtual Item_equal *get_item_equal() { return NULL; } virtual void set_item_equal(Item_equal *item_eq) {}; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 19146a146e4..cb96db0a46d 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2595,7 +2595,6 @@ static bool show_status_array(THD *thd, const char *wild, int len; LEX_STRING null_lex_str; SHOW_VAR tmp, *var; - COND *partial_cond= 0; enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; bool res= FALSE; CHARSET_INFO *charset= system_charset_info; @@ -2609,7 +2608,6 @@ static bool show_status_array(THD *thd, const char *wild, if (*prefix) *prefix_end++= '_'; len=name_buffer + sizeof(name_buffer) - prefix_end; - partial_cond= make_cond_for_info_schema(cond, table->pos_in_table_list); for (; variables->name; variables++) { @@ -2632,13 +2630,13 @@ static bool show_status_array(THD *thd, const char *wild, if (show_type == SHOW_ARRAY) { show_status_array(thd, wild, (SHOW_VAR *) var->value, value_type, - status_var, name_buffer, table, ucase_names, partial_cond); + status_var, name_buffer, table, ucase_names, cond); } else { if (!(wild && wild[0] && wild_case_compare(system_charset_info, name_buffer, wild)) && - (!partial_cond || partial_cond->val_int())) + (!cond || cond->val_int())) { char *value=var->value; const char *pos, *end; // We assign a lot of const's @@ -6898,9 +6896,12 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond) schema_table_idx == SCH_GLOBAL_VARIABLES) option_type= OPT_GLOBAL; + COND *partial_cond= make_cond_for_info_schema(cond, tables); + mysql_rwlock_rdlock(&LOCK_system_variables_hash); res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, option_type), - option_type, NULL, "", tables->table, upper_case_names, cond); + option_type, NULL, "", tables->table, + upper_case_names, partial_cond); mysql_rwlock_unlock(&LOCK_system_variables_hash); DBUG_RETURN(res); } @@ -6937,13 +6938,18 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond) tmp1= &thd->status_var; } + COND *partial_cond= make_cond_for_info_schema(cond, tables); + // Evaluate and cache const subqueries now, before the mutex. + if (partial_cond) + partial_cond->val_int(); + mysql_mutex_lock(&LOCK_status); if (option_type == OPT_GLOBAL) calc_sum_of_all_status(&tmp); res= show_status_array(thd, wild, (SHOW_VAR *)all_status_vars.buffer, option_type, tmp1, "", tables->table, - upper_case_names, cond); + upper_case_names, partial_cond); mysql_mutex_unlock(&LOCK_status); DBUG_RETURN(res); } From 02d368ff9d2e5121ed27c221d9bfd2b3792177a3 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 19 Jan 2013 23:40:53 -0800 Subject: [PATCH 321/349] Corrected the test case for bug mdev-3938. --- mysql-test/suite/vcol/r/vcol_misc.result | 1 + mysql-test/suite/vcol/t/vcol_misc.test | 2 ++ 2 files changed, 3 insertions(+) diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index f679d5eb671..4c301795f5c 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -188,6 +188,7 @@ tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL ) ENGINE=MyISAM; INSERT INTO t1 (tsv) VALUES (DEFAULT); INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT); +FLUSH TABLES; SELECT COUNT(*) FROM t1; COUNT(*) 2 diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 53c04898648..0a689795b4c 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -192,6 +192,8 @@ INSERT INTO t1 (tsv) VALUES (DEFAULT); INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT); +FLUSH TABLES; + SELECT COUNT(*) FROM t1; DROP TABLE t1; From 7caa80c48170f8a35ef8ece7a1881fe1f0e022dd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 20 Jan 2013 14:06:33 +0100 Subject: [PATCH 322/349] MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column sel_arg_range_seq_next(): set keypart map also for GEOM_FLAG keys --- mysql-test/r/gis2.result | 14 ++++++++++++++ mysql-test/t/gis2.test | 17 +++++++++++++++++ sql/opt_range_mrr.cc | 1 + 3 files changed, 32 insertions(+) create mode 100644 mysql-test/r/gis2.result create mode 100644 mysql-test/t/gis2.test diff --git a/mysql-test/r/gis2.result b/mysql-test/r/gis2.result new file mode 100644 index 00000000000..214431e1d2d --- /dev/null +++ b/mysql-test/r/gis2.result @@ -0,0 +1,14 @@ +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +point_data POINT NOT NULL, +PRIMARY KEY (id), +KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES +(GeomFromText('Point(37.0248492 23.8512726)')), +(GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +id +2 +DROP TABLE t1; diff --git a/mysql-test/t/gis2.test b/mysql-test/t/gis2.test new file mode 100644 index 00000000000..b734ab19ecd --- /dev/null +++ b/mysql-test/t/gis2.test @@ -0,0 +1,17 @@ +# +# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column +# + +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + point_data POINT NOT NULL, + PRIMARY KEY (id), + KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES + (GeomFromText('Point(37.0248492 23.8512726)')), + (GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +DROP TABLE t1; + diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc index a4345059f85..1f4e36178db 100644 --- a/sql/opt_range_mrr.cc +++ b/sql/opt_range_mrr.cc @@ -248,6 +248,7 @@ walk_up_n_right: /* Here minimum contains also function code bits, and maximum is +inf */ range->start_key.key= seq->param->min_key; range->start_key.length= min_key_length; + range->start_key.keypart_map= make_prev_keypart_map(cur->min_key_parts); range->start_key.flag= (ha_rkey_function) (cur->min_key_flag ^ GEOM_FLAG); } else From faac8db6bdd9f91eaa8dd4dc929e2909f8075d14 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 20 Jan 2013 21:42:01 +0100 Subject: [PATCH 323/349] MDEV-3952 Incompatible change in MariaDB-5.5.28a-client rpm adds mytop when not in MariaDB-5.5.23-client (CentOS 5) Same as for deb: don't add mytop to the client rpm. --- scripts/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 8f306abcb32..76e92899c2a 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -285,7 +285,7 @@ SET(mysql_config_COMPONENT COMPONENT Development) SET(msql2mysql_COMPONENT COMPONENT Client) SET(mysqlaccess_COMPONENT COMPONENT Client) SET(mysql_find_rows_COMPONENT COMPONENT Client) -SET(mytop_COMPONENT Client) +SET(mytop_COMPONENT Mytop) IF(WIN32) # On Windows, some .sh and some .pl.in files are configured From a0710621bf463db66d81f42134dd66f8b03c276a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 20 Jan 2013 21:43:11 +0100 Subject: [PATCH 324/349] fix a strict aliasing warning - remove a meaningless cast. --- sql/item_strfunc.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 28009e7154e..0c1f556b398 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4192,8 +4192,7 @@ String *Item_dyncol_get::val_str(String *str_result) case DYN_COL_DECIMAL: { int res; - int length= - my_decimal_string_length((const my_decimal*)&val.x.decimal.value); + int length= decimal_string_size(&val.x.decimal.value); if (str_result->alloc(length)) goto null; if ((res= decimal2string(&val.x.decimal.value, (char*) str_result->ptr(), From 43c6953fa1ba3aad4f065bfbd63cca6b5d0c5ce7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 21 Jan 2013 10:52:39 +0100 Subject: [PATCH 325/349] MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling Early evaluation of subqueries in the WHERE conditions on I_S.*_STATUS tables, otherwise the subquery on this same table will try to acquire LOCK_status twice. --- mysql-test/r/information_schema2.result | 8 ++++++++ mysql-test/t/information_schema2.test | 9 +++++++++ sql/sql_show.cc | 18 ++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 mysql-test/r/information_schema2.result create mode 100644 mysql-test/t/information_schema2.test diff --git a/mysql-test/r/information_schema2.result b/mysql-test/r/information_schema2.result new file mode 100644 index 00000000000..60a20944839 --- /dev/null +++ b/mysql-test/r/information_schema2.result @@ -0,0 +1,8 @@ +select variable_name from information_schema.session_status where variable_name = +(select variable_name from information_schema.session_status where variable_name = 'uptime'); +variable_name +UPTIME +select variable_name from information_schema.session_variables where variable_name = +(select variable_name from information_schema.session_variables where variable_name = 'basedir'); +variable_name +BASEDIR diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test new file mode 100644 index 00000000000..c2479087f47 --- /dev/null +++ b/mysql-test/t/information_schema2.test @@ -0,0 +1,9 @@ + +# +# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling +# +select variable_name from information_schema.session_status where variable_name = +(select variable_name from information_schema.session_status where variable_name = 'uptime'); +select variable_name from information_schema.session_variables where variable_name = +(select variable_name from information_schema.session_variables where variable_name = 'basedir'); + diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d544ff4c52c..f9c2d114596 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2260,7 +2260,6 @@ static bool show_status_array(THD *thd, const char *wild, int len; LEX_STRING null_lex_str; SHOW_VAR tmp, *var; - COND *partial_cond= 0; enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; bool res= FALSE; CHARSET_INFO *charset= system_charset_info; @@ -2274,7 +2273,6 @@ static bool show_status_array(THD *thd, const char *wild, if (*prefix) *prefix_end++= '_'; len=name_buffer + sizeof(name_buffer) - prefix_end; - partial_cond= make_cond_for_info_schema(cond, table->pos_in_table_list); for (; variables->name; variables++) { @@ -2297,13 +2295,13 @@ static bool show_status_array(THD *thd, const char *wild, if (show_type == SHOW_ARRAY) { show_status_array(thd, wild, (SHOW_VAR *) var->value, value_type, - status_var, name_buffer, table, ucase_names, partial_cond); + status_var, name_buffer, table, ucase_names, cond); } else { if (!(wild && wild[0] && wild_case_compare(system_charset_info, name_buffer, wild)) && - (!partial_cond || partial_cond->val_int())) + (!cond || cond->val_int())) { char *value=var->value; const char *pos, *end; // We assign a lot of const's @@ -5562,9 +5560,12 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond) schema_table_idx == SCH_GLOBAL_VARIABLES) option_type= OPT_GLOBAL; + COND *partial_cond= make_cond_for_info_schema(cond, tables); + rw_rdlock(&LOCK_system_variables_hash); res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars), - option_type, NULL, "", tables->table, upper_case_names, cond); + option_type, NULL, "", tables->table, upper_case_names, + partial_cond); rw_unlock(&LOCK_system_variables_hash); DBUG_RETURN(res); } @@ -5601,13 +5602,18 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond) tmp1= &thd->status_var; } + COND *partial_cond= make_cond_for_info_schema(cond, tables); + // Evaluate and cache const subqueries now, before the mutex. + if (partial_cond) + partial_cond->val_int(); + pthread_mutex_lock(&LOCK_status); if (option_type == OPT_GLOBAL) calc_sum_of_all_status(&tmp); res= show_status_array(thd, wild, (SHOW_VAR *)all_status_vars.buffer, option_type, tmp1, "", tables->table, - upper_case_names, cond); + upper_case_names, partial_cond); pthread_mutex_unlock(&LOCK_status); DBUG_RETURN(res); } From 193c6f548b3702b4259560c40ca24c1243053388 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jan 2013 14:34:39 +0200 Subject: [PATCH 326/349] MDEV-3873: fixed functions absend in 5.3. --- sql/item_func.h | 5 +++++ sql/item_strfunc.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sql/item_func.h b/sql/item_func.h index 88491be44a2..516cdd548d0 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -2053,6 +2053,11 @@ public: enum_field_types field_type() const { return last_value->field_type(); } bool const_item() const { return 0; } void evaluate_sideeffects(); + void update_uesd_tables() + { + Item_func_last_value::update_used_tables(); + maybe_null= last_value->maybe_null; + } }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 0c1f556b398..3fc5e504b85 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -341,7 +341,7 @@ String *Item_func_sha2::val_str_ascii(String *str) void Item_func_sha2::fix_length_and_dec() { - maybe_null = 1; + set_persist_maybe_null(1); max_length = 0; #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) From 82e39cb1e1637794cc3f7c5049d2d20ce5a32576 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Jan 2013 13:29:59 +0200 Subject: [PATCH 327/349] Fixed typo in the function name. test suite added. --- mysql-test/r/func_misc.result | 33 +++++++++++++++++++++++++++++++++ mysql-test/t/func_misc.test | 19 +++++++++++++++++++ sql/item_func.h | 4 ++-- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 514994ed27c..55b0f9d3c57 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -305,6 +305,39 @@ SELECT 1 from t1 HAVING NAME_CONST('', a); ERROR HY000: Incorrect arguments to NAME_CONST DROP TABLE t1; # +# Test or correct maybe_null of last_value +# +CREATE TABLE t1 (a char(2) not null ); +INSERT INTO t1 VALUES (4),(7),(1); +set @optimizer_switch_save= @@optimizer_switch; +set optimizer_switch='materialization=off'; +CREATE TABLE tv (e char(2) not null ) engine=mysql; +Warnings: +Warning 1286 Unknown storage engine 'mysql' +Warning 1266 Using storage engine MyISAM for table 'tv' +INSERT INTO tv VALUES (1); +CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; +CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv; +explain extended +select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(((last_value(NULL,`test`.`tv`.`e`),(select last_value(NULL,'1') from dual where trigcond(((last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1')))))))) +explain extended +select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<`test`.`tv`.`e`>((`test`.`tv`.`e`,(select last_value(NULL,'1') from dual where trigcond(((`test`.`tv`.`e`) = last_value(NULL,'1')))))))) +set optimizer_switch=@optimizer_switch_save; +drop view v_merge, vm; +drop table t1,tv; +# # End of 5.5 tests # # diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 1f221ce9878..292db69a6e3 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -348,6 +348,25 @@ SELECT 1 from t1 HAVING NAME_CONST('', a); DROP TABLE t1; +--echo # +--echo # Test or correct maybe_null of last_value +--echo # +CREATE TABLE t1 (a char(2) not null ); +INSERT INTO t1 VALUES (4),(7),(1); +set @optimizer_switch_save= @@optimizer_switch; +set optimizer_switch='materialization=off'; +CREATE TABLE tv (e char(2) not null ) engine=mysql; +INSERT INTO tv VALUES (1); +CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; +CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv; +explain extended +select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm); +explain extended +select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm); +set optimizer_switch=@optimizer_switch_save; +drop view v_merge, vm; +drop table t1,tv; + --echo # --echo # End of 5.5 tests diff --git a/sql/item_func.h b/sql/item_func.h index 516cdd548d0..4306c6ea47a 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -2053,9 +2053,9 @@ public: enum_field_types field_type() const { return last_value->field_type(); } bool const_item() const { return 0; } void evaluate_sideeffects(); - void update_uesd_tables() + void update_used_tables() { - Item_func_last_value::update_used_tables(); + Item_func::update_used_tables(); maybe_null= last_value->maybe_null; } }; From 7925bf6b40aed5af7ed3e45cb4818c3be6f55064 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 21 Jan 2013 12:20:54 +0100 Subject: [PATCH 328/349] MDEV-4069 thd_wait_end does not called in some cases in buf_page_read_low in XtraDB engine --- storage/xtradb/buf/buf0rea.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c index 67379d614a0..6d76a488af7 100644 --- a/storage/xtradb/buf/buf0rea.c +++ b/storage/xtradb/buf/buf0rea.c @@ -235,6 +235,9 @@ not_to_recover: sync, space, 0, offset, 0, UNIV_PAGE_SIZE, ((buf_block_t*) bpage)->frame, bpage, trx); } + if(sync) { + thd_wait_end(NULL); + } if (*err == DB_TABLESPACE_DELETED) { buf_read_page_handle_error(bpage); @@ -250,7 +253,6 @@ not_to_recover: } if (sync) { - thd_wait_end(NULL); /* The i/o is already completed when we arrive from fil_read */ if (!buf_page_io_complete(bpage)) { From fade3647ecb18a90d9c89a924a076d714ec45888 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Mon, 21 Jan 2013 11:47:45 -0800 Subject: [PATCH 329/349] Fixed bug mdev-4063 (bug #56927). This bug could result in returning 0 for the expressions of the form (distinct field) when the system variable max_heap_table_size was set to a small enough number. It happened because the method Unique::walk() did not support the case when more than one pass was needed to merge the trees of distinct values saved in an external file. Backported a fix in grant_lowercase.test from mariadb 5.5. --- mysql-test/r/sum_distinct-big.result | 15 +++ mysql-test/t/grant_lowercase.test | 1 + mysql-test/t/sum_distinct-big.test | 17 +++ sql/item_sum.cc | 4 +- sql/sql_class.h | 4 +- sql/uniques.cc | 174 +++++++++++++++++---------- 6 files changed, 146 insertions(+), 69 deletions(-) diff --git a/mysql-test/r/sum_distinct-big.result b/mysql-test/r/sum_distinct-big.result index 9b55d59ab91..d4933b31f80 100644 --- a/mysql-test/r/sum_distinct-big.result +++ b/mysql-test/r/sum_distinct-big.result @@ -103,5 +103,20 @@ sm 10323810 10325070 10326330 +# +# Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size +# (bug #56927) +# +SET max_heap_table_size=default; +INSERT INTO t1 SELECT id+16384 FROM t1; +DELETE FROM t2; +INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand(); +SELECT SUM(DISTINCT id) sm FROM t2; +sm +536887296 +SET max_heap_table_size=16384; +SELECT SUM(DISTINCT id) sm FROM t2; +sm +536887296 DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/t/grant_lowercase.test b/mysql-test/t/grant_lowercase.test index 157e13449c2..b07cb88afd6 100644 --- a/mysql-test/t/grant_lowercase.test +++ b/mysql-test/t/grant_lowercase.test @@ -1,4 +1,5 @@ # test cases for strmov(tmp_db, db) -> strnmov replacement in sql_acl.cc +--source include/not_embedded.inc # # http://seclists.org/fulldisclosure/2012/Dec/4 diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test index 0859f4b3d89..d3710056c9a 100644 --- a/mysql-test/t/sum_distinct-big.test +++ b/mysql-test/t/sum_distinct-big.test @@ -63,5 +63,22 @@ SELECT SUM(DISTINCT id) sm FROM t1; SELECT SUM(DISTINCT id) sm FROM t2; SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13; +--echo # +--echo # Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size +--echo # (bug #56927) +--echo # + +SET max_heap_table_size=default; + +INSERT INTO t1 SELECT id+16384 FROM t1; +DELETE FROM t2; +INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand(); + +SELECT SUM(DISTINCT id) sm FROM t2; + +SET max_heap_table_size=16384; + +SELECT SUM(DISTINCT id) sm FROM t2; + DROP TABLE t1; DROP TABLE t2; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 92c2ba83f23..debba23438d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1084,7 +1084,7 @@ void Item_sum_distinct::calculate_val_and_count() if (tree) { table->field[0]->set_notnull(); - tree->walk(item_sum_distinct_walk, (void*) this); + tree->walk(table, item_sum_distinct_walk, (void*) this); } is_evaluated= TRUE; } @@ -2583,7 +2583,7 @@ longlong Item_sum_count_distinct::val_int() if (tree->elements == 0) return (longlong) tree->elements_in_tree(); // everything fits in memory count= 0; - tree->walk(count_distinct_walk, (void*) &count); + tree->walk(table, count_distinct_walk, (void*) &count); is_evaluated= TRUE; return (longlong) count; } diff --git a/sql/sql_class.h b/sql/sql_class.h index fb4e13ad9c6..2fd8e8cd04b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3008,6 +3008,8 @@ class Unique :public Sql_alloc bool flush(); uint size; + bool merge(TABLE *table, uchar *buff, bool without_last_merge); + public: ulong elements; Unique(qsort_cmp2 comp_func, void *comp_func_fixed_arg, @@ -3035,7 +3037,7 @@ public: } void reset(); - bool walk(tree_walk_action action, void *walk_action_arg); + bool walk(TABLE *table, tree_walk_action action, void *walk_action_arg); uint get_size() const { return size; } ulonglong get_max_in_memory_size() const { return max_in_memory_size; } diff --git a/sql/uniques.cc b/sql/uniques.cc index fd6056ae8a6..5788edc673e 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -538,6 +538,7 @@ end: SYNOPSIS Unique:walk() All params are 'IN': + table parameter for the call of the merge method action function-visitor, typed in include/my_tree.h function is called for each unique element arg argument for visitor, which is passed to it on each call @@ -546,30 +547,117 @@ end: <> 0 error */ -bool Unique::walk(tree_walk_action action, void *walk_action_arg) +bool Unique::walk(TABLE *table, tree_walk_action action, void *walk_action_arg) { - int res; + int res= 0; uchar *merge_buffer; if (elements == 0) /* the whole tree is in memory */ return tree_walk(&tree, action, walk_action_arg, left_root_right); + table->sort.found_records=elements+tree.elements_in_tree; /* flush current tree to the file to have some memory for merge buffer */ if (flush()) return 1; if (flush_io_cache(&file) || reinit_io_cache(&file, READ_CACHE, 0L, 0, 0)) return 1; - if (!(merge_buffer= (uchar *) my_malloc((ulong) max_in_memory_size, MYF(0)))) + ulong buff_sz= (max_in_memory_size / size + 1) * size; + if (!(merge_buffer= (uchar *) my_malloc((ulong) buff_sz, MYF(0)))) return 1; - res= merge_walk(merge_buffer, (ulong) max_in_memory_size, size, - (BUFFPEK *) file_ptrs.buffer, - (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements, - action, walk_action_arg, - tree.compare, tree.custom_arg, &file); + if (buff_sz < (ulong) (size * (file_ptrs.elements + 1))) + res= merge(table, merge_buffer, buff_sz >= size * MERGEBUFF2) ; + + if (!res) + { + res= merge_walk(merge_buffer, (ulong) max_in_memory_size, size, + (BUFFPEK *) file_ptrs.buffer, + (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements, + action, walk_action_arg, + tree.compare, tree.custom_arg, &file); + } my_free((char*) merge_buffer, MYF(0)); return res; } + +/* + DESCRIPTION + Perform multi-pass sort merge of the elements accessed through table->sort, + using the buffer buff as the merge buffer. The last pass is not performed + if without_last_merge is TRUE. + SYNOPSIS + Unique:merge() + All params are 'IN': + table the parameter to access sort context + buff merge buffer + without_last_merge TRUE <=> do not perform the last merge + RETURN VALUE + 0 OK + <> 0 error + */ + +bool Unique::merge(TABLE *table, uchar *buff, bool without_last_merge) +{ + SORTPARAM sort_param; + IO_CACHE *outfile= table->sort.io_cache; + BUFFPEK *file_ptr= (BUFFPEK*) file_ptrs.buffer; + uint maxbuffer= file_ptrs.elements - 1; + my_off_t save_pos; + bool error= 1; + + /* Open cached file if it isn't open */ + if (!outfile) + outfile= table->sort.io_cache= (IO_CACHE*) my_malloc(sizeof(IO_CACHE), + MYF(MY_ZEROFILL)); + if (!outfile || + (! my_b_inited(outfile) && + open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER, + MYF(MY_WME)))) + return 1; + reinit_io_cache(outfile,WRITE_CACHE,0L,0,0); + + bzero((char*) &sort_param,sizeof(sort_param)); + sort_param.max_rows= elements; + sort_param.sort_form= table; + sort_param.rec_length= sort_param.sort_length= sort_param.ref_length= + size; + sort_param.keys= (uint) (max_in_memory_size / sort_param.sort_length); + sort_param.not_killable= 1; + + sort_param.unique_buff= buff + (sort_param.keys * sort_param.sort_length); + + sort_param.compare= (qsort2_cmp) buffpek_compare; + sort_param.cmp_context.key_compare= tree.compare; + sort_param.cmp_context.key_compare_arg= tree.custom_arg; + + /* Merge the buffers to one file, removing duplicates */ + if (merge_many_buff(&sort_param,buff,file_ptr,&maxbuffer,&file)) + goto err; + if (flush_io_cache(&file) || + reinit_io_cache(&file,READ_CACHE,0L,0,0)) + goto err; + if (without_last_merge) + { + file_ptrs.elements= maxbuffer+1; + return 0; + } + if (merge_buffers(&sort_param, &file, outfile, buff, file_ptr, + file_ptr, file_ptr+maxbuffer,0)) + goto err; + error= 0; +err: + if (flush_io_cache(outfile)) + error= 1; + + /* Setup io_cache for reading */ + save_pos= outfile->pos_in_file; + if (reinit_io_cache(outfile,READ_CACHE,0L,0,0)) + error= 1; + outfile->end_of_file=save_pos; + return error; +} + + /* Modify the TABLE element so that when one calls init_records() the rows will be read in priority order. @@ -577,8 +665,9 @@ bool Unique::walk(tree_walk_action action, void *walk_action_arg) bool Unique::get(TABLE *table) { - SORTPARAM sort_param; - table->sort.found_records=elements+tree.elements_in_tree; + bool rc= 1; + uchar *sort_buffer= NULL; + table->sort.found_records= elements+tree.elements_in_tree; if (my_b_tell(&file) == 0) { @@ -594,63 +683,16 @@ bool Unique::get(TABLE *table) /* Not enough memory; Save the result to file && free memory used by tree */ if (flush()) return 1; - - IO_CACHE *outfile=table->sort.io_cache; - BUFFPEK *file_ptr= (BUFFPEK*) file_ptrs.buffer; - uint maxbuffer= file_ptrs.elements - 1; - uchar *sort_buffer; - my_off_t save_pos; - bool error=1; - - /* Open cached file if it isn't open */ - outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE), - MYF(MY_ZEROFILL)); - - if (!outfile || - (! my_b_inited(outfile) && - open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER, - MYF(MY_WME)))) + + ulong buff_sz= (max_in_memory_size / size + 1) * size; + if (!(sort_buffer= (uchar*) my_malloc(buff_sz, MYF(0)))) return 1; - reinit_io_cache(outfile,WRITE_CACHE,0L,0,0); - bzero((char*) &sort_param,sizeof(sort_param)); - sort_param.max_rows= elements; - sort_param.sort_form=table; - sort_param.rec_length= sort_param.sort_length= sort_param.ref_length= - size; - sort_param.keys= (uint) (max_in_memory_size / sort_param.sort_length); - sort_param.not_killable=1; + if (merge(table, sort_buffer, FALSE)) + goto err; + rc= 0; - if (!(sort_buffer=(uchar*) my_malloc((sort_param.keys+1) * - sort_param.sort_length, - MYF(0)))) - return 1; - sort_param.unique_buff= sort_buffer+(sort_param.keys* - sort_param.sort_length); - - sort_param.compare= (qsort2_cmp) buffpek_compare; - sort_param.cmp_context.key_compare= tree.compare; - sort_param.cmp_context.key_compare_arg= tree.custom_arg; - - /* Merge the buffers to one file, removing duplicates */ - if (merge_many_buff(&sort_param,sort_buffer,file_ptr,&maxbuffer,&file)) - goto err; - if (flush_io_cache(&file) || - reinit_io_cache(&file,READ_CACHE,0L,0,0)) - goto err; - if (merge_buffers(&sort_param, &file, outfile, sort_buffer, file_ptr, - file_ptr, file_ptr+maxbuffer,0)) - goto err; - error=0; -err: - x_free(sort_buffer); - if (flush_io_cache(outfile)) - error=1; - - /* Setup io_cache for reading */ - save_pos=outfile->pos_in_file; - if (reinit_io_cache(outfile,READ_CACHE,0L,0,0)) - error=1; - outfile->end_of_file=save_pos; - return error; +err: + x_free(sort_buffer); + return rc; } From f1e758dc6f4183a8e3856d21c95f7e4973c585c1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 23 Jan 2013 14:58:05 +0100 Subject: [PATCH 330/349] remove one particularly stupid test --- mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result | 3 --- mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test | 3 --- 2 files changed, 6 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result b/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result index ee6169a9e35..4192f6b2444 100644 --- a/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result +++ b/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result @@ -1,8 +1,5 @@ select @@global.pseudo_thread_id; ERROR HY000: Variable 'pseudo_thread_id' is a SESSION variable -select @@session.pseudo_thread_id between 1 and 10000; -@@session.pseudo_thread_id between 1 and 10000 -1 should be empty show global variables like 'pseudo_thread_id'; Variable_name Value diff --git a/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test b/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test index fef3e906869..aaf87912213 100644 --- a/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test +++ b/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test @@ -9,9 +9,6 @@ --error ER_INCORRECT_GLOBAL_LOCAL_VAR select @@global.pseudo_thread_id; -# Check the variable has a valid numeric value (assumed to be less then 10000) -select @@session.pseudo_thread_id between 1 and 10000; - --echo should be empty show global variables like 'pseudo_thread_id'; From bfc71e63a77972fa4ab934855b6ab712bea323a1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 25 Jan 2013 00:17:39 +0100 Subject: [PATCH 331/349] MDEV-3915 COM_CHANGE_USER allows fast password brute-forcing allow only three failed change_user per connection. successful change_user do NOT reset the counter tests/mysql_client_test.c: make --error to work for --change_user errors --- client/mysqltest.cc | 5 +- mysql-test/r/change_user_notembedded.result | 5 + mysql-test/r/mysqltest.result | 6 +- mysql-test/t/change_user_notembedded.test | 24 +++ sql/sql_class.cc | 1 + sql/sql_class.h | 1 + sql/sql_parse.cc | 17 +- tests/mysql_client_test.c | 184 ++++++++++++-------- 8 files changed, 164 insertions(+), 79 deletions(-) create mode 100644 mysql-test/r/change_user_notembedded.result create mode 100644 mysql-test/t/change_user_notembedded.test diff --git a/client/mysqltest.cc b/client/mysqltest.cc index fa5f2b566c2..fa3ade1a7c1 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3908,7 +3908,10 @@ void do_change_user(struct st_command *command) cur_con->name, ds_user.str, ds_passwd.str, ds_db.str)); if (mysql_change_user(mysql, ds_user.str, ds_passwd.str, ds_db.str)) - die("change user failed: %s", mysql_error(mysql)); + handle_error(command, mysql_errno(mysql), mysql_error(mysql), + mysql_sqlstate(mysql), &ds_res); + else + handle_no_error(command); dynstr_free(&ds_user); dynstr_free(&ds_passwd); diff --git a/mysql-test/r/change_user_notembedded.result b/mysql-test/r/change_user_notembedded.result new file mode 100644 index 00000000000..506a463d6d2 --- /dev/null +++ b/mysql-test/r/change_user_notembedded.result @@ -0,0 +1,5 @@ +ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) +ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) +ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) +ERROR 08S01: Unknown command +ERROR 08S01: Unknown command diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 312dd7d0312..32658866951 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -847,9 +847,9 @@ a int(11) YES NULL b varchar(255) YES NULL c datetime YES NULL drop table t1; -mysqltest: At line 1: change user failed: Unknown database 'inexistent' -mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO) -mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES) +mysqltest: At line 1: query 'change_user root,,inexistent' failed: 1049: Unknown database 'inexistent' +mysqltest: At line 1: query 'change_user inexistent,,test' failed: 1045: Access denied for user 'inexistent'@'localhost' (using password: NO) +mysqltest: At line 1: query 'change_user root,inexistent,test' failed: 1045: Access denied for user 'root'@'localhost' (using password: YES) REPLACED_FILE1.txt file1.txt file2.txt diff --git a/mysql-test/t/change_user_notembedded.test b/mysql-test/t/change_user_notembedded.test new file mode 100644 index 00000000000..bf5d1956cd5 --- /dev/null +++ b/mysql-test/t/change_user_notembedded.test @@ -0,0 +1,24 @@ +source include/not_embedded.inc; + +# +# MDEV-3915 COM_CHANGE_USER allows fast password brute-forcing +# +# only three failed change_user per connection. +# successful change_user do NOT reset the counter +# +connect (test,localhost,root,,); +connection test; +--error 1045 +change_user foo,bar; +--error 1045 +change_user foo; +change_user; +--error 1045 +change_user foo,bar; +--error 1047 +change_user foo,bar; +--error 1047 +change_user; +disconnect test; +connection default; + diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b7a37ae3f69..d44d28eaae2 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -675,6 +675,7 @@ THD::THD() stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE), examined_row_count(0), global_read_lock(0), + failed_com_change_user(0), is_fatal_error(0), transaction_rollback_request(0), is_fatal_sub_stmt_error(0), diff --git a/sql/sql_class.h b/sql/sql_class.h index 6b277add4a5..d55200efea4 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1865,6 +1865,7 @@ public: bool no_errors, password; bool extra_port; /* If extra connection */ + uint8 failed_com_change_user; /** Set to TRUE if execution of the current compound statement can not continue. In particular, disables activation of diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index be0e2db43c6..0c47b7a8bb3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1144,6 +1144,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, uint save_db_length= thd->db_length; char *save_db= thd->db; + int rc; USER_CONN *save_user_connect= thd->user_connect; Security_context save_security_ctx= *thd->security_ctx; CHARSET_INFO *save_character_set_client= @@ -1157,7 +1158,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->security_ctx->user= 0; thd->user_connect= 0; - if (acl_authenticate(thd, 0, packet_length)) + /* + to limit COM_CHANGE_USER ability to brute-force passwords, + we only allow three unsuccessful COM_CHANGE_USER per connection. + */ + if (thd->failed_com_change_user >= 3) + { + my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0)); + rc= 1; + } + else + rc= acl_authenticate(thd, 0, packet_length); + + if (rc) { /* Free user if allocated by acl_authenticate */ x_free(thd->security_ctx->user); @@ -1170,6 +1183,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->variables.collation_connection= save_collation_connection; thd->variables.character_set_results= save_character_set_results; thd->update_charset(); + thd->failed_com_change_user++; + my_sleep(1000000); } else { diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 5f9d7bc76c8..fff06ca7daa 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -15386,6 +15386,7 @@ static void test_change_user() const char *pw= "password"; const char *db= "mysqltest_user_test_database"; int rc; + MYSQL* conn; DBUG_ENTER("test_change_user"); myheader("test_change_user"); @@ -15429,149 +15430,173 @@ static void test_change_user() rc= mysql_query(mysql, buff); myquery(rc); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); /* Try some combinations */ - rc= mysql_change_user(mysql, NULL, NULL, NULL); + rc= mysql_change_user(conn, NULL, NULL, NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, "", NULL, NULL); + rc= mysql_change_user(conn, "", NULL, NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, "", "", NULL); + rc= mysql_change_user(conn, "", "", NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, "", "", ""); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, "", "", ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, NULL, "", ""); + rc= mysql_change_user(conn, NULL, "", ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, NULL, NULL, ""); + rc= mysql_change_user(conn, NULL, NULL, ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, "", NULL, ""); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, "", NULL, ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_pw, NULL, ""); + rc= mysql_change_user(conn, user_pw, NULL, ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_pw, "", ""); + rc= mysql_change_user(conn, user_pw, "", ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_pw, "", NULL); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, user_pw, "", NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_pw, NULL, NULL); + rc= mysql_change_user(conn, user_pw, NULL, NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_pw, "", db); + rc= mysql_change_user(conn, user_pw, "", db); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_pw, NULL, db); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, user_pw, NULL, db); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_pw, pw, db); + rc= mysql_change_user(conn, user_pw, pw, db); myquery(rc); - rc= mysql_change_user(mysql, user_pw, pw, NULL); + rc= mysql_change_user(conn, user_pw, pw, NULL); myquery(rc); - rc= mysql_change_user(mysql, user_pw, pw, ""); + rc= mysql_change_user(conn, user_pw, pw, ""); myquery(rc); - rc= mysql_change_user(mysql, user_no_pw, pw, db); + rc= mysql_change_user(conn, user_no_pw, pw, db); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_no_pw, pw, ""); + rc= mysql_change_user(conn, user_no_pw, pw, ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_no_pw, pw, NULL); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, user_no_pw, pw, NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, user_no_pw, "", NULL); + rc= mysql_change_user(conn, user_no_pw, "", NULL); myquery(rc); - rc= mysql_change_user(mysql, user_no_pw, "", ""); + rc= mysql_change_user(conn, user_no_pw, "", ""); myquery(rc); - rc= mysql_change_user(mysql, user_no_pw, "", db); + rc= mysql_change_user(conn, user_no_pw, "", db); myquery(rc); - rc= mysql_change_user(mysql, user_no_pw, NULL, db); + rc= mysql_change_user(conn, user_no_pw, NULL, db); myquery(rc); - rc= mysql_change_user(mysql, "", pw, db); + rc= mysql_change_user(conn, "", pw, db); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, "", pw, ""); + rc= mysql_change_user(conn, "", pw, ""); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, "", pw, NULL); - DIE_UNLESS(rc); - if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); - rc= mysql_change_user(mysql, NULL, pw, NULL); + rc= mysql_change_user(conn, "", pw, NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, NULL, NULL, db); + rc= mysql_change_user(conn, NULL, pw, NULL); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, NULL, "", db); + rc= mysql_change_user(conn, NULL, NULL, db); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); - rc= mysql_change_user(mysql, "", "", db); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, NULL, "", db); DIE_UNLESS(rc); if (! opt_silent) - printf("Got error (as expected): %s\n", mysql_error(mysql)); + printf("Got error (as expected): %s\n", mysql_error(conn)); + + rc= mysql_change_user(conn, "", "", db); + DIE_UNLESS(rc); + if (! opt_silent) + printf("Got error (as expected): %s\n", mysql_error(conn)); /* Cleanup the environment */ - mysql_change_user(mysql, opt_user, opt_password, current_db); + mysql_change_user(conn, opt_user, opt_password, current_db); + + mysql_close(conn); sprintf(buff, "drop database %s", db); rc= mysql_query(mysql, buff); @@ -16234,29 +16259,35 @@ static void test_bug31669() static char db[NAME_CHAR_LEN+1]; static char query[LARGE_BUFFER_SIZE*2]; #endif + MYSQL* conn; DBUG_ENTER("test_bug31669"); myheader("test_bug31669"); - rc= mysql_change_user(mysql, NULL, NULL, NULL); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, NULL, NULL, NULL); DIE_UNLESS(rc); - rc= mysql_change_user(mysql, "", "", ""); + rc= mysql_change_user(conn, "", "", ""); DIE_UNLESS(rc); memset(buff, 'a', sizeof(buff)); - rc= mysql_change_user(mysql, buff, buff, buff); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + + rc= mysql_change_user(conn, buff, buff, buff); DIE_UNLESS(rc); - rc = mysql_change_user(mysql, opt_user, opt_password, current_db); + rc = mysql_change_user(conn, opt_user, opt_password, current_db); DIE_UNLESS(!rc); #ifndef EMBEDDED_LIBRARY memset(db, 'a', sizeof(db)); db[NAME_CHAR_LEN]= 0; strxmov(query, "CREATE DATABASE IF NOT EXISTS ", db, NullS); - rc= mysql_query(mysql, query); + rc= mysql_query(conn, query); myquery(rc); memset(user, 'b', sizeof(user)); @@ -16265,54 +16296,59 @@ static void test_bug31669() buff[LARGE_BUFFER_SIZE]= 0; strxmov(query, "GRANT ALL PRIVILEGES ON *.* TO '", user, "'@'%' IDENTIFIED BY " "'", buff, "' WITH GRANT OPTION", NullS); - rc= mysql_query(mysql, query); + rc= mysql_query(conn, query); myquery(rc); strxmov(query, "GRANT ALL PRIVILEGES ON *.* TO '", user, "'@'localhost' IDENTIFIED BY " "'", buff, "' WITH GRANT OPTION", NullS); - rc= mysql_query(mysql, query); + rc= mysql_query(conn, query); myquery(rc); - rc= mysql_query(mysql, "FLUSH PRIVILEGES"); + rc= mysql_query(conn, "FLUSH PRIVILEGES"); myquery(rc); - rc= mysql_change_user(mysql, user, buff, db); + rc= mysql_change_user(conn, user, buff, db); DIE_UNLESS(!rc); user[USERNAME_CHAR_LENGTH-1]= 'a'; - rc= mysql_change_user(mysql, user, buff, db); + rc= mysql_change_user(conn, user, buff, db); DIE_UNLESS(rc); user[USERNAME_CHAR_LENGTH-1]= 'b'; buff[LARGE_BUFFER_SIZE-1]= 'd'; - rc= mysql_change_user(mysql, user, buff, db); + rc= mysql_change_user(conn, user, buff, db); DIE_UNLESS(rc); buff[LARGE_BUFFER_SIZE-1]= 'c'; db[NAME_CHAR_LEN-1]= 'e'; - rc= mysql_change_user(mysql, user, buff, db); + rc= mysql_change_user(conn, user, buff, db); DIE_UNLESS(rc); + mysql_close(conn); + conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); + db[NAME_CHAR_LEN-1]= 'a'; - rc= mysql_change_user(mysql, user, buff, db); + rc= mysql_change_user(conn, user, buff, db); DIE_UNLESS(!rc); - rc= mysql_change_user(mysql, user + 1, buff + 1, db + 1); + rc= mysql_change_user(conn, user + 1, buff + 1, db + 1); DIE_UNLESS(rc); - rc = mysql_change_user(mysql, opt_user, opt_password, current_db); + rc = mysql_change_user(conn, opt_user, opt_password, current_db); DIE_UNLESS(!rc); strxmov(query, "DROP DATABASE ", db, NullS); - rc= mysql_query(mysql, query); + rc= mysql_query(conn, query); myquery(rc); strxmov(query, "DELETE FROM mysql.user WHERE User='", user, "'", NullS); - rc= mysql_query(mysql, query); + rc= mysql_query(conn, query); myquery(rc); - DIE_UNLESS(mysql_affected_rows(mysql) == 2); + DIE_UNLESS(mysql_affected_rows(conn) == 2); #endif + mysql_close(conn); + DBUG_VOID_RETURN; } From 82c022f2d54813bc0d4b77d23b714c0806b42f73 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 25 Jan 2013 00:20:53 +0100 Subject: [PATCH 332/349] report "using password: YES/NO" correctly for the COM_CHANGE_USER failures --- mysql-test/r/change_user_notembedded.result | 4 ++-- sql/sql_acl.cc | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/change_user_notembedded.result b/mysql-test/r/change_user_notembedded.result index 506a463d6d2..60579d15ec2 100644 --- a/mysql-test/r/change_user_notembedded.result +++ b/mysql-test/r/change_user_notembedded.result @@ -1,5 +1,5 @@ +ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES) ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) -ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) -ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) +ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES) ERROR 08S01: Unknown command ERROR 08S01: Unknown command diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 1005f5d8688..547572c5db6 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -7471,6 +7471,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length) } #ifndef NO_EMBEDDED_ACCESS_CHECKS + thd->password= passwd_len > 0; if (find_mpvio_user(mpvio, sctx)) return 1; From fa7d0c4fdf85c501ebb3a135d31814161e6bc9e4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 25 Jan 2013 09:41:26 +0100 Subject: [PATCH 333/349] MDEV-3909 remote user enumeration instead of returning Access denied on the incorrect user name, emulate the complete failed logic procedure, possibly with the change plugin packet. --- mysql-test/r/failed_auth_3909.result | 21 +++++++++++++ mysql-test/t/failed_auth_3909.test | 37 ++++++++++++++++++++++ sql/sql_acl.cc | 47 +++++++++++++++++++++++----- 3 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 mysql-test/r/failed_auth_3909.result create mode 100644 mysql-test/t/failed_auth_3909.test diff --git a/mysql-test/r/failed_auth_3909.result b/mysql-test/r/failed_auth_3909.result new file mode 100644 index 00000000000..36c812b6932 --- /dev/null +++ b/mysql-test/r/failed_auth_3909.result @@ -0,0 +1,21 @@ +optimize table mysql.user; +Table Op Msg_type Msg_text +mysql.user optimize status OK +insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar'); +Warnings: +Warning 1364 Field 'ssl_cipher' doesn't have a default value +Warning 1364 Field 'x509_issuer' doesn't have a default value +Warning 1364 Field 'x509_subject' doesn't have a default value +Warning 1364 Field 'auth_string' doesn't have a default value +flush privileges; +connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); +ERROR HY000: Plugin 'bar' is not loaded +connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET); +ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO) +connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET); +ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES) +ERROR HY000: Plugin 'bar' is not loaded +ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO) +ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES) +delete from mysql.user where plugin = 'bar'; +flush privileges; diff --git a/mysql-test/t/failed_auth_3909.test b/mysql-test/t/failed_auth_3909.test new file mode 100644 index 00000000000..3179794d155 --- /dev/null +++ b/mysql-test/t/failed_auth_3909.test @@ -0,0 +1,37 @@ +source include/not_embedded.inc; + +# +# MDEV-3909 remote user enumeration +# +# verify that for some failed login attemps (with wrong user names) +# the server requests a plugin +# +optimize table mysql.user; +insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar'); +flush privileges; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_PLUGIN_IS_NOT_LOADED +connect (fail,localhost,u1); + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (fail,localhost,u2); + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (fail,localhost,u2,password); + +--error ER_PLUGIN_IS_NOT_LOADED +change_user u1; + +--error ER_ACCESS_DENIED_ERROR +change_user u2; + +--error ER_ACCESS_DENIED_ERROR +change_user u2,password; + +delete from mysql.user where plugin = 'bar'; +flush privileges; + + diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 547572c5db6..29922aa5321 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -7056,6 +7056,7 @@ struct MPVIO_EXT : public MYSQL_PLUGIN_VIO } cached_server_packet; int packets_read, packets_written; ///< counters for send/received packets uint connect_errors; ///< if there were connect errors for this host + bool make_it_fail; /** when plugin returns a failure this tells us what really happened */ enum { SUCCESS, FAILURE, RESTART } status; }; @@ -7322,14 +7323,14 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio, /** Finds acl entry in user database for authentication purposes. - Finds a user and copies it into mpvio. Reports an authentication - failure if a user is not found. + Finds a user and copies it into mpvio. Creates a fake user + if no matching user account is found. @note find_acl_user is not the same, because it doesn't take into account the case when user is not empty, but acl_user->user is empty @retval 0 found - @retval 1 not found + @retval 1 error */ static bool find_mpvio_user(MPVIO_EXT *mpvio, Security_context *sctx) @@ -7351,8 +7352,27 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio, Security_context *sctx) if (!mpvio->acl_user) { - login_failed_error(mpvio->thd); - return 1; + /* + A matching user was not found. Fake it. Take any user, make the + authentication fail later. + This way we get a realistically looking failure, with occasional + "change auth plugin" requests even for nonexistent users. The ratio + of "change auth plugin" request will be the same for real and + nonexistent users. + Note, that we cannot pick any user at random, it must always be + the same user account for the incoming sctx->user name. + */ + ulong nr1=1, nr2=4; + CHARSET_INFO *cs= &my_charset_latin1; + cs->coll->hash_sort(cs, (uchar*) sctx->user, strlen(sctx->user), &nr1, &nr2); + + pthread_mutex_lock(&acl_cache->lock); + uint i= nr1 % acl_users.elements; + ACL_USER *acl_user_tmp= dynamic_element(&acl_users, i, ACL_USER*); + mpvio->acl_user= acl_user_tmp->copy(mpvio->thd->mem_root); + pthread_mutex_unlock(&acl_cache->lock); + + mpvio->make_it_fail= true; } /* user account requires non-default plugin and the client is too old */ @@ -7763,8 +7783,8 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio, mpvio->cached_server_packet.pkt_len)) return packet_error; - passwd_len= my_net_read(&mpvio->thd->net); - passwd = (char*)mpvio->thd->net.read_pos; + passwd_len= my_net_read(&thd->net); + passwd= (char*)thd->net.read_pos; } *buff= (uchar*)passwd; @@ -7868,6 +7888,10 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf) *buf= (uchar*)mpvio->cached_client_reply.pkt; mpvio->cached_client_reply.pkt= 0; mpvio->packets_read++; + + if (mpvio->make_it_fail) + goto err; + return (int)mpvio->cached_client_reply.pkt_len; } /* @@ -7901,13 +7925,19 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf) else *buf = mpvio->thd->net.read_pos; + if (mpvio->make_it_fail) + goto err; + return (int)pkt_len; err: if (mpvio->status == MPVIO_EXT::FAILURE && !mpvio->thd->is_error()) { inc_host_errors(&mpvio->thd->net.vio->remote.sin_addr); - my_error(ER_HANDSHAKE_ERROR, MYF(0)); + if (mpvio->make_it_fail) + login_failed_error(mpvio->thd); + else + my_error(ER_HANDSHAKE_ERROR, MYF(0)); } return -1; } @@ -8116,6 +8146,7 @@ bool acl_authenticate(THD *thd, uint connect_errors, mpvio.thd= thd; mpvio.connect_errors= connect_errors; mpvio.status= MPVIO_EXT::FAILURE; + mpvio.make_it_fail= false; if (command == COM_CHANGE_USER) { From 9142c50b0751c1ee964b9b56ef2378fc2bef202c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 25 Jan 2013 10:19:35 +0100 Subject: [PATCH 334/349] MDEV-4040 Replace deprecated SET OPTION syntax in mysqldump mysqldump.c: s/SET OPTION/SET/ (OPTION was, hm, optional since 3.21, so there's no need to use SET OPTION even in the old compatibility modes) --- client/mysqldump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 3653cc93eeb..80af5185ecc 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2513,7 +2513,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, verbose_msg("-- Retrieving table structure for table %s...\n", table); len= my_snprintf(query_buff, sizeof(query_buff), - "SET OPTION SQL_QUOTE_SHOW_CREATE=%d", + "SET SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords)); if (!create_options) strmov(query_buff+len, @@ -5068,7 +5068,7 @@ static my_bool get_view_structure(char *table, char* db) verbose_msg("-- Retrieving view structure for table %s...\n", table); #ifdef NOT_REALLY_USED_YET - sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", + sprintf(insert_pat,"SET SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords)); #endif From 326d2d56fe74c5affdcf7c6459c93c3b1dc37dd1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 25 Jan 2013 12:26:35 +0100 Subject: [PATCH 335/349] MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1)) check item->null_value before using the result of item->val_int() --- mysql-test/r/func_str.result | 18 ++++++++++++++++++ mysql-test/t/func_str.test | 11 +++++++++++ sql/item_strfunc.cc | 20 ++++++++++++++------ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 8f4038e1239..aef452b7b50 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -2628,4 +2628,22 @@ SELECT * FROM t1; a aaaaaaaaaaaaaa DROP TABLE t1; +SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1))); +SUBSTRING('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT LEFT('1', DAY(FROM_UNIXTIME(-1))); +LEFT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1))); +RIGHT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1))); +REPEAT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?') +NULL +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?') +NULL End of 5.1 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 92c4bae5327..9909974d3be 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1380,4 +1380,15 @@ LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1; SELECT * FROM t1; DROP TABLE t1; +# +# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1)) +# +SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1))); +SELECT LEFT('1', DAY(FROM_UNIXTIME(-1))); +SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1))); +SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1))); +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); + + --echo End of 5.1 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4225687724f..9cc77849094 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1167,7 +1167,7 @@ void Item_str_func::left_right_max_length() if (args[1]->const_item()) { int length=(int) args[1]->val_int()*collation.collation->mbmaxlen; - if (length <= 0) + if (args[1]->null_value || length <= 0) max_length=0; else set_if_smaller(max_length,(uint) length); @@ -1270,7 +1270,9 @@ void Item_func_substr::fix_length_and_dec() if (args[1]->const_item()) { int32 start= (int32) args[1]->val_int(); - if (start < 0) + if (args[1]->null_value) + max_length= 0; + else if (start < 0) max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start); else max_length-= min((uint)(start - 1), max_length); @@ -1278,7 +1280,7 @@ void Item_func_substr::fix_length_and_dec() if (arg_count == 3 && args[2]->const_item()) { int32 length= (int32) args[2]->val_int(); - if (length <= 0) + if (args[2]->null_value || length <= 0) max_length=0; /* purecov: inspected */ else set_if_smaller(max_length,(uint) length); @@ -2411,7 +2413,9 @@ void Item_func_repeat::fix_length_and_dec() /* Assumes that the maximum length of a String is < INT_MAX32. */ /* Set here so that rest of code sees out-of-bound value as such. */ - if (count > INT_MAX32) + if (args[1]->null_value) + count= 0; + else if (count > INT_MAX32) count= INT_MAX32; ulonglong max_result_length= (ulonglong) args[0]->max_length * count; @@ -2499,7 +2503,9 @@ void Item_func_rpad::fix_length_and_dec() /* Assumes that the maximum length of a String is < INT_MAX32. */ /* Set here so that rest of code sees out-of-bound value as such. */ - if (temp > INT_MAX32) + if (args[1]->null_value) + temp= 0; + else if (temp > INT_MAX32) temp = INT_MAX32; length= temp * collation.collation->mbmaxlen; @@ -2616,7 +2622,9 @@ void Item_func_lpad::fix_length_and_dec() /* Assumes that the maximum length of a String is < INT_MAX32. */ /* Set here so that rest of code sees out-of-bound value as such. */ - if (temp > INT_MAX32) + if (args[1]->null_value) + temp= 0; + else if (temp > INT_MAX32) temp= INT_MAX32; length= temp * collation.collation->mbmaxlen; From 7f208d3c356e559d3be15f161df8a0adbfa2dd1c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 25 Jan 2013 14:29:46 +0100 Subject: [PATCH 336/349] MDEV-729 lp:998028 - Server crashes on normal shutdown in closefrm after executing a query from MyISAM table don't write a key value into the record buffer - a key length can be larger then the record length. --- mysql-test/r/group_min_max.result | 7 +++++++ mysql-test/t/group_min_max.test | 8 ++++++++ sql/opt_range.cc | 8 +++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 6fef66b9d93..feb06ac4d7a 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2780,4 +2780,11 @@ ORDER BY min_a; min_a NULL DROP TABLE t1; +create table t1 (a int, b varchar(1), key(b,a)) engine=myisam; +insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i'); +select min(a), b from t1 where a=7 or b='z' group by b; +min(a) b +7 g +flush tables; +drop table t1; End of 5.1 tests diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 8ab7e1c9cb4..4b5e8e82e54 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1099,5 +1099,13 @@ ORDER BY min_a; DROP TABLE t1; +# +# MDEV-729 lp:998028 - Server crashes on normal shutdown in closefrm after executing a query from MyISAM table +# +create table t1 (a int, b varchar(1), key(b,a)) engine=myisam; +insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i'); +select min(a), b from t1 where a=7 or b='z' group by b; +flush tables; +drop table t1; --echo End of 5.1 tests diff --git a/sql/opt_range.cc b/sql/opt_range.cc index a42a03f4c86..14c2eeddb9f 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -10815,9 +10815,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min() */ if (min_max_arg_part && min_max_arg_part->field->is_null()) { + uchar *tmp_key_buff= (uchar*)my_alloca(index_info->key_length); /* Find the first subsequent record without NULL in the MIN/MAX field. */ - key_copy(tmp_record, record, index_info, 0); - result= file->index_read_map(record, tmp_record, + key_copy(tmp_key_buff, record, index_info, 0); + result= file->index_read_map(record, tmp_key_buff, make_keypart_map(real_key_parts), HA_READ_AFTER_KEY); /* @@ -10833,10 +10834,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min() if (!result) { if (key_cmp(index_info->key_part, group_prefix, real_prefix_len)) - key_restore(record, tmp_record, index_info, 0); + key_restore(record, tmp_key_buff, index_info, 0); } else if (result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE) result= 0; /* There is a result in any case. */ + my_afree(tmp_key_buff); } } From 298008dc4fbf4c5cc98d86115218bf89611ff7ea Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 25 Jan 2013 16:56:57 +0200 Subject: [PATCH 337/349] The problem was that expression with field after transformation (on the first execution) reached by fix_fields() (via reference) before row which it belongs to (on the second execution) and fix_field for row did not follow usual protocol for Items with argument (first check that the item fixed then call fix_fields). Item_row::fix_field fixed. --- mysql-test/r/subselect_sj.result | 15 +++++++++++++++ mysql-test/r/subselect_sj_jcl6.result | 15 +++++++++++++++ mysql-test/t/subselect_sj.test | 20 ++++++++++++++++++++ sql/item_row.cc | 3 ++- 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index ad2d5f760e8..01ad6f9712f 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -2757,4 +2757,19 @@ GROUP BY b HAVING t1sum <> 1; t1sum b DROP TABLE t1, t2; +# +# MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields +# on 2nd execution of PS with semijoin=on and IN subquery +# +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0,4),(8,6); +CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7,1),(0,7); +PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) '; +execute stmt; +a b +execute stmt; +a b +deallocate prepare stmt; +drop table t1,t2; set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 6247688d635..cf45162284c 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2771,6 +2771,21 @@ GROUP BY b HAVING t1sum <> 1; t1sum b DROP TABLE t1, t2; +# +# MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields +# on 2nd execution of PS with semijoin=on and IN subquery +# +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0,4),(8,6); +CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7,1),(0,7); +PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) '; +execute stmt; +a b +execute stmt; +a b +deallocate prepare stmt; +drop table t1,t2; set optimizer_switch=@subselect_sj_tmp; # # BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index 2facb089718..650c9d73893 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2462,5 +2462,25 @@ HAVING t1sum <> 1; DROP TABLE t1, t2; +--echo # +--echo # MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields +--echo # on 2nd execution of PS with semijoin=on and IN subquery +--echo # + +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0,4),(8,6); + +CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (7,1),(0,7); + +eval PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) '; + +execute stmt; +execute stmt; + +deallocate prepare stmt; +drop table t1,t2; + + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; diff --git a/sql/item_row.cc b/sql/item_row.cc index 72bae6f0900..d9d3e359338 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -68,7 +68,8 @@ bool Item_row::fix_fields(THD *thd, Item **ref) Item **arg, **arg_end; for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++) { - if ((*arg)->fix_fields(thd, arg)) + if (!(*arg)->fixed && + (*arg)->fix_fields(thd, arg)) return TRUE; // we can't assign 'item' before, because fix_fields() can change arg Item *item= *arg; From 8864940583fa7e5717ccfbfcdc95d4ded8b40e1e Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 25 Jan 2013 16:50:14 +0100 Subject: [PATCH 338/349] MDEV-3971 : problems installing MariaDB packages (conflicts with mysql-libs-5.5) FIx : make "shared" RPM obsolete/provide mysql-libs --- cmake/cpack_rpm.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index f5ff7ab0fae..8ef9d9e178a 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -107,8 +107,8 @@ SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh) SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh) -SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared") -SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.18 libmysqlclient.so.18(libmysqlclient_16) libmysqlclient.so.18(libmysqlclient_18) libmysqlclient_r.so.18 libmysqlclient_r.so.18(libmysqlclient_18)") +SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared mysql-libs") +SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.18 libmysqlclient.so.18(libmysqlclient_16) libmysqlclient.so.18(libmysqlclient_18) libmysqlclient_r.so.18 libmysqlclient_r.so.18(libmysqlclient_18) mysql-libs") SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) From 76400fcc258c1895dcaed4c4c3ebbdc340d7a62a Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 25 Jan 2013 17:26:10 +0100 Subject: [PATCH 339/349] MDEV-3842, MDEV-3923 : Miscellaneous workarounds for drop-in compatibility problems with Linux distributions, arounf versioning of the MySQL 5.5 client shared library. There seems to be 3 different ways major distributions handle versioning 1. Fedora (also Mageia, and likely other Redhat descendants) way old, 5.1 API functions are given version libmysqlclient_16 new API functions (client plugins, mysql_stmt_next ) are given version libmysqlclient_18 some extra functions beyond API are exported. some functions are renamed. 2.Debian Wheezy way all functions are given libmysqlclient_18 version 3. Ubuntu way (or MySQL/MariaDB download packages) no versioning UIp to this fix, MariaDB distributions did not have any versioning in the libraries, this rendered client library incompatible to distributions thus exchanging distribution's libmysqlclient.so.18.0.0 with MariaDB's did not work nicely (anywhere but on Ubuntu) THE FIX is to build libraries the same way as distributions do it - when building RPMs, use same version script as Fedora does, Make sure to export extra-symbols, the same as Fedora exports. - when building DEBs, use the same version script as Debian Wheezy - do not use version scripts otherwise Also, makes sure that extensions of MySQL APIs (asynchronous client functionality) is exported by the shared libraries. --- libmysql/CMakeLists.txt | 168 +++++++++++++++++++++++++++++-- libmysql/libmysql_rpm_version.in | 48 +++++++++ libmysql/rpm_support.cc | 41 ++++++++ libmysqld/CMakeLists.txt | 13 ++- 4 files changed, 262 insertions(+), 8 deletions(-) create mode 100644 libmysql/libmysql_rpm_version.in create mode 100644 libmysql/rpm_support.cc diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index f67b3962c1a..72fee72af77 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -23,7 +23,7 @@ INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR}) ADD_DEFINITIONS(${SSL_DEFINES}) -SET(CLIENT_API_FUNCTIONS +SET(CLIENT_API_FUNCTIONS_5_1 get_tty_password handle_options load_defaults @@ -58,6 +58,7 @@ mysql_field_count mysql_field_seek mysql_field_tell mysql_free_result +mysql_get_parameters mysql_get_client_info mysql_get_host_info mysql_get_proto_info @@ -129,12 +130,164 @@ mysql_server_init mysql_server_end mysql_set_character_set mysql_get_character_set_info -mysql_stmt_next_result - -CACHE INTERNAL "Functions exported by client API" - ) +SET(CLIENT_API_FUNCTIONS_5_5 +mysql_stmt_next_result +# Client plugins +mysql_client_find_plugin +mysql_client_register_plugin +mysql_load_plugin +mysql_load_plugin_v +mysql_plugin_options +# Async API +mysql_autocommit_cont +mysql_autocommit_start +mysql_change_user_cont +mysql_change_user_start +mysql_close_cont +mysql_close_slow_part_cont +mysql_close_slow_part_start +mysql_close_start +mysql_commit_cont +mysql_commit_start +mysql_fetch_row_cont +mysql_fetch_row_start +mysql_free_result_cont +mysql_free_result_start +mysql_kill_cont +mysql_kill_start +mysql_list_dbs_cont +mysql_list_dbs_start +mysql_list_fields_cont +mysql_list_fields_start +mysql_list_processes_cont +mysql_list_processes_start +mysql_list_tables_cont +mysql_list_tables_start +mysql_next_result_cont +mysql_next_result_start +mysql_ping_cont +mysql_ping_start +mysql_query_cont +mysql_query_start +mysql_read_query_result_cont +mysql_read_query_result_start +mysql_real_connect_cont +mysql_real_connect_start +mysql_real_query_cont +mysql_real_query_start +mysql_refresh_cont +mysql_refresh_start +mysql_rollback_cont +mysql_rollback_start +mysql_select_db_cont +mysql_select_db_start +mysql_send_query_cont +mysql_send_query_start +mysql_set_character_set_cont +mysql_set_character_set_start +mysql_set_server_option_cont +mysql_set_server_option_start +mysql_shutdown_cont +mysql_shutdown_start +mysql_stat_cont +mysql_stat_start +mysql_stmt_close_cont +mysql_stmt_close_start +mysql_stmt_execute_cont +mysql_stmt_execute_start +mysql_stmt_fetch_cont +mysql_stmt_fetch_start +mysql_stmt_free_result_cont +mysql_stmt_free_result_start +mysql_stmt_next_result_cont +mysql_stmt_next_result_start +mysql_stmt_prepare_cont +mysql_stmt_prepare_start +mysql_stmt_reset_cont +mysql_stmt_reset_start +mysql_stmt_send_long_data_cont +mysql_stmt_send_long_data_start +mysql_stmt_store_result_cont +mysql_stmt_store_result_start +mysql_store_result_cont +mysql_store_result_start +) + +SET(CLIENT_API_FUNCTIONS + ${CLIENT_API_FUNCTIONS_5_1} + ${CLIENT_API_FUNCTIONS_5_5} + CACHE INTERNAL + "Client functions" +) + +IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + # When building RPM, or DEB package on Debian, use ELF symbol versioning + # for compatibility with distribution packages, so client shared library can + # painlessly replace the one supplied by the distribution. + + # Also list of exported symbols in distributions may differ from what is considered + # official API. Define CLIENT_API_EXTRA for the set of symbols, that required to + # be exported on different platforms. + + IF(RPM) + # Fedora & Co declared following functions as part of API + # These functions are alias of another function (given mysql_ prefix=. The + # renaming is handled in rpm_support.cc below + SET(CLIENT_API_EXTRA + mysql_default_charset_info + mysql_get_charset + mysql_get_charset_by_csname + mysql_net_realloc + mysql_client_errors + ) + # Add special script to fix symbols renames by Fedora + SET(CLIENT_SOURCES_EXTRA ${CLIENT_SOURCES} rpm_support.cc) + SET(VERSION_SCRIPT_TEMPLATE + ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in) + ELSEIF(DEB) + # libmyodbc on Ubuntu is using functions below + # If we don't export them, linker would just remove + # them (they are not used inside libmysqlclient) + SET(CLIENT_API_EXTRA + strfill + init_dynamic_string + ) + # MySQL supplied with Ubuntu does not have versioning, bug Debian does. + IF(DEB MATCHES "debian") + SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql.ver.in) + ENDIF() + ENDIF() + + IF(VERSION_SCRIPT_TEMPLATE) + # Generate version script. + # Create semicolon separated lists of functions to export from + # Since RPM packages use separate versioning for 5.1 API + # and 5.5 API (libmysqlclient_16 vs libmysqlclient_18), + # we need 2 lists. + SET (CLIENT_API_5_1_LIST) + FOREACH (f ${CLIENT_API_FUNCTIONS_5_1}) + SET(CLIENT_API_5_1_LIST "${CLIENT_API_5_1_LIST}\n${f};") + ENDFOREACH() + + SET (CLIENT_API_5_5_LIST) + FOREACH (f ${CLIENT_API_FUNCTIONS_5_5}) + SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\n${f};") + ENDFOREACH() + + CONFIGURE_FILE( + ${VERSION_SCRIPT_TEMPLATE} + ${CMAKE_CURRENT_BINARY_DIR}/libmysql.version + @ONLY@ + ) + SET(VERSION_SCRIPT_LINK_FLAGS + "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libmysql.version") + ENDIF() + +ENDIF() + + SET(CLIENT_SOURCES get_password.c libmysql.c @@ -146,6 +299,7 @@ SET(CLIENT_SOURCES ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c + ${CLIENT_SOURCES_EXTRA} ) ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES}) DTRACE_INSTRUMENT(clientlib) @@ -193,13 +347,13 @@ IF(NOT DISABLE_SHARED) OUTPUT_NAME mysqlclient VERSION "${OS_SHARED_LIB_VERSION}" SOVERSION "${SHARED_LIB_MAJOR_VERSION}") - IF(LINK_FLAG_NO_UNDEFINED) + IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS) GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS) IF(NOT libmysql_link_flag) SET(libmysql_link_flags) ENDIF() SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS - "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED}") + "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}") ENDIF() # clean direct output needs to be set several targets have the same name #(mysqlclient in this case) diff --git a/libmysql/libmysql_rpm_version.in b/libmysql/libmysql_rpm_version.in new file mode 100644 index 00000000000..ad15c8aa2c8 --- /dev/null +++ b/libmysql/libmysql_rpm_version.in @@ -0,0 +1,48 @@ +# This version script is heavily inspired by Fedora's and Mageia's version scripts for +# MySQL client shared library. It is used in MariaDB for building RPMs. + +libmysqlclient_16 { + global: +@CLIENT_API_5_1_LIST@ + +# some stuff from Mageia, I have no idea why it is there +# But too afraid to throw anything away + _fini; + _init; + my_init; + my_progname; + myodbc_remove_escape; + +# These are documented in Paul DuBois' MySQL book, so we treat them as part +# of the de-facto API. + free_defaults; + handle_options; + load_defaults; + my_print_help; +# pure-ftpd requires this + my_make_scrambled_password; +# hydra requires this + scramble; +# DBD::mysql requires this + is_prefix; + local: + *; +}; + +libmysqlclient_18 { + global: + @CLIENT_API_5_5_LIST@ +# +# Ideally the following symbols wouldn't be exported, but various applications +# require them. We limit the namespace damage by prefixing mysql_ +# (see mysql-dubious-exports.patch), which means the symbols are not present +# in libmysqlclient_16. +# +# mysql-connector-odbc requires these + mysql_default_charset_info; + mysql_get_charset; + mysql_get_charset_by_csname; + mysql_net_realloc; +# PHP's mysqli.so requires this (via the ER() macro) + mysql_client_errors; +}; diff --git a/libmysql/rpm_support.cc b/libmysql/rpm_support.cc new file mode 100644 index 00000000000..8c9a1e8683d --- /dev/null +++ b/libmysql/rpm_support.cc @@ -0,0 +1,41 @@ +/* + Provide aliases for several symbols, to support drop-in replacement for + MariaDB on Fedora and several derives distributions. + + These distributions redefine several symbols (in a way that is no compatible + with either MySQL or MariaDB) and export it from the client library ( as seen + e.g from this patch) +http://lists.fedoraproject.org/pipermail/scm-commits/2010-December/537257.html + + MariaDB handles compatibility distribution by providing the same symbols from + the client library if it is built with -DRPM + +*/ +#include +#include +#include +extern "C" { + +CHARSET_INFO *mysql_default_charset_info = default_charset_info; + +CHARSET_INFO *mysql_get_charset(uint cs_number, myf flags) +{ + return get_charset(cs_number, flags); +} + +CHARSET_INFO *mysql_get_charset_by_csname(const char *cs_name, + uint cs_flags, myf my_flags) +{ + return get_charset_by_csname(cs_name, cs_flags, my_flags); +} + + +my_bool mysql_net_realloc(NET *net, size_t length) +{ + return net_realloc(net,length); +} + +const char **mysql_client_errors = client_errors; + +} /*extern "C" */ + diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index c40beb5f9a1..c071356715f 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -146,8 +146,19 @@ IF(UNIX) ${CMAKE_STATIC_LIBRARY_PREFIX}mysqld-debug) ENDIF() +# List of exported functions in embedded (client api except client plugin or +# async (*_start/*_cont functions) + +SET(EMBEDDED_API) +FOREACH(f ${CLIENT_API}) + IF(NOT(f MATCHES "plugin|_start$|_cont$")) + SET(EMBEDDED_API ${EMBEDDED_API) ${f}) + ENDIF() +ENDFOREACH() +MESSAGE("embedded api=${EMBEDDED_API}") + IF(NOT DISABLE_SHARED) - MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${CLIENT_API_FUNCTIONS} + MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API} COMPONENT Server) IF(UNIX) # Name the shared library, handle versioning (provides same api as client From db26ab8a3f0918f785cac5ffa89cf42a794ac8f9 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 25 Jan 2013 18:59:30 +0100 Subject: [PATCH 340/349] Fix embedded build --- libmysqld/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index c071356715f..76ed13acf40 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -150,12 +150,13 @@ ENDIF() # async (*_start/*_cont functions) SET(EMBEDDED_API) -FOREACH(f ${CLIENT_API}) + +FOREACH(f ${CLIENT_API_FUNCTIONS}) + #IF(NOT(f MATCHES "plugin") AND NOT (f MATCHES "_start$") AND NOT (f MATCHES "_cont$")) IF(NOT(f MATCHES "plugin|_start$|_cont$")) - SET(EMBEDDED_API ${EMBEDDED_API) ${f}) + SET(EMBEDDED_API ${EMBEDDED_API} ${f}) ENDIF() ENDFOREACH() -MESSAGE("embedded api=${EMBEDDED_API}") IF(NOT DISABLE_SHARED) MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API} From ea1d5943c5aa4e66fa3f36333043dc6fed0a9d60 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 25 Jan 2013 21:40:42 +0200 Subject: [PATCH 341/349] Fixed MDEV-3890: Server crash inserting record on a temporary table after truncating it The problem was that a temporary table was re-created as a non-temporary table. mysql-test/suite/maria/truncate.result: Added test cases mysql-test/suite/maria/truncate.test: Added test cases sql/sql_truncate.cc: Mark that table to be created is a temporary table storage/maria/ha_maria.cc: Ensure that temporary tables are not transactional. --- mysql-test/suite/maria/truncate.result | 12 ++++++++++++ mysql-test/suite/maria/truncate.test | 13 +++++++++++++ sql/sql_truncate.cc | 1 + storage/maria/ha_maria.cc | 3 +++ 4 files changed, 29 insertions(+) diff --git a/mysql-test/suite/maria/truncate.result b/mysql-test/suite/maria/truncate.result index 467e0f915dd..a9adcb9ae87 100644 --- a/mysql-test/suite/maria/truncate.result +++ b/mysql-test/suite/maria/truncate.result @@ -35,3 +35,15 @@ select count(*) from t1; count(*) 0 drop table t1,t2; +CREATE TEMPORARY TABLE t1 ( i int) ENGINE=aria; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +TRUNCATE TABLE t1; +INSERT INTO t1 (i) VALUES (1); +lock table t1 write; +truncate table t1; +unlock tables; +drop table t1; diff --git a/mysql-test/suite/maria/truncate.test b/mysql-test/suite/maria/truncate.test index 3d6e70d9db6..11d42dc3879 100644 --- a/mysql-test/suite/maria/truncate.test +++ b/mysql-test/suite/maria/truncate.test @@ -45,3 +45,16 @@ select * from t1; truncate t1; select count(*) from t1; drop table t1,t2; + +# +# MDEV-3890 +# Server crash inserting record on a temporary table after truncating it +# +CREATE TEMPORARY TABLE t1 ( i int) ENGINE=aria; +SHOW CREATE TABLE t1; +TRUNCATE TABLE t1; +INSERT INTO t1 (i) VALUES (1); +lock table t1 write; +truncate table t1; +unlock tables; +drop table t1; diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 979dde30ceb..4b77344c042 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -263,6 +263,7 @@ static bool recreate_temporary_table(THD *thd, TABLE *table) DBUG_ENTER("recreate_temporary_table"); memset(&create_info, 0, sizeof(create_info)); + create_info.options|= HA_LEX_CREATE_TMP_TABLE; table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 1278d951a16..31b903871ce 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -3042,7 +3042,10 @@ int ha_maria::create(const char *name, register TABLE *table_arg, ha_create_info->transactional != HA_CHOICE_NO); if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE) + { create_flags|= HA_CREATE_TMP_TABLE; + create_info.transactional= 0; + } if (ha_create_info->options & HA_CREATE_KEEP_FILES) create_flags|= HA_CREATE_KEEP_FILES; if (options & HA_OPTION_PACK_RECORD) From 8199838a49c521fa06b4d20552e9efccd4ad9559 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 25 Jan 2013 23:34:46 +0100 Subject: [PATCH 342/349] fix embedded --- libmysqld/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 76ed13acf40..6ea5c3c84bf 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -152,7 +152,6 @@ ENDIF() SET(EMBEDDED_API) FOREACH(f ${CLIENT_API_FUNCTIONS}) - #IF(NOT(f MATCHES "plugin") AND NOT (f MATCHES "_start$") AND NOT (f MATCHES "_cont$")) IF(NOT(f MATCHES "plugin|_start$|_cont$")) SET(EMBEDDED_API ${EMBEDDED_API} ${f}) ENDIF() From 0791692bdc311f39181b9df236981a2cb439638e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 26 Jan 2013 22:33:18 +0100 Subject: [PATCH 343/349] MDEV-3875 Wrong result (missing row) on a DISTINCT query with the same subquery in the SELECT list and GROUP BY fix remove_dup_with_hash_index() and remove_dup_with_compare() to take NULLs into account --- mysql-test/r/distinct.result | 32 ++++++++++++ mysql-test/t/distinct.test | 24 +++++++++ sql/field.cc | 15 ++++++ sql/field.h | 1 + sql/filesort.cc | 25 +++------- sql/sql_select.cc | 95 +++++++++++++++--------------------- 6 files changed, 120 insertions(+), 72 deletions(-) diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 99d98d2a9bc..dc3b2fb1b47 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -847,3 +847,35 @@ time(f1) 00:00:00.000200 00:00:00.000300 drop table t1; +create table t1(i int, g int); +insert into t1 values (null, 1), (0, 2); +select distinct i from t1 group by g; +i +NULL +0 +drop table t1; +create table t1(i int, g blob); +insert into t1 values (null, 1), (0, 2); +select distinct i from t1 group by g; +i +NULL +0 +drop table t1; +create table t1 (a int) engine=myisam; +insert into t1 values (0),(7); +create table t2 (b int) engine=myisam; +insert into t2 values (7),(0),(3); +create algorithm=temptable view v as +select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1; +select * from v; +field1 +NULL +0 +7 +select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1; +field1 +NULL +0 +7 +drop view v; +drop table t1, t2; diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 0f0cbcf26d0..302fb24f18c 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -658,3 +658,27 @@ select time(f1) from t1 ; select distinct time(f1) from t1 ; drop table t1; +# +# MDEV-3875 Wrong result (missing row) on a DISTINCT query with the same subquery in the SELECT list and GROUP BY +# MySQL Bug#66896 Distinct not distinguishing 0 from NULL when GROUP BY is used +# +create table t1(i int, g int); # remove_dup_with_hash_index +insert into t1 values (null, 1), (0, 2); +select distinct i from t1 group by g; +drop table t1; + +create table t1(i int, g blob); # remove_dup_with_compare +insert into t1 values (null, 1), (0, 2); +select distinct i from t1 group by g; +drop table t1; + +create table t1 (a int) engine=myisam; +insert into t1 values (0),(7); +create table t2 (b int) engine=myisam; +insert into t2 values (7),(0),(3); +create algorithm=temptable view v as +select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1; +select * from v; +select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1; +drop view v; +drop table t1, t2; diff --git a/sql/field.cc b/sql/field.cc index 9b0f6a7dfcd..fa098bef72c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1062,6 +1062,21 @@ bool Field::type_can_have_key_part(enum enum_field_types type) } +void Field::make_sort_key(uchar *buff,uint length) +{ + if (maybe_null()) + { + if (is_null()) + { + bzero(buff, length + 1); + return; + } + *buff++= 1; + } + sort_string(buff, length); +} + + /** Numeric fields base class constructor. */ diff --git a/sql/field.h b/sql/field.h index 208f1e381f5..115a9519b7b 100644 --- a/sql/field.h +++ b/sql/field.h @@ -386,6 +386,7 @@ public: return bytes; } + void make_sort_key(uchar *buff, uint length); virtual void make_field(Send_field *); virtual void sort_string(uchar *buff,uint length)=0; virtual bool optimize_range(uint idx, uint part); diff --git a/sql/filesort.cc b/sql/filesort.cc index a4d4ec1b37f..703264b7ef5 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -783,21 +783,9 @@ static void make_sortkey(register SORTPARAM *param, bool maybe_null=0; if ((field=sort_field->field)) { // Field - if (field->maybe_null()) - { - if (field->is_null()) - { - if (sort_field->reverse) - bfill(to,sort_field->length+1,(char) 255); - else - bzero((char*) to,sort_field->length+1); - to+= sort_field->length+1; - continue; - } - else - *to++=1; - } - field->sort_string(to, sort_field->length); + field->make_sort_key(to, sort_field->length); + if ((maybe_null = field->maybe_null())) + to++; } else { // Item @@ -949,8 +937,11 @@ static void make_sortkey(register SORTPARAM *param, } if (sort_field->reverse) { /* Revers key */ - if (maybe_null) - to[-1]= ~to[-1]; + if (maybe_null && (to[-1]= !to[-1])) + { + to+= sort_field->length; // don't waste the time reversing all 0's + continue; + } length=sort_field->length; while (length--) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0897aa287db..5aa8c0479cf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -204,7 +204,7 @@ static int create_sort_index(THD *thd, JOIN *join, ORDER *order, static int remove_duplicates(JOIN *join,TABLE *entry,List &fields, Item *having); static int remove_dup_with_compare(THD *thd, TABLE *entry, Field **field, - ulong offset,Item *having); + Item *having); static int remove_dup_with_hash_index(THD *thd,TABLE *table, uint field_count, Field **first_field, ulong key_length,Item *having); @@ -18891,19 +18891,24 @@ static bool fix_having(JOIN *join, Item **having) #endif -/***************************************************************************** - Remove duplicates from tmp table - This should be recoded to add a unique index to the table and remove - duplicates - Table is a locked single thread table - fields is the number of fields to check (from the end) -*****************************************************************************/ +/** + Compare fields from table->record[0] and table->record[1], + possibly skipping few first fields. + @param table + @param ptr field to start the comparison from, + somewhere in the table->field[] array + + @retval 1 different + @retval 0 identical +*/ static bool compare_record(TABLE *table, Field **ptr) { for (; *ptr ; ptr++) { - if ((*ptr)->cmp_offset(table->s->rec_buff_length)) + Field *f= *ptr; + if (f->is_null() != f->is_null(table->s->rec_buff_length) || + (!f->is_null() && f->cmp_offset(table->s->rec_buff_length))) return 1; } return 0; @@ -18931,15 +18936,15 @@ static void free_blobs(Field **ptr) static int -remove_duplicates(JOIN *join, TABLE *entry,List &fields, Item *having) +remove_duplicates(JOIN *join, TABLE *table, List &fields, Item *having) { int error; - ulong reclength,offset; + ulong keylength= 0; uint field_count; THD *thd= join->thd; DBUG_ENTER("remove_duplicates"); - entry->reginfo.lock_type=TL_WRITE; + table->reginfo.lock_type=TL_WRITE; /* Calculate how many saved fields there is in list */ field_count=0; @@ -18956,24 +18961,21 @@ remove_duplicates(JOIN *join, TABLE *entry,List &fields, Item *having) join->unit->select_limit_cnt= 1; // Only send first row DBUG_RETURN(0); } - Field **first_field=entry->field+entry->s->fields - field_count; - offset= (field_count ? - entry->field[entry->s->fields - field_count]-> - offset(entry->record[0]) : 0); - reclength=entry->s->reclength-offset; - free_io_cache(entry); // Safety - entry->file->info(HA_STATUS_VARIABLE); - if (entry->s->db_type() == heap_hton || - (!entry->s->blob_fields && - ((ALIGN_SIZE(reclength) + HASH_OVERHEAD) * entry->file->stats.records < + Field **first_field=table->field+table->s->fields - field_count; + for (Field **ptr=first_field; *ptr; ptr++) + keylength+= (*ptr)->sort_length() + (*ptr)->maybe_null(); + + free_io_cache(table); // Safety + table->file->info(HA_STATUS_VARIABLE); + if (table->s->db_type() == heap_hton || + (!table->s->blob_fields && + ((ALIGN_SIZE(keylength) + HASH_OVERHEAD) * table->file->stats.records < thd->variables.sortbuff_size))) - error=remove_dup_with_hash_index(join->thd, entry, - field_count, first_field, - reclength, having); + error=remove_dup_with_hash_index(join->thd, table, field_count, first_field, + keylength, having); else - error=remove_dup_with_compare(join->thd, entry, first_field, offset, - having); + error=remove_dup_with_compare(join->thd, table, first_field, having); free_blobs(first_field); DBUG_RETURN(error); @@ -18981,18 +18983,13 @@ remove_duplicates(JOIN *join, TABLE *entry,List &fields, Item *having) static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, - ulong offset, Item *having) + Item *having) { handler *file=table->file; - char *org_record,*new_record; - uchar *record; + uchar *record=table->record[0]; int error; - ulong reclength= table->s->reclength-offset; DBUG_ENTER("remove_dup_with_compare"); - org_record=(char*) (record=table->record[0])+offset; - new_record=(char*) table->record[1]+offset; - if (file->ha_rnd_init_with_error(1)) DBUG_RETURN(1); @@ -19029,7 +19026,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, error=0; goto err; } - memcpy(new_record,org_record,reclength); + store_record(table,record[1]); /* Read through rest of file and mark duplicated rows deleted */ bool found=0; @@ -19088,8 +19085,9 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, int error; handler *file= table->file; ulong extra_length= ALIGN_SIZE(key_length)-key_length; - uint *field_lengths,*field_length; + uint *field_lengths, *field_length; HASH hash; + Field **ptr; DBUG_ENTER("remove_dup_with_hash_index"); if (!my_multi_malloc(MYF(MY_WME), @@ -19101,21 +19099,8 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, NullS)) DBUG_RETURN(1); - { - Field **ptr; - ulong total_length= 0; - for (ptr= first_field, field_length=field_lengths ; *ptr ; ptr++) - { - uint length= (*ptr)->sort_length(); - (*field_length++)= length; - total_length+= length; - } - DBUG_PRINT("info",("field_count: %u key_length: %lu total_length: %lu", - field_count, key_length, total_length)); - DBUG_ASSERT(total_length <= key_length); - key_length= total_length; - extra_length= ALIGN_SIZE(key_length)-key_length; - } + for (ptr= first_field, field_length=field_lengths ; *ptr ; ptr++) + (*field_length++)= (*ptr)->sort_length(); if (hash_init(&hash, &my_charset_bin, (uint) file->stats.records, 0, key_length, (hash_get_key) 0, 0, 0)) @@ -19155,13 +19140,13 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, /* copy fields to key buffer */ org_key_pos= key_pos; field_length=field_lengths; - for (Field **ptr= first_field ; *ptr ; ptr++) + for (ptr= first_field ; *ptr ; ptr++) { - (*ptr)->sort_string(key_pos,*field_length); - key_pos+= *field_length++; + (*ptr)->make_sort_key(key_pos, *field_length); + key_pos+= (*ptr)->maybe_null() + *field_length++; } /* Check if it exists before */ - if (hash_search(&hash, org_key_pos, key_length)) + if (my_hash_search(&hash, org_key_pos, key_length)) { /* Duplicated found ; Remove the row */ if ((error= file->ha_delete_row(record))) From 5138bf4238d4a8850ee364a3adf10dc2687af67c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 28 Jan 2013 09:10:01 +0100 Subject: [PATCH 344/349] compilation error with -Wuninitialized -Werror --- sql/sql_insert.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f9179843810..53948f11923 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2084,7 +2084,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) { my_ptrdiff_t adjust_ptrs; Field **field,**org_field, *found_next_number_field; - Field **vfield; + Field **UNINIT_VAR(vfield); TABLE *copy; TABLE_SHARE *share; uchar *bitmap; From f08a404a6d87f7c8c7fef1862eaf768cf920677b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Jan 2013 13:49:14 +0200 Subject: [PATCH 345/349] MDEV-4091: Dynamic columns C functions should be included in libmysqlclient --- libmysql/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 72fee72af77..5ad6b197379 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -213,6 +213,16 @@ mysql_stmt_store_result_cont mysql_stmt_store_result_start mysql_store_result_cont mysql_store_result_start +#dynamic columns api +dynamic_column_create +dynamic_column_create_many +dynamic_column_update +dynamic_column_update_many +dynamic_column_delete +dynamic_column_exists +dynamic_column_list +dynamic_column_get +dynamic_column_prepare_decimal ) SET(CLIENT_API_FUNCTIONS From f65e5841d7c6ff0e7470d01fab27fd6b42c64c9f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Jan 2013 15:13:39 +0200 Subject: [PATCH 346/349] Fix for MDEV-3948, and backport of the following collection of fixes and backports from MariaDB 10.0. The bug in mdev-3948 was an instance of the problem fixed by Sergey's patch in 10.0 - namely that the range optimizer could change table->[read | write]_set, and not restore it. revno: 3471 committer: Sergey Petrunya branch nick: 10.0-serg-fix-imerge timestamp: Sat 2012-11-03 12:24:36 +0400 message: # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions Reconcile the fixes from: # # guilhem.bichot@oracle.com-20110805143029-ywrzuz15uzgontr0 # Fix for BUG#12698916 - "JOIN QUERY GIVES WRONG RESULT AT 2ND EXEC. OR # AFTER FLUSH TABLES [-INT VS NULL]" # # guilhem.bichot@oracle.com-20111209150650-tzx3ldzxe1yfwji6 # Fix for BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == SAVE_READ_SET # and # and related fixes from: BUG#1006164, MDEV-376: Now, ROR-merged QUICK_RANGE_SELECT objects make no assumptions about the values of table->read_set and table->write_set. Each QUICK_ROR_SELECT has (and had before) its own column bitmap, but now, all QUICK_ROR_SELECT's functions that care: reset(), init_ror_merged_scan(), and get_next() will set table->read_set when invoked and restore it back to what it was before the call before they return. This allows to avoid the mess when somebody else modifies table->read_set for some reason. --- mysql-test/r/innodb_mrr_cpk.result | 22 +++++++++++ mysql-test/r/partition_innodb.result | 20 ++++++++++ mysql-test/r/range.result | 46 +++++++++++++++++++++++ mysql-test/r/range_mrr_icp.result | 46 +++++++++++++++++++++++ mysql-test/r/update.result | 42 +++++++++++++++++++++ mysql-test/t/innodb_mrr_cpk.test | 26 +++++++++++++ mysql-test/t/partition_innodb.test | 15 ++++++++ mysql-test/t/range.test | 55 ++++++++++++++++++++++++++++ mysql-test/t/update.test | 41 +++++++++++++++++++++ sql/opt_range.cc | 44 ++++++++++++++++------ sql/opt_range.h | 2 +- sql/sql_update.cc | 14 +++++-- 12 files changed, 357 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/innodb_mrr_cpk.result b/mysql-test/r/innodb_mrr_cpk.result index 90f59b96e61..15ef32447a8 100644 --- a/mysql-test/r/innodb_mrr_cpk.result +++ b/mysql-test/r/innodb_mrr_cpk.result @@ -149,3 +149,25 @@ set @@join_cache_level= @save_join_cache_level; set storage_engine=@save_storage_engine; set optimizer_switch=@innodb_mrr_cpk_tmp; drop table t0; +# +# MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions +# +set @tmp_mdev3817=@@optimizer_switch; +SET optimizer_switch='index_merge=on,index_merge_intersection=on'; +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b INT, +c VARCHAR(1024) CHARACTER SET utf8, +d INT, +KEY (b) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14); +CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,9), (2,6) ; +SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e ); +a b c d e g +1 9 one 11 1 9 +2 6 two 12 2 6 +DROP TABLE t1, t2; +set optimizer_switch=@tmp_mdev3817; diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index dd403f64b5c..a706ae2c671 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -574,4 +574,24 @@ a b 1 2 0 1 DROP TABLE t1; +# +# BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == +# SAVE_READ_SET +# +CREATE TABLE t1 ( +a INT, +b INT, +c INT, +PRIMARY KEY (c,a), KEY (a),KEY (a) +) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2; +INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1); +UPDATE t1 SET b = 0, c=1 WHERE a <=>0; +SELECT * FROM t1; +a b c +1 5 1 +2 4 1 +3 3 1 +4 2 1 +5 1 1 +DROP TABLE t1; set global default_storage_engine=default; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 3b7d07d525e..146d250d687 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1953,3 +1953,49 @@ a b c d 14 1 1 q 9 7 1 s DROP TABLE t1; +# +# BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET == +# SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606 +# +CREATE TABLE t1 ( +f1 INT AUTO_INCREMENT, +f2 INT, +f3 INT, +f4 INT, +PRIMARY KEY (f1),KEY(f2) +) ENGINE=INNODB; +CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103; +INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0), +(NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157); +SELECT * FROM v2; +f1 f2 f3 f4 +UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1; +SELECT * FROM v2; +f1 f2 f3 f4 +DROP TABLE t1; +DROP VIEW v2; +CREATE TABLE t1 ( +f1 INT AUTO_INCREMENT, +f2 INT, +f3 INT, +f4 INT, +PRIMARY KEY (f1),KEY(f2) +) ENGINE=INNODB; +INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18), +(10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3); +CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ; +SELECT * FROM v3; +f1 f2 f3 f4 +1 NULL NULL 0 +2 2 0 3 +9 0 107 18 +10 0 0 0 +UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1; +SELECT * FROM v3; +f1 f2 f3 f4 +1 NULL NULL 0 +2 2 0 3 +9 0 107 18 +10 0 0 0 +DROP TABLE t1; +DROP VIEW v3; diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 354a4758e7c..3769ceb9145 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -1955,4 +1955,50 @@ a b c d 9 7 1 s 14 1 1 q DROP TABLE t1; +# +# BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET == +# SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606 +# +CREATE TABLE t1 ( +f1 INT AUTO_INCREMENT, +f2 INT, +f3 INT, +f4 INT, +PRIMARY KEY (f1),KEY(f2) +) ENGINE=INNODB; +CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103; +INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0), +(NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157); +SELECT * FROM v2; +f1 f2 f3 f4 +UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1; +SELECT * FROM v2; +f1 f2 f3 f4 +DROP TABLE t1; +DROP VIEW v2; +CREATE TABLE t1 ( +f1 INT AUTO_INCREMENT, +f2 INT, +f3 INT, +f4 INT, +PRIMARY KEY (f1),KEY(f2) +) ENGINE=INNODB; +INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18), +(10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3); +CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ; +SELECT * FROM v3; +f1 f2 f3 f4 +1 NULL NULL 0 +2 2 0 3 +9 0 107 18 +10 0 0 0 +UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1; +SELECT * FROM v3; +f1 f2 f3 f4 +1 NULL NULL 0 +2 2 0 3 +9 0 107 18 +10 0 0 0 +DROP TABLE t1; +DROP VIEW v3; set optimizer_switch=@mrr_icp_extra_tmp; diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 427374fd995..3f3a3ac07df 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -561,3 +561,45 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function DROP VIEW v1; DROP FUNCTION f1; DROP TABLE t1; +# +# Verify that UPDATE does the same number of handler_update +# operations, no matter if there is ORDER BY or not. +# +CREATE TABLE t1 (i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), +(20),(21),(22),(23),(24),(25),(26),(27),(28),(29), +(30),(31),(32),(33),(34),(35); +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), +INDEX idx (a,b(1),c)) ENGINE=INNODB; +INSERT INTO t2 SELECT i, i, i, i FROM t1; +FLUSH STATUS; +START TRANSACTION; +UPDATE t2 SET d = 10 WHERE b = 10 LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +Variable_name Value +Handler_update 1 +ROLLBACK; +FLUSH STATUS; +START TRANSACTION; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +Variable_name Value +Handler_update 1 +ROLLBACK; +Same test with a different UPDATE. +ALTER TABLE t2 DROP INDEX idx, ADD INDEX idx2 (a, b); +FLUSH STATUS; +START TRANSACTION; +UPDATE t2 SET c = 10 LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +Variable_name Value +Handler_update 5 +ROLLBACK; +FLUSH STATUS; +START TRANSACTION; +UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +Variable_name Value +Handler_update 5 +ROLLBACK; +DROP TABLE t1, t2; diff --git a/mysql-test/t/innodb_mrr_cpk.test b/mysql-test/t/innodb_mrr_cpk.test index a157ddd792f..a7b2d9c0ddd 100644 --- a/mysql-test/t/innodb_mrr_cpk.test +++ b/mysql-test/t/innodb_mrr_cpk.test @@ -139,3 +139,29 @@ set storage_engine=@save_storage_engine; set optimizer_switch=@innodb_mrr_cpk_tmp; drop table t0; +--echo # +--echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions +--echo # + +set @tmp_mdev3817=@@optimizer_switch; +SET optimizer_switch='index_merge=on,index_merge_intersection=on'; + +CREATE TABLE t1 ( + a INT PRIMARY KEY, + b INT, + c VARCHAR(1024) CHARACTER SET utf8, + d INT, + KEY (b) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14); + +CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,9), (2,6) ; + +SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e ); + +DROP TABLE t1, t2; +set optimizer_switch=@tmp_mdev3817; + diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 2756f7d1ebb..3aa78e74828 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -663,4 +663,19 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; +--echo # +--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == +--echo # SAVE_READ_SET +--echo # +CREATE TABLE t1 ( + a INT, + b INT, + c INT, + PRIMARY KEY (c,a), KEY (a),KEY (a) +) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2; +INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1); +UPDATE t1 SET b = 0, c=1 WHERE a <=>0; +SELECT * FROM t1; +DROP TABLE t1; + set global default_storage_engine=default; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 6ac883ffcc1..a5ff9cc0096 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1,6 +1,7 @@ # # Problem with range optimizer # +--source include/have_innodb.inc --disable_warnings drop table if exists t1, t2, t3, t10, t100; @@ -1549,3 +1550,57 @@ SELECT * FROM t1 ignore index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's' SELECT * FROM t1 force index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( b = 102 )); DROP TABLE t1; + +--disable_parsing +# MariaDB: Moved the following to partition.test +--echo # +--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == +--echo # SAVE_READ_SET +--echo # +CREATE TABLE t1 ( + a INT, + b INT, + c INT, + PRIMARY KEY (c,a), KEY (a),KEY (a) +) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2; +INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1); +UPDATE t1 SET b = 0, c=1 WHERE a <=>0; +SELECT * FROM t1; +DROP TABLE t1; +--enable_parsing + +--echo # +--echo # BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET == +--echo # SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606 +--echo # +CREATE TABLE t1 ( + f1 INT AUTO_INCREMENT, + f2 INT, + f3 INT, + f4 INT, + PRIMARY KEY (f1),KEY(f2) +) ENGINE=INNODB; +CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103; +INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0), + (NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157); +SELECT * FROM v2; +UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1; +SELECT * FROM v2; +DROP TABLE t1; +DROP VIEW v2; + +CREATE TABLE t1 ( + f1 INT AUTO_INCREMENT, + f2 INT, + f3 INT, + f4 INT, + PRIMARY KEY (f1),KEY(f2) +) ENGINE=INNODB; +INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18), + (10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3); +CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ; +SELECT * FROM v3; +UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1; +SELECT * FROM v3; +DROP TABLE t1; +DROP VIEW v3; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index c515f8873d8..daa20509ab6 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -2,6 +2,8 @@ # test of updating of keys # +-- source include/have_innodb.inc + --disable_warnings drop table if exists t1,t2; --enable_warnings @@ -503,3 +505,42 @@ UPDATE v1 SET pk = 7 WHERE pk > 0; DROP VIEW v1; DROP FUNCTION f1; DROP TABLE t1; + +--echo # +--echo # Verify that UPDATE does the same number of handler_update +--echo # operations, no matter if there is ORDER BY or not. +--echo # + +CREATE TABLE t1 (i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), + (20),(21),(22),(23),(24),(25),(26),(27),(28),(29), + (30),(31),(32),(33),(34),(35); +CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), + INDEX idx (a,b(1),c)) ENGINE=INNODB; +INSERT INTO t2 SELECT i, i, i, i FROM t1; +FLUSH STATUS; # FLUSH is autocommit, so we put it outside of transaction +START TRANSACTION; +UPDATE t2 SET d = 10 WHERE b = 10 LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +ROLLBACK; +FLUSH STATUS; +START TRANSACTION; +UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +ROLLBACK; + +--echo Same test with a different UPDATE. + +ALTER TABLE t2 DROP INDEX idx, ADD INDEX idx2 (a, b); +FLUSH STATUS; +START TRANSACTION; +UPDATE t2 SET c = 10 LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +ROLLBACK; +FLUSH STATUS; +START TRANSACTION; +UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; +SHOW STATUS LIKE 'HANDLER_UPDATE'; +ROLLBACK; +DROP TABLE t1, t2; + diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 8f094c47f67..cb25ca7760e 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1789,8 +1789,6 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr, bzero((char*) &alloc,sizeof(alloc)); file= head->file; record= head->record[0]; - save_read_set= head->read_set; - save_write_set= head->write_set; /* Allocate a bitmap for used columns (Q: why not on MEM_ROOT?) */ if (!(bitmap= (my_bitmap_map*) my_malloc(head->s->column_bitmap_size, @@ -1860,7 +1858,6 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() free_root(&alloc,MYF(0)); my_free(column_bitmap.bitmap); } - head->column_bitmaps_set(save_read_set, save_write_set); my_free(mrr_buf_desc); DBUG_VOID_RETURN; } @@ -2004,6 +2001,8 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) handler *save_file= file, *org_file; my_bool org_key_read; THD *thd= head->in_use; + MY_BITMAP * const save_read_set= head->read_set; + MY_BITMAP * const save_write_set= head->write_set; DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan"); in_ror_merged_scan= 1; @@ -2054,6 +2053,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) last_rowid= file->ref; end: + DBUG_ASSERT(head->read_set == &column_bitmap); /* We are only going to read key fields and call position() on 'file' The following sets head->tmp_set to only use this key and then updates @@ -2067,7 +2067,8 @@ end: if (!head->no_keyread) { doing_key_read= 1; - head->mark_columns_used_by_index(index); + head->mark_columns_used_by_index_no_reset(index, head->read_set); + head->enable_keyread(); } head->prepare_for_position(); @@ -2089,8 +2090,9 @@ end: head->file= org_file; head->key_read= org_key_read; - bitmap_copy(&column_bitmap, head->read_set); - head->column_bitmaps_set(&column_bitmap, &column_bitmap); + + /* Restore head->read_set (and write_set) to what they had before the call */ + head->column_bitmaps_set(save_read_set, save_write_set); if (reset()) { @@ -2148,9 +2150,19 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler) while ((cur= quick_it++)) { quick= cur->quick; +#ifndef DBUG_OFF + const MY_BITMAP * const save_read_set= quick->head->read_set; + const MY_BITMAP * const save_write_set= quick->head->write_set; +#endif if (quick->init_ror_merged_scan(FALSE)) DBUG_RETURN(1); quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS); + + // Sets are shared by all members of "quick_selects" so must not change +#ifndef DBUG_OFF + DBUG_ASSERT(quick->head->read_set == save_read_set); + DBUG_ASSERT(quick->head->write_set == save_write_set); +#endif /* All merged scans share the same record buffer in intersection. */ quick->record= head->record[0]; } @@ -10978,9 +10990,15 @@ int QUICK_RANGE_SELECT::reset() uchar *mrange_buff; int error; HANDLER_BUFFER empty_buf; + MY_BITMAP * const save_read_set= head->read_set; + MY_BITMAP * const save_write_set= head->write_set; DBUG_ENTER("QUICK_RANGE_SELECT::reset"); last_range= NULL; cur_range= (QUICK_RANGE**) ranges.buffer; + RANGE_SEQ_IF seq_funcs= {NULL, quick_range_seq_init, quick_range_seq_next, 0, 0}; + + if (in_ror_merged_scan) + head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap); if (file->inited == handler::RND) { @@ -10991,15 +11009,12 @@ int QUICK_RANGE_SELECT::reset() if (file->inited == handler::NONE) { - if (in_ror_merged_scan) - head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap); - DBUG_EXECUTE_IF("bug14365043_2", DBUG_SET("+d,ha_index_init_fail");); if ((error= file->ha_index_init(index,1))) { file->print_error(error, MYF(0)); - DBUG_RETURN(error); + goto err; } } @@ -11035,10 +11050,14 @@ int QUICK_RANGE_SELECT::reset() if (!mrr_buf_desc) empty_buf.buffer= empty_buf.buffer_end= empty_buf.end_of_used_area= NULL; - RANGE_SEQ_IF seq_funcs= {NULL, quick_range_seq_init, quick_range_seq_next, 0, 0}; error= file->multi_range_read_init(&seq_funcs, (void*)this, ranges.elements, mrr_flags, mrr_buf_desc? mrr_buf_desc: &empty_buf); +err: + /* Restore bitmaps set on entry */ + if (in_ror_merged_scan) + head->column_bitmaps_set_no_signal(save_read_set, save_write_set); + DBUG_RETURN(error); } @@ -11061,6 +11080,9 @@ int QUICK_RANGE_SELECT::reset() int QUICK_RANGE_SELECT::get_next() { range_id_t dummy; + MY_BITMAP * const save_read_set= head->read_set; + MY_BITMAP * const save_write_set= head->write_set; + DBUG_ENTER("QUICK_RANGE_SELECT::get_next"); if (in_ror_merged_scan) { diff --git a/sql/opt_range.h b/sql/opt_range.h index efb45f96345..c59b2a7eb02 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -430,7 +430,7 @@ protected: /* Members to deal with case when this quick select is a ROR-merged scan */ bool in_ror_merged_scan; - MY_BITMAP column_bitmap, *save_read_set, *save_write_set; + MY_BITMAP column_bitmap; bool free_file; /* TRUE <=> this->file is "owned" by this quick select */ /* Range pointers to be used when not using MRR interface */ diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 5836f7bf5dc..f59dfb3bc93 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -480,12 +480,15 @@ int mysql_update(THD *thd, We can't update table directly; We must first search after all matching rows before updating the table! */ + + // Verify that table->restore_column_maps_after_mark_index() will work + DBUG_ASSERT(table->read_set == &table->def_read_set); + DBUG_ASSERT(table->write_set == &table->def_write_set); + if (used_index < MAX_KEY && old_covering_keys.is_set(used_index)) table->add_read_columns_used_by_index(used_index); else - { table->use_all_columns(); - } /* note: We avoid sorting if we sort on the used index */ if (order && (need_sort || used_key_is_modified)) @@ -619,8 +622,11 @@ int mysql_update(THD *thd, if (error >= 0) goto err; } - if (table->key_read) - table->restore_column_maps_after_mark_index(); + /* + This restore bitmaps, works for add_read_columns_used_by_index() and + use_all_columns(): + */ + table->restore_column_maps_after_mark_index(); } if (ignore) From 52747434e583f877972ab913c7f4970a6d1f9b18 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 28 Jan 2013 17:24:50 +0100 Subject: [PATCH 347/349] fix embedded build with for cmake 2.6.2 (older cmake could not handle IF(NOT MATCHES) --- libmysqld/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 6ea5c3c84bf..5af5f5e1807 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -152,7 +152,9 @@ ENDIF() SET(EMBEDDED_API) FOREACH(f ${CLIENT_API_FUNCTIONS}) - IF(NOT(f MATCHES "plugin|_start$|_cont$")) + IF(f MATCHES "plugin|_start$|_cont$") + # Ignore functions, embedded does not export them + ELSE() SET(EMBEDDED_API ${EMBEDDED_API} ${f}) ENDIF() ENDFOREACH() From 78e47eb0040978a30e5f2287b6dc1aa0ebfcc53c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 29 Jan 2013 10:46:05 +0100 Subject: [PATCH 348/349] fix 'compat' rpm for fedora18 --- cmake/cpack_rpm.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 8ef9d9e178a..be42dacc415 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -85,6 +85,7 @@ SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/ SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf") SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*") SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*") +SET(CPACK_RPM_compat_USER_FILELIST ${ignored}) SET(CPACK_RPM_devel_USER_FILELIST ${ignored}) SET(CPACK_RPM_test_USER_FILELIST ${ignored}) From 52fbe44fbbe60ecaba6453884ec1ad32755d7a04 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 29 Jan 2013 12:27:31 +0100 Subject: [PATCH 349/349] more changes for fedora18 --- cmake/cpack_rpm.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index be42dacc415..056366e6ee6 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -71,6 +71,7 @@ SET(ignored "%ignore /usr" "%ignore /usr/bin" "%ignore /usr/include" + "%ignore /usr/lib" "%ignore /usr/lib64" "%ignore /usr/sbin" "%ignore /usr/share"