From 1d98f5f6b324025351559df32d05bec28551cb89 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Jun 2010 16:38:23 +0400 Subject: [PATCH 001/439] From ceb60c564f4609542a5ac32639157c8ff0155b59 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jun 2010 12:36:13 +0400 Subject: [PATCH 002/439] From ff2878f13bc4be2c3483f213124817c63ea554c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jun 2010 14:58:02 +0400 Subject: [PATCH 003/439] From b43616cb10fe10f9de6ffa244d5fa56bf40d6844 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Aug 2010 12:35:28 +0400 Subject: [PATCH 004/439] From 98a85c54215a1e345a7a5de95c2843eda752ff23 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Sep 2010 14:13:19 +0400 Subject: [PATCH 005/439] From 724ca07bd2b468ef4fb16666d2b6c48b991da506 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Oct 2010 11:50:30 +0200 Subject: [PATCH 006/439] From b3be64a6225e91c7b1d63ef2c7d9b9ff84e59670 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Oct 2010 12:10:57 +0200 Subject: [PATCH 007/439] From 282bd2c48b39857d23451e0801d08358cc512ff9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Oct 2010 15:08:56 +0200 Subject: [PATCH 008/439] From 49bf45f09e220be7ccef2ba60772f5630d81a04a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 13 Oct 2010 14:09:09 +0200 Subject: [PATCH 009/439] From d8763119c3ae7e54701eadfa8cf65c08a03606e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Oct 2010 07:57:58 +0200 Subject: [PATCH 010/439] From a8326f82a2fef6029dede4e8a9197cde258f357c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Oct 2010 14:28:05 +0200 Subject: [PATCH 011/439] From 983287b9cee28508a3a35954a100aeee2dfe4dc3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 09:44:06 +0200 Subject: [PATCH 012/439] From 583304564667acea066b4d13c1dd2619478a06c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 10:08:23 +0200 Subject: [PATCH 013/439] From 528ee88f452ddaf15c32d915cf8662c7eeb7f4de Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 12:24:40 +0200 Subject: [PATCH 014/439] From 5d424ac6c937bfc6372ba81143449e85a28da440 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 14:17:56 +0200 Subject: [PATCH 015/439] From ad6c110c2657a871a02de0c24acbacea080584dd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Oct 2010 12:31:10 +0200 Subject: [PATCH 016/439] From 365f30c69b8c350979ebebb634438b76dc8396bd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Oct 2010 14:04:53 +0200 Subject: [PATCH 017/439] From d8c435acbd5aa5ae43d8c3ed1efb4cec53283784 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Oct 2010 19:31:27 +0200 Subject: [PATCH 018/439] From cd5541bccf226f3591aa844458f8edb8ae5f8887 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Oct 2010 12:26:56 +0200 Subject: [PATCH 019/439] From 6e36a3327c2cb839775ab5cf2c7300bfe46fa505 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Oct 2010 14:12:34 +0200 Subject: [PATCH 020/439] From 027dc3469aab4d8d281392418d22c2b97f3941cc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 14:41:51 +0100 Subject: [PATCH 021/439] From 3e69de9da0f7cefc0f99af70430e1d336e4ecd53 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 15:45:58 +0100 Subject: [PATCH 022/439] From ac98991149c589757b281037c64b525f02028441 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 22:40:42 +0100 Subject: [PATCH 023/439] From 1a25823b8f55c304a7cb742e8e09bda55cab6f7a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Nov 2010 22:53:34 +0100 Subject: [PATCH 024/439] From 56633558581d35b78f7de947afd80d1867f9a29e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 Nov 2010 17:21:49 +0100 Subject: [PATCH 025/439] From a6824da69b56e3204682e508dc2492a18b0e5645 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 15:37:06 +0200 Subject: [PATCH 026/439] From 44d90be51804ec1f078430c5694c878cb4d8814f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 16:00:48 +0200 Subject: [PATCH 027/439] From a5745fbc29384b64b0cf60fe88da8a6691dc19ea Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 17:59:04 +0200 Subject: [PATCH 028/439] From 06b7e7bd655eb67bd0d2f140cdd2b57496dd75dc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Nov 2010 16:45:53 +0200 Subject: [PATCH 029/439] From a5fc25b0a65c61c79618df0933ea2d9fffc56cb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Nov 2010 14:52:02 +0100 Subject: [PATCH 030/439] From 2d4a00578ca4c63241c056a6aac243f827641e05 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Nov 2010 23:52:50 +0100 Subject: [PATCH 031/439] From 69ed65c8b8be488b4615b7400bced26f138662ea Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Nov 2010 17:43:52 +0200 Subject: [PATCH 032/439] From 5171af9402250db6a4f6c529b80654359559c4f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 Dec 2010 15:35:22 +0300 Subject: [PATCH 033/439] From 7bff141ce39fa82e1034478813e1521173219b54 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Dec 2010 15:05:34 +0300 Subject: [PATCH 034/439] From d1743d0ff502fb37afee96958045b3f8e6c46623 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Dec 2010 10:45:24 +0300 Subject: [PATCH 035/439] From 5d73a7a878b84243dff9a94063a721919f3b6228 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Dec 2010 13:14:15 +0300 Subject: [PATCH 036/439] From 73e4d40b025dd9ae14726cb1de8f631b8ed07ff0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Jan 2011 15:38:52 +0100 Subject: [PATCH 037/439] From 044c3f3c8c35262f48f765f3056416d5c5759396 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Jan 2011 15:40:44 +0100 Subject: [PATCH 038/439] From 7a08d9b91bbd1adf50cfb4272c30e0c909a45983 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Jan 2011 14:42:19 +0200 Subject: [PATCH 039/439] From b947b5e39d7505cfced968d5a3c21adb89c70d34 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Jan 2011 15:02:28 +0200 Subject: [PATCH 040/439] From 4b1d7b760f4f33df6adf0cc586b52c807b4216a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2011 13:39:08 +0200 Subject: [PATCH 041/439] From 4346f30e739d395de69f6d222e1be3c1379b0ccc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2011 13:39:45 +0200 Subject: [PATCH 042/439] From df38d3b7de69596c43b38654bc744ab99a0b66ab Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2011 13:41:57 +0200 Subject: [PATCH 043/439] From 70e9b65b859c8805ed7453792f78592b9d3096a3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Jan 2011 12:13:54 +0200 Subject: [PATCH 044/439] From 50f442bdb6c212bfd0d512f8ef533532758c378c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Jan 2011 18:20:03 +0200 Subject: [PATCH 045/439] From 36334fdca37c629f88b079ba4bc5624f033cb352 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Feb 2011 16:56:27 +0100 Subject: [PATCH 046/439] From 594741043e907418dda64dc20350cd4588db6b88 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Feb 2011 18:36:20 +0300 Subject: [PATCH 047/439] From 9c1795853825952f9fc94124b81d06887feb6624 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Feb 2011 10:31:05 +0300 Subject: [PATCH 048/439] From 57bc1bef4a83cb4d9b5392c45487f3080a24f4dd Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Feb 2011 14:28:28 +0300 Subject: [PATCH 049/439] From b1b3614e4eb3918f12ccdb28e1df9bf2ade93e4e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2011 09:14:04 +0300 Subject: [PATCH 050/439] From e6d7ccd689dcf54bf42b1967f3dc0e90a0f59400 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2011 10:18:15 +0300 Subject: [PATCH 051/439] From 9a9b685bf051ac1ec322c995eb4fc7529fef45de Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2011 11:36:47 +0300 Subject: [PATCH 052/439] From a67848ca54e59682caf78f2fd9238709611b2dd3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Feb 2011 09:16:15 +0300 Subject: [PATCH 053/439] From 5844fcee03f9412eef0000d5a8354476da2a3781 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2011 11:17:48 +0300 Subject: [PATCH 054/439] From d30f6443d5913d36295bc49a17058c47ed0e9d2f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2011 11:41:54 +0300 Subject: [PATCH 055/439] From 4df417da5bceb3457a4abcb5cd508ed5c5e0260d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Mar 2011 11:45:26 +0300 Subject: [PATCH 056/439] From 88c0cfd2b07fa94df15cfda114b55e96fc5c38c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Mar 2011 15:06:16 +0300 Subject: [PATCH 057/439] From aad279b33125f01af819bd86a1282a761178a0b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Mar 2011 15:19:02 +0300 Subject: [PATCH 058/439] From 11e2548910b295167f88fd80e562ccd6b86294f0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Mar 2011 16:15:05 +0300 Subject: [PATCH 059/439] From 5bf7ea745bef54d9ec9fcbd6b6048d9d9c4d4abc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Mar 2011 17:30:59 +0300 Subject: [PATCH 060/439] From c1f4c3ab92531101d004bb22a0e42781f8334604 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Mar 2011 12:34:24 +0300 Subject: [PATCH 061/439] From 2461535285fa28e13eba852d74cf043a09a5f72d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Mar 2011 11:30:42 +0300 Subject: [PATCH 062/439] From 15c67437dbf1e3b1a6bf5cae0672bd0d778411e3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Mar 2011 09:28:21 +0300 Subject: [PATCH 063/439] From 799150f58bcbc1a21cd3c5d2d1f312a3faecd20f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Mar 2011 11:41:28 +0200 Subject: [PATCH 064/439] From cc118d68fbda2c3bd26cc8fd76a26a96e2a9e57e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 18 Apr 2011 11:11:02 +0200 Subject: [PATCH 065/439] From 78ef1681cd6374ff622d60ac70eff3f4bda00150 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Apr 2011 12:51:58 +0200 Subject: [PATCH 066/439] From 54ac334d384a6d8ac675d393906c2ef65ef3256f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Apr 2011 22:54:05 +0200 Subject: [PATCH 067/439] From a483c2585a3ba1f3b53ac7e6c164a1aa670615b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 May 2011 12:38:44 +0300 Subject: [PATCH 068/439] From 76b829d5a02280d7ac44f501f8afe5cfe261d447 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 May 2011 12:40:29 +0300 Subject: [PATCH 069/439] From b7ea8621af4fb8f91b6d3e70bf6ed19f682a3c68 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 14:19:41 +0200 Subject: [PATCH 070/439] From ad8034bc83bdf372bb16cf1fd292fd9224dc2a1e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:02:22 +0200 Subject: [PATCH 071/439] From 6aea16c33c2530c105b886498554330b4d1c8b4d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:05:38 +0200 Subject: [PATCH 072/439] From fc31ce5086f304527ad6dede5f9de47d96716130 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:08:27 +0200 Subject: [PATCH 073/439] From 18a49e7a27f4da46aa34dd43664b6ba221415c17 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:17:28 +0200 Subject: [PATCH 074/439] From 5288f99fb8785fc6442f0e7b2824d6b92de183d7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2011 15:22:18 +0200 Subject: [PATCH 075/439] From 326621e5a3a7445c6c40a067ca6a5ff44cbf8330 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 10:00:22 +0200 Subject: [PATCH 076/439] From 730d160a69f6897281786c1fedac00eebffd9d2f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 10:39:44 +0200 Subject: [PATCH 077/439] From 113fb69f0f6d45183ac64fd9429908e27356a02f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 13:22:01 +0200 Subject: [PATCH 078/439] From c5c9fc2dbecc9eb6970f661752da40beb56d913b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 13:31:36 +0200 Subject: [PATCH 079/439] From 7c2dd1561824a771abd277f1719b5d766d272706 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2011 16:15:16 +0200 Subject: [PATCH 080/439] From 7e59b5cd948c041a7e68cdb492d9b02893b55da8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 11:59:46 +0200 Subject: [PATCH 081/439] From 97105260188eb3765d8af21c974b91ea92456c6f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 14:46:30 +0200 Subject: [PATCH 082/439] From b957a5d831aa8d3e3f8e3a70e4c29c277470bcd9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 15:44:29 +0200 Subject: [PATCH 083/439] From 8eccbb7dc3f5ed4407417d1858f3ed00160239ff Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 16:21:34 +0200 Subject: [PATCH 084/439] From f21203f1f6cdab7a8da16ac25c0060bc6f357a20 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2011 16:28:59 +0200 Subject: [PATCH 085/439] From fc209fe922fe5851b3a61074c89ff9f06e0dc691 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 11:34:53 +0200 Subject: [PATCH 086/439] From 1a3a1d45fd6bd13ee867bd8df6f53c299929ace7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 13:37:32 +0200 Subject: [PATCH 087/439] From a73ee62a33a24b360bd7c350d47d10e0a4e500d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 14:17:35 +0200 Subject: [PATCH 088/439] From 021812e38dc337cdca62e8b4b054c1ca34bb277e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 20:40:46 +0200 Subject: [PATCH 089/439] From 30ab0a9268bdfe071db826b1125d77a7054c7f16 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 20:42:53 +0200 Subject: [PATCH 090/439] From 71090aa72863ffdb77b3e2a3938539e89cedb934 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 20:47:39 +0200 Subject: [PATCH 091/439] From c7a95864b8e4498a1e361f9b39e362f995e7113b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2011 21:01:12 +0200 Subject: [PATCH 092/439] From 8d33c5d17403b57acd02f17ed43b7bb684a3a774 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jun 2011 21:47:44 +0200 Subject: [PATCH 093/439] From df672bef4b1b41a4ee9d6197064965dd18f8404a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jun 2011 20:55:37 +0200 Subject: [PATCH 094/439] From 528448ff02023510c5663be6c854e92916e0b6ae Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2011 13:27:46 +0200 Subject: [PATCH 095/439] From ae4d027ce925539e64b303fb7243c329fdf14da3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2011 12:28:29 +0400 Subject: [PATCH 096/439] From 09341b78dda52ec9260240392dfdec0e77f5e428 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2011 16:53:08 +0200 Subject: [PATCH 097/439] From 028d87e7a1108ba7d8872027c54aedda85ed5707 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jun 2011 09:19:21 +0200 Subject: [PATCH 098/439] From e58c971fb120b20db5701e575b048fdde71199bc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jun 2011 11:28:10 +0200 Subject: [PATCH 099/439] From 5584961e030bc44619d704515df5921e118bf9f9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jun 2011 22:17:15 +0200 Subject: [PATCH 100/439] From e79c71b7e96515b24091a704e7ce6263457ea55a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 11 Jun 2011 16:25:46 +0200 Subject: [PATCH 101/439] From 2480e76ce9a211704c554f2af1f158f48d5c3aa8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Jun 2011 12:54:59 +0200 Subject: [PATCH 102/439] From f7593d71d1bfa5f604a42c03035e7ce2c31a6517 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Jun 2011 10:38:51 +0200 Subject: [PATCH 103/439] From 30412e252193e9f1c1cc4cadc9e152e0f0d3a480 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Jun 2011 14:57:02 +0400 Subject: [PATCH 104/439] From a5ad75acb0f47fd1c13cc940a2373881b8521099 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Jul 2011 17:57:44 +0300 Subject: [PATCH 105/439] From 95854892298a26d7ac0fca2928e0cbc7e1604e31 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Jul 2011 21:39:15 -0300 Subject: [PATCH 106/439] From 3d2e329dec873d177f973ed0ff5b06f62c59cc10 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Jul 2011 22:10:35 -0300 Subject: [PATCH 107/439] From 2e6eccc241630412e2c0289f323cef8b53b16330 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jul 2011 12:42:04 -0300 Subject: [PATCH 108/439] From b3589afe4d0adc9873d7f66b89adc15c75a164cb Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Aug 2011 17:27:30 +0200 Subject: [PATCH 109/439] From 09cd3f305e142a50adb789da345d071b9ba3a027 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2011 15:52:28 +0300 Subject: [PATCH 110/439] From 282b192da33bb023b047d302079d11f69b0d1431 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2011 16:41:24 +0200 Subject: [PATCH 111/439] From ff32d581e44c174609770a6b90b8bd4e374f92be Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 Aug 2011 13:16:08 +0300 Subject: [PATCH 112/439] From df7ecefc38ce89362e18e34ddd0d125df4c9e4f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Aug 2011 10:46:23 +0300 Subject: [PATCH 113/439] From 5628f022eafbb386bc23c222e0edbefbc3d4acaa Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Aug 2011 16:06:01 +0200 Subject: [PATCH 114/439] From 84f8af386c4c9a3fe68ff0288b7c44ec87566130 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Sep 2011 11:46:05 +0200 Subject: [PATCH 115/439] From c7034a21be5da4be3b025ff70b0374c84ba1b454 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Sep 2011 15:13:04 +0200 Subject: [PATCH 116/439] From 5dc086cb84ff261172a9f5e28763aabc02553c5a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Sep 2011 15:18:03 +0200 Subject: [PATCH 117/439] From 1dae9261054266f245635df15377ca934771cb28 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Sep 2011 18:58:54 +0200 Subject: [PATCH 118/439] From 28b3dde980b4794bc6d34333cd6eb6e138efbc2c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Sep 2011 22:16:05 +0200 Subject: [PATCH 119/439] From fde05cbe60038358f240d3fde7db0dfda97d0059 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Sep 2011 22:19:07 +0200 Subject: [PATCH 120/439] From ac9739ff80ceb21e5939065652aaf1d8bed30157 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Sep 2011 10:11:39 +0200 Subject: [PATCH 121/439] From b48eec0413bf140a91eda98fe63e7d9fc17d0069 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2011 18:40:54 +0200 Subject: [PATCH 122/439] From 2d20d8389bdec7bf11e9f35755ce414aec575c59 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Sep 2011 12:23:38 +0300 Subject: [PATCH 123/439] From a510b5638e187e0fa5996f9728b0dbf3e4cda6ec Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Sep 2011 17:06:02 +0300 Subject: [PATCH 124/439] From b1ca7fdd06eca64f672d52d309ecb17d5873484d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2011 17:50:00 +0200 Subject: [PATCH 125/439] From f35537d75da055cc5d195b64f10e9554a1a07ab1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2011 17:51:26 +0200 Subject: [PATCH 126/439] From 6639c39d3aa230c65a4743be8c3561f60a642f49 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Nov 2011 11:43:55 +0100 Subject: [PATCH 127/439] From 45dd5afb1fdf90a2f60f804c27e1073f6a85a10f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 21 Dec 2011 17:04:24 +0100 Subject: [PATCH 128/439] From 0debf36f963dd2a67fc5314702aa36cc588f734f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jan 2012 16:16:29 +0100 Subject: [PATCH 129/439] From fa40ae3797571d3d63e358f8912d61865a820014 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jan 2012 12:09:06 +0100 Subject: [PATCH 130/439] From 599d6bbb1149be4c9e1a012103def15e0c0687ab Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Feb 2012 13:18:53 +0100 Subject: [PATCH 131/439] From 286edcdb00a254cbbce8bc2bcb35fce9f1950a49 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Feb 2012 13:20:36 +0100 Subject: [PATCH 132/439] From 0f222c6b2a7877f233d6811b7c714823c0af64f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Mar 2012 12:40:57 +0100 Subject: [PATCH 133/439] From e629839f5143fe06a6b262812ec5bc7e3e98016a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Apr 2012 14:05:03 +0400 Subject: [PATCH 134/439] From 5967ae0143e11b99bf20a0841ceaf8a4647fec31 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Jun 2012 14:56:04 +0200 Subject: [PATCH 135/439] From 7bc9f782f2ef60c14a4bcf9a0ba01d73fcbd4930 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2012 09:41:31 +0200 Subject: [PATCH 136/439] From 057cb35c459185af9e2bf901d27ced6e55b6b28f Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Fri, 8 Jun 2012 19:44:06 +0200 Subject: [PATCH 137/439] 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/439] 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/439] From 014ed2bd17b744ac69c387fb92c20a1225fca84b Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 11 Jun 2012 18:02:30 +0200 Subject: [PATCH 140/439] 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/439] 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/439] 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/439] 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/439] 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/439] 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/439] 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/439] From bb0f0276357be688b207a3eba4ccd6123bf8ef36 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Jun 2012 09:25:05 +0400 Subject: [PATCH 148/439] From 9aa4063511d43afe08e437a69a67b0a71f280b41 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Jun 2012 10:46:52 +0200 Subject: [PATCH 149/439] From c5af50cecd567f56b79e17e518295e648279c501 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jun 2012 15:19:58 +0200 Subject: [PATCH 150/439] From 97bd43920c0be78f370d9f7a7a555f142b683b7c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Jun 2012 12:31:12 +0200 Subject: [PATCH 151/439] From 885d4641d4e15b1deef4d45a019696bc4c309fc1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2012 11:32:39 +0400 Subject: [PATCH 152/439] From 446bd50e4ce6772b5774023649df30049e39ce0d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Jul 2012 12:58:51 +0200 Subject: [PATCH 153/439] From 40f9b65f93da9a077a071e629cd741a7b4e6672e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2012 13:55:03 +0200 Subject: [PATCH 154/439] From 4540e722689e6906f7600f7656da900d08b02dd6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Jul 2012 08:24:07 +0200 Subject: [PATCH 155/439] From dce6acf67cbdf9489a5e50c8bf99866578321a4e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Jul 2012 11:34:03 +0200 Subject: [PATCH 156/439] From b9a8be20d67094f59a90bccf864898e361b46f0f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2012 11:28:25 +0200 Subject: [PATCH 157/439] From 202a2591c4153618e250a560fc1c6792398879e9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Jul 2012 09:06:50 +0200 Subject: [PATCH 158/439] From 8ebfe7edf190490d08d209ebcff0420300fec96b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Jul 2012 09:38:40 +0200 Subject: [PATCH 159/439] From b3ac76da0801637bc1f3902e46ac165b0b2acf75 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Jul 2012 08:55:55 +0200 Subject: [PATCH 160/439] From 45176d9f14092c2f517f6167712c2c9cc9b8119f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2012 09:09:13 +0200 Subject: [PATCH 161/439] From cedccf11572e7cf4150ef3fd005b85236cd3e795 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2012 14:45:43 +0530 Subject: [PATCH 162/439] From d06273ef43089f95a5a46bf75a7262c5ad4e2841 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 26 Jul 2012 20:24:51 +0200 Subject: [PATCH 163/439] 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/439] 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/439] 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/439] 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/439] 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/439] From ec7d3f63dbfaa73e1c42191cc927a24eef535a56 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2012 00:53:10 +0400 Subject: [PATCH 169/439] From d028cc5f1d39c5dfa0ae332e5341cea918a5a6b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2012 15:37:40 +0400 Subject: [PATCH 170/439] From c15914f761c722d31f72524fe468d6275bdddf47 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 17 Aug 2012 21:13:20 +0400 Subject: [PATCH 171/439] Initial commit for Cassandra storage engine. --- mysql-test/include/have_cassandra.inc | 10 + mysql-test/include/have_cassandra.opt | 1 + mysql-test/r/cassandra.result | 20 + mysql-test/t/cassandra.test | 68 + storage/cassandra/CMakeLists.txt | 22 + storage/cassandra/cassandra_se.cc | 271 + storage/cassandra/cassandra_se.h | 57 + storage/cassandra/gen-cpp/Cassandra.cpp | 12871 ++++++++++++++++ storage/cassandra/gen-cpp/Cassandra.h | 5466 +++++++ .../gen-cpp/Cassandra_server.skeleton.cpp | 219 + .../cassandra/gen-cpp/cassandra_constants.cpp | 18 + .../cassandra/gen-cpp/cassandra_constants.h | 26 + storage/cassandra/gen-cpp/cassandra_types.cpp | 3512 +++++ storage/cassandra/gen-cpp/cassandra_types.h | 2149 +++ storage/cassandra/ha_cassandra.cc | 727 + storage/cassandra/ha_cassandra.h | 218 + 16 files changed, 25655 insertions(+) create mode 100644 mysql-test/include/have_cassandra.inc create mode 100644 mysql-test/include/have_cassandra.opt create mode 100644 mysql-test/r/cassandra.result create mode 100644 mysql-test/t/cassandra.test create mode 100644 storage/cassandra/CMakeLists.txt create mode 100644 storage/cassandra/cassandra_se.cc create mode 100644 storage/cassandra/cassandra_se.h create mode 100644 storage/cassandra/gen-cpp/Cassandra.cpp create mode 100644 storage/cassandra/gen-cpp/Cassandra.h create mode 100644 storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp create mode 100644 storage/cassandra/gen-cpp/cassandra_constants.cpp create mode 100644 storage/cassandra/gen-cpp/cassandra_constants.h create mode 100644 storage/cassandra/gen-cpp/cassandra_types.cpp create mode 100644 storage/cassandra/gen-cpp/cassandra_types.h create mode 100644 storage/cassandra/ha_cassandra.cc create mode 100644 storage/cassandra/ha_cassandra.h diff --git a/mysql-test/include/have_cassandra.inc b/mysql-test/include/have_cassandra.inc new file mode 100644 index 00000000000..d358e2ecc26 --- /dev/null +++ b/mysql-test/include/have_cassandra.inc @@ -0,0 +1,10 @@ +# +# suite.pm will make sure that all tests including this file +# will be skipped unless innodb or xtradb is enabled +# +# The test below is redundant + +if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'cassandra' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) +{ + --skip Test requires Cassandra. +} diff --git a/mysql-test/include/have_cassandra.opt b/mysql-test/include/have_cassandra.opt new file mode 100644 index 00000000000..92d642a5e4c --- /dev/null +++ b/mysql-test/include/have_cassandra.opt @@ -0,0 +1 @@ +--cassandra=on diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result new file mode 100644 index 00000000000..6dbf08651d8 --- /dev/null +++ b/mysql-test/r/cassandra.result @@ -0,0 +1,20 @@ +drop table if exists t0, t1; +create table t1 (a int) engine=cassandra +thrift_host='localhost' keyspace='foo' column_family='colfam'; +ERROR 42000: Incorrect column name 'First column must be named 'rowkey'' +create table t1 (a int primary key, b int) engine=cassandra +thrift_host='localhost' keyspace='foo' column_family='colfam'; +ERROR 42000: Incorrect column name 'First column must be named 'rowkey'' +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra +thrift_host='127.0.0.2' keyspace='foo' column_family='colfam'; +ERROR HY000: Unable to connect to foreign data source: connect() failed: Connection refused [1] +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra +thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam'; +ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace no_such_keyspace does not exist] +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra +thrift_host='localhost' keyspace='no_such_keyspace'; +ERROR HY000: Can't create table 'test.t1' (errno: 140) +create table t1 (rowkey char(36) primary key, column1 char(60)) engine=cassandra +thrift_host='localhost' keyspace='mariadbtest' column_family='cf1'; +insert into t1 values ('key0', 'data1'); +drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test new file mode 100644 index 00000000000..34a6909af38 --- /dev/null +++ b/mysql-test/t/cassandra.test @@ -0,0 +1,68 @@ +# +# Tests for cassandra storage engine +# +--source include/have_cassandra.inc + +--disable_warnings +drop table if exists t0, t1; +--enable_warnings + +# Test various errors on table creation. +--error ER_WRONG_COLUMN_NAME +create table t1 (a int) engine=cassandra + thrift_host='localhost' keyspace='foo' column_family='colfam'; + +--error ER_WRONG_COLUMN_NAME +create table t1 (a int primary key, b int) engine=cassandra + thrift_host='localhost' keyspace='foo' column_family='colfam'; + +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra + thrift_host='127.0.0.2' keyspace='foo' column_family='colfam'; + +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra + thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam'; + +# No column family specified +--error ER_CANT_CREATE_TABLE +create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra + thrift_host='localhost' keyspace='no_such_keyspace'; + +############################################################################ +## Cassandra initialization: +############################################################################ +--disable_parsing + +./cqlsh --cql3 + +CREATE KEYSPACE mariadbtest + WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' + AND strategy_options:replication_factor='1'; + +USE mariadbtest; +create columnfamily cf1 ( pk varchar primary key, data1 varchar); + +--enable_parsing +############################################################################ +## Cassandra initialization ends +############################################################################ + +# Now, create a table for real and insert data +create table t1 (rowkey char(36) primary key, column1 char(60)) engine=cassandra + thrift_host='localhost' keyspace='mariadbtest' column_family='cf1'; + +insert into t1 values ('key0', 'data1'); + +drop table t1; + +############################################################################ +## Cassandra cleanup +############################################################################ +--disable_parsing +drop columnfamily cf1; +--enable_parsing +############################################################################ +## Cassandra cleanup ends +############################################################################ + diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt new file mode 100644 index 00000000000..7986b0244bb --- /dev/null +++ b/storage/cassandra/CMakeLists.txt @@ -0,0 +1,22 @@ + +SET(cassandra_sources + ha_cassandra.cc + ha_cassandra.h + cassandra_se.h + cassandra_se.cc + gen-cpp/Cassandra.cpp + gen-cpp/cassandra_types.h + gen-cpp/cassandra_types.cpp + gen-cpp/cassandra_constants.h + gen-cpp/cassandra_constants.cpp + gen-cpp/Cassandra.h) + +#INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) +# +STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +#LINK_DIRECTORIES(/home/psergey/cassandra/thrift/lib) + +MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE LINK_LIBRARIES thrift) +# was: STORAGE_ENGINE MANDATORY diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc new file mode 100644 index 00000000000..1bc799d09c6 --- /dev/null +++ b/storage/cassandra/cassandra_se.cc @@ -0,0 +1,271 @@ + +// Cassandra includes: +#include +#include +#include +#include +#include + +#include "Thrift.h" +#include "transport/TSocket.h" +#include "transport/TTransport.h" +#include "transport/TBufferTransports.h" +#include "protocol/TProtocol.h" +#include "protocol/TBinaryProtocol.h" +#include "gen-cpp/Cassandra.h" +// cassandra includes end + +#include "cassandra_se.h" + +using namespace std; +using namespace apache::thrift; +using namespace apache::thrift::transport; +using namespace apache::thrift::protocol; +using namespace org::apache::cassandra; + +void Cassandra_se_interface::print_error(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + // it's not a problem if output was truncated + vsnprintf(err_buffer, sizeof(err_buffer), format, ap); + va_end(ap); +} + +/* + Implementation of connection to one Cassandra column family (ie., table) +*/ +class Cassandra_se_impl: public Cassandra_se_interface +{ + CassandraClient *cass; /* Connection to cassandra */ + ConsistencyLevel::type cur_consistency_level; + + std::string column_family; + std::string keyspace; + + /* DDL checks */ + KsDef ks_def; /* KeySpace we're using (TODO: put this in table->share) */ + CfDef cf_def; /* Column family we're using (TODO: put in table->share)*/ + std::vector::iterator column_ddl_it; + + /* The list that was returned by the last key lookup */ + std::vector col_supercol_vec; + +public: + + Cassandra_se_impl() : cass(NULL) {} + virtual ~Cassandra_se_impl(){ delete cass; } + + bool connect(const char *host, const char *keyspace); + + virtual void set_column_family(const char *cfname) + { + column_family.assign(cfname); + } + + virtual bool insert(NameAndValue *fields); + virtual bool get_slice(char *key, size_t key_len, NameAndValue *row, bool *found); + + + /* Functions to enumerate ColumnFamily's DDL data */ + bool setup_ddl_checks(); + void first_ddl_column(); + bool next_ddl_column(char **name, int *name_len, char **value, int *value_len); +}; + + +Cassandra_se_interface *get_cassandra_se() +{ + return new Cassandra_se_impl; +} + +#define CASS_TRY(x) try { \ + x; \ + }catch(TTransportException te){ \ + print_error("%s [%d]", te.what(), te.getType()); \ + }catch(InvalidRequestException ire){ \ + print_error("%s [%s]", ire.what(), ire.why.c_str()); \ + }catch(NotFoundException nfe){ \ + print_error("%s", nfe.what()); \ + } catch(...) { \ + print_error("Unknown Exception"); \ + } + +bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg) +{ + bool res= true; + + keyspace.assign(keyspace_arg); + + try { + boost::shared_ptr socket = + boost::shared_ptr(new TSocket(host, 9160)); + boost::shared_ptr tr = + boost::shared_ptr(new TFramedTransport (socket)); + boost::shared_ptr p = + boost::shared_ptr(new TBinaryProtocol(tr)); + + cass= new CassandraClient(p); + tr->open(); + cass->set_keyspace(keyspace_arg); + + res= false; // success + }catch(TTransportException te){ + print_error("%s [%d]", te.what(), te.getType()); + }catch(InvalidRequestException ire){ + print_error("%s [%s]", ire.what(), ire.why.c_str()); + }catch(NotFoundException nfe){ + print_error("%s", nfe.what()); + } + catch(...) { + print_error("Unknown Exception"); + } + + // For now: + cur_consistency_level= ConsistencyLevel::ONE; + + if (setup_ddl_checks()) + res= true; + return res; +} + + +bool Cassandra_se_impl::setup_ddl_checks() +{ + try { + cass->describe_keyspace(ks_def, keyspace); + + std::vector::iterator it; + for (it= ks_def.cf_defs.begin(); it < ks_def.cf_defs.end(); it++) + { + cf_def= *it; + if (!cf_def.name.compare(column_family)) + return false; + } + + print_error("describe_keyspace() didn't return our column family"); + + } catch (InvalidRequestException ire) { + print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (NotFoundException nfe) { + print_error("keyspace not found: %s", nfe.what()); + } + return true; +} + + +void Cassandra_se_impl::first_ddl_column() +{ + column_ddl_it= cf_def.column_metadata.begin(); +} + + +bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len, + char **type, int *type_len) +{ + if (column_ddl_it == cf_def.column_metadata.end()) + return true; + + *name= (char*)(*column_ddl_it).name.c_str(); + *name_len= (*column_ddl_it).name.length(); + + *type= (char*)(*column_ddl_it).validation_class.c_str(); + *type_len= (*column_ddl_it).validation_class.length(); + + column_ddl_it++; + return false; +} + + +bool Cassandra_se_impl::insert(NameAndValue *fields) +{ + ColumnParent cparent; + cparent.column_family= column_family; + + Column c; + struct timeval td; + gettimeofday(&td, NULL); + int64_t ms = td.tv_sec; + ms = ms * 1000; + int64_t usec = td.tv_usec; + usec = usec / 1000; + ms += usec; + c.timestamp = ms; + c.__isset.timestamp = true; + + std::string key; + key.assign(fields->value, fields->value_len); + fields++; + + bool res= false; + try { + /* TODO: switch to batch_mutate(). Or, even to CQL? */ + + // TODO: what should INSERT table (co1, col2) VALUES ('foo', 'bar') mean? + // in SQL, it sets all columns.. what should it mean here? can we have + // it to work only for specified columns? (if yes, what do for + // VALUES()?) + c.__isset.value= true; + for(;fields->name; fields++) + { + c.name.assign(fields->name); + c.value.assign(fields->value, fields->value_len); + cass->insert(key, cparent, c, ConsistencyLevel::ONE); + } + + } catch (...) { + res= true; + } + return res; +} + + +bool Cassandra_se_impl::get_slice(char *key, size_t key_len, NameAndValue *row, bool *found) +{ + ColumnParent cparent; + cparent.column_family= column_family; + + std::string rowkey_str; + rowkey_str.assign(key, key_len); + + SlicePredicate slice_pred; + SliceRange sr; + sr.start = ""; + sr.finish = ""; + slice_pred.__set_slice_range(sr); + + try { + std::vector &res= col_supercol_vec; + cass->get_slice(res, rowkey_str, cparent, slice_pred, ConsistencyLevel::ONE); + *found= true; + + std::vector::iterator it; + if (res.size() == 0) + { + /* + No columns found. Cassandra doesn't allow records without any column => + this means the seach key doesn't exist + */ + *found= false; + return false; + } + for (it= res.begin(); it < res.end(); it++) + { + ColumnOrSuperColumn cs= *it; + if (!cs.__isset.column) + return true; + row->name= (char*)cs.column.name.c_str(); + row->value= (char*)cs.column.value.c_str(); + row->value_len= cs.column.value.length(); + row++; + } + row->name= NULL; + } catch (InvalidRequestException ire) { + return true; + } catch (UnavailableException ue) { + return true; + } catch (TimedOutException te) { + return true; + } + return false; +} diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h new file mode 100644 index 00000000000..1ab14c39602 --- /dev/null +++ b/storage/cassandra/cassandra_se.h @@ -0,0 +1,57 @@ + +/* + This file is a "bridge" interface between cassandra+Thrift and MariaDB. + + It is #included by both sides, so it must itself include neither (including + both together causes compile errors due to conflicts). +*/ + + +/* + Storage for (name,value) pairs. name==NULL means 'non-object'. + + This should be used for + - shipping data from sql to cassandra for INSERTs + - shipping data from cassandra to SQL for record reads. + +*/ +class NameAndValue +{ +public: + char *name; + char *value; + size_t value_len; +}; + +/* + Interface to one cassandra column family, i.e. one 'table' +*/ +class Cassandra_se_interface +{ +public: + Cassandra_se_interface() { err_buffer[0]=0; } + + virtual ~Cassandra_se_interface(){}; + /* Init */ + virtual bool connect(const char *host, const char *port)=0; + virtual void set_column_family(const char *cfname) = 0; + + /* Check underlying DDL */ + virtual bool setup_ddl_checks()=0; + virtual void first_ddl_column()=0; + virtual bool next_ddl_column(char **name, int *name_len, char **value, + int *value_len)=0; + + /* Writes */ + virtual bool insert(NameAndValue *fields)=0; + + /* Reads */ + virtual bool get_slice(char *key, size_t key_len, NameAndValue *row, bool *found)=0 ; + + /* Passing error messages up to ha_cassandra */ + char err_buffer[512]; + const char *error_str() { return err_buffer; } + void print_error(const char *format, ...); +}; + +Cassandra_se_interface *get_cassandra_se(); diff --git a/storage/cassandra/gen-cpp/Cassandra.cpp b/storage/cassandra/gen-cpp/Cassandra.cpp new file mode 100644 index 00000000000..db1deb34c31 --- /dev/null +++ b/storage/cassandra/gen-cpp/Cassandra.cpp @@ -0,0 +1,12871 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#include +#include + +#include "Cassandra.h" + +namespace org { namespace apache { namespace cassandra { + +uint32_t Cassandra_login_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_auth_request = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->auth_request.read(iprot); + isset_auth_request = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_auth_request) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_login_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_login_args"); + xfer += oprot->writeFieldBegin("auth_request", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->auth_request.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_login_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_login_pargs"); + xfer += oprot->writeFieldBegin("auth_request", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->auth_request)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_login_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->authnx.read(iprot); + this->__isset.authnx = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->authzx.read(iprot); + this->__isset.authzx = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_login_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_login_result"); + + if (this->__isset.authnx) { + xfer += oprot->writeFieldBegin("authnx", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->authnx.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.authzx) { + xfer += oprot->writeFieldBegin("authzx", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->authzx.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_login_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->authnx.read(iprot); + this->__isset.authnx = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->authzx.read(iprot); + this->__isset.authzx = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_set_keyspace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_keyspace = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->keyspace); + isset_keyspace = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_keyspace) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_set_keyspace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_set_keyspace_args"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->keyspace); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_set_keyspace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_set_keyspace_pargs"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->keyspace))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_set_keyspace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_set_keyspace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_set_keyspace_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_set_keyspace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_column_path = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_path.read(iprot); + isset_column_path = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast149; + xfer += iprot->readI32(ecast149); + this->consistency_level = (ConsistencyLevel::type)ecast149; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_path) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_get_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_args"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_path", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_path.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_pargs"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->key))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_path", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_path)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->nfe.read(iprot); + this->__isset.nfe = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_get_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.nfe) { + xfer += oprot->writeFieldBegin("nfe", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->nfe.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->nfe.read(iprot); + this->__isset.nfe = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_slice_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->predicate.read(iprot); + isset_predicate = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast150; + xfer += iprot->readI32(ecast150); + this->consistency_level = (ConsistencyLevel::type)ecast150; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_predicate) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_get_slice_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_slice_args"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->predicate.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_slice_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_slice_pargs"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->key))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->predicate)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_slice_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size151; + ::apache::thrift::protocol::TType _etype154; + iprot->readListBegin(_etype154, _size151); + this->success.resize(_size151); + uint32_t _i155; + for (_i155 = 0; _i155 < _size151; ++_i155) + { + xfer += this->success[_i155].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_slice_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_get_slice_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); + std::vector ::const_iterator _iter156; + for (_iter156 = this->success.begin(); _iter156 != this->success.end(); ++_iter156) + { + xfer += (*_iter156).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_slice_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size157; + ::apache::thrift::protocol::TType _etype160; + iprot->readListBegin(_etype160, _size157); + (*(this->success)).resize(_size157); + uint32_t _i161; + for (_i161 = 0; _i161 < _size157; ++_i161) + { + xfer += (*(this->success))[_i161].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_count_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->predicate.read(iprot); + isset_predicate = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast162; + xfer += iprot->readI32(ecast162); + this->consistency_level = (ConsistencyLevel::type)ecast162; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_predicate) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_get_count_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_count_args"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->predicate.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_count_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_count_pargs"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->key))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->predicate)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_count_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_count_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_get_count_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0); + xfer += oprot->writeI32(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_count_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_multiget_slice_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_keys = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->keys.clear(); + uint32_t _size163; + ::apache::thrift::protocol::TType _etype166; + iprot->readListBegin(_etype166, _size163); + this->keys.resize(_size163); + uint32_t _i167; + for (_i167 = 0; _i167 < _size163; ++_i167) + { + xfer += iprot->readBinary(this->keys[_i167]); + } + iprot->readListEnd(); + } + isset_keys = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->predicate.read(iprot); + isset_predicate = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast168; + xfer += iprot->readI32(ecast168); + this->consistency_level = (ConsistencyLevel::type)ecast168; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_keys) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_predicate) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_multiget_slice_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_multiget_slice_args"); + xfer += oprot->writeFieldBegin("keys", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->keys.size())); + std::vector ::const_iterator _iter169; + for (_iter169 = this->keys.begin(); _iter169 != this->keys.end(); ++_iter169) + { + xfer += oprot->writeBinary((*_iter169)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->predicate.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_multiget_slice_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_multiget_slice_pargs"); + xfer += oprot->writeFieldBegin("keys", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast((*(this->keys)).size())); + std::vector ::const_iterator _iter170; + for (_iter170 = (*(this->keys)).begin(); _iter170 != (*(this->keys)).end(); ++_iter170) + { + xfer += oprot->writeBinary((*_iter170)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->predicate)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_multiget_slice_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->success.clear(); + uint32_t _size171; + ::apache::thrift::protocol::TType _ktype172; + ::apache::thrift::protocol::TType _vtype173; + iprot->readMapBegin(_ktype172, _vtype173, _size171); + uint32_t _i175; + for (_i175 = 0; _i175 < _size171; ++_i175) + { + std::string _key176; + xfer += iprot->readBinary(_key176); + std::vector & _val177 = this->success[_key176]; + { + _val177.clear(); + uint32_t _size178; + ::apache::thrift::protocol::TType _etype181; + iprot->readListBegin(_etype181, _size178); + _val177.resize(_size178); + uint32_t _i182; + for (_i182 = 0; _i182 < _size178; ++_i182) + { + xfer += _val177[_i182].read(iprot); + } + iprot->readListEnd(); + } + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_multiget_slice_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_multiget_slice_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_MAP, 0); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast(this->success.size())); + std::map > ::const_iterator _iter183; + for (_iter183 = this->success.begin(); _iter183 != this->success.end(); ++_iter183) + { + xfer += oprot->writeBinary(_iter183->first); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(_iter183->second.size())); + std::vector ::const_iterator _iter184; + for (_iter184 = _iter183->second.begin(); _iter184 != _iter183->second.end(); ++_iter184) + { + xfer += (*_iter184).write(oprot); + } + xfer += oprot->writeListEnd(); + } + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_multiget_slice_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + (*(this->success)).clear(); + uint32_t _size185; + ::apache::thrift::protocol::TType _ktype186; + ::apache::thrift::protocol::TType _vtype187; + iprot->readMapBegin(_ktype186, _vtype187, _size185); + uint32_t _i189; + for (_i189 = 0; _i189 < _size185; ++_i189) + { + std::string _key190; + xfer += iprot->readBinary(_key190); + std::vector & _val191 = (*(this->success))[_key190]; + { + _val191.clear(); + uint32_t _size192; + ::apache::thrift::protocol::TType _etype195; + iprot->readListBegin(_etype195, _size192); + _val191.resize(_size192); + uint32_t _i196; + for (_i196 = 0; _i196 < _size192; ++_i196) + { + xfer += _val191[_i196].read(iprot); + } + iprot->readListEnd(); + } + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_multiget_count_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_keys = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->keys.clear(); + uint32_t _size197; + ::apache::thrift::protocol::TType _etype200; + iprot->readListBegin(_etype200, _size197); + this->keys.resize(_size197); + uint32_t _i201; + for (_i201 = 0; _i201 < _size197; ++_i201) + { + xfer += iprot->readBinary(this->keys[_i201]); + } + iprot->readListEnd(); + } + isset_keys = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->predicate.read(iprot); + isset_predicate = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast202; + xfer += iprot->readI32(ecast202); + this->consistency_level = (ConsistencyLevel::type)ecast202; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_keys) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_predicate) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_multiget_count_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_multiget_count_args"); + xfer += oprot->writeFieldBegin("keys", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->keys.size())); + std::vector ::const_iterator _iter203; + for (_iter203 = this->keys.begin(); _iter203 != this->keys.end(); ++_iter203) + { + xfer += oprot->writeBinary((*_iter203)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->predicate.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_multiget_count_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_multiget_count_pargs"); + xfer += oprot->writeFieldBegin("keys", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast((*(this->keys)).size())); + std::vector ::const_iterator _iter204; + for (_iter204 = (*(this->keys)).begin(); _iter204 != (*(this->keys)).end(); ++_iter204) + { + xfer += oprot->writeBinary((*_iter204)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->predicate)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_multiget_count_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->success.clear(); + uint32_t _size205; + ::apache::thrift::protocol::TType _ktype206; + ::apache::thrift::protocol::TType _vtype207; + iprot->readMapBegin(_ktype206, _vtype207, _size205); + uint32_t _i209; + for (_i209 = 0; _i209 < _size205; ++_i209) + { + std::string _key210; + xfer += iprot->readBinary(_key210); + int32_t& _val211 = this->success[_key210]; + xfer += iprot->readI32(_val211); + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_multiget_count_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_multiget_count_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_MAP, 0); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_I32, static_cast(this->success.size())); + std::map ::const_iterator _iter212; + for (_iter212 = this->success.begin(); _iter212 != this->success.end(); ++_iter212) + { + xfer += oprot->writeBinary(_iter212->first); + xfer += oprot->writeI32(_iter212->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_multiget_count_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + (*(this->success)).clear(); + uint32_t _size213; + ::apache::thrift::protocol::TType _ktype214; + ::apache::thrift::protocol::TType _vtype215; + iprot->readMapBegin(_ktype214, _vtype215, _size213); + uint32_t _i217; + for (_i217 = 0; _i217 < _size213; ++_i217) + { + std::string _key218; + xfer += iprot->readBinary(_key218); + int32_t& _val219 = (*(this->success))[_key218]; + xfer += iprot->readI32(_val219); + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_range_slices_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_range = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->predicate.read(iprot); + isset_predicate = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->range.read(iprot); + isset_range = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast220; + xfer += iprot->readI32(ecast220); + this->consistency_level = (ConsistencyLevel::type)ecast220; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_predicate) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_range) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_get_range_slices_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_range_slices_args"); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->predicate.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("range", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->range.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_range_slices_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_range_slices_pargs"); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->predicate)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("range", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->range)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_range_slices_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size221; + ::apache::thrift::protocol::TType _etype224; + iprot->readListBegin(_etype224, _size221); + this->success.resize(_size221); + uint32_t _i225; + for (_i225 = 0; _i225 < _size221; ++_i225) + { + xfer += this->success[_i225].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_range_slices_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_get_range_slices_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); + std::vector ::const_iterator _iter226; + for (_iter226 = this->success.begin(); _iter226 != this->success.end(); ++_iter226) + { + xfer += (*_iter226).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_range_slices_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size227; + ::apache::thrift::protocol::TType _etype230; + iprot->readListBegin(_etype230, _size227); + (*(this->success)).resize(_size227); + uint32_t _i231; + for (_i231 = 0; _i231 < _size227; ++_i231) + { + xfer += (*(this->success))[_i231].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_paged_slice_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_column_family = false; + bool isset_range = false; + bool isset_start_column = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->column_family); + isset_column_family = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->range.read(iprot); + isset_range = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->start_column); + isset_start_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast232; + xfer += iprot->readI32(ecast232); + this->consistency_level = (ConsistencyLevel::type)ecast232; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_column_family) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_range) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_start_column) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_get_paged_slice_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_paged_slice_args"); + xfer += oprot->writeFieldBegin("column_family", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->column_family); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("range", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->range.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("start_column", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeBinary(this->start_column); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_paged_slice_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_paged_slice_pargs"); + xfer += oprot->writeFieldBegin("column_family", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->column_family))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("range", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->range)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("start_column", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeBinary((*(this->start_column))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_paged_slice_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size233; + ::apache::thrift::protocol::TType _etype236; + iprot->readListBegin(_etype236, _size233); + this->success.resize(_size233); + uint32_t _i237; + for (_i237 = 0; _i237 < _size233; ++_i237) + { + xfer += this->success[_i237].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_paged_slice_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_get_paged_slice_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); + std::vector ::const_iterator _iter238; + for (_iter238 = this->success.begin(); _iter238 != this->success.end(); ++_iter238) + { + xfer += (*_iter238).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_paged_slice_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size239; + ::apache::thrift::protocol::TType _etype242; + iprot->readListBegin(_etype242, _size239); + (*(this->success)).resize(_size239); + uint32_t _i243; + for (_i243 = 0; _i243 < _size239; ++_i243) + { + xfer += (*(this->success))[_i243].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_indexed_slices_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_column_parent = false; + bool isset_index_clause = false; + bool isset_column_predicate = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->index_clause.read(iprot); + isset_index_clause = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_predicate.read(iprot); + isset_column_predicate = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast244; + xfer += iprot->readI32(ecast244); + this->consistency_level = (ConsistencyLevel::type)ecast244; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_index_clause) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_predicate) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_get_indexed_slices_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_indexed_slices_args"); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("index_clause", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->index_clause.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->column_predicate.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_indexed_slices_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_get_indexed_slices_pargs"); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("index_clause", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->index_clause)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->column_predicate)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_indexed_slices_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size245; + ::apache::thrift::protocol::TType _etype248; + iprot->readListBegin(_etype248, _size245); + this->success.resize(_size245); + uint32_t _i249; + for (_i249 = 0; _i249 < _size245; ++_i249) + { + xfer += this->success[_i249].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_get_indexed_slices_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_get_indexed_slices_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); + std::vector ::const_iterator _iter250; + for (_iter250 = this->success.begin(); _iter250 != this->success.end(); ++_iter250) + { + xfer += (*_iter250).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_get_indexed_slices_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size251; + ::apache::thrift::protocol::TType _etype254; + iprot->readListBegin(_etype254, _size251); + (*(this->success)).resize(_size251); + uint32_t _i255; + for (_i255 = 0; _i255 < _size251; ++_i255) + { + xfer += (*(this->success))[_i255].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_insert_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_column_parent = false; + bool isset_column = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column.read(iprot); + isset_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast256; + xfer += iprot->readI32(ecast256); + this->consistency_level = (ConsistencyLevel::type)ecast256; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_insert_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_insert_args"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->column.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_insert_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_insert_pargs"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->key))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->column)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_insert_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_insert_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_insert_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_insert_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_add_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_column_parent = false; + bool isset_column = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_parent.read(iprot); + isset_column_parent = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column.read(iprot); + isset_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast257; + xfer += iprot->readI32(ecast257); + this->consistency_level = (ConsistencyLevel::type)ecast257; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_parent) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_add_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_add_args"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_parent.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->column.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_add_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_add_pargs"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->key))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_parent", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_parent)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += (*(this->column)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_add_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_add_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_add_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_add_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_remove_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_column_path = false; + bool isset_timestamp = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_path.read(iprot); + isset_column_path = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->timestamp); + isset_timestamp = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast258; + xfer += iprot->readI32(ecast258); + this->consistency_level = (ConsistencyLevel::type)ecast258; + this->__isset.consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_column_path) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_timestamp) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_remove_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_remove_args"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_path", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->column_path.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 3); + xfer += oprot->writeI64(this->timestamp); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_remove_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_remove_pargs"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->key))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("column_path", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->column_path)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 3); + xfer += oprot->writeI64((*(this->timestamp))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_remove_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_remove_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_remove_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_remove_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_remove_counter_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_path = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->path.read(iprot); + isset_path = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast259; + xfer += iprot->readI32(ecast259); + this->consistency_level = (ConsistencyLevel::type)ecast259; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_path) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_remove_counter_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_remove_counter_args"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("path", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->path.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_remove_counter_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_remove_counter_pargs"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->key))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("path", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += (*(this->path)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_remove_counter_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_remove_counter_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_remove_counter_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_remove_counter_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_batch_mutate_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_mutation_map = false; + bool isset_consistency_level = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->mutation_map.clear(); + uint32_t _size260; + ::apache::thrift::protocol::TType _ktype261; + ::apache::thrift::protocol::TType _vtype262; + iprot->readMapBegin(_ktype261, _vtype262, _size260); + uint32_t _i264; + for (_i264 = 0; _i264 < _size260; ++_i264) + { + std::string _key265; + xfer += iprot->readBinary(_key265); + std::map > & _val266 = this->mutation_map[_key265]; + { + _val266.clear(); + uint32_t _size267; + ::apache::thrift::protocol::TType _ktype268; + ::apache::thrift::protocol::TType _vtype269; + iprot->readMapBegin(_ktype268, _vtype269, _size267); + uint32_t _i271; + for (_i271 = 0; _i271 < _size267; ++_i271) + { + std::string _key272; + xfer += iprot->readString(_key272); + std::vector & _val273 = _val266[_key272]; + { + _val273.clear(); + uint32_t _size274; + ::apache::thrift::protocol::TType _etype277; + iprot->readListBegin(_etype277, _size274); + _val273.resize(_size274); + uint32_t _i278; + for (_i278 = 0; _i278 < _size274; ++_i278) + { + xfer += _val273[_i278].read(iprot); + } + iprot->readListEnd(); + } + } + iprot->readMapEnd(); + } + } + iprot->readMapEnd(); + } + isset_mutation_map = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast279; + xfer += iprot->readI32(ecast279); + this->consistency_level = (ConsistencyLevel::type)ecast279; + isset_consistency_level = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_mutation_map) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_consistency_level) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_batch_mutate_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_batch_mutate_args"); + xfer += oprot->writeFieldBegin("mutation_map", ::apache::thrift::protocol::T_MAP, 1); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_MAP, static_cast(this->mutation_map.size())); + std::map > > ::const_iterator _iter280; + for (_iter280 = this->mutation_map.begin(); _iter280 != this->mutation_map.end(); ++_iter280) + { + xfer += oprot->writeBinary(_iter280->first); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast(_iter280->second.size())); + std::map > ::const_iterator _iter281; + for (_iter281 = _iter280->second.begin(); _iter281 != _iter280->second.end(); ++_iter281) + { + xfer += oprot->writeString(_iter281->first); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(_iter281->second.size())); + std::vector ::const_iterator _iter282; + for (_iter282 = _iter281->second.begin(); _iter282 != _iter281->second.end(); ++_iter282) + { + xfer += (*_iter282).write(oprot); + } + xfer += oprot->writeListEnd(); + } + } + xfer += oprot->writeMapEnd(); + } + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)this->consistency_level); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_batch_mutate_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_batch_mutate_pargs"); + xfer += oprot->writeFieldBegin("mutation_map", ::apache::thrift::protocol::T_MAP, 1); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_MAP, static_cast((*(this->mutation_map)).size())); + std::map > > ::const_iterator _iter283; + for (_iter283 = (*(this->mutation_map)).begin(); _iter283 != (*(this->mutation_map)).end(); ++_iter283) + { + xfer += oprot->writeBinary(_iter283->first); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast(_iter283->second.size())); + std::map > ::const_iterator _iter284; + for (_iter284 = _iter283->second.begin(); _iter284 != _iter283->second.end(); ++_iter284) + { + xfer += oprot->writeString(_iter284->first); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(_iter284->second.size())); + std::vector ::const_iterator _iter285; + for (_iter285 = _iter284->second.begin(); _iter285 != _iter284->second.end(); ++_iter285) + { + xfer += (*_iter285).write(oprot); + } + xfer += oprot->writeListEnd(); + } + } + xfer += oprot->writeMapEnd(); + } + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("consistency_level", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)(*(this->consistency_level))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_batch_mutate_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_batch_mutate_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_batch_mutate_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_batch_mutate_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_truncate_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_cfname = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->cfname); + isset_cfname = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_cfname) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_truncate_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_truncate_args"); + xfer += oprot->writeFieldBegin("cfname", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->cfname); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_truncate_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_truncate_pargs"); + xfer += oprot->writeFieldBegin("cfname", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->cfname))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_truncate_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_truncate_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_truncate_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_truncate_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_schema_versions_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_schema_versions_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_schema_versions_args"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_schema_versions_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_schema_versions_pargs"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_schema_versions_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->success.clear(); + uint32_t _size286; + ::apache::thrift::protocol::TType _ktype287; + ::apache::thrift::protocol::TType _vtype288; + iprot->readMapBegin(_ktype287, _vtype288, _size286); + uint32_t _i290; + for (_i290 = 0; _i290 < _size286; ++_i290) + { + std::string _key291; + xfer += iprot->readString(_key291); + std::vector & _val292 = this->success[_key291]; + { + _val292.clear(); + uint32_t _size293; + ::apache::thrift::protocol::TType _etype296; + iprot->readListBegin(_etype296, _size293); + _val292.resize(_size293); + uint32_t _i297; + for (_i297 = 0; _i297 < _size293; ++_i297) + { + xfer += iprot->readString(_val292[_i297]); + } + iprot->readListEnd(); + } + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_schema_versions_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_schema_versions_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_MAP, 0); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast(this->success.size())); + std::map > ::const_iterator _iter298; + for (_iter298 = this->success.begin(); _iter298 != this->success.end(); ++_iter298) + { + xfer += oprot->writeString(_iter298->first); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(_iter298->second.size())); + std::vector ::const_iterator _iter299; + for (_iter299 = _iter298->second.begin(); _iter299 != _iter298->second.end(); ++_iter299) + { + xfer += oprot->writeString((*_iter299)); + } + xfer += oprot->writeListEnd(); + } + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_schema_versions_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + (*(this->success)).clear(); + uint32_t _size300; + ::apache::thrift::protocol::TType _ktype301; + ::apache::thrift::protocol::TType _vtype302; + iprot->readMapBegin(_ktype301, _vtype302, _size300); + uint32_t _i304; + for (_i304 = 0; _i304 < _size300; ++_i304) + { + std::string _key305; + xfer += iprot->readString(_key305); + std::vector & _val306 = (*(this->success))[_key305]; + { + _val306.clear(); + uint32_t _size307; + ::apache::thrift::protocol::TType _etype310; + iprot->readListBegin(_etype310, _size307); + _val306.resize(_size307); + uint32_t _i311; + for (_i311 = 0; _i311 < _size307; ++_i311) + { + xfer += iprot->readString(_val306[_i311]); + } + iprot->readListEnd(); + } + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_keyspaces_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_keyspaces_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_keyspaces_args"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_keyspaces_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_keyspaces_pargs"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_keyspaces_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size312; + ::apache::thrift::protocol::TType _etype315; + iprot->readListBegin(_etype315, _size312); + this->success.resize(_size312); + uint32_t _i316; + for (_i316 = 0; _i316 < _size312; ++_i316) + { + xfer += this->success[_i316].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_keyspaces_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_keyspaces_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); + std::vector ::const_iterator _iter317; + for (_iter317 = this->success.begin(); _iter317 != this->success.end(); ++_iter317) + { + xfer += (*_iter317).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_keyspaces_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size318; + ::apache::thrift::protocol::TType _etype321; + iprot->readListBegin(_etype321, _size318); + (*(this->success)).resize(_size318); + uint32_t _i322; + for (_i322 = 0; _i322 < _size318; ++_i322) + { + xfer += (*(this->success))[_i322].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_cluster_name_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_cluster_name_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_cluster_name_args"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_cluster_name_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_cluster_name_pargs"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_cluster_name_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_cluster_name_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_cluster_name_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_cluster_name_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_version_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_version_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_version_args"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_version_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_version_pargs"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_version_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_version_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_version_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_version_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_ring_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_keyspace = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->keyspace); + isset_keyspace = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_keyspace) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_describe_ring_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_ring_args"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->keyspace); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_ring_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_ring_pargs"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->keyspace))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_ring_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size323; + ::apache::thrift::protocol::TType _etype326; + iprot->readListBegin(_etype326, _size323); + this->success.resize(_size323); + uint32_t _i327; + for (_i327 = 0; _i327 < _size323; ++_i327) + { + xfer += this->success[_i327].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_ring_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_ring_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); + std::vector ::const_iterator _iter328; + for (_iter328 = this->success.begin(); _iter328 != this->success.end(); ++_iter328) + { + xfer += (*_iter328).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_ring_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size329; + ::apache::thrift::protocol::TType _etype332; + iprot->readListBegin(_etype332, _size329); + (*(this->success)).resize(_size329); + uint32_t _i333; + for (_i333 = 0; _i333 < _size329; ++_i333) + { + xfer += (*(this->success))[_i333].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_token_map_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_token_map_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_token_map_args"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_token_map_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_token_map_pargs"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_token_map_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->success.clear(); + uint32_t _size334; + ::apache::thrift::protocol::TType _ktype335; + ::apache::thrift::protocol::TType _vtype336; + iprot->readMapBegin(_ktype335, _vtype336, _size334); + uint32_t _i338; + for (_i338 = 0; _i338 < _size334; ++_i338) + { + std::string _key339; + xfer += iprot->readString(_key339); + std::string& _val340 = this->success[_key339]; + xfer += iprot->readString(_val340); + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_token_map_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_token_map_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_MAP, 0); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->success.size())); + std::map ::const_iterator _iter341; + for (_iter341 = this->success.begin(); _iter341 != this->success.end(); ++_iter341) + { + xfer += oprot->writeString(_iter341->first); + xfer += oprot->writeString(_iter341->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_token_map_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + (*(this->success)).clear(); + uint32_t _size342; + ::apache::thrift::protocol::TType _ktype343; + ::apache::thrift::protocol::TType _vtype344; + iprot->readMapBegin(_ktype343, _vtype344, _size342); + uint32_t _i346; + for (_i346 = 0; _i346 < _size342; ++_i346) + { + std::string _key347; + xfer += iprot->readString(_key347); + std::string& _val348 = (*(this->success))[_key347]; + xfer += iprot->readString(_val348); + } + iprot->readMapEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_partitioner_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_partitioner_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_partitioner_args"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_partitioner_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_partitioner_pargs"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_partitioner_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_partitioner_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_partitioner_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_partitioner_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_snitch_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_snitch_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_snitch_args"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_snitch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_snitch_pargs"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_snitch_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_snitch_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_snitch_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_snitch_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_keyspace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_keyspace = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->keyspace); + isset_keyspace = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_keyspace) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_describe_keyspace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_keyspace_args"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->keyspace); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_keyspace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_keyspace_pargs"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->keyspace))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_keyspace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->nfe.read(iprot); + this->__isset.nfe = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_keyspace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_keyspace_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.nfe) { + xfer += oprot->writeFieldBegin("nfe", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->nfe.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_keyspace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->nfe.read(iprot); + this->__isset.nfe = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_splits_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_cfName = false; + bool isset_start_token = false; + bool isset_end_token = false; + bool isset_keys_per_split = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->cfName); + isset_cfName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->start_token); + isset_start_token = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->end_token); + isset_end_token = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->keys_per_split); + isset_keys_per_split = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_cfName) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_start_token) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_end_token) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_keys_per_split) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_describe_splits_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_splits_args"); + xfer += oprot->writeFieldBegin("cfName", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->cfName); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("start_token", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->start_token); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("end_token", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->end_token); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("keys_per_split", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32(this->keys_per_split); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_splits_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_describe_splits_pargs"); + xfer += oprot->writeFieldBegin("cfName", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->cfName))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("start_token", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString((*(this->start_token))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("end_token", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString((*(this->end_token))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("keys_per_split", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32((*(this->keys_per_split))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_splits_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size349; + ::apache::thrift::protocol::TType _etype352; + iprot->readListBegin(_etype352, _size349); + this->success.resize(_size349); + uint32_t _i353; + for (_i353 = 0; _i353 < _size349; ++_i353) + { + xfer += iprot->readString(this->success[_i353]); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_describe_splits_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_describe_splits_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->success.size())); + std::vector ::const_iterator _iter354; + for (_iter354 = this->success.begin(); _iter354 != this->success.end(); ++_iter354) + { + xfer += oprot->writeString((*_iter354)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_describe_splits_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size355; + ::apache::thrift::protocol::TType _etype358; + iprot->readListBegin(_etype358, _size355); + (*(this->success)).resize(_size355); + uint32_t _i359; + for (_i359 = 0; _i359 < _size355; ++_i359) + { + xfer += iprot->readString((*(this->success))[_i359]); + } + iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_add_column_family_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_cf_def = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->cf_def.read(iprot); + isset_cf_def = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_cf_def) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_system_add_column_family_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_add_column_family_args"); + xfer += oprot->writeFieldBegin("cf_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->cf_def.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_add_column_family_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_add_column_family_pargs"); + xfer += oprot->writeFieldBegin("cf_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->cf_def)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_add_column_family_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_add_column_family_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_system_add_column_family_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_add_column_family_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_drop_column_family_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_column_family = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->column_family); + isset_column_family = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_column_family) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_system_drop_column_family_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_drop_column_family_args"); + xfer += oprot->writeFieldBegin("column_family", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->column_family); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_drop_column_family_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_drop_column_family_pargs"); + xfer += oprot->writeFieldBegin("column_family", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->column_family))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_drop_column_family_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_drop_column_family_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_system_drop_column_family_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_drop_column_family_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_add_keyspace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_ks_def = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ks_def.read(iprot); + isset_ks_def = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_ks_def) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_system_add_keyspace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_add_keyspace_args"); + xfer += oprot->writeFieldBegin("ks_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ks_def.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_add_keyspace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_add_keyspace_pargs"); + xfer += oprot->writeFieldBegin("ks_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->ks_def)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_add_keyspace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_add_keyspace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_system_add_keyspace_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_add_keyspace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_drop_keyspace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_keyspace = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->keyspace); + isset_keyspace = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_keyspace) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_system_drop_keyspace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_drop_keyspace_args"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->keyspace); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_drop_keyspace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_drop_keyspace_pargs"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->keyspace))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_drop_keyspace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_drop_keyspace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_system_drop_keyspace_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_drop_keyspace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_update_keyspace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_ks_def = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ks_def.read(iprot); + isset_ks_def = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_ks_def) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_system_update_keyspace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_update_keyspace_args"); + xfer += oprot->writeFieldBegin("ks_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ks_def.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_update_keyspace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_update_keyspace_pargs"); + xfer += oprot->writeFieldBegin("ks_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->ks_def)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_update_keyspace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_update_keyspace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_system_update_keyspace_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_update_keyspace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_update_column_family_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_cf_def = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->cf_def.read(iprot); + isset_cf_def = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_cf_def) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_system_update_column_family_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_update_column_family_args"); + xfer += oprot->writeFieldBegin("cf_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->cf_def.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_update_column_family_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_system_update_column_family_pargs"); + xfer += oprot->writeFieldBegin("cf_def", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->cf_def)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_update_column_family_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_system_update_column_family_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_system_update_column_family_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_system_update_column_family_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_execute_cql_query_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_query = false; + bool isset_compression = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->query); + isset_query = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast360; + xfer += iprot->readI32(ecast360); + this->compression = (Compression::type)ecast360; + isset_compression = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_query) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_compression) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_execute_cql_query_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_execute_cql_query_args"); + xfer += oprot->writeFieldBegin("query", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->query); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("compression", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)this->compression); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_execute_cql_query_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_execute_cql_query_pargs"); + xfer += oprot->writeFieldBegin("query", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->query))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("compression", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)(*(this->compression))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_execute_cql_query_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_execute_cql_query_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_execute_cql_query_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_execute_cql_query_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_prepare_cql_query_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_query = false; + bool isset_compression = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->query); + isset_query = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast361; + xfer += iprot->readI32(ecast361); + this->compression = (Compression::type)ecast361; + isset_compression = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_query) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_compression) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_prepare_cql_query_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_prepare_cql_query_args"); + xfer += oprot->writeFieldBegin("query", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->query); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("compression", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)this->compression); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_prepare_cql_query_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_prepare_cql_query_pargs"); + xfer += oprot->writeFieldBegin("query", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary((*(this->query))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("compression", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)(*(this->compression))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_prepare_cql_query_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_prepare_cql_query_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_prepare_cql_query_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_prepare_cql_query_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_execute_prepared_cql_query_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_itemId = false; + bool isset_values = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->itemId); + isset_itemId = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size362; + ::apache::thrift::protocol::TType _etype365; + iprot->readListBegin(_etype365, _size362); + this->values.resize(_size362); + uint32_t _i366; + for (_i366 = 0; _i366 < _size362; ++_i366) + { + xfer += iprot->readBinary(this->values[_i366]); + } + iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_itemId) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_execute_prepared_cql_query_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_execute_prepared_cql_query_args"); + xfer += oprot->writeFieldBegin("itemId", ::apache::thrift::protocol::T_I32, 1); + xfer += oprot->writeI32(this->itemId); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 2); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->values.size())); + std::vector ::const_iterator _iter367; + for (_iter367 = this->values.begin(); _iter367 != this->values.end(); ++_iter367) + { + xfer += oprot->writeBinary((*_iter367)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_execute_prepared_cql_query_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_execute_prepared_cql_query_pargs"); + xfer += oprot->writeFieldBegin("itemId", ::apache::thrift::protocol::T_I32, 1); + xfer += oprot->writeI32((*(this->itemId))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 2); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast((*(this->values)).size())); + std::vector ::const_iterator _iter368; + for (_iter368 = (*(this->values)).begin(); _iter368 != (*(this->values)).end(); ++_iter368) + { + xfer += oprot->writeBinary((*_iter368)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_execute_prepared_cql_query_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_execute_prepared_cql_query_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_execute_prepared_cql_query_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ue) { + xfer += oprot->writeFieldBegin("ue", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ue.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.te) { + xfer += oprot->writeFieldBegin("te", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->te.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.sde) { + xfer += oprot->writeFieldBegin("sde", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->sde.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_execute_prepared_cql_query_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ue.read(iprot); + this->__isset.ue = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->te.read(iprot); + this->__isset.te = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->sde.read(iprot); + this->__isset.sde = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_set_cql_version_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_version = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->version); + isset_version = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_version) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Cassandra_set_cql_version_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_set_cql_version_args"); + xfer += oprot->writeFieldBegin("version", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->version); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_set_cql_version_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Cassandra_set_cql_version_pargs"); + xfer += oprot->writeFieldBegin("version", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->version))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_set_cql_version_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Cassandra_set_cql_version_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Cassandra_set_cql_version_result"); + + if (this->__isset.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t Cassandra_set_cql_version_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +void CassandraClient::login(const AuthenticationRequest& auth_request) +{ + send_login(auth_request); + recv_login(); +} + +void CassandraClient::send_login(const AuthenticationRequest& auth_request) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("login", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_login_pargs args; + args.auth_request = &auth_request; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_login() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("login") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_login_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.authnx) { + throw result.authnx; + } + if (result.__isset.authzx) { + throw result.authzx; + } + return; +} + +void CassandraClient::set_keyspace(const std::string& keyspace) +{ + send_set_keyspace(keyspace); + recv_set_keyspace(); +} + +void CassandraClient::send_set_keyspace(const std::string& keyspace) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("set_keyspace", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_set_keyspace_pargs args; + args.keyspace = &keyspace; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_set_keyspace() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("set_keyspace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_set_keyspace_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + return; +} + +void CassandraClient::get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) +{ + send_get(key, column_path, consistency_level); + recv_get(_return); +} + +void CassandraClient::send_get(const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_get_pargs args; + args.key = &key; + args.column_path = &column_path; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_get(ColumnOrSuperColumn& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("get") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_get_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.nfe) { + throw result.nfe; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get failed: unknown result"); +} + +void CassandraClient::get_slice(std::vector & _return, const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + send_get_slice(key, column_parent, predicate, consistency_level); + recv_get_slice(_return); +} + +void CassandraClient::send_get_slice(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get_slice", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_get_slice_pargs args; + args.key = &key; + args.column_parent = &column_parent; + args.predicate = &predicate; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_get_slice(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("get_slice") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_get_slice_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_slice failed: unknown result"); +} + +int32_t CassandraClient::get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + send_get_count(key, column_parent, predicate, consistency_level); + return recv_get_count(); +} + +void CassandraClient::send_get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get_count", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_get_count_pargs args; + args.key = &key; + args.column_parent = &column_parent; + args.predicate = &predicate; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +int32_t CassandraClient::recv_get_count() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("get_count") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + int32_t _return; + Cassandra_get_count_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + return _return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_count failed: unknown result"); +} + +void CassandraClient::multiget_slice(std::map > & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + send_multiget_slice(keys, column_parent, predicate, consistency_level); + recv_multiget_slice(_return); +} + +void CassandraClient::send_multiget_slice(const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("multiget_slice", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_multiget_slice_pargs args; + args.keys = &keys; + args.column_parent = &column_parent; + args.predicate = &predicate; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_multiget_slice(std::map > & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("multiget_slice") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_multiget_slice_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "multiget_slice failed: unknown result"); +} + +void CassandraClient::multiget_count(std::map & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + send_multiget_count(keys, column_parent, predicate, consistency_level); + recv_multiget_count(_return); +} + +void CassandraClient::send_multiget_count(const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("multiget_count", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_multiget_count_pargs args; + args.keys = &keys; + args.column_parent = &column_parent; + args.predicate = &predicate; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_multiget_count(std::map & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("multiget_count") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_multiget_count_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "multiget_count failed: unknown result"); +} + +void CassandraClient::get_range_slices(std::vector & _return, const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level) +{ + send_get_range_slices(column_parent, predicate, range, consistency_level); + recv_get_range_slices(_return); +} + +void CassandraClient::send_get_range_slices(const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get_range_slices", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_get_range_slices_pargs args; + args.column_parent = &column_parent; + args.predicate = &predicate; + args.range = ⦥ + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_get_range_slices(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("get_range_slices") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_get_range_slices_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_range_slices failed: unknown result"); +} + +void CassandraClient::get_paged_slice(std::vector & _return, const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level) +{ + send_get_paged_slice(column_family, range, start_column, consistency_level); + recv_get_paged_slice(_return); +} + +void CassandraClient::send_get_paged_slice(const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get_paged_slice", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_get_paged_slice_pargs args; + args.column_family = &column_family; + args.range = ⦥ + args.start_column = &start_column; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_get_paged_slice(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("get_paged_slice") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_get_paged_slice_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_paged_slice failed: unknown result"); +} + +void CassandraClient::get_indexed_slices(std::vector & _return, const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level) +{ + send_get_indexed_slices(column_parent, index_clause, column_predicate, consistency_level); + recv_get_indexed_slices(_return); +} + +void CassandraClient::send_get_indexed_slices(const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get_indexed_slices", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_get_indexed_slices_pargs args; + args.column_parent = &column_parent; + args.index_clause = &index_clause; + args.column_predicate = &column_predicate; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_get_indexed_slices(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("get_indexed_slices") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_get_indexed_slices_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_indexed_slices failed: unknown result"); +} + +void CassandraClient::insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) +{ + send_insert(key, column_parent, column, consistency_level); + recv_insert(); +} + +void CassandraClient::send_insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("insert", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_insert_pargs args; + args.key = &key; + args.column_parent = &column_parent; + args.column = &column; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_insert() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("insert") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_insert_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + return; +} + +void CassandraClient::add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) +{ + send_add(key, column_parent, column, consistency_level); + recv_add(); +} + +void CassandraClient::send_add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("add", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_add_pargs args; + args.key = &key; + args.column_parent = &column_parent; + args.column = &column; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_add() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("add") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_add_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + return; +} + +void CassandraClient::remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level) +{ + send_remove(key, column_path, timestamp, consistency_level); + recv_remove(); +} + +void CassandraClient::send_remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("remove", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_remove_pargs args; + args.key = &key; + args.column_path = &column_path; + args.timestamp = ×tamp; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_remove() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("remove") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_remove_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + return; +} + +void CassandraClient::remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level) +{ + send_remove_counter(key, path, consistency_level); + recv_remove_counter(); +} + +void CassandraClient::send_remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("remove_counter", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_remove_counter_pargs args; + args.key = &key; + args.path = &path; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_remove_counter() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("remove_counter") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_remove_counter_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + return; +} + +void CassandraClient::batch_mutate(const std::map > > & mutation_map, const ConsistencyLevel::type consistency_level) +{ + send_batch_mutate(mutation_map, consistency_level); + recv_batch_mutate(); +} + +void CassandraClient::send_batch_mutate(const std::map > > & mutation_map, const ConsistencyLevel::type consistency_level) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("batch_mutate", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_batch_mutate_pargs args; + args.mutation_map = &mutation_map; + args.consistency_level = &consistency_level; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_batch_mutate() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("batch_mutate") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_batch_mutate_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + return; +} + +void CassandraClient::truncate(const std::string& cfname) +{ + send_truncate(cfname); + recv_truncate(); +} + +void CassandraClient::send_truncate(const std::string& cfname) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("truncate", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_truncate_pargs args; + args.cfname = &cfname; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_truncate() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("truncate") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_truncate_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + return; +} + +void CassandraClient::describe_schema_versions(std::map > & _return) +{ + send_describe_schema_versions(); + recv_describe_schema_versions(_return); +} + +void CassandraClient::send_describe_schema_versions() +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_schema_versions", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_schema_versions_pargs args; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_schema_versions(std::map > & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_schema_versions") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_schema_versions_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_schema_versions failed: unknown result"); +} + +void CassandraClient::describe_keyspaces(std::vector & _return) +{ + send_describe_keyspaces(); + recv_describe_keyspaces(_return); +} + +void CassandraClient::send_describe_keyspaces() +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_keyspaces", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_keyspaces_pargs args; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_keyspaces(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_keyspaces") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_keyspaces_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_keyspaces failed: unknown result"); +} + +void CassandraClient::describe_cluster_name(std::string& _return) +{ + send_describe_cluster_name(); + recv_describe_cluster_name(_return); +} + +void CassandraClient::send_describe_cluster_name() +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_cluster_name", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_cluster_name_pargs args; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_cluster_name(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_cluster_name") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_cluster_name_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_cluster_name failed: unknown result"); +} + +void CassandraClient::describe_version(std::string& _return) +{ + send_describe_version(); + recv_describe_version(_return); +} + +void CassandraClient::send_describe_version() +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_version", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_version_pargs args; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_version(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_version") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_version_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_version failed: unknown result"); +} + +void CassandraClient::describe_ring(std::vector & _return, const std::string& keyspace) +{ + send_describe_ring(keyspace); + recv_describe_ring(_return); +} + +void CassandraClient::send_describe_ring(const std::string& keyspace) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_ring", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_ring_pargs args; + args.keyspace = &keyspace; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_ring(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_ring") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_ring_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_ring failed: unknown result"); +} + +void CassandraClient::describe_token_map(std::map & _return) +{ + send_describe_token_map(); + recv_describe_token_map(_return); +} + +void CassandraClient::send_describe_token_map() +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_token_map", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_token_map_pargs args; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_token_map(std::map & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_token_map") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_token_map_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_token_map failed: unknown result"); +} + +void CassandraClient::describe_partitioner(std::string& _return) +{ + send_describe_partitioner(); + recv_describe_partitioner(_return); +} + +void CassandraClient::send_describe_partitioner() +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_partitioner", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_partitioner_pargs args; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_partitioner(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_partitioner") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_partitioner_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_partitioner failed: unknown result"); +} + +void CassandraClient::describe_snitch(std::string& _return) +{ + send_describe_snitch(); + recv_describe_snitch(_return); +} + +void CassandraClient::send_describe_snitch() +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_snitch", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_snitch_pargs args; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_snitch(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_snitch") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_snitch_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_snitch failed: unknown result"); +} + +void CassandraClient::describe_keyspace(KsDef& _return, const std::string& keyspace) +{ + send_describe_keyspace(keyspace); + recv_describe_keyspace(_return); +} + +void CassandraClient::send_describe_keyspace(const std::string& keyspace) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_keyspace", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_keyspace_pargs args; + args.keyspace = &keyspace; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_keyspace(KsDef& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_keyspace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_keyspace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.nfe) { + throw result.nfe; + } + if (result.__isset.ire) { + throw result.ire; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_keyspace failed: unknown result"); +} + +void CassandraClient::describe_splits(std::vector & _return, const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split) +{ + send_describe_splits(cfName, start_token, end_token, keys_per_split); + recv_describe_splits(_return); +} + +void CassandraClient::send_describe_splits(const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("describe_splits", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_describe_splits_pargs args; + args.cfName = &cfName; + args.start_token = &start_token; + args.end_token = &end_token; + args.keys_per_split = &keys_per_split; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_describe_splits(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("describe_splits") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_describe_splits_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "describe_splits failed: unknown result"); +} + +void CassandraClient::system_add_column_family(std::string& _return, const CfDef& cf_def) +{ + send_system_add_column_family(cf_def); + recv_system_add_column_family(_return); +} + +void CassandraClient::send_system_add_column_family(const CfDef& cf_def) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("system_add_column_family", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_system_add_column_family_pargs args; + args.cf_def = &cf_def; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_system_add_column_family(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("system_add_column_family") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_system_add_column_family_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "system_add_column_family failed: unknown result"); +} + +void CassandraClient::system_drop_column_family(std::string& _return, const std::string& column_family) +{ + send_system_drop_column_family(column_family); + recv_system_drop_column_family(_return); +} + +void CassandraClient::send_system_drop_column_family(const std::string& column_family) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("system_drop_column_family", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_system_drop_column_family_pargs args; + args.column_family = &column_family; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_system_drop_column_family(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("system_drop_column_family") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_system_drop_column_family_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "system_drop_column_family failed: unknown result"); +} + +void CassandraClient::system_add_keyspace(std::string& _return, const KsDef& ks_def) +{ + send_system_add_keyspace(ks_def); + recv_system_add_keyspace(_return); +} + +void CassandraClient::send_system_add_keyspace(const KsDef& ks_def) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("system_add_keyspace", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_system_add_keyspace_pargs args; + args.ks_def = &ks_def; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_system_add_keyspace(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("system_add_keyspace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_system_add_keyspace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "system_add_keyspace failed: unknown result"); +} + +void CassandraClient::system_drop_keyspace(std::string& _return, const std::string& keyspace) +{ + send_system_drop_keyspace(keyspace); + recv_system_drop_keyspace(_return); +} + +void CassandraClient::send_system_drop_keyspace(const std::string& keyspace) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("system_drop_keyspace", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_system_drop_keyspace_pargs args; + args.keyspace = &keyspace; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_system_drop_keyspace(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("system_drop_keyspace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_system_drop_keyspace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "system_drop_keyspace failed: unknown result"); +} + +void CassandraClient::system_update_keyspace(std::string& _return, const KsDef& ks_def) +{ + send_system_update_keyspace(ks_def); + recv_system_update_keyspace(_return); +} + +void CassandraClient::send_system_update_keyspace(const KsDef& ks_def) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("system_update_keyspace", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_system_update_keyspace_pargs args; + args.ks_def = &ks_def; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_system_update_keyspace(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("system_update_keyspace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_system_update_keyspace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "system_update_keyspace failed: unknown result"); +} + +void CassandraClient::system_update_column_family(std::string& _return, const CfDef& cf_def) +{ + send_system_update_column_family(cf_def); + recv_system_update_column_family(_return); +} + +void CassandraClient::send_system_update_column_family(const CfDef& cf_def) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("system_update_column_family", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_system_update_column_family_pargs args; + args.cf_def = &cf_def; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_system_update_column_family(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("system_update_column_family") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_system_update_column_family_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "system_update_column_family failed: unknown result"); +} + +void CassandraClient::execute_cql_query(CqlResult& _return, const std::string& query, const Compression::type compression) +{ + send_execute_cql_query(query, compression); + recv_execute_cql_query(_return); +} + +void CassandraClient::send_execute_cql_query(const std::string& query, const Compression::type compression) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("execute_cql_query", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_execute_cql_query_pargs args; + args.query = &query; + args.compression = &compression; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_execute_cql_query(CqlResult& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("execute_cql_query") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_execute_cql_query_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "execute_cql_query failed: unknown result"); +} + +void CassandraClient::prepare_cql_query(CqlPreparedResult& _return, const std::string& query, const Compression::type compression) +{ + send_prepare_cql_query(query, compression); + recv_prepare_cql_query(_return); +} + +void CassandraClient::send_prepare_cql_query(const std::string& query, const Compression::type compression) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("prepare_cql_query", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_prepare_cql_query_pargs args; + args.query = &query; + args.compression = &compression; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_prepare_cql_query(CqlPreparedResult& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("prepare_cql_query") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_prepare_cql_query_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "prepare_cql_query failed: unknown result"); +} + +void CassandraClient::execute_prepared_cql_query(CqlResult& _return, const int32_t itemId, const std::vector & values) +{ + send_execute_prepared_cql_query(itemId, values); + recv_execute_prepared_cql_query(_return); +} + +void CassandraClient::send_execute_prepared_cql_query(const int32_t itemId, const std::vector & values) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("execute_prepared_cql_query", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_execute_prepared_cql_query_pargs args; + args.itemId = &itemId; + args.values = &values; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_execute_prepared_cql_query(CqlResult& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("execute_prepared_cql_query") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_execute_prepared_cql_query_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.ire) { + throw result.ire; + } + if (result.__isset.ue) { + throw result.ue; + } + if (result.__isset.te) { + throw result.te; + } + if (result.__isset.sde) { + throw result.sde; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "execute_prepared_cql_query failed: unknown result"); +} + +void CassandraClient::set_cql_version(const std::string& version) +{ + send_set_cql_version(version); + recv_set_cql_version(); +} + +void CassandraClient::send_set_cql_version(const std::string& version) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("set_cql_version", ::apache::thrift::protocol::T_CALL, cseqid); + + Cassandra_set_cql_version_pargs args; + args.version = &version; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void CassandraClient::recv_set_cql_version() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("set_cql_version") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Cassandra_set_cql_version_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.ire) { + throw result.ire; + } + return; +} + +bool CassandraProcessor::process(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot, void* callContext) { + + ::apache::thrift::protocol::TProtocol* iprot = piprot.get(); + ::apache::thrift::protocol::TProtocol* oprot = poprot.get(); + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + int32_t seqid; + + iprot->readMessageBegin(fname, mtype, seqid); + + if (mtype != ::apache::thrift::protocol::T_CALL && mtype != ::apache::thrift::protocol::T_ONEWAY) { + iprot->skip(::apache::thrift::protocol::T_STRUCT); + iprot->readMessageEnd(); + iprot->getTransport()->readEnd(); + ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::INVALID_MESSAGE_TYPE); + oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return true; + } + + return process_fn(iprot, oprot, fname, seqid, callContext); +} + +bool CassandraProcessor::process_fn( ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, std::string& fname, int32_t seqid, void* callContext) { + std::map::iterator pfn; + pfn = processMap_.find(fname); + if (pfn == processMap_.end()) { + iprot->skip(::apache::thrift::protocol::T_STRUCT); + iprot->readMessageEnd(); + iprot->getTransport()->readEnd(); + ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'"); + oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return true; + } + (this->*(pfn->second))(seqid, iprot, oprot, callContext); + return true; +} + +void CassandraProcessor::process_login(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.login", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.login"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.login"); + } + + Cassandra_login_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.login", bytes); + } + + Cassandra_login_result result; + try { + iface_->login(args.auth_request); + } catch (AuthenticationException &authnx) { + result.authnx = authnx; + result.__isset.authnx = true; + } catch (AuthorizationException &authzx) { + result.authzx = authzx; + result.__isset.authzx = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.login"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("login", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.login"); + } + + oprot->writeMessageBegin("login", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.login", bytes); + } +} + +void CassandraProcessor::process_set_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.set_keyspace", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.set_keyspace"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.set_keyspace"); + } + + Cassandra_set_keyspace_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.set_keyspace", bytes); + } + + Cassandra_set_keyspace_result result; + try { + iface_->set_keyspace(args.keyspace); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.set_keyspace"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("set_keyspace", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.set_keyspace"); + } + + oprot->writeMessageBegin("set_keyspace", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.set_keyspace", bytes); + } +} + +void CassandraProcessor::process_get(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.get", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.get"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.get"); + } + + Cassandra_get_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.get", bytes); + } + + Cassandra_get_result result; + try { + iface_->get(result.success, args.key, args.column_path, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (NotFoundException &nfe) { + result.nfe = nfe; + result.__isset.nfe = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.get"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.get"); + } + + oprot->writeMessageBegin("get", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.get", bytes); + } +} + +void CassandraProcessor::process_get_slice(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.get_slice", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.get_slice"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.get_slice"); + } + + Cassandra_get_slice_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.get_slice", bytes); + } + + Cassandra_get_slice_result result; + try { + iface_->get_slice(result.success, args.key, args.column_parent, args.predicate, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.get_slice"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get_slice", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.get_slice"); + } + + oprot->writeMessageBegin("get_slice", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.get_slice", bytes); + } +} + +void CassandraProcessor::process_get_count(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.get_count", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.get_count"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.get_count"); + } + + Cassandra_get_count_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.get_count", bytes); + } + + Cassandra_get_count_result result; + try { + result.success = iface_->get_count(args.key, args.column_parent, args.predicate, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.get_count"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get_count", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.get_count"); + } + + oprot->writeMessageBegin("get_count", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.get_count", bytes); + } +} + +void CassandraProcessor::process_multiget_slice(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.multiget_slice", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.multiget_slice"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.multiget_slice"); + } + + Cassandra_multiget_slice_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.multiget_slice", bytes); + } + + Cassandra_multiget_slice_result result; + try { + iface_->multiget_slice(result.success, args.keys, args.column_parent, args.predicate, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.multiget_slice"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("multiget_slice", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.multiget_slice"); + } + + oprot->writeMessageBegin("multiget_slice", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.multiget_slice", bytes); + } +} + +void CassandraProcessor::process_multiget_count(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.multiget_count", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.multiget_count"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.multiget_count"); + } + + Cassandra_multiget_count_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.multiget_count", bytes); + } + + Cassandra_multiget_count_result result; + try { + iface_->multiget_count(result.success, args.keys, args.column_parent, args.predicate, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.multiget_count"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("multiget_count", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.multiget_count"); + } + + oprot->writeMessageBegin("multiget_count", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.multiget_count", bytes); + } +} + +void CassandraProcessor::process_get_range_slices(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.get_range_slices", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.get_range_slices"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.get_range_slices"); + } + + Cassandra_get_range_slices_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.get_range_slices", bytes); + } + + Cassandra_get_range_slices_result result; + try { + iface_->get_range_slices(result.success, args.column_parent, args.predicate, args.range, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.get_range_slices"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get_range_slices", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.get_range_slices"); + } + + oprot->writeMessageBegin("get_range_slices", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.get_range_slices", bytes); + } +} + +void CassandraProcessor::process_get_paged_slice(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.get_paged_slice", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.get_paged_slice"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.get_paged_slice"); + } + + Cassandra_get_paged_slice_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.get_paged_slice", bytes); + } + + Cassandra_get_paged_slice_result result; + try { + iface_->get_paged_slice(result.success, args.column_family, args.range, args.start_column, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.get_paged_slice"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get_paged_slice", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.get_paged_slice"); + } + + oprot->writeMessageBegin("get_paged_slice", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.get_paged_slice", bytes); + } +} + +void CassandraProcessor::process_get_indexed_slices(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.get_indexed_slices", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.get_indexed_slices"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.get_indexed_slices"); + } + + Cassandra_get_indexed_slices_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.get_indexed_slices", bytes); + } + + Cassandra_get_indexed_slices_result result; + try { + iface_->get_indexed_slices(result.success, args.column_parent, args.index_clause, args.column_predicate, args.consistency_level); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.get_indexed_slices"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get_indexed_slices", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.get_indexed_slices"); + } + + oprot->writeMessageBegin("get_indexed_slices", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.get_indexed_slices", bytes); + } +} + +void CassandraProcessor::process_insert(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.insert", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.insert"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.insert"); + } + + Cassandra_insert_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.insert", bytes); + } + + Cassandra_insert_result result; + try { + iface_->insert(args.key, args.column_parent, args.column, args.consistency_level); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.insert"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("insert", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.insert"); + } + + oprot->writeMessageBegin("insert", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.insert", bytes); + } +} + +void CassandraProcessor::process_add(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.add", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.add"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.add"); + } + + Cassandra_add_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.add", bytes); + } + + Cassandra_add_result result; + try { + iface_->add(args.key, args.column_parent, args.column, args.consistency_level); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.add"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("add", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.add"); + } + + oprot->writeMessageBegin("add", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.add", bytes); + } +} + +void CassandraProcessor::process_remove(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.remove", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.remove"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.remove"); + } + + Cassandra_remove_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.remove", bytes); + } + + Cassandra_remove_result result; + try { + iface_->remove(args.key, args.column_path, args.timestamp, args.consistency_level); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.remove"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("remove", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.remove"); + } + + oprot->writeMessageBegin("remove", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.remove", bytes); + } +} + +void CassandraProcessor::process_remove_counter(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.remove_counter", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.remove_counter"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.remove_counter"); + } + + Cassandra_remove_counter_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.remove_counter", bytes); + } + + Cassandra_remove_counter_result result; + try { + iface_->remove_counter(args.key, args.path, args.consistency_level); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.remove_counter"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("remove_counter", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.remove_counter"); + } + + oprot->writeMessageBegin("remove_counter", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.remove_counter", bytes); + } +} + +void CassandraProcessor::process_batch_mutate(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.batch_mutate", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.batch_mutate"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.batch_mutate"); + } + + Cassandra_batch_mutate_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.batch_mutate", bytes); + } + + Cassandra_batch_mutate_result result; + try { + iface_->batch_mutate(args.mutation_map, args.consistency_level); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.batch_mutate"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("batch_mutate", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.batch_mutate"); + } + + oprot->writeMessageBegin("batch_mutate", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.batch_mutate", bytes); + } +} + +void CassandraProcessor::process_truncate(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.truncate", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.truncate"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.truncate"); + } + + Cassandra_truncate_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.truncate", bytes); + } + + Cassandra_truncate_result result; + try { + iface_->truncate(args.cfname); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.truncate"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("truncate", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.truncate"); + } + + oprot->writeMessageBegin("truncate", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.truncate", bytes); + } +} + +void CassandraProcessor::process_describe_schema_versions(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_schema_versions", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_schema_versions"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_schema_versions"); + } + + Cassandra_describe_schema_versions_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_schema_versions", bytes); + } + + Cassandra_describe_schema_versions_result result; + try { + iface_->describe_schema_versions(result.success); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_schema_versions"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_schema_versions", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_schema_versions"); + } + + oprot->writeMessageBegin("describe_schema_versions", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_schema_versions", bytes); + } +} + +void CassandraProcessor::process_describe_keyspaces(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_keyspaces", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_keyspaces"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_keyspaces"); + } + + Cassandra_describe_keyspaces_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_keyspaces", bytes); + } + + Cassandra_describe_keyspaces_result result; + try { + iface_->describe_keyspaces(result.success); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_keyspaces"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_keyspaces", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_keyspaces"); + } + + oprot->writeMessageBegin("describe_keyspaces", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_keyspaces", bytes); + } +} + +void CassandraProcessor::process_describe_cluster_name(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_cluster_name", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_cluster_name"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_cluster_name"); + } + + Cassandra_describe_cluster_name_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_cluster_name", bytes); + } + + Cassandra_describe_cluster_name_result result; + try { + iface_->describe_cluster_name(result.success); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_cluster_name"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_cluster_name", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_cluster_name"); + } + + oprot->writeMessageBegin("describe_cluster_name", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_cluster_name", bytes); + } +} + +void CassandraProcessor::process_describe_version(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_version", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_version"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_version"); + } + + Cassandra_describe_version_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_version", bytes); + } + + Cassandra_describe_version_result result; + try { + iface_->describe_version(result.success); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_version"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_version", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_version"); + } + + oprot->writeMessageBegin("describe_version", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_version", bytes); + } +} + +void CassandraProcessor::process_describe_ring(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_ring", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_ring"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_ring"); + } + + Cassandra_describe_ring_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_ring", bytes); + } + + Cassandra_describe_ring_result result; + try { + iface_->describe_ring(result.success, args.keyspace); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_ring"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_ring", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_ring"); + } + + oprot->writeMessageBegin("describe_ring", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_ring", bytes); + } +} + +void CassandraProcessor::process_describe_token_map(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_token_map", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_token_map"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_token_map"); + } + + Cassandra_describe_token_map_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_token_map", bytes); + } + + Cassandra_describe_token_map_result result; + try { + iface_->describe_token_map(result.success); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_token_map"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_token_map", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_token_map"); + } + + oprot->writeMessageBegin("describe_token_map", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_token_map", bytes); + } +} + +void CassandraProcessor::process_describe_partitioner(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_partitioner", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_partitioner"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_partitioner"); + } + + Cassandra_describe_partitioner_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_partitioner", bytes); + } + + Cassandra_describe_partitioner_result result; + try { + iface_->describe_partitioner(result.success); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_partitioner"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_partitioner", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_partitioner"); + } + + oprot->writeMessageBegin("describe_partitioner", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_partitioner", bytes); + } +} + +void CassandraProcessor::process_describe_snitch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_snitch", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_snitch"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_snitch"); + } + + Cassandra_describe_snitch_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_snitch", bytes); + } + + Cassandra_describe_snitch_result result; + try { + iface_->describe_snitch(result.success); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_snitch"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_snitch", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_snitch"); + } + + oprot->writeMessageBegin("describe_snitch", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_snitch", bytes); + } +} + +void CassandraProcessor::process_describe_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_keyspace", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_keyspace"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_keyspace"); + } + + Cassandra_describe_keyspace_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_keyspace", bytes); + } + + Cassandra_describe_keyspace_result result; + try { + iface_->describe_keyspace(result.success, args.keyspace); + result.__isset.success = true; + } catch (NotFoundException &nfe) { + result.nfe = nfe; + result.__isset.nfe = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_keyspace"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_keyspace", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_keyspace"); + } + + oprot->writeMessageBegin("describe_keyspace", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_keyspace", bytes); + } +} + +void CassandraProcessor::process_describe_splits(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.describe_splits", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.describe_splits"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.describe_splits"); + } + + Cassandra_describe_splits_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.describe_splits", bytes); + } + + Cassandra_describe_splits_result result; + try { + iface_->describe_splits(result.success, args.cfName, args.start_token, args.end_token, args.keys_per_split); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.describe_splits"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("describe_splits", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.describe_splits"); + } + + oprot->writeMessageBegin("describe_splits", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.describe_splits", bytes); + } +} + +void CassandraProcessor::process_system_add_column_family(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.system_add_column_family", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.system_add_column_family"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.system_add_column_family"); + } + + Cassandra_system_add_column_family_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.system_add_column_family", bytes); + } + + Cassandra_system_add_column_family_result result; + try { + iface_->system_add_column_family(result.success, args.cf_def); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.system_add_column_family"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("system_add_column_family", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.system_add_column_family"); + } + + oprot->writeMessageBegin("system_add_column_family", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.system_add_column_family", bytes); + } +} + +void CassandraProcessor::process_system_drop_column_family(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.system_drop_column_family", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.system_drop_column_family"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.system_drop_column_family"); + } + + Cassandra_system_drop_column_family_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.system_drop_column_family", bytes); + } + + Cassandra_system_drop_column_family_result result; + try { + iface_->system_drop_column_family(result.success, args.column_family); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.system_drop_column_family"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("system_drop_column_family", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.system_drop_column_family"); + } + + oprot->writeMessageBegin("system_drop_column_family", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.system_drop_column_family", bytes); + } +} + +void CassandraProcessor::process_system_add_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.system_add_keyspace", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.system_add_keyspace"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.system_add_keyspace"); + } + + Cassandra_system_add_keyspace_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.system_add_keyspace", bytes); + } + + Cassandra_system_add_keyspace_result result; + try { + iface_->system_add_keyspace(result.success, args.ks_def); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.system_add_keyspace"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("system_add_keyspace", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.system_add_keyspace"); + } + + oprot->writeMessageBegin("system_add_keyspace", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.system_add_keyspace", bytes); + } +} + +void CassandraProcessor::process_system_drop_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.system_drop_keyspace", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.system_drop_keyspace"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.system_drop_keyspace"); + } + + Cassandra_system_drop_keyspace_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.system_drop_keyspace", bytes); + } + + Cassandra_system_drop_keyspace_result result; + try { + iface_->system_drop_keyspace(result.success, args.keyspace); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.system_drop_keyspace"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("system_drop_keyspace", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.system_drop_keyspace"); + } + + oprot->writeMessageBegin("system_drop_keyspace", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.system_drop_keyspace", bytes); + } +} + +void CassandraProcessor::process_system_update_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.system_update_keyspace", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.system_update_keyspace"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.system_update_keyspace"); + } + + Cassandra_system_update_keyspace_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.system_update_keyspace", bytes); + } + + Cassandra_system_update_keyspace_result result; + try { + iface_->system_update_keyspace(result.success, args.ks_def); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.system_update_keyspace"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("system_update_keyspace", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.system_update_keyspace"); + } + + oprot->writeMessageBegin("system_update_keyspace", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.system_update_keyspace", bytes); + } +} + +void CassandraProcessor::process_system_update_column_family(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.system_update_column_family", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.system_update_column_family"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.system_update_column_family"); + } + + Cassandra_system_update_column_family_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.system_update_column_family", bytes); + } + + Cassandra_system_update_column_family_result result; + try { + iface_->system_update_column_family(result.success, args.cf_def); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.system_update_column_family"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("system_update_column_family", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.system_update_column_family"); + } + + oprot->writeMessageBegin("system_update_column_family", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.system_update_column_family", bytes); + } +} + +void CassandraProcessor::process_execute_cql_query(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.execute_cql_query", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.execute_cql_query"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.execute_cql_query"); + } + + Cassandra_execute_cql_query_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.execute_cql_query", bytes); + } + + Cassandra_execute_cql_query_result result; + try { + iface_->execute_cql_query(result.success, args.query, args.compression); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.execute_cql_query"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("execute_cql_query", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.execute_cql_query"); + } + + oprot->writeMessageBegin("execute_cql_query", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.execute_cql_query", bytes); + } +} + +void CassandraProcessor::process_prepare_cql_query(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.prepare_cql_query", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.prepare_cql_query"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.prepare_cql_query"); + } + + Cassandra_prepare_cql_query_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.prepare_cql_query", bytes); + } + + Cassandra_prepare_cql_query_result result; + try { + iface_->prepare_cql_query(result.success, args.query, args.compression); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.prepare_cql_query"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("prepare_cql_query", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.prepare_cql_query"); + } + + oprot->writeMessageBegin("prepare_cql_query", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.prepare_cql_query", bytes); + } +} + +void CassandraProcessor::process_execute_prepared_cql_query(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.execute_prepared_cql_query", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.execute_prepared_cql_query"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.execute_prepared_cql_query"); + } + + Cassandra_execute_prepared_cql_query_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.execute_prepared_cql_query", bytes); + } + + Cassandra_execute_prepared_cql_query_result result; + try { + iface_->execute_prepared_cql_query(result.success, args.itemId, args.values); + result.__isset.success = true; + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (UnavailableException &ue) { + result.ue = ue; + result.__isset.ue = true; + } catch (TimedOutException &te) { + result.te = te; + result.__isset.te = true; + } catch (SchemaDisagreementException &sde) { + result.sde = sde; + result.__isset.sde = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.execute_prepared_cql_query"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("execute_prepared_cql_query", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.execute_prepared_cql_query"); + } + + oprot->writeMessageBegin("execute_prepared_cql_query", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.execute_prepared_cql_query", bytes); + } +} + +void CassandraProcessor::process_set_cql_version(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Cassandra.set_cql_version", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Cassandra.set_cql_version"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Cassandra.set_cql_version"); + } + + Cassandra_set_cql_version_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Cassandra.set_cql_version", bytes); + } + + Cassandra_set_cql_version_result result; + try { + iface_->set_cql_version(args.version); + } catch (InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Cassandra.set_cql_version"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("set_cql_version", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Cassandra.set_cql_version"); + } + + oprot->writeMessageBegin("set_cql_version", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Cassandra.set_cql_version", bytes); + } +} + +::boost::shared_ptr< ::apache::thrift::TProcessor > CassandraProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { + ::apache::thrift::ReleaseHandler< CassandraIfFactory > cleanup(handlerFactory_); + ::boost::shared_ptr< CassandraIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new CassandraProcessor(handler)); + return processor; +} +}}} // namespace + diff --git a/storage/cassandra/gen-cpp/Cassandra.h b/storage/cassandra/gen-cpp/Cassandra.h new file mode 100644 index 00000000000..2040cc63aa2 --- /dev/null +++ b/storage/cassandra/gen-cpp/Cassandra.h @@ -0,0 +1,5466 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef Cassandra_H +#define Cassandra_H + +#include +#include "cassandra_types.h" + +namespace org { namespace apache { namespace cassandra { + +class CassandraIf { + public: + virtual ~CassandraIf() {} + virtual void login(const AuthenticationRequest& auth_request) = 0; + virtual void set_keyspace(const std::string& keyspace) = 0; + virtual void get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) = 0; + virtual void get_slice(std::vector & _return, const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) = 0; + virtual int32_t get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) = 0; + virtual void multiget_slice(std::map > & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) = 0; + virtual void multiget_count(std::map & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) = 0; + virtual void get_range_slices(std::vector & _return, const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level) = 0; + virtual void get_paged_slice(std::vector & _return, const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level) = 0; + virtual void get_indexed_slices(std::vector & _return, const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level) = 0; + virtual void insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) = 0; + virtual void add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) = 0; + virtual void remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level) = 0; + virtual void remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level) = 0; + virtual void batch_mutate(const std::map > > & mutation_map, const ConsistencyLevel::type consistency_level) = 0; + virtual void truncate(const std::string& cfname) = 0; + virtual void describe_schema_versions(std::map > & _return) = 0; + virtual void describe_keyspaces(std::vector & _return) = 0; + virtual void describe_cluster_name(std::string& _return) = 0; + virtual void describe_version(std::string& _return) = 0; + virtual void describe_ring(std::vector & _return, const std::string& keyspace) = 0; + virtual void describe_token_map(std::map & _return) = 0; + virtual void describe_partitioner(std::string& _return) = 0; + virtual void describe_snitch(std::string& _return) = 0; + virtual void describe_keyspace(KsDef& _return, const std::string& keyspace) = 0; + virtual void describe_splits(std::vector & _return, const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split) = 0; + virtual void system_add_column_family(std::string& _return, const CfDef& cf_def) = 0; + virtual void system_drop_column_family(std::string& _return, const std::string& column_family) = 0; + virtual void system_add_keyspace(std::string& _return, const KsDef& ks_def) = 0; + virtual void system_drop_keyspace(std::string& _return, const std::string& keyspace) = 0; + virtual void system_update_keyspace(std::string& _return, const KsDef& ks_def) = 0; + virtual void system_update_column_family(std::string& _return, const CfDef& cf_def) = 0; + virtual void execute_cql_query(CqlResult& _return, const std::string& query, const Compression::type compression) = 0; + virtual void prepare_cql_query(CqlPreparedResult& _return, const std::string& query, const Compression::type compression) = 0; + virtual void execute_prepared_cql_query(CqlResult& _return, const int32_t itemId, const std::vector & values) = 0; + virtual void set_cql_version(const std::string& version) = 0; +}; + +class CassandraIfFactory { + public: + typedef CassandraIf Handler; + + virtual ~CassandraIfFactory() {} + + virtual CassandraIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; + virtual void releaseHandler(CassandraIf* /* handler */) = 0; +}; + +class CassandraIfSingletonFactory : virtual public CassandraIfFactory { + public: + CassandraIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + virtual ~CassandraIfSingletonFactory() {} + + virtual CassandraIf* getHandler(const ::apache::thrift::TConnectionInfo&) { + return iface_.get(); + } + virtual void releaseHandler(CassandraIf* /* handler */) {} + + protected: + boost::shared_ptr iface_; +}; + +class CassandraNull : virtual public CassandraIf { + public: + virtual ~CassandraNull() {} + void login(const AuthenticationRequest& /* auth_request */) { + return; + } + void set_keyspace(const std::string& /* keyspace */) { + return; + } + void get(ColumnOrSuperColumn& /* _return */, const std::string& /* key */, const ColumnPath& /* column_path */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void get_slice(std::vector & /* _return */, const std::string& /* key */, const ColumnParent& /* column_parent */, const SlicePredicate& /* predicate */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + int32_t get_count(const std::string& /* key */, const ColumnParent& /* column_parent */, const SlicePredicate& /* predicate */, const ConsistencyLevel::type /* consistency_level */) { + int32_t _return = 0; + return _return; + } + void multiget_slice(std::map > & /* _return */, const std::vector & /* keys */, const ColumnParent& /* column_parent */, const SlicePredicate& /* predicate */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void multiget_count(std::map & /* _return */, const std::vector & /* keys */, const ColumnParent& /* column_parent */, const SlicePredicate& /* predicate */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void get_range_slices(std::vector & /* _return */, const ColumnParent& /* column_parent */, const SlicePredicate& /* predicate */, const KeyRange& /* range */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void get_paged_slice(std::vector & /* _return */, const std::string& /* column_family */, const KeyRange& /* range */, const std::string& /* start_column */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void get_indexed_slices(std::vector & /* _return */, const ColumnParent& /* column_parent */, const IndexClause& /* index_clause */, const SlicePredicate& /* column_predicate */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void insert(const std::string& /* key */, const ColumnParent& /* column_parent */, const Column& /* column */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void add(const std::string& /* key */, const ColumnParent& /* column_parent */, const CounterColumn& /* column */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void remove(const std::string& /* key */, const ColumnPath& /* column_path */, const int64_t /* timestamp */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void remove_counter(const std::string& /* key */, const ColumnPath& /* path */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void batch_mutate(const std::map > > & /* mutation_map */, const ConsistencyLevel::type /* consistency_level */) { + return; + } + void truncate(const std::string& /* cfname */) { + return; + } + void describe_schema_versions(std::map > & /* _return */) { + return; + } + void describe_keyspaces(std::vector & /* _return */) { + return; + } + void describe_cluster_name(std::string& /* _return */) { + return; + } + void describe_version(std::string& /* _return */) { + return; + } + void describe_ring(std::vector & /* _return */, const std::string& /* keyspace */) { + return; + } + void describe_token_map(std::map & /* _return */) { + return; + } + void describe_partitioner(std::string& /* _return */) { + return; + } + void describe_snitch(std::string& /* _return */) { + return; + } + void describe_keyspace(KsDef& /* _return */, const std::string& /* keyspace */) { + return; + } + void describe_splits(std::vector & /* _return */, const std::string& /* cfName */, const std::string& /* start_token */, const std::string& /* end_token */, const int32_t /* keys_per_split */) { + return; + } + void system_add_column_family(std::string& /* _return */, const CfDef& /* cf_def */) { + return; + } + void system_drop_column_family(std::string& /* _return */, const std::string& /* column_family */) { + return; + } + void system_add_keyspace(std::string& /* _return */, const KsDef& /* ks_def */) { + return; + } + void system_drop_keyspace(std::string& /* _return */, const std::string& /* keyspace */) { + return; + } + void system_update_keyspace(std::string& /* _return */, const KsDef& /* ks_def */) { + return; + } + void system_update_column_family(std::string& /* _return */, const CfDef& /* cf_def */) { + return; + } + void execute_cql_query(CqlResult& /* _return */, const std::string& /* query */, const Compression::type /* compression */) { + return; + } + void prepare_cql_query(CqlPreparedResult& /* _return */, const std::string& /* query */, const Compression::type /* compression */) { + return; + } + void execute_prepared_cql_query(CqlResult& /* _return */, const int32_t /* itemId */, const std::vector & /* values */) { + return; + } + void set_cql_version(const std::string& /* version */) { + return; + } +}; + + +class Cassandra_login_args { + public: + + Cassandra_login_args() { + } + + virtual ~Cassandra_login_args() throw() {} + + AuthenticationRequest auth_request; + + void __set_auth_request(const AuthenticationRequest& val) { + auth_request = val; + } + + bool operator == (const Cassandra_login_args & rhs) const + { + if (!(auth_request == rhs.auth_request)) + return false; + return true; + } + bool operator != (const Cassandra_login_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_login_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_login_pargs { + public: + + + virtual ~Cassandra_login_pargs() throw() {} + + const AuthenticationRequest* auth_request; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_login_result__isset { + _Cassandra_login_result__isset() : authnx(false), authzx(false) {} + bool authnx; + bool authzx; +} _Cassandra_login_result__isset; + +class Cassandra_login_result { + public: + + Cassandra_login_result() { + } + + virtual ~Cassandra_login_result() throw() {} + + AuthenticationException authnx; + AuthorizationException authzx; + + _Cassandra_login_result__isset __isset; + + void __set_authnx(const AuthenticationException& val) { + authnx = val; + } + + void __set_authzx(const AuthorizationException& val) { + authzx = val; + } + + bool operator == (const Cassandra_login_result & rhs) const + { + if (!(authnx == rhs.authnx)) + return false; + if (!(authzx == rhs.authzx)) + return false; + return true; + } + bool operator != (const Cassandra_login_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_login_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_login_presult__isset { + _Cassandra_login_presult__isset() : authnx(false), authzx(false) {} + bool authnx; + bool authzx; +} _Cassandra_login_presult__isset; + +class Cassandra_login_presult { + public: + + + virtual ~Cassandra_login_presult() throw() {} + + AuthenticationException authnx; + AuthorizationException authzx; + + _Cassandra_login_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_set_keyspace_args { + public: + + Cassandra_set_keyspace_args() : keyspace("") { + } + + virtual ~Cassandra_set_keyspace_args() throw() {} + + std::string keyspace; + + void __set_keyspace(const std::string& val) { + keyspace = val; + } + + bool operator == (const Cassandra_set_keyspace_args & rhs) const + { + if (!(keyspace == rhs.keyspace)) + return false; + return true; + } + bool operator != (const Cassandra_set_keyspace_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_set_keyspace_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_set_keyspace_pargs { + public: + + + virtual ~Cassandra_set_keyspace_pargs() throw() {} + + const std::string* keyspace; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_set_keyspace_result__isset { + _Cassandra_set_keyspace_result__isset() : ire(false) {} + bool ire; +} _Cassandra_set_keyspace_result__isset; + +class Cassandra_set_keyspace_result { + public: + + Cassandra_set_keyspace_result() { + } + + virtual ~Cassandra_set_keyspace_result() throw() {} + + InvalidRequestException ire; + + _Cassandra_set_keyspace_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_set_keyspace_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_set_keyspace_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_set_keyspace_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_set_keyspace_presult__isset { + _Cassandra_set_keyspace_presult__isset() : ire(false) {} + bool ire; +} _Cassandra_set_keyspace_presult__isset; + +class Cassandra_set_keyspace_presult { + public: + + + virtual ~Cassandra_set_keyspace_presult() throw() {} + + InvalidRequestException ire; + + _Cassandra_set_keyspace_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_get_args { + public: + + Cassandra_get_args() : key(""), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_get_args() throw() {} + + std::string key; + ColumnPath column_path; + ConsistencyLevel::type consistency_level; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_column_path(const ColumnPath& val) { + column_path = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_get_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(column_path == rhs.column_path)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_get_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_get_pargs { + public: + + + virtual ~Cassandra_get_pargs() throw() {} + + const std::string* key; + const ColumnPath* column_path; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_result__isset { + _Cassandra_get_result__isset() : success(false), ire(false), nfe(false), ue(false), te(false) {} + bool success; + bool ire; + bool nfe; + bool ue; + bool te; +} _Cassandra_get_result__isset; + +class Cassandra_get_result { + public: + + Cassandra_get_result() { + } + + virtual ~Cassandra_get_result() throw() {} + + ColumnOrSuperColumn success; + InvalidRequestException ire; + NotFoundException nfe; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_result__isset __isset; + + void __set_success(const ColumnOrSuperColumn& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_nfe(const NotFoundException& val) { + nfe = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_get_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(nfe == rhs.nfe)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_get_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_presult__isset { + _Cassandra_get_presult__isset() : success(false), ire(false), nfe(false), ue(false), te(false) {} + bool success; + bool ire; + bool nfe; + bool ue; + bool te; +} _Cassandra_get_presult__isset; + +class Cassandra_get_presult { + public: + + + virtual ~Cassandra_get_presult() throw() {} + + ColumnOrSuperColumn* success; + InvalidRequestException ire; + NotFoundException nfe; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_get_slice_args { + public: + + Cassandra_get_slice_args() : key(""), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_get_slice_args() throw() {} + + std::string key; + ColumnParent column_parent; + SlicePredicate predicate; + ConsistencyLevel::type consistency_level; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_predicate(const SlicePredicate& val) { + predicate = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_get_slice_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(column_parent == rhs.column_parent)) + return false; + if (!(predicate == rhs.predicate)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_get_slice_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_slice_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_get_slice_pargs { + public: + + + virtual ~Cassandra_get_slice_pargs() throw() {} + + const std::string* key; + const ColumnParent* column_parent; + const SlicePredicate* predicate; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_slice_result__isset { + _Cassandra_get_slice_result__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_slice_result__isset; + +class Cassandra_get_slice_result { + public: + + Cassandra_get_slice_result() { + } + + virtual ~Cassandra_get_slice_result() throw() {} + + std::vector success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_slice_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_get_slice_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_get_slice_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_slice_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_slice_presult__isset { + _Cassandra_get_slice_presult__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_slice_presult__isset; + +class Cassandra_get_slice_presult { + public: + + + virtual ~Cassandra_get_slice_presult() throw() {} + + std::vector * success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_slice_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_get_count_args { + public: + + Cassandra_get_count_args() : key(""), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_get_count_args() throw() {} + + std::string key; + ColumnParent column_parent; + SlicePredicate predicate; + ConsistencyLevel::type consistency_level; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_predicate(const SlicePredicate& val) { + predicate = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_get_count_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(column_parent == rhs.column_parent)) + return false; + if (!(predicate == rhs.predicate)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_get_count_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_count_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_get_count_pargs { + public: + + + virtual ~Cassandra_get_count_pargs() throw() {} + + const std::string* key; + const ColumnParent* column_parent; + const SlicePredicate* predicate; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_count_result__isset { + _Cassandra_get_count_result__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_count_result__isset; + +class Cassandra_get_count_result { + public: + + Cassandra_get_count_result() : success(0) { + } + + virtual ~Cassandra_get_count_result() throw() {} + + int32_t success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_count_result__isset __isset; + + void __set_success(const int32_t val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_get_count_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_get_count_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_count_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_count_presult__isset { + _Cassandra_get_count_presult__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_count_presult__isset; + +class Cassandra_get_count_presult { + public: + + + virtual ~Cassandra_get_count_presult() throw() {} + + int32_t* success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_count_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_multiget_slice_args { + public: + + Cassandra_multiget_slice_args() : consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_multiget_slice_args() throw() {} + + std::vector keys; + ColumnParent column_parent; + SlicePredicate predicate; + ConsistencyLevel::type consistency_level; + + void __set_keys(const std::vector & val) { + keys = val; + } + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_predicate(const SlicePredicate& val) { + predicate = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_multiget_slice_args & rhs) const + { + if (!(keys == rhs.keys)) + return false; + if (!(column_parent == rhs.column_parent)) + return false; + if (!(predicate == rhs.predicate)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_multiget_slice_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_multiget_slice_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_multiget_slice_pargs { + public: + + + virtual ~Cassandra_multiget_slice_pargs() throw() {} + + const std::vector * keys; + const ColumnParent* column_parent; + const SlicePredicate* predicate; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_multiget_slice_result__isset { + _Cassandra_multiget_slice_result__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_multiget_slice_result__isset; + +class Cassandra_multiget_slice_result { + public: + + Cassandra_multiget_slice_result() { + } + + virtual ~Cassandra_multiget_slice_result() throw() {} + + std::map > success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_multiget_slice_result__isset __isset; + + void __set_success(const std::map > & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_multiget_slice_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_multiget_slice_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_multiget_slice_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_multiget_slice_presult__isset { + _Cassandra_multiget_slice_presult__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_multiget_slice_presult__isset; + +class Cassandra_multiget_slice_presult { + public: + + + virtual ~Cassandra_multiget_slice_presult() throw() {} + + std::map > * success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_multiget_slice_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_multiget_count_args { + public: + + Cassandra_multiget_count_args() : consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_multiget_count_args() throw() {} + + std::vector keys; + ColumnParent column_parent; + SlicePredicate predicate; + ConsistencyLevel::type consistency_level; + + void __set_keys(const std::vector & val) { + keys = val; + } + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_predicate(const SlicePredicate& val) { + predicate = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_multiget_count_args & rhs) const + { + if (!(keys == rhs.keys)) + return false; + if (!(column_parent == rhs.column_parent)) + return false; + if (!(predicate == rhs.predicate)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_multiget_count_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_multiget_count_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_multiget_count_pargs { + public: + + + virtual ~Cassandra_multiget_count_pargs() throw() {} + + const std::vector * keys; + const ColumnParent* column_parent; + const SlicePredicate* predicate; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_multiget_count_result__isset { + _Cassandra_multiget_count_result__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_multiget_count_result__isset; + +class Cassandra_multiget_count_result { + public: + + Cassandra_multiget_count_result() { + } + + virtual ~Cassandra_multiget_count_result() throw() {} + + std::map success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_multiget_count_result__isset __isset; + + void __set_success(const std::map & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_multiget_count_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_multiget_count_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_multiget_count_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_multiget_count_presult__isset { + _Cassandra_multiget_count_presult__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_multiget_count_presult__isset; + +class Cassandra_multiget_count_presult { + public: + + + virtual ~Cassandra_multiget_count_presult() throw() {} + + std::map * success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_multiget_count_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_get_range_slices_args { + public: + + Cassandra_get_range_slices_args() : consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_get_range_slices_args() throw() {} + + ColumnParent column_parent; + SlicePredicate predicate; + KeyRange range; + ConsistencyLevel::type consistency_level; + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_predicate(const SlicePredicate& val) { + predicate = val; + } + + void __set_range(const KeyRange& val) { + range = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_get_range_slices_args & rhs) const + { + if (!(column_parent == rhs.column_parent)) + return false; + if (!(predicate == rhs.predicate)) + return false; + if (!(range == rhs.range)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_get_range_slices_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_range_slices_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_get_range_slices_pargs { + public: + + + virtual ~Cassandra_get_range_slices_pargs() throw() {} + + const ColumnParent* column_parent; + const SlicePredicate* predicate; + const KeyRange* range; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_range_slices_result__isset { + _Cassandra_get_range_slices_result__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_range_slices_result__isset; + +class Cassandra_get_range_slices_result { + public: + + Cassandra_get_range_slices_result() { + } + + virtual ~Cassandra_get_range_slices_result() throw() {} + + std::vector success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_range_slices_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_get_range_slices_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_get_range_slices_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_range_slices_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_range_slices_presult__isset { + _Cassandra_get_range_slices_presult__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_range_slices_presult__isset; + +class Cassandra_get_range_slices_presult { + public: + + + virtual ~Cassandra_get_range_slices_presult() throw() {} + + std::vector * success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_range_slices_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_get_paged_slice_args { + public: + + Cassandra_get_paged_slice_args() : column_family(""), start_column(""), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_get_paged_slice_args() throw() {} + + std::string column_family; + KeyRange range; + std::string start_column; + ConsistencyLevel::type consistency_level; + + void __set_column_family(const std::string& val) { + column_family = val; + } + + void __set_range(const KeyRange& val) { + range = val; + } + + void __set_start_column(const std::string& val) { + start_column = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_get_paged_slice_args & rhs) const + { + if (!(column_family == rhs.column_family)) + return false; + if (!(range == rhs.range)) + return false; + if (!(start_column == rhs.start_column)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_get_paged_slice_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_paged_slice_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_get_paged_slice_pargs { + public: + + + virtual ~Cassandra_get_paged_slice_pargs() throw() {} + + const std::string* column_family; + const KeyRange* range; + const std::string* start_column; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_paged_slice_result__isset { + _Cassandra_get_paged_slice_result__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_paged_slice_result__isset; + +class Cassandra_get_paged_slice_result { + public: + + Cassandra_get_paged_slice_result() { + } + + virtual ~Cassandra_get_paged_slice_result() throw() {} + + std::vector success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_paged_slice_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_get_paged_slice_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_get_paged_slice_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_paged_slice_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_paged_slice_presult__isset { + _Cassandra_get_paged_slice_presult__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_paged_slice_presult__isset; + +class Cassandra_get_paged_slice_presult { + public: + + + virtual ~Cassandra_get_paged_slice_presult() throw() {} + + std::vector * success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_paged_slice_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_get_indexed_slices_args { + public: + + Cassandra_get_indexed_slices_args() : consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_get_indexed_slices_args() throw() {} + + ColumnParent column_parent; + IndexClause index_clause; + SlicePredicate column_predicate; + ConsistencyLevel::type consistency_level; + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_index_clause(const IndexClause& val) { + index_clause = val; + } + + void __set_column_predicate(const SlicePredicate& val) { + column_predicate = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_get_indexed_slices_args & rhs) const + { + if (!(column_parent == rhs.column_parent)) + return false; + if (!(index_clause == rhs.index_clause)) + return false; + if (!(column_predicate == rhs.column_predicate)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_get_indexed_slices_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_indexed_slices_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_get_indexed_slices_pargs { + public: + + + virtual ~Cassandra_get_indexed_slices_pargs() throw() {} + + const ColumnParent* column_parent; + const IndexClause* index_clause; + const SlicePredicate* column_predicate; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_indexed_slices_result__isset { + _Cassandra_get_indexed_slices_result__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_indexed_slices_result__isset; + +class Cassandra_get_indexed_slices_result { + public: + + Cassandra_get_indexed_slices_result() { + } + + virtual ~Cassandra_get_indexed_slices_result() throw() {} + + std::vector success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_indexed_slices_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_get_indexed_slices_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_get_indexed_slices_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_get_indexed_slices_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_get_indexed_slices_presult__isset { + _Cassandra_get_indexed_slices_presult__isset() : success(false), ire(false), ue(false), te(false) {} + bool success; + bool ire; + bool ue; + bool te; +} _Cassandra_get_indexed_slices_presult__isset; + +class Cassandra_get_indexed_slices_presult { + public: + + + virtual ~Cassandra_get_indexed_slices_presult() throw() {} + + std::vector * success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_get_indexed_slices_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_insert_args { + public: + + Cassandra_insert_args() : key(""), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_insert_args() throw() {} + + std::string key; + ColumnParent column_parent; + Column column; + ConsistencyLevel::type consistency_level; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_column(const Column& val) { + column = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_insert_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(column_parent == rhs.column_parent)) + return false; + if (!(column == rhs.column)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_insert_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_insert_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_insert_pargs { + public: + + + virtual ~Cassandra_insert_pargs() throw() {} + + const std::string* key; + const ColumnParent* column_parent; + const Column* column; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_insert_result__isset { + _Cassandra_insert_result__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_insert_result__isset; + +class Cassandra_insert_result { + public: + + Cassandra_insert_result() { + } + + virtual ~Cassandra_insert_result() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_insert_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_insert_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_insert_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_insert_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_insert_presult__isset { + _Cassandra_insert_presult__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_insert_presult__isset; + +class Cassandra_insert_presult { + public: + + + virtual ~Cassandra_insert_presult() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_insert_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_add_args { + public: + + Cassandra_add_args() : key(""), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_add_args() throw() {} + + std::string key; + ColumnParent column_parent; + CounterColumn column; + ConsistencyLevel::type consistency_level; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_column_parent(const ColumnParent& val) { + column_parent = val; + } + + void __set_column(const CounterColumn& val) { + column = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_add_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(column_parent == rhs.column_parent)) + return false; + if (!(column == rhs.column)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_add_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_add_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_add_pargs { + public: + + + virtual ~Cassandra_add_pargs() throw() {} + + const std::string* key; + const ColumnParent* column_parent; + const CounterColumn* column; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_add_result__isset { + _Cassandra_add_result__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_add_result__isset; + +class Cassandra_add_result { + public: + + Cassandra_add_result() { + } + + virtual ~Cassandra_add_result() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_add_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_add_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_add_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_add_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_add_presult__isset { + _Cassandra_add_presult__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_add_presult__isset; + +class Cassandra_add_presult { + public: + + + virtual ~Cassandra_add_presult() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_add_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Cassandra_remove_args__isset { + _Cassandra_remove_args__isset() : consistency_level(false) {} + bool consistency_level; +} _Cassandra_remove_args__isset; + +class Cassandra_remove_args { + public: + + Cassandra_remove_args() : key(""), timestamp(0), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_remove_args() throw() {} + + std::string key; + ColumnPath column_path; + int64_t timestamp; + ConsistencyLevel::type consistency_level; + + _Cassandra_remove_args__isset __isset; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_column_path(const ColumnPath& val) { + column_path = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_remove_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(column_path == rhs.column_path)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_remove_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_remove_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_remove_pargs { + public: + + + virtual ~Cassandra_remove_pargs() throw() {} + + const std::string* key; + const ColumnPath* column_path; + const int64_t* timestamp; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_remove_result__isset { + _Cassandra_remove_result__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_remove_result__isset; + +class Cassandra_remove_result { + public: + + Cassandra_remove_result() { + } + + virtual ~Cassandra_remove_result() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_remove_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_remove_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_remove_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_remove_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_remove_presult__isset { + _Cassandra_remove_presult__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_remove_presult__isset; + +class Cassandra_remove_presult { + public: + + + virtual ~Cassandra_remove_presult() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_remove_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_remove_counter_args { + public: + + Cassandra_remove_counter_args() : key(""), consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_remove_counter_args() throw() {} + + std::string key; + ColumnPath path; + ConsistencyLevel::type consistency_level; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_path(const ColumnPath& val) { + path = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_remove_counter_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(path == rhs.path)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_remove_counter_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_remove_counter_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_remove_counter_pargs { + public: + + + virtual ~Cassandra_remove_counter_pargs() throw() {} + + const std::string* key; + const ColumnPath* path; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_remove_counter_result__isset { + _Cassandra_remove_counter_result__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_remove_counter_result__isset; + +class Cassandra_remove_counter_result { + public: + + Cassandra_remove_counter_result() { + } + + virtual ~Cassandra_remove_counter_result() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_remove_counter_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_remove_counter_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_remove_counter_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_remove_counter_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_remove_counter_presult__isset { + _Cassandra_remove_counter_presult__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_remove_counter_presult__isset; + +class Cassandra_remove_counter_presult { + public: + + + virtual ~Cassandra_remove_counter_presult() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_remove_counter_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_batch_mutate_args { + public: + + Cassandra_batch_mutate_args() : consistency_level((ConsistencyLevel::type)1) { + consistency_level = (ConsistencyLevel::type)1; + + } + + virtual ~Cassandra_batch_mutate_args() throw() {} + + std::map > > mutation_map; + ConsistencyLevel::type consistency_level; + + void __set_mutation_map(const std::map > > & val) { + mutation_map = val; + } + + void __set_consistency_level(const ConsistencyLevel::type val) { + consistency_level = val; + } + + bool operator == (const Cassandra_batch_mutate_args & rhs) const + { + if (!(mutation_map == rhs.mutation_map)) + return false; + if (!(consistency_level == rhs.consistency_level)) + return false; + return true; + } + bool operator != (const Cassandra_batch_mutate_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_batch_mutate_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_batch_mutate_pargs { + public: + + + virtual ~Cassandra_batch_mutate_pargs() throw() {} + + const std::map > > * mutation_map; + const ConsistencyLevel::type* consistency_level; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_batch_mutate_result__isset { + _Cassandra_batch_mutate_result__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_batch_mutate_result__isset; + +class Cassandra_batch_mutate_result { + public: + + Cassandra_batch_mutate_result() { + } + + virtual ~Cassandra_batch_mutate_result() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_batch_mutate_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_batch_mutate_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_batch_mutate_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_batch_mutate_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_batch_mutate_presult__isset { + _Cassandra_batch_mutate_presult__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_batch_mutate_presult__isset; + +class Cassandra_batch_mutate_presult { + public: + + + virtual ~Cassandra_batch_mutate_presult() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_batch_mutate_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_truncate_args { + public: + + Cassandra_truncate_args() : cfname("") { + } + + virtual ~Cassandra_truncate_args() throw() {} + + std::string cfname; + + void __set_cfname(const std::string& val) { + cfname = val; + } + + bool operator == (const Cassandra_truncate_args & rhs) const + { + if (!(cfname == rhs.cfname)) + return false; + return true; + } + bool operator != (const Cassandra_truncate_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_truncate_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_truncate_pargs { + public: + + + virtual ~Cassandra_truncate_pargs() throw() {} + + const std::string* cfname; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_truncate_result__isset { + _Cassandra_truncate_result__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_truncate_result__isset; + +class Cassandra_truncate_result { + public: + + Cassandra_truncate_result() { + } + + virtual ~Cassandra_truncate_result() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_truncate_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + bool operator == (const Cassandra_truncate_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + return true; + } + bool operator != (const Cassandra_truncate_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_truncate_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_truncate_presult__isset { + _Cassandra_truncate_presult__isset() : ire(false), ue(false), te(false) {} + bool ire; + bool ue; + bool te; +} _Cassandra_truncate_presult__isset; + +class Cassandra_truncate_presult { + public: + + + virtual ~Cassandra_truncate_presult() throw() {} + + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + + _Cassandra_truncate_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_schema_versions_args { + public: + + Cassandra_describe_schema_versions_args() { + } + + virtual ~Cassandra_describe_schema_versions_args() throw() {} + + + bool operator == (const Cassandra_describe_schema_versions_args & /* rhs */) const + { + return true; + } + bool operator != (const Cassandra_describe_schema_versions_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_schema_versions_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_schema_versions_pargs { + public: + + + virtual ~Cassandra_describe_schema_versions_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_schema_versions_result__isset { + _Cassandra_describe_schema_versions_result__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_schema_versions_result__isset; + +class Cassandra_describe_schema_versions_result { + public: + + Cassandra_describe_schema_versions_result() { + } + + virtual ~Cassandra_describe_schema_versions_result() throw() {} + + std::map > success; + InvalidRequestException ire; + + _Cassandra_describe_schema_versions_result__isset __isset; + + void __set_success(const std::map > & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_describe_schema_versions_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_describe_schema_versions_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_schema_versions_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_schema_versions_presult__isset { + _Cassandra_describe_schema_versions_presult__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_schema_versions_presult__isset; + +class Cassandra_describe_schema_versions_presult { + public: + + + virtual ~Cassandra_describe_schema_versions_presult() throw() {} + + std::map > * success; + InvalidRequestException ire; + + _Cassandra_describe_schema_versions_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_keyspaces_args { + public: + + Cassandra_describe_keyspaces_args() { + } + + virtual ~Cassandra_describe_keyspaces_args() throw() {} + + + bool operator == (const Cassandra_describe_keyspaces_args & /* rhs */) const + { + return true; + } + bool operator != (const Cassandra_describe_keyspaces_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_keyspaces_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_keyspaces_pargs { + public: + + + virtual ~Cassandra_describe_keyspaces_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_keyspaces_result__isset { + _Cassandra_describe_keyspaces_result__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_keyspaces_result__isset; + +class Cassandra_describe_keyspaces_result { + public: + + Cassandra_describe_keyspaces_result() { + } + + virtual ~Cassandra_describe_keyspaces_result() throw() {} + + std::vector success; + InvalidRequestException ire; + + _Cassandra_describe_keyspaces_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_describe_keyspaces_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_describe_keyspaces_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_keyspaces_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_keyspaces_presult__isset { + _Cassandra_describe_keyspaces_presult__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_keyspaces_presult__isset; + +class Cassandra_describe_keyspaces_presult { + public: + + + virtual ~Cassandra_describe_keyspaces_presult() throw() {} + + std::vector * success; + InvalidRequestException ire; + + _Cassandra_describe_keyspaces_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_cluster_name_args { + public: + + Cassandra_describe_cluster_name_args() { + } + + virtual ~Cassandra_describe_cluster_name_args() throw() {} + + + bool operator == (const Cassandra_describe_cluster_name_args & /* rhs */) const + { + return true; + } + bool operator != (const Cassandra_describe_cluster_name_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_cluster_name_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_cluster_name_pargs { + public: + + + virtual ~Cassandra_describe_cluster_name_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_cluster_name_result__isset { + _Cassandra_describe_cluster_name_result__isset() : success(false) {} + bool success; +} _Cassandra_describe_cluster_name_result__isset; + +class Cassandra_describe_cluster_name_result { + public: + + Cassandra_describe_cluster_name_result() : success("") { + } + + virtual ~Cassandra_describe_cluster_name_result() throw() {} + + std::string success; + + _Cassandra_describe_cluster_name_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + bool operator == (const Cassandra_describe_cluster_name_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const Cassandra_describe_cluster_name_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_cluster_name_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_cluster_name_presult__isset { + _Cassandra_describe_cluster_name_presult__isset() : success(false) {} + bool success; +} _Cassandra_describe_cluster_name_presult__isset; + +class Cassandra_describe_cluster_name_presult { + public: + + + virtual ~Cassandra_describe_cluster_name_presult() throw() {} + + std::string* success; + + _Cassandra_describe_cluster_name_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_version_args { + public: + + Cassandra_describe_version_args() { + } + + virtual ~Cassandra_describe_version_args() throw() {} + + + bool operator == (const Cassandra_describe_version_args & /* rhs */) const + { + return true; + } + bool operator != (const Cassandra_describe_version_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_version_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_version_pargs { + public: + + + virtual ~Cassandra_describe_version_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_version_result__isset { + _Cassandra_describe_version_result__isset() : success(false) {} + bool success; +} _Cassandra_describe_version_result__isset; + +class Cassandra_describe_version_result { + public: + + Cassandra_describe_version_result() : success("") { + } + + virtual ~Cassandra_describe_version_result() throw() {} + + std::string success; + + _Cassandra_describe_version_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + bool operator == (const Cassandra_describe_version_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const Cassandra_describe_version_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_version_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_version_presult__isset { + _Cassandra_describe_version_presult__isset() : success(false) {} + bool success; +} _Cassandra_describe_version_presult__isset; + +class Cassandra_describe_version_presult { + public: + + + virtual ~Cassandra_describe_version_presult() throw() {} + + std::string* success; + + _Cassandra_describe_version_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_ring_args { + public: + + Cassandra_describe_ring_args() : keyspace("") { + } + + virtual ~Cassandra_describe_ring_args() throw() {} + + std::string keyspace; + + void __set_keyspace(const std::string& val) { + keyspace = val; + } + + bool operator == (const Cassandra_describe_ring_args & rhs) const + { + if (!(keyspace == rhs.keyspace)) + return false; + return true; + } + bool operator != (const Cassandra_describe_ring_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_ring_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_ring_pargs { + public: + + + virtual ~Cassandra_describe_ring_pargs() throw() {} + + const std::string* keyspace; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_ring_result__isset { + _Cassandra_describe_ring_result__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_ring_result__isset; + +class Cassandra_describe_ring_result { + public: + + Cassandra_describe_ring_result() { + } + + virtual ~Cassandra_describe_ring_result() throw() {} + + std::vector success; + InvalidRequestException ire; + + _Cassandra_describe_ring_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_describe_ring_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_describe_ring_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_ring_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_ring_presult__isset { + _Cassandra_describe_ring_presult__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_ring_presult__isset; + +class Cassandra_describe_ring_presult { + public: + + + virtual ~Cassandra_describe_ring_presult() throw() {} + + std::vector * success; + InvalidRequestException ire; + + _Cassandra_describe_ring_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_token_map_args { + public: + + Cassandra_describe_token_map_args() { + } + + virtual ~Cassandra_describe_token_map_args() throw() {} + + + bool operator == (const Cassandra_describe_token_map_args & /* rhs */) const + { + return true; + } + bool operator != (const Cassandra_describe_token_map_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_token_map_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_token_map_pargs { + public: + + + virtual ~Cassandra_describe_token_map_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_token_map_result__isset { + _Cassandra_describe_token_map_result__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_token_map_result__isset; + +class Cassandra_describe_token_map_result { + public: + + Cassandra_describe_token_map_result() { + } + + virtual ~Cassandra_describe_token_map_result() throw() {} + + std::map success; + InvalidRequestException ire; + + _Cassandra_describe_token_map_result__isset __isset; + + void __set_success(const std::map & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_describe_token_map_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_describe_token_map_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_token_map_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_token_map_presult__isset { + _Cassandra_describe_token_map_presult__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_token_map_presult__isset; + +class Cassandra_describe_token_map_presult { + public: + + + virtual ~Cassandra_describe_token_map_presult() throw() {} + + std::map * success; + InvalidRequestException ire; + + _Cassandra_describe_token_map_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_partitioner_args { + public: + + Cassandra_describe_partitioner_args() { + } + + virtual ~Cassandra_describe_partitioner_args() throw() {} + + + bool operator == (const Cassandra_describe_partitioner_args & /* rhs */) const + { + return true; + } + bool operator != (const Cassandra_describe_partitioner_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_partitioner_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_partitioner_pargs { + public: + + + virtual ~Cassandra_describe_partitioner_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_partitioner_result__isset { + _Cassandra_describe_partitioner_result__isset() : success(false) {} + bool success; +} _Cassandra_describe_partitioner_result__isset; + +class Cassandra_describe_partitioner_result { + public: + + Cassandra_describe_partitioner_result() : success("") { + } + + virtual ~Cassandra_describe_partitioner_result() throw() {} + + std::string success; + + _Cassandra_describe_partitioner_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + bool operator == (const Cassandra_describe_partitioner_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const Cassandra_describe_partitioner_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_partitioner_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_partitioner_presult__isset { + _Cassandra_describe_partitioner_presult__isset() : success(false) {} + bool success; +} _Cassandra_describe_partitioner_presult__isset; + +class Cassandra_describe_partitioner_presult { + public: + + + virtual ~Cassandra_describe_partitioner_presult() throw() {} + + std::string* success; + + _Cassandra_describe_partitioner_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_snitch_args { + public: + + Cassandra_describe_snitch_args() { + } + + virtual ~Cassandra_describe_snitch_args() throw() {} + + + bool operator == (const Cassandra_describe_snitch_args & /* rhs */) const + { + return true; + } + bool operator != (const Cassandra_describe_snitch_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_snitch_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_snitch_pargs { + public: + + + virtual ~Cassandra_describe_snitch_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_snitch_result__isset { + _Cassandra_describe_snitch_result__isset() : success(false) {} + bool success; +} _Cassandra_describe_snitch_result__isset; + +class Cassandra_describe_snitch_result { + public: + + Cassandra_describe_snitch_result() : success("") { + } + + virtual ~Cassandra_describe_snitch_result() throw() {} + + std::string success; + + _Cassandra_describe_snitch_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + bool operator == (const Cassandra_describe_snitch_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const Cassandra_describe_snitch_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_snitch_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_snitch_presult__isset { + _Cassandra_describe_snitch_presult__isset() : success(false) {} + bool success; +} _Cassandra_describe_snitch_presult__isset; + +class Cassandra_describe_snitch_presult { + public: + + + virtual ~Cassandra_describe_snitch_presult() throw() {} + + std::string* success; + + _Cassandra_describe_snitch_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_keyspace_args { + public: + + Cassandra_describe_keyspace_args() : keyspace("") { + } + + virtual ~Cassandra_describe_keyspace_args() throw() {} + + std::string keyspace; + + void __set_keyspace(const std::string& val) { + keyspace = val; + } + + bool operator == (const Cassandra_describe_keyspace_args & rhs) const + { + if (!(keyspace == rhs.keyspace)) + return false; + return true; + } + bool operator != (const Cassandra_describe_keyspace_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_keyspace_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_keyspace_pargs { + public: + + + virtual ~Cassandra_describe_keyspace_pargs() throw() {} + + const std::string* keyspace; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_keyspace_result__isset { + _Cassandra_describe_keyspace_result__isset() : success(false), nfe(false), ire(false) {} + bool success; + bool nfe; + bool ire; +} _Cassandra_describe_keyspace_result__isset; + +class Cassandra_describe_keyspace_result { + public: + + Cassandra_describe_keyspace_result() { + } + + virtual ~Cassandra_describe_keyspace_result() throw() {} + + KsDef success; + NotFoundException nfe; + InvalidRequestException ire; + + _Cassandra_describe_keyspace_result__isset __isset; + + void __set_success(const KsDef& val) { + success = val; + } + + void __set_nfe(const NotFoundException& val) { + nfe = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_describe_keyspace_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(nfe == rhs.nfe)) + return false; + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_describe_keyspace_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_keyspace_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_keyspace_presult__isset { + _Cassandra_describe_keyspace_presult__isset() : success(false), nfe(false), ire(false) {} + bool success; + bool nfe; + bool ire; +} _Cassandra_describe_keyspace_presult__isset; + +class Cassandra_describe_keyspace_presult { + public: + + + virtual ~Cassandra_describe_keyspace_presult() throw() {} + + KsDef* success; + NotFoundException nfe; + InvalidRequestException ire; + + _Cassandra_describe_keyspace_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_describe_splits_args { + public: + + Cassandra_describe_splits_args() : cfName(""), start_token(""), end_token(""), keys_per_split(0) { + } + + virtual ~Cassandra_describe_splits_args() throw() {} + + std::string cfName; + std::string start_token; + std::string end_token; + int32_t keys_per_split; + + void __set_cfName(const std::string& val) { + cfName = val; + } + + void __set_start_token(const std::string& val) { + start_token = val; + } + + void __set_end_token(const std::string& val) { + end_token = val; + } + + void __set_keys_per_split(const int32_t val) { + keys_per_split = val; + } + + bool operator == (const Cassandra_describe_splits_args & rhs) const + { + if (!(cfName == rhs.cfName)) + return false; + if (!(start_token == rhs.start_token)) + return false; + if (!(end_token == rhs.end_token)) + return false; + if (!(keys_per_split == rhs.keys_per_split)) + return false; + return true; + } + bool operator != (const Cassandra_describe_splits_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_splits_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_describe_splits_pargs { + public: + + + virtual ~Cassandra_describe_splits_pargs() throw() {} + + const std::string* cfName; + const std::string* start_token; + const std::string* end_token; + const int32_t* keys_per_split; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_splits_result__isset { + _Cassandra_describe_splits_result__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_splits_result__isset; + +class Cassandra_describe_splits_result { + public: + + Cassandra_describe_splits_result() { + } + + virtual ~Cassandra_describe_splits_result() throw() {} + + std::vector success; + InvalidRequestException ire; + + _Cassandra_describe_splits_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_describe_splits_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_describe_splits_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_describe_splits_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_describe_splits_presult__isset { + _Cassandra_describe_splits_presult__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_describe_splits_presult__isset; + +class Cassandra_describe_splits_presult { + public: + + + virtual ~Cassandra_describe_splits_presult() throw() {} + + std::vector * success; + InvalidRequestException ire; + + _Cassandra_describe_splits_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_system_add_column_family_args { + public: + + Cassandra_system_add_column_family_args() { + } + + virtual ~Cassandra_system_add_column_family_args() throw() {} + + CfDef cf_def; + + void __set_cf_def(const CfDef& val) { + cf_def = val; + } + + bool operator == (const Cassandra_system_add_column_family_args & rhs) const + { + if (!(cf_def == rhs.cf_def)) + return false; + return true; + } + bool operator != (const Cassandra_system_add_column_family_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_add_column_family_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_system_add_column_family_pargs { + public: + + + virtual ~Cassandra_system_add_column_family_pargs() throw() {} + + const CfDef* cf_def; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_add_column_family_result__isset { + _Cassandra_system_add_column_family_result__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_add_column_family_result__isset; + +class Cassandra_system_add_column_family_result { + public: + + Cassandra_system_add_column_family_result() : success("") { + } + + virtual ~Cassandra_system_add_column_family_result() throw() {} + + std::string success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_add_column_family_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_system_add_column_family_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_system_add_column_family_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_add_column_family_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_add_column_family_presult__isset { + _Cassandra_system_add_column_family_presult__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_add_column_family_presult__isset; + +class Cassandra_system_add_column_family_presult { + public: + + + virtual ~Cassandra_system_add_column_family_presult() throw() {} + + std::string* success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_add_column_family_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_system_drop_column_family_args { + public: + + Cassandra_system_drop_column_family_args() : column_family("") { + } + + virtual ~Cassandra_system_drop_column_family_args() throw() {} + + std::string column_family; + + void __set_column_family(const std::string& val) { + column_family = val; + } + + bool operator == (const Cassandra_system_drop_column_family_args & rhs) const + { + if (!(column_family == rhs.column_family)) + return false; + return true; + } + bool operator != (const Cassandra_system_drop_column_family_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_drop_column_family_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_system_drop_column_family_pargs { + public: + + + virtual ~Cassandra_system_drop_column_family_pargs() throw() {} + + const std::string* column_family; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_drop_column_family_result__isset { + _Cassandra_system_drop_column_family_result__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_drop_column_family_result__isset; + +class Cassandra_system_drop_column_family_result { + public: + + Cassandra_system_drop_column_family_result() : success("") { + } + + virtual ~Cassandra_system_drop_column_family_result() throw() {} + + std::string success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_drop_column_family_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_system_drop_column_family_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_system_drop_column_family_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_drop_column_family_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_drop_column_family_presult__isset { + _Cassandra_system_drop_column_family_presult__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_drop_column_family_presult__isset; + +class Cassandra_system_drop_column_family_presult { + public: + + + virtual ~Cassandra_system_drop_column_family_presult() throw() {} + + std::string* success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_drop_column_family_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_system_add_keyspace_args { + public: + + Cassandra_system_add_keyspace_args() { + } + + virtual ~Cassandra_system_add_keyspace_args() throw() {} + + KsDef ks_def; + + void __set_ks_def(const KsDef& val) { + ks_def = val; + } + + bool operator == (const Cassandra_system_add_keyspace_args & rhs) const + { + if (!(ks_def == rhs.ks_def)) + return false; + return true; + } + bool operator != (const Cassandra_system_add_keyspace_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_add_keyspace_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_system_add_keyspace_pargs { + public: + + + virtual ~Cassandra_system_add_keyspace_pargs() throw() {} + + const KsDef* ks_def; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_add_keyspace_result__isset { + _Cassandra_system_add_keyspace_result__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_add_keyspace_result__isset; + +class Cassandra_system_add_keyspace_result { + public: + + Cassandra_system_add_keyspace_result() : success("") { + } + + virtual ~Cassandra_system_add_keyspace_result() throw() {} + + std::string success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_add_keyspace_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_system_add_keyspace_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_system_add_keyspace_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_add_keyspace_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_add_keyspace_presult__isset { + _Cassandra_system_add_keyspace_presult__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_add_keyspace_presult__isset; + +class Cassandra_system_add_keyspace_presult { + public: + + + virtual ~Cassandra_system_add_keyspace_presult() throw() {} + + std::string* success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_add_keyspace_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_system_drop_keyspace_args { + public: + + Cassandra_system_drop_keyspace_args() : keyspace("") { + } + + virtual ~Cassandra_system_drop_keyspace_args() throw() {} + + std::string keyspace; + + void __set_keyspace(const std::string& val) { + keyspace = val; + } + + bool operator == (const Cassandra_system_drop_keyspace_args & rhs) const + { + if (!(keyspace == rhs.keyspace)) + return false; + return true; + } + bool operator != (const Cassandra_system_drop_keyspace_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_drop_keyspace_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_system_drop_keyspace_pargs { + public: + + + virtual ~Cassandra_system_drop_keyspace_pargs() throw() {} + + const std::string* keyspace; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_drop_keyspace_result__isset { + _Cassandra_system_drop_keyspace_result__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_drop_keyspace_result__isset; + +class Cassandra_system_drop_keyspace_result { + public: + + Cassandra_system_drop_keyspace_result() : success("") { + } + + virtual ~Cassandra_system_drop_keyspace_result() throw() {} + + std::string success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_drop_keyspace_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_system_drop_keyspace_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_system_drop_keyspace_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_drop_keyspace_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_drop_keyspace_presult__isset { + _Cassandra_system_drop_keyspace_presult__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_drop_keyspace_presult__isset; + +class Cassandra_system_drop_keyspace_presult { + public: + + + virtual ~Cassandra_system_drop_keyspace_presult() throw() {} + + std::string* success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_drop_keyspace_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_system_update_keyspace_args { + public: + + Cassandra_system_update_keyspace_args() { + } + + virtual ~Cassandra_system_update_keyspace_args() throw() {} + + KsDef ks_def; + + void __set_ks_def(const KsDef& val) { + ks_def = val; + } + + bool operator == (const Cassandra_system_update_keyspace_args & rhs) const + { + if (!(ks_def == rhs.ks_def)) + return false; + return true; + } + bool operator != (const Cassandra_system_update_keyspace_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_update_keyspace_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_system_update_keyspace_pargs { + public: + + + virtual ~Cassandra_system_update_keyspace_pargs() throw() {} + + const KsDef* ks_def; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_update_keyspace_result__isset { + _Cassandra_system_update_keyspace_result__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_update_keyspace_result__isset; + +class Cassandra_system_update_keyspace_result { + public: + + Cassandra_system_update_keyspace_result() : success("") { + } + + virtual ~Cassandra_system_update_keyspace_result() throw() {} + + std::string success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_update_keyspace_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_system_update_keyspace_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_system_update_keyspace_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_update_keyspace_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_update_keyspace_presult__isset { + _Cassandra_system_update_keyspace_presult__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_update_keyspace_presult__isset; + +class Cassandra_system_update_keyspace_presult { + public: + + + virtual ~Cassandra_system_update_keyspace_presult() throw() {} + + std::string* success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_update_keyspace_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_system_update_column_family_args { + public: + + Cassandra_system_update_column_family_args() { + } + + virtual ~Cassandra_system_update_column_family_args() throw() {} + + CfDef cf_def; + + void __set_cf_def(const CfDef& val) { + cf_def = val; + } + + bool operator == (const Cassandra_system_update_column_family_args & rhs) const + { + if (!(cf_def == rhs.cf_def)) + return false; + return true; + } + bool operator != (const Cassandra_system_update_column_family_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_update_column_family_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_system_update_column_family_pargs { + public: + + + virtual ~Cassandra_system_update_column_family_pargs() throw() {} + + const CfDef* cf_def; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_update_column_family_result__isset { + _Cassandra_system_update_column_family_result__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_update_column_family_result__isset; + +class Cassandra_system_update_column_family_result { + public: + + Cassandra_system_update_column_family_result() : success("") { + } + + virtual ~Cassandra_system_update_column_family_result() throw() {} + + std::string success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_update_column_family_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_system_update_column_family_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_system_update_column_family_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_system_update_column_family_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_system_update_column_family_presult__isset { + _Cassandra_system_update_column_family_presult__isset() : success(false), ire(false), sde(false) {} + bool success; + bool ire; + bool sde; +} _Cassandra_system_update_column_family_presult__isset; + +class Cassandra_system_update_column_family_presult { + public: + + + virtual ~Cassandra_system_update_column_family_presult() throw() {} + + std::string* success; + InvalidRequestException ire; + SchemaDisagreementException sde; + + _Cassandra_system_update_column_family_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_execute_cql_query_args { + public: + + Cassandra_execute_cql_query_args() : query(""), compression((Compression::type)0) { + } + + virtual ~Cassandra_execute_cql_query_args() throw() {} + + std::string query; + Compression::type compression; + + void __set_query(const std::string& val) { + query = val; + } + + void __set_compression(const Compression::type val) { + compression = val; + } + + bool operator == (const Cassandra_execute_cql_query_args & rhs) const + { + if (!(query == rhs.query)) + return false; + if (!(compression == rhs.compression)) + return false; + return true; + } + bool operator != (const Cassandra_execute_cql_query_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_execute_cql_query_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_execute_cql_query_pargs { + public: + + + virtual ~Cassandra_execute_cql_query_pargs() throw() {} + + const std::string* query; + const Compression::type* compression; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_execute_cql_query_result__isset { + _Cassandra_execute_cql_query_result__isset() : success(false), ire(false), ue(false), te(false), sde(false) {} + bool success; + bool ire; + bool ue; + bool te; + bool sde; +} _Cassandra_execute_cql_query_result__isset; + +class Cassandra_execute_cql_query_result { + public: + + Cassandra_execute_cql_query_result() { + } + + virtual ~Cassandra_execute_cql_query_result() throw() {} + + CqlResult success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + SchemaDisagreementException sde; + + _Cassandra_execute_cql_query_result__isset __isset; + + void __set_success(const CqlResult& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_execute_cql_query_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_execute_cql_query_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_execute_cql_query_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_execute_cql_query_presult__isset { + _Cassandra_execute_cql_query_presult__isset() : success(false), ire(false), ue(false), te(false), sde(false) {} + bool success; + bool ire; + bool ue; + bool te; + bool sde; +} _Cassandra_execute_cql_query_presult__isset; + +class Cassandra_execute_cql_query_presult { + public: + + + virtual ~Cassandra_execute_cql_query_presult() throw() {} + + CqlResult* success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + SchemaDisagreementException sde; + + _Cassandra_execute_cql_query_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_prepare_cql_query_args { + public: + + Cassandra_prepare_cql_query_args() : query(""), compression((Compression::type)0) { + } + + virtual ~Cassandra_prepare_cql_query_args() throw() {} + + std::string query; + Compression::type compression; + + void __set_query(const std::string& val) { + query = val; + } + + void __set_compression(const Compression::type val) { + compression = val; + } + + bool operator == (const Cassandra_prepare_cql_query_args & rhs) const + { + if (!(query == rhs.query)) + return false; + if (!(compression == rhs.compression)) + return false; + return true; + } + bool operator != (const Cassandra_prepare_cql_query_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_prepare_cql_query_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_prepare_cql_query_pargs { + public: + + + virtual ~Cassandra_prepare_cql_query_pargs() throw() {} + + const std::string* query; + const Compression::type* compression; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_prepare_cql_query_result__isset { + _Cassandra_prepare_cql_query_result__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_prepare_cql_query_result__isset; + +class Cassandra_prepare_cql_query_result { + public: + + Cassandra_prepare_cql_query_result() { + } + + virtual ~Cassandra_prepare_cql_query_result() throw() {} + + CqlPreparedResult success; + InvalidRequestException ire; + + _Cassandra_prepare_cql_query_result__isset __isset; + + void __set_success(const CqlPreparedResult& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_prepare_cql_query_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_prepare_cql_query_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_prepare_cql_query_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_prepare_cql_query_presult__isset { + _Cassandra_prepare_cql_query_presult__isset() : success(false), ire(false) {} + bool success; + bool ire; +} _Cassandra_prepare_cql_query_presult__isset; + +class Cassandra_prepare_cql_query_presult { + public: + + + virtual ~Cassandra_prepare_cql_query_presult() throw() {} + + CqlPreparedResult* success; + InvalidRequestException ire; + + _Cassandra_prepare_cql_query_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_execute_prepared_cql_query_args { + public: + + Cassandra_execute_prepared_cql_query_args() : itemId(0) { + } + + virtual ~Cassandra_execute_prepared_cql_query_args() throw() {} + + int32_t itemId; + std::vector values; + + void __set_itemId(const int32_t val) { + itemId = val; + } + + void __set_values(const std::vector & val) { + values = val; + } + + bool operator == (const Cassandra_execute_prepared_cql_query_args & rhs) const + { + if (!(itemId == rhs.itemId)) + return false; + if (!(values == rhs.values)) + return false; + return true; + } + bool operator != (const Cassandra_execute_prepared_cql_query_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_execute_prepared_cql_query_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_execute_prepared_cql_query_pargs { + public: + + + virtual ~Cassandra_execute_prepared_cql_query_pargs() throw() {} + + const int32_t* itemId; + const std::vector * values; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_execute_prepared_cql_query_result__isset { + _Cassandra_execute_prepared_cql_query_result__isset() : success(false), ire(false), ue(false), te(false), sde(false) {} + bool success; + bool ire; + bool ue; + bool te; + bool sde; +} _Cassandra_execute_prepared_cql_query_result__isset; + +class Cassandra_execute_prepared_cql_query_result { + public: + + Cassandra_execute_prepared_cql_query_result() { + } + + virtual ~Cassandra_execute_prepared_cql_query_result() throw() {} + + CqlResult success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + SchemaDisagreementException sde; + + _Cassandra_execute_prepared_cql_query_result__isset __isset; + + void __set_success(const CqlResult& val) { + success = val; + } + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + void __set_ue(const UnavailableException& val) { + ue = val; + } + + void __set_te(const TimedOutException& val) { + te = val; + } + + void __set_sde(const SchemaDisagreementException& val) { + sde = val; + } + + bool operator == (const Cassandra_execute_prepared_cql_query_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(ire == rhs.ire)) + return false; + if (!(ue == rhs.ue)) + return false; + if (!(te == rhs.te)) + return false; + if (!(sde == rhs.sde)) + return false; + return true; + } + bool operator != (const Cassandra_execute_prepared_cql_query_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_execute_prepared_cql_query_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_execute_prepared_cql_query_presult__isset { + _Cassandra_execute_prepared_cql_query_presult__isset() : success(false), ire(false), ue(false), te(false), sde(false) {} + bool success; + bool ire; + bool ue; + bool te; + bool sde; +} _Cassandra_execute_prepared_cql_query_presult__isset; + +class Cassandra_execute_prepared_cql_query_presult { + public: + + + virtual ~Cassandra_execute_prepared_cql_query_presult() throw() {} + + CqlResult* success; + InvalidRequestException ire; + UnavailableException ue; + TimedOutException te; + SchemaDisagreementException sde; + + _Cassandra_execute_prepared_cql_query_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Cassandra_set_cql_version_args { + public: + + Cassandra_set_cql_version_args() : version("") { + } + + virtual ~Cassandra_set_cql_version_args() throw() {} + + std::string version; + + void __set_version(const std::string& val) { + version = val; + } + + bool operator == (const Cassandra_set_cql_version_args & rhs) const + { + if (!(version == rhs.version)) + return false; + return true; + } + bool operator != (const Cassandra_set_cql_version_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_set_cql_version_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Cassandra_set_cql_version_pargs { + public: + + + virtual ~Cassandra_set_cql_version_pargs() throw() {} + + const std::string* version; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_set_cql_version_result__isset { + _Cassandra_set_cql_version_result__isset() : ire(false) {} + bool ire; +} _Cassandra_set_cql_version_result__isset; + +class Cassandra_set_cql_version_result { + public: + + Cassandra_set_cql_version_result() { + } + + virtual ~Cassandra_set_cql_version_result() throw() {} + + InvalidRequestException ire; + + _Cassandra_set_cql_version_result__isset __isset; + + void __set_ire(const InvalidRequestException& val) { + ire = val; + } + + bool operator == (const Cassandra_set_cql_version_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + return true; + } + bool operator != (const Cassandra_set_cql_version_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Cassandra_set_cql_version_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Cassandra_set_cql_version_presult__isset { + _Cassandra_set_cql_version_presult__isset() : ire(false) {} + bool ire; +} _Cassandra_set_cql_version_presult__isset; + +class Cassandra_set_cql_version_presult { + public: + + + virtual ~Cassandra_set_cql_version_presult() throw() {} + + InvalidRequestException ire; + + _Cassandra_set_cql_version_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +class CassandraClient : virtual public CassandraIf { + public: + CassandraClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : + piprot_(prot), + poprot_(prot) { + iprot_ = prot.get(); + oprot_ = prot.get(); + } + CassandraClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) : + piprot_(iprot), + poprot_(oprot) { + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void login(const AuthenticationRequest& auth_request); + void send_login(const AuthenticationRequest& auth_request); + void recv_login(); + void set_keyspace(const std::string& keyspace); + void send_set_keyspace(const std::string& keyspace); + void recv_set_keyspace(); + void get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level); + void send_get(const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level); + void recv_get(ColumnOrSuperColumn& _return); + void get_slice(std::vector & _return, const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + void send_get_slice(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + void recv_get_slice(std::vector & _return); + int32_t get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + void send_get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + int32_t recv_get_count(); + void multiget_slice(std::map > & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + void send_multiget_slice(const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + void recv_multiget_slice(std::map > & _return); + void multiget_count(std::map & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + void send_multiget_count(const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level); + void recv_multiget_count(std::map & _return); + void get_range_slices(std::vector & _return, const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level); + void send_get_range_slices(const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level); + void recv_get_range_slices(std::vector & _return); + void get_paged_slice(std::vector & _return, const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level); + void send_get_paged_slice(const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level); + void recv_get_paged_slice(std::vector & _return); + void get_indexed_slices(std::vector & _return, const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level); + void send_get_indexed_slices(const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level); + void recv_get_indexed_slices(std::vector & _return); + void insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level); + void send_insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level); + void recv_insert(); + void add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level); + void send_add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level); + void recv_add(); + void remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level); + void send_remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level); + void recv_remove(); + void remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level); + void send_remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level); + void recv_remove_counter(); + void batch_mutate(const std::map > > & mutation_map, const ConsistencyLevel::type consistency_level); + void send_batch_mutate(const std::map > > & mutation_map, const ConsistencyLevel::type consistency_level); + void recv_batch_mutate(); + void truncate(const std::string& cfname); + void send_truncate(const std::string& cfname); + void recv_truncate(); + void describe_schema_versions(std::map > & _return); + void send_describe_schema_versions(); + void recv_describe_schema_versions(std::map > & _return); + void describe_keyspaces(std::vector & _return); + void send_describe_keyspaces(); + void recv_describe_keyspaces(std::vector & _return); + void describe_cluster_name(std::string& _return); + void send_describe_cluster_name(); + void recv_describe_cluster_name(std::string& _return); + void describe_version(std::string& _return); + void send_describe_version(); + void recv_describe_version(std::string& _return); + void describe_ring(std::vector & _return, const std::string& keyspace); + void send_describe_ring(const std::string& keyspace); + void recv_describe_ring(std::vector & _return); + void describe_token_map(std::map & _return); + void send_describe_token_map(); + void recv_describe_token_map(std::map & _return); + void describe_partitioner(std::string& _return); + void send_describe_partitioner(); + void recv_describe_partitioner(std::string& _return); + void describe_snitch(std::string& _return); + void send_describe_snitch(); + void recv_describe_snitch(std::string& _return); + void describe_keyspace(KsDef& _return, const std::string& keyspace); + void send_describe_keyspace(const std::string& keyspace); + void recv_describe_keyspace(KsDef& _return); + void describe_splits(std::vector & _return, const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split); + void send_describe_splits(const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split); + void recv_describe_splits(std::vector & _return); + void system_add_column_family(std::string& _return, const CfDef& cf_def); + void send_system_add_column_family(const CfDef& cf_def); + void recv_system_add_column_family(std::string& _return); + void system_drop_column_family(std::string& _return, const std::string& column_family); + void send_system_drop_column_family(const std::string& column_family); + void recv_system_drop_column_family(std::string& _return); + void system_add_keyspace(std::string& _return, const KsDef& ks_def); + void send_system_add_keyspace(const KsDef& ks_def); + void recv_system_add_keyspace(std::string& _return); + void system_drop_keyspace(std::string& _return, const std::string& keyspace); + void send_system_drop_keyspace(const std::string& keyspace); + void recv_system_drop_keyspace(std::string& _return); + void system_update_keyspace(std::string& _return, const KsDef& ks_def); + void send_system_update_keyspace(const KsDef& ks_def); + void recv_system_update_keyspace(std::string& _return); + void system_update_column_family(std::string& _return, const CfDef& cf_def); + void send_system_update_column_family(const CfDef& cf_def); + void recv_system_update_column_family(std::string& _return); + void execute_cql_query(CqlResult& _return, const std::string& query, const Compression::type compression); + void send_execute_cql_query(const std::string& query, const Compression::type compression); + void recv_execute_cql_query(CqlResult& _return); + void prepare_cql_query(CqlPreparedResult& _return, const std::string& query, const Compression::type compression); + void send_prepare_cql_query(const std::string& query, const Compression::type compression); + void recv_prepare_cql_query(CqlPreparedResult& _return); + void execute_prepared_cql_query(CqlResult& _return, const int32_t itemId, const std::vector & values); + void send_execute_prepared_cql_query(const int32_t itemId, const std::vector & values); + void recv_execute_prepared_cql_query(CqlResult& _return); + void set_cql_version(const std::string& version); + void send_set_cql_version(const std::string& version); + void recv_set_cql_version(); + protected: + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; +}; + +class CassandraProcessor : public ::apache::thrift::TProcessor { + protected: + boost::shared_ptr iface_; + virtual bool process_fn(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, std::string& fname, int32_t seqid, void* callContext); + private: + std::map processMap_; + void process_login(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_set_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_get(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_get_slice(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_get_count(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_multiget_slice(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_multiget_count(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_get_range_slices(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_get_paged_slice(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_get_indexed_slices(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_insert(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_add(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_remove(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_remove_counter(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_batch_mutate(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_truncate(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_schema_versions(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_keyspaces(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_cluster_name(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_version(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_ring(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_token_map(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_partitioner(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_snitch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_describe_splits(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_system_add_column_family(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_system_drop_column_family(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_system_add_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_system_drop_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_system_update_keyspace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_system_update_column_family(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_execute_cql_query(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_prepare_cql_query(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_execute_prepared_cql_query(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_set_cql_version(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + public: + CassandraProcessor(boost::shared_ptr iface) : + iface_(iface) { + processMap_["login"] = &CassandraProcessor::process_login; + processMap_["set_keyspace"] = &CassandraProcessor::process_set_keyspace; + processMap_["get"] = &CassandraProcessor::process_get; + processMap_["get_slice"] = &CassandraProcessor::process_get_slice; + processMap_["get_count"] = &CassandraProcessor::process_get_count; + processMap_["multiget_slice"] = &CassandraProcessor::process_multiget_slice; + processMap_["multiget_count"] = &CassandraProcessor::process_multiget_count; + processMap_["get_range_slices"] = &CassandraProcessor::process_get_range_slices; + processMap_["get_paged_slice"] = &CassandraProcessor::process_get_paged_slice; + processMap_["get_indexed_slices"] = &CassandraProcessor::process_get_indexed_slices; + processMap_["insert"] = &CassandraProcessor::process_insert; + processMap_["add"] = &CassandraProcessor::process_add; + processMap_["remove"] = &CassandraProcessor::process_remove; + processMap_["remove_counter"] = &CassandraProcessor::process_remove_counter; + processMap_["batch_mutate"] = &CassandraProcessor::process_batch_mutate; + processMap_["truncate"] = &CassandraProcessor::process_truncate; + processMap_["describe_schema_versions"] = &CassandraProcessor::process_describe_schema_versions; + processMap_["describe_keyspaces"] = &CassandraProcessor::process_describe_keyspaces; + processMap_["describe_cluster_name"] = &CassandraProcessor::process_describe_cluster_name; + processMap_["describe_version"] = &CassandraProcessor::process_describe_version; + processMap_["describe_ring"] = &CassandraProcessor::process_describe_ring; + processMap_["describe_token_map"] = &CassandraProcessor::process_describe_token_map; + processMap_["describe_partitioner"] = &CassandraProcessor::process_describe_partitioner; + processMap_["describe_snitch"] = &CassandraProcessor::process_describe_snitch; + processMap_["describe_keyspace"] = &CassandraProcessor::process_describe_keyspace; + processMap_["describe_splits"] = &CassandraProcessor::process_describe_splits; + processMap_["system_add_column_family"] = &CassandraProcessor::process_system_add_column_family; + processMap_["system_drop_column_family"] = &CassandraProcessor::process_system_drop_column_family; + processMap_["system_add_keyspace"] = &CassandraProcessor::process_system_add_keyspace; + processMap_["system_drop_keyspace"] = &CassandraProcessor::process_system_drop_keyspace; + processMap_["system_update_keyspace"] = &CassandraProcessor::process_system_update_keyspace; + processMap_["system_update_column_family"] = &CassandraProcessor::process_system_update_column_family; + processMap_["execute_cql_query"] = &CassandraProcessor::process_execute_cql_query; + processMap_["prepare_cql_query"] = &CassandraProcessor::process_prepare_cql_query; + processMap_["execute_prepared_cql_query"] = &CassandraProcessor::process_execute_prepared_cql_query; + processMap_["set_cql_version"] = &CassandraProcessor::process_set_cql_version; + } + + virtual bool process(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot, void* callContext); + virtual ~CassandraProcessor() {} +}; + +class CassandraProcessorFactory : public ::apache::thrift::TProcessorFactory { + public: + CassandraProcessorFactory(const ::boost::shared_ptr< CassandraIfFactory >& handlerFactory) : + handlerFactory_(handlerFactory) {} + + ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + + protected: + ::boost::shared_ptr< CassandraIfFactory > handlerFactory_; +}; + +class CassandraMultiface : virtual public CassandraIf { + public: + CassandraMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + } + virtual ~CassandraMultiface() {} + protected: + std::vector > ifaces_; + CassandraMultiface() {} + void add(boost::shared_ptr iface) { + ifaces_.push_back(iface); + } + public: + void login(const AuthenticationRequest& auth_request) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->login(auth_request); + } + } + + void set_keyspace(const std::string& keyspace) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->set_keyspace(keyspace); + } + } + + void get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->get(_return, key, column_path, consistency_level); + return; + } else { + ifaces_[i]->get(_return, key, column_path, consistency_level); + } + } + } + + void get_slice(std::vector & _return, const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->get_slice(_return, key, column_parent, predicate, consistency_level); + return; + } else { + ifaces_[i]->get_slice(_return, key, column_parent, predicate, consistency_level); + } + } + } + + int32_t get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + return ifaces_[i]->get_count(key, column_parent, predicate, consistency_level); + } else { + ifaces_[i]->get_count(key, column_parent, predicate, consistency_level); + } + } + return 0xDEADBEEF; //psergey: shut up the compiler + } + + void multiget_slice(std::map > & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->multiget_slice(_return, keys, column_parent, predicate, consistency_level); + return; + } else { + ifaces_[i]->multiget_slice(_return, keys, column_parent, predicate, consistency_level); + } + } + } + + void multiget_count(std::map & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->multiget_count(_return, keys, column_parent, predicate, consistency_level); + return; + } else { + ifaces_[i]->multiget_count(_return, keys, column_parent, predicate, consistency_level); + } + } + } + + void get_range_slices(std::vector & _return, const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->get_range_slices(_return, column_parent, predicate, range, consistency_level); + return; + } else { + ifaces_[i]->get_range_slices(_return, column_parent, predicate, range, consistency_level); + } + } + } + + void get_paged_slice(std::vector & _return, const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->get_paged_slice(_return, column_family, range, start_column, consistency_level); + return; + } else { + ifaces_[i]->get_paged_slice(_return, column_family, range, start_column, consistency_level); + } + } + } + + void get_indexed_slices(std::vector & _return, const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->get_indexed_slices(_return, column_parent, index_clause, column_predicate, consistency_level); + return; + } else { + ifaces_[i]->get_indexed_slices(_return, column_parent, index_clause, column_predicate, consistency_level); + } + } + } + + void insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->insert(key, column_parent, column, consistency_level); + } + } + + void add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->add(key, column_parent, column, consistency_level); + } + } + + void remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->remove(key, column_path, timestamp, consistency_level); + } + } + + void remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->remove_counter(key, path, consistency_level); + } + } + + void batch_mutate(const std::map > > & mutation_map, const ConsistencyLevel::type consistency_level) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->batch_mutate(mutation_map, consistency_level); + } + } + + void truncate(const std::string& cfname) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->truncate(cfname); + } + } + + void describe_schema_versions(std::map > & _return) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_schema_versions(_return); + return; + } else { + ifaces_[i]->describe_schema_versions(_return); + } + } + } + + void describe_keyspaces(std::vector & _return) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_keyspaces(_return); + return; + } else { + ifaces_[i]->describe_keyspaces(_return); + } + } + } + + void describe_cluster_name(std::string& _return) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_cluster_name(_return); + return; + } else { + ifaces_[i]->describe_cluster_name(_return); + } + } + } + + void describe_version(std::string& _return) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_version(_return); + return; + } else { + ifaces_[i]->describe_version(_return); + } + } + } + + void describe_ring(std::vector & _return, const std::string& keyspace) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_ring(_return, keyspace); + return; + } else { + ifaces_[i]->describe_ring(_return, keyspace); + } + } + } + + void describe_token_map(std::map & _return) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_token_map(_return); + return; + } else { + ifaces_[i]->describe_token_map(_return); + } + } + } + + void describe_partitioner(std::string& _return) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_partitioner(_return); + return; + } else { + ifaces_[i]->describe_partitioner(_return); + } + } + } + + void describe_snitch(std::string& _return) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_snitch(_return); + return; + } else { + ifaces_[i]->describe_snitch(_return); + } + } + } + + void describe_keyspace(KsDef& _return, const std::string& keyspace) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_keyspace(_return, keyspace); + return; + } else { + ifaces_[i]->describe_keyspace(_return, keyspace); + } + } + } + + void describe_splits(std::vector & _return, const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->describe_splits(_return, cfName, start_token, end_token, keys_per_split); + return; + } else { + ifaces_[i]->describe_splits(_return, cfName, start_token, end_token, keys_per_split); + } + } + } + + void system_add_column_family(std::string& _return, const CfDef& cf_def) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->system_add_column_family(_return, cf_def); + return; + } else { + ifaces_[i]->system_add_column_family(_return, cf_def); + } + } + } + + void system_drop_column_family(std::string& _return, const std::string& column_family) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->system_drop_column_family(_return, column_family); + return; + } else { + ifaces_[i]->system_drop_column_family(_return, column_family); + } + } + } + + void system_add_keyspace(std::string& _return, const KsDef& ks_def) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->system_add_keyspace(_return, ks_def); + return; + } else { + ifaces_[i]->system_add_keyspace(_return, ks_def); + } + } + } + + void system_drop_keyspace(std::string& _return, const std::string& keyspace) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->system_drop_keyspace(_return, keyspace); + return; + } else { + ifaces_[i]->system_drop_keyspace(_return, keyspace); + } + } + } + + void system_update_keyspace(std::string& _return, const KsDef& ks_def) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->system_update_keyspace(_return, ks_def); + return; + } else { + ifaces_[i]->system_update_keyspace(_return, ks_def); + } + } + } + + void system_update_column_family(std::string& _return, const CfDef& cf_def) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->system_update_column_family(_return, cf_def); + return; + } else { + ifaces_[i]->system_update_column_family(_return, cf_def); + } + } + } + + void execute_cql_query(CqlResult& _return, const std::string& query, const Compression::type compression) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->execute_cql_query(_return, query, compression); + return; + } else { + ifaces_[i]->execute_cql_query(_return, query, compression); + } + } + } + + void prepare_cql_query(CqlPreparedResult& _return, const std::string& query, const Compression::type compression) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->prepare_cql_query(_return, query, compression); + return; + } else { + ifaces_[i]->prepare_cql_query(_return, query, compression); + } + } + } + + void execute_prepared_cql_query(CqlResult& _return, const int32_t itemId, const std::vector & values) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->execute_prepared_cql_query(_return, itemId, values); + return; + } else { + ifaces_[i]->execute_prepared_cql_query(_return, itemId, values); + } + } + } + + void set_cql_version(const std::string& version) { + size_t sz = ifaces_.size(); + for (size_t i = 0; i < sz; ++i) { + ifaces_[i]->set_cql_version(version); + } + } + +}; + +}}} // namespace + +#endif diff --git a/storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp b/storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp new file mode 100644 index 00000000000..4d4e489ef4d --- /dev/null +++ b/storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp @@ -0,0 +1,219 @@ +// This autogenerated skeleton file illustrates how to build a server. +// You should copy it to another filename to avoid overwriting it. + +#include "Cassandra.h" +#include +#include +#include +#include + +using namespace ::apache::thrift; +using namespace ::apache::thrift::protocol; +using namespace ::apache::thrift::transport; +using namespace ::apache::thrift::server; + +using boost::shared_ptr; + +using namespace ::org::apache::cassandra; + +class CassandraHandler : virtual public CassandraIf { + public: + CassandraHandler() { + // Your initialization goes here + } + + void login(const AuthenticationRequest& auth_request) { + // Your implementation goes here + printf("login\n"); + } + + void set_keyspace(const std::string& keyspace) { + // Your implementation goes here + printf("set_keyspace\n"); + } + + void get(ColumnOrSuperColumn& _return, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("get\n"); + } + + void get_slice(std::vector & _return, const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("get_slice\n"); + } + + int32_t get_count(const std::string& key, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("get_count\n"); + } + + void multiget_slice(std::map > & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("multiget_slice\n"); + } + + void multiget_count(std::map & _return, const std::vector & keys, const ColumnParent& column_parent, const SlicePredicate& predicate, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("multiget_count\n"); + } + + void get_range_slices(std::vector & _return, const ColumnParent& column_parent, const SlicePredicate& predicate, const KeyRange& range, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("get_range_slices\n"); + } + + void get_paged_slice(std::vector & _return, const std::string& column_family, const KeyRange& range, const std::string& start_column, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("get_paged_slice\n"); + } + + void get_indexed_slices(std::vector & _return, const ColumnParent& column_parent, const IndexClause& index_clause, const SlicePredicate& column_predicate, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("get_indexed_slices\n"); + } + + void insert(const std::string& key, const ColumnParent& column_parent, const Column& column, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("insert\n"); + } + + void add(const std::string& key, const ColumnParent& column_parent, const CounterColumn& column, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("add\n"); + } + + void remove(const std::string& key, const ColumnPath& column_path, const int64_t timestamp, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("remove\n"); + } + + void remove_counter(const std::string& key, const ColumnPath& path, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("remove_counter\n"); + } + + void batch_mutate(const std::map > > & mutation_map, const ConsistencyLevel::type consistency_level) { + // Your implementation goes here + printf("batch_mutate\n"); + } + + void truncate(const std::string& cfname) { + // Your implementation goes here + printf("truncate\n"); + } + + void describe_schema_versions(std::map > & _return) { + // Your implementation goes here + printf("describe_schema_versions\n"); + } + + void describe_keyspaces(std::vector & _return) { + // Your implementation goes here + printf("describe_keyspaces\n"); + } + + void describe_cluster_name(std::string& _return) { + // Your implementation goes here + printf("describe_cluster_name\n"); + } + + void describe_version(std::string& _return) { + // Your implementation goes here + printf("describe_version\n"); + } + + void describe_ring(std::vector & _return, const std::string& keyspace) { + // Your implementation goes here + printf("describe_ring\n"); + } + + void describe_token_map(std::map & _return) { + // Your implementation goes here + printf("describe_token_map\n"); + } + + void describe_partitioner(std::string& _return) { + // Your implementation goes here + printf("describe_partitioner\n"); + } + + void describe_snitch(std::string& _return) { + // Your implementation goes here + printf("describe_snitch\n"); + } + + void describe_keyspace(KsDef& _return, const std::string& keyspace) { + // Your implementation goes here + printf("describe_keyspace\n"); + } + + void describe_splits(std::vector & _return, const std::string& cfName, const std::string& start_token, const std::string& end_token, const int32_t keys_per_split) { + // Your implementation goes here + printf("describe_splits\n"); + } + + void system_add_column_family(std::string& _return, const CfDef& cf_def) { + // Your implementation goes here + printf("system_add_column_family\n"); + } + + void system_drop_column_family(std::string& _return, const std::string& column_family) { + // Your implementation goes here + printf("system_drop_column_family\n"); + } + + void system_add_keyspace(std::string& _return, const KsDef& ks_def) { + // Your implementation goes here + printf("system_add_keyspace\n"); + } + + void system_drop_keyspace(std::string& _return, const std::string& keyspace) { + // Your implementation goes here + printf("system_drop_keyspace\n"); + } + + void system_update_keyspace(std::string& _return, const KsDef& ks_def) { + // Your implementation goes here + printf("system_update_keyspace\n"); + } + + void system_update_column_family(std::string& _return, const CfDef& cf_def) { + // Your implementation goes here + printf("system_update_column_family\n"); + } + + void execute_cql_query(CqlResult& _return, const std::string& query, const Compression::type compression) { + // Your implementation goes here + printf("execute_cql_query\n"); + } + + void prepare_cql_query(CqlPreparedResult& _return, const std::string& query, const Compression::type compression) { + // Your implementation goes here + printf("prepare_cql_query\n"); + } + + void execute_prepared_cql_query(CqlResult& _return, const int32_t itemId, const std::vector & values) { + // Your implementation goes here + printf("execute_prepared_cql_query\n"); + } + + void set_cql_version(const std::string& version) { + // Your implementation goes here + printf("set_cql_version\n"); + } + +}; + +int main(int argc, char **argv) { + int port = 9090; + shared_ptr handler(new CassandraHandler()); + shared_ptr processor(new CassandraProcessor(handler)); + shared_ptr serverTransport(new TServerSocket(port)); + shared_ptr transportFactory(new TBufferedTransportFactory()); + shared_ptr protocolFactory(new TBinaryProtocolFactory()); + + TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); + server.serve(); + return 0; +} + diff --git a/storage/cassandra/gen-cpp/cassandra_constants.cpp b/storage/cassandra/gen-cpp/cassandra_constants.cpp new file mode 100644 index 00000000000..621d39027ad --- /dev/null +++ b/storage/cassandra/gen-cpp/cassandra_constants.cpp @@ -0,0 +1,18 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#include "cassandra_constants.h" + +namespace org { namespace apache { namespace cassandra { + +const cassandraConstants g_cassandra_constants; + +cassandraConstants::cassandraConstants() { + cassandra_const_VERSION = "19.32.0"; +} + +}}} // namespace + diff --git a/storage/cassandra/gen-cpp/cassandra_constants.h b/storage/cassandra/gen-cpp/cassandra_constants.h new file mode 100644 index 00000000000..fa12a1676ae --- /dev/null +++ b/storage/cassandra/gen-cpp/cassandra_constants.h @@ -0,0 +1,26 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef cassandra_CONSTANTS_H +#define cassandra_CONSTANTS_H + +#include "cassandra_types.h" + +namespace org { namespace apache { namespace cassandra { + +class cassandraConstants { + public: + cassandraConstants(); + +// std::string VERSION; + char* cassandra_const_VERSION; +}; + +extern const cassandraConstants g_cassandra_constants; + +}}} // namespace + +#endif diff --git a/storage/cassandra/gen-cpp/cassandra_types.cpp b/storage/cassandra/gen-cpp/cassandra_types.cpp new file mode 100644 index 00000000000..4b51c21a320 --- /dev/null +++ b/storage/cassandra/gen-cpp/cassandra_types.cpp @@ -0,0 +1,3512 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#include "cassandra_types.h" + +namespace org { namespace apache { namespace cassandra { + +int _kConsistencyLevelValues[] = { + ConsistencyLevel::ONE, + ConsistencyLevel::QUORUM, + ConsistencyLevel::LOCAL_QUORUM, + ConsistencyLevel::EACH_QUORUM, + ConsistencyLevel::ALL, + ConsistencyLevel::ANY, + ConsistencyLevel::TWO, + ConsistencyLevel::THREE +}; +const char* _kConsistencyLevelNames[] = { + "ONE", + "QUORUM", + "LOCAL_QUORUM", + "EACH_QUORUM", + "ALL", + "ANY", + "TWO", + "THREE" +}; +const std::map _ConsistencyLevel_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(8, _kConsistencyLevelValues, _kConsistencyLevelNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +int _kIndexOperatorValues[] = { + IndexOperator::EQ, + IndexOperator::GTE, + IndexOperator::GT, + IndexOperator::LTE, + IndexOperator::LT +}; +const char* _kIndexOperatorNames[] = { + "EQ", + "GTE", + "GT", + "LTE", + "LT" +}; +const std::map _IndexOperator_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kIndexOperatorValues, _kIndexOperatorNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +int _kIndexTypeValues[] = { + IndexType::KEYS, + IndexType::CUSTOM +}; +const char* _kIndexTypeNames[] = { + "KEYS", + "CUSTOM" +}; +const std::map _IndexType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kIndexTypeValues, _kIndexTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +int _kCompressionValues[] = { + Compression::GZIP, + Compression::NONE +}; +const char* _kCompressionNames[] = { + "GZIP", + "NONE" +}; +const std::map _Compression_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kCompressionValues, _kCompressionNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +int _kCqlResultTypeValues[] = { + CqlResultType::ROWS, + CqlResultType::VOID, + CqlResultType::INT +}; +const char* _kCqlResultTypeNames[] = { + "ROWS", + "VOID", + "INT" +}; +const std::map _CqlResultType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kCqlResultTypeValues, _kCqlResultTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +const char* Column::ascii_fingerprint = "3EE0E1C5C844001B62F08125068292CC"; +const uint8_t Column::binary_fingerprint[16] = {0x3E,0xE0,0xE1,0xC5,0xC8,0x44,0x00,0x1B,0x62,0xF0,0x81,0x25,0x06,0x82,0x92,0xCC}; + +uint32_t Column::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_name = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->name); + isset_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->value); + this->__isset.value = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->timestamp); + this->__isset.timestamp = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->ttl); + this->__isset.ttl = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Column::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Column"); + xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->name); + xfer += oprot->writeFieldEnd(); + if (this->__isset.value) { + xfer += oprot->writeFieldBegin("value", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->value); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.timestamp) { + xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 3); + xfer += oprot->writeI64(this->timestamp); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.ttl) { + xfer += oprot->writeFieldBegin("ttl", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32(this->ttl); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* SuperColumn::ascii_fingerprint = "470EFC558004E98D92D604898305C04E"; +const uint8_t SuperColumn::binary_fingerprint[16] = {0x47,0x0E,0xFC,0x55,0x80,0x04,0xE9,0x8D,0x92,0xD6,0x04,0x89,0x83,0x05,0xC0,0x4E}; + +uint32_t SuperColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_name = false; + bool isset_columns = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->name); + isset_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->columns.clear(); + uint32_t _size0; + ::apache::thrift::protocol::TType _etype3; + iprot->readListBegin(_etype3, _size0); + this->columns.resize(_size0); + uint32_t _i4; + for (_i4 = 0; _i4 < _size0; ++_i4) + { + xfer += this->columns[_i4].read(iprot); + } + iprot->readListEnd(); + } + isset_columns = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_columns) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t SuperColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("SuperColumn"); + xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("columns", ::apache::thrift::protocol::T_LIST, 2); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->columns.size())); + std::vector ::const_iterator _iter5; + for (_iter5 = this->columns.begin(); _iter5 != this->columns.end(); ++_iter5) + { + xfer += (*_iter5).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* CounterColumn::ascii_fingerprint = "1CCCF6FC31CFD1D61BBBB1BAF3590620"; +const uint8_t CounterColumn::binary_fingerprint[16] = {0x1C,0xCC,0xF6,0xFC,0x31,0xCF,0xD1,0xD6,0x1B,0xBB,0xB1,0xBA,0xF3,0x59,0x06,0x20}; + +uint32_t CounterColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_name = false; + bool isset_value = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->name); + isset_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->value); + isset_value = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_value) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t CounterColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("CounterColumn"); + xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("value", ::apache::thrift::protocol::T_I64, 2); + xfer += oprot->writeI64(this->value); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* CounterSuperColumn::ascii_fingerprint = "CD4C8C4BF7753E46DE417CDE369343A4"; +const uint8_t CounterSuperColumn::binary_fingerprint[16] = {0xCD,0x4C,0x8C,0x4B,0xF7,0x75,0x3E,0x46,0xDE,0x41,0x7C,0xDE,0x36,0x93,0x43,0xA4}; + +uint32_t CounterSuperColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_name = false; + bool isset_columns = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->name); + isset_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->columns.clear(); + uint32_t _size6; + ::apache::thrift::protocol::TType _etype9; + iprot->readListBegin(_etype9, _size6); + this->columns.resize(_size6); + uint32_t _i10; + for (_i10 = 0; _i10 < _size6; ++_i10) + { + xfer += this->columns[_i10].read(iprot); + } + iprot->readListEnd(); + } + isset_columns = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_columns) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t CounterSuperColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("CounterSuperColumn"); + xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("columns", ::apache::thrift::protocol::T_LIST, 2); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->columns.size())); + std::vector ::const_iterator _iter11; + for (_iter11 = this->columns.begin(); _iter11 != this->columns.end(); ++_iter11) + { + xfer += (*_iter11).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* ColumnOrSuperColumn::ascii_fingerprint = "2B34AC9E80F1DAA3A2A63B1AB1841E61"; +const uint8_t ColumnOrSuperColumn::binary_fingerprint[16] = {0x2B,0x34,0xAC,0x9E,0x80,0xF1,0xDA,0xA3,0xA2,0xA6,0x3B,0x1A,0xB1,0x84,0x1E,0x61}; + +uint32_t ColumnOrSuperColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column.read(iprot); + this->__isset.column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->super_column.read(iprot); + this->__isset.super_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->counter_column.read(iprot); + this->__isset.counter_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->counter_super_column.read(iprot); + this->__isset.counter_super_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ColumnOrSuperColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ColumnOrSuperColumn"); + if (this->__isset.column) { + xfer += oprot->writeFieldBegin("column", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->column.write(oprot); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.super_column) { + xfer += oprot->writeFieldBegin("super_column", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->super_column.write(oprot); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.counter_column) { + xfer += oprot->writeFieldBegin("counter_column", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->counter_column.write(oprot); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.counter_super_column) { + xfer += oprot->writeFieldBegin("counter_super_column", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->counter_super_column.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* NotFoundException::ascii_fingerprint = "99914B932BD37A50B983C5E7C90AE93B"; +const uint8_t NotFoundException::binary_fingerprint[16] = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + +uint32_t NotFoundException::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t NotFoundException::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("NotFoundException"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* InvalidRequestException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1"; +const uint8_t InvalidRequestException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + +uint32_t InvalidRequestException::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_why = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->why); + isset_why = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_why) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t InvalidRequestException::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("InvalidRequestException"); + xfer += oprot->writeFieldBegin("why", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->why); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* UnavailableException::ascii_fingerprint = "99914B932BD37A50B983C5E7C90AE93B"; +const uint8_t UnavailableException::binary_fingerprint[16] = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + +uint32_t UnavailableException::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t UnavailableException::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("UnavailableException"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* TimedOutException::ascii_fingerprint = "99914B932BD37A50B983C5E7C90AE93B"; +const uint8_t TimedOutException::binary_fingerprint[16] = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + +uint32_t TimedOutException::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TimedOutException::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TimedOutException"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* AuthenticationException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1"; +const uint8_t AuthenticationException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + +uint32_t AuthenticationException::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_why = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->why); + isset_why = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_why) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t AuthenticationException::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("AuthenticationException"); + xfer += oprot->writeFieldBegin("why", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->why); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* AuthorizationException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1"; +const uint8_t AuthorizationException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + +uint32_t AuthorizationException::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_why = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->why); + isset_why = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_why) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t AuthorizationException::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("AuthorizationException"); + xfer += oprot->writeFieldBegin("why", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->why); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* SchemaDisagreementException::ascii_fingerprint = "99914B932BD37A50B983C5E7C90AE93B"; +const uint8_t SchemaDisagreementException::binary_fingerprint[16] = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + +uint32_t SchemaDisagreementException::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t SchemaDisagreementException::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("SchemaDisagreementException"); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* ColumnParent::ascii_fingerprint = "0A13AE61181713A4100DFFB3EC293822"; +const uint8_t ColumnParent::binary_fingerprint[16] = {0x0A,0x13,0xAE,0x61,0x18,0x17,0x13,0xA4,0x10,0x0D,0xFF,0xB3,0xEC,0x29,0x38,0x22}; + +uint32_t ColumnParent::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_column_family = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->column_family); + isset_column_family = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->super_column); + this->__isset.super_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_column_family) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t ColumnParent::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ColumnParent"); + xfer += oprot->writeFieldBegin("column_family", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->column_family); + xfer += oprot->writeFieldEnd(); + if (this->__isset.super_column) { + xfer += oprot->writeFieldBegin("super_column", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeBinary(this->super_column); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* ColumnPath::ascii_fingerprint = "606212895BCF63C757913CF35AEB3462"; +const uint8_t ColumnPath::binary_fingerprint[16] = {0x60,0x62,0x12,0x89,0x5B,0xCF,0x63,0xC7,0x57,0x91,0x3C,0xF3,0x5A,0xEB,0x34,0x62}; + +uint32_t ColumnPath::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_column_family = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->column_family); + isset_column_family = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->super_column); + this->__isset.super_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->column); + this->__isset.column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_column_family) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t ColumnPath::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ColumnPath"); + xfer += oprot->writeFieldBegin("column_family", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->column_family); + xfer += oprot->writeFieldEnd(); + if (this->__isset.super_column) { + xfer += oprot->writeFieldBegin("super_column", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeBinary(this->super_column); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.column) { + xfer += oprot->writeFieldBegin("column", ::apache::thrift::protocol::T_STRING, 5); + xfer += oprot->writeBinary(this->column); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* SliceRange::ascii_fingerprint = "184D24C9A0B8D4415E234DB649CAE740"; +const uint8_t SliceRange::binary_fingerprint[16] = {0x18,0x4D,0x24,0xC9,0xA0,0xB8,0xD4,0x41,0x5E,0x23,0x4D,0xB6,0x49,0xCA,0xE7,0x40}; + +uint32_t SliceRange::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_start = false; + bool isset_finish = false; + bool isset_reversed = false; + bool isset_count = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->start); + isset_start = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->finish); + isset_finish = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->reversed); + isset_reversed = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->count); + isset_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_start) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_finish) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_reversed) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_count) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t SliceRange::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("SliceRange"); + xfer += oprot->writeFieldBegin("start", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->start); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("finish", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->finish); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("reversed", ::apache::thrift::protocol::T_BOOL, 3); + xfer += oprot->writeBool(this->reversed); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32(this->count); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* SlicePredicate::ascii_fingerprint = "F59D1D81C17DFFAF09988BF1C9CE5E27"; +const uint8_t SlicePredicate::binary_fingerprint[16] = {0xF5,0x9D,0x1D,0x81,0xC1,0x7D,0xFF,0xAF,0x09,0x98,0x8B,0xF1,0xC9,0xCE,0x5E,0x27}; + +uint32_t SlicePredicate::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->column_names.clear(); + uint32_t _size12; + ::apache::thrift::protocol::TType _etype15; + iprot->readListBegin(_etype15, _size12); + this->column_names.resize(_size12); + uint32_t _i16; + for (_i16 = 0; _i16 < _size12; ++_i16) + { + xfer += iprot->readBinary(this->column_names[_i16]); + } + iprot->readListEnd(); + } + this->__isset.column_names = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->slice_range.read(iprot); + this->__isset.slice_range = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t SlicePredicate::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("SlicePredicate"); + if (this->__isset.column_names) { + xfer += oprot->writeFieldBegin("column_names", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->column_names.size())); + std::vector ::const_iterator _iter17; + for (_iter17 = this->column_names.begin(); _iter17 != this->column_names.end(); ++_iter17) + { + xfer += oprot->writeBinary((*_iter17)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.slice_range) { + xfer += oprot->writeFieldBegin("slice_range", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->slice_range.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* IndexExpression::ascii_fingerprint = "D9F4CFE2F293A8B1052FD3031DD2C847"; +const uint8_t IndexExpression::binary_fingerprint[16] = {0xD9,0xF4,0xCF,0xE2,0xF2,0x93,0xA8,0xB1,0x05,0x2F,0xD3,0x03,0x1D,0xD2,0xC8,0x47}; + +uint32_t IndexExpression::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_column_name = false; + bool isset_op = false; + bool isset_value = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->column_name); + isset_column_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast18; + xfer += iprot->readI32(ecast18); + this->op = (IndexOperator::type)ecast18; + isset_op = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->value); + isset_value = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_column_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_op) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_value) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t IndexExpression::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("IndexExpression"); + xfer += oprot->writeFieldBegin("column_name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->column_name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("op", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)this->op); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("value", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeBinary(this->value); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* IndexClause::ascii_fingerprint = "9B551B9AB86120B0EEA9005C77FD3C1F"; +const uint8_t IndexClause::binary_fingerprint[16] = {0x9B,0x55,0x1B,0x9A,0xB8,0x61,0x20,0xB0,0xEE,0xA9,0x00,0x5C,0x77,0xFD,0x3C,0x1F}; + +uint32_t IndexClause::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_expressions = false; + bool isset_start_key = false; + bool isset_count = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->expressions.clear(); + uint32_t _size19; + ::apache::thrift::protocol::TType _etype22; + iprot->readListBegin(_etype22, _size19); + this->expressions.resize(_size19); + uint32_t _i23; + for (_i23 = 0; _i23 < _size19; ++_i23) + { + xfer += this->expressions[_i23].read(iprot); + } + iprot->readListEnd(); + } + isset_expressions = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->start_key); + isset_start_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->count); + isset_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_expressions) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_start_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_count) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t IndexClause::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("IndexClause"); + xfer += oprot->writeFieldBegin("expressions", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->expressions.size())); + std::vector ::const_iterator _iter24; + for (_iter24 = this->expressions.begin(); _iter24 != this->expressions.end(); ++_iter24) + { + xfer += (*_iter24).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("start_key", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->start_key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32(this->count); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* KeyRange::ascii_fingerprint = "A6EC82FA0980B91C7C8EB013C61CA1B0"; +const uint8_t KeyRange::binary_fingerprint[16] = {0xA6,0xEC,0x82,0xFA,0x09,0x80,0xB9,0x1C,0x7C,0x8E,0xB0,0x13,0xC6,0x1C,0xA1,0xB0}; + +uint32_t KeyRange::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_count = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->start_key); + this->__isset.start_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->end_key); + this->__isset.end_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->start_token); + this->__isset.start_token = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->end_token); + this->__isset.end_token = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->row_filter.clear(); + uint32_t _size25; + ::apache::thrift::protocol::TType _etype28; + iprot->readListBegin(_etype28, _size25); + this->row_filter.resize(_size25); + uint32_t _i29; + for (_i29 = 0; _i29 < _size25; ++_i29) + { + xfer += this->row_filter[_i29].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.row_filter = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->count); + isset_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_count) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t KeyRange::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("KeyRange"); + if (this->__isset.start_key) { + xfer += oprot->writeFieldBegin("start_key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->start_key); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.end_key) { + xfer += oprot->writeFieldBegin("end_key", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->end_key); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.start_token) { + xfer += oprot->writeFieldBegin("start_token", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->start_token); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.end_token) { + xfer += oprot->writeFieldBegin("end_token", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->end_token); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I32, 5); + xfer += oprot->writeI32(this->count); + xfer += oprot->writeFieldEnd(); + if (this->__isset.row_filter) { + xfer += oprot->writeFieldBegin("row_filter", ::apache::thrift::protocol::T_LIST, 6); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->row_filter.size())); + std::vector ::const_iterator _iter30; + for (_iter30 = this->row_filter.begin(); _iter30 != this->row_filter.end(); ++_iter30) + { + xfer += (*_iter30).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* KeySlice::ascii_fingerprint = "D1568675B0C135C909E3169B72A4DA3D"; +const uint8_t KeySlice::binary_fingerprint[16] = {0xD1,0x56,0x86,0x75,0xB0,0xC1,0x35,0xC9,0x09,0xE3,0x16,0x9B,0x72,0xA4,0xDA,0x3D}; + +uint32_t KeySlice::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_columns = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->columns.clear(); + uint32_t _size31; + ::apache::thrift::protocol::TType _etype34; + iprot->readListBegin(_etype34, _size31); + this->columns.resize(_size31); + uint32_t _i35; + for (_i35 = 0; _i35 < _size31; ++_i35) + { + xfer += this->columns[_i35].read(iprot); + } + iprot->readListEnd(); + } + isset_columns = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_columns) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t KeySlice::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("KeySlice"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("columns", ::apache::thrift::protocol::T_LIST, 2); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->columns.size())); + std::vector ::const_iterator _iter36; + for (_iter36 = this->columns.begin(); _iter36 != this->columns.end(); ++_iter36) + { + xfer += (*_iter36).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* KeyCount::ascii_fingerprint = "EEBC915CE44901401D881E6091423036"; +const uint8_t KeyCount::binary_fingerprint[16] = {0xEE,0xBC,0x91,0x5C,0xE4,0x49,0x01,0x40,0x1D,0x88,0x1E,0x60,0x91,0x42,0x30,0x36}; + +uint32_t KeyCount::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_count = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->count); + isset_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_count) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t KeyCount::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("KeyCount"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32(this->count); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* Deletion::ascii_fingerprint = "40F33ECF1C932CA77C2414C4E6C60CBE"; +const uint8_t Deletion::binary_fingerprint[16] = {0x40,0xF3,0x3E,0xCF,0x1C,0x93,0x2C,0xA7,0x7C,0x24,0x14,0xC4,0xE6,0xC6,0x0C,0xBE}; + +uint32_t Deletion::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->timestamp); + this->__isset.timestamp = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->super_column); + this->__isset.super_column = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->predicate.read(iprot); + this->__isset.predicate = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Deletion::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Deletion"); + if (this->__isset.timestamp) { + xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 1); + xfer += oprot->writeI64(this->timestamp); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.super_column) { + xfer += oprot->writeFieldBegin("super_column", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->super_column); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.predicate) { + xfer += oprot->writeFieldBegin("predicate", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->predicate.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* Mutation::ascii_fingerprint = "E8B65DF3979C6868F80DF81F8E769E63"; +const uint8_t Mutation::binary_fingerprint[16] = {0xE8,0xB6,0x5D,0xF3,0x97,0x9C,0x68,0x68,0xF8,0x0D,0xF8,0x1F,0x8E,0x76,0x9E,0x63}; + +uint32_t Mutation::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->column_or_supercolumn.read(iprot); + this->__isset.column_or_supercolumn = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->deletion.read(iprot); + this->__isset.deletion = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Mutation::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("Mutation"); + if (this->__isset.column_or_supercolumn) { + xfer += oprot->writeFieldBegin("column_or_supercolumn", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->column_or_supercolumn.write(oprot); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.deletion) { + xfer += oprot->writeFieldBegin("deletion", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->deletion.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* EndpointDetails::ascii_fingerprint = "F4A50F0EC638C7F66026F9B6678FD89B"; +const uint8_t EndpointDetails::binary_fingerprint[16] = {0xF4,0xA5,0x0F,0x0E,0xC6,0x38,0xC7,0xF6,0x60,0x26,0xF9,0xB6,0x67,0x8F,0xD8,0x9B}; + +uint32_t EndpointDetails::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->host); + this->__isset.host = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->datacenter); + this->__isset.datacenter = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->rack); + this->__isset.rack = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t EndpointDetails::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("EndpointDetails"); + xfer += oprot->writeFieldBegin("host", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->host); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("datacenter", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->datacenter); + xfer += oprot->writeFieldEnd(); + if (this->__isset.rack) { + xfer += oprot->writeFieldBegin("rack", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->rack); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* TokenRange::ascii_fingerprint = "832268DC4CD6B17EE8881FC57EA04679"; +const uint8_t TokenRange::binary_fingerprint[16] = {0x83,0x22,0x68,0xDC,0x4C,0xD6,0xB1,0x7E,0xE8,0x88,0x1F,0xC5,0x7E,0xA0,0x46,0x79}; + +uint32_t TokenRange::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_start_token = false; + bool isset_end_token = false; + bool isset_endpoints = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->start_token); + isset_start_token = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->end_token); + isset_end_token = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->endpoints.clear(); + uint32_t _size37; + ::apache::thrift::protocol::TType _etype40; + iprot->readListBegin(_etype40, _size37); + this->endpoints.resize(_size37); + uint32_t _i41; + for (_i41 = 0; _i41 < _size37; ++_i41) + { + xfer += iprot->readString(this->endpoints[_i41]); + } + iprot->readListEnd(); + } + isset_endpoints = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->rpc_endpoints.clear(); + uint32_t _size42; + ::apache::thrift::protocol::TType _etype45; + iprot->readListBegin(_etype45, _size42); + this->rpc_endpoints.resize(_size42); + uint32_t _i46; + for (_i46 = 0; _i46 < _size42; ++_i46) + { + xfer += iprot->readString(this->rpc_endpoints[_i46]); + } + iprot->readListEnd(); + } + this->__isset.rpc_endpoints = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->endpoint_details.clear(); + uint32_t _size47; + ::apache::thrift::protocol::TType _etype50; + iprot->readListBegin(_etype50, _size47); + this->endpoint_details.resize(_size47); + uint32_t _i51; + for (_i51 = 0; _i51 < _size47; ++_i51) + { + xfer += this->endpoint_details[_i51].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.endpoint_details = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_start_token) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_end_token) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_endpoints) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TokenRange::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TokenRange"); + xfer += oprot->writeFieldBegin("start_token", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->start_token); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("end_token", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->end_token); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("endpoints", ::apache::thrift::protocol::T_LIST, 3); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->endpoints.size())); + std::vector ::const_iterator _iter52; + for (_iter52 = this->endpoints.begin(); _iter52 != this->endpoints.end(); ++_iter52) + { + xfer += oprot->writeString((*_iter52)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + if (this->__isset.rpc_endpoints) { + xfer += oprot->writeFieldBegin("rpc_endpoints", ::apache::thrift::protocol::T_LIST, 4); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->rpc_endpoints.size())); + std::vector ::const_iterator _iter53; + for (_iter53 = this->rpc_endpoints.begin(); _iter53 != this->rpc_endpoints.end(); ++_iter53) + { + xfer += oprot->writeString((*_iter53)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.endpoint_details) { + xfer += oprot->writeFieldBegin("endpoint_details", ::apache::thrift::protocol::T_LIST, 5); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->endpoint_details.size())); + std::vector ::const_iterator _iter54; + for (_iter54 = this->endpoint_details.begin(); _iter54 != this->endpoint_details.end(); ++_iter54) + { + xfer += (*_iter54).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* AuthenticationRequest::ascii_fingerprint = "5EA2D527ECA3BA20C77AFC023EE8C05F"; +const uint8_t AuthenticationRequest::binary_fingerprint[16] = {0x5E,0xA2,0xD5,0x27,0xEC,0xA3,0xBA,0x20,0xC7,0x7A,0xFC,0x02,0x3E,0xE8,0xC0,0x5F}; + +uint32_t AuthenticationRequest::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_credentials = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->credentials.clear(); + uint32_t _size55; + ::apache::thrift::protocol::TType _ktype56; + ::apache::thrift::protocol::TType _vtype57; + iprot->readMapBegin(_ktype56, _vtype57, _size55); + uint32_t _i59; + for (_i59 = 0; _i59 < _size55; ++_i59) + { + std::string _key60; + xfer += iprot->readString(_key60); + std::string& _val61 = this->credentials[_key60]; + xfer += iprot->readString(_val61); + } + iprot->readMapEnd(); + } + isset_credentials = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_credentials) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t AuthenticationRequest::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("AuthenticationRequest"); + xfer += oprot->writeFieldBegin("credentials", ::apache::thrift::protocol::T_MAP, 1); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->credentials.size())); + std::map ::const_iterator _iter62; + for (_iter62 = this->credentials.begin(); _iter62 != this->credentials.end(); ++_iter62) + { + xfer += oprot->writeString(_iter62->first); + xfer += oprot->writeString(_iter62->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* ColumnDef::ascii_fingerprint = "0D89CE83D7EDAD079AC3213ED1DCAA58"; +const uint8_t ColumnDef::binary_fingerprint[16] = {0x0D,0x89,0xCE,0x83,0xD7,0xED,0xAD,0x07,0x9A,0xC3,0x21,0x3E,0xD1,0xDC,0xAA,0x58}; + +uint32_t ColumnDef::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_name = false; + bool isset_validation_class = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->name); + isset_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->validation_class); + isset_validation_class = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast63; + xfer += iprot->readI32(ecast63); + this->index_type = (IndexType::type)ecast63; + this->__isset.index_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->index_name); + this->__isset.index_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->index_options.clear(); + uint32_t _size64; + ::apache::thrift::protocol::TType _ktype65; + ::apache::thrift::protocol::TType _vtype66; + iprot->readMapBegin(_ktype65, _vtype66, _size64); + uint32_t _i68; + for (_i68 = 0; _i68 < _size64; ++_i68) + { + std::string _key69; + xfer += iprot->readString(_key69); + std::string& _val70 = this->index_options[_key69]; + xfer += iprot->readString(_val70); + } + iprot->readMapEnd(); + } + this->__isset.index_options = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_validation_class) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t ColumnDef::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ColumnDef"); + xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("validation_class", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->validation_class); + xfer += oprot->writeFieldEnd(); + if (this->__isset.index_type) { + xfer += oprot->writeFieldBegin("index_type", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32((int32_t)this->index_type); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.index_name) { + xfer += oprot->writeFieldBegin("index_name", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->index_name); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.index_options) { + xfer += oprot->writeFieldBegin("index_options", ::apache::thrift::protocol::T_MAP, 5); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->index_options.size())); + std::map ::const_iterator _iter71; + for (_iter71 = this->index_options.begin(); _iter71 != this->index_options.end(); ++_iter71) + { + xfer += oprot->writeString(_iter71->first); + xfer += oprot->writeString(_iter71->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* CfDef::ascii_fingerprint = "231A260521B5DD99EFBCCBDD8768CA7D"; +const uint8_t CfDef::binary_fingerprint[16] = {0x23,0x1A,0x26,0x05,0x21,0xB5,0xDD,0x99,0xEF,0xBC,0xCB,0xDD,0x87,0x68,0xCA,0x7D}; + +uint32_t CfDef::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_keyspace = false; + bool isset_name = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->keyspace); + isset_keyspace = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->name); + isset_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->column_type); + this->__isset.column_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->comparator_type); + this->__isset.comparator_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->subcomparator_type); + this->__isset.subcomparator_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 8: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->comment); + this->__isset.comment = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 12: + if (ftype == ::apache::thrift::protocol::T_DOUBLE) { + xfer += iprot->readDouble(this->read_repair_chance); + this->__isset.read_repair_chance = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 13: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->column_metadata.clear(); + uint32_t _size72; + ::apache::thrift::protocol::TType _etype75; + iprot->readListBegin(_etype75, _size72); + this->column_metadata.resize(_size72); + uint32_t _i76; + for (_i76 = 0; _i76 < _size72; ++_i76) + { + xfer += this->column_metadata[_i76].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.column_metadata = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 14: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->gc_grace_seconds); + this->__isset.gc_grace_seconds = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 15: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->default_validation_class); + this->__isset.default_validation_class = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 16: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->id); + this->__isset.id = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 17: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->min_compaction_threshold); + this->__isset.min_compaction_threshold = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 18: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->max_compaction_threshold); + this->__isset.max_compaction_threshold = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 24: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->replicate_on_write); + this->__isset.replicate_on_write = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 26: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->key_validation_class); + this->__isset.key_validation_class = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 28: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key_alias); + this->__isset.key_alias = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 29: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->compaction_strategy); + this->__isset.compaction_strategy = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 30: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->compaction_strategy_options.clear(); + uint32_t _size77; + ::apache::thrift::protocol::TType _ktype78; + ::apache::thrift::protocol::TType _vtype79; + iprot->readMapBegin(_ktype78, _vtype79, _size77); + uint32_t _i81; + for (_i81 = 0; _i81 < _size77; ++_i81) + { + std::string _key82; + xfer += iprot->readString(_key82); + std::string& _val83 = this->compaction_strategy_options[_key82]; + xfer += iprot->readString(_val83); + } + iprot->readMapEnd(); + } + this->__isset.compaction_strategy_options = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 32: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->compression_options.clear(); + uint32_t _size84; + ::apache::thrift::protocol::TType _ktype85; + ::apache::thrift::protocol::TType _vtype86; + iprot->readMapBegin(_ktype85, _vtype86, _size84); + uint32_t _i88; + for (_i88 = 0; _i88 < _size84; ++_i88) + { + std::string _key89; + xfer += iprot->readString(_key89); + std::string& _val90 = this->compression_options[_key89]; + xfer += iprot->readString(_val90); + } + iprot->readMapEnd(); + } + this->__isset.compression_options = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 33: + if (ftype == ::apache::thrift::protocol::T_DOUBLE) { + xfer += iprot->readDouble(this->bloom_filter_fp_chance); + this->__isset.bloom_filter_fp_chance = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 34: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->caching); + this->__isset.caching = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 37: + if (ftype == ::apache::thrift::protocol::T_DOUBLE) { + xfer += iprot->readDouble(this->dclocal_read_repair_chance); + this->__isset.dclocal_read_repair_chance = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 9: + if (ftype == ::apache::thrift::protocol::T_DOUBLE) { + xfer += iprot->readDouble(this->row_cache_size); + this->__isset.row_cache_size = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 11: + if (ftype == ::apache::thrift::protocol::T_DOUBLE) { + xfer += iprot->readDouble(this->key_cache_size); + this->__isset.key_cache_size = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 19: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->row_cache_save_period_in_seconds); + this->__isset.row_cache_save_period_in_seconds = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 20: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->key_cache_save_period_in_seconds); + this->__isset.key_cache_save_period_in_seconds = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 21: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->memtable_flush_after_mins); + this->__isset.memtable_flush_after_mins = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 22: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->memtable_throughput_in_mb); + this->__isset.memtable_throughput_in_mb = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 23: + if (ftype == ::apache::thrift::protocol::T_DOUBLE) { + xfer += iprot->readDouble(this->memtable_operations_in_millions); + this->__isset.memtable_operations_in_millions = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 25: + if (ftype == ::apache::thrift::protocol::T_DOUBLE) { + xfer += iprot->readDouble(this->merge_shards_chance); + this->__isset.merge_shards_chance = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 27: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->row_cache_provider); + this->__isset.row_cache_provider = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 31: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->row_cache_keys_to_save); + this->__isset.row_cache_keys_to_save = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_keyspace) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t CfDef::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("CfDef"); + xfer += oprot->writeFieldBegin("keyspace", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->keyspace); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->name); + xfer += oprot->writeFieldEnd(); + if (this->__isset.column_type) { + xfer += oprot->writeFieldBegin("column_type", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->column_type); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.comparator_type) { + xfer += oprot->writeFieldBegin("comparator_type", ::apache::thrift::protocol::T_STRING, 5); + xfer += oprot->writeString(this->comparator_type); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.subcomparator_type) { + xfer += oprot->writeFieldBegin("subcomparator_type", ::apache::thrift::protocol::T_STRING, 6); + xfer += oprot->writeString(this->subcomparator_type); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.comment) { + xfer += oprot->writeFieldBegin("comment", ::apache::thrift::protocol::T_STRING, 8); + xfer += oprot->writeString(this->comment); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.row_cache_size) { + xfer += oprot->writeFieldBegin("row_cache_size", ::apache::thrift::protocol::T_DOUBLE, 9); + xfer += oprot->writeDouble(this->row_cache_size); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.key_cache_size) { + xfer += oprot->writeFieldBegin("key_cache_size", ::apache::thrift::protocol::T_DOUBLE, 11); + xfer += oprot->writeDouble(this->key_cache_size); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.read_repair_chance) { + xfer += oprot->writeFieldBegin("read_repair_chance", ::apache::thrift::protocol::T_DOUBLE, 12); + xfer += oprot->writeDouble(this->read_repair_chance); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.column_metadata) { + xfer += oprot->writeFieldBegin("column_metadata", ::apache::thrift::protocol::T_LIST, 13); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->column_metadata.size())); + std::vector ::const_iterator _iter91; + for (_iter91 = this->column_metadata.begin(); _iter91 != this->column_metadata.end(); ++_iter91) + { + xfer += (*_iter91).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.gc_grace_seconds) { + xfer += oprot->writeFieldBegin("gc_grace_seconds", ::apache::thrift::protocol::T_I32, 14); + xfer += oprot->writeI32(this->gc_grace_seconds); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.default_validation_class) { + xfer += oprot->writeFieldBegin("default_validation_class", ::apache::thrift::protocol::T_STRING, 15); + xfer += oprot->writeString(this->default_validation_class); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.id) { + xfer += oprot->writeFieldBegin("id", ::apache::thrift::protocol::T_I32, 16); + xfer += oprot->writeI32(this->id); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.min_compaction_threshold) { + xfer += oprot->writeFieldBegin("min_compaction_threshold", ::apache::thrift::protocol::T_I32, 17); + xfer += oprot->writeI32(this->min_compaction_threshold); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.max_compaction_threshold) { + xfer += oprot->writeFieldBegin("max_compaction_threshold", ::apache::thrift::protocol::T_I32, 18); + xfer += oprot->writeI32(this->max_compaction_threshold); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.row_cache_save_period_in_seconds) { + xfer += oprot->writeFieldBegin("row_cache_save_period_in_seconds", ::apache::thrift::protocol::T_I32, 19); + xfer += oprot->writeI32(this->row_cache_save_period_in_seconds); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.key_cache_save_period_in_seconds) { + xfer += oprot->writeFieldBegin("key_cache_save_period_in_seconds", ::apache::thrift::protocol::T_I32, 20); + xfer += oprot->writeI32(this->key_cache_save_period_in_seconds); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.memtable_flush_after_mins) { + xfer += oprot->writeFieldBegin("memtable_flush_after_mins", ::apache::thrift::protocol::T_I32, 21); + xfer += oprot->writeI32(this->memtable_flush_after_mins); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.memtable_throughput_in_mb) { + xfer += oprot->writeFieldBegin("memtable_throughput_in_mb", ::apache::thrift::protocol::T_I32, 22); + xfer += oprot->writeI32(this->memtable_throughput_in_mb); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.memtable_operations_in_millions) { + xfer += oprot->writeFieldBegin("memtable_operations_in_millions", ::apache::thrift::protocol::T_DOUBLE, 23); + xfer += oprot->writeDouble(this->memtable_operations_in_millions); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.replicate_on_write) { + xfer += oprot->writeFieldBegin("replicate_on_write", ::apache::thrift::protocol::T_BOOL, 24); + xfer += oprot->writeBool(this->replicate_on_write); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.merge_shards_chance) { + xfer += oprot->writeFieldBegin("merge_shards_chance", ::apache::thrift::protocol::T_DOUBLE, 25); + xfer += oprot->writeDouble(this->merge_shards_chance); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.key_validation_class) { + xfer += oprot->writeFieldBegin("key_validation_class", ::apache::thrift::protocol::T_STRING, 26); + xfer += oprot->writeString(this->key_validation_class); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.row_cache_provider) { + xfer += oprot->writeFieldBegin("row_cache_provider", ::apache::thrift::protocol::T_STRING, 27); + xfer += oprot->writeString(this->row_cache_provider); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.key_alias) { + xfer += oprot->writeFieldBegin("key_alias", ::apache::thrift::protocol::T_STRING, 28); + xfer += oprot->writeBinary(this->key_alias); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.compaction_strategy) { + xfer += oprot->writeFieldBegin("compaction_strategy", ::apache::thrift::protocol::T_STRING, 29); + xfer += oprot->writeString(this->compaction_strategy); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.compaction_strategy_options) { + xfer += oprot->writeFieldBegin("compaction_strategy_options", ::apache::thrift::protocol::T_MAP, 30); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->compaction_strategy_options.size())); + std::map ::const_iterator _iter92; + for (_iter92 = this->compaction_strategy_options.begin(); _iter92 != this->compaction_strategy_options.end(); ++_iter92) + { + xfer += oprot->writeString(_iter92->first); + xfer += oprot->writeString(_iter92->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.row_cache_keys_to_save) { + xfer += oprot->writeFieldBegin("row_cache_keys_to_save", ::apache::thrift::protocol::T_I32, 31); + xfer += oprot->writeI32(this->row_cache_keys_to_save); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.compression_options) { + xfer += oprot->writeFieldBegin("compression_options", ::apache::thrift::protocol::T_MAP, 32); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->compression_options.size())); + std::map ::const_iterator _iter93; + for (_iter93 = this->compression_options.begin(); _iter93 != this->compression_options.end(); ++_iter93) + { + xfer += oprot->writeString(_iter93->first); + xfer += oprot->writeString(_iter93->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.bloom_filter_fp_chance) { + xfer += oprot->writeFieldBegin("bloom_filter_fp_chance", ::apache::thrift::protocol::T_DOUBLE, 33); + xfer += oprot->writeDouble(this->bloom_filter_fp_chance); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.caching) { + xfer += oprot->writeFieldBegin("caching", ::apache::thrift::protocol::T_STRING, 34); + xfer += oprot->writeString(this->caching); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.dclocal_read_repair_chance) { + xfer += oprot->writeFieldBegin("dclocal_read_repair_chance", ::apache::thrift::protocol::T_DOUBLE, 37); + xfer += oprot->writeDouble(this->dclocal_read_repair_chance); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* KsDef::ascii_fingerprint = "0767851B6476EB3777A21E59E912E11A"; +const uint8_t KsDef::binary_fingerprint[16] = {0x07,0x67,0x85,0x1B,0x64,0x76,0xEB,0x37,0x77,0xA2,0x1E,0x59,0xE9,0x12,0xE1,0x1A}; + +uint32_t KsDef::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_name = false; + bool isset_strategy_class = false; + bool isset_cf_defs = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->name); + isset_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->strategy_class); + isset_strategy_class = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->strategy_options.clear(); + uint32_t _size94; + ::apache::thrift::protocol::TType _ktype95; + ::apache::thrift::protocol::TType _vtype96; + iprot->readMapBegin(_ktype95, _vtype96, _size94); + uint32_t _i98; + for (_i98 = 0; _i98 < _size94; ++_i98) + { + std::string _key99; + xfer += iprot->readString(_key99); + std::string& _val100 = this->strategy_options[_key99]; + xfer += iprot->readString(_val100); + } + iprot->readMapEnd(); + } + this->__isset.strategy_options = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->replication_factor); + this->__isset.replication_factor = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->cf_defs.clear(); + uint32_t _size101; + ::apache::thrift::protocol::TType _etype104; + iprot->readListBegin(_etype104, _size101); + this->cf_defs.resize(_size101); + uint32_t _i105; + for (_i105 = 0; _i105 < _size101; ++_i105) + { + xfer += this->cf_defs[_i105].read(iprot); + } + iprot->readListEnd(); + } + isset_cf_defs = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->durable_writes); + this->__isset.durable_writes = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_name) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_strategy_class) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_cf_defs) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t KsDef::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("KsDef"); + xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("strategy_class", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->strategy_class); + xfer += oprot->writeFieldEnd(); + if (this->__isset.strategy_options) { + xfer += oprot->writeFieldBegin("strategy_options", ::apache::thrift::protocol::T_MAP, 3); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->strategy_options.size())); + std::map ::const_iterator _iter106; + for (_iter106 = this->strategy_options.begin(); _iter106 != this->strategy_options.end(); ++_iter106) + { + xfer += oprot->writeString(_iter106->first); + xfer += oprot->writeString(_iter106->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.replication_factor) { + xfer += oprot->writeFieldBegin("replication_factor", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32(this->replication_factor); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldBegin("cf_defs", ::apache::thrift::protocol::T_LIST, 5); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->cf_defs.size())); + std::vector ::const_iterator _iter107; + for (_iter107 = this->cf_defs.begin(); _iter107 != this->cf_defs.end(); ++_iter107) + { + xfer += (*_iter107).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + if (this->__isset.durable_writes) { + xfer += oprot->writeFieldBegin("durable_writes", ::apache::thrift::protocol::T_BOOL, 6); + xfer += oprot->writeBool(this->durable_writes); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* CqlRow::ascii_fingerprint = "470EFC558004E98D92D604898305C04E"; +const uint8_t CqlRow::binary_fingerprint[16] = {0x47,0x0E,0xFC,0x55,0x80,0x04,0xE9,0x8D,0x92,0xD6,0x04,0x89,0x83,0x05,0xC0,0x4E}; + +uint32_t CqlRow::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_key = false; + bool isset_columns = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->key); + isset_key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->columns.clear(); + uint32_t _size108; + ::apache::thrift::protocol::TType _etype111; + iprot->readListBegin(_etype111, _size108); + this->columns.resize(_size108); + uint32_t _i112; + for (_i112 = 0; _i112 < _size108; ++_i112) + { + xfer += this->columns[_i112].read(iprot); + } + iprot->readListEnd(); + } + isset_columns = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_key) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_columns) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t CqlRow::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("CqlRow"); + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeBinary(this->key); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("columns", ::apache::thrift::protocol::T_LIST, 2); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->columns.size())); + std::vector ::const_iterator _iter113; + for (_iter113 = this->columns.begin(); _iter113 != this->columns.end(); ++_iter113) + { + xfer += (*_iter113).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* CqlMetadata::ascii_fingerprint = "B7C5A4AA9652C744A48EBC1C12D531E7"; +const uint8_t CqlMetadata::binary_fingerprint[16] = {0xB7,0xC5,0xA4,0xAA,0x96,0x52,0xC7,0x44,0xA4,0x8E,0xBC,0x1C,0x12,0xD5,0x31,0xE7}; + +uint32_t CqlMetadata::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_name_types = false; + bool isset_value_types = false; + bool isset_default_name_type = false; + bool isset_default_value_type = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->name_types.clear(); + uint32_t _size114; + ::apache::thrift::protocol::TType _ktype115; + ::apache::thrift::protocol::TType _vtype116; + iprot->readMapBegin(_ktype115, _vtype116, _size114); + uint32_t _i118; + for (_i118 = 0; _i118 < _size114; ++_i118) + { + std::string _key119; + xfer += iprot->readBinary(_key119); + std::string& _val120 = this->name_types[_key119]; + xfer += iprot->readString(_val120); + } + iprot->readMapEnd(); + } + isset_name_types = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->value_types.clear(); + uint32_t _size121; + ::apache::thrift::protocol::TType _ktype122; + ::apache::thrift::protocol::TType _vtype123; + iprot->readMapBegin(_ktype122, _vtype123, _size121); + uint32_t _i125; + for (_i125 = 0; _i125 < _size121; ++_i125) + { + std::string _key126; + xfer += iprot->readBinary(_key126); + std::string& _val127 = this->value_types[_key126]; + xfer += iprot->readString(_val127); + } + iprot->readMapEnd(); + } + isset_value_types = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->default_name_type); + isset_default_name_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->default_value_type); + isset_default_value_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_name_types) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_value_types) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_default_name_type) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_default_value_type) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t CqlMetadata::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("CqlMetadata"); + xfer += oprot->writeFieldBegin("name_types", ::apache::thrift::protocol::T_MAP, 1); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->name_types.size())); + std::map ::const_iterator _iter128; + for (_iter128 = this->name_types.begin(); _iter128 != this->name_types.end(); ++_iter128) + { + xfer += oprot->writeBinary(_iter128->first); + xfer += oprot->writeString(_iter128->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("value_types", ::apache::thrift::protocol::T_MAP, 2); + { + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->value_types.size())); + std::map ::const_iterator _iter129; + for (_iter129 = this->value_types.begin(); _iter129 != this->value_types.end(); ++_iter129) + { + xfer += oprot->writeBinary(_iter129->first); + xfer += oprot->writeString(_iter129->second); + } + xfer += oprot->writeMapEnd(); + } + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("default_name_type", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->default_name_type); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("default_value_type", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->default_value_type); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* CqlResult::ascii_fingerprint = "521B9CE5AF77539F7267F6952B609E81"; +const uint8_t CqlResult::binary_fingerprint[16] = {0x52,0x1B,0x9C,0xE5,0xAF,0x77,0x53,0x9F,0x72,0x67,0xF6,0x95,0x2B,0x60,0x9E,0x81}; + +uint32_t CqlResult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_type = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast130; + xfer += iprot->readI32(ecast130); + this->type = (CqlResultType::type)ecast130; + isset_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->rows.clear(); + uint32_t _size131; + ::apache::thrift::protocol::TType _etype134; + iprot->readListBegin(_etype134, _size131); + this->rows.resize(_size131); + uint32_t _i135; + for (_i135 = 0; _i135 < _size131; ++_i135) + { + xfer += this->rows[_i135].read(iprot); + } + iprot->readListEnd(); + } + this->__isset.rows = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->num); + this->__isset.num = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->schema.read(iprot); + this->__isset.schema = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_type) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t CqlResult::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("CqlResult"); + xfer += oprot->writeFieldBegin("type", ::apache::thrift::protocol::T_I32, 1); + xfer += oprot->writeI32((int32_t)this->type); + xfer += oprot->writeFieldEnd(); + if (this->__isset.rows) { + xfer += oprot->writeFieldBegin("rows", ::apache::thrift::protocol::T_LIST, 2); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->rows.size())); + std::vector ::const_iterator _iter136; + for (_iter136 = this->rows.begin(); _iter136 != this->rows.end(); ++_iter136) + { + xfer += (*_iter136).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.num) { + xfer += oprot->writeFieldBegin("num", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32(this->num); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.schema) { + xfer += oprot->writeFieldBegin("schema", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->schema.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +const char* CqlPreparedResult::ascii_fingerprint = "7E1663EC688DFDC28722BF36F9F64E6F"; +const uint8_t CqlPreparedResult::binary_fingerprint[16] = {0x7E,0x16,0x63,0xEC,0x68,0x8D,0xFD,0xC2,0x87,0x22,0xBF,0x36,0xF9,0xF6,0x4E,0x6F}; + +uint32_t CqlPreparedResult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_itemId = false; + bool isset_count = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->itemId); + isset_itemId = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->count); + isset_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->variable_types.clear(); + uint32_t _size137; + ::apache::thrift::protocol::TType _etype140; + iprot->readListBegin(_etype140, _size137); + this->variable_types.resize(_size137); + uint32_t _i141; + for (_i141 = 0; _i141 < _size137; ++_i141) + { + xfer += iprot->readString(this->variable_types[_i141]); + } + iprot->readListEnd(); + } + this->__isset.variable_types = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->variable_names.clear(); + uint32_t _size142; + ::apache::thrift::protocol::TType _etype145; + iprot->readListBegin(_etype145, _size142); + this->variable_names.resize(_size142); + uint32_t _i146; + for (_i146 = 0; _i146 < _size142; ++_i146) + { + xfer += iprot->readString(this->variable_names[_i146]); + } + iprot->readListEnd(); + } + this->__isset.variable_names = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_itemId) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_count) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t CqlPreparedResult::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("CqlPreparedResult"); + xfer += oprot->writeFieldBegin("itemId", ::apache::thrift::protocol::T_I32, 1); + xfer += oprot->writeI32(this->itemId); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32(this->count); + xfer += oprot->writeFieldEnd(); + if (this->__isset.variable_types) { + xfer += oprot->writeFieldBegin("variable_types", ::apache::thrift::protocol::T_LIST, 3); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->variable_types.size())); + std::vector ::const_iterator _iter147; + for (_iter147 = this->variable_types.begin(); _iter147 != this->variable_types.end(); ++_iter147) + { + xfer += oprot->writeString((*_iter147)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.variable_names) { + xfer += oprot->writeFieldBegin("variable_names", ::apache::thrift::protocol::T_LIST, 4); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->variable_names.size())); + std::vector ::const_iterator _iter148; + for (_iter148 = this->variable_names.begin(); _iter148 != this->variable_names.end(); ++_iter148) + { + xfer += oprot->writeString((*_iter148)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +}}} // namespace diff --git a/storage/cassandra/gen-cpp/cassandra_types.h b/storage/cassandra/gen-cpp/cassandra_types.h new file mode 100644 index 00000000000..d675198dcc8 --- /dev/null +++ b/storage/cassandra/gen-cpp/cassandra_types.h @@ -0,0 +1,2149 @@ +/** + * Autogenerated by Thrift Compiler (0.8.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef cassandra_TYPES_H +#define cassandra_TYPES_H + +#include +#include + +#include +#include +#include +#include + + + +namespace org { namespace apache { namespace cassandra { + +struct ConsistencyLevel { + enum type { + ONE = 1, + QUORUM = 2, + LOCAL_QUORUM = 3, + EACH_QUORUM = 4, + ALL = 5, + ANY = 6, + TWO = 7, + THREE = 8 + }; +}; + +extern const std::map _ConsistencyLevel_VALUES_TO_NAMES; + +struct IndexOperator { + enum type { + EQ = 0, + GTE = 1, + GT = 2, + LTE = 3, + LT = 4 + }; +}; + +extern const std::map _IndexOperator_VALUES_TO_NAMES; + +struct IndexType { + enum type { + KEYS = 0, + CUSTOM = 1 + }; +}; + +extern const std::map _IndexType_VALUES_TO_NAMES; + +struct Compression { + enum type { + GZIP = 1, + NONE = 2 + }; +}; + +extern const std::map _Compression_VALUES_TO_NAMES; + +struct CqlResultType { + enum type { + ROWS = 1, + VOID = 2, + INT = 3 + }; +}; + +extern const std::map _CqlResultType_VALUES_TO_NAMES; + +typedef struct _Column__isset { + _Column__isset() : value(false), timestamp(false), ttl(false) {} + bool value; + bool timestamp; + bool ttl; +} _Column__isset; + +class Column { + public: + + static const char* ascii_fingerprint; // = "3EE0E1C5C844001B62F08125068292CC"; + static const uint8_t binary_fingerprint[16]; // = {0x3E,0xE0,0xE1,0xC5,0xC8,0x44,0x00,0x1B,0x62,0xF0,0x81,0x25,0x06,0x82,0x92,0xCC}; + + Column() : name(""), value(""), timestamp(0), ttl(0) { + } + + virtual ~Column() throw() {} + + std::string name; + std::string value; + int64_t timestamp; + int32_t ttl; + + _Column__isset __isset; + + void __set_name(const std::string& val) { + name = val; + } + + void __set_value(const std::string& val) { + value = val; + __isset.value = true; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + __isset.timestamp = true; + } + + void __set_ttl(const int32_t val) { + ttl = val; + __isset.ttl = true; + } + + bool operator == (const Column & rhs) const + { + if (!(name == rhs.name)) + return false; + if (__isset.value != rhs.__isset.value) + return false; + else if (__isset.value && !(value == rhs.value)) + return false; + if (__isset.timestamp != rhs.__isset.timestamp) + return false; + else if (__isset.timestamp && !(timestamp == rhs.timestamp)) + return false; + if (__isset.ttl != rhs.__isset.ttl) + return false; + else if (__isset.ttl && !(ttl == rhs.ttl)) + return false; + return true; + } + bool operator != (const Column &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Column & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class SuperColumn { + public: + + static const char* ascii_fingerprint; // = "470EFC558004E98D92D604898305C04E"; + static const uint8_t binary_fingerprint[16]; // = {0x47,0x0E,0xFC,0x55,0x80,0x04,0xE9,0x8D,0x92,0xD6,0x04,0x89,0x83,0x05,0xC0,0x4E}; + + SuperColumn() : name("") { + } + + virtual ~SuperColumn() throw() {} + + std::string name; + std::vector columns; + + void __set_name(const std::string& val) { + name = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + bool operator == (const SuperColumn & rhs) const + { + if (!(name == rhs.name)) + return false; + if (!(columns == rhs.columns)) + return false; + return true; + } + bool operator != (const SuperColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const SuperColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class CounterColumn { + public: + + static const char* ascii_fingerprint; // = "1CCCF6FC31CFD1D61BBBB1BAF3590620"; + static const uint8_t binary_fingerprint[16]; // = {0x1C,0xCC,0xF6,0xFC,0x31,0xCF,0xD1,0xD6,0x1B,0xBB,0xB1,0xBA,0xF3,0x59,0x06,0x20}; + + CounterColumn() : name(""), value(0) { + } + + virtual ~CounterColumn() throw() {} + + std::string name; + int64_t value; + + void __set_name(const std::string& val) { + name = val; + } + + void __set_value(const int64_t val) { + value = val; + } + + bool operator == (const CounterColumn & rhs) const + { + if (!(name == rhs.name)) + return false; + if (!(value == rhs.value)) + return false; + return true; + } + bool operator != (const CounterColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const CounterColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class CounterSuperColumn { + public: + + static const char* ascii_fingerprint; // = "CD4C8C4BF7753E46DE417CDE369343A4"; + static const uint8_t binary_fingerprint[16]; // = {0xCD,0x4C,0x8C,0x4B,0xF7,0x75,0x3E,0x46,0xDE,0x41,0x7C,0xDE,0x36,0x93,0x43,0xA4}; + + CounterSuperColumn() : name("") { + } + + virtual ~CounterSuperColumn() throw() {} + + std::string name; + std::vector columns; + + void __set_name(const std::string& val) { + name = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + bool operator == (const CounterSuperColumn & rhs) const + { + if (!(name == rhs.name)) + return false; + if (!(columns == rhs.columns)) + return false; + return true; + } + bool operator != (const CounterSuperColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const CounterSuperColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ColumnOrSuperColumn__isset { + _ColumnOrSuperColumn__isset() : column(false), super_column(false), counter_column(false), counter_super_column(false) {} + bool column; + bool super_column; + bool counter_column; + bool counter_super_column; +} _ColumnOrSuperColumn__isset; + +class ColumnOrSuperColumn { + public: + + static const char* ascii_fingerprint; // = "2B34AC9E80F1DAA3A2A63B1AB1841E61"; + static const uint8_t binary_fingerprint[16]; // = {0x2B,0x34,0xAC,0x9E,0x80,0xF1,0xDA,0xA3,0xA2,0xA6,0x3B,0x1A,0xB1,0x84,0x1E,0x61}; + + ColumnOrSuperColumn() { + } + + virtual ~ColumnOrSuperColumn() throw() {} + + Column column; + SuperColumn super_column; + CounterColumn counter_column; + CounterSuperColumn counter_super_column; + + _ColumnOrSuperColumn__isset __isset; + + void __set_column(const Column& val) { + column = val; + __isset.column = true; + } + + void __set_super_column(const SuperColumn& val) { + super_column = val; + __isset.super_column = true; + } + + void __set_counter_column(const CounterColumn& val) { + counter_column = val; + __isset.counter_column = true; + } + + void __set_counter_super_column(const CounterSuperColumn& val) { + counter_super_column = val; + __isset.counter_super_column = true; + } + + bool operator == (const ColumnOrSuperColumn & rhs) const + { + if (__isset.column != rhs.__isset.column) + return false; + else if (__isset.column && !(column == rhs.column)) + return false; + if (__isset.super_column != rhs.__isset.super_column) + return false; + else if (__isset.super_column && !(super_column == rhs.super_column)) + return false; + if (__isset.counter_column != rhs.__isset.counter_column) + return false; + else if (__isset.counter_column && !(counter_column == rhs.counter_column)) + return false; + if (__isset.counter_super_column != rhs.__isset.counter_super_column) + return false; + else if (__isset.counter_super_column && !(counter_super_column == rhs.counter_super_column)) + return false; + return true; + } + bool operator != (const ColumnOrSuperColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ColumnOrSuperColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class NotFoundException : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B"; + static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + + NotFoundException() { + } + + virtual ~NotFoundException() throw() {} + + + bool operator == (const NotFoundException & /* rhs */) const + { + return true; + } + bool operator != (const NotFoundException &rhs) const { + return !(*this == rhs); + } + + bool operator < (const NotFoundException & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class InvalidRequestException : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; + static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + + InvalidRequestException() : why("") { + } + + virtual ~InvalidRequestException() throw() {} + + std::string why; + + void __set_why(const std::string& val) { + why = val; + } + + bool operator == (const InvalidRequestException & rhs) const + { + if (!(why == rhs.why)) + return false; + return true; + } + bool operator != (const InvalidRequestException &rhs) const { + return !(*this == rhs); + } + + bool operator < (const InvalidRequestException & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class UnavailableException : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B"; + static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + + UnavailableException() { + } + + virtual ~UnavailableException() throw() {} + + + bool operator == (const UnavailableException & /* rhs */) const + { + return true; + } + bool operator != (const UnavailableException &rhs) const { + return !(*this == rhs); + } + + bool operator < (const UnavailableException & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class TimedOutException : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B"; + static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + + TimedOutException() { + } + + virtual ~TimedOutException() throw() {} + + + bool operator == (const TimedOutException & /* rhs */) const + { + return true; + } + bool operator != (const TimedOutException &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TimedOutException & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class AuthenticationException : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; + static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + + AuthenticationException() : why("") { + } + + virtual ~AuthenticationException() throw() {} + + std::string why; + + void __set_why(const std::string& val) { + why = val; + } + + bool operator == (const AuthenticationException & rhs) const + { + if (!(why == rhs.why)) + return false; + return true; + } + bool operator != (const AuthenticationException &rhs) const { + return !(*this == rhs); + } + + bool operator < (const AuthenticationException & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class AuthorizationException : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; + static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + + AuthorizationException() : why("") { + } + + virtual ~AuthorizationException() throw() {} + + std::string why; + + void __set_why(const std::string& val) { + why = val; + } + + bool operator == (const AuthorizationException & rhs) const + { + if (!(why == rhs.why)) + return false; + return true; + } + bool operator != (const AuthorizationException &rhs) const { + return !(*this == rhs); + } + + bool operator < (const AuthorizationException & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class SchemaDisagreementException : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "99914B932BD37A50B983C5E7C90AE93B"; + static const uint8_t binary_fingerprint[16]; // = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B}; + + SchemaDisagreementException() { + } + + virtual ~SchemaDisagreementException() throw() {} + + + bool operator == (const SchemaDisagreementException & /* rhs */) const + { + return true; + } + bool operator != (const SchemaDisagreementException &rhs) const { + return !(*this == rhs); + } + + bool operator < (const SchemaDisagreementException & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ColumnParent__isset { + _ColumnParent__isset() : super_column(false) {} + bool super_column; +} _ColumnParent__isset; + +class ColumnParent { + public: + + static const char* ascii_fingerprint; // = "0A13AE61181713A4100DFFB3EC293822"; + static const uint8_t binary_fingerprint[16]; // = {0x0A,0x13,0xAE,0x61,0x18,0x17,0x13,0xA4,0x10,0x0D,0xFF,0xB3,0xEC,0x29,0x38,0x22}; + + ColumnParent() : column_family(""), super_column("") { + } + + virtual ~ColumnParent() throw() {} + + std::string column_family; + std::string super_column; + + _ColumnParent__isset __isset; + + void __set_column_family(const std::string& val) { + column_family = val; + } + + void __set_super_column(const std::string& val) { + super_column = val; + __isset.super_column = true; + } + + bool operator == (const ColumnParent & rhs) const + { + if (!(column_family == rhs.column_family)) + return false; + if (__isset.super_column != rhs.__isset.super_column) + return false; + else if (__isset.super_column && !(super_column == rhs.super_column)) + return false; + return true; + } + bool operator != (const ColumnParent &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ColumnParent & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ColumnPath__isset { + _ColumnPath__isset() : super_column(false), column(false) {} + bool super_column; + bool column; +} _ColumnPath__isset; + +class ColumnPath { + public: + + static const char* ascii_fingerprint; // = "606212895BCF63C757913CF35AEB3462"; + static const uint8_t binary_fingerprint[16]; // = {0x60,0x62,0x12,0x89,0x5B,0xCF,0x63,0xC7,0x57,0x91,0x3C,0xF3,0x5A,0xEB,0x34,0x62}; + + ColumnPath() : column_family(""), super_column(""), column("") { + } + + virtual ~ColumnPath() throw() {} + + std::string column_family; + std::string super_column; + std::string column; + + _ColumnPath__isset __isset; + + void __set_column_family(const std::string& val) { + column_family = val; + } + + void __set_super_column(const std::string& val) { + super_column = val; + __isset.super_column = true; + } + + void __set_column(const std::string& val) { + column = val; + __isset.column = true; + } + + bool operator == (const ColumnPath & rhs) const + { + if (!(column_family == rhs.column_family)) + return false; + if (__isset.super_column != rhs.__isset.super_column) + return false; + else if (__isset.super_column && !(super_column == rhs.super_column)) + return false; + if (__isset.column != rhs.__isset.column) + return false; + else if (__isset.column && !(column == rhs.column)) + return false; + return true; + } + bool operator != (const ColumnPath &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ColumnPath & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class SliceRange { + public: + + static const char* ascii_fingerprint; // = "184D24C9A0B8D4415E234DB649CAE740"; + static const uint8_t binary_fingerprint[16]; // = {0x18,0x4D,0x24,0xC9,0xA0,0xB8,0xD4,0x41,0x5E,0x23,0x4D,0xB6,0x49,0xCA,0xE7,0x40}; + + SliceRange() : start(""), finish(""), reversed(false), count(100) { + } + + virtual ~SliceRange() throw() {} + + std::string start; + std::string finish; + bool reversed; + int32_t count; + + void __set_start(const std::string& val) { + start = val; + } + + void __set_finish(const std::string& val) { + finish = val; + } + + void __set_reversed(const bool val) { + reversed = val; + } + + void __set_count(const int32_t val) { + count = val; + } + + bool operator == (const SliceRange & rhs) const + { + if (!(start == rhs.start)) + return false; + if (!(finish == rhs.finish)) + return false; + if (!(reversed == rhs.reversed)) + return false; + if (!(count == rhs.count)) + return false; + return true; + } + bool operator != (const SliceRange &rhs) const { + return !(*this == rhs); + } + + bool operator < (const SliceRange & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _SlicePredicate__isset { + _SlicePredicate__isset() : column_names(false), slice_range(false) {} + bool column_names; + bool slice_range; +} _SlicePredicate__isset; + +class SlicePredicate { + public: + + static const char* ascii_fingerprint; // = "F59D1D81C17DFFAF09988BF1C9CE5E27"; + static const uint8_t binary_fingerprint[16]; // = {0xF5,0x9D,0x1D,0x81,0xC1,0x7D,0xFF,0xAF,0x09,0x98,0x8B,0xF1,0xC9,0xCE,0x5E,0x27}; + + SlicePredicate() { + } + + virtual ~SlicePredicate() throw() {} + + std::vector column_names; + SliceRange slice_range; + + _SlicePredicate__isset __isset; + + void __set_column_names(const std::vector & val) { + column_names = val; + __isset.column_names = true; + } + + void __set_slice_range(const SliceRange& val) { + slice_range = val; + __isset.slice_range = true; + } + + bool operator == (const SlicePredicate & rhs) const + { + if (__isset.column_names != rhs.__isset.column_names) + return false; + else if (__isset.column_names && !(column_names == rhs.column_names)) + return false; + if (__isset.slice_range != rhs.__isset.slice_range) + return false; + else if (__isset.slice_range && !(slice_range == rhs.slice_range)) + return false; + return true; + } + bool operator != (const SlicePredicate &rhs) const { + return !(*this == rhs); + } + + bool operator < (const SlicePredicate & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class IndexExpression { + public: + + static const char* ascii_fingerprint; // = "D9F4CFE2F293A8B1052FD3031DD2C847"; + static const uint8_t binary_fingerprint[16]; // = {0xD9,0xF4,0xCF,0xE2,0xF2,0x93,0xA8,0xB1,0x05,0x2F,0xD3,0x03,0x1D,0xD2,0xC8,0x47}; + + IndexExpression() : column_name(""), op((IndexOperator::type)0), value("") { + } + + virtual ~IndexExpression() throw() {} + + std::string column_name; + IndexOperator::type op; + std::string value; + + void __set_column_name(const std::string& val) { + column_name = val; + } + + void __set_op(const IndexOperator::type val) { + op = val; + } + + void __set_value(const std::string& val) { + value = val; + } + + bool operator == (const IndexExpression & rhs) const + { + if (!(column_name == rhs.column_name)) + return false; + if (!(op == rhs.op)) + return false; + if (!(value == rhs.value)) + return false; + return true; + } + bool operator != (const IndexExpression &rhs) const { + return !(*this == rhs); + } + + bool operator < (const IndexExpression & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class IndexClause { + public: + + static const char* ascii_fingerprint; // = "9B551B9AB86120B0EEA9005C77FD3C1F"; + static const uint8_t binary_fingerprint[16]; // = {0x9B,0x55,0x1B,0x9A,0xB8,0x61,0x20,0xB0,0xEE,0xA9,0x00,0x5C,0x77,0xFD,0x3C,0x1F}; + + IndexClause() : start_key(""), count(100) { + } + + virtual ~IndexClause() throw() {} + + std::vector expressions; + std::string start_key; + int32_t count; + + void __set_expressions(const std::vector & val) { + expressions = val; + } + + void __set_start_key(const std::string& val) { + start_key = val; + } + + void __set_count(const int32_t val) { + count = val; + } + + bool operator == (const IndexClause & rhs) const + { + if (!(expressions == rhs.expressions)) + return false; + if (!(start_key == rhs.start_key)) + return false; + if (!(count == rhs.count)) + return false; + return true; + } + bool operator != (const IndexClause &rhs) const { + return !(*this == rhs); + } + + bool operator < (const IndexClause & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _KeyRange__isset { + _KeyRange__isset() : start_key(false), end_key(false), start_token(false), end_token(false), row_filter(false) {} + bool start_key; + bool end_key; + bool start_token; + bool end_token; + bool row_filter; +} _KeyRange__isset; + +class KeyRange { + public: + + static const char* ascii_fingerprint; // = "A6EC82FA0980B91C7C8EB013C61CA1B0"; + static const uint8_t binary_fingerprint[16]; // = {0xA6,0xEC,0x82,0xFA,0x09,0x80,0xB9,0x1C,0x7C,0x8E,0xB0,0x13,0xC6,0x1C,0xA1,0xB0}; + + KeyRange() : start_key(""), end_key(""), start_token(""), end_token(""), count(100) { + } + + virtual ~KeyRange() throw() {} + + std::string start_key; + std::string end_key; + std::string start_token; + std::string end_token; + std::vector row_filter; + int32_t count; + + _KeyRange__isset __isset; + + void __set_start_key(const std::string& val) { + start_key = val; + __isset.start_key = true; + } + + void __set_end_key(const std::string& val) { + end_key = val; + __isset.end_key = true; + } + + void __set_start_token(const std::string& val) { + start_token = val; + __isset.start_token = true; + } + + void __set_end_token(const std::string& val) { + end_token = val; + __isset.end_token = true; + } + + void __set_row_filter(const std::vector & val) { + row_filter = val; + __isset.row_filter = true; + } + + void __set_count(const int32_t val) { + count = val; + } + + bool operator == (const KeyRange & rhs) const + { + if (__isset.start_key != rhs.__isset.start_key) + return false; + else if (__isset.start_key && !(start_key == rhs.start_key)) + return false; + if (__isset.end_key != rhs.__isset.end_key) + return false; + else if (__isset.end_key && !(end_key == rhs.end_key)) + return false; + if (__isset.start_token != rhs.__isset.start_token) + return false; + else if (__isset.start_token && !(start_token == rhs.start_token)) + return false; + if (__isset.end_token != rhs.__isset.end_token) + return false; + else if (__isset.end_token && !(end_token == rhs.end_token)) + return false; + if (__isset.row_filter != rhs.__isset.row_filter) + return false; + else if (__isset.row_filter && !(row_filter == rhs.row_filter)) + return false; + if (!(count == rhs.count)) + return false; + return true; + } + bool operator != (const KeyRange &rhs) const { + return !(*this == rhs); + } + + bool operator < (const KeyRange & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class KeySlice { + public: + + static const char* ascii_fingerprint; // = "D1568675B0C135C909E3169B72A4DA3D"; + static const uint8_t binary_fingerprint[16]; // = {0xD1,0x56,0x86,0x75,0xB0,0xC1,0x35,0xC9,0x09,0xE3,0x16,0x9B,0x72,0xA4,0xDA,0x3D}; + + KeySlice() : key("") { + } + + virtual ~KeySlice() throw() {} + + std::string key; + std::vector columns; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + bool operator == (const KeySlice & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(columns == rhs.columns)) + return false; + return true; + } + bool operator != (const KeySlice &rhs) const { + return !(*this == rhs); + } + + bool operator < (const KeySlice & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class KeyCount { + public: + + static const char* ascii_fingerprint; // = "EEBC915CE44901401D881E6091423036"; + static const uint8_t binary_fingerprint[16]; // = {0xEE,0xBC,0x91,0x5C,0xE4,0x49,0x01,0x40,0x1D,0x88,0x1E,0x60,0x91,0x42,0x30,0x36}; + + KeyCount() : key(""), count(0) { + } + + virtual ~KeyCount() throw() {} + + std::string key; + int32_t count; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_count(const int32_t val) { + count = val; + } + + bool operator == (const KeyCount & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(count == rhs.count)) + return false; + return true; + } + bool operator != (const KeyCount &rhs) const { + return !(*this == rhs); + } + + bool operator < (const KeyCount & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Deletion__isset { + _Deletion__isset() : timestamp(false), super_column(false), predicate(false) {} + bool timestamp; + bool super_column; + bool predicate; +} _Deletion__isset; + +class Deletion { + public: + + static const char* ascii_fingerprint; // = "40F33ECF1C932CA77C2414C4E6C60CBE"; + static const uint8_t binary_fingerprint[16]; // = {0x40,0xF3,0x3E,0xCF,0x1C,0x93,0x2C,0xA7,0x7C,0x24,0x14,0xC4,0xE6,0xC6,0x0C,0xBE}; + + Deletion() : timestamp(0), super_column("") { + } + + virtual ~Deletion() throw() {} + + int64_t timestamp; + std::string super_column; + SlicePredicate predicate; + + _Deletion__isset __isset; + + void __set_timestamp(const int64_t val) { + timestamp = val; + __isset.timestamp = true; + } + + void __set_super_column(const std::string& val) { + super_column = val; + __isset.super_column = true; + } + + void __set_predicate(const SlicePredicate& val) { + predicate = val; + __isset.predicate = true; + } + + bool operator == (const Deletion & rhs) const + { + if (__isset.timestamp != rhs.__isset.timestamp) + return false; + else if (__isset.timestamp && !(timestamp == rhs.timestamp)) + return false; + if (__isset.super_column != rhs.__isset.super_column) + return false; + else if (__isset.super_column && !(super_column == rhs.super_column)) + return false; + if (__isset.predicate != rhs.__isset.predicate) + return false; + else if (__isset.predicate && !(predicate == rhs.predicate)) + return false; + return true; + } + bool operator != (const Deletion &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Deletion & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Mutation__isset { + _Mutation__isset() : column_or_supercolumn(false), deletion(false) {} + bool column_or_supercolumn; + bool deletion; +} _Mutation__isset; + +class Mutation { + public: + + static const char* ascii_fingerprint; // = "E8B65DF3979C6868F80DF81F8E769E63"; + static const uint8_t binary_fingerprint[16]; // = {0xE8,0xB6,0x5D,0xF3,0x97,0x9C,0x68,0x68,0xF8,0x0D,0xF8,0x1F,0x8E,0x76,0x9E,0x63}; + + Mutation() { + } + + virtual ~Mutation() throw() {} + + ColumnOrSuperColumn column_or_supercolumn; + Deletion deletion; + + _Mutation__isset __isset; + + void __set_column_or_supercolumn(const ColumnOrSuperColumn& val) { + column_or_supercolumn = val; + __isset.column_or_supercolumn = true; + } + + void __set_deletion(const Deletion& val) { + deletion = val; + __isset.deletion = true; + } + + bool operator == (const Mutation & rhs) const + { + if (__isset.column_or_supercolumn != rhs.__isset.column_or_supercolumn) + return false; + else if (__isset.column_or_supercolumn && !(column_or_supercolumn == rhs.column_or_supercolumn)) + return false; + if (__isset.deletion != rhs.__isset.deletion) + return false; + else if (__isset.deletion && !(deletion == rhs.deletion)) + return false; + return true; + } + bool operator != (const Mutation &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Mutation & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _EndpointDetails__isset { + _EndpointDetails__isset() : host(false), datacenter(false), rack(false) {} + bool host; + bool datacenter; + bool rack; +} _EndpointDetails__isset; + +class EndpointDetails { + public: + + static const char* ascii_fingerprint; // = "F4A50F0EC638C7F66026F9B6678FD89B"; + static const uint8_t binary_fingerprint[16]; // = {0xF4,0xA5,0x0F,0x0E,0xC6,0x38,0xC7,0xF6,0x60,0x26,0xF9,0xB6,0x67,0x8F,0xD8,0x9B}; + + EndpointDetails() : host(""), datacenter(""), rack("") { + } + + virtual ~EndpointDetails() throw() {} + + std::string host; + std::string datacenter; + std::string rack; + + _EndpointDetails__isset __isset; + + void __set_host(const std::string& val) { + host = val; + } + + void __set_datacenter(const std::string& val) { + datacenter = val; + } + + void __set_rack(const std::string& val) { + rack = val; + __isset.rack = true; + } + + bool operator == (const EndpointDetails & rhs) const + { + if (!(host == rhs.host)) + return false; + if (!(datacenter == rhs.datacenter)) + return false; + if (__isset.rack != rhs.__isset.rack) + return false; + else if (__isset.rack && !(rack == rhs.rack)) + return false; + return true; + } + bool operator != (const EndpointDetails &rhs) const { + return !(*this == rhs); + } + + bool operator < (const EndpointDetails & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TokenRange__isset { + _TokenRange__isset() : rpc_endpoints(false), endpoint_details(false) {} + bool rpc_endpoints; + bool endpoint_details; +} _TokenRange__isset; + +class TokenRange { + public: + + static const char* ascii_fingerprint; // = "832268DC4CD6B17EE8881FC57EA04679"; + static const uint8_t binary_fingerprint[16]; // = {0x83,0x22,0x68,0xDC,0x4C,0xD6,0xB1,0x7E,0xE8,0x88,0x1F,0xC5,0x7E,0xA0,0x46,0x79}; + + TokenRange() : start_token(""), end_token("") { + } + + virtual ~TokenRange() throw() {} + + std::string start_token; + std::string end_token; + std::vector endpoints; + std::vector rpc_endpoints; + std::vector endpoint_details; + + _TokenRange__isset __isset; + + void __set_start_token(const std::string& val) { + start_token = val; + } + + void __set_end_token(const std::string& val) { + end_token = val; + } + + void __set_endpoints(const std::vector & val) { + endpoints = val; + } + + void __set_rpc_endpoints(const std::vector & val) { + rpc_endpoints = val; + __isset.rpc_endpoints = true; + } + + void __set_endpoint_details(const std::vector & val) { + endpoint_details = val; + __isset.endpoint_details = true; + } + + bool operator == (const TokenRange & rhs) const + { + if (!(start_token == rhs.start_token)) + return false; + if (!(end_token == rhs.end_token)) + return false; + if (!(endpoints == rhs.endpoints)) + return false; + if (__isset.rpc_endpoints != rhs.__isset.rpc_endpoints) + return false; + else if (__isset.rpc_endpoints && !(rpc_endpoints == rhs.rpc_endpoints)) + return false; + if (__isset.endpoint_details != rhs.__isset.endpoint_details) + return false; + else if (__isset.endpoint_details && !(endpoint_details == rhs.endpoint_details)) + return false; + return true; + } + bool operator != (const TokenRange &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TokenRange & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class AuthenticationRequest { + public: + + static const char* ascii_fingerprint; // = "5EA2D527ECA3BA20C77AFC023EE8C05F"; + static const uint8_t binary_fingerprint[16]; // = {0x5E,0xA2,0xD5,0x27,0xEC,0xA3,0xBA,0x20,0xC7,0x7A,0xFC,0x02,0x3E,0xE8,0xC0,0x5F}; + + AuthenticationRequest() { + } + + virtual ~AuthenticationRequest() throw() {} + + std::map credentials; + + void __set_credentials(const std::map & val) { + credentials = val; + } + + bool operator == (const AuthenticationRequest & rhs) const + { + if (!(credentials == rhs.credentials)) + return false; + return true; + } + bool operator != (const AuthenticationRequest &rhs) const { + return !(*this == rhs); + } + + bool operator < (const AuthenticationRequest & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ColumnDef__isset { + _ColumnDef__isset() : index_type(false), index_name(false), index_options(false) {} + bool index_type; + bool index_name; + bool index_options; +} _ColumnDef__isset; + +class ColumnDef { + public: + + static const char* ascii_fingerprint; // = "0D89CE83D7EDAD079AC3213ED1DCAA58"; + static const uint8_t binary_fingerprint[16]; // = {0x0D,0x89,0xCE,0x83,0xD7,0xED,0xAD,0x07,0x9A,0xC3,0x21,0x3E,0xD1,0xDC,0xAA,0x58}; + + ColumnDef() : name(""), validation_class(""), index_type((IndexType::type)0), index_name("") { + } + + virtual ~ColumnDef() throw() {} + + std::string name; + std::string validation_class; + IndexType::type index_type; + std::string index_name; + std::map index_options; + + _ColumnDef__isset __isset; + + void __set_name(const std::string& val) { + name = val; + } + + void __set_validation_class(const std::string& val) { + validation_class = val; + } + + void __set_index_type(const IndexType::type val) { + index_type = val; + __isset.index_type = true; + } + + void __set_index_name(const std::string& val) { + index_name = val; + __isset.index_name = true; + } + + void __set_index_options(const std::map & val) { + index_options = val; + __isset.index_options = true; + } + + bool operator == (const ColumnDef & rhs) const + { + if (!(name == rhs.name)) + return false; + if (!(validation_class == rhs.validation_class)) + return false; + if (__isset.index_type != rhs.__isset.index_type) + return false; + else if (__isset.index_type && !(index_type == rhs.index_type)) + return false; + if (__isset.index_name != rhs.__isset.index_name) + return false; + else if (__isset.index_name && !(index_name == rhs.index_name)) + return false; + if (__isset.index_options != rhs.__isset.index_options) + return false; + else if (__isset.index_options && !(index_options == rhs.index_options)) + return false; + return true; + } + bool operator != (const ColumnDef &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ColumnDef & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _CfDef__isset { + _CfDef__isset() : column_type(false), comparator_type(false), subcomparator_type(false), comment(false), read_repair_chance(false), column_metadata(false), gc_grace_seconds(false), default_validation_class(false), id(false), min_compaction_threshold(false), max_compaction_threshold(false), replicate_on_write(false), key_validation_class(false), key_alias(false), compaction_strategy(false), compaction_strategy_options(false), compression_options(false), bloom_filter_fp_chance(false), caching(false), dclocal_read_repair_chance(false), row_cache_size(false), key_cache_size(false), row_cache_save_period_in_seconds(false), key_cache_save_period_in_seconds(false), memtable_flush_after_mins(false), memtable_throughput_in_mb(false), memtable_operations_in_millions(false), merge_shards_chance(false), row_cache_provider(false), row_cache_keys_to_save(false) {} + bool column_type; + bool comparator_type; + bool subcomparator_type; + bool comment; + bool read_repair_chance; + bool column_metadata; + bool gc_grace_seconds; + bool default_validation_class; + bool id; + bool min_compaction_threshold; + bool max_compaction_threshold; + bool replicate_on_write; + bool key_validation_class; + bool key_alias; + bool compaction_strategy; + bool compaction_strategy_options; + bool compression_options; + bool bloom_filter_fp_chance; + bool caching; + bool dclocal_read_repair_chance; + bool row_cache_size; + bool key_cache_size; + bool row_cache_save_period_in_seconds; + bool key_cache_save_period_in_seconds; + bool memtable_flush_after_mins; + bool memtable_throughput_in_mb; + bool memtable_operations_in_millions; + bool merge_shards_chance; + bool row_cache_provider; + bool row_cache_keys_to_save; +} _CfDef__isset; + +class CfDef { + public: + + static const char* ascii_fingerprint; // = "231A260521B5DD99EFBCCBDD8768CA7D"; + static const uint8_t binary_fingerprint[16]; // = {0x23,0x1A,0x26,0x05,0x21,0xB5,0xDD,0x99,0xEF,0xBC,0xCB,0xDD,0x87,0x68,0xCA,0x7D}; + + CfDef() : keyspace(""), name(""), column_type("Standard"), comparator_type("BytesType"), subcomparator_type(""), comment(""), read_repair_chance(0), gc_grace_seconds(0), default_validation_class(""), id(0), min_compaction_threshold(0), max_compaction_threshold(0), replicate_on_write(0), key_validation_class(""), key_alias(""), compaction_strategy(""), bloom_filter_fp_chance(0), caching("keys_only"), dclocal_read_repair_chance(0), row_cache_size(0), key_cache_size(0), row_cache_save_period_in_seconds(0), key_cache_save_period_in_seconds(0), memtable_flush_after_mins(0), memtable_throughput_in_mb(0), memtable_operations_in_millions(0), merge_shards_chance(0), row_cache_provider(""), row_cache_keys_to_save(0) { + } + + virtual ~CfDef() throw() {} + + std::string keyspace; + std::string name; + std::string column_type; + std::string comparator_type; + std::string subcomparator_type; + std::string comment; + double read_repair_chance; + std::vector column_metadata; + int32_t gc_grace_seconds; + std::string default_validation_class; + int32_t id; + int32_t min_compaction_threshold; + int32_t max_compaction_threshold; + bool replicate_on_write; + std::string key_validation_class; + std::string key_alias; + std::string compaction_strategy; + std::map compaction_strategy_options; + std::map compression_options; + double bloom_filter_fp_chance; + std::string caching; + double dclocal_read_repair_chance; + double row_cache_size; + double key_cache_size; + int32_t row_cache_save_period_in_seconds; + int32_t key_cache_save_period_in_seconds; + int32_t memtable_flush_after_mins; + int32_t memtable_throughput_in_mb; + double memtable_operations_in_millions; + double merge_shards_chance; + std::string row_cache_provider; + int32_t row_cache_keys_to_save; + + _CfDef__isset __isset; + + void __set_keyspace(const std::string& val) { + keyspace = val; + } + + void __set_name(const std::string& val) { + name = val; + } + + void __set_column_type(const std::string& val) { + column_type = val; + __isset.column_type = true; + } + + void __set_comparator_type(const std::string& val) { + comparator_type = val; + __isset.comparator_type = true; + } + + void __set_subcomparator_type(const std::string& val) { + subcomparator_type = val; + __isset.subcomparator_type = true; + } + + void __set_comment(const std::string& val) { + comment = val; + __isset.comment = true; + } + + void __set_read_repair_chance(const double val) { + read_repair_chance = val; + __isset.read_repair_chance = true; + } + + void __set_column_metadata(const std::vector & val) { + column_metadata = val; + __isset.column_metadata = true; + } + + void __set_gc_grace_seconds(const int32_t val) { + gc_grace_seconds = val; + __isset.gc_grace_seconds = true; + } + + void __set_default_validation_class(const std::string& val) { + default_validation_class = val; + __isset.default_validation_class = true; + } + + void __set_id(const int32_t val) { + id = val; + __isset.id = true; + } + + void __set_min_compaction_threshold(const int32_t val) { + min_compaction_threshold = val; + __isset.min_compaction_threshold = true; + } + + void __set_max_compaction_threshold(const int32_t val) { + max_compaction_threshold = val; + __isset.max_compaction_threshold = true; + } + + void __set_replicate_on_write(const bool val) { + replicate_on_write = val; + __isset.replicate_on_write = true; + } + + void __set_key_validation_class(const std::string& val) { + key_validation_class = val; + __isset.key_validation_class = true; + } + + void __set_key_alias(const std::string& val) { + key_alias = val; + __isset.key_alias = true; + } + + void __set_compaction_strategy(const std::string& val) { + compaction_strategy = val; + __isset.compaction_strategy = true; + } + + void __set_compaction_strategy_options(const std::map & val) { + compaction_strategy_options = val; + __isset.compaction_strategy_options = true; + } + + void __set_compression_options(const std::map & val) { + compression_options = val; + __isset.compression_options = true; + } + + void __set_bloom_filter_fp_chance(const double val) { + bloom_filter_fp_chance = val; + __isset.bloom_filter_fp_chance = true; + } + + void __set_caching(const std::string& val) { + caching = val; + __isset.caching = true; + } + + void __set_dclocal_read_repair_chance(const double val) { + dclocal_read_repair_chance = val; + __isset.dclocal_read_repair_chance = true; + } + + void __set_row_cache_size(const double val) { + row_cache_size = val; + __isset.row_cache_size = true; + } + + void __set_key_cache_size(const double val) { + key_cache_size = val; + __isset.key_cache_size = true; + } + + void __set_row_cache_save_period_in_seconds(const int32_t val) { + row_cache_save_period_in_seconds = val; + __isset.row_cache_save_period_in_seconds = true; + } + + void __set_key_cache_save_period_in_seconds(const int32_t val) { + key_cache_save_period_in_seconds = val; + __isset.key_cache_save_period_in_seconds = true; + } + + void __set_memtable_flush_after_mins(const int32_t val) { + memtable_flush_after_mins = val; + __isset.memtable_flush_after_mins = true; + } + + void __set_memtable_throughput_in_mb(const int32_t val) { + memtable_throughput_in_mb = val; + __isset.memtable_throughput_in_mb = true; + } + + void __set_memtable_operations_in_millions(const double val) { + memtable_operations_in_millions = val; + __isset.memtable_operations_in_millions = true; + } + + void __set_merge_shards_chance(const double val) { + merge_shards_chance = val; + __isset.merge_shards_chance = true; + } + + void __set_row_cache_provider(const std::string& val) { + row_cache_provider = val; + __isset.row_cache_provider = true; + } + + void __set_row_cache_keys_to_save(const int32_t val) { + row_cache_keys_to_save = val; + __isset.row_cache_keys_to_save = true; + } + + bool operator == (const CfDef & rhs) const + { + if (!(keyspace == rhs.keyspace)) + return false; + if (!(name == rhs.name)) + return false; + if (__isset.column_type != rhs.__isset.column_type) + return false; + else if (__isset.column_type && !(column_type == rhs.column_type)) + return false; + if (__isset.comparator_type != rhs.__isset.comparator_type) + return false; + else if (__isset.comparator_type && !(comparator_type == rhs.comparator_type)) + return false; + if (__isset.subcomparator_type != rhs.__isset.subcomparator_type) + return false; + else if (__isset.subcomparator_type && !(subcomparator_type == rhs.subcomparator_type)) + return false; + if (__isset.comment != rhs.__isset.comment) + return false; + else if (__isset.comment && !(comment == rhs.comment)) + return false; + if (__isset.read_repair_chance != rhs.__isset.read_repair_chance) + return false; + else if (__isset.read_repair_chance && !(read_repair_chance == rhs.read_repair_chance)) + return false; + if (__isset.column_metadata != rhs.__isset.column_metadata) + return false; + else if (__isset.column_metadata && !(column_metadata == rhs.column_metadata)) + return false; + if (__isset.gc_grace_seconds != rhs.__isset.gc_grace_seconds) + return false; + else if (__isset.gc_grace_seconds && !(gc_grace_seconds == rhs.gc_grace_seconds)) + return false; + if (__isset.default_validation_class != rhs.__isset.default_validation_class) + return false; + else if (__isset.default_validation_class && !(default_validation_class == rhs.default_validation_class)) + return false; + if (__isset.id != rhs.__isset.id) + return false; + else if (__isset.id && !(id == rhs.id)) + return false; + if (__isset.min_compaction_threshold != rhs.__isset.min_compaction_threshold) + return false; + else if (__isset.min_compaction_threshold && !(min_compaction_threshold == rhs.min_compaction_threshold)) + return false; + if (__isset.max_compaction_threshold != rhs.__isset.max_compaction_threshold) + return false; + else if (__isset.max_compaction_threshold && !(max_compaction_threshold == rhs.max_compaction_threshold)) + return false; + if (__isset.replicate_on_write != rhs.__isset.replicate_on_write) + return false; + else if (__isset.replicate_on_write && !(replicate_on_write == rhs.replicate_on_write)) + return false; + if (__isset.key_validation_class != rhs.__isset.key_validation_class) + return false; + else if (__isset.key_validation_class && !(key_validation_class == rhs.key_validation_class)) + return false; + if (__isset.key_alias != rhs.__isset.key_alias) + return false; + else if (__isset.key_alias && !(key_alias == rhs.key_alias)) + return false; + if (__isset.compaction_strategy != rhs.__isset.compaction_strategy) + return false; + else if (__isset.compaction_strategy && !(compaction_strategy == rhs.compaction_strategy)) + return false; + if (__isset.compaction_strategy_options != rhs.__isset.compaction_strategy_options) + return false; + else if (__isset.compaction_strategy_options && !(compaction_strategy_options == rhs.compaction_strategy_options)) + return false; + if (__isset.compression_options != rhs.__isset.compression_options) + return false; + else if (__isset.compression_options && !(compression_options == rhs.compression_options)) + return false; + if (__isset.bloom_filter_fp_chance != rhs.__isset.bloom_filter_fp_chance) + return false; + else if (__isset.bloom_filter_fp_chance && !(bloom_filter_fp_chance == rhs.bloom_filter_fp_chance)) + return false; + if (__isset.caching != rhs.__isset.caching) + return false; + else if (__isset.caching && !(caching == rhs.caching)) + return false; + if (__isset.dclocal_read_repair_chance != rhs.__isset.dclocal_read_repair_chance) + return false; + else if (__isset.dclocal_read_repair_chance && !(dclocal_read_repair_chance == rhs.dclocal_read_repair_chance)) + return false; + if (__isset.row_cache_size != rhs.__isset.row_cache_size) + return false; + else if (__isset.row_cache_size && !(row_cache_size == rhs.row_cache_size)) + return false; + if (__isset.key_cache_size != rhs.__isset.key_cache_size) + return false; + else if (__isset.key_cache_size && !(key_cache_size == rhs.key_cache_size)) + return false; + if (__isset.row_cache_save_period_in_seconds != rhs.__isset.row_cache_save_period_in_seconds) + return false; + else if (__isset.row_cache_save_period_in_seconds && !(row_cache_save_period_in_seconds == rhs.row_cache_save_period_in_seconds)) + return false; + if (__isset.key_cache_save_period_in_seconds != rhs.__isset.key_cache_save_period_in_seconds) + return false; + else if (__isset.key_cache_save_period_in_seconds && !(key_cache_save_period_in_seconds == rhs.key_cache_save_period_in_seconds)) + return false; + if (__isset.memtable_flush_after_mins != rhs.__isset.memtable_flush_after_mins) + return false; + else if (__isset.memtable_flush_after_mins && !(memtable_flush_after_mins == rhs.memtable_flush_after_mins)) + return false; + if (__isset.memtable_throughput_in_mb != rhs.__isset.memtable_throughput_in_mb) + return false; + else if (__isset.memtable_throughput_in_mb && !(memtable_throughput_in_mb == rhs.memtable_throughput_in_mb)) + return false; + if (__isset.memtable_operations_in_millions != rhs.__isset.memtable_operations_in_millions) + return false; + else if (__isset.memtable_operations_in_millions && !(memtable_operations_in_millions == rhs.memtable_operations_in_millions)) + return false; + if (__isset.merge_shards_chance != rhs.__isset.merge_shards_chance) + return false; + else if (__isset.merge_shards_chance && !(merge_shards_chance == rhs.merge_shards_chance)) + return false; + if (__isset.row_cache_provider != rhs.__isset.row_cache_provider) + return false; + else if (__isset.row_cache_provider && !(row_cache_provider == rhs.row_cache_provider)) + return false; + if (__isset.row_cache_keys_to_save != rhs.__isset.row_cache_keys_to_save) + return false; + else if (__isset.row_cache_keys_to_save && !(row_cache_keys_to_save == rhs.row_cache_keys_to_save)) + return false; + return true; + } + bool operator != (const CfDef &rhs) const { + return !(*this == rhs); + } + + bool operator < (const CfDef & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _KsDef__isset { + _KsDef__isset() : strategy_options(false), replication_factor(false), durable_writes(false) {} + bool strategy_options; + bool replication_factor; + bool durable_writes; +} _KsDef__isset; + +class KsDef { + public: + + static const char* ascii_fingerprint; // = "0767851B6476EB3777A21E59E912E11A"; + static const uint8_t binary_fingerprint[16]; // = {0x07,0x67,0x85,0x1B,0x64,0x76,0xEB,0x37,0x77,0xA2,0x1E,0x59,0xE9,0x12,0xE1,0x1A}; + + KsDef() : name(""), strategy_class(""), replication_factor(0), durable_writes(true) { + } + + virtual ~KsDef() throw() {} + + std::string name; + std::string strategy_class; + std::map strategy_options; + int32_t replication_factor; + std::vector cf_defs; + bool durable_writes; + + _KsDef__isset __isset; + + void __set_name(const std::string& val) { + name = val; + } + + void __set_strategy_class(const std::string& val) { + strategy_class = val; + } + + void __set_strategy_options(const std::map & val) { + strategy_options = val; + __isset.strategy_options = true; + } + + void __set_replication_factor(const int32_t val) { + replication_factor = val; + __isset.replication_factor = true; + } + + void __set_cf_defs(const std::vector & val) { + cf_defs = val; + } + + void __set_durable_writes(const bool val) { + durable_writes = val; + __isset.durable_writes = true; + } + + bool operator == (const KsDef & rhs) const + { + if (!(name == rhs.name)) + return false; + if (!(strategy_class == rhs.strategy_class)) + return false; + if (__isset.strategy_options != rhs.__isset.strategy_options) + return false; + else if (__isset.strategy_options && !(strategy_options == rhs.strategy_options)) + return false; + if (__isset.replication_factor != rhs.__isset.replication_factor) + return false; + else if (__isset.replication_factor && !(replication_factor == rhs.replication_factor)) + return false; + if (!(cf_defs == rhs.cf_defs)) + return false; + if (__isset.durable_writes != rhs.__isset.durable_writes) + return false; + else if (__isset.durable_writes && !(durable_writes == rhs.durable_writes)) + return false; + return true; + } + bool operator != (const KsDef &rhs) const { + return !(*this == rhs); + } + + bool operator < (const KsDef & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class CqlRow { + public: + + static const char* ascii_fingerprint; // = "470EFC558004E98D92D604898305C04E"; + static const uint8_t binary_fingerprint[16]; // = {0x47,0x0E,0xFC,0x55,0x80,0x04,0xE9,0x8D,0x92,0xD6,0x04,0x89,0x83,0x05,0xC0,0x4E}; + + CqlRow() : key("") { + } + + virtual ~CqlRow() throw() {} + + std::string key; + std::vector columns; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + bool operator == (const CqlRow & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(columns == rhs.columns)) + return false; + return true; + } + bool operator != (const CqlRow &rhs) const { + return !(*this == rhs); + } + + bool operator < (const CqlRow & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class CqlMetadata { + public: + + static const char* ascii_fingerprint; // = "B7C5A4AA9652C744A48EBC1C12D531E7"; + static const uint8_t binary_fingerprint[16]; // = {0xB7,0xC5,0xA4,0xAA,0x96,0x52,0xC7,0x44,0xA4,0x8E,0xBC,0x1C,0x12,0xD5,0x31,0xE7}; + + CqlMetadata() : default_name_type(""), default_value_type("") { + } + + virtual ~CqlMetadata() throw() {} + + std::map name_types; + std::map value_types; + std::string default_name_type; + std::string default_value_type; + + void __set_name_types(const std::map & val) { + name_types = val; + } + + void __set_value_types(const std::map & val) { + value_types = val; + } + + void __set_default_name_type(const std::string& val) { + default_name_type = val; + } + + void __set_default_value_type(const std::string& val) { + default_value_type = val; + } + + bool operator == (const CqlMetadata & rhs) const + { + if (!(name_types == rhs.name_types)) + return false; + if (!(value_types == rhs.value_types)) + return false; + if (!(default_name_type == rhs.default_name_type)) + return false; + if (!(default_value_type == rhs.default_value_type)) + return false; + return true; + } + bool operator != (const CqlMetadata &rhs) const { + return !(*this == rhs); + } + + bool operator < (const CqlMetadata & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _CqlResult__isset { + _CqlResult__isset() : rows(false), num(false), schema(false) {} + bool rows; + bool num; + bool schema; +} _CqlResult__isset; + +class CqlResult { + public: + + static const char* ascii_fingerprint; // = "521B9CE5AF77539F7267F6952B609E81"; + static const uint8_t binary_fingerprint[16]; // = {0x52,0x1B,0x9C,0xE5,0xAF,0x77,0x53,0x9F,0x72,0x67,0xF6,0x95,0x2B,0x60,0x9E,0x81}; + + CqlResult() : type((CqlResultType::type)0), num(0) { + } + + virtual ~CqlResult() throw() {} + + CqlResultType::type type; + std::vector rows; + int32_t num; + CqlMetadata schema; + + _CqlResult__isset __isset; + + void __set_type(const CqlResultType::type val) { + type = val; + } + + void __set_rows(const std::vector & val) { + rows = val; + __isset.rows = true; + } + + void __set_num(const int32_t val) { + num = val; + __isset.num = true; + } + + void __set_schema(const CqlMetadata& val) { + schema = val; + __isset.schema = true; + } + + bool operator == (const CqlResult & rhs) const + { + if (!(type == rhs.type)) + return false; + if (__isset.rows != rhs.__isset.rows) + return false; + else if (__isset.rows && !(rows == rhs.rows)) + return false; + if (__isset.num != rhs.__isset.num) + return false; + else if (__isset.num && !(num == rhs.num)) + return false; + if (__isset.schema != rhs.__isset.schema) + return false; + else if (__isset.schema && !(schema == rhs.schema)) + return false; + return true; + } + bool operator != (const CqlResult &rhs) const { + return !(*this == rhs); + } + + bool operator < (const CqlResult & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _CqlPreparedResult__isset { + _CqlPreparedResult__isset() : variable_types(false), variable_names(false) {} + bool variable_types; + bool variable_names; +} _CqlPreparedResult__isset; + +class CqlPreparedResult { + public: + + static const char* ascii_fingerprint; // = "7E1663EC688DFDC28722BF36F9F64E6F"; + static const uint8_t binary_fingerprint[16]; // = {0x7E,0x16,0x63,0xEC,0x68,0x8D,0xFD,0xC2,0x87,0x22,0xBF,0x36,0xF9,0xF6,0x4E,0x6F}; + + CqlPreparedResult() : itemId(0), count(0) { + } + + virtual ~CqlPreparedResult() throw() {} + + int32_t itemId; + int32_t count; + std::vector variable_types; + std::vector variable_names; + + _CqlPreparedResult__isset __isset; + + void __set_itemId(const int32_t val) { + itemId = val; + } + + void __set_count(const int32_t val) { + count = val; + } + + void __set_variable_types(const std::vector & val) { + variable_types = val; + __isset.variable_types = true; + } + + void __set_variable_names(const std::vector & val) { + variable_names = val; + __isset.variable_names = true; + } + + bool operator == (const CqlPreparedResult & rhs) const + { + if (!(itemId == rhs.itemId)) + return false; + if (!(count == rhs.count)) + return false; + if (__isset.variable_types != rhs.__isset.variable_types) + return false; + else if (__isset.variable_types && !(variable_types == rhs.variable_types)) + return false; + if (__isset.variable_names != rhs.__isset.variable_names) + return false; + else if (__isset.variable_names && !(variable_names == rhs.variable_names)) + return false; + return true; + } + bool operator != (const CqlPreparedResult &rhs) const { + return !(*this == rhs); + } + + bool operator < (const CqlPreparedResult & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +}}} // namespace + +#endif diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc new file mode 100644 index 00000000000..4dec67202bf --- /dev/null +++ b/storage/cassandra/ha_cassandra.cc @@ -0,0 +1,727 @@ +/* + MP AB copyrights +*/ + +#ifdef USE_PRAGMA_IMPLEMENTATION +#pragma implementation // gcc: Class implementation +#endif + +#include +#include "ha_cassandra.h" +#include "sql_class.h" + +static handler *cassandra_create_handler(handlerton *hton, + TABLE_SHARE *table, + MEM_ROOT *mem_root); + + +handlerton *cassandra_hton; + + +/* + Hash used to track the number of open tables; variable for example share + methods +*/ +static HASH cassandra_open_tables; + +/* The mutex used to init the hash; variable for example share methods */ +mysql_mutex_t cassandra_mutex; + + +/** + Structure for CREATE TABLE options (table options). + It needs to be called ha_table_option_struct. + + The option values can be specified in the CREATE TABLE at the end: + CREATE TABLE ( ... ) *here* +*/ + +struct ha_table_option_struct +{ + const char *host; + const char *keyspace; + const char *column_family; +}; + + +ha_create_table_option cassandra_table_option_list[]= +{ + /* + one option that takes an arbitrary string + */ + HA_TOPTION_STRING("thrift_host", host), + HA_TOPTION_STRING("keyspace", keyspace), + HA_TOPTION_STRING("column_family", column_family), + HA_TOPTION_END +}; + + +/** + @brief + Function we use in the creation of our hash to get key. +*/ + +static uchar* cassandra_get_key(CASSANDRA_SHARE *share, size_t *length, + my_bool not_used __attribute__((unused))) +{ + *length=share->table_name_length; + return (uchar*) share->table_name; +} + +#ifdef HAVE_PSI_INTERFACE +static PSI_mutex_key ex_key_mutex_example, ex_key_mutex_CASSANDRA_SHARE_mutex; + +static PSI_mutex_info all_cassandra_mutexes[]= +{ + { &ex_key_mutex_example, "cassandra", PSI_FLAG_GLOBAL}, + { &ex_key_mutex_CASSANDRA_SHARE_mutex, "CASSANDRA_SHARE::mutex", 0} +}; + +static void init_cassandra_psi_keys() +{ + const char* category= "cassandra"; + int count; + + if (PSI_server == NULL) + return; + + count= array_elements(all_cassandra_mutexes); + PSI_server->register_mutex(category, all_cassandra_mutexes, count); +} +#endif + +static int cassandra_init_func(void *p) +{ + DBUG_ENTER("cassandra_init_func"); + +#ifdef HAVE_PSI_INTERFACE + init_cassandra_psi_keys(); +#endif + + cassandra_hton= (handlerton *)p; + mysql_mutex_init(ex_key_mutex_example, &cassandra_mutex, MY_MUTEX_INIT_FAST); + (void) my_hash_init(&cassandra_open_tables,system_charset_info,32,0,0, + (my_hash_get_key) cassandra_get_key,0,0); + + cassandra_hton->state= SHOW_OPTION_YES; + cassandra_hton->create= cassandra_create_handler; + cassandra_hton->flags= HTON_CAN_RECREATE; + cassandra_hton->table_options= cassandra_table_option_list; + //cassandra_hton->field_options= example_field_option_list; + cassandra_hton->field_options= NULL; + + DBUG_RETURN(0); +} + + +static int cassandra_done_func(void *p) +{ + int error= 0; + DBUG_ENTER("cassandra_done_func"); + if (cassandra_open_tables.records) + error= 1; + my_hash_free(&cassandra_open_tables); + mysql_mutex_destroy(&cassandra_mutex); + DBUG_RETURN(error); +} + + +/** + @brief + Example of simple lock controls. The "share" it creates is a + structure we will pass to each cassandra handler. Do you have to have + one of these? Well, you have pieces that are used for locking, and + they are needed to function. +*/ + +static CASSANDRA_SHARE *get_share(const char *table_name, TABLE *table) +{ + CASSANDRA_SHARE *share; + uint length; + char *tmp_name; + + mysql_mutex_lock(&cassandra_mutex); + length=(uint) strlen(table_name); + + if (!(share=(CASSANDRA_SHARE*) my_hash_search(&cassandra_open_tables, + (uchar*) table_name, + length))) + { + if (!(share=(CASSANDRA_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &share, sizeof(*share), + &tmp_name, length+1, + NullS))) + { + mysql_mutex_unlock(&cassandra_mutex); + return NULL; + } + + share->use_count=0; + share->table_name_length=length; + share->table_name=tmp_name; + strmov(share->table_name,table_name); + if (my_hash_insert(&cassandra_open_tables, (uchar*) share)) + goto error; + thr_lock_init(&share->lock); + mysql_mutex_init(ex_key_mutex_CASSANDRA_SHARE_mutex, + &share->mutex, MY_MUTEX_INIT_FAST); + } + share->use_count++; + mysql_mutex_unlock(&cassandra_mutex); + + return share; + +error: + mysql_mutex_destroy(&share->mutex); + my_free(share); + + return NULL; +} + + +/** + @brief + Free lock controls. We call this whenever we close a table. If the table had + the last reference to the share, then we free memory associated with it. +*/ + +static int free_share(CASSANDRA_SHARE *share) +{ + mysql_mutex_lock(&cassandra_mutex); + if (!--share->use_count) + { + my_hash_delete(&cassandra_open_tables, (uchar*) share); + thr_lock_delete(&share->lock); + mysql_mutex_destroy(&share->mutex); + my_free(share); + } + mysql_mutex_unlock(&cassandra_mutex); + + return 0; +} + + +static handler* cassandra_create_handler(handlerton *hton, + TABLE_SHARE *table, + MEM_ROOT *mem_root) +{ + return new (mem_root) ha_cassandra(hton, table); +} + + +ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg) + :handler(hton, table_arg), + se(NULL), names_and_vals(NULL) +{} + + +static const char *ha_cassandra_exts[] = { + NullS +}; + +const char **ha_cassandra::bas_ext() const +{ + return ha_cassandra_exts; +} + + +int ha_cassandra::open(const char *name, int mode, uint test_if_locked) +{ + DBUG_ENTER("ha_cassandra::open"); + + if (!(share = get_share(name, table))) + DBUG_RETURN(1); + thr_lock_data_init(&share->lock,&lock,NULL); + + ha_table_option_struct *options= table->s->option_struct; + fprintf(stderr, "ha_cass: open thrift_host=%s keyspace=%s column_family=%s\n", + options->host, options->keyspace, options->column_family); + + DBUG_ASSERT(!se); + if (!options->host || !options->keyspace || !options->column_family) + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + se= get_cassandra_se(); + se->set_column_family(options->column_family); + if (se->connect(options->host, options->keyspace)) + { + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); + DBUG_RETURN(HA_ERR_NO_CONNECTION); + } + + DBUG_RETURN(0); +} + + +int ha_cassandra::close(void) +{ + DBUG_ENTER("ha_cassandra::close"); + delete se; + se= NULL; + if (names_and_vals) + { + my_free(names_and_vals); + names_and_vals= NULL; + } + DBUG_RETURN(free_share(share)); +} + + +/** + @brief + create() is called to create a database. The variable name will have the name + of the table. + + @details + When create() is called you do not need to worry about + opening the table. Also, the .frm file will have already been + created so adjusting create_info is not necessary. You can overwrite + the .frm file at this point if you wish to change the table + definition, but there are no methods currently provided for doing + so. + + Called from handle.cc by ha_create_table(). + + @see + ha_create_table() in handle.cc +*/ + +int ha_cassandra::create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info) +{ + ha_table_option_struct *options= table_arg->s->option_struct; + DBUG_ENTER("ha_cassandra::create"); + DBUG_ASSERT(options); + //psergey-todo: This is called for CREATE TABLE... check options here. + +/* + if (table_arg->s->fields != 2) + { + my_error(ER_WRONG_COLUMN_NAME, MYF(0), "The table must have two fields"); + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + } +*/ + + Field **pfield= table_arg->s->field; + if (strcmp((*pfield)->field_name, "rowkey")) + { + my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be named 'rowkey'"); + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + } + + if (table_arg->s->keys != 1 || table_arg->s->primary_key !=0 || + table_arg->key_info[0].key_parts != 1 || + table_arg->key_info[0].key_part[0].fieldnr != 1) + { + my_error(ER_WRONG_COLUMN_NAME, MYF(0), "Table must have one PRIMARY KEY(rowkey)"); + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + } + +/* + pfield++; + if (strcmp((*pfield)->field_name, "data")) + { + my_error(ER_WRONG_COLUMN_NAME, MYF(0), "Second column must be named 'data'"); + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + } +*/ + + + +#ifndef DBUG_OFF +/* + DBUG_PRINT("info", ("strparam: '%-.64s' ullparam: %llu enumparam: %u "\ + "boolparam: %u", + (options->strparam ? options->strparam : ""), + options->ullparam, options->enumparam, options->boolparam)); + + psergey-todo: check table definition! + for (Field **field= table_arg->s->field; *field; field++) + { + ha_field_option_struct *field_options= (*field)->option_struct; + DBUG_ASSERT(field_options); + DBUG_PRINT("info", ("field: %s complex: '%-.64s'", + (*field)->field_name, + (field_options->complex_param_to_parse_it_in_engine ? + field_options->complex_param_to_parse_it_in_engine : + ""))); + } +*/ +#endif + DBUG_ASSERT(!se); + if (!options->host || !options->keyspace || !options->column_family) + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + se= get_cassandra_se(); + se->set_column_family(options->column_family); + if (se->connect(options->host, options->keyspace)) + { + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); + DBUG_RETURN(HA_ERR_NO_CONNECTION); + } + + /* + TODO: what about mapping the primary key? It has a 'type', too... + see CfDef::key_validation_class ? see also CfDef::key_alias? + */ + se->first_ddl_column(); + char *col_name; + int col_name_len; + char *col_type; + int col_type_len; + while (!se->next_ddl_column(&col_name, &col_name_len, &col_type, + &col_type_len)) + { + /* Mapping for the 1st field is already known */ + for (Field **field= table_arg->s->field + 1; *field; field++) + { + if (!strcmp((*field)->field_name, col_name)) + { + //map_field_to_type(field, col_type); + } + } + } + + DBUG_RETURN(0); +} + +/* + Mapping needs to + - copy value from MySQL record to Thrift buffer + - copy value from Thrift bufer to MySQL record.. + +*/ + +const char * const validator_bigint="org.apache.cassandra.db.marshal.LongType"; +const char * const validator_int="org.apache.cassandra.db.marshal.Int32Type"; +const char * const validator_counter= "org.apache.cassandra.db.marshal.CounterColumnType"; + +const char * const validator_float= "org.apache.cassandra.db.marshal.FloatType"; +const char * const validator_double= "org.apache.cassandra.db.marshal.DoubleType"; + +void map_field_to_type(Field *field, const char *validator_name) +{ + switch(field->type()) { + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + case MYSQL_TYPE_LONGLONG: + if (!strcmp(validator_name, validator_bigint)) + { + //setup bigint validator + } + break; + case MYSQL_TYPE_FLOAT: + if (!strcmp(validator_name, validator_float)) + break; + case MYSQL_TYPE_DOUBLE: + if (!strcmp(validator_name, validator_double)) + break; + default: + DBUG_ASSERT(0); + } +} + + +void store_key_image_to_rec(Field *field, uchar *ptr, uint len); + +int ha_cassandra::index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + int rc; + DBUG_ENTER("ha_cassandra::index_read_map"); + + if (find_flag != HA_READ_KEY_EXACT) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + + // todo: decode the search key. + uint key_len= calculate_key_len(table, active_index, key, keypart_map); + store_key_image_to_rec(table->field[0], (uchar*)key, key_len); + + char buff[256]; + String tmp(buff,sizeof(buff), &my_charset_bin); + tmp.length(0); + String *str; + str= table->field[0]->val_str(&tmp); + + bool found; + if (se->get_slice((char*)str->ptr(), str->length(), get_names_and_vals(), &found)) + rc= HA_ERR_INTERNAL_ERROR; + else + { + if (found) + { + //NameAndValue *nv= get_names_and_vals(); + // TODO: walk through the (name, value) pairs and return values. + } + else + rc= HA_ERR_KEY_NOT_FOUND; + } +#ifdef NEW_CODE + + se->get_slice(); + + for each column + { + find column; + } +#endif + + DBUG_RETURN(rc); +} + + +int ha_cassandra::write_row(uchar *buf) +{ + my_bitmap_map *old_map; + char buff[512]; + NameAndValue *tuple; + NameAndValue *nv; + DBUG_ENTER("ha_cassandra::write_row"); + + /* Temporary malloc-happy code just to get INSERTs to work */ + nv= tuple= get_names_and_vals(); + old_map= dbug_tmp_use_all_columns(table, table->read_set); + + for (Field **field= table->field; *field; field++, nv++) + { + String tmp(buff,sizeof(buff), &my_charset_bin); + tmp.length(0); + String *str; + str= (*field)->val_str(&tmp); + nv->name= (char*)(*field)->field_name; + nv->value_len= str->length(); + nv->value= (char*)my_malloc(nv->value_len, MYF(0)); + memcpy(nv->value, str->ptr(), nv->value_len); + } + nv->name= NULL; + dbug_tmp_restore_column_map(table->read_set, old_map); + + //invoke! + bool res= se->insert(tuple); + + for (nv= tuple; nv->name; nv++) + { + my_free(nv->value); + } + + DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); +} + + +NameAndValue *ha_cassandra::get_names_and_vals() +{ + if (names_and_vals) + return names_and_vals; + else + { + size_t size= sizeof(NameAndValue) * (table->s->fields + 1); + names_and_vals= (NameAndValue*)my_malloc(size ,0); + memset(names_and_vals, 0, size); + return names_and_vals; + } +} + + +///////////////////////////////////////////////////////////////////////////// +// Dummy implementations start +///////////////////////////////////////////////////////////////////////////// + + +int ha_cassandra::index_next(uchar *buf) +{ + int rc; + DBUG_ENTER("ha_cassandra::index_next"); + rc= HA_ERR_WRONG_COMMAND; + DBUG_RETURN(rc); +} + + +int ha_cassandra::index_prev(uchar *buf) +{ + int rc; + DBUG_ENTER("ha_cassandra::index_prev"); + rc= HA_ERR_WRONG_COMMAND; + DBUG_RETURN(rc); +} + + +int ha_cassandra::index_first(uchar *buf) +{ + int rc; + DBUG_ENTER("ha_cassandra::index_first"); + rc= HA_ERR_WRONG_COMMAND; + DBUG_RETURN(rc); +} + +int ha_cassandra::index_last(uchar *buf) +{ + int rc; + DBUG_ENTER("ha_cassandra::index_last"); + rc= HA_ERR_WRONG_COMMAND; + DBUG_RETURN(rc); +} + +int ha_cassandra::rnd_init(bool scan) +{ + DBUG_ENTER("ha_cassandra::rnd_init"); + DBUG_RETURN(0); +} + +int ha_cassandra::rnd_end() +{ + DBUG_ENTER("ha_cassandra::rnd_end"); + DBUG_RETURN(0); +} + + +int ha_cassandra::rnd_next(uchar *buf) +{ + int rc; + DBUG_ENTER("ha_cassandra::rnd_next"); + rc= HA_ERR_END_OF_FILE; + DBUG_RETURN(rc); +} + +void ha_cassandra::position(const uchar *record) +{ + DBUG_ENTER("ha_cassandra::position"); + DBUG_VOID_RETURN; +} + +int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) +{ + int rc; + DBUG_ENTER("ha_cassandra::rnd_pos"); + rc= HA_ERR_WRONG_COMMAND; + DBUG_RETURN(rc); +} + +ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, + key_range *max_key) +{ + DBUG_ENTER("ha_cassandra::records_in_range"); + DBUG_RETURN(10); // low number to force index usage +} + + +int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) +{ + + DBUG_ENTER("ha_cassandra::update_row"); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); +} + + +int ha_cassandra::info(uint flag) +{ + DBUG_ENTER("ha_cassandra::info"); + DBUG_RETURN(0); +} + + +int ha_cassandra::extra(enum ha_extra_function operation) +{ + DBUG_ENTER("ha_cassandra::extra"); + DBUG_RETURN(0); +} + + +THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) + lock.type=lock_type; + *to++= &lock; + return to; +} + + +int ha_cassandra::external_lock(THD *thd, int lock_type) +{ + DBUG_ENTER("ha_cassandra::external_lock"); + DBUG_RETURN(0); +} + +int ha_cassandra::delete_table(const char *name) +{ + DBUG_ENTER("ha_cassandra::delete_table"); + /* This is not implemented but we want someone to be able that it works. */ + DBUG_RETURN(0); +} + + +int ha_cassandra::delete_row(const uchar *buf) +{ + DBUG_ENTER("ha_cassandra::delete_row"); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); +} + + +int ha_cassandra::delete_all_rows() +{ + DBUG_ENTER("ha_cassandra::delete_all_rows"); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); +} + + +/** + check_if_incompatible_data() called if ALTER TABLE can't detect otherwise + if new and old definition are compatible + + @details If there are no other explicit signs like changed number of + fields this function will be called by compare_tables() + (sql/sql_tables.cc) to decide should we rewrite whole table or only .frm + file. + +*/ + +bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info, + uint table_changes) +{ + //ha_table_option_struct *param_old, *param_new; + DBUG_ENTER("ha_cassandra::check_if_incompatible_data"); + + DBUG_RETURN(COMPATIBLE_DATA_YES); +} + + +///////////////////////////////////////////////////////////////////////////// +// Dummy implementations end +///////////////////////////////////////////////////////////////////////////// + + +static struct st_mysql_sys_var* cassandra_system_variables[]= { +// MYSQL_SYSVAR(enum_var), +// MYSQL_SYSVAR(ulong_var), + NULL +}; + + +struct st_mysql_storage_engine cassandra_storage_engine= +{ MYSQL_HANDLERTON_INTERFACE_VERSION }; + +static struct st_mysql_show_var func_status[]= +{ +// {"example_func_example", (char *)show_func_example, SHOW_FUNC}, + {0,0,SHOW_UNDEF} +}; + +maria_declare_plugin(cassandra) +{ + MYSQL_STORAGE_ENGINE_PLUGIN, + &cassandra_storage_engine, + "CASSANDRA", + "Monty Program Ab", + "Cassandra storage engine", + PLUGIN_LICENSE_GPL, + cassandra_init_func, /* Plugin Init */ + cassandra_done_func, /* Plugin Deinit */ + 0x0001, /* version number (0.1) */ + func_status, /* status variables */ + cassandra_system_variables, /* system variables */ + "0.1", /* string version */ + MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* maturity */ +} +maria_declare_plugin_end; diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h new file mode 100644 index 00000000000..fc10dfb247c --- /dev/null +++ b/storage/cassandra/ha_cassandra.h @@ -0,0 +1,218 @@ +/* + MP AB copyrights +*/ +#ifdef USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif + + +#include "my_global.h" /* ulonglong */ +#include "thr_lock.h" /* THR_LOCK, THR_LOCK_DATA */ +#include "handler.h" /* handler */ +#include "my_base.h" /* ha_rows */ + +#include "cassandra_se.h" + +/** @brief + CASSANDRA_SHARE is a structure that will be shared among all open handlers. + This example implements the minimum of what you will probably need. +*/ +typedef struct st_cassandra_share { + char *table_name; + uint table_name_length,use_count; + mysql_mutex_t mutex; + THR_LOCK lock; +} CASSANDRA_SHARE; + + +/** @brief + Class definition for the storage engine +*/ +class ha_cassandra: public handler +{ + THR_LOCK_DATA lock; ///< MySQL lock + CASSANDRA_SHARE *share; ///< Shared lock info + + Cassandra_se_interface *se; + + /* pre-allocated array of #fields elements */ + NameAndValue *names_and_vals; + NameAndValue *get_names_and_vals(); +public: + ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); + ~ha_cassandra() + { + delete se; + } + + /** @brief + The name that will be used for display purposes. + */ + const char *table_type() const { return "CASSANDRA"; } + + /** @brief + The name of the index type that will be used for display. + Don't implement this method unless you really have indexes. + */ + const char *index_type(uint inx) { return "HASH"; } + + /** @brief + The file extensions. + */ + const char **bas_ext() const; + + /** @brief + This is a list of flags that indicate what functionality the storage engine + implements. The current table flags are documented in handler.h + */ + ulonglong table_flags() const + { + /* + We are saying that this engine is just statement capable to have + an engine that can only handle statement-based logging. This is + used in testing. + */ + return HA_BINLOG_STMT_CAPABLE; + } + + /** @brief + This is a bitmap of flags that indicates how the storage engine + implements indexes. The current index flags are documented in + handler.h. If you do not implement indexes, just return zero here. + + @details + part is the key part to check. First key part is 0. + If all_parts is set, MySQL wants to know the flags for the combined + index, up to and including 'part'. + */ + ulong index_flags(uint inx, uint part, bool all_parts) const + { + return 0; + } + + /** @brief + unireg.cc will call max_supported_record_length(), max_supported_keys(), + max_supported_key_parts(), uint max_supported_key_length() + to make sure that the storage engine can handle the data it is about to + send. Return *real* limits of your storage engine here; MySQL will do + min(your_limits, MySQL_limits) automatically. + */ + uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } + + /* Support only one Primary Key, for now */ + uint max_supported_keys() const { return 1; } + uint max_supported_key_parts() const { return 1; } + + /** @brief + unireg.cc will call this to make sure that the storage engine can handle + the data it is about to send. Return *real* limits of your storage engine + here; MySQL will do min(your_limits, MySQL_limits) automatically. + + @details + There is no need to implement ..._key_... methods if your engine doesn't + support indexes. + */ + uint max_supported_key_length() const { return 16*1024; /* just to return something*/ } + + /* At the moment, we're ok with default handler::index_init() implementation. */ + int index_read_map(uchar * buf, const uchar * key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); + + /** @brief + Called in test_quick_select to determine if indexes should be used. + */ + virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; } + + /** @brief + This method will never be called if you do not implement indexes. + */ + virtual double read_time(uint, uint, ha_rows rows) + { return (double) rows / 20.0+1; } + + /* + Everything below are methods that we implement in ha_example.cc. + + Most of these methods are not obligatory, skip them and + MySQL will treat them as not implemented + */ + /** @brief + We implement this in ha_example.cc; it's a required method. + */ + int open(const char *name, int mode, uint test_if_locked); // required + + /** @brief + We implement this in ha_example.cc; it's a required method. + */ + int close(void); // required + + /** @brief + We implement this in ha_example.cc. It's not an obligatory method; + skip it and and MySQL will treat it as not implemented. + */ + int write_row(uchar *buf); + + /** @brief + We implement this in ha_example.cc. It's not an obligatory method; + skip it and and MySQL will treat it as not implemented. + */ + int update_row(const uchar *old_data, uchar *new_data); + + /** @brief + We implement this in ha_example.cc. It's not an obligatory method; + skip it and and MySQL will treat it as not implemented. + */ + int delete_row(const uchar *buf); + + /** @brief + We implement this in ha_example.cc. It's not an obligatory method; + skip it and and MySQL will treat it as not implemented. + */ + int index_next(uchar *buf); + + /** @brief + We implement this in ha_example.cc. It's not an obligatory method; + skip it and and MySQL will treat it as not implemented. + */ + int index_prev(uchar *buf); + + /** @brief + We implement this in ha_example.cc. It's not an obligatory method; + skip it and and MySQL will treat it as not implemented. + */ + int index_first(uchar *buf); + + /** @brief + We implement this in ha_example.cc. It's not an obligatory method; + skip it and and MySQL will treat it as not implemented. + */ + int index_last(uchar *buf); + + /** @brief + Unlike index_init(), rnd_init() can be called two consecutive times + without rnd_end() in between (it only makes sense if scan=1). In this + case, the second call should prepare for the new table scan (e.g if + rnd_init() allocates the cursor, the second call should position the + cursor to the start of the table; no need to deallocate and allocate + it again. This is a required method. + */ + int rnd_init(bool scan); //required + int rnd_end(); + int rnd_next(uchar *buf); ///< required + int rnd_pos(uchar *buf, uchar *pos); ///< required + void position(const uchar *record); ///< required + int info(uint); ///< required + int extra(enum ha_extra_function operation); + int external_lock(THD *thd, int lock_type); ///< required + int delete_all_rows(void); + ha_rows records_in_range(uint inx, key_range *min_key, + key_range *max_key); + int delete_table(const char *from); + int create(const char *name, TABLE *form, + HA_CREATE_INFO *create_info); ///< required + bool check_if_incompatible_data(HA_CREATE_INFO *info, + uint table_changes); + + THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); ///< required +}; From 0d840d4d2370cde9e581ac9bc522d103d95badab Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sat, 18 Aug 2012 16:28:35 +0400 Subject: [PATCH 172/439] MDEV-431: Cassandra storage engine - Introduce type converters (so far rather trivial) - switch INSERT to using batch_mutate() --- mysql-test/t/cassandra.test | 2 +- storage/cassandra/cassandra_se.cc | 189 ++++++++++------- storage/cassandra/cassandra_se.h | 8 +- storage/cassandra/ha_cassandra.cc | 337 +++++++++++++++++++++++------- storage/cassandra/ha_cassandra.h | 7 + 5 files changed, 392 insertions(+), 151 deletions(-) diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 34a6909af38..6acb5f769ab 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -49,7 +49,7 @@ create columnfamily cf1 ( pk varchar primary key, data1 varchar); ############################################################################ # Now, create a table for real and insert data -create table t1 (rowkey char(36) primary key, column1 char(60)) engine=cassandra +create table t1 (rowkey char(36) primary key, data1 varchar(60)) engine=cassandra thrift_host='localhost' keyspace='mariadbtest' column_family='cf1'; insert into t1 values ('key0', 'data1'); diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 1bc799d09c6..e3d731815f9 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -43,53 +43,56 @@ class Cassandra_se_impl: public Cassandra_se_interface std::string column_family; std::string keyspace; - /* DDL checks */ + /* DDL data */ KsDef ks_def; /* KeySpace we're using (TODO: put this in table->share) */ CfDef cf_def; /* Column family we're using (TODO: put in table->share)*/ std::vector::iterator column_ddl_it; /* The list that was returned by the last key lookup */ - std::vector col_supercol_vec; + std::vector column_data_vec; + std::vector::iterator column_data_it; + + /* Insert preparation */ + typedef std::map > ColumnFamilyToMutation; + typedef std::map KeyToCfMutationMap; + + KeyToCfMutationMap batch_mutation; /* Prepare operation here */ + std::string key_to_insert; + int64_t insert_timestamp; + std::vector* insert_list; public: - Cassandra_se_impl() : cass(NULL) {} virtual ~Cassandra_se_impl(){ delete cass; } + /* Connection and DDL checks */ bool connect(const char *host, const char *keyspace); + void set_column_family(const char *cfname) { column_family.assign(cfname); } - virtual void set_column_family(const char *cfname) - { - column_family.assign(cfname); - } - - virtual bool insert(NameAndValue *fields); - virtual bool get_slice(char *key, size_t key_len, NameAndValue *row, bool *found); - - - /* Functions to enumerate ColumnFamily's DDL data */ bool setup_ddl_checks(); void first_ddl_column(); bool next_ddl_column(char **name, int *name_len, char **value, int *value_len); + + /* Writes */ + void start_prepare_insert(const char *key, int key_len); + void add_insert_column(const char *name, const char *value, int value_len); + bool do_insert(); + + /* Reads */ + bool get_slice(char *key, size_t key_len, bool *found); + bool get_next_read_column(char **name, char **value, int *value_len); + }; +///////////////////////////////////////////////////////////////////////////// +// Connection and setup +///////////////////////////////////////////////////////////////////////////// Cassandra_se_interface *get_cassandra_se() { return new Cassandra_se_impl; } -#define CASS_TRY(x) try { \ - x; \ - }catch(TTransportException te){ \ - print_error("%s [%d]", te.what(), te.getType()); \ - }catch(InvalidRequestException ire){ \ - print_error("%s [%s]", ire.what(), ire.why.c_str()); \ - }catch(NotFoundException nfe){ \ - print_error("%s", nfe.what()); \ - } catch(...) { \ - print_error("Unknown Exception"); \ - } bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg) { @@ -121,10 +124,9 @@ bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg) print_error("Unknown Exception"); } - // For now: cur_consistency_level= ConsistencyLevel::ONE; - if (setup_ddl_checks()) + if (!res && setup_ddl_checks()) res= true; return res; } @@ -176,13 +178,20 @@ bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len, return false; } +///////////////////////////////////////////////////////////////////////////// +// Data writes +///////////////////////////////////////////////////////////////////////////// -bool Cassandra_se_impl::insert(NameAndValue *fields) +void Cassandra_se_impl::start_prepare_insert(const char *key, int key_len) { - ColumnParent cparent; - cparent.column_family= column_family; - - Column c; + key_to_insert.assign(key, key_len); + batch_mutation.clear(); + batch_mutation[key_to_insert]= ColumnFamilyToMutation(); + ColumnFamilyToMutation& cf_mut= batch_mutation[key_to_insert]; + + cf_mut[column_family]= std::vector(); + insert_list= &cf_mut[column_family]; + struct timeval td; gettimeofday(&td, NULL); int64_t ms = td.tv_sec; @@ -190,37 +199,57 @@ bool Cassandra_se_impl::insert(NameAndValue *fields) int64_t usec = td.tv_usec; usec = usec / 1000; ms += usec; - c.timestamp = ms; - c.__isset.timestamp = true; + insert_timestamp= ms; +} - std::string key; - key.assign(fields->value, fields->value_len); - fields++; - bool res= false; +void Cassandra_se_impl::add_insert_column(const char *name, const char *value, + int value_len) +{ + Mutation mut; + mut.__isset.column_or_supercolumn= true; + mut.column_or_supercolumn.__isset.column= true; + + Column& col=mut.column_or_supercolumn.column; + col.name.assign(name); + col.value.assign(value, value_len); + col.timestamp= insert_timestamp; + col.__isset.value= true; + col.__isset.timestamp= true; + insert_list->push_back(mut); +} + + +bool Cassandra_se_impl::do_insert() +{ + bool res= true; try { - /* TODO: switch to batch_mutate(). Or, even to CQL? */ + + cass->batch_mutate(batch_mutation, cur_consistency_level); + res= false; - // TODO: what should INSERT table (co1, col2) VALUES ('foo', 'bar') mean? - // in SQL, it sets all columns.. what should it mean here? can we have - // it to work only for specified columns? (if yes, what do for - // VALUES()?) - c.__isset.value= true; - for(;fields->name; fields++) - { - c.name.assign(fields->name); - c.value.assign(fields->value, fields->value_len); - cass->insert(key, cparent, c, ConsistencyLevel::ONE); - } - - } catch (...) { - res= true; + } catch (InvalidRequestException ire) { + print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (UnavailableException ue) { + print_error("UnavailableException: %s", ue.what()); + } catch (TimedOutException te) { + print_error("TimedOutException: %s", te.what()); } + return res; } -bool Cassandra_se_impl::get_slice(char *key, size_t key_len, NameAndValue *row, bool *found) +///////////////////////////////////////////////////////////////////////////// +// Reading data +///////////////////////////////////////////////////////////////////////////// + +/* + Make one key lookup. If the record is found, the result is stored locally and + the caller should iterate over it. +*/ + +bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) { ColumnParent cparent; cparent.column_family= column_family; @@ -235,37 +264,57 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, NameAndValue *row, slice_pred.__set_slice_range(sr); try { - std::vector &res= col_supercol_vec; - cass->get_slice(res, rowkey_str, cparent, slice_pred, ConsistencyLevel::ONE); - *found= true; + cass->get_slice(column_data_vec, rowkey_str, cparent, slice_pred, + ConsistencyLevel::ONE); - std::vector::iterator it; - if (res.size() == 0) + if (column_data_vec.size() == 0) { - /* + /* No columns found. Cassandra doesn't allow records without any column => this means the seach key doesn't exist */ *found= false; return false; } - for (it= res.begin(); it < res.end(); it++) - { - ColumnOrSuperColumn cs= *it; - if (!cs.__isset.column) - return true; - row->name= (char*)cs.column.name.c_str(); - row->value= (char*)cs.column.value.c_str(); - row->value_len= cs.column.value.length(); - row++; - } - row->name= NULL; + *found= true; + } catch (InvalidRequestException ire) { + print_error("%s [%s]", ire.what(), ire.why.c_str()); return true; } catch (UnavailableException ue) { + print_error("UnavailableException: %s", ue.what()); return true; } catch (TimedOutException te) { + print_error("TimedOutException: %s", te.what()); return true; } + + column_data_it= column_data_vec.begin(); return false; } + + +bool Cassandra_se_impl::get_next_read_column(char **name, char **value, + int *value_len) +{ + while (1) + { + if (column_data_it == column_data_vec.end()) + return true; + + if (((*column_data_it).__isset.column)) + break; /* Ok it's a real column. Should be always the case. */ + + column_data_it++; + } + + ColumnOrSuperColumn& cs= *column_data_it; + *name= (char*)cs.column.name.c_str(); + *value= (char*)cs.column.value.c_str(); + *value_len= cs.column.value.length(); + + column_data_it++; + return false; +} + + diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 1ab14c39602..dea4f0f51ea 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -43,10 +43,14 @@ public: int *value_len)=0; /* Writes */ - virtual bool insert(NameAndValue *fields)=0; + virtual void start_prepare_insert(const char *key, int key_len)=0; + virtual void add_insert_column(const char *name, const char *value, + int value_len)=0; + virtual bool do_insert()=0; /* Reads */ - virtual bool get_slice(char *key, size_t key_len, NameAndValue *row, bool *found)=0 ; + virtual bool get_slice(char *key, size_t key_len, bool *found)=0 ; + virtual bool get_next_read_column(char **name, char **value, int *value_len)=0; /* Passing error messages up to ha_cassandra */ char err_buffer[512]; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 4dec67202bf..757c0fd5e10 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -212,7 +212,8 @@ static handler* cassandra_create_handler(handlerton *hton, ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), - se(NULL), names_and_vals(NULL) + se(NULL), names_and_vals(NULL), + field_converters(NULL) {} @@ -249,6 +250,12 @@ int ha_cassandra::open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(HA_ERR_NO_CONNECTION); } + if (setup_field_converters(table->field, table->s->fields)) + { + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "setup_field_converters"); + DBUG_RETURN(HA_ERR_NO_CONNECTION); + } + DBUG_RETURN(0); } @@ -317,16 +324,6 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, DBUG_RETURN(HA_WRONG_CREATE_OPTION); } -/* - pfield++; - if (strcmp((*pfield)->field_name, "data")) - { - my_error(ER_WRONG_COLUMN_NAME, MYF(0), "Second column must be named 'data'"); - DBUG_RETURN(HA_WRONG_CREATE_OPTION); - } -*/ - - #ifndef DBUG_OFF /* @@ -358,29 +355,12 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); DBUG_RETURN(HA_ERR_NO_CONNECTION); } - - /* - TODO: what about mapping the primary key? It has a 'type', too... - see CfDef::key_validation_class ? see also CfDef::key_alias? - */ - se->first_ddl_column(); - char *col_name; - int col_name_len; - char *col_type; - int col_type_len; - while (!se->next_ddl_column(&col_name, &col_name_len, &col_type, - &col_type_len)) + + if (setup_field_converters(table_arg->s->field, table_arg->s->fields)) { - /* Mapping for the 1st field is already known */ - for (Field **field= table_arg->s->field + 1; *field; field++) - { - if (!strcmp((*field)->field_name, col_name)) - { - //map_field_to_type(field, col_type); - } - } + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "setup_field_converters"); + DBUG_RETURN(HA_ERR_NO_CONNECTION); } - DBUG_RETURN(0); } @@ -391,37 +371,224 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, */ -const char * const validator_bigint="org.apache.cassandra.db.marshal.LongType"; -const char * const validator_int="org.apache.cassandra.db.marshal.Int32Type"; +/* Converter base */ +class ColumnDataConverter +{ +public: + Field *field; + + /* This will save Cassandra's data in the Field */ + virtual void cassandra_to_mariadb(const char *cass_data, + int cass_data_len)=0; + + /* + This will get data from the Field pointer, store Cassandra's form + in internal buffer, and return pointer/size. + */ + virtual void mariadb_to_cassandra(char **cass_data, int *cass_data_len)=0; + virtual ~ColumnDataConverter() {}; +}; + + +class DoubleDataConverter : public ColumnDataConverter +{ + double buf; +public: + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + DBUG_ASSERT(cass_data_len == sizeof(double)); + double *pdata= (double*) cass_data; + field->store(*pdata); + } + + void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + buf= field->val_real(); + *cass_data= (char*)&buf; + *cass_data_len=sizeof(double); + } + ~DoubleDataConverter(){} +}; + + +class FloatDataConverter : public ColumnDataConverter +{ + float buf; +public: + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + DBUG_ASSERT(cass_data_len == sizeof(float)); + float *pdata= (float*) cass_data; + field->store(*pdata); + } + + void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + buf= field->val_real(); + *cass_data= (char*)&buf; + *cass_data_len=sizeof(float); + } + ~FloatDataConverter(){} +}; + + +class BigintDataConverter : public ColumnDataConverter +{ + longlong buf; +public: + void flip(const char *from, char* to) + { + to[0]= from[7]; + to[1]= from[6]; + to[2]= from[5]; + to[3]= from[4]; + to[4]= from[3]; + to[5]= from[2]; + to[6]= from[1]; + to[7]= from[0]; + } + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + longlong tmp; + DBUG_ASSERT(cass_data_len == sizeof(longlong)); + flip(cass_data, (char*)&tmp); + field->store(tmp); + } + + void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + longlong tmp= field->val_int(); + flip((const char*)&tmp, (char*)&buf); + *cass_data= (char*)&buf; + *cass_data_len=sizeof(longlong); + } + ~BigintDataConverter(){} +}; + + +class StringCopyConverter : public ColumnDataConverter +{ + String buf; +public: + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + field->store(cass_data, cass_data_len,field->charset()); + } + + void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + String *pstr= field->val_str(&buf); + *cass_data= (char*)pstr->c_ptr(); + *cass_data_len= pstr->length(); + } + ~StringCopyConverter(){} +}; + + +const char * const validator_bigint= "org.apache.cassandra.db.marshal.LongType"; +const char * const validator_int= "org.apache.cassandra.db.marshal.Int32Type"; const char * const validator_counter= "org.apache.cassandra.db.marshal.CounterColumnType"; -const char * const validator_float= "org.apache.cassandra.db.marshal.FloatType"; -const char * const validator_double= "org.apache.cassandra.db.marshal.DoubleType"; +const char * const validator_float= "org.apache.cassandra.db.marshal.FloatType"; +const char * const validator_double= "org.apache.cassandra.db.marshal.DoubleType"; -void map_field_to_type(Field *field, const char *validator_name) +const char * const validator_blob= "org.apache.cassandra.db.marshal.BytesType"; +const char * const validator_ascii= "org.apache.cassandra.db.marshal.AsciiType"; +const char * const validator_text= "org.apache.cassandra.db.marshal.UTF8Type"; + + +ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) { + ColumnDataConverter *res= NULL; + switch(field->type()) { case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONGLONG: if (!strcmp(validator_name, validator_bigint)) - { - //setup bigint validator - } + res= new BigintDataConverter; break; case MYSQL_TYPE_FLOAT: if (!strcmp(validator_name, validator_float)) + res= new FloatDataConverter; break; case MYSQL_TYPE_DOUBLE: if (!strcmp(validator_name, validator_double)) + res= new DoubleDataConverter; break; - default: - DBUG_ASSERT(0); + + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_VARCHAR: + if (!strcmp(validator_name, validator_blob) || + !strcmp(validator_name, validator_ascii) || + !strcmp(validator_name, validator_text)) + { + res= new StringCopyConverter; + } + break; + default:; } + return res; } +bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) +{ + char *col_name; + int col_name_len; + char *col_type; + int col_type_len; + + DBUG_ASSERT(!field_converters); + size_t memsize= sizeof(ColumnDataConverter*) * n_fields; + if (!(field_converters= (ColumnDataConverter**)my_malloc(memsize, MYF(0)))) + return true; + bzero(field_converters, memsize); + n_field_converters= n_fields; + + /* + TODO: what about mapping the primary key? It has a 'type', too... + see CfDef::key_validation_class ? see also CfDef::key_alias? + */ + + se->first_ddl_column(); + uint n_mapped= 0; + while (!se->next_ddl_column(&col_name, &col_name_len, &col_type, + &col_type_len)) + { + /* Mapping for the 1st field is already known */ + for (Field **field= field_arg + 1; *field; field++) + { + if (!strcmp((*field)->field_name, col_name)) + { + n_mapped++; + ColumnDataConverter **conv= field_converters + (*field)->field_index; + if (!(*conv= map_field_to_validator(*field, col_type))) + return true; + (*conv)->field= *field; + } + } + } + + if (n_mapped != n_fields - 1) + return true; + + return false; +} + + +void ha_cassandra::free_field_converters() +{ + if (field_converters) + { + for (uint i=0; i < n_field_converters; i++) + delete field_converters[i]; + my_free(field_converters); + field_converters= NULL; + } +} + void store_key_image_to_rec(Field *field, uchar *ptr, uint len); int ha_cassandra::index_read_map(uchar *buf, const uchar *key, @@ -445,27 +612,42 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, str= table->field[0]->val_str(&tmp); bool found; - if (se->get_slice((char*)str->ptr(), str->length(), get_names_and_vals(), &found)) + if (se->get_slice((char*)str->ptr(), str->length(), &found)) rc= HA_ERR_INTERNAL_ERROR; + + /* TODO: what if we're not reading all columns?? */ + if (!found) + { + rc= HA_ERR_KEY_NOT_FOUND; + } else { - if (found) - { - //NameAndValue *nv= get_names_and_vals(); - // TODO: walk through the (name, value) pairs and return values. - } - else - rc= HA_ERR_KEY_NOT_FOUND; - } -#ifdef NEW_CODE - - se->get_slice(); + char *cass_name; + char *cass_value; + int cass_value_len; + Field **field; - for each column - { - find column; + /* Start with all fields being NULL */ + for (field= table->field + 1; *field; field++) + (*field)->set_null(); + + while (!se->get_next_read_column(&cass_name, &cass_value, &cass_value_len)) + { + // map to our column. todo: use hash or something.. + int idx=1; + for (field= table->field + 1; *field; field++) + { + idx++; + if (!strcmp((*field)->field_name, cass_name)) + { + int fieldnr= (*field)->field_index; + (*field)->set_notnull(); + field_converters[fieldnr]->cassandra_to_mariadb(cass_value, cass_value_len); + break; + } + } + } } -#endif DBUG_RETURN(rc); } @@ -475,35 +657,34 @@ int ha_cassandra::write_row(uchar *buf) { my_bitmap_map *old_map; char buff[512]; - NameAndValue *tuple; - NameAndValue *nv; DBUG_ENTER("ha_cassandra::write_row"); - /* Temporary malloc-happy code just to get INSERTs to work */ - nv= tuple= get_names_and_vals(); old_map= dbug_tmp_use_all_columns(table, table->read_set); - - for (Field **field= table->field; *field; field++, nv++) + + /* Convert the key (todo: unify with the rest of the processing) */ { + Field *pk_col= table->field[0]; String tmp(buff,sizeof(buff), &my_charset_bin); - tmp.length(0); String *str; - str= (*field)->val_str(&tmp); - nv->name= (char*)(*field)->field_name; - nv->value_len= str->length(); - nv->value= (char*)my_malloc(nv->value_len, MYF(0)); - memcpy(nv->value, str->ptr(), nv->value_len); + tmp.length(0); + str= pk_col->val_str(&tmp); + + se->start_prepare_insert(str->ptr(), str->length()); } - nv->name= NULL; + + /* Convert other fields */ + for (uint i= 1; i < table->s->fields; i++) + { + char *cass_data; + int cass_data_len; + field_converters[i]->mariadb_to_cassandra(&cass_data, &cass_data_len); + se->add_insert_column(field_converters[i]->field->field_name, + cass_data, cass_data_len); + } + dbug_tmp_restore_column_map(table->read_set, old_map); - //invoke! - bool res= se->insert(tuple); - - for (nv= tuple; nv->name; nv++) - { - my_free(nv->value); - } + bool res= se->do_insert(); DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); } diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index fc10dfb247c..595b840d360 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -24,6 +24,7 @@ typedef struct st_cassandra_share { THR_LOCK lock; } CASSANDRA_SHARE; +class ColumnDataConverter; /** @brief Class definition for the storage engine @@ -38,6 +39,12 @@ class ha_cassandra: public handler /* pre-allocated array of #fields elements */ NameAndValue *names_and_vals; NameAndValue *get_names_and_vals(); + + + ColumnDataConverter **field_converters; + uint n_field_converters; + bool setup_field_converters(Field **field, uint n_fields); + void free_field_converters(); public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() From ab281741220a1bcb7ec9107bdb4f4b8ea4760e32 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sat, 18 Aug 2012 21:21:50 +0400 Subject: [PATCH 173/439] MDEV-431: Cassandra storage engine - Got range reads to work (except for unpacking of the rowkey value) --- mysql-test/r/cassandra.result | 11 ++- mysql-test/t/cassandra.test | 15 ++-- storage/cassandra/cassandra_se.cc | 84 +++++++++++++++++- storage/cassandra/cassandra_se.h | 25 ++---- storage/cassandra/ha_cassandra.cc | 137 +++++++++++++++++------------- storage/cassandra/ha_cassandra.h | 8 +- 6 files changed, 189 insertions(+), 91 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 6dbf08651d8..651adf40c7b 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -14,7 +14,12 @@ ERROR HY000: Unable to connect to foreign data source: Default TException. [Keys create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace'; ERROR HY000: Can't create table 'test.t1' (errno: 140) -create table t1 (rowkey char(36) primary key, column1 char(60)) engine=cassandra -thrift_host='localhost' keyspace='mariadbtest' column_family='cf1'; -insert into t1 values ('key0', 'data1'); +create table t1 (rowkey char(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra +thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +select * from t1; +rowkey data1 data2 + data1-value 123456 + data1-value2 34543 drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 6acb5f769ab..e316e23d626 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -36,12 +36,12 @@ create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra ./cqlsh --cql3 -CREATE KEYSPACE mariadbtest +CREATE KEYSPACE mariadbtest2 WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' AND strategy_options:replication_factor='1'; -USE mariadbtest; -create columnfamily cf1 ( pk varchar primary key, data1 varchar); +USE mariadbtest2; +create columnfamily cf1 ( pk varchar primary key, data1 varchar, data2 bigint); --enable_parsing ############################################################################ @@ -49,11 +49,12 @@ create columnfamily cf1 ( pk varchar primary key, data1 varchar); ############################################################################ # Now, create a table for real and insert data -create table t1 (rowkey char(36) primary key, data1 varchar(60)) engine=cassandra - thrift_host='localhost' keyspace='mariadbtest' column_family='cf1'; - -insert into t1 values ('key0', 'data1'); +create table t1 (rowkey char(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra + thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +select * from t1; drop table t1; ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index e3d731815f9..f8891a43351 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -60,7 +60,12 @@ class Cassandra_se_impl: public Cassandra_se_interface std::string key_to_insert; int64_t insert_timestamp; std::vector* insert_list; + + /* Resultset we're reading */ + std::vector key_slice_vec; + std::vector::iterator key_slice_it; + SlicePredicate slice_pred; public: Cassandra_se_impl() : cass(NULL) {} virtual ~Cassandra_se_impl(){ delete cass; } @@ -78,10 +83,18 @@ public: void add_insert_column(const char *name, const char *value, int value_len); bool do_insert(); - /* Reads */ + /* Reads, point lookups */ bool get_slice(char *key, size_t key_len, bool *found); bool get_next_read_column(char **name, char **value, int *value_len); + /* Reads, multi-row scans */ + bool get_range_slices(); + void finish_reading_range_slices(); + bool get_next_range_slice_row(); + + /* Setup that's necessary before a multi-row read. (todo: use it before point lookups, too) */ + void clear_read_columns(); + void add_read_column(const char *name); }; @@ -265,7 +278,7 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) try { cass->get_slice(column_data_vec, rowkey_str, cparent, slice_pred, - ConsistencyLevel::ONE); + cur_consistency_level); if (column_data_vec.size() == 0) { @@ -318,3 +331,70 @@ bool Cassandra_se_impl::get_next_read_column(char **name, char **value, } +bool Cassandra_se_impl::get_range_slices() //todo: start_range/end_range as parameters +{ + bool res= true; + + ColumnParent cparent; + cparent.column_family= column_family; + + /* SlicePredicate can be used to limit columns we will retrieve */ + // Try passing nothing... + + KeyRange key_range; // Try passing nothing, too. + key_range.__isset.start_key=true; + key_range.__isset.end_key=true; + key_range.start_key.assign("", 0); + key_range.end_key.assign("", 0); + + try { + + cass->get_range_slices(key_slice_vec, + cparent, slice_pred, key_range, + cur_consistency_level); + res= false; + + } catch (InvalidRequestException ire) { + print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (UnavailableException ue) { + print_error("UnavailableException: %s", ue.what()); + } catch (TimedOutException te) { + print_error("TimedOutException: %s", te.what()); + } + + key_slice_it= key_slice_vec.begin(); + return res; +} + + +bool Cassandra_se_impl::get_next_range_slice_row() +{ + if (key_slice_it == key_slice_vec.end()) + return true; + + column_data_vec= key_slice_it->columns; + column_data_it= column_data_vec.begin(); + key_slice_it++; + return false; +} + + +void Cassandra_se_impl::finish_reading_range_slices() +{ + key_slice_vec.clear(); +} + + +void Cassandra_se_impl::clear_read_columns() +{ + slice_pred.column_names.clear(); +} + + +void Cassandra_se_impl::add_read_column(const char *name_arg) +{ + std::string name(name_arg); + slice_pred.__isset.column_names= true; + slice_pred.column_names.push_back(name); +} + diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index dea4f0f51ea..d35a6e6a003 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -7,22 +7,6 @@ */ -/* - Storage for (name,value) pairs. name==NULL means 'non-object'. - - This should be used for - - shipping data from sql to cassandra for INSERTs - - shipping data from cassandra to SQL for record reads. - -*/ -class NameAndValue -{ -public: - char *name; - char *value; - size_t value_len; -}; - /* Interface to one cassandra column family, i.e. one 'table' */ @@ -52,6 +36,15 @@ public: virtual bool get_slice(char *key, size_t key_len, bool *found)=0 ; virtual bool get_next_read_column(char **name, char **value, int *value_len)=0; + /* Reads, multi-row scans */ + virtual bool get_range_slices()=0; + virtual void finish_reading_range_slices()=0; + virtual bool get_next_range_slice_row()=0; + + /* read_set setup */ + virtual void clear_read_columns()=0; + virtual void add_read_column(const char *name)=0; + /* Passing error messages up to ha_cassandra */ char err_buffer[512]; const char *error_str() { return err_buffer; } diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 757c0fd5e10..02eddcaf5cd 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -212,8 +212,7 @@ static handler* cassandra_create_handler(handlerton *hton, ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), - se(NULL), names_and_vals(NULL), - field_converters(NULL) + se(NULL), field_converters(NULL) {} @@ -265,11 +264,7 @@ int ha_cassandra::close(void) DBUG_ENTER("ha_cassandra::close"); delete se; se= NULL; - if (names_and_vals) - { - my_free(names_and_vals); - names_and_vals= NULL; - } + free_field_converters(); DBUG_RETURN(free_share(share)); } @@ -589,6 +584,7 @@ void ha_cassandra::free_field_converters() } } + void store_key_image_to_rec(Field *field, uchar *ptr, uint len); int ha_cassandra::index_read_map(uchar *buf, const uchar *key, @@ -622,34 +618,49 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, } else { - char *cass_name; - char *cass_value; - int cass_value_len; - Field **field; + read_cassandra_columns(); + } - /* Start with all fields being NULL */ + DBUG_RETURN(rc); +} + + +void ha_cassandra::read_cassandra_columns() +{ + char *cass_name; + char *cass_value; + int cass_value_len; + Field **field; + + /* + cassandra_to_mariadb() calls will use field->store(...) methods, which + require that the column is in the table->write_set + */ + my_bitmap_map *old_map; + old_map= dbug_tmp_use_all_columns(table, table->write_set); + + /* Start with all fields being NULL */ + for (field= table->field + 1; *field; field++) + (*field)->set_null(); + + while (!se->get_next_read_column(&cass_name, &cass_value, &cass_value_len)) + { + // map to our column. todo: use hash or something.. + int idx=1; for (field= table->field + 1; *field; field++) - (*field)->set_null(); - - while (!se->get_next_read_column(&cass_name, &cass_value, &cass_value_len)) { - // map to our column. todo: use hash or something.. - int idx=1; - for (field= table->field + 1; *field; field++) + idx++; + if (!strcmp((*field)->field_name, cass_name)) { - idx++; - if (!strcmp((*field)->field_name, cass_name)) - { - int fieldnr= (*field)->field_index; - (*field)->set_notnull(); - field_converters[fieldnr]->cassandra_to_mariadb(cass_value, cass_value_len); - break; - } + int fieldnr= (*field)->field_index; + (*field)->set_notnull(); + field_converters[fieldnr]->cassandra_to_mariadb(cass_value, cass_value_len); + break; } } } - DBUG_RETURN(rc); + dbug_tmp_restore_column_map(table->write_set, old_map); } @@ -690,20 +701,51 @@ int ha_cassandra::write_row(uchar *buf) } -NameAndValue *ha_cassandra::get_names_and_vals() +int ha_cassandra::rnd_init(bool scan) { - if (names_and_vals) - return names_and_vals; - else - { - size_t size= sizeof(NameAndValue) * (table->s->fields + 1); - names_and_vals= (NameAndValue*)my_malloc(size ,0); - memset(names_and_vals, 0, size); - return names_and_vals; - } + bool bres; + DBUG_ENTER("ha_cassandra::rnd_init"); + if (!scan) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + + se->clear_read_columns(); + for (uint i= 1; i < table->s->fields; i++) + se->add_read_column(table->field[i]->field_name); + + bres= se->get_range_slices(); + + DBUG_RETURN(bres? HA_ERR_INTERNAL_ERROR: 0); } +int ha_cassandra::rnd_end() +{ + DBUG_ENTER("ha_cassandra::rnd_end"); + + se->finish_reading_range_slices(); + DBUG_RETURN(0); +} + + +int ha_cassandra::rnd_next(uchar *buf) +{ + int rc; + DBUG_ENTER("ha_cassandra::rnd_next"); + + // Unpack and return the next record. + if (se->get_next_range_slice_row()) + { + rc= HA_ERR_END_OF_FILE; + } + else + { + read_cassandra_columns(); + rc= 0; + } + + DBUG_RETURN(rc); +} + ///////////////////////////////////////////////////////////////////////////// // Dummy implementations start ///////////////////////////////////////////////////////////////////////////// @@ -743,27 +785,6 @@ int ha_cassandra::index_last(uchar *buf) DBUG_RETURN(rc); } -int ha_cassandra::rnd_init(bool scan) -{ - DBUG_ENTER("ha_cassandra::rnd_init"); - DBUG_RETURN(0); -} - -int ha_cassandra::rnd_end() -{ - DBUG_ENTER("ha_cassandra::rnd_end"); - DBUG_RETURN(0); -} - - -int ha_cassandra::rnd_next(uchar *buf) -{ - int rc; - DBUG_ENTER("ha_cassandra::rnd_next"); - rc= HA_ERR_END_OF_FILE; - DBUG_RETURN(rc); -} - void ha_cassandra::position(const uchar *record) { DBUG_ENTER("ha_cassandra::position"); diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 595b840d360..30958e4e17c 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -36,19 +36,17 @@ class ha_cassandra: public handler Cassandra_se_interface *se; - /* pre-allocated array of #fields elements */ - NameAndValue *names_and_vals; - NameAndValue *get_names_and_vals(); - - ColumnDataConverter **field_converters; uint n_field_converters; bool setup_field_converters(Field **field, uint n_fields); void free_field_converters(); + + void read_cassandra_columns(); public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() { + free_field_converters(); delete se; } From 9cdf5eeec91b60fbdffdc7d7a675f47bdb39ff50 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sat, 18 Aug 2012 21:29:31 +0400 Subject: [PATCH 174/439] MDEV-431: Cassandra storage engine - Support "DELETE FROM cassandra_table" --- mysql-test/r/cassandra.result | 3 +++ mysql-test/t/cassandra.test | 5 +++++ storage/cassandra/cassandra_se.cc | 22 ++++++++++++++++++++++ storage/cassandra/cassandra_se.h | 3 ++- storage/cassandra/ha_cassandra.cc | 19 ++++++++++++------- 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 651adf40c7b..4e45685a8c2 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -22,4 +22,7 @@ select * from t1; rowkey data1 data2 data1-value 123456 data1-value2 34543 +delete from t1; +select * from t1; +rowkey data1 data2 drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index e316e23d626..80271e48d3e 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -55,6 +55,11 @@ create table t1 (rowkey char(36) primary key, data1 varchar(60), data2 bigint) e insert into t1 values ('rowkey10', 'data1-value', 123456); insert into t1 values ('rowkey11', 'data1-value2', 34543); select * from t1; + +# Check if deletion works +delete from t1; +select * from t1; + drop table t1; ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index f8891a43351..c47787d97f4 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -95,6 +95,8 @@ public: /* Setup that's necessary before a multi-row read. (todo: use it before point lookups, too) */ void clear_read_columns(); void add_read_column(const char *name); + + bool truncate(); }; @@ -398,3 +400,23 @@ void Cassandra_se_impl::add_read_column(const char *name_arg) slice_pred.column_names.push_back(name); } + +bool Cassandra_se_impl::truncate() +{ + bool res= true; + try { + + cass->truncate(column_family); + res= false; + + } catch (InvalidRequestException ire) { + print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (UnavailableException ue) { + print_error("UnavailableException: %s", ue.what()); + } catch (TimedOutException te) { + print_error("TimedOutException: %s", te.what()); + } + + return res; +} + diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index d35a6e6a003..44b6ac05ca8 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -44,7 +44,8 @@ public: /* read_set setup */ virtual void clear_read_columns()=0; virtual void add_read_column(const char *name)=0; - + + virtual bool truncate()=0; /* Passing error messages up to ha_cassandra */ char err_buffer[512]; const char *error_str() { return err_buffer; } diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 02eddcaf5cd..21131944bb3 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -746,6 +746,18 @@ int ha_cassandra::rnd_next(uchar *buf) DBUG_RETURN(rc); } + +int ha_cassandra::delete_all_rows() +{ + bool bres; + DBUG_ENTER("ha_cassandra::delete_all_rows"); + + bres= se->truncate(); + + DBUG_RETURN(bres? HA_ERR_INTERNAL_ERROR: 0); +} + + ///////////////////////////////////////////////////////////////////////////// // Dummy implementations start ///////////////////////////////////////////////////////////////////////////// @@ -861,13 +873,6 @@ int ha_cassandra::delete_row(const uchar *buf) } -int ha_cassandra::delete_all_rows() -{ - DBUG_ENTER("ha_cassandra::delete_all_rows"); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} - - /** check_if_incompatible_data() called if ALTER TABLE can't detect otherwise if new and old definition are compatible From d36259703b8ffa37ed47ed9dec7f393c8283c4c5 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sun, 19 Aug 2012 12:50:53 +0400 Subject: [PATCH 175/439] MDEV-431: Cassandra storage engine - Descriptive error messages - Unpack PK column on range scans --- mysql-test/r/cassandra.result | 23 +++++-- mysql-test/t/cassandra.test | 10 ++- storage/cassandra/cassandra_se.cc | 34 +++++++++- storage/cassandra/cassandra_se.h | 2 + storage/cassandra/ha_cassandra.cc | 108 ++++++++++++++++++++++++------ storage/cassandra/ha_cassandra.h | 5 +- 6 files changed, 149 insertions(+), 33 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 4e45685a8c2..b77dcc40c14 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -13,15 +13,26 @@ thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam'; ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace no_such_keyspace does not exist] create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace'; -ERROR HY000: Can't create table 'test.t1' (errno: 140) -create table t1 (rowkey char(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra +ERROR HY000: Unable to connect to foreign data source: thrift_host, keyspace, and column_family table options must be s +create table t1 (rowkey varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; -insert into t1 values ('rowkey10', 'data1-value', 123456); -insert into t1 values ('rowkey11', 'data1-value2', 34543); select * from t1; rowkey data1 data2 - data1-value 123456 - data1-value2 34543 +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1; +rowkey data1 data2 +rowkey12 data1-value3 454 +rowkey10 data1-value 123456 +rowkey11 data1-value2 34543 +explain +select * from t1 where rowkey='rowkey11'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 38 const 1 +select * from t1 where rowkey='rowkey11'; +rowkey data1 data2 +rowkey11 data1-value2 34543 delete from t1; select * from t1; rowkey data1 data2 diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 80271e48d3e..0f0a1544af5 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -25,7 +25,7 @@ create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam'; # No column family specified ---error ER_CANT_CREATE_TABLE +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace'; @@ -49,13 +49,19 @@ create columnfamily cf1 ( pk varchar primary key, data1 varchar, data2 bigint); ############################################################################ # Now, create a table for real and insert data -create table t1 (rowkey char(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra +create table t1 (rowkey varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; +select * from t1; insert into t1 values ('rowkey10', 'data1-value', 123456); insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); select * from t1; +explain +select * from t1 where rowkey='rowkey11'; +select * from t1 where rowkey='rowkey11'; + # Check if deletion works delete from t1; select * from t1; diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index c47787d97f4..82b6dcbb93b 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -64,6 +64,8 @@ class Cassandra_se_impl: public Cassandra_se_interface /* Resultset we're reading */ std::vector key_slice_vec; std::vector::iterator key_slice_it; + + std::string rowkey; /* key of the record we're returning now */ SlicePredicate slice_pred; public: @@ -77,6 +79,7 @@ public: bool setup_ddl_checks(); void first_ddl_column(); bool next_ddl_column(char **name, int *name_len, char **value, int *value_len); + void get_rowkey_type(char **name, char **type); /* Writes */ void start_prepare_insert(const char *key, int key_len); @@ -86,6 +89,7 @@ public: /* Reads, point lookups */ bool get_slice(char *key, size_t key_len, bool *found); bool get_next_read_column(char **name, char **value, int *value_len); + void get_read_rowkey(char **value, int *value_len); /* Reads, multi-row scans */ bool get_range_slices(); @@ -193,6 +197,21 @@ bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len, return false; } + +void Cassandra_se_impl::get_rowkey_type(char **name, char **type) +{ + if (cf_def.__isset.key_validation_class) + *type= (char*)cf_def.key_validation_class.c_str(); + else + *type= NULL; + + if (cf_def.__isset.key_alias) + *name= (char*)cf_def.key_alias.c_str(); + else + *name= NULL; +} + + ///////////////////////////////////////////////////////////////////////////// // Data writes ///////////////////////////////////////////////////////////////////////////// @@ -269,8 +288,7 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) ColumnParent cparent; cparent.column_family= column_family; - std::string rowkey_str; - rowkey_str.assign(key, key_len); + rowkey.assign(key, key_len); SlicePredicate slice_pred; SliceRange sr; @@ -279,7 +297,7 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) slice_pred.__set_slice_range(sr); try { - cass->get_slice(column_data_vec, rowkey_str, cparent, slice_pred, + cass->get_slice(column_data_vec, rowkey, cparent, slice_pred, cur_consistency_level); if (column_data_vec.size() == 0) @@ -333,6 +351,15 @@ bool Cassandra_se_impl::get_next_read_column(char **name, char **value, } +/* Return the rowkey for the record that was read */ + +void Cassandra_se_impl::get_read_rowkey(char **value, int *value_len) +{ + *value= (char*)rowkey.c_str(); + *value_len= rowkey.length(); +} + + bool Cassandra_se_impl::get_range_slices() //todo: start_range/end_range as parameters { bool res= true; @@ -375,6 +402,7 @@ bool Cassandra_se_impl::get_next_range_slice_row() return true; column_data_vec= key_slice_it->columns; + rowkey= key_slice_it->key; column_data_it= column_data_vec.begin(); key_slice_it++; return false; diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 44b6ac05ca8..6e3380e7f50 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -25,6 +25,7 @@ public: virtual void first_ddl_column()=0; virtual bool next_ddl_column(char **name, int *name_len, char **value, int *value_len)=0; + virtual void get_rowkey_type(char **name, char **type)=0; /* Writes */ virtual void start_prepare_insert(const char *key, int key_len)=0; @@ -35,6 +36,7 @@ public: /* Reads */ virtual bool get_slice(char *key, size_t key_len, bool *found)=0 ; virtual bool get_next_read_column(char **name, char **value, int *value_len)=0; + virtual void get_read_rowkey(char **value, int *value_len)=0; /* Reads, multi-row scans */ virtual bool get_range_slices()=0; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 21131944bb3..8d7c4051c01 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -212,7 +212,7 @@ static handler* cassandra_create_handler(handlerton *hton, ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), - se(NULL), field_converters(NULL) + se(NULL), field_converters(NULL),rowkey_converter(NULL) {} @@ -251,7 +251,6 @@ int ha_cassandra::open(const char *name, int mode, uint test_if_locked) if (setup_field_converters(table->field, table->s->fields)) { - my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "setup_field_converters"); DBUG_RETURN(HA_ERR_NO_CONNECTION); } @@ -341,8 +340,12 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, */ #endif DBUG_ASSERT(!se); - if (!options->host || !options->keyspace || !options->column_family) + if (!options->host || !options->keyspace || !options->column_family) + { + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), + "thrift_host, keyspace, and column_family table options must be specified"); DBUG_RETURN(HA_WRONG_CREATE_OPTION); + } se= get_cassandra_se(); se->set_column_family(options->column_family); if (se->connect(options->host, options->keyspace)) @@ -515,6 +518,7 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VARCHAR: + //case MYSQL_TYPE_STRING: <-- todo: should we allow end-padded 'CHAR(N)'? if (!strcmp(validator_name, validator_blob) || !strcmp(validator_name, validator_ascii) || !strcmp(validator_name, validator_text)) @@ -560,7 +564,12 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) n_mapped++; ColumnDataConverter **conv= field_converters + (*field)->field_index; if (!(*conv= map_field_to_validator(*field, col_type))) + { + se->print_error("Failed to map column %s to datatype %s", + (*field)->field_name, col_type); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); return true; + } (*conv)->field= *field; } } @@ -568,6 +577,28 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) if (n_mapped != n_fields - 1) return true; + + /* + Setup type conversion for row_key. It may also have a name, but we ignore + it currently + */ + se->get_rowkey_type(&col_name, &col_type); + if (col_type != NULL) + { + if (!(rowkey_converter= map_field_to_validator(*field_arg, col_type))) + { + se->print_error("Failed to map PRIMARY KEY to datatype %s", col_type); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + return true; + } + rowkey_converter->field= *field_arg; + } + else + { + se->print_error("Cassandra's rowkey has no defined datatype (todo: support this)"); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + return true; + } return false; } @@ -575,6 +606,9 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) void ha_cassandra::free_field_converters() { + delete rowkey_converter; + rowkey_converter= NULL; + if (field_converters) { for (uint i=0; i < n_field_converters; i++) @@ -588,8 +622,8 @@ void ha_cassandra::free_field_converters() void store_key_image_to_rec(Field *field, uchar *ptr, uint len); int ha_cassandra::index_read_map(uchar *buf, const uchar *key, - key_part_map keypart_map, - enum ha_rkey_function find_flag) + key_part_map keypart_map, + enum ha_rkey_function find_flag) { int rc; DBUG_ENTER("ha_cassandra::index_read_map"); @@ -597,19 +631,26 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, if (find_flag != HA_READ_KEY_EXACT) DBUG_RETURN(HA_ERR_WRONG_COMMAND); - // todo: decode the search key. uint key_len= calculate_key_len(table, active_index, key, keypart_map); store_key_image_to_rec(table->field[0], (uchar*)key, key_len); - +#if 0 char buff[256]; String tmp(buff,sizeof(buff), &my_charset_bin); tmp.length(0); String *str; str= table->field[0]->val_str(&tmp); - +#endif + + char *cass_key; + int cass_key_len; + rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); + bool found; - if (se->get_slice((char*)str->ptr(), str->length(), &found)) + if (se->get_slice(cass_key, cass_key_len, &found)) + { + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); rc= HA_ERR_INTERNAL_ERROR; + } /* TODO: what if we're not reading all columns?? */ if (!found) @@ -618,14 +659,14 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, } else { - read_cassandra_columns(); + read_cassandra_columns(false); } DBUG_RETURN(rc); } -void ha_cassandra::read_cassandra_columns() +void ha_cassandra::read_cassandra_columns(bool unpack_pk) { char *cass_name; char *cass_value; @@ -659,6 +700,15 @@ void ha_cassandra::read_cassandra_columns() } } } + + if (unpack_pk) + { + /* Unpack rowkey to primary key */ + field= table->field; + (*field)->set_notnull(); + se->get_read_rowkey(&cass_value, &cass_value_len); + rowkey_converter->cassandra_to_mariadb(cass_value, cass_value_len); + } dbug_tmp_restore_column_map(table->write_set, old_map); } @@ -667,12 +717,13 @@ void ha_cassandra::read_cassandra_columns() int ha_cassandra::write_row(uchar *buf) { my_bitmap_map *old_map; - char buff[512]; +// char buff[512]; DBUG_ENTER("ha_cassandra::write_row"); old_map= dbug_tmp_use_all_columns(table, table->read_set); /* Convert the key (todo: unify with the rest of the processing) */ +#if 0 { Field *pk_col= table->field[0]; String tmp(buff,sizeof(buff), &my_charset_bin); @@ -682,6 +733,11 @@ int ha_cassandra::write_row(uchar *buf) se->start_prepare_insert(str->ptr(), str->length()); } +#endif + char *cass_key; + int cass_key_len; + rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); + se->start_prepare_insert(cass_key, cass_key_len); /* Convert other fields */ for (uint i= 1; i < table->s->fields; i++) @@ -697,6 +753,9 @@ int ha_cassandra::write_row(uchar *buf) bool res= se->do_insert(); + if (res) + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); } @@ -713,6 +772,8 @@ int ha_cassandra::rnd_init(bool scan) se->add_read_column(table->field[i]->field_name); bres= se->get_range_slices(); + if (bres) + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); DBUG_RETURN(bres? HA_ERR_INTERNAL_ERROR: 0); } @@ -739,7 +800,7 @@ int ha_cassandra::rnd_next(uchar *buf) } else { - read_cassandra_columns(); + read_cassandra_columns(true); rc= 0; } @@ -753,11 +814,22 @@ int ha_cassandra::delete_all_rows() DBUG_ENTER("ha_cassandra::delete_all_rows"); bres= se->truncate(); + + if (bres) + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); DBUG_RETURN(bres? HA_ERR_INTERNAL_ERROR: 0); } +int ha_cassandra::delete_row(const uchar *buf) +{ + DBUG_ENTER("ha_cassandra::delete_row"); + // todo: delete the row we've just read. + DBUG_RETURN(HA_ERR_WRONG_COMMAND); +} + + ///////////////////////////////////////////////////////////////////////////// // Dummy implementations start ///////////////////////////////////////////////////////////////////////////// @@ -815,7 +887,8 @@ ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, key_range *max_key) { DBUG_ENTER("ha_cassandra::records_in_range"); - DBUG_RETURN(10); // low number to force index usage + //DBUG_RETURN(10); // low number to force index usage + DBUG_RETURN(HA_POS_ERROR); } @@ -866,13 +939,6 @@ int ha_cassandra::delete_table(const char *name) } -int ha_cassandra::delete_row(const uchar *buf) -{ - DBUG_ENTER("ha_cassandra::delete_row"); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} - - /** check_if_incompatible_data() called if ALTER TABLE can't detect otherwise if new and old definition are compatible diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 30958e4e17c..7a163363ab6 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -38,10 +38,13 @@ class ha_cassandra: public handler ColumnDataConverter **field_converters; uint n_field_converters; + + ColumnDataConverter *rowkey_converter; + bool setup_field_converters(Field **field, uint n_fields); void free_field_converters(); - void read_cassandra_columns(); + void read_cassandra_columns(bool unpack_pk); public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() From 62c1c3f0c50a3727fa634e2b965fd78e376aab5e Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sun, 19 Aug 2012 13:21:23 +0400 Subject: [PATCH 176/439] MDEV-431: Cassandra storage engine - Partial support for DELETE ... WHERE. --- mysql-test/r/cassandra.result | 9 ++++++ mysql-test/t/cassandra.test | 22 +++++++++++++-- storage/cassandra/cassandra_se.cc | 47 +++++++++++++++++++++++++------ storage/cassandra/cassandra_se.h | 2 ++ storage/cassandra/ha_cassandra.cc | 12 ++++++-- 5 files changed, 79 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index b77dcc40c14..b39a29b22eb 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -14,8 +14,11 @@ ERROR HY000: Unable to connect to foreign data source: Default TException. [Keys create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace'; ERROR HY000: Unable to connect to foreign data source: thrift_host, keyspace, and column_family table options must be s +# Now, create a table for real and insert data create table t1 (rowkey varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; +# Just in case there were left-overs from previous: +delete from t1; select * from t1; rowkey data1 data2 insert into t1 values ('rowkey10', 'data1-value', 123456); @@ -33,6 +36,12 @@ id select_type table type possible_keys key key_len ref rows Extra select * from t1 where rowkey='rowkey11'; rowkey data1 data2 rowkey11 data1-value2 34543 +delete from t1 where rowkey='rowkey11'; +select * from t1; +rowkey data1 data2 +rowkey12 data1-value3 454 +rowkey10 data1-value 123456 +rowkey11 NULL NULL delete from t1; select * from t1; rowkey data1 data2 diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 0f0a1544af5..7c00e20651a 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -48,9 +48,12 @@ create columnfamily cf1 ( pk varchar primary key, data1 varchar, data2 bigint); ## Cassandra initialization ends ############################################################################ -# Now, create a table for real and insert data +--echo # Now, create a table for real and insert data create table t1 (rowkey varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; + +--echo # Just in case there were left-overs from previous: +delete from t1; select * from t1; insert into t1 values ('rowkey10', 'data1-value', 123456); @@ -62,7 +65,22 @@ explain select * from t1 where rowkey='rowkey11'; select * from t1 where rowkey='rowkey11'; -# Check if deletion works +# Deletion functions weirdly: it sets all columns to NULL +# but when If I do this in cassandra-cli: +# +# del cf1[ascii('rowkey10')] +# +# Subsequent 'list cf1' command also gives +# +# RowKey: rowkey10 +# +# without any columns. +# +# CQL seems to simply ignore all "incomplete" records. + +delete from t1 where rowkey='rowkey11'; +select * from t1; + delete from t1; select * from t1; diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 82b6dcbb93b..7d7d6bf9eee 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -101,6 +101,10 @@ public: void add_read_column(const char *name); bool truncate(); + bool remove_row(); + + /* Non-inherited utility functions: */ + int64_t get_i64_timestamp(); }; @@ -215,6 +219,18 @@ void Cassandra_se_impl::get_rowkey_type(char **name, char **type) ///////////////////////////////////////////////////////////////////////////// // Data writes ///////////////////////////////////////////////////////////////////////////// +int64_t Cassandra_se_impl::get_i64_timestamp() +{ + struct timeval td; + gettimeofday(&td, NULL); + int64_t ms = td.tv_sec; + ms = ms * 1000; + int64_t usec = td.tv_usec; + usec = usec / 1000; + ms += usec; + + return ms; +} void Cassandra_se_impl::start_prepare_insert(const char *key, int key_len) { @@ -226,14 +242,7 @@ void Cassandra_se_impl::start_prepare_insert(const char *key, int key_len) cf_mut[column_family]= std::vector(); insert_list= &cf_mut[column_family]; - struct timeval td; - gettimeofday(&td, NULL); - int64_t ms = td.tv_sec; - ms = ms * 1000; - int64_t usec = td.tv_usec; - usec = usec / 1000; - ms += usec; - insert_timestamp= ms; + insert_timestamp= get_i64_timestamp(); } @@ -448,3 +457,25 @@ bool Cassandra_se_impl::truncate() return res; } +bool Cassandra_se_impl::remove_row() +{ + bool res= true; + + ColumnPath column_path; + column_path.column_family= column_family; + + try { + + cass->remove(rowkey, column_path, get_i64_timestamp(), cur_consistency_level); + res= false; + + } catch (InvalidRequestException ire) { + print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (UnavailableException ue) { + print_error("UnavailableException: %s", ue.what()); + } catch (TimedOutException te) { + print_error("TimedOutException: %s", te.what()); + } + + return res; +} diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 6e3380e7f50..bbd4c8dd883 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -48,6 +48,8 @@ public: virtual void add_read_column(const char *name)=0; virtual bool truncate()=0; + virtual bool remove_row()=0; + /* Passing error messages up to ha_cassandra */ char err_buffer[512]; const char *error_str() { return err_buffer; } diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 8d7c4051c01..c6cb624156b 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -625,7 +625,7 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { - int rc; + int rc= 0; DBUG_ENTER("ha_cassandra::index_read_map"); if (find_flag != HA_READ_KEY_EXACT) @@ -824,9 +824,15 @@ int ha_cassandra::delete_all_rows() int ha_cassandra::delete_row(const uchar *buf) { + bool bres; DBUG_ENTER("ha_cassandra::delete_row"); - // todo: delete the row we've just read. - DBUG_RETURN(HA_ERR_WRONG_COMMAND); + + bres= se->remove_row(); + + if (bres) + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + + DBUG_RETURN(bres? HA_ERR_INTERNAL_ERROR: 0); } From 38bc66fb1a0eff9d96ecbc205e95e720ffbc46d7 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sun, 19 Aug 2012 14:54:58 +0400 Subject: [PATCH 177/439] position() and rnd_pos() implementations. --- storage/cassandra/ha_cassandra.cc | 105 ++++++++++++++++++------------ 1 file changed, 64 insertions(+), 41 deletions(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index c6cb624156b..5e950eb4b96 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -254,6 +254,8 @@ int ha_cassandra::open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(HA_ERR_NO_CONNECTION); } + info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + DBUG_RETURN(0); } @@ -310,6 +312,12 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, DBUG_RETURN(HA_WRONG_CREATE_OPTION); } + if (!((*pfield)->flags & NOT_NULL_FLAG)) + { + my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be NOT NULL"); + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + } + if (table_arg->s->keys != 1 || table_arg->s->primary_key !=0 || table_arg->key_info[0].key_parts != 1 || table_arg->key_info[0].key_part[0].fieldnr != 1) @@ -633,13 +641,6 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, uint key_len= calculate_key_len(table, active_index, key, keypart_map); store_key_image_to_rec(table->field[0], (uchar*)key, key_len); -#if 0 - char buff[256]; - String tmp(buff,sizeof(buff), &my_charset_bin); - tmp.length(0); - String *str; - str= table->field[0]->val_str(&tmp); -#endif char *cass_key; int cass_key_len; @@ -717,23 +718,11 @@ void ha_cassandra::read_cassandra_columns(bool unpack_pk) int ha_cassandra::write_row(uchar *buf) { my_bitmap_map *old_map; -// char buff[512]; DBUG_ENTER("ha_cassandra::write_row"); old_map= dbug_tmp_use_all_columns(table, table->read_set); - /* Convert the key (todo: unify with the rest of the processing) */ -#if 0 - { - Field *pk_col= table->field[0]; - String tmp(buff,sizeof(buff), &my_charset_bin); - String *str; - tmp.length(0); - str= pk_col->val_str(&tmp); - - se->start_prepare_insert(str->ptr(), str->length()); - } -#endif + /* Convert the key */ char *cass_key; int cass_key_len; rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); @@ -836,6 +825,57 @@ int ha_cassandra::delete_row(const uchar *buf) } +int ha_cassandra::info(uint flag) +{ + DBUG_ENTER("ha_cassandra::info"); + + if (!table) + return 1; + + if (flag & HA_STATUS_VARIABLE) + { + stats.records= 1000; + //TODO: any other stats? + } + if (flag & HA_STATUS_CONST) + { + ref_length= table->field[0]->key_length(); + } + + DBUG_RETURN(0); +} + + +void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, + uint key_length, bool with_zerofill); + + +void ha_cassandra::position(const uchar *record) +{ + DBUG_ENTER("ha_cassandra::position"); + + /* Copy the primary key to rowid */ + key_copy(ref, (uchar*)record, &table->key_info[0], + table->field[0]->key_length(), true); + + DBUG_VOID_RETURN; +} + + +int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) +{ + int rc; + DBUG_ENTER("ha_cassandra::rnd_pos"); + + int save_active_index= active_index; + rc= index_read_map(buf, pos, key_part_map(1), HA_READ_KEY_EXACT); + + active_index= save_active_index; + + DBUG_RETURN(rc); +} + + ///////////////////////////////////////////////////////////////////////////// // Dummy implementations start ///////////////////////////////////////////////////////////////////////////// @@ -875,19 +915,6 @@ int ha_cassandra::index_last(uchar *buf) DBUG_RETURN(rc); } -void ha_cassandra::position(const uchar *record) -{ - DBUG_ENTER("ha_cassandra::position"); - DBUG_VOID_RETURN; -} - -int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) -{ - int rc; - DBUG_ENTER("ha_cassandra::rnd_pos"); - rc= HA_ERR_WRONG_COMMAND; - DBUG_RETURN(rc); -} ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, key_range *max_key) @@ -906,13 +933,6 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) } -int ha_cassandra::info(uint flag) -{ - DBUG_ENTER("ha_cassandra::info"); - DBUG_RETURN(0); -} - - int ha_cassandra::extra(enum ha_extra_function operation) { DBUG_ENTER("ha_cassandra::extra"); @@ -940,7 +960,10 @@ int ha_cassandra::external_lock(THD *thd, int lock_type) int ha_cassandra::delete_table(const char *name) { DBUG_ENTER("ha_cassandra::delete_table"); - /* This is not implemented but we want someone to be able that it works. */ + /* + Cassandra table is just a view. Dropping it doesn't affect the underlying + column family. + */ DBUG_RETURN(0); } From 81817412aa526628cb3f02f5075c03f034a69424 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 20 Aug 2012 12:08:29 +0400 Subject: [PATCH 178/439] Read records in batches when doing full table scan. --- storage/cassandra/cassandra_se.cc | 52 +++++++++++++++++++++++++------ storage/cassandra/cassandra_se.h | 6 ++-- storage/cassandra/ha_cassandra.cc | 20 ++++++++---- storage/cassandra/ha_cassandra.h | 2 ++ 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 7d7d6bf9eee..bd5056bcda4 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -68,6 +68,7 @@ class Cassandra_se_impl: public Cassandra_se_interface std::string rowkey; /* key of the record we're returning now */ SlicePredicate slice_pred; + bool get_slices_returned_less; public: Cassandra_se_impl() : cass(NULL) {} virtual ~Cassandra_se_impl(){ delete cass; } @@ -92,9 +93,9 @@ public: void get_read_rowkey(char **value, int *value_len); /* Reads, multi-row scans */ - bool get_range_slices(); + bool get_range_slices(bool last_key_as_start_key); void finish_reading_range_slices(); - bool get_next_range_slice_row(); + bool get_next_range_slice_row(bool *eof); /* Setup that's necessary before a multi-row read. (todo: use it before point lookups, too) */ void clear_read_columns(); @@ -369,7 +370,7 @@ void Cassandra_se_impl::get_read_rowkey(char **value, int *value_len) } -bool Cassandra_se_impl::get_range_slices() //todo: start_range/end_range as parameters +bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) { bool res= true; @@ -380,11 +381,16 @@ bool Cassandra_se_impl::get_range_slices() //todo: start_range/end_range as para // Try passing nothing... KeyRange key_range; // Try passing nothing, too. - key_range.__isset.start_key=true; - key_range.__isset.end_key=true; - key_range.start_key.assign("", 0); - key_range.end_key.assign("", 0); + key_range.__isset.start_key= true; + key_range.__isset.end_key= true; + if (last_key_as_start_key) + key_range.start_key= rowkey; + else + key_range.start_key.assign("", 0); + + key_range.end_key.assign("", 0); + key_range.count= read_batch_size; try { cass->get_range_slices(key_slice_vec, @@ -392,6 +398,11 @@ bool Cassandra_se_impl::get_range_slices() //todo: start_range/end_range as para cur_consistency_level); res= false; + if (key_slice_vec.size() < (uint)read_batch_size) + get_slices_returned_less= true; + else + get_slices_returned_less= false; + } catch (InvalidRequestException ire) { print_error("%s [%s]", ire.what(), ire.why.c_str()); } catch (UnavailableException ue) { @@ -405,11 +416,32 @@ bool Cassandra_se_impl::get_range_slices() //todo: start_range/end_range as para } -bool Cassandra_se_impl::get_next_range_slice_row() +/* Switch to next row. This may produce an error */ +bool Cassandra_se_impl::get_next_range_slice_row(bool *eof) { if (key_slice_it == key_slice_vec.end()) - return true; - + { + if (get_slices_returned_less) + { + *eof= true; + return false; + } + + /* + We have read through all columns in this batch. Try getting the next + batch. + */ + if (get_range_slices(true)) + return true; + + if (key_slice_vec.empty()) + { + *eof= true; + return false; + } + } + + *eof= false; column_data_vec= key_slice_it->columns; rowkey= key_slice_it->key; column_data_it= column_data_vec.begin(); diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index bbd4c8dd883..e65e495e91c 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -39,9 +39,11 @@ public: virtual void get_read_rowkey(char **value, int *value_len)=0; /* Reads, multi-row scans */ - virtual bool get_range_slices()=0; + int read_batch_size; + + virtual bool get_range_slices(bool last_key_as_start_key)=0; virtual void finish_reading_range_slices()=0; - virtual bool get_next_range_slice_row()=0; + virtual bool get_next_range_slice_row(bool *eof)=0; /* read_set setup */ virtual void clear_read_columns()=0; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 5e950eb4b96..0f196ed2a99 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -212,7 +212,8 @@ static handler* cassandra_create_handler(handlerton *hton, ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), - se(NULL), field_converters(NULL),rowkey_converter(NULL) + se(NULL), field_converters(NULL), rowkey_converter(NULL), + rnd_batch_size(10*1000) {} @@ -760,7 +761,8 @@ int ha_cassandra::rnd_init(bool scan) for (uint i= 1; i < table->s->fields; i++) se->add_read_column(table->field[i]->field_name); - bres= se->get_range_slices(); + se->read_batch_size= rnd_batch_size; + bres= se->get_range_slices(false); if (bres) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); @@ -780,17 +782,23 @@ int ha_cassandra::rnd_end() int ha_cassandra::rnd_next(uchar *buf) { int rc; + bool reached_eof; DBUG_ENTER("ha_cassandra::rnd_next"); // Unpack and return the next record. - if (se->get_next_range_slice_row()) + if (se->get_next_range_slice_row(&reached_eof)) { - rc= HA_ERR_END_OF_FILE; + rc= HA_ERR_INTERNAL_ERROR; } else { - read_cassandra_columns(true); - rc= 0; + if (reached_eof) + rc= HA_ERR_END_OF_FILE; + else + { + read_cassandra_columns(true); + rc= 0; + } } DBUG_RETURN(rc); diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 7a163363ab6..d5327e20934 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -45,6 +45,8 @@ class ha_cassandra: public handler void free_field_converters(); void read_cassandra_columns(bool unpack_pk); + + ha_rows rnd_batch_size; public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() From 06ea60d221761af9f9dee5345b783ba75c3cb6c1 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Tue, 21 Aug 2012 18:38:27 +0400 Subject: [PATCH 179/439] Make ha_cassandra work with filesort(). --- mysql-test/r/cassandra.result | 13 +++++++++++++ mysql-test/t/cassandra.test | 10 ++++++++++ storage/cassandra/ha_cassandra.cc | 5 ++++- storage/cassandra/ha_cassandra.h | 14 ++++++++++---- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index b39a29b22eb..b6b7429ee0a 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -45,4 +45,17 @@ rowkey11 NULL NULL delete from t1; select * from t1; rowkey data1 data2 +# +# A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ, +# also check ::rnd_pos() +# +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1 order by data2; +rowkey data1 data2 +rowkey12 data1-value3 454 +rowkey11 data1-value2 34543 +rowkey10 data1-value 123456 +delete from t1; drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 7c00e20651a..b4727709f8e 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -84,6 +84,16 @@ select * from t1; delete from t1; select * from t1; +--echo # +--echo # A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ, +--echo # also check ::rnd_pos() +--echo # +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1 order by data2; + +delete from t1; drop table t1; ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 0f196ed2a99..7455420870c 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -755,7 +755,10 @@ int ha_cassandra::rnd_init(bool scan) bool bres; DBUG_ENTER("ha_cassandra::rnd_init"); if (!scan) - DBUG_RETURN(HA_ERR_WRONG_COMMAND); + { + /* Prepare for rnd_pos() calls. We don't need to anything. */ + DBUG_RETURN(0); + } se->clear_read_columns(); for (uint i= 1; i < table->s->fields; i++) diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index d5327e20934..cca70814b1b 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -78,11 +78,17 @@ public: ulonglong table_flags() const { /* - We are saying that this engine is just statement capable to have - an engine that can only handle statement-based logging. This is - used in testing. + HA_BINLOG_STMT_CAPABLE + We are saying that this engine is just statement capable to have + an engine that can only handle statement-based logging. This is + used in testing. + HA_REC_NOT_IN_SEQ + If we don't set it, filesort crashes, because it assumes rowids are + 1..8 byte numbers */ - return HA_BINLOG_STMT_CAPABLE; + return HA_BINLOG_STMT_CAPABLE | + HA_REC_NOT_IN_SEQ; + } /** @brief From 3ea983dab1bcf543cb6cfc6c48a16342f1eafbf6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Aug 2012 11:11:48 +0200 Subject: [PATCH 180/439] From cd0a82d8b1cec34a9cf88d34d4636d8b35b9214c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Aug 2012 16:17:37 +0400 Subject: [PATCH 181/439] From 38d4e02559ad33ae7c4e9258528d78a09e5e330b Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 23 Aug 2012 16:15:28 +0400 Subject: [PATCH 182/439] # MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY - Fix typo in ha_cassandra::rnd_pos(). - in ::index_read_map(), do not assume that pk column is part of table->read_set. --- mysql-test/r/cassandra.result | 8 ++++++++ mysql-test/t/cassandra.test | 13 +++++++++++++ storage/cassandra/ha_cassandra.cc | 7 +++++++ 3 files changed, 28 insertions(+) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index b6b7429ee0a..8d200e783bc 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -59,3 +59,11 @@ rowkey11 data1-value2 34543 rowkey10 data1-value 123456 delete from t1; drop table t1; +# +# MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY +# +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +INSERT INTO t1 VALUES (1,1),(2,2); +DELETE FROM t1 ORDER BY a LIMIT 1; +DROP TABLE t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index b4727709f8e..5630d4da666 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -43,6 +43,8 @@ CREATE KEYSPACE mariadbtest2 USE mariadbtest2; create columnfamily cf1 ( pk varchar primary key, data1 varchar, data2 bigint); +create columnfamily cf2 (rowkey bigint primary key, a bigint); + --enable_parsing ############################################################################ ## Cassandra initialization ends @@ -96,6 +98,17 @@ select * from t1 order by data2; delete from t1; drop table t1; +--echo # +--echo # MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY +--echo # +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; + +INSERT INTO t1 VALUES (1,1),(2,2); +DELETE FROM t1 ORDER BY a LIMIT 1; + +DROP TABLE t1; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 7455420870c..d1006a6e816 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -645,8 +645,14 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, char *cass_key; int cass_key_len; + my_bitmap_map *old_map; + + old_map= dbug_tmp_use_all_columns(table, table->read_set); + rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); + dbug_tmp_restore_column_map(table->read_set, old_map); + bool found; if (se->get_slice(cass_key, cass_key_len, &found)) { @@ -879,6 +885,7 @@ int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) DBUG_ENTER("ha_cassandra::rnd_pos"); int save_active_index= active_index; + active_index= 0; /* The primary key */ rc= index_read_map(buf, pos, key_part_map(1), HA_READ_KEY_EXACT); active_index= save_active_index; From 38a3df4a2c887b406a8adb2d55e2adb5b80a2748 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 23 Aug 2012 21:16:01 +0400 Subject: [PATCH 183/439] - Enable mapping of CHAR(n) - preparations for support of bulk INSERT. --- storage/cassandra/ha_cassandra.cc | 14 +++++++++++++- storage/cassandra/ha_cassandra.h | 5 ++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index d1006a6e816..29159828a97 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -527,7 +527,7 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VARCHAR: - //case MYSQL_TYPE_STRING: <-- todo: should we allow end-padded 'CHAR(N)'? + case MYSQL_TYPE_STRING: // these are space padded strings. if (!strcmp(validator_name, validator_blob) || !strcmp(validator_name, validator_ascii) || !strcmp(validator_name, validator_text)) @@ -893,7 +893,19 @@ int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) DBUG_RETURN(rc); } +#if 0 +void ha_cassandra::start_bulk_insert(ha_rows rows) +{ + /* Do nothing? */ +} + +int ha_cassandra::end_bulk_insert() +{ + // TODO! + return 0; +} +#endif ///////////////////////////////////////////////////////////////////////////// // Dummy implementations start ///////////////////////////////////////////////////////////////////////////// diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index cca70814b1b..469440a0049 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -145,7 +145,10 @@ public: */ virtual double read_time(uint, uint, ha_rows rows) { return (double) rows / 20.0+1; } - +#if 0 + virtual void start_bulk_insert(ha_rows rows); + virtual int end_bulk_insert(); +#endif /* Everything below are methods that we implement in ha_example.cc. From 42827de4918fd630e3b134ac8df5b7c548478837 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Aug 2012 19:49:47 +0200 Subject: [PATCH 184/439] 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 185/439] 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 186/439] From 87f5583415e5cc777b383f9e1483b69e48dc8053 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Aug 2012 16:22:02 +0530 Subject: [PATCH 187/439] From 9d41d7c57b4566b86ef2b623ed93ada50a359781 Mon Sep 17 00:00:00 2001 From: Annamalai Gurusami Date: Tue, 4 Sep 2012 14:33:56 +0530 Subject: [PATCH 188/439] 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 189/439] 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 190/439] 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 191/439] 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 192/439] 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 fdab0300c1e11511df4bae3072eb642fdc222ff8 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sun, 26 Aug 2012 16:06:39 +0400 Subject: [PATCH 193/439] Cassandra storage engine: bulk INSERT support - bulk inserts themselves - control variable and counters. --- mysql-test/r/cassandra.result | 25 ++++++++ mysql-test/t/cassandra.test | 18 ++++++ storage/cassandra/cassandra_se.cc | 19 ++++-- storage/cassandra/cassandra_se.h | 13 ++++- storage/cassandra/ha_cassandra.cc | 96 +++++++++++++++++++++++++------ storage/cassandra/ha_cassandra.h | 9 ++- 6 files changed, 156 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 8d200e783bc..3b78bd5466a 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -67,3 +67,28 @@ thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; INSERT INTO t1 VALUES (1,1),(2,2); DELETE FROM t1 ORDER BY a LIMIT 1; DROP TABLE t1; +# +# Batched INSERT +# +show variables like 'cassandra_insert_batch_size'; +Variable_name Value +cassandra_insert_batch_size 100 +show status like 'cassandra_row_insert%'; +Variable_name Value +Cassandra_row_inserts 8 +Cassandra_row_insert_batches 7 +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +INSERT INTO t1 VALUES (1,1),(2,2); +DELETE FROM t1 ORDER BY a LIMIT 1; +DROP TABLE t1; +show status like 'cassandra_row_insert%'; +Variable_name Value +Cassandra_row_inserts 10 +Cassandra_row_insert_batches 8 +# FLUSH STATUS doesn't work for our variables, just like with InnoDB. +flush status; +show status like 'cassandra_row_insert%'; +Variable_name Value +Cassandra_row_inserts 10 +Cassandra_row_insert_batches 8 diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 5630d4da666..195f365a372 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -109,6 +109,24 @@ DELETE FROM t1 ORDER BY a LIMIT 1; DROP TABLE t1; +--echo # +--echo # Batched INSERT +--echo # +show variables like 'cassandra_insert_batch_size'; +show status like 'cassandra_row_insert%'; +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; + +INSERT INTO t1 VALUES (1,1),(2,2); +DELETE FROM t1 ORDER BY a LIMIT 1; + +DROP TABLE t1; +show status like 'cassandra_row_insert%'; + +--echo # FLUSH STATUS doesn't work for our variables, just like with InnoDB. +flush status; +show status like 'cassandra_row_insert%'; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index bd5056bcda4..75ce33cb981 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -57,7 +57,6 @@ class Cassandra_se_impl: public Cassandra_se_interface typedef std::map KeyToCfMutationMap; KeyToCfMutationMap batch_mutation; /* Prepare operation here */ - std::string key_to_insert; int64_t insert_timestamp; std::vector* insert_list; @@ -83,7 +82,8 @@ public: void get_rowkey_type(char **name, char **type); /* Writes */ - void start_prepare_insert(const char *key, int key_len); + void clear_insert_buffer(); + void start_row_insert(const char *key, int key_len); void add_insert_column(const char *name, const char *value, int value_len); bool do_insert(); @@ -233,10 +233,17 @@ int64_t Cassandra_se_impl::get_i64_timestamp() return ms; } -void Cassandra_se_impl::start_prepare_insert(const char *key, int key_len) + +void Cassandra_se_impl::clear_insert_buffer() { - key_to_insert.assign(key, key_len); batch_mutation.clear(); +} + + +void Cassandra_se_impl::start_row_insert(const char *key, int key_len) +{ + std::string key_to_insert; + key_to_insert.assign(key, key_len); batch_mutation[key_to_insert]= ColumnFamilyToMutation(); ColumnFamilyToMutation& cf_mut= batch_mutation[key_to_insert]; @@ -270,6 +277,10 @@ bool Cassandra_se_impl::do_insert() try { cass->batch_mutate(batch_mutation, cur_consistency_level); + + cassandra_counters.row_inserts+= batch_mutation.size(); + cassandra_counters.row_insert_batches++; + res= false; } catch (InvalidRequestException ire) { diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index e65e495e91c..78bf1016fea 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -28,7 +28,8 @@ public: virtual void get_rowkey_type(char **name, char **type)=0; /* Writes */ - virtual void start_prepare_insert(const char *key, int key_len)=0; + virtual void clear_insert_buffer()=0; + virtual void start_row_insert(const char *key, int key_len)=0; virtual void add_insert_column(const char *name, const char *value, int value_len)=0; virtual bool do_insert()=0; @@ -58,4 +59,14 @@ public: void print_error(const char *format, ...); }; +/* A structure with global counters */ +class Cassandra_status_vars +{ +public: + ulong row_inserts; + ulong row_insert_batches; +}; +extern Cassandra_status_vars cassandra_counters; + + Cassandra_se_interface *get_cassandra_se(); diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 29159828a97..70d389d4992 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -56,6 +56,23 @@ ha_create_table_option cassandra_table_option_list[]= }; +static MYSQL_THDVAR_ULONG(insert_batch_size, PLUGIN_VAR_RQCMDARG, + "Number of rows in an INSERT batch", + NULL, NULL, /*default*/ 100, /*min*/ 1, /*max*/ 1024*1024*1024, 0); + + +static struct st_mysql_sys_var* cassandra_system_variables[]= { + MYSQL_SYSVAR(insert_batch_size), +// MYSQL_SYSVAR(enum_var), +// MYSQL_SYSVAR(ulong_var), + NULL +}; + + +Cassandra_status_vars cassandra_counters; +Cassandra_status_vars cassandra_counters_copy; + + /** @brief Function we use in the creation of our hash to get key. @@ -727,13 +744,16 @@ int ha_cassandra::write_row(uchar *buf) my_bitmap_map *old_map; DBUG_ENTER("ha_cassandra::write_row"); + if (!doing_insert_batch) + se->clear_insert_buffer(); + old_map= dbug_tmp_use_all_columns(table, table->read_set); /* Convert the key */ char *cass_key; int cass_key_len; rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); - se->start_prepare_insert(cass_key, cass_key_len); + se->start_row_insert(cass_key, cass_key_len); /* Convert other fields */ for (uint i= 1; i < table->s->fields; i++) @@ -747,7 +767,20 @@ int ha_cassandra::write_row(uchar *buf) dbug_tmp_restore_column_map(table->read_set, old_map); - bool res= se->do_insert(); + bool res; + + if (doing_insert_batch) + { + res= 0; + if (++insert_rows_batched >= /*insert_batch_size*/ + THDVAR(table->in_use, insert_batch_size)) + { + res= se->do_insert(); + insert_rows_batched= 0; + } + } + else + res= se->do_insert(); if (res) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); @@ -756,6 +789,28 @@ int ha_cassandra::write_row(uchar *buf) } +void ha_cassandra::start_bulk_insert(ha_rows rows) +{ + doing_insert_batch= true; + insert_rows_batched= 0; + + se->clear_insert_buffer(); +} + + +int ha_cassandra::end_bulk_insert() +{ + DBUG_ENTER("ha_cassandra::end_bulk_insert"); + + /* Flush out the insert buffer */ + doing_insert_batch= false; + bool bres= se->do_insert(); + se->clear_insert_buffer(); + + DBUG_RETURN(bres? HA_ERR_INTERNAL_ERROR: 0); +} + + int ha_cassandra::rnd_init(bool scan) { bool bres; @@ -893,19 +948,14 @@ int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) DBUG_RETURN(rc); } -#if 0 -void ha_cassandra::start_bulk_insert(ha_rows rows) -{ - /* Do nothing? */ -} - -int ha_cassandra::end_bulk_insert() +int ha_cassandra::reset() { - // TODO! + doing_insert_batch= false; return 0; } -#endif + + ///////////////////////////////////////////////////////////////////////////// // Dummy implementations start ///////////////////////////////////////////////////////////////////////////// @@ -1023,20 +1073,32 @@ bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info, // Dummy implementations end ///////////////////////////////////////////////////////////////////////////// - -static struct st_mysql_sys_var* cassandra_system_variables[]= { -// MYSQL_SYSVAR(enum_var), -// MYSQL_SYSVAR(ulong_var), - NULL +static SHOW_VAR cassandra_status_variables[]= { + {"row_inserts", + (char*) &cassandra_counters.row_inserts, SHOW_LONG}, + {"row_insert_batches", + (char*) &cassandra_counters.row_insert_batches, SHOW_LONG}, + {NullS, NullS, SHOW_LONG} }; +static int show_cassandra_vars(THD *thd, SHOW_VAR *var, char *buff) +{ + //innodb_export_status(); + cassandra_counters_copy= cassandra_counters; + + var->type= SHOW_ARRAY; + var->value= (char *) &cassandra_status_variables; + return 0; +} + + struct st_mysql_storage_engine cassandra_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; static struct st_mysql_show_var func_status[]= { -// {"example_func_example", (char *)show_func_example, SHOW_FUNC}, + {"Cassandra", (char *)show_cassandra_vars, SHOW_FUNC}, {0,0,SHOW_UNDEF} }; diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 469440a0049..c8042cfb14a 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -47,6 +47,9 @@ class ha_cassandra: public handler void read_cassandra_columns(bool unpack_pk); ha_rows rnd_batch_size; + + bool doing_insert_batch; + ha_rows insert_rows_batched; public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() @@ -145,10 +148,12 @@ public: */ virtual double read_time(uint, uint, ha_rows rows) { return (double) rows / 20.0+1; } -#if 0 + virtual void start_bulk_insert(ha_rows rows); virtual int end_bulk_insert(); -#endif + + virtual int reset(); + /* Everything below are methods that we implement in ha_example.cc. From 8eb16159e19b38e67728fca7c7f316f921a2c7e0 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 27 Aug 2012 08:44:58 +0400 Subject: [PATCH 194/439] Cassandra storage engine: BKA support - We use HA_MRR_NO_ASSOC ("optimizer_switch=join_cache_hashed") mode - Not able to use BKA's buffers yet. - There is a variable to control batch size - There are status counters. - Nedeed to make some fixes in BKA code (to be checked with Igor) --- mysql-test/r/cassandra.result | 64 ++++++++++++ mysql-test/t/cassandra.test | 35 +++++++ sql/sql_join_cache.cc | 5 +- storage/cassandra/cassandra_se.cc | 82 ++++++++++++++- storage/cassandra/cassandra_se.h | 14 ++- storage/cassandra/ha_cassandra.cc | 161 ++++++++++++++++++++++++++++-- storage/cassandra/ha_cassandra.h | 18 ++++ 7 files changed, 365 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 3b78bd5466a..096e501ceae 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -79,6 +79,7 @@ Cassandra_row_inserts 8 Cassandra_row_insert_batches 7 CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +delete from t1; INSERT INTO t1 VALUES (1,1),(2,2); DELETE FROM t1 ORDER BY a LIMIT 1; DROP TABLE t1; @@ -92,3 +93,66 @@ show status like 'cassandra_row_insert%'; Variable_name Value Cassandra_row_inserts 10 Cassandra_row_insert_batches 8 +# +# Batched Key Access +# +# Control variable (we are not yet able to make use of MRR's buffer) +show variables like 'cassandra_multi%'; +Variable_name Value +cassandra_multiget_batch_size 100 +# MRR-related status variables: +show status like 'cassandra_multi%'; +Variable_name Value +Cassandra_multiget_reads 0 +Cassandra_multiget_keys_scanned 0 +Cassandra_multiget_rows_read 0 +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +delete from t1; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +set @tmp_jcl=@@join_cache_level; +set join_cache_level=8; +explain select * from t1 A, t1 B where B.rowkey=A.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE A ALL NULL NULL NULL NULL 1000 Using where +1 SIMPLE B eq_ref PRIMARY PRIMARY 8 test.A.a 1 Using join buffer (flat, BKAH join); multiget_slice +select * from t1 A, t1 B where B.rowkey=A.a; +rowkey a rowkey a +0 0 0 0 +1 1 1 1 +2 2 2 2 +3 3 3 3 +4 4 4 4 +5 5 5 5 +6 6 6 6 +7 7 7 7 +8 8 8 8 +9 9 9 9 +show status like 'cassandra_multi%'; +Variable_name Value +Cassandra_multiget_reads 1 +Cassandra_multiget_keys_scanned 10 +Cassandra_multiget_rows_read 10 +insert into t1 values(1, 8); +insert into t1 values(3, 8); +insert into t1 values(5, 8); +insert into t1 values(7, 8); +select * from t1 A, t1 B where B.rowkey=A.a; +rowkey a rowkey a +0 0 0 0 +2 2 2 2 +4 4 4 4 +6 6 6 6 +1 8 8 8 +7 8 8 8 +8 8 8 8 +5 8 8 8 +3 8 8 8 +9 9 9 9 +show status like 'cassandra_multi%'; +Variable_name Value +Cassandra_multiget_reads 2 +Cassandra_multiget_keys_scanned 16 +Cassandra_multiget_rows_read 16 +delete from t1; +drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 195f365a372..2d76a4aeb71 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -117,6 +117,7 @@ show status like 'cassandra_row_insert%'; CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +delete from t1; INSERT INTO t1 VALUES (1,1),(2,2); DELETE FROM t1 ORDER BY a LIMIT 1; @@ -127,6 +128,40 @@ show status like 'cassandra_row_insert%'; flush status; show status like 'cassandra_row_insert%'; +--echo # +--echo # Batched Key Access +--echo # + +--echo # Control variable (we are not yet able to make use of MRR's buffer) +show variables like 'cassandra_multi%'; + +--echo # MRR-related status variables: +show status like 'cassandra_multi%'; + +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +delete from t1; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); + +set @tmp_jcl=@@join_cache_level; +set join_cache_level=8; +explain select * from t1 A, t1 B where B.rowkey=A.a; + +select * from t1 A, t1 B where B.rowkey=A.a; +show status like 'cassandra_multi%'; + +# The following INSERTs are really UPDATEs +insert into t1 values(1, 8); +insert into t1 values(3, 8); +insert into t1 values(5, 8); +insert into t1 values(7, 8); + +select * from t1 A, t1 B where B.rowkey=A.a; +show status like 'cassandra_multi%'; + + +delete from t1; +drop table t1; ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index f953cf4df57..d785366ae69 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -3876,8 +3876,11 @@ int JOIN_TAB_SCAN_MRR::next() If a record in in an incremental cache contains no fields then the association for the last record in cache will be equal to cache->end_pos */ + /* + psergey: this makes no sense where HA_MRR_NO_ASSOC is used. DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) && (uchar *) (*ptr) <= cache->end_pos); + */ if (join_tab->table->vfield) update_virtual_fields(join->thd, join_tab->table); } @@ -4543,7 +4546,7 @@ bool JOIN_CACHE_BKAH::prepare_look_for_matches(bool skip_last) { last_matching_rec_ref_ptr= next_matching_rec_ref_ptr= 0; if (no_association && - (curr_matching_chain= get_matching_chain_by_join_key())) + !(curr_matching_chain= get_matching_chain_by_join_key())) //psergey: added '!' return 1; last_matching_rec_ref_ptr= get_next_rec_ref(curr_matching_chain); return 0; diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 75ce33cb981..27ff83f7c0d 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -100,7 +100,18 @@ public: /* Setup that's necessary before a multi-row read. (todo: use it before point lookups, too) */ void clear_read_columns(); void add_read_column(const char *name); - + + /* Reads, MRR scans */ + void new_lookup_keys(); + int add_lookup_key(const char *key, size_t key_len); + bool multiget_slice(); + + std::vector mrr_keys; /* TODO: can we use allocator to put them onto MRR buffer? */ + std::map > mrr_result; + std::map >::iterator mrr_result_it; + + bool get_next_multiget_row(); + bool truncate(); bool remove_row(); @@ -522,3 +533,72 @@ bool Cassandra_se_impl::remove_row() return res; } + +///////////////////////////////////////////////////////////////////////////// +// MRR reads +///////////////////////////////////////////////////////////////////////////// + +void Cassandra_se_impl::new_lookup_keys() +{ + mrr_keys.clear(); +} + + +int Cassandra_se_impl::add_lookup_key(const char *key, size_t key_len) +{ + mrr_keys.push_back(std::string(key, key_len)); + return mrr_keys.size(); +} + + +bool Cassandra_se_impl::multiget_slice() +{ + ColumnParent cparent; + cparent.column_family= column_family; + + SlicePredicate slice_pred; + SliceRange sr; + sr.start = ""; + sr.finish = ""; + slice_pred.__set_slice_range(sr); + + bool res= true; + + try { + + cassandra_counters.multiget_reads++; + cassandra_counters.multiget_keys_scanned += mrr_keys.size(); + + cass->multiget_slice(mrr_result, mrr_keys, cparent, slice_pred, + cur_consistency_level); + + cassandra_counters.multiget_rows_read += mrr_result.size(); + + res= false; + mrr_result_it= mrr_result.begin(); + + } catch (InvalidRequestException ire) { + print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (UnavailableException ue) { + print_error("UnavailableException: %s", ue.what()); + } catch (TimedOutException te) { + print_error("TimedOutException: %s", te.what()); + } + + return res; +} + + +bool Cassandra_se_impl::get_next_multiget_row() +{ + if (mrr_result_it == mrr_result.end()) + return true; /* EOF */ + + column_data_vec= mrr_result_it->second; + rowkey= mrr_result_it->first; + + column_data_it= column_data_vec.begin(); + mrr_result_it++; + return false; +} + diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 78bf1016fea..d2ece4d9441 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -41,11 +41,16 @@ public: /* Reads, multi-row scans */ int read_batch_size; - virtual bool get_range_slices(bool last_key_as_start_key)=0; virtual void finish_reading_range_slices()=0; virtual bool get_next_range_slice_row(bool *eof)=0; + /* Reads, MRR scans */ + virtual void new_lookup_keys()=0; + virtual int add_lookup_key(const char *key, size_t key_len)=0; + virtual bool multiget_slice()=0; + virtual bool get_next_multiget_row()=0; + /* read_set setup */ virtual void clear_read_columns()=0; virtual void add_read_column(const char *name)=0; @@ -59,13 +64,20 @@ public: void print_error(const char *format, ...); }; + /* A structure with global counters */ class Cassandra_status_vars { public: ulong row_inserts; ulong row_insert_batches; + + ulong multiget_reads; + ulong multiget_keys_scanned; + ulong multiget_rows_read; }; + + extern Cassandra_status_vars cassandra_counters; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 70d389d4992..9e94c848988 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -60,15 +60,35 @@ static MYSQL_THDVAR_ULONG(insert_batch_size, PLUGIN_VAR_RQCMDARG, "Number of rows in an INSERT batch", NULL, NULL, /*default*/ 100, /*min*/ 1, /*max*/ 1024*1024*1024, 0); +static MYSQL_THDVAR_ULONG(multiget_batch_size, PLUGIN_VAR_RQCMDARG, + "Number of rows in a multiget(MRR) batch", + NULL, NULL, /*default*/ 100, /*min*/ 1, /*max*/ 1024*1024*1024, 0); static struct st_mysql_sys_var* cassandra_system_variables[]= { MYSQL_SYSVAR(insert_batch_size), + MYSQL_SYSVAR(multiget_batch_size), // MYSQL_SYSVAR(enum_var), // MYSQL_SYSVAR(ulong_var), NULL }; +static SHOW_VAR cassandra_status_variables[]= { + {"row_inserts", + (char*) &cassandra_counters.row_inserts, SHOW_LONG}, + {"row_insert_batches", + (char*) &cassandra_counters.row_insert_batches, SHOW_LONG}, + + {"multiget_reads", + (char*) &cassandra_counters.multiget_reads, SHOW_LONG}, + {"multiget_keys_scanned", + (char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG}, + {"multiget_rows_read", + (char*) &cassandra_counters.multiget_rows_read, SHOW_LONG}, + {NullS, NullS, SHOW_LONG} +}; + + Cassandra_status_vars cassandra_counters; Cassandra_status_vars cassandra_counters_copy; @@ -772,8 +792,7 @@ int ha_cassandra::write_row(uchar *buf) if (doing_insert_batch) { res= 0; - if (++insert_rows_batched >= /*insert_batch_size*/ - THDVAR(table->in_use, insert_batch_size)) + if (++insert_rows_batched >= THDVAR(table->in_use, insert_batch_size)) { res= se->do_insert(); insert_rows_batched= 0; @@ -955,6 +974,135 @@ int ha_cassandra::reset() return 0; } +///////////////////////////////////////////////////////////////////////////// +// MRR implementation +///////////////////////////////////////////////////////////////////////////// + + +/* + - The key can be only primary key + - allow equality-ranges only. + - anything else? +*/ +ha_rows ha_cassandra::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost) +{ + /* No support for const ranges so far */ + return HA_POS_ERROR; +} + + +ha_rows ha_cassandra::multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint key_parts, uint *bufsz, + uint *flags, COST_VECT *cost) +{ + /* Can only be equality lookups on the primary key... */ + // TODO anything else? + *flags &= ~HA_MRR_USE_DEFAULT_IMPL; + *flags |= HA_MRR_NO_ASSOCIATION; + + return 10; +} + + +int ha_cassandra::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf) +{ + int res; + mrr_iter= seq->init(seq_init_param, n_ranges, mode); + mrr_funcs= *seq; + res= mrr_start_read(); + return (res? HA_ERR_INTERNAL_ERROR: 0); +} + + +bool ha_cassandra::mrr_start_read() +{ + uint key_len; + + my_bitmap_map *old_map; + old_map= dbug_tmp_use_all_columns(table, table->read_set); + + se->new_lookup_keys(); + + while (!(source_exhausted= mrr_funcs.next(mrr_iter, &mrr_cur_range))) + { + char *cass_key; + int cass_key_len; + + DBUG_ASSERT(mrr_cur_range.range_flag & EQ_RANGE); + + uchar *key= (uchar*)mrr_cur_range.start_key.key; + key_len= mrr_cur_range.start_key.length; + //key_len= calculate_key_len(table, active_index, key, keypart_map); // NEED THIS?? + store_key_image_to_rec(table->field[0], (uchar*)key, key_len); + + rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); + + // Primitive buffer control + if (se->add_lookup_key(cass_key, cass_key_len) > + THDVAR(table->in_use, multiget_batch_size)) + break; + } + + dbug_tmp_restore_column_map(table->read_set, old_map); + + return se->multiget_slice(); +} + + +int ha_cassandra::multi_range_read_next(range_id_t *range_info) +{ + int res; + while(1) + { + if (!se->get_next_multiget_row()) + { + read_cassandra_columns(true); + res= 0; + break; + } + else + { + if (source_exhausted) + { + res= HA_ERR_END_OF_FILE; + break; + } + else + { + if (mrr_start_read()) + { + res= HA_ERR_INTERNAL_ERROR; + break; + } + } + } + /* + We get here if we've refilled the buffer and done another read. Try + reading from results again + */ + } + return res; +} + + +int ha_cassandra::multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) +{ + const char *mrr_str= "multiget_slice"; + + if (!(mrr_mode & HA_MRR_USE_DEFAULT_IMPL)) + { + uint mrr_str_len= strlen(mrr_str); + uint copy_len= min(mrr_str_len, size); + memcpy(str, mrr_str, size); + return copy_len; + } + return 0; +} + ///////////////////////////////////////////////////////////////////////////// // Dummy implementations start @@ -1073,15 +1221,6 @@ bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info, // Dummy implementations end ///////////////////////////////////////////////////////////////////////////// -static SHOW_VAR cassandra_status_variables[]= { - {"row_inserts", - (char*) &cassandra_counters.row_inserts, SHOW_LONG}, - {"row_insert_batches", - (char*) &cassandra_counters.row_insert_batches, SHOW_LONG}, - {NullS, NullS, SHOW_LONG} -}; - - static int show_cassandra_vars(THD *thd, SHOW_VAR *var, char *buff) { //innodb_export_status(); diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index c8042cfb14a..66e79f4ee70 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -154,6 +154,24 @@ public: virtual int reset(); + + int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf); + int multi_range_read_next(range_id_t *range_info); + ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost); + ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint key_parts, uint *bufsz, + uint *flags, COST_VECT *cost); + int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size); + +private: + bool source_exhausted; + bool mrr_start_read(); +public: + /* Everything below are methods that we implement in ha_example.cc. From 4fb57747fe90a148c25089f813bba56cbd230aeb Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 27 Aug 2012 15:30:58 +0300 Subject: [PATCH 195/439] 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 196/439] From 869826d770e844608e5871a40610f676b8e0754b Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Tue, 28 Aug 2012 12:53:33 +0400 Subject: [PATCH 197/439] MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows - Remove HTON_CAN_RECREATE flag, re-create won't delete rows in cassandra. --- mysql-test/r/cassandra.result | 10 ++++++++++ mysql-test/t/cassandra.test | 12 +++++++++++- storage/cassandra/ha_cassandra.cc | 7 ++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 096e501ceae..bb41e9a010b 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -156,3 +156,13 @@ Cassandra_multiget_keys_scanned 16 Cassandra_multiget_rows_read 16 delete from t1; drop table t1; +# +# MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows +# +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2); +truncate table t1; +select * from t1; +rowkey a +drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 2d76a4aeb71..26e1cf85839 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -159,9 +159,19 @@ insert into t1 values(7, 8); select * from t1 A, t1 B where B.rowkey=A.a; show status like 'cassandra_multi%'; - delete from t1; drop table t1; + +--echo # +--echo # MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows +--echo # +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2); +truncate table t1; +select * from t1; +drop table t1; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 9e94c848988..5b1a411be6a 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -142,7 +142,12 @@ static int cassandra_init_func(void *p) cassandra_hton->state= SHOW_OPTION_YES; cassandra_hton->create= cassandra_create_handler; - cassandra_hton->flags= HTON_CAN_RECREATE; + /* + Don't specify HTON_CAN_RECREATE in flags. re-create is used by TRUNCATE + TABLE to create an *empty* table from scratch. Cassandra table won't be + emptied if re-created. + */ + cassandra_hton->flags= 0; cassandra_hton->table_options= cassandra_table_option_list; //cassandra_hton->field_options= example_field_option_list; cassandra_hton->field_options= NULL; From 108474f01bd7b6a1b0d8dff8927ed0d257523840 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Aug 2012 16:13:34 +0200 Subject: [PATCH 198/439] From c943dfd8b2374b9c910ad08b1d08011fdd94257f Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Tue, 28 Aug 2012 20:22:45 +0400 Subject: [PATCH 199/439] MDEV-494, part #1: phantom row for big full-scan selects - Full table scan internally uses LIMIT n, and re-starts the scan from the last seen rowkey value. rowkey ranges are inclusive, so we will see the same rowkey again. We should ignore it. --- mysql-test/r/cassandra.result | 17 +++++++++++++++++ mysql-test/t/cassandra.test | 17 +++++++++++++++++ storage/cassandra/cassandra_se.cc | 25 +++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index bb41e9a010b..608eef2e629 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -166,3 +166,20 @@ truncate table t1; select * from t1; rowkey a drop table t1; +# +# MDEV-494, part #1: phantom row for big full-scan selects +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +insert into t1 select A.a + 10 * B.a + 100*C.a, 12345 from t0 A, t0 B, t0 C; +select count(*) from t1; +count(*) +1000 +select count(*) from t1 where a=12345; +count(*) +1000 +delete from t1; +drop table t1; +drop table t0; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 26e1cf85839..9d395ae3474 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -172,6 +172,23 @@ truncate table t1; select * from t1; drop table t1; +--echo # +--echo # MDEV-494, part #1: phantom row for big full-scan selects +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; + +insert into t1 select A.a + 10 * B.a + 100*C.a, 12345 from t0 A, t0 B, t0 C; + +select count(*) from t1; +select count(*) from t1 where a=12345; + +delete from t1; +drop table t1; +drop table t0; ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 27ff83f7c0d..d74f6c9444a 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -93,6 +93,10 @@ public: void get_read_rowkey(char **value, int *value_len); /* Reads, multi-row scans */ +private: + bool have_rowkey_to_skip; + std::string rowkey_to_skip; +public: bool get_range_slices(bool last_key_as_start_key); void finish_reading_range_slices(); bool get_next_range_slice_row(bool *eof); @@ -106,15 +110,17 @@ public: int add_lookup_key(const char *key, size_t key_len); bool multiget_slice(); +private: std::vector mrr_keys; /* TODO: can we use allocator to put them onto MRR buffer? */ std::map > mrr_result; std::map >::iterator mrr_result_it; - +public: bool get_next_multiget_row(); bool truncate(); bool remove_row(); +private: /* Non-inherited utility functions: */ int64_t get_i64_timestamp(); }; @@ -407,9 +413,17 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) key_range.__isset.end_key= true; if (last_key_as_start_key) + { key_range.start_key= rowkey; + + have_rowkey_to_skip= true; + rowkey_to_skip= rowkey; + } else + { + have_rowkey_to_skip= false; key_range.start_key.assign("", 0); + } key_range.end_key.assign("", 0); key_range.count= read_batch_size; @@ -441,6 +455,7 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) /* Switch to next row. This may produce an error */ bool Cassandra_se_impl::get_next_range_slice_row(bool *eof) { +restart: if (key_slice_it == key_slice_vec.end()) { if (get_slices_returned_less) @@ -462,7 +477,13 @@ bool Cassandra_se_impl::get_next_range_slice_row(bool *eof) return false; } } - + + if (have_rowkey_to_skip && !rowkey_to_skip.compare(key_slice_it->key)) + { + key_slice_it++; + goto restart; + } + *eof= false; column_data_vec= key_slice_it->columns; rowkey= key_slice_it->key; From c34b24ff88ccf6c5645b7c6bb469a08ca78af019 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 29 Aug 2012 07:39:22 +0400 Subject: [PATCH 200/439] Cassandra storage engine: add @@rnd_batch_size variable. --- mysql-test/t/cassandra.test | 1 + storage/cassandra/ha_cassandra.cc | 10 +++++++--- storage/cassandra/ha_cassandra.h | 2 -- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 9d395ae3474..bfefb987572 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -194,6 +194,7 @@ drop table t0; ############################################################################ --disable_parsing drop columnfamily cf1; +drop columnfamily cf2; --enable_parsing ############################################################################ ## Cassandra cleanup ends diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 5b1a411be6a..2c4b4371005 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -64,9 +64,14 @@ static MYSQL_THDVAR_ULONG(multiget_batch_size, PLUGIN_VAR_RQCMDARG, "Number of rows in a multiget(MRR) batch", NULL, NULL, /*default*/ 100, /*min*/ 1, /*max*/ 1024*1024*1024, 0); +static MYSQL_THDVAR_ULONG(rnd_batch_size, PLUGIN_VAR_RQCMDARG, + "Number of rows in an rnd_read (full scan) batch", + NULL, NULL, /*default*/ 10*1000, /*min*/ 1, /*max*/ 1024*1024*1024, 0); + static struct st_mysql_sys_var* cassandra_system_variables[]= { MYSQL_SYSVAR(insert_batch_size), MYSQL_SYSVAR(multiget_batch_size), + MYSQL_SYSVAR(rnd_batch_size), // MYSQL_SYSVAR(enum_var), // MYSQL_SYSVAR(ulong_var), NULL @@ -254,8 +259,7 @@ static handler* cassandra_create_handler(handlerton *hton, ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), - se(NULL), field_converters(NULL), rowkey_converter(NULL), - rnd_batch_size(10*1000) + se(NULL), field_converters(NULL), rowkey_converter(NULL) {} @@ -849,7 +853,7 @@ int ha_cassandra::rnd_init(bool scan) for (uint i= 1; i < table->s->fields; i++) se->add_read_column(table->field[i]->field_name); - se->read_batch_size= rnd_batch_size; + se->read_batch_size= THDVAR(table->in_use, rnd_batch_size); bres= se->get_range_slices(false); if (bres) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 66e79f4ee70..d5b542aae06 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -46,8 +46,6 @@ class ha_cassandra: public handler void read_cassandra_columns(bool unpack_pk); - ha_rows rnd_batch_size; - bool doing_insert_batch; ha_rows insert_rows_batched; public: From 22e71e4cc19b3c12f0c5721d6845ba7c28b25060 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 29 Aug 2012 10:05:21 +0400 Subject: [PATCH 201/439] Cassandra SE - Add mapping for INT datatype - Primary key column should now be named like CQL's primary key, or 'rowkey' if CF has key_alias. --- mysql-test/r/cassandra.result | 40 +++++++++++----- mysql-test/t/cassandra.test | 40 ++++++++++++++-- storage/cassandra/ha_cassandra.cc | 76 +++++++++++++++++++++++-------- 3 files changed, 120 insertions(+), 36 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 608eef2e629..a0447776582 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -1,10 +1,10 @@ drop table if exists t0, t1; create table t1 (a int) engine=cassandra thrift_host='localhost' keyspace='foo' column_family='colfam'; -ERROR 42000: Incorrect column name 'First column must be named 'rowkey'' +ERROR 42000: Incorrect column name 'First column must be NOT NULL' create table t1 (a int primary key, b int) engine=cassandra thrift_host='localhost' keyspace='foo' column_family='colfam'; -ERROR 42000: Incorrect column name 'First column must be named 'rowkey'' +ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace foo does not exist] create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='127.0.0.2' keyspace='foo' column_family='colfam'; ERROR HY000: Unable to connect to foreign data source: connect() failed: Connection refused [1] @@ -15,36 +15,36 @@ create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace'; ERROR HY000: Unable to connect to foreign data source: thrift_host, keyspace, and column_family table options must be s # Now, create a table for real and insert data -create table t1 (rowkey varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra +create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; # Just in case there were left-overs from previous: delete from t1; select * from t1; -rowkey data1 data2 +pk data1 data2 insert into t1 values ('rowkey10', 'data1-value', 123456); insert into t1 values ('rowkey11', 'data1-value2', 34543); insert into t1 values ('rowkey12', 'data1-value3', 454); select * from t1; -rowkey data1 data2 +pk data1 data2 rowkey12 data1-value3 454 rowkey10 data1-value 123456 rowkey11 data1-value2 34543 explain -select * from t1 where rowkey='rowkey11'; +select * from t1 where pk='rowkey11'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 38 const 1 -select * from t1 where rowkey='rowkey11'; -rowkey data1 data2 +select * from t1 where pk='rowkey11'; +pk data1 data2 rowkey11 data1-value2 34543 -delete from t1 where rowkey='rowkey11'; +delete from t1 where pk='rowkey11'; select * from t1; -rowkey data1 data2 +pk data1 data2 rowkey12 data1-value3 454 rowkey10 data1-value 123456 rowkey11 NULL NULL delete from t1; select * from t1; -rowkey data1 data2 +pk data1 data2 # # A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ, # also check ::rnd_pos() @@ -53,7 +53,7 @@ insert into t1 values ('rowkey10', 'data1-value', 123456); insert into t1 values ('rowkey11', 'data1-value2', 34543); insert into t1 values ('rowkey12', 'data1-value3', 454); select * from t1 order by data2; -rowkey data1 data2 +pk data1 data2 rowkey12 data1-value3 454 rowkey11 data1-value2 34543 rowkey10 data1-value 123456 @@ -183,3 +183,19 @@ count(*) delete from t1; drop table t1; drop table t0; +# 32-bit INT type support +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, intcol INT) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3'; +insert into t1 values (10,10); +insert into t1 values (12,12); +delete from t1; +drop table t1; +# +# Try accessing column family w/o explicitly defined columns +# +CREATE TABLE t1 (my_primary_key varchar(10) PRIMARY KEY) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10'; +ERROR HY000: Internal error: 'target column family has no key_alias defined, PRIMARY KEY column must be named 'rowkey'' +CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10'; +DROP TABLE t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index bfefb987572..c35c15da8ca 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -12,7 +12,7 @@ drop table if exists t0, t1; create table t1 (a int) engine=cassandra thrift_host='localhost' keyspace='foo' column_family='colfam'; ---error ER_WRONG_COLUMN_NAME +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE create table t1 (a int primary key, b int) engine=cassandra thrift_host='localhost' keyspace='foo' column_family='colfam'; @@ -45,13 +45,22 @@ create columnfamily cf1 ( pk varchar primary key, data1 varchar, data2 bigint); create columnfamily cf2 (rowkey bigint primary key, a bigint); +create columnfamily cf3 (rowkey bigint primary key, intcol int); + +./cassandra-cli + +CREATE COLUMN FAMILY cf10 + WITH comparator = UTF8Type + AND key_validation_class=UTF8Type + AND default_validation_class = UTF8Type; + --enable_parsing ############################################################################ ## Cassandra initialization ends ############################################################################ --echo # Now, create a table for real and insert data -create table t1 (rowkey varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra +create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; --echo # Just in case there were left-overs from previous: @@ -64,8 +73,8 @@ insert into t1 values ('rowkey12', 'data1-value3', 454); select * from t1; explain -select * from t1 where rowkey='rowkey11'; -select * from t1 where rowkey='rowkey11'; +select * from t1 where pk='rowkey11'; +select * from t1 where pk='rowkey11'; # Deletion functions weirdly: it sets all columns to NULL # but when If I do this in cassandra-cli: @@ -80,7 +89,7 @@ select * from t1 where rowkey='rowkey11'; # # CQL seems to simply ignore all "incomplete" records. -delete from t1 where rowkey='rowkey11'; +delete from t1 where pk='rowkey11'; select * from t1; delete from t1; @@ -189,6 +198,27 @@ select count(*) from t1 where a=12345; delete from t1; drop table t1; drop table t0; + +--echo # 32-bit INT type support +CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, intcol INT) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3'; +insert into t1 values (10,10); +insert into t1 values (12,12); +delete from t1; +drop table t1; + +--echo # +--echo # Try accessing column family w/o explicitly defined columns +--echo # +--error ER_INTERNAL_ERROR +CREATE TABLE t1 (my_primary_key varchar(10) PRIMARY KEY) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10'; + +CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10'; + +DROP TABLE t1; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 2c4b4371005..1778622ae9f 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -342,23 +342,16 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, ha_table_option_struct *options= table_arg->s->option_struct; DBUG_ENTER("ha_cassandra::create"); DBUG_ASSERT(options); - //psergey-todo: This is called for CREATE TABLE... check options here. -/* - if (table_arg->s->fields != 2) - { - my_error(ER_WRONG_COLUMN_NAME, MYF(0), "The table must have two fields"); - DBUG_RETURN(HA_WRONG_CREATE_OPTION); - } -*/ Field **pfield= table_arg->s->field; +/* if (strcmp((*pfield)->field_name, "rowkey")) { my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be named 'rowkey'"); DBUG_RETURN(HA_WRONG_CREATE_OPTION); } - +*/ if (!((*pfield)->flags & NOT_NULL_FLAG)) { my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be NOT NULL"); @@ -369,11 +362,11 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, table_arg->key_info[0].key_parts != 1 || table_arg->key_info[0].key_part[0].fieldnr != 1) { - my_error(ER_WRONG_COLUMN_NAME, MYF(0), "Table must have one PRIMARY KEY(rowkey)"); + my_error(ER_WRONG_COLUMN_NAME, MYF(0), + "Table must have PRIMARY KEY defined over the first column"); DBUG_RETURN(HA_WRONG_CREATE_OPTION); } - #ifndef DBUG_OFF /* DBUG_PRINT("info", ("strparam: '%-.64s' ullparam: %llu enumparam: %u "\ @@ -519,6 +512,36 @@ public: }; +class Int32DataConverter : public ColumnDataConverter +{ + int32_t buf; +public: + void flip(const char *from, char* to) + { + to[0]= from[3]; + to[1]= from[2]; + to[2]= from[1]; + to[3]= from[0]; + } + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + int32_t tmp; + DBUG_ASSERT(cass_data_len == sizeof(int32_t)); + flip(cass_data, (char*)&tmp); + field->store(tmp); + } + + void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + int32_t tmp= field->val_int(); + flip((const char*)&tmp, (char*)&buf); + *cass_data= (char*)&buf; + *cass_data_len=sizeof(int32_t); + } + ~Int32DataConverter(){} +}; + + class StringCopyConverter : public ColumnDataConverter { String buf; @@ -557,15 +580,16 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ switch(field->type()) { case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: - case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONGLONG: if (!strcmp(validator_name, validator_bigint)) res= new BigintDataConverter; break; + case MYSQL_TYPE_FLOAT: if (!strcmp(validator_name, validator_float)) res= new FloatDataConverter; break; + case MYSQL_TYPE_DOUBLE: if (!strcmp(validator_name, validator_double)) res= new DoubleDataConverter; @@ -581,6 +605,12 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ res= new StringCopyConverter; } break; + + case MYSQL_TYPE_LONG: + if (!strcmp(validator_name, validator_int)) + res= new Int32DataConverter; + break; + default:; } return res; @@ -601,11 +631,6 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) bzero(field_converters, memsize); n_field_converters= n_fields; - /* - TODO: what about mapping the primary key? It has a 'type', too... - see CfDef::key_validation_class ? see also CfDef::key_alias? - */ - se->first_ddl_column(); uint n_mapped= 0; while (!se->next_ddl_column(&col_name, &col_name_len, &col_type, @@ -634,10 +659,23 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) return true; /* - Setup type conversion for row_key. It may also have a name, but we ignore - it currently + Setup type conversion for row_key. */ se->get_rowkey_type(&col_name, &col_type); + if (col_name && strcmp(col_name, (*field_arg)->field_name)) + { + se->print_error("PRIMARY KEY column must match Cassandra's name '%s'", col_name); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + return true; + } + if (!col_name && strcmp("rowkey", (*field_arg)->field_name)) + { + se->print_error("target column family has no key_alias defined, " + "PRIMARY KEY column must be named 'rowkey'"); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + return true; + } + if (col_type != NULL) { if (!(rowkey_converter= map_field_to_validator(*field_arg, col_type))) From fd53cbbff61bcfb882c11f3dab3a020262736ce4 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 29 Aug 2012 11:05:46 +0400 Subject: [PATCH 202/439] Cassandra SE: Timestamp data type support. --- mysql-test/r/cassandra.result | 12 +++++ mysql-test/t/cassandra.test | 14 ++++++ storage/cassandra/ha_cassandra.cc | 81 ++++++++++++++++++++++--------- 3 files changed, 84 insertions(+), 23 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index a0447776582..e7f34860444 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -199,3 +199,15 @@ ERROR HY000: Internal error: 'target column family has no key_alias defined, PRI CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10'; DROP TABLE t1; +# +# Timestamp datatype support +# +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +delete from t2; +insert into t2 values (1, '2012-08-29 01:23:45'); +select * from t2; +rowkey datecol +1 2012-08-29 01:23:45 +delete from t2; +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index c35c15da8ca..052afdad89e 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -47,6 +47,8 @@ create columnfamily cf2 (rowkey bigint primary key, a bigint); create columnfamily cf3 (rowkey bigint primary key, intcol int); +create columnfamily cf4 (rowkey bigint primary key, datecol timestamp); + ./cassandra-cli CREATE COLUMN FAMILY cf10 @@ -219,6 +221,18 @@ CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY) ENGINE=CASSANDRA DROP TABLE t1; +--echo # +--echo # Timestamp datatype support +--echo # +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; + +delete from t2; +insert into t2 values (1, '2012-08-29 01:23:45'); +select * from t2; +delete from t2; + +drop table t2; ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 1778622ae9f..519190ad5d2 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -477,64 +477,64 @@ public: ~FloatDataConverter(){} }; +static void flip64(const char *from, char* to) +{ + to[0]= from[7]; + to[1]= from[6]; + to[2]= from[5]; + to[3]= from[4]; + to[4]= from[3]; + to[5]= from[2]; + to[6]= from[1]; + to[7]= from[0]; +} class BigintDataConverter : public ColumnDataConverter { longlong buf; public: - void flip(const char *from, char* to) - { - to[0]= from[7]; - to[1]= from[6]; - to[2]= from[5]; - to[3]= from[4]; - to[4]= from[3]; - to[5]= from[2]; - to[6]= from[1]; - to[7]= from[0]; - } void cassandra_to_mariadb(const char *cass_data, int cass_data_len) { longlong tmp; DBUG_ASSERT(cass_data_len == sizeof(longlong)); - flip(cass_data, (char*)&tmp); + flip64(cass_data, (char*)&tmp); field->store(tmp); } void mariadb_to_cassandra(char **cass_data, int *cass_data_len) { longlong tmp= field->val_int(); - flip((const char*)&tmp, (char*)&buf); + flip64((const char*)&tmp, (char*)&buf); *cass_data= (char*)&buf; *cass_data_len=sizeof(longlong); } ~BigintDataConverter(){} }; +static void flip32(const char *from, char* to) +{ + to[0]= from[3]; + to[1]= from[2]; + to[2]= from[1]; + to[3]= from[0]; +} class Int32DataConverter : public ColumnDataConverter { int32_t buf; public: - void flip(const char *from, char* to) - { - to[0]= from[3]; - to[1]= from[2]; - to[2]= from[1]; - to[3]= from[0]; - } void cassandra_to_mariadb(const char *cass_data, int cass_data_len) { int32_t tmp; DBUG_ASSERT(cass_data_len == sizeof(int32_t)); - flip(cass_data, (char*)&tmp); + flip32(cass_data, (char*)&tmp); field->store(tmp); } void mariadb_to_cassandra(char **cass_data, int *cass_data_len) { int32_t tmp= field->val_int(); - flip((const char*)&tmp, (char*)&buf); + flip32((const char*)&tmp, (char*)&buf); *cass_data= (char*)&buf; *cass_data_len=sizeof(int32_t); } @@ -561,6 +561,34 @@ public: }; +class TimestampDataConverter : public ColumnDataConverter +{ + int64_t buf; +public: + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + int64_t tmp; + DBUG_ASSERT(cass_data_len==8); + flip64(cass_data, (char*)&tmp); + ((Field_timestamp*)field)->store_TIME(tmp / 1000, tmp % 1000); + } + + void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + my_time_t ts_time; + ulong ts_millis; + int64_t tmp; + ts_time= ((Field_timestamp*)field)->get_timestamp(&ts_millis); + + tmp= ts_time * 1000 + ts_millis; + flip64((const char*)&tmp, (char*)&buf); + + *cass_data= (char*)&buf; + *cass_data_len= 8; + } + ~TimestampDataConverter(){} +}; + const char * const validator_bigint= "org.apache.cassandra.db.marshal.LongType"; const char * const validator_int= "org.apache.cassandra.db.marshal.Int32Type"; const char * const validator_counter= "org.apache.cassandra.db.marshal.CounterColumnType"; @@ -572,6 +600,7 @@ const char * const validator_blob= "org.apache.cassandra.db.marshal.BytesType const char * const validator_ascii= "org.apache.cassandra.db.marshal.AsciiType"; const char * const validator_text= "org.apache.cassandra.db.marshal.UTF8Type"; +const char * const validator_timestamp="org.apache.cassandra.db.marshal.DateType"; ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) { @@ -581,7 +610,8 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONGLONG: - if (!strcmp(validator_name, validator_bigint)) + if (!strcmp(validator_name, validator_bigint) || + 0/*!strcmp(validator_name, validator_timestamp)*/) res= new BigintDataConverter; break; @@ -594,6 +624,11 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ if (!strcmp(validator_name, validator_double)) res= new DoubleDataConverter; break; + + case MYSQL_TYPE_TIMESTAMP: + if (!strcmp(validator_name, validator_timestamp)) + res= new TimestampDataConverter; + break; case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VARCHAR: From 6a827daf61cd1a999e9191d6815c9ade4c0a3f78 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 29 Aug 2012 11:14:04 +0400 Subject: [PATCH 203/439] Fix for the previous cset: Field::store_TIME() accepts microseconds fraction, not millisecond. --- storage/cassandra/ha_cassandra.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 519190ad5d2..fcaf4bd0fc1 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -567,20 +567,27 @@ class TimestampDataConverter : public ColumnDataConverter public: void cassandra_to_mariadb(const char *cass_data, int cass_data_len) { + /* Cassandra data is milliseconds-since-epoch in network byte order */ int64_t tmp; DBUG_ASSERT(cass_data_len==8); flip64(cass_data, (char*)&tmp); - ((Field_timestamp*)field)->store_TIME(tmp / 1000, tmp % 1000); + /* + store_TIME's arguments: + - seconds since epoch + - microsecond fraction of a second. + */ + ((Field_timestamp*)field)->store_TIME(tmp / 1000, (tmp % 1000)*1000); } - + void mariadb_to_cassandra(char **cass_data, int *cass_data_len) { my_time_t ts_time; - ulong ts_millis; + ulong ts_microsec; int64_t tmp; - ts_time= ((Field_timestamp*)field)->get_timestamp(&ts_millis); - - tmp= ts_time * 1000 + ts_millis; + ts_time= ((Field_timestamp*)field)->get_timestamp(&ts_microsec); + + /* Cassandra needs milliseconds-since-epoch */ + tmp= ts_time * 1000 + ts_microsec/1000; flip64((const char*)&tmp, (char*)&buf); *cass_data= (char*)&buf; From 29e9406a82a00e6ec81a65e0254d9527ba25ba20 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 29 Aug 2012 20:27:11 +0400 Subject: [PATCH 204/439] Cassandra SE: fix batched insert to flush its buffers after insert operation. --- mysql-test/r/cassandra.result | 15 +++++++++++ mysql-test/t/cassandra.test | 44 +++++++++++++++++++++++++++++++ storage/cassandra/cassandra_se.cc | 11 ++++++++ 3 files changed, 70 insertions(+) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index e7f34860444..8f4b261b5ae 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -210,4 +210,19 @@ select * from t2; rowkey datecol 1 2012-08-29 01:23:45 delete from t2; +# +# (no MDEV#) Check that insert counters work correctly +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +set cassandra_insert_batch_size=10; +insert into t2 select A.a+10*B.a, now() from t0 A, t0 B; +inserts insert_batches +100 10 +set cassandra_insert_batch_size=1; +insert into t2 select A.a+10*B.a+100, now() from t0 A, t0 B; +inserts insert_batches +100 100 +delete from t2; drop table t2; +drop table t0; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 052afdad89e..9abe9448c45 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -232,7 +232,51 @@ insert into t2 values (1, '2012-08-29 01:23:45'); select * from t2; delete from t2; +--echo # +--echo # (no MDEV#) Check that insert counters work correctly +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +let $start_inserts=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts'`; +let $start_insert_batches=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches'`; + +set cassandra_insert_batch_size=10; +insert into t2 select A.a+10*B.a, now() from t0 A, t0 B; + +--disable_query_log +eval select + (select variable_value - $start_inserts from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts') + AS 'inserts', + (select variable_value - $start_insert_batches from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches') + AS 'insert_batches'; +--enable_query_log + +let $start_inserts=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts'`; +let $start_insert_batches=`select variable_value from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches'`; + +set cassandra_insert_batch_size=1; +insert into t2 select A.a+10*B.a+100, now() from t0 A, t0 B; + +--disable_query_log +eval select + (select variable_value - $start_inserts from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_inserts') + AS 'inserts', + (select variable_value - $start_insert_batches from information_schema.SESSION_STATUS + where variable_name ='Cassandra_row_insert_batches') + AS 'insert_batches'; +--enable_query_log + +delete from t2; drop table t2; +drop table t0; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index d74f6c9444a..670c13c2e91 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -291,6 +291,15 @@ void Cassandra_se_impl::add_insert_column(const char *name, const char *value, bool Cassandra_se_impl::do_insert() { bool res= true; + + /* + zero-size mutations are allowed by Cassandra's batch_mutate but lets not + do them (we may attempt to do it if there is a bulk insert that stores + exactly @@cassandra_insert_batch_size*n elements. + */ + if (batch_mutation.empty()) + return false; + try { cass->batch_mutate(batch_mutation, cur_consistency_level); @@ -298,6 +307,7 @@ bool Cassandra_se_impl::do_insert() cassandra_counters.row_inserts+= batch_mutation.size(); cassandra_counters.row_insert_batches++; + clear_insert_buffer(); res= false; } catch (InvalidRequestException ire) { @@ -623,3 +633,4 @@ bool Cassandra_se_impl::get_next_multiget_row() return false; } + From 6cce520472989216ac57349f1ad6d4b2afe03c91 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 31 Aug 2012 10:49:36 +0400 Subject: [PATCH 205/439] Cassandra SE - add support for Cassandra's UUID datatype. We map it to CHAR(36). --- mysql-test/r/cassandra.result | 34 +++++++ mysql-test/t/cassandra.test | 49 ++++++++++ storage/cassandra/cassandra_se.cc | 3 +- storage/cassandra/ha_cassandra.cc | 150 +++++++++++++++++++++++++++--- storage/cassandra/ha_cassandra.h | 3 + 5 files changed, 222 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 8f4b261b5ae..a340ae75f62 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -226,3 +226,37 @@ inserts insert_batches delete from t2; drop table t2; drop table t0; +# +# UUID datatype support +# +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; +insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09'); +insert into t2 values(2,'not-an-uuid'); +ERROR 22003: Out of range value for column 'uuidcol' at row 1 +insert into t2 values(3,'9b5658dc-f32f-11e1=94cd-f46d046e9f09'); +ERROR 22003: Out of range value for column 'uuidcol' at row 1 +insert into t2 values(4,'9b5658dc-fzzf-11e1-94cd-f46d046e9f09'); +ERROR 22003: Out of range value for column 'uuidcol' at row 1 +insert into t2 values +(5,'9b5658dc-f11f-11e1-94cd-f46d046e9f09'), +(6,'9b5658dc-f11f011e1-94cd-f46d046e9f09'); +ERROR 22003: Out of range value for column 'uuidcol' at row 2 +select * from t2; +rowkey uuidcol +1 9b5658dc-f32f-11e1-94cd-f46d046e9f09 +5 9b5658dc-f11f-11e1-94cd-f46d046e9f09 +delete from t2; +drop table t2; +CREATE TABLE t2 (rowkey char(36) PRIMARY KEY, col1 int) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf6'; +delete from t2; +insert into t2 values('9b5658dc-f32f-11e1-94cd-f46d046e9f09', 1234); +insert into t2 values('not-an-uuid', 563); +ERROR 22003: Out of range value for column 'rowkey' at row 1 +select * from t2; +rowkey col1 +9b5658dc-f32f-11e1-94cd-f46d046e9f09 1234 +delete from t2; +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 9abe9448c45..365cb5f8230 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -49,6 +49,10 @@ create columnfamily cf3 (rowkey bigint primary key, intcol int); create columnfamily cf4 (rowkey bigint primary key, datecol timestamp); +create columnfamily cf5 (rowkey bigint primary key, uuidcol uuid); + +create columnfamily cf6 (rowkey uuid primary key, col1 int); + ./cassandra-cli CREATE COLUMN FAMILY cf10 @@ -277,12 +281,57 @@ delete from t2; drop table t2; drop table t0; +--echo # +--echo # UUID datatype support +--echo # +#create columnfamily cf5 (rowkey bigint primary key, uuidcol uuid); +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; + +insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values(2,'not-an-uuid'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values(3,'9b5658dc-f32f-11e1=94cd-f46d046e9f09'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values(4,'9b5658dc-fzzf-11e1-94cd-f46d046e9f09'); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values + (5,'9b5658dc-f11f-11e1-94cd-f46d046e9f09'), + (6,'9b5658dc-f11f011e1-94cd-f46d046e9f09'); + +select * from t2; + +delete from t2; +drop table t2; + +# create columnfamily cf6 (rowkey uuid primary key, col1 int); +CREATE TABLE t2 (rowkey char(36) PRIMARY KEY, col1 int) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf6'; +delete from t2; + +insert into t2 values('9b5658dc-f32f-11e1-94cd-f46d046e9f09', 1234); + +--error ER_WARN_DATA_OUT_OF_RANGE +insert into t2 values('not-an-uuid', 563); + +select * from t2; +delete from t2; +drop table t2; + ############################################################################ ## Cassandra cleanup ############################################################################ --disable_parsing drop columnfamily cf1; drop columnfamily cf2; +drop columnfamily cf3; +drop columnfamily cf4; --enable_parsing ############################################################################ ## Cassandra cleanup ends diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 670c13c2e91..692bfb595da 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -416,9 +416,8 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) cparent.column_family= column_family; /* SlicePredicate can be used to limit columns we will retrieve */ - // Try passing nothing... - KeyRange key_range; // Try passing nothing, too. + KeyRange key_range; key_range.__isset.start_key= true; key_range.__isset.end_key= true; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index fcaf4bd0fc1..3be416e99cc 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -302,6 +302,7 @@ int ha_cassandra::open(const char *name, int mode, uint test_if_locked) } info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + insert_lineno= 0; DBUG_RETURN(0); } @@ -407,6 +408,7 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "setup_field_converters"); DBUG_RETURN(HA_ERR_NO_CONNECTION); } + insert_lineno= 0; DBUG_RETURN(0); } @@ -430,8 +432,13 @@ public: /* This will get data from the Field pointer, store Cassandra's form in internal buffer, and return pointer/size. + + @return + false - OK + true - Failed to convert value (completely, there is no value to insert + at all). */ - virtual void mariadb_to_cassandra(char **cass_data, int *cass_data_len)=0; + virtual bool mariadb_to_cassandra(char **cass_data, int *cass_data_len)=0; virtual ~ColumnDataConverter() {}; }; @@ -447,11 +454,12 @@ public: field->store(*pdata); } - void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { buf= field->val_real(); *cass_data= (char*)&buf; *cass_data_len=sizeof(double); + return false; } ~DoubleDataConverter(){} }; @@ -468,11 +476,12 @@ public: field->store(*pdata); } - void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { buf= field->val_real(); *cass_data= (char*)&buf; *cass_data_len=sizeof(float); + return false; } ~FloatDataConverter(){} }; @@ -501,12 +510,13 @@ public: field->store(tmp); } - void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { longlong tmp= field->val_int(); flip64((const char*)&tmp, (char*)&buf); *cass_data= (char*)&buf; *cass_data_len=sizeof(longlong); + return false; } ~BigintDataConverter(){} }; @@ -531,12 +541,13 @@ public: field->store(tmp); } - void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { int32_t tmp= field->val_int(); flip32((const char*)&tmp, (char*)&buf); *cass_data= (char*)&buf; *cass_data_len=sizeof(int32_t); + return false; } ~Int32DataConverter(){} }; @@ -551,11 +562,12 @@ public: field->store(cass_data, cass_data_len,field->charset()); } - void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { String *pstr= field->val_str(&buf); *cass_data= (char*)pstr->c_ptr(); *cass_data_len= pstr->length(); + return false; } ~StringCopyConverter(){} }; @@ -579,7 +591,7 @@ public: ((Field_timestamp*)field)->store_TIME(tmp / 1000, (tmp % 1000)*1000); } - void mariadb_to_cassandra(char **cass_data, int *cass_data_len) + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { my_time_t ts_time; ulong ts_microsec; @@ -592,10 +604,85 @@ public: *cass_data= (char*)&buf; *cass_data_len= 8; + return false; } ~TimestampDataConverter(){} }; + + +static int convert_hex_digit(const char c) +{ + int num; + if (c >= '0' && c <= '9') + num= c - '0'; + else if (c >= 'A' && c <= 'F') + num= c - 'A' + 10; + else if (c >= 'a' && c <= 'f') + num= c - 'a' + 10; + else + return -1; /* Couldn't convert */ + return num; +} + + +const char map2number[]="0123456789abcdef"; + +class UuidDataConverter : public ColumnDataConverter +{ + char buf[16]; /* Binary UUID representation */ + String str_buf; +public: + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + DBUG_ASSERT(cass_data_len==16); + char str[37]; + char *ptr= str; + /* UUID arrives as 16-byte number in network byte order */ + for (uint i=0; i < 16; i++) + { + *(ptr++)= map2number[(cass_data[i] >> 4) & 0xF]; + *(ptr++)= map2number[cass_data[i] & 0xF]; + if (i == 3 || i == 5 || i == 7 || i == 9) + *(ptr++)= '-'; + } + *ptr= 0; + field->store(str, 36,field->charset()); + } + + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + String *uuid_str= field->val_str(&str_buf); + char *pstr= (char*)uuid_str->c_ptr(); + + if (uuid_str->length() != 36) + return true; + + int lower, upper; + for (uint i=0; i < 16; i++) + { + if ((upper= convert_hex_digit(pstr[0])) == -1 || + (lower= convert_hex_digit(pstr[1])) == -1) + { + return true; + } + buf[i]= lower | (upper << 4); + pstr += 2; + if (i == 3 || i == 5 || i == 7 || i == 9) + { + if (pstr[0] != '-') + return true; + pstr++; + } + } + + *cass_data= buf; + *cass_data_len= 16; + return false; + } + ~UuidDataConverter(){} +}; + const char * const validator_bigint= "org.apache.cassandra.db.marshal.LongType"; const char * const validator_int= "org.apache.cassandra.db.marshal.Int32Type"; const char * const validator_counter= "org.apache.cassandra.db.marshal.CounterColumnType"; @@ -609,6 +696,8 @@ const char * const validator_text= "org.apache.cassandra.db.marshal.UTF8Type" const char * const validator_timestamp="org.apache.cassandra.db.marshal.DateType"; +const char * const validator_uuid= "org.apache.cassandra.db.marshal.UUIDType"; + ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) { ColumnDataConverter *res= NULL; @@ -617,8 +706,7 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONGLONG: - if (!strcmp(validator_name, validator_bigint) || - 0/*!strcmp(validator_name, validator_timestamp)*/) + if (!strcmp(validator_name, validator_bigint)) res= new BigintDataConverter; break; @@ -637,9 +725,18 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ res= new TimestampDataConverter; break; - case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: // these are space padded CHAR(n) strings. + if (!strcmp(validator_name, validator_uuid) && + field->real_type() == MYSQL_TYPE_STRING && + field->field_length == 36) + { + // UUID maps to CHAR(36), its text representation + res= new UuidDataConverter; + break; + } + /* fall through: */ case MYSQL_TYPE_VARCHAR: - case MYSQL_TYPE_STRING: // these are space padded strings. + case MYSQL_TYPE_VAR_STRING: if (!strcmp(validator_name, validator_blob) || !strcmp(validator_name, validator_ascii) || !strcmp(validator_name, validator_text)) @@ -698,7 +795,11 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) } if (n_mapped != n_fields - 1) + { + se->print_error("Some of SQL fields were not mapped to Cassandra's fields"); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); return true; + } /* Setup type conversion for row_key. @@ -775,7 +876,11 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, old_map= dbug_tmp_use_all_columns(table, table->read_set); - rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); + if (rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len)) + { + /* We get here when making lookups like uuid_column='not-an-uuid' */ + DBUG_RETURN(HA_ERR_KEY_NOT_FOUND); + } dbug_tmp_restore_column_map(table->read_set, old_map); @@ -858,10 +963,18 @@ int ha_cassandra::write_row(uchar *buf) old_map= dbug_tmp_use_all_columns(table, table->read_set); + insert_lineno++; + /* Convert the key */ char *cass_key; int cass_key_len; - rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); + if (rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len)) + { + my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), + rowkey_converter->field->field_name, insert_lineno); + dbug_tmp_restore_column_map(table->read_set, old_map); + DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + } se->start_row_insert(cass_key, cass_key_len); /* Convert other fields */ @@ -869,7 +982,13 @@ int ha_cassandra::write_row(uchar *buf) { char *cass_data; int cass_data_len; - field_converters[i]->mariadb_to_cassandra(&cass_data, &cass_data_len); + if (field_converters[i]->mariadb_to_cassandra(&cass_data, &cass_data_len)) + { + my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), + field_converters[i]->field->field_name, insert_lineno); + dbug_tmp_restore_column_map(table->read_set, old_map); + DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + } se->add_insert_column(field_converters[i]->field->field_name, cass_data, cass_data_len); } @@ -892,7 +1011,7 @@ int ha_cassandra::write_row(uchar *buf) if (res) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - + DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); } @@ -1060,6 +1179,7 @@ int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) int ha_cassandra::reset() { doing_insert_batch= false; + insert_lineno= 0; return 0; } diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index d5b542aae06..948bd8a6687 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -48,6 +48,9 @@ class ha_cassandra: public handler bool doing_insert_batch; ha_rows insert_rows_batched; + + /* Used to produce 'wrong column %s at row %lu' warnings */ + ha_rows insert_lineno; public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() From 12ab6a4f3cae9a3100eecba616824a3c040672fc Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 31 Aug 2012 11:03:59 +0400 Subject: [PATCH 206/439] MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system - Make an attempt at fixing. --- mysql-test/r/cassandra.result | 6 ++++++ mysql-test/t/cassandra.test | 5 +++++ storage/cassandra/ha_cassandra.cc | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index a340ae75f62..36d562f3348 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -210,6 +210,12 @@ select * from t2; rowkey datecol 1 2012-08-29 01:23:45 delete from t2; +# MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system +INSERT INTO t2 VALUES (10,'2012-12-12 12:12:12'); +SELECT * FROM t2; +rowkey datecol +10 2012-12-12 12:12:12 +delete from t2; # # (no MDEV#) Check that insert counters work correctly # diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 365cb5f8230..b7762085029 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -236,6 +236,11 @@ insert into t2 values (1, '2012-08-29 01:23:45'); select * from t2; delete from t2; +--echo # MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system +INSERT INTO t2 VALUES (10,'2012-12-12 12:12:12'); +SELECT * FROM t2; +delete from t2; + --echo # --echo # (no MDEV#) Check that insert counters work correctly --echo # diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 3be416e99cc..f5ca8a4494d 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -599,7 +599,7 @@ public: ts_time= ((Field_timestamp*)field)->get_timestamp(&ts_microsec); /* Cassandra needs milliseconds-since-epoch */ - tmp= ts_time * 1000 + ts_microsec/1000; + tmp= ((int64_t)ts_time) * 1000 + ts_microsec/1000; flip64((const char*)&tmp, (char*)&buf); *cass_data= (char*)&buf; From 95a937e368e20027ce126fecc257d31c8a10dcc9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Sep 2012 10:30:53 +0200 Subject: [PATCH 207/439] 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 4986de84ad0a7b70e8cd4788564d13ad6f03e016 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 7 Sep 2012 15:32:43 +0400 Subject: [PATCH 208/439] Cassandra SE: added support for boolean type. --- mysql-test/r/cassandra.result | 10 ++++++++++ mysql-test/t/cassandra.test | 15 +++++++++++++++ storage/cassandra/ha_cassandra.cc | 31 +++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 36d562f3348..401bc75cc80 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -266,3 +266,13 @@ rowkey col1 9b5658dc-f32f-11e1-94cd-f46d046e9f09 1234 delete from t2; drop table t2; +CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol varchar(12)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; +insert into t2 values (0, 0); +insert into t2 values (1, 1); +select * from t2; +rowkey boolcol +0 0 +1 1 +delete from t2; +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index b7762085029..6738cee4c77 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -53,6 +53,8 @@ create columnfamily cf5 (rowkey bigint primary key, uuidcol uuid); create columnfamily cf6 (rowkey uuid primary key, col1 int); +create columnfamily cf7 (rowkey int primary key, boolcol boolean); + ./cassandra-cli CREATE COLUMN FAMILY cf10 @@ -329,6 +331,16 @@ select * from t2; delete from t2; drop table t2; + +# create columnfamily cf7 (rowkey int primary key, boolcol boolean); +CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol varchar(12)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; +insert into t2 values (0, 0); +insert into t2 values (1, 1); +select * from t2; +delete from t2; +drop table t2; + ############################################################################ ## Cassandra cleanup ############################################################################ @@ -337,6 +349,9 @@ drop columnfamily cf1; drop columnfamily cf2; drop columnfamily cf3; drop columnfamily cf4; +drop columnfamily cf5; +drop columnfamily cf6; +drop columnfamily cf7; --enable_parsing ############################################################################ ## Cassandra cleanup ends diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index f5ca8a4494d..7ef563114fd 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -529,6 +529,28 @@ static void flip32(const char *from, char* to) to[3]= from[0]; } + +class TinyintDataConverter : public ColumnDataConverter +{ + char buf; +public: + void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + { + DBUG_ASSERT(cass_data_len == 1); + field->store(cass_data[0]); + } + + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) + { + buf= field->val_int()? 1 : 0; /* TODO: error handling? */ + *cass_data= (char*)&buf; + *cass_data_len= 1; + return false; + } + ~TinyintDataConverter(){} +}; + + class Int32DataConverter : public ColumnDataConverter { int32_t buf; @@ -683,6 +705,7 @@ public: ~UuidDataConverter(){} }; + const char * const validator_bigint= "org.apache.cassandra.db.marshal.LongType"; const char * const validator_int= "org.apache.cassandra.db.marshal.Int32Type"; const char * const validator_counter= "org.apache.cassandra.db.marshal.CounterColumnType"; @@ -698,12 +721,20 @@ const char * const validator_timestamp="org.apache.cassandra.db.marshal.DateType const char * const validator_uuid= "org.apache.cassandra.db.marshal.UUIDType"; +const char * const validator_boolean= "org.apache.cassandra.db.marshal.BooleanType"; + ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) { ColumnDataConverter *res= NULL; switch(field->type()) { case MYSQL_TYPE_TINY: + if (!strcmp(validator_name, validator_boolean)) + { + res= new TinyintDataConverter; + break; + } + /* fall through: */ case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONGLONG: if (!strcmp(validator_name, validator_bigint)) From 82e74d4cc1b59ed5901e2e06ead6df972b1b815d Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 10 Sep 2012 12:50:58 +0400 Subject: [PATCH 209/439] Cassandra SE - Make cassandra.test drop and re-crate the test keyspace. --- mysql-test/t/cassandra.test | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 6738cee4c77..44d42512fbc 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -30,11 +30,20 @@ create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace'; ############################################################################ -## Cassandra initialization: +## Cassandra initialization ############################################################################ ---disable_parsing -./cqlsh --cql3 +# Step 1: remove the keyspace that could be left over from the previous test +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_cleanup.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql +drop keyspace mariadbtest2; +EOF +--error 0,1,2 +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql + +# Step 2: create new keyspace and test column families +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_init.cql CREATE KEYSPACE mariadbtest2 WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' @@ -55,14 +64,27 @@ create columnfamily cf6 (rowkey uuid primary key, col1 int); create columnfamily cf7 (rowkey int primary key, boolcol boolean); -./cassandra-cli +create columnfamily cf8 (rowkey int primary key, countercol counter); +EOF +--error 0,1,2 +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql + + +# Step 3: Cassandra's CQL doesn't allow certain kinds of queries. Run them in +# CLI +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cli +--write_file $MYSQLTEST_VARDIR/cassandra_test_init.cli +use mariadbtest2; CREATE COLUMN FAMILY cf10 WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND default_validation_class = UTF8Type; +EOF + +--error 0,1,2 +--system cassandra-cli -f $MYSQLTEST_VARDIR/cassandra_test_init.cli ---enable_parsing ############################################################################ ## Cassandra initialization ends ############################################################################ From a3f33268ec00740596527951ef9b7906a77a0835 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 10 Sep 2012 14:40:07 +0400 Subject: [PATCH 210/439] Cassandra SE: add support for reading counter type values --- mysql-test/t/cassandra.test | 13 +++++++++++-- storage/cassandra/cassandra_se.cc | 24 ++++++++++++++++++++---- storage/cassandra/ha_cassandra.cc | 22 +++++++++++++++++----- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 44d42512fbc..4d2d390fdb5 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -64,7 +64,9 @@ create columnfamily cf6 (rowkey uuid primary key, col1 int); create columnfamily cf7 (rowkey int primary key, boolcol boolean); -create columnfamily cf8 (rowkey int primary key, countercol counter); +create columnfamily cf8 (rowkey varchar primary key, countercol counter); +update cf8 set countercol=countercol+1 where rowkey='cnt1'; +update cf8 set countercol=countercol+100 where rowkey='cnt2'; EOF --error 0,1,2 @@ -355,7 +357,7 @@ drop table t2; # create columnfamily cf7 (rowkey int primary key, boolcol boolean); -CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol varchar(12)) ENGINE=CASSANDRA +CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol bool) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; insert into t2 values (0, 0); insert into t2 values (1, 1); @@ -363,6 +365,13 @@ select * from t2; delete from t2; drop table t2; + +# Counter type +# create columnfamily cf8 (rowkey int primary key, countercol counter); +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8'; +select * from t2; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 692bfb595da..6eba141cf58 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -378,21 +378,37 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) bool Cassandra_se_impl::get_next_read_column(char **name, char **value, int *value_len) { + bool use_counter=false; while (1) { if (column_data_it == column_data_vec.end()) return true; - if (((*column_data_it).__isset.column)) + if ((*column_data_it).__isset.column) break; /* Ok it's a real column. Should be always the case. */ + if ((*column_data_it).__isset.counter_column) + { + use_counter= true; + break; + } + column_data_it++; } ColumnOrSuperColumn& cs= *column_data_it; - *name= (char*)cs.column.name.c_str(); - *value= (char*)cs.column.value.c_str(); - *value_len= cs.column.value.length(); + if (use_counter) + { + *name= (char*)cs.counter_column.name.c_str(); + *value= (char*)&cs.counter_column.value; + *value_len= sizeof(cs.counter_column.value); + } + else + { + *name= (char*)cs.column.name.c_str(); + *value= (char*)cs.column.value.c_str(); + *value_len= cs.column.value.length(); + } column_data_it++; return false; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 7ef563114fd..f1a5916ffc6 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -501,23 +501,31 @@ static void flip64(const char *from, char* to) class BigintDataConverter : public ColumnDataConverter { longlong buf; + bool flip; /* is false when reading counter columns */ public: void cassandra_to_mariadb(const char *cass_data, int cass_data_len) { longlong tmp; DBUG_ASSERT(cass_data_len == sizeof(longlong)); - flip64(cass_data, (char*)&tmp); + if (flip) + flip64(cass_data, (char*)&tmp); + else + memcpy(&tmp, cass_data, sizeof(longlong)); field->store(tmp); } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { longlong tmp= field->val_int(); - flip64((const char*)&tmp, (char*)&buf); + if (flip) + flip64((const char*)&tmp, (char*)&buf); + else + memcpy(&buf, &tmp, sizeof(longlong)); *cass_data= (char*)&buf; *cass_data_len=sizeof(longlong); return false; } + BigintDataConverter(bool flip_arg) : flip(flip_arg) {} ~BigintDataConverter(){} }; @@ -723,6 +731,7 @@ const char * const validator_uuid= "org.apache.cassandra.db.marshal.UUIDType"; const char * const validator_boolean= "org.apache.cassandra.db.marshal.BooleanType"; + ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) { ColumnDataConverter *res= NULL; @@ -737,10 +746,13 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ /* fall through: */ case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONGLONG: - if (!strcmp(validator_name, validator_bigint)) - res= new BigintDataConverter; + { + bool is_counter= false; + if (!strcmp(validator_name, validator_bigint) || + (is_counter= !strcmp(validator_name, validator_counter))) + res= new BigintDataConverter(!is_counter); break; - + } case MYSQL_TYPE_FLOAT: if (!strcmp(validator_name, validator_float)) res= new FloatDataConverter; From 8c641484dc43571b16edeb9780a587472fc1f14b Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Tue, 11 Sep 2012 16:29:51 +0200 Subject: [PATCH 211/439] 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 212/439] 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 213/439] 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 214/439] 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 215/439] From 76e4d6acf09f26a13f4d4378d2c0559973aa4638 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Thu, 20 Sep 2012 08:44:33 -0400 Subject: [PATCH 216/439] 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 217/439] 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 218/439] From a47d8d76652d95f2a1340141bf63e17f73b4e9e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 1 Oct 2012 08:44:52 +0200 Subject: [PATCH 219/439] 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 220/439] 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 221/439] 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 222/439] 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 223/439] 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 e4bffe61784f82fb9b8df43075481d0d7468d200 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 12 Sep 2012 07:36:23 +0400 Subject: [PATCH 224/439] Update test results after last cset --- mysql-test/r/cassandra.result | 9 ++++++++- mysql-test/t/cassandra.test | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 401bc75cc80..25722aeacb3 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -266,7 +266,7 @@ rowkey col1 9b5658dc-f32f-11e1-94cd-f46d046e9f09 1234 delete from t2; drop table t2; -CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol varchar(12)) ENGINE=CASSANDRA +CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol bool) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; insert into t2 values (0, 0); insert into t2 values (1, 1); @@ -276,3 +276,10 @@ rowkey boolcol 1 1 delete from t2; drop table t2; +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8'; +select * from t2; +rowkey countercol +cnt1 1 +cnt2 100 +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 4d2d390fdb5..0389363fdda 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -371,6 +371,7 @@ drop table t2; CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8'; select * from t2; +drop table t2; ############################################################################ ## Cassandra cleanup From f0b52a9e7e26b761e14911a7a072d4cf91ceab54 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 12 Sep 2012 08:36:12 +0200 Subject: [PATCH 225/439] 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 226/439] From 16fec32ecc2492cf8c2d56f0f03d6bfb2a1b7f2b Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 12 Sep 2012 20:52:23 +0400 Subject: [PATCH 227/439] Cassandra SE: small optimization: StringCopyConverter::mariadb_to_cassandra doesn't need to make NULL-terminated strings. --- storage/cassandra/ha_cassandra.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index f1a5916ffc6..af34750d031 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -595,7 +595,7 @@ public: bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { String *pstr= field->val_str(&buf); - *cass_data= (char*)pstr->c_ptr(); + *cass_data= (char*)pstr->ptr(); *cass_data_len= pstr->length(); return false; } From d6f2d692c129412a72549085d5cfe83a1edae1b5 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 14 Sep 2012 08:44:34 +0400 Subject: [PATCH 228/439] Cassandra SE - Catch all kinds of exceptions when calling Thrift code. --- storage/cassandra/cassandra_se.cc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 6eba141cf58..dbaa00f8d1e 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -160,9 +160,8 @@ bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg) print_error("%s [%s]", ire.what(), ire.why.c_str()); }catch(NotFoundException nfe){ print_error("%s", nfe.what()); - } - catch(...) { - print_error("Unknown Exception"); + }catch (...) { + print_error("Unknown exception"); } cur_consistency_level= ConsistencyLevel::ONE; @@ -192,7 +191,10 @@ bool Cassandra_se_impl::setup_ddl_checks() print_error("%s [%s]", ire.what(), ire.why.c_str()); } catch (NotFoundException nfe) { print_error("keyspace not found: %s", nfe.what()); + } catch (...) { + print_error("Unknown exception"); } + return true; } @@ -316,6 +318,8 @@ bool Cassandra_se_impl::do_insert() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + } catch (...) { + print_error("Unknown exception"); } return res; @@ -368,6 +372,9 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); return true; + } catch (...) { + print_error("Unknown exception"); + return true; } column_data_it= column_data_vec.begin(); @@ -470,6 +477,8 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + } catch (...) { + print_error("Unknown exception"); } key_slice_it= key_slice_vec.begin(); @@ -552,6 +561,8 @@ bool Cassandra_se_impl::truncate() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + } catch (...) { + print_error("Unknown exception"); } return res; @@ -575,6 +586,8 @@ bool Cassandra_se_impl::remove_row() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + } catch (...) { + print_error("Unknown exception"); } return res; @@ -629,6 +642,8 @@ bool Cassandra_se_impl::multiget_slice() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + } catch (...) { + print_error("Unknown exception"); } return res; From c7b41e5d466863cf2f7ef2599e9d2cd6d0cd8e57 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 14 Sep 2012 09:03:25 +0400 Subject: [PATCH 229/439] Cassandra SE - Also provide handling for generic Thrift exceptions. These are not listed in the 'throws' clause of API definition but still can happen. --- storage/cassandra/cassandra_se.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index dbaa00f8d1e..044e727e1c8 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -160,6 +160,8 @@ bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg) print_error("%s [%s]", ire.what(), ire.why.c_str()); }catch(NotFoundException nfe){ print_error("%s", nfe.what()); + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); }catch (...) { print_error("Unknown exception"); } @@ -191,6 +193,8 @@ bool Cassandra_se_impl::setup_ddl_checks() print_error("%s [%s]", ire.what(), ire.why.c_str()); } catch (NotFoundException nfe) { print_error("keyspace not found: %s", nfe.what()); + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); } catch (...) { print_error("Unknown exception"); } @@ -318,6 +322,8 @@ bool Cassandra_se_impl::do_insert() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); } catch (...) { print_error("Unknown exception"); } @@ -372,6 +378,8 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); return true; + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); } catch (...) { print_error("Unknown exception"); return true; @@ -477,6 +485,8 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); } catch (...) { print_error("Unknown exception"); } @@ -561,6 +571,8 @@ bool Cassandra_se_impl::truncate() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); } catch (...) { print_error("Unknown exception"); } @@ -586,6 +598,8 @@ bool Cassandra_se_impl::remove_row() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); } catch (...) { print_error("Unknown exception"); } @@ -642,6 +656,8 @@ bool Cassandra_se_impl::multiget_slice() print_error("UnavailableException: %s", ue.what()); } catch (TimedOutException te) { print_error("TimedOutException: %s", te.what()); + }catch(TException e){ + print_error("Thrift exception: %s", e.what()); } catch (...) { print_error("Unknown exception"); } From c3de7c977adc6a7810c8f83dfb4614acc82a67c6 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 14 Sep 2012 09:25:42 +0400 Subject: [PATCH 230/439] MDEV-530: Cassandra SE: Locking is incorrect - Use more permissive locking. --- storage/cassandra/ha_cassandra.cc | 35 +++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index af34750d031..b6983be498a 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1420,14 +1420,41 @@ int ha_cassandra::extra(enum ha_extra_function operation) } +/* The following function was copied from ha_blackhole::store_lock: */ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, - THR_LOCK_DATA **to, - enum thr_lock_type lock_type) + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) { + DBUG_ENTER("ha_cassandra::store_lock"); if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) - lock.type=lock_type; + { + /* + Here is where we get into the guts of a row level lock. + If TL_UNLOCK is set + If we are not doing a LOCK TABLE or DISCARD/IMPORT + TABLESPACE, then allow multiple writers + */ + + if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && + lock_type <= TL_WRITE) && !thd_in_lock_tables(thd) + && !thd_tablespace_op(thd)) + lock_type = TL_WRITE_ALLOW_WRITE; + + /* + In queries of type INSERT INTO t1 SELECT ... FROM t2 ... + MySQL would use the lock TL_READ_NO_INSERT on t2, and that + would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts + to t2. Convert the lock to a normal read lock to allow + concurrent inserts to t2. + */ + + if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) + lock_type = TL_READ; + + lock.type= lock_type; + } *to++= &lock; - return to; + DBUG_RETURN(to); } From eb63b07ace114f58984055610fe4a76accca9480 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sun, 16 Sep 2012 12:22:21 +0400 Subject: [PATCH 231/439] Cassandra SE: - added option thrift_port which allows to specify which port to connect to - not adding username/password - it turns out, there are no authentication schemes in stock cassandra distribution. --- storage/cassandra/cassandra_se.cc | 7 ++++--- storage/cassandra/cassandra_se.h | 3 ++- storage/cassandra/ha_cassandra.cc | 16 +++++++++------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 044e727e1c8..c6415e6a4aa 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -73,7 +73,7 @@ public: virtual ~Cassandra_se_impl(){ delete cass; } /* Connection and DDL checks */ - bool connect(const char *host, const char *keyspace); + bool connect(const char *host, int port, const char *keyspace); void set_column_family(const char *cfname) { column_family.assign(cfname); } bool setup_ddl_checks(); @@ -135,7 +135,7 @@ Cassandra_se_interface *get_cassandra_se() } -bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg) +bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace_arg) { bool res= true; @@ -143,7 +143,7 @@ bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg) try { boost::shared_ptr socket = - boost::shared_ptr(new TSocket(host, 9160)); + boost::shared_ptr(new TSocket(host, port)); boost::shared_ptr tr = boost::shared_ptr(new TFramedTransport (socket)); boost::shared_ptr p = @@ -680,3 +680,4 @@ bool Cassandra_se_impl::get_next_multiget_row() } + diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index d2ece4d9441..598267308af 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -17,7 +17,7 @@ public: virtual ~Cassandra_se_interface(){}; /* Init */ - virtual bool connect(const char *host, const char *port)=0; + virtual bool connect(const char *host, int port, const char *keyspace)=0; virtual void set_column_family(const char *cfname) = 0; /* Check underlying DDL */ @@ -82,3 +82,4 @@ extern Cassandra_status_vars cassandra_counters; Cassandra_se_interface *get_cassandra_se(); + diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index b6983be498a..c2570ad7a3a 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -38,7 +38,8 @@ mysql_mutex_t cassandra_mutex; struct ha_table_option_struct { - const char *host; + const char *thrift_host; + int thrift_port; const char *keyspace; const char *column_family; }; @@ -49,7 +50,8 @@ ha_create_table_option cassandra_table_option_list[]= /* one option that takes an arbitrary string */ - HA_TOPTION_STRING("thrift_host", host), + HA_TOPTION_STRING("thrift_host", thrift_host), + HA_TOPTION_NUMBER("thrift_port", thrift_port, 9160, 1, 65535, 0), HA_TOPTION_STRING("keyspace", keyspace), HA_TOPTION_STRING("column_family", column_family), HA_TOPTION_END @@ -283,14 +285,14 @@ int ha_cassandra::open(const char *name, int mode, uint test_if_locked) ha_table_option_struct *options= table->s->option_struct; fprintf(stderr, "ha_cass: open thrift_host=%s keyspace=%s column_family=%s\n", - options->host, options->keyspace, options->column_family); + options->thrift_host, options->keyspace, options->column_family); DBUG_ASSERT(!se); - if (!options->host || !options->keyspace || !options->column_family) + if (!options->thrift_host || !options->keyspace || !options->column_family) DBUG_RETURN(HA_WRONG_CREATE_OPTION); se= get_cassandra_se(); se->set_column_family(options->column_family); - if (se->connect(options->host, options->keyspace)) + if (se->connect(options->thrift_host, options->thrift_port, options->keyspace)) { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); DBUG_RETURN(HA_ERR_NO_CONNECTION); @@ -389,7 +391,7 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, */ #endif DBUG_ASSERT(!se); - if (!options->host || !options->keyspace || !options->column_family) + if (!options->thrift_host || !options->keyspace || !options->column_family) { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "thrift_host, keyspace, and column_family table options must be specified"); @@ -397,7 +399,7 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, } se= get_cassandra_se(); se->set_column_family(options->column_family); - if (se->connect(options->host, options->keyspace)) + if (se->connect(options->thrift_host, options->thrift_port, options->keyspace)) { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); DBUG_RETURN(HA_ERR_NO_CONNECTION); From 5cbdb908270a052284155cd5b7eff7eacb177218 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Mon, 17 Sep 2012 11:48:02 +0530 Subject: [PATCH 232/439] 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 233/439] 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 234/439] 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 235/439] 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 236/439] From 004e024775ed5c68dcc721f36aedda7f59a2197e Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 20 Sep 2012 14:22:36 +0400 Subject: [PATCH 237/439] Cassandra SE: - Added @@cassandra_thrift_host global variable. --- mysql-test/r/cassandra.result | 25 +++++- mysql-test/t/cassandra.test | 21 ++++- storage/cassandra/ha_cassandra.cc | 124 +++++++++++++++++++++++------- storage/cassandra/ha_cassandra.h | 19 ++++- 4 files changed, 159 insertions(+), 30 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 25722aeacb3..15a68421d9e 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -13,7 +13,7 @@ thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam'; ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace no_such_keyspace does not exist] create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra thrift_host='localhost' keyspace='no_such_keyspace'; -ERROR HY000: Unable to connect to foreign data source: thrift_host, keyspace, and column_family table options must be s +ERROR HY000: Unable to connect to foreign data source: keyspace and column_family table options must be specified # Now, create a table for real and insert data create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; @@ -266,6 +266,9 @@ rowkey col1 9b5658dc-f32f-11e1-94cd-f46d046e9f09 1234 delete from t2; drop table t2; +# +# boolean datatype support +# CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol bool) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; insert into t2 values (0, 0); @@ -276,6 +279,9 @@ rowkey boolcol 1 1 delete from t2; drop table t2; +# +# Counter datatype support (read-only) +# CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8'; select * from t2; @@ -283,3 +289,20 @@ rowkey countercol cnt1 1 cnt2 100 drop table t2; +# +# Check that @@cassandra_default_thrift_host works +# +show variables like 'cassandra_default_thrift_host'; +Variable_name Value +cassandra_default_thrift_host +set cassandra_default_thrift_host='localhost'; +ERROR HY000: Variable 'cassandra_default_thrift_host' is a GLOBAL variable and should be set with SET GLOBAL +set global cassandra_default_thrift_host='localhost'; +# Try creating a table without specifying thrift_host: +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA +keyspace='mariadbtest2' column_family = 'cf8'; +select * from t2; +rowkey countercol +cnt1 1 +cnt2 100 +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 0389363fdda..f76fbc6e129 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -356,6 +356,9 @@ delete from t2; drop table t2; +--echo # +--echo # boolean datatype support +--echo # # create columnfamily cf7 (rowkey int primary key, boolcol boolean); CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol bool) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; @@ -366,13 +369,29 @@ delete from t2; drop table t2; -# Counter type +--echo # +--echo # Counter datatype support (read-only) +--echo # # create columnfamily cf8 (rowkey int primary key, countercol counter); CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8'; select * from t2; drop table t2; +--echo # +--echo # Check that @@cassandra_default_thrift_host works +--echo # +show variables like 'cassandra_default_thrift_host'; +--error ER_GLOBAL_VARIABLE +set cassandra_default_thrift_host='localhost'; +set global cassandra_default_thrift_host='localhost'; + +--echo # Try creating a table without specifying thrift_host: +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA + keyspace='mariadbtest2' column_family = 'cf8'; +select * from t2; +drop table t2; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index c2570ad7a3a..59f754287a0 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1,6 +1,18 @@ /* - MP AB copyrights -*/ + Copyright (c) 2012, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation @@ -70,12 +82,54 @@ static MYSQL_THDVAR_ULONG(rnd_batch_size, PLUGIN_VAR_RQCMDARG, "Number of rows in an rnd_read (full scan) batch", NULL, NULL, /*default*/ 10*1000, /*min*/ 1, /*max*/ 1024*1024*1024, 0); +mysql_mutex_t cassandra_default_host_lock; +static char* cassandra_default_thrift_host = NULL; +static char cassandra_default_host_buf[256]=""; + +static void +cassandra_default_thrift_host_update(THD *thd, + struct st_mysql_sys_var* var, + void* var_ptr, /*!< out: where the + formal string goes */ + const void* save) /*!< in: immediate result + from check function */ +{ + const char *new_host= *((char**)save); + const size_t max_len= sizeof(cassandra_default_host_buf); + + mysql_mutex_lock(&cassandra_default_host_lock); + + if (new_host) + { + strncpy(cassandra_default_host_buf, new_host, max_len); + cassandra_default_host_buf[max_len]= 0; + cassandra_default_thrift_host= cassandra_default_host_buf; + } + else + { + cassandra_default_host_buf[0]= 0; + cassandra_default_thrift_host= NULL; + } + + *((const char**)var_ptr)= cassandra_default_thrift_host; + + mysql_mutex_unlock(&cassandra_default_host_lock); +} + + +static MYSQL_SYSVAR_STR(default_thrift_host, cassandra_default_thrift_host, + PLUGIN_VAR_RQCMDARG, + "Default host for Cassandra thrift connections", + /*check*/NULL, + cassandra_default_thrift_host_update, + /*default*/NULL); + static struct st_mysql_sys_var* cassandra_system_variables[]= { MYSQL_SYSVAR(insert_batch_size), MYSQL_SYSVAR(multiget_batch_size), MYSQL_SYSVAR(rnd_batch_size), -// MYSQL_SYSVAR(enum_var), -// MYSQL_SYSVAR(ulong_var), + + MYSQL_SYSVAR(default_thrift_host), NULL }; @@ -158,6 +212,9 @@ static int cassandra_init_func(void *p) cassandra_hton->table_options= cassandra_table_option_list; //cassandra_hton->field_options= example_field_option_list; cassandra_hton->field_options= NULL; + + mysql_mutex_init(0 /* no instrumentation */, + &cassandra_default_host_lock, MY_MUTEX_INIT_FAST); DBUG_RETURN(0); } @@ -171,6 +228,7 @@ static int cassandra_done_func(void *p) error= 1; my_hash_free(&cassandra_open_tables); mysql_mutex_destroy(&cassandra_mutex); + mysql_mutex_destroy(&cassandra_default_host_lock); DBUG_RETURN(error); } @@ -277,22 +335,23 @@ const char **ha_cassandra::bas_ext() const int ha_cassandra::open(const char *name, int mode, uint test_if_locked) { + ha_table_option_struct *options= table->s->option_struct; + int res; DBUG_ENTER("ha_cassandra::open"); if (!(share = get_share(name, table))) DBUG_RETURN(1); thr_lock_data_init(&share->lock,&lock,NULL); - ha_table_option_struct *options= table->s->option_struct; - fprintf(stderr, "ha_cass: open thrift_host=%s keyspace=%s column_family=%s\n", - options->thrift_host, options->keyspace, options->column_family); - DBUG_ASSERT(!se); - if (!options->thrift_host || !options->keyspace || !options->column_family) - DBUG_RETURN(HA_WRONG_CREATE_OPTION); + if ((res= check_table_options(options))) + DBUG_RETURN(res); + se= get_cassandra_se(); se->set_column_family(options->column_family); - if (se->connect(options->thrift_host, options->thrift_port, options->keyspace)) + const char *thrift_host= options->thrift_host? options->thrift_host: + cassandra_default_thrift_host; + if (se->connect(thrift_host, options->thrift_port, options->keyspace)) { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); DBUG_RETURN(HA_ERR_NO_CONNECTION); @@ -320,6 +379,27 @@ int ha_cassandra::close(void) } +int ha_cassandra::check_table_options(ha_table_option_struct *options) +{ + if (!options->thrift_host && (!cassandra_default_thrift_host || + !cassandra_default_thrift_host[0])) + { + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), + "thrift_host table option must be specified, or " + "@@cassandra_default_thrift_host must be set"); + return HA_WRONG_CREATE_OPTION; + } + + if (!options->keyspace || !options->column_family) + { + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), + "keyspace and column_family table options must be specified"); + return HA_WRONG_CREATE_OPTION; + } + return 0; +} + + /** @brief create() is called to create a database. The variable name will have the name @@ -343,18 +423,11 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) { ha_table_option_struct *options= table_arg->s->option_struct; + int res; DBUG_ENTER("ha_cassandra::create"); DBUG_ASSERT(options); - Field **pfield= table_arg->s->field; -/* - if (strcmp((*pfield)->field_name, "rowkey")) - { - my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be named 'rowkey'"); - DBUG_RETURN(HA_WRONG_CREATE_OPTION); - } -*/ if (!((*pfield)->flags & NOT_NULL_FLAG)) { my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be NOT NULL"); @@ -391,15 +464,14 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, */ #endif DBUG_ASSERT(!se); - if (!options->thrift_host || !options->keyspace || !options->column_family) - { - my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), - "thrift_host, keyspace, and column_family table options must be specified"); - DBUG_RETURN(HA_WRONG_CREATE_OPTION); - } + if ((res= check_table_options(options))) + DBUG_RETURN(res); + se= get_cassandra_se(); se->set_column_family(options->column_family); - if (se->connect(options->thrift_host, options->thrift_port, options->keyspace)) + const char *thrift_host= options->thrift_host? options->thrift_host: + cassandra_default_thrift_host; + if (se->connect(thrift_host, options->thrift_port, options->keyspace)) { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); DBUG_RETURN(HA_ERR_NO_CONNECTION); diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 948bd8a6687..9b11b055af3 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -1,6 +1,18 @@ /* - MP AB copyrights -*/ + Copyright (c) 2012, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif @@ -26,6 +38,8 @@ typedef struct st_cassandra_share { class ColumnDataConverter; +struct ha_table_option_struct; + /** @brief Class definition for the storage engine */ @@ -45,6 +59,7 @@ class ha_cassandra: public handler void free_field_converters(); void read_cassandra_columns(bool unpack_pk); + int check_table_options(struct ha_table_option_struct* options); bool doing_insert_batch; ha_rows insert_rows_batched; From 1f419232486730a8cdf5428d04ce1df0d0abfb7f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Sep 2012 10:54:09 +0200 Subject: [PATCH 238/439] From f820334bbfd0cc6effdab7e947bb095885566a70 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Fri, 21 Sep 2012 23:28:55 +0530 Subject: [PATCH 239/439] 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 240/439] 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 c59faf95ae31b9ba61ba14ed53ddd92695eb05c8 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sat, 22 Sep 2012 23:30:29 +0400 Subject: [PATCH 241/439] Cassandra SE: make consistency settings user-settable. --- mysql-test/r/cassandra.result | 20 +++++++++++++++++ mysql-test/t/cassandra.test | 21 ++++++++++++++++++ storage/cassandra/cassandra_se.cc | 33 ++++++++++++++++++++-------- storage/cassandra/cassandra_se.h | 16 ++++++++++++++ storage/cassandra/ha_cassandra.cc | 36 +++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 15a68421d9e..32e1789983c 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -295,6 +295,7 @@ drop table t2; show variables like 'cassandra_default_thrift_host'; Variable_name Value cassandra_default_thrift_host +set @tmp=@@cassandra_default_thrift_host; set cassandra_default_thrift_host='localhost'; ERROR HY000: Variable 'cassandra_default_thrift_host' is a GLOBAL variable and should be set with SET GLOBAL set global cassandra_default_thrift_host='localhost'; @@ -306,3 +307,22 @@ rowkey countercol cnt1 1 cnt2 100 drop table t2; +set global cassandra_default_thrift_host=@tmp; +# +# Consistency settings +# +show variables like 'cassandra_%consistency'; +Variable_name Value +cassandra_read_consistency ONE +cassandra_write_consistency ONE +set @tmp=@@cassandra_write_consistency; +# Unfortunately, there is no easy way to check if setting have the effect.. +set cassandra_write_consistency='ONE'; +set cassandra_write_consistency='QUORUM'; +set cassandra_write_consistency='LOCAL_QUORUM'; +set cassandra_write_consistency='EACH_QUORUM'; +set cassandra_write_consistency='ALL'; +set cassandra_write_consistency='ANY'; +set cassandra_write_consistency='TWO'; +set cassandra_write_consistency='THREE'; +set cassandra_write_consistency=@tmp; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index f76fbc6e129..8a2da608c22 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -382,6 +382,7 @@ drop table t2; --echo # Check that @@cassandra_default_thrift_host works --echo # show variables like 'cassandra_default_thrift_host'; +set @tmp=@@cassandra_default_thrift_host; --error ER_GLOBAL_VARIABLE set cassandra_default_thrift_host='localhost'; set global cassandra_default_thrift_host='localhost'; @@ -392,6 +393,26 @@ CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSA select * from t2; drop table t2; +set global cassandra_default_thrift_host=@tmp; + +--echo # +--echo # Consistency settings +--echo # +show variables like 'cassandra_%consistency'; +set @tmp=@@cassandra_write_consistency; + +--echo # Unfortunately, there is no easy way to check if setting have the effect.. +set cassandra_write_consistency='ONE'; +set cassandra_write_consistency='QUORUM'; +set cassandra_write_consistency='LOCAL_QUORUM'; +set cassandra_write_consistency='EACH_QUORUM'; +set cassandra_write_consistency='ALL'; +set cassandra_write_consistency='ANY'; +set cassandra_write_consistency='TWO'; +set cassandra_write_consistency='THREE'; + +set cassandra_write_consistency=@tmp; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index c6415e6a4aa..3be81c5e6bf 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -23,6 +23,7 @@ using namespace apache::thrift::transport; using namespace apache::thrift::protocol; using namespace org::apache::cassandra; + void Cassandra_se_interface::print_error(const char *format, ...) { va_list ap; @@ -38,10 +39,13 @@ void Cassandra_se_interface::print_error(const char *format, ...) class Cassandra_se_impl: public Cassandra_se_interface { CassandraClient *cass; /* Connection to cassandra */ - ConsistencyLevel::type cur_consistency_level; std::string column_family; std::string keyspace; + + ConsistencyLevel::type write_consistency; + ConsistencyLevel::type read_consistency; + /* DDL data */ KsDef ks_def; /* KeySpace we're using (TODO: put this in table->share) */ @@ -69,7 +73,9 @@ class Cassandra_se_impl: public Cassandra_se_interface SlicePredicate slice_pred; bool get_slices_returned_less; public: - Cassandra_se_impl() : cass(NULL) {} + Cassandra_se_impl() : cass(NULL), + write_consistency(ConsistencyLevel::ONE), + read_consistency(ConsistencyLevel::ONE) {} virtual ~Cassandra_se_impl(){ delete cass; } /* Connection and DDL checks */ @@ -81,6 +87,9 @@ public: bool next_ddl_column(char **name, int *name_len, char **value, int *value_len); void get_rowkey_type(char **name, char **type); + /* Settings */ + void set_consistency_levels(ulong read_cons_level, ulong write_cons_level); + /* Writes */ void clear_insert_buffer(); void start_row_insert(const char *key, int key_len); @@ -166,14 +175,20 @@ bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace print_error("Unknown exception"); } - cur_consistency_level= ConsistencyLevel::ONE; - if (!res && setup_ddl_checks()) res= true; return res; } +void Cassandra_se_impl::set_consistency_levels(ulong read_cons_level, + ulong write_cons_level) +{ + write_cons_level= (ConsistencyLevel::type)(write_cons_level + 1); + read_cons_level= (ConsistencyLevel::type)(read_cons_level + 1); +} + + bool Cassandra_se_impl::setup_ddl_checks() { try { @@ -308,7 +323,7 @@ bool Cassandra_se_impl::do_insert() try { - cass->batch_mutate(batch_mutation, cur_consistency_level); + cass->batch_mutate(batch_mutation, write_consistency); cassandra_counters.row_inserts+= batch_mutation.size(); cassandra_counters.row_insert_batches++; @@ -356,7 +371,7 @@ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) try { cass->get_slice(column_data_vec, rowkey, cparent, slice_pred, - cur_consistency_level); + read_consistency); if (column_data_vec.size() == 0) { @@ -471,7 +486,7 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) cass->get_range_slices(key_slice_vec, cparent, slice_pred, key_range, - cur_consistency_level); + read_consistency); res= false; if (key_slice_vec.size() < (uint)read_batch_size) @@ -589,7 +604,7 @@ bool Cassandra_se_impl::remove_row() try { - cass->remove(rowkey, column_path, get_i64_timestamp(), cur_consistency_level); + cass->remove(rowkey, column_path, get_i64_timestamp(), write_consistency); res= false; } catch (InvalidRequestException ire) { @@ -643,7 +658,7 @@ bool Cassandra_se_impl::multiget_slice() cassandra_counters.multiget_keys_scanned += mrr_keys.size(); cass->multiget_slice(mrr_result, mrr_keys, cparent, slice_pred, - cur_consistency_level); + read_consistency); cassandra_counters.multiget_rows_read += mrr_result.size(); diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 598267308af..33ef677d276 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -7,6 +7,19 @@ */ +/* We need to define this here so that ha_cassandra.cc also has access to it */ +typedef enum +{ + ONE = 1-1, + QUORUM = 2-1, + LOCAL_QUORUM = 3-1, + EACH_QUORUM = 4-1, + ALL = 5-1, + ANY = 6-1, + TWO = 7-1, + THREE = 8-1, +} enum_cassandra_consistency_level; + /* Interface to one cassandra column family, i.e. one 'table' */ @@ -19,6 +32,9 @@ public: /* Init */ virtual bool connect(const char *host, int port, const char *keyspace)=0; virtual void set_column_family(const char *cfname) = 0; + + /* Settings */ + virtual void set_consistency_levels(ulong read_cons_level, ulong write_cons_level)=0; /* Check underlying DDL */ virtual bool setup_ddl_checks()=0; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 59f754287a0..3643da97287 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -82,6 +82,35 @@ static MYSQL_THDVAR_ULONG(rnd_batch_size, PLUGIN_VAR_RQCMDARG, "Number of rows in an rnd_read (full scan) batch", NULL, NULL, /*default*/ 10*1000, /*min*/ 1, /*max*/ 1024*1024*1024, 0); +/* These match values in enum_cassandra_consistency_level */ +const char *cassandra_consistency_level[] = +{ + "ONE", + "QUORUM", + "LOCAL_QUORUM", + "EACH_QUORUM", + "ALL", + "ANY", + "TWO", + "THREE", + NullS +}; + +TYPELIB cassandra_consistency_level_typelib= { + array_elements(cassandra_consistency_level) - 1, "", + cassandra_consistency_level, NULL +}; + + +static MYSQL_THDVAR_ENUM(write_consistency, PLUGIN_VAR_RQCMDARG, + "Cassandra consistency level to use for write operations", NULL, NULL, + ONE, &cassandra_consistency_level_typelib); + +static MYSQL_THDVAR_ENUM(read_consistency, PLUGIN_VAR_RQCMDARG, + "Cassandra consistency level to use for read operations", NULL, NULL, + ONE, &cassandra_consistency_level_typelib); + + mysql_mutex_t cassandra_default_host_lock; static char* cassandra_default_thrift_host = NULL; static char cassandra_default_host_buf[256]=""; @@ -130,6 +159,8 @@ static struct st_mysql_sys_var* cassandra_system_variables[]= { MYSQL_SYSVAR(rnd_batch_size), MYSQL_SYSVAR(default_thrift_host), + MYSQL_SYSVAR(write_consistency), + MYSQL_SYSVAR(read_consistency), NULL }; @@ -1297,6 +1328,11 @@ int ha_cassandra::reset() { doing_insert_batch= false; insert_lineno= 0; + if (se) + { + se->set_consistency_levels(THDVAR(table->in_use, read_consistency), + THDVAR(table->in_use, write_consistency)); + } return 0; } From 7c671a7ead96dd9115a6ae77ebbf78d0dea43485 Mon Sep 17 00:00:00 2001 From: Rohit Kalhans Date: Sun, 23 Sep 2012 15:45:22 +0530 Subject: [PATCH 242/439] 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 bce2e6683a19f7d32c4540b5850f370db6bb4e36 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 24 Sep 2012 19:15:12 +0400 Subject: [PATCH 243/439] Cassandra SE - Add support for Cassandra's 'varint' datatype, mappable to VARBINARY. --- mysql-test/r/cassandra.result | 17 +++++ mysql-test/t/cassandra.test | 24 +++++++ storage/cassandra/ha_cassandra.cc | 104 ++++++++++++++++++++++-------- storage/cassandra/ha_cassandra.h | 4 +- 4 files changed, 122 insertions(+), 27 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 32e1789983c..3ca4091ed29 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -326,3 +326,20 @@ set cassandra_write_consistency='ANY'; set cassandra_write_consistency='TWO'; set cassandra_write_consistency='THREE'; set cassandra_write_consistency=@tmp; +# +# varint datatype support +# +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(32)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; +select rowkey, hex(varint_col) from t2; +rowkey hex(varint_col) +val-01 01 +val-0x123456 123456 +val-0x12345678 12345678 +drop table t2; +# now, let's check what happens when MariaDB's column is not wide enough: +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(2)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; +select rowkey, hex(varint_col) from t2; +ERROR HY000: Internal error: 'Unable to convert value of field `varint_col` from cassandra's data format. Source has 4 bytes, data: 12345678' +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 8a2da608c22..5ff6018214e 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -68,6 +68,11 @@ create columnfamily cf8 (rowkey varchar primary key, countercol counter); update cf8 set countercol=countercol+1 where rowkey='cnt1'; update cf8 set countercol=countercol+100 where rowkey='cnt2'; +create columnfamily cf9 (rowkey varchar primary key, varint_col varint); +insert into cf9 (rowkey, varint_col) values ('val-01', 1); +insert into cf9 (rowkey, varint_col) values ('val-0x123456', 1193046); +insert into cf9 (rowkey, varint_col) values ('val-0x12345678', 305419896); + EOF --error 0,1,2 --system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql @@ -413,6 +418,25 @@ set cassandra_write_consistency='THREE'; set cassandra_write_consistency=@tmp; +--echo # +--echo # varint datatype support +--echo # +# create columnfamily cf9 (rowkey varchar primary key, varint_col varint); +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; +--sorted_result +select rowkey, hex(varint_col) from t2; +drop table t2; + +--echo # now, let's check what happens when MariaDB's column is not wide enough: +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(2)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; +--sorted_result +--error ER_INTERNAL_ERROR +select rowkey, hex(varint_col) from t2; +drop table t2; + + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 3643da97287..6a82f811eb4 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -531,7 +531,7 @@ public: Field *field; /* This will save Cassandra's data in the Field */ - virtual void cassandra_to_mariadb(const char *cass_data, + virtual int cassandra_to_mariadb(const char *cass_data, int cass_data_len)=0; /* @@ -552,11 +552,12 @@ class DoubleDataConverter : public ColumnDataConverter { double buf; public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { DBUG_ASSERT(cass_data_len == sizeof(double)); double *pdata= (double*) cass_data; field->store(*pdata); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -574,11 +575,12 @@ class FloatDataConverter : public ColumnDataConverter { float buf; public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { DBUG_ASSERT(cass_data_len == sizeof(float)); float *pdata= (float*) cass_data; field->store(*pdata); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -608,7 +610,7 @@ class BigintDataConverter : public ColumnDataConverter longlong buf; bool flip; /* is false when reading counter columns */ public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { longlong tmp; DBUG_ASSERT(cass_data_len == sizeof(longlong)); @@ -617,6 +619,7 @@ public: else memcpy(&tmp, cass_data, sizeof(longlong)); field->store(tmp); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -647,10 +650,11 @@ class TinyintDataConverter : public ColumnDataConverter { char buf; public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { DBUG_ASSERT(cass_data_len == 1); field->store(cass_data[0]); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -668,12 +672,13 @@ class Int32DataConverter : public ColumnDataConverter { int32_t buf; public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { int32_t tmp; DBUG_ASSERT(cass_data_len == sizeof(int32_t)); flip32(cass_data, (char*)&tmp); field->store(tmp); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -691,10 +696,14 @@ public: class StringCopyConverter : public ColumnDataConverter { String buf; + size_t max_length; public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { + if ((size_t)cass_data_len > max_length) + return 1; field->store(cass_data, cass_data_len,field->charset()); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -704,6 +713,7 @@ public: *cass_data_len= pstr->length(); return false; } + StringCopyConverter(size_t max_length_arg) : max_length(max_length_arg) {} ~StringCopyConverter(){} }; @@ -712,7 +722,7 @@ class TimestampDataConverter : public ColumnDataConverter { int64_t buf; public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { /* Cassandra data is milliseconds-since-epoch in network byte order */ int64_t tmp; @@ -724,6 +734,7 @@ public: - microsecond fraction of a second. */ ((Field_timestamp*)field)->store_TIME(tmp / 1000, (tmp % 1000)*1000); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -768,7 +779,7 @@ class UuidDataConverter : public ColumnDataConverter char buf[16]; /* Binary UUID representation */ String str_buf; public: - void cassandra_to_mariadb(const char *cass_data, int cass_data_len) + int cassandra_to_mariadb(const char *cass_data, int cass_data_len) { DBUG_ASSERT(cass_data_len==16); char str[37]; @@ -783,6 +794,7 @@ public: } *ptr= 0; field->store(str, 36,field->charset()); + return 0; } bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) @@ -836,6 +848,11 @@ const char * const validator_uuid= "org.apache.cassandra.db.marshal.UUIDType"; const char * const validator_boolean= "org.apache.cassandra.db.marshal.BooleanType"; +/* + VARINTs are stored as little-endian big numbers. +*/ +const char * const validator_varint= "org.apache.cassandra.db.marshal.IntegerType"; + ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) { @@ -885,14 +902,20 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ /* fall through: */ case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VAR_STRING: + { + bool is_varint; if (!strcmp(validator_name, validator_blob) || !strcmp(validator_name, validator_ascii) || - !strcmp(validator_name, validator_text)) + !strcmp(validator_name, validator_text) || + (is_varint= !strcmp(validator_name, validator_varint))) { - res= new StringCopyConverter; + size_t max_size= (size_t)-1; + if (is_varint) + max_size= field->field_length; + res= new StringCopyConverter(max_size); } break; - + } case MYSQL_TYPE_LONG: if (!strcmp(validator_name, validator_int)) res= new Int32DataConverter; @@ -1041,24 +1064,43 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, /* TODO: what if we're not reading all columns?? */ if (!found) - { rc= HA_ERR_KEY_NOT_FOUND; - } else - { - read_cassandra_columns(false); - } + rc= read_cassandra_columns(false); DBUG_RETURN(rc); } -void ha_cassandra::read_cassandra_columns(bool unpack_pk) +void ha_cassandra::print_conversion_error(const char *field_name, + char *cass_value, + int cass_value_len) +{ + char buf[32]; + char *p= cass_value; + size_t i= 0; + for (; (i < (int)sizeof(buf)-1) && (p < cass_value + cass_value_len); p++) + { + buf[i++]= map2number[(*p >> 4) & 0xF]; + buf[i++]= map2number[*p & 0xF]; + } + buf[i]=0; + + se->print_error("Unable to convert value for field `%s` from Cassandra's data" + " format. Source data is %d bytes, 0x%s%s", + field_name, cass_value_len, buf, + (i == sizeof(buf) - 1)? "..." : ""); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); +} + + +int ha_cassandra::read_cassandra_columns(bool unpack_pk) { char *cass_name; char *cass_value; int cass_value_len; Field **field; + int res= 0; /* cassandra_to_mariadb() calls will use field->store(...) methods, which @@ -1082,7 +1124,14 @@ void ha_cassandra::read_cassandra_columns(bool unpack_pk) { int fieldnr= (*field)->field_index; (*field)->set_notnull(); - field_converters[fieldnr]->cassandra_to_mariadb(cass_value, cass_value_len); + if (field_converters[fieldnr]->cassandra_to_mariadb(cass_value, + cass_value_len)) + { + print_conversion_error((*field)->field_name, cass_value, + cass_value_len); + res=1; + goto err; + } break; } } @@ -1094,10 +1143,17 @@ void ha_cassandra::read_cassandra_columns(bool unpack_pk) field= table->field; (*field)->set_notnull(); se->get_read_rowkey(&cass_value, &cass_value_len); - rowkey_converter->cassandra_to_mariadb(cass_value, cass_value_len); + if (rowkey_converter->cassandra_to_mariadb(cass_value, cass_value_len)) + { + print_conversion_error((*field)->field_name, cass_value, cass_value_len); + res=1; + goto err; + } } +err: dbug_tmp_restore_column_map(table->write_set, old_map); + return res; } @@ -1234,10 +1290,7 @@ int ha_cassandra::rnd_next(uchar *buf) if (reached_eof) rc= HA_ERR_END_OF_FILE; else - { - read_cassandra_columns(true); - rc= 0; - } + rc= read_cassandra_columns(true); } DBUG_RETURN(rc); @@ -1422,8 +1475,7 @@ int ha_cassandra::multi_range_read_next(range_id_t *range_info) { if (!se->get_next_multiget_row()) { - read_cassandra_columns(true); - res= 0; + res= read_cassandra_columns(true); break; } else diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 9b11b055af3..52fd46fa5ef 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -58,7 +58,7 @@ class ha_cassandra: public handler bool setup_field_converters(Field **field, uint n_fields); void free_field_converters(); - void read_cassandra_columns(bool unpack_pk); + int read_cassandra_columns(bool unpack_pk); int check_table_options(struct ha_table_option_struct* options); bool doing_insert_batch; @@ -66,6 +66,8 @@ class ha_cassandra: public handler /* Used to produce 'wrong column %s at row %lu' warnings */ ha_rows insert_lineno; + void print_conversion_error(const char *field_name, + char *cass_value, int cass_value_len); public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() From 366638718c0f5ca328f023f1fea4cc4731595953 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 24 Sep 2012 20:58:26 +0400 Subject: [PATCH 244/439] Cassandra SE: varint datatype support: - allow only VARBINARY(n), all other types can get meaningless data after conversions - more comments --- mysql-test/r/cassandra.result | 2 +- storage/cassandra/ha_cassandra.cc | 33 ++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 3ca4091ed29..89e39a99c44 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -341,5 +341,5 @@ drop table t2; CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(2)) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; select rowkey, hex(varint_col) from t2; -ERROR HY000: Internal error: 'Unable to convert value of field `varint_col` from cassandra's data format. Source has 4 bytes, data: 12345678' +ERROR HY000: Internal error: 'Unable to convert value for field `varint_col` from Cassandra's data format. Source data is 4 bytes, 0x12345678' drop table t2; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 6a82f811eb4..6dc774266e4 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -848,9 +848,7 @@ const char * const validator_uuid= "org.apache.cassandra.db.marshal.UUIDType"; const char * const validator_boolean= "org.apache.cassandra.db.marshal.BooleanType"; -/* - VARINTs are stored as little-endian big numbers. -*/ +/* VARINTs are stored as big-endian big numbers. */ const char * const validator_varint= "org.apache.cassandra.db.marshal.IntegerType"; @@ -900,19 +898,32 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ break; } /* fall through: */ - case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_VARCHAR: { - bool is_varint; + /* + Cassandra's "varint" type is a binary-encoded arbitary-length + big-endian number. + - It can be mapped to VARBINARY(N), with sufficiently big N. + - If the value does not fit into N bytes, it is an error. We should not + truncate it, because that is just as good as returning garbage. + - varint should not be mapped to BINARY(N), because BINARY(N) values + are zero-padded, which will work as multiplying the value by + 2^k for some value of k. + */ + if (field->type() == MYSQL_TYPE_VARCHAR && + field->binary() && + !strcmp(validator_name, validator_varint)) + { + res= new StringCopyConverter(field->field_length); + break; + } + if (!strcmp(validator_name, validator_blob) || !strcmp(validator_name, validator_ascii) || - !strcmp(validator_name, validator_text) || - (is_varint= !strcmp(validator_name, validator_varint))) + !strcmp(validator_name, validator_text)) { - size_t max_size= (size_t)-1; - if (is_varint) - max_size= field->field_length; - res= new StringCopyConverter(max_size); + res= new StringCopyConverter((size_t)-1); } break; } From 815aad69287d83a1e1e98cd7797d02ca96f74bc3 Mon Sep 17 00:00:00 2001 From: Raghav Kapoor Date: Tue, 25 Sep 2012 15:58:46 +0530 Subject: [PATCH 245/439] 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 246/439] 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 73dfd5782bf2ec845dc5490de22d9ef8ea9f7326 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Tue, 25 Sep 2012 16:20:19 +0400 Subject: [PATCH 247/439] Cassandra SE: more datatypes support - Support mapping Cassandra's timestamp to INT64 - Support mapping Cassadnra's decimal to VARBINARY. --- mysql-test/r/cassandra.result | 26 ++++++++++++++++++++++++++ mysql-test/t/cassandra.test | 27 +++++++++++++++++++++++++++ storage/cassandra/ha_cassandra.cc | 5 ++++- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 89e39a99c44..a2bb6129928 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -343,3 +343,29 @@ thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9'; select rowkey, hex(varint_col) from t2; ERROR HY000: Internal error: 'Unable to convert value for field `varint_col` from Cassandra's data format. Source data is 4 bytes, 0x12345678' drop table t2; +# +# Decimal datatype support +# +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; +select rowkey, hex(decimal_col) from t2; +rowkey hex(decimal_col) +val_1.5 000000010F +val_0.5 0000000105 +val_1234 0000000004D2 +drop table t2; +# +# Mapping TIMESTAMP -> int64 +# +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +insert into t2 values (1, '2012-08-29 01:23:45'); +INSERT INTO t2 VALUES (10,'2012-08-29 01:23:46'); +drop table t2; +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +select * from t2; +rowkey datecol +1 1346189025000 +10 1346189026000 +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 5ff6018214e..9a0c4976254 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -73,6 +73,11 @@ insert into cf9 (rowkey, varint_col) values ('val-01', 1); insert into cf9 (rowkey, varint_col) values ('val-0x123456', 1193046); insert into cf9 (rowkey, varint_col) values ('val-0x12345678', 305419896); +create columnfamily cf11 (rowkey varchar primary key, decimal_col decimal); +insert into cf11 (rowkey, decimal_col) values ('val_0.5', 0.5); +insert into cf11 (rowkey, decimal_col) values ('val_1.5', 1.5); +insert into cf11 (rowkey, decimal_col) values ('val_1234', 1234); + EOF --error 0,1,2 --system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql @@ -436,6 +441,28 @@ CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(2)) ENGINE select rowkey, hex(varint_col) from t2; drop table t2; +--echo # +--echo # Decimal datatype support +--echo # +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; +select rowkey, hex(decimal_col) from t2; +drop table t2; + +--echo # +--echo # Mapping TIMESTAMP -> int64 +--echo # +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +insert into t2 values (1, '2012-08-29 01:23:45'); +INSERT INTO t2 VALUES (10,'2012-08-29 01:23:46'); +drop table t2; + +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +select * from t2; + +drop table t2; ############################################################################ ## Cassandra cleanup diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 6dc774266e4..18a4a8c2728 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -850,6 +850,7 @@ const char * const validator_boolean= "org.apache.cassandra.db.marshal.BooleanTy /* VARINTs are stored as big-endian big numbers. */ const char * const validator_varint= "org.apache.cassandra.db.marshal.IntegerType"; +const char * const validator_decimal= "org.apache.cassandra.db.marshal.DecimalType"; ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) @@ -869,6 +870,7 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ { bool is_counter= false; if (!strcmp(validator_name, validator_bigint) || + !strcmp(validator_name, validator_timestamp) || (is_counter= !strcmp(validator_name, validator_counter))) res= new BigintDataConverter(!is_counter); break; @@ -913,7 +915,8 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ */ if (field->type() == MYSQL_TYPE_VARCHAR && field->binary() && - !strcmp(validator_name, validator_varint)) + (!strcmp(validator_name, validator_varint) || + !strcmp(validator_name, validator_decimal))) { res= new StringCopyConverter(field->field_length); break; From bb11c81be5eb5126eb968df0e55eb05ac7d72821 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Sep 2012 18:00:26 +0530 Subject: [PATCH 248/439] From 66c7b315b1c71cdf209961c9f25bee52c674429b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Sep 2012 18:44:21 +0530 Subject: [PATCH 249/439] From b079b388a50dfa1fdaa4da0cb22154b0cc6d885e Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 25 Sep 2012 16:03:05 +0200 Subject: [PATCH 250/439] 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 344c0ea4232a4954a6eb83195bb78cace03bd4c4 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 26 Sep 2012 14:13:03 +0400 Subject: [PATCH 251/439] Cassandra SE: Add capability to retry failed API calls - Add capability to retry calls that have failed with UnavailableException or [Cassandra's] TimedOutException. - We don't retry for Thrift errors yet, although could easily do, now. --- storage/cassandra/cassandra_se.cc | 342 +++++++++++++++--------------- storage/cassandra/cassandra_se.h | 3 + storage/cassandra/ha_cassandra.cc | 12 +- 3 files changed, 189 insertions(+), 168 deletions(-) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 3be81c5e6bf..7a825a9fc00 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -45,6 +45,9 @@ class Cassandra_se_impl: public Cassandra_se_interface ConsistencyLevel::type write_consistency; ConsistencyLevel::type read_consistency; + + /* How many times to retry an operation before giving up */ + int thrift_call_retries_to_do; /* DDL data */ @@ -72,10 +75,12 @@ class Cassandra_se_impl: public Cassandra_se_interface SlicePredicate slice_pred; bool get_slices_returned_less; + bool get_slice_found_rows; public: Cassandra_se_impl() : cass(NULL), write_consistency(ConsistencyLevel::ONE), - read_consistency(ConsistencyLevel::ONE) {} + read_consistency(ConsistencyLevel::ONE), + thrift_call_retries_to_do(0) {} virtual ~Cassandra_se_impl(){ delete cass; } /* Connection and DDL checks */ @@ -94,6 +99,7 @@ public: void clear_insert_buffer(); void start_row_insert(const char *key, int key_len); void add_insert_column(const char *name, const char *value, int value_len); + bool do_insert(); /* Reads, point lookups */ @@ -105,6 +111,8 @@ public: private: bool have_rowkey_to_skip; std::string rowkey_to_skip; + + bool get_range_slices_param_last_key_as_start_key; public: bool get_range_slices(bool last_key_as_start_key); void finish_reading_range_slices(); @@ -119,19 +127,30 @@ public: int add_lookup_key(const char *key, size_t key_len); bool multiget_slice(); -private: - std::vector mrr_keys; /* TODO: can we use allocator to put them onto MRR buffer? */ - std::map > mrr_result; - std::map >::iterator mrr_result_it; -public: bool get_next_multiget_row(); bool truncate(); + bool remove_row(); private: + bool retryable_truncate(); + bool retryable_do_insert(); + bool retryable_remove_row(); + bool retryable_setup_ddl_checks(); + bool retryable_multiget_slice(); + bool retryable_get_range_slices(); + bool retryable_get_slice(); + + std::vector mrr_keys; /* can we use allocator to put these into MRR buffer? */ + std::map > mrr_result; + std::map >::iterator mrr_result_it; + /* Non-inherited utility functions: */ int64_t get_i64_timestamp(); + + typedef bool (Cassandra_se_impl::*retryable_func_t)(); + bool try_operation(retryable_func_t func); }; @@ -189,34 +208,36 @@ void Cassandra_se_impl::set_consistency_levels(ulong read_cons_level, } -bool Cassandra_se_impl::setup_ddl_checks() +bool Cassandra_se_impl::retryable_setup_ddl_checks() { try { + cass->describe_keyspace(ks_def, keyspace); - - std::vector::iterator it; - for (it= ks_def.cf_defs.begin(); it < ks_def.cf_defs.end(); it++) - { - cf_def= *it; - if (!cf_def.name.compare(column_family)) - return false; - } - - print_error("describe_keyspace() didn't return our column family"); - - } catch (InvalidRequestException ire) { - print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (NotFoundException nfe) { - print_error("keyspace not found: %s", nfe.what()); - }catch(TException e){ - print_error("Thrift exception: %s", e.what()); - } catch (...) { - print_error("Unknown exception"); + print_error("keyspace `%s` not found: %s", keyspace.c_str(), nfe.what()); + return true; } + std::vector::iterator it; + for (it= ks_def.cf_defs.begin(); it < ks_def.cf_defs.end(); it++) + { + cf_def= *it; + if (!cf_def.name.compare(column_family)) + return false; + } + + print_error("Column family %s not found in keyspace %s", + column_family.c_str(), + keyspace.c_str()); return true; } +bool Cassandra_se_impl::setup_ddl_checks() +{ + return try_operation(&Cassandra_se_impl::retryable_setup_ddl_checks); +} + void Cassandra_se_impl::first_ddl_column() { @@ -309,41 +330,29 @@ void Cassandra_se_impl::add_insert_column(const char *name, const char *value, } +bool Cassandra_se_impl::retryable_do_insert() +{ + cass->batch_mutate(batch_mutation, write_consistency); + + cassandra_counters.row_inserts+= batch_mutation.size(); + cassandra_counters.row_insert_batches++; + + clear_insert_buffer(); + return 0; +} + + bool Cassandra_se_impl::do_insert() { - bool res= true; - /* - zero-size mutations are allowed by Cassandra's batch_mutate but lets not + zero-size mutations are allowed by Cassandra's batch_mutate but lets not do them (we may attempt to do it if there is a bulk insert that stores exactly @@cassandra_insert_batch_size*n elements. */ if (batch_mutation.empty()) return false; - - try { - - cass->batch_mutate(batch_mutation, write_consistency); - - cassandra_counters.row_inserts+= batch_mutation.size(); - cassandra_counters.row_insert_batches++; - - clear_insert_buffer(); - res= false; - - } catch (InvalidRequestException ire) { - print_error("%s [%s]", ire.what(), ire.why.c_str()); - } catch (UnavailableException ue) { - print_error("UnavailableException: %s", ue.what()); - } catch (TimedOutException te) { - print_error("TimedOutException: %s", te.what()); - }catch(TException e){ - print_error("Thrift exception: %s", e.what()); - } catch (...) { - print_error("Unknown exception"); - } - - return res; + + return try_operation(&Cassandra_se_impl::retryable_do_insert); } @@ -357,48 +366,40 @@ bool Cassandra_se_impl::do_insert() */ bool Cassandra_se_impl::get_slice(char *key, size_t key_len, bool *found) +{ + bool res; + rowkey.assign(key, key_len); + + if (!(res= try_operation(&Cassandra_se_impl::retryable_get_slice))) + *found= get_slice_found_rows; + return res; +} + + +bool Cassandra_se_impl::retryable_get_slice() { ColumnParent cparent; cparent.column_family= column_family; - rowkey.assign(key, key_len); - SlicePredicate slice_pred; SliceRange sr; sr.start = ""; sr.finish = ""; slice_pred.__set_slice_range(sr); - try { - cass->get_slice(column_data_vec, rowkey, cparent, slice_pred, - read_consistency); + cass->get_slice(column_data_vec, rowkey, cparent, slice_pred, + read_consistency); - if (column_data_vec.size() == 0) - { - /* - No columns found. Cassandra doesn't allow records without any column => - this means the seach key doesn't exist - */ - *found= false; - return false; - } - *found= true; - - } catch (InvalidRequestException ire) { - print_error("%s [%s]", ire.what(), ire.why.c_str()); - return true; - } catch (UnavailableException ue) { - print_error("UnavailableException: %s", ue.what()); - return true; - } catch (TimedOutException te) { - print_error("TimedOutException: %s", te.what()); - return true; - }catch(TException e){ - print_error("Thrift exception: %s", e.what()); - } catch (...) { - print_error("Unknown exception"); - return true; + if (column_data_vec.size() == 0) + { + /* + No columns found. Cassandra doesn't allow records without any column => + this means the seach key doesn't exist + */ + get_slice_found_rows= false; + return false; } + get_slice_found_rows= true; column_data_it= column_data_vec.begin(); return false; @@ -456,7 +457,15 @@ void Cassandra_se_impl::get_read_rowkey(char **value, int *value_len) bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) { - bool res= true; + get_range_slices_param_last_key_as_start_key= last_key_as_start_key; + + return try_operation(&Cassandra_se_impl::retryable_get_range_slices); +} + + +bool Cassandra_se_impl::retryable_get_range_slices() +{ + bool last_key_as_start_key= get_range_slices_param_last_key_as_start_key; ColumnParent cparent; cparent.column_family= column_family; @@ -482,32 +491,17 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) key_range.end_key.assign("", 0); key_range.count= read_batch_size; - try { - - cass->get_range_slices(key_slice_vec, - cparent, slice_pred, key_range, - read_consistency); - res= false; - if (key_slice_vec.size() < (uint)read_batch_size) - get_slices_returned_less= true; - else - get_slices_returned_less= false; + cass->get_range_slices(key_slice_vec, cparent, slice_pred, key_range, + read_consistency); - } catch (InvalidRequestException ire) { - print_error("%s [%s]", ire.what(), ire.why.c_str()); - } catch (UnavailableException ue) { - print_error("UnavailableException: %s", ue.what()); - } catch (TimedOutException te) { - print_error("TimedOutException: %s", te.what()); - }catch(TException e){ - print_error("Thrift exception: %s", e.what()); - } catch (...) { - print_error("Unknown exception"); - } + if (key_slice_vec.size() < (uint)read_batch_size) + get_slices_returned_less= true; + else + get_slices_returned_less= false; key_slice_it= key_slice_vec.begin(); - return res; + return false; } @@ -574,50 +568,78 @@ void Cassandra_se_impl::add_read_column(const char *name_arg) bool Cassandra_se_impl::truncate() { - bool res= true; - try { - - cass->truncate(column_family); - res= false; - - } catch (InvalidRequestException ire) { - print_error("%s [%s]", ire.what(), ire.why.c_str()); - } catch (UnavailableException ue) { - print_error("UnavailableException: %s", ue.what()); - } catch (TimedOutException te) { - print_error("TimedOutException: %s", te.what()); - }catch(TException e){ - print_error("Thrift exception: %s", e.what()); - } catch (...) { - print_error("Unknown exception"); - } - - return res; + return try_operation(&Cassandra_se_impl::retryable_truncate); } + +bool Cassandra_se_impl::retryable_truncate() +{ + cass->truncate(column_family); + return 0; +} + + bool Cassandra_se_impl::remove_row() { - bool res= true; + return try_operation(&Cassandra_se_impl::retryable_remove_row); +} + +bool Cassandra_se_impl::retryable_remove_row() +{ ColumnPath column_path; column_path.column_family= column_family; + cass->remove(rowkey, column_path, get_i64_timestamp(), write_consistency); + return 0; +} - try { - - cass->remove(rowkey, column_path, get_i64_timestamp(), write_consistency); - res= false; +/* + This function will try a Cassandra operation, and handle errors. - } catch (InvalidRequestException ire) { - print_error("%s [%s]", ire.what(), ire.why.c_str()); - } catch (UnavailableException ue) { - print_error("UnavailableException: %s", ue.what()); - } catch (TimedOutException te) { - print_error("TimedOutException: %s", te.what()); - }catch(TException e){ - print_error("Thrift exception: %s", e.what()); - } catch (...) { - print_error("Unknown exception"); - } +*/ +bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call) +{ + bool res; + int n_retries= thrift_call_retries_to_do; + + do + { + res= true; + + try { + + if ((res= (this->*func_to_call)())) + { + /* + The function call was made successfully (without timeouts, etc), + but something inside it returned 'true'. + This is supposedly a failure (or "not found" or other negative + result). We need to return this to the caller. + */ + n_retries= 0; + } + + } catch (InvalidRequestException ire) { + n_retries= 0; /* there is no point in retrying this operation */ + print_error("%s [%s]", ire.what(), ire.why.c_str()); + } catch (UnavailableException ue) { + cassandra_counters.unavailable_exceptions++; + if (!--n_retries) + print_error("UnavailableException: %s", ue.what()); + } catch (TimedOutException te) { + cassandra_counters.timeout_exceptions++; + if (!--n_retries) + print_error("TimedOutException: %s", te.what()); + }catch(TException e){ + /* todo: we may use retry for certain kinds of Thrift errors */ + n_retries= 0; + print_error("Thrift exception: %s", e.what()); + } catch (...) { + n_retries= 0; /* Don't retry */ + print_error("Unknown exception"); + } + + } while (res && n_retries > 0); return res; } @@ -638,8 +660,13 @@ int Cassandra_se_impl::add_lookup_key(const char *key, size_t key_len) return mrr_keys.size(); } - bool Cassandra_se_impl::multiget_slice() +{ + return try_operation(&Cassandra_se_impl::retryable_multiget_slice); +} + + +bool Cassandra_se_impl::retryable_multiget_slice() { ColumnParent cparent; cparent.column_family= column_family; @@ -650,34 +677,15 @@ bool Cassandra_se_impl::multiget_slice() sr.finish = ""; slice_pred.__set_slice_range(sr); - bool res= true; + cassandra_counters.multiget_reads++; + cassandra_counters.multiget_keys_scanned += mrr_keys.size(); + cass->multiget_slice(mrr_result, mrr_keys, cparent, slice_pred, + read_consistency); - try { - - cassandra_counters.multiget_reads++; - cassandra_counters.multiget_keys_scanned += mrr_keys.size(); + cassandra_counters.multiget_rows_read += mrr_result.size(); + mrr_result_it= mrr_result.begin(); - cass->multiget_slice(mrr_result, mrr_keys, cparent, slice_pred, - read_consistency); - - cassandra_counters.multiget_rows_read += mrr_result.size(); - - res= false; - mrr_result_it= mrr_result.begin(); - - } catch (InvalidRequestException ire) { - print_error("%s [%s]", ire.what(), ire.why.c_str()); - } catch (UnavailableException ue) { - print_error("UnavailableException: %s", ue.what()); - } catch (TimedOutException te) { - print_error("TimedOutException: %s", te.what()); - }catch(TException e){ - print_error("Thrift exception: %s", e.what()); - } catch (...) { - print_error("Unknown exception"); - } - - return res; + return false; } diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 33ef677d276..c6de779f8bc 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -91,6 +91,9 @@ public: ulong multiget_reads; ulong multiget_keys_scanned; ulong multiget_rows_read; + + ulong timeout_exceptions; + ulong unavailable_exceptions; }; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 18a4a8c2728..187df2a2dd8 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -82,6 +82,11 @@ static MYSQL_THDVAR_ULONG(rnd_batch_size, PLUGIN_VAR_RQCMDARG, "Number of rows in an rnd_read (full scan) batch", NULL, NULL, /*default*/ 10*1000, /*min*/ 1, /*max*/ 1024*1024*1024, 0); +static MYSQL_THDVAR_ULONG(failure_retries, PLUGIN_VAR_RQCMDARG, + "Number of times to retry Cassandra calls that failed due to timeouts or " + "network communication problems. The default, 0, means not to retry.", + NULL, NULL, /*default*/ 0, /*min*/ 0, /*max*/ 1024*1024*1024, 0); + /* These match values in enum_cassandra_consistency_level */ const char *cassandra_consistency_level[] = { @@ -161,6 +166,7 @@ static struct st_mysql_sys_var* cassandra_system_variables[]= { MYSQL_SYSVAR(default_thrift_host), MYSQL_SYSVAR(write_consistency), MYSQL_SYSVAR(read_consistency), + MYSQL_SYSVAR(failure_retries), NULL }; @@ -177,6 +183,11 @@ static SHOW_VAR cassandra_status_variables[]= { (char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG}, {"multiget_rows_read", (char*) &cassandra_counters.multiget_rows_read, SHOW_LONG}, + + {"timeout_exceptions", + (char*) &cassandra_counters.timeout_exceptions, SHOW_LONG}, + {"unavailable_exceptions", + (char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG}, {NullS, NullS, SHOW_LONG} }; @@ -1678,7 +1689,6 @@ bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info, static int show_cassandra_vars(THD *thd, SHOW_VAR *var, char *buff) { - //innodb_export_status(); cassandra_counters_copy= cassandra_counters; var->type= SHOW_ARRAY; From 0362968be82c391db9d19230090f4a7d95092018 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 26 Sep 2012 14:57:45 +0400 Subject: [PATCH 252/439] Cassandra SE: - Add a test for ALTER TABLE --- mysql-test/t/cassandra.test | 26 ++++++++++++++++++++++++++ storage/cassandra/cassandra_se.cc | 4 ++-- storage/cassandra/ha_cassandra.cc | 3 +-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 9a0c4976254..c564a63fd2d 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -78,6 +78,8 @@ insert into cf11 (rowkey, decimal_col) values ('val_0.5', 0.5); insert into cf11 (rowkey, decimal_col) values ('val_1.5', 1.5); insert into cf11 (rowkey, decimal_col) values ('val_1234', 1234); +create columnfamily cf12 (rowkey varchar primary key, decimal_col decimal); + EOF --error 0,1,2 --system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql @@ -464,6 +466,30 @@ select * from t2; drop table t2; +--echo # +--echo # Check whether changing parameters with ALTER TABLE works. +--echo # +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; + +--error ER_INTERNAL_ERROR +alter table t2 column_family='cf9'; + +drop table t2; + +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; + +let $c1= `select variable_value from information_schema.global_status + where variable_name like 'cassandra_row_inserts'`; +alter table t2 column_family='cf12'; +let $c2= `select variable_value from information_schema.global_status + where variable_name like 'cassandra_row_inserts'`; + +--disable_query_log +eval select ($c2 - $c1) as 'Writes made during ALTER TABLE'; +--enable_query_log + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 7a825a9fc00..e46d02f48d9 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -594,8 +594,8 @@ bool Cassandra_se_impl::retryable_remove_row() } /* - This function will try a Cassandra operation, and handle errors. - + Try calling a function, catching possible Cassandra errors, and re-trying + for "transient" errors. */ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call) { diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 187df2a2dd8..df4b54cc4f7 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1676,9 +1676,8 @@ int ha_cassandra::delete_table(const char *name) bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes) { - //ha_table_option_struct *param_old, *param_new; DBUG_ENTER("ha_cassandra::check_if_incompatible_data"); - + /* Checked, we intend to have this empty for Cassandra SE. */ DBUG_RETURN(COMPATIBLE_DATA_YES); } From 422e6b520dd8790ec2e81790c5621ca4288e5289 Mon Sep 17 00:00:00 2001 From: Akhila Maddukuri Date: Wed, 26 Sep 2012 16:38:42 +0530 Subject: [PATCH 253/439] 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 c69a8fa6164c112b496c92000be5525dd46da7f8 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 26 Sep 2012 19:02:12 +0400 Subject: [PATCH 254/439] - Update testcases - Better error messages. --- mysql-test/r/cassandra.result | 12 ++++++++++++ mysql-test/t/cassandra.test | 6 ++++-- storage/cassandra/ha_cassandra.cc | 15 ++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index a2bb6129928..6497eab6dd2 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -369,3 +369,15 @@ rowkey datecol 1 1346189025000 10 1346189026000 drop table t2; +# +# Check whether changing parameters with ALTER TABLE works. +# +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; +drop table t2; +CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; +alter table t2 column_family='cf12'; +Writes made during ALTER TABLE +0 +drop table t2; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index c564a63fd2d..3f5933e8b66 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -472,8 +472,8 @@ drop table t2; CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11'; ---error ER_INTERNAL_ERROR -alter table t2 column_family='cf9'; +#--error ER_INTERNAL_ERROR +#alter table t2 column_family='cf9'; drop table t2; @@ -490,6 +490,8 @@ let $c2= `select variable_value from information_schema.global_status eval select ($c2 - $c1) as 'Writes made during ALTER TABLE'; --enable_query_log +drop table t2; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index df4b54cc4f7..f9aa8cd40a8 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -992,7 +992,20 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) if (n_mapped != n_fields - 1) { - se->print_error("Some of SQL fields were not mapped to Cassandra's fields"); + Field *first_unmapped= NULL; + /* Find the first field */ + for (uint i= 1; i < n_fields;i++) + { + if (!field_converters[i]) + { + first_unmapped= field_arg[i]; + break; + } + } + DBUG_ASSERT(first_unmapped); + + se->print_error("Field `%s` could not be mapped to any field in Cassandra", + first_unmapped->field_name); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); return true; } From faca6ed81e90e953fb7cf6e9756c424a0ecd391d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Sep 2012 18:29:09 +0100 Subject: [PATCH 255/439] From 2d88c4befb93c5d02f91aa01c33824d86d056188 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 27 Sep 2012 11:59:14 +0400 Subject: [PATCH 256/439] Cassandra SE - Support UPDATE statements - Follow what CQL does: don't show deleted rows (they show up as rows without any columns in reads) --- mysql-test/r/cassandra.result | 28 +++++++++- mysql-test/t/cassandra.test | 19 +++++++ storage/cassandra/cassandra_se.cc | 46 +++++++++++++++- storage/cassandra/cassandra_se.h | 10 ++++ storage/cassandra/ha_cassandra.cc | 88 ++++++++++++++++++++++++++++++- storage/cassandra/ha_cassandra.h | 1 + 6 files changed, 188 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 6497eab6dd2..07720bb5b23 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -41,7 +41,6 @@ select * from t1; pk data1 data2 rowkey12 data1-value3 454 rowkey10 data1-value 123456 -rowkey11 NULL NULL delete from t1; select * from t1; pk data1 data2 @@ -381,3 +380,30 @@ alter table t2 column_family='cf12'; Writes made during ALTER TABLE 0 drop table t2; +# +# UPDATE command support +# +create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra +thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1; +pk data1 data2 +rowkey12 data1-value3 454 +rowkey10 data1-value 123456 +rowkey11 data1-value2 34543 +update t1 set data1='updated-1' where pk='rowkey11'; +select * from t1; +pk data1 data2 +rowkey12 data1-value3 454 +rowkey10 data1-value 123456 +rowkey11 updated-1 34543 +update t1 set pk='new-rowkey12' where pk='rowkey12'; +select * from t1; +pk data1 data2 +rowkey10 data1-value 123456 +new-rowkey12 data1-value3 454 +rowkey11 updated-1 34543 +delete from t1; +drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 3f5933e8b66..7e5b327580c 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -492,6 +492,25 @@ eval select ($c2 - $c1) as 'Writes made during ALTER TABLE'; drop table t2; +--echo # +--echo # UPDATE command support +--echo # +create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra + thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; + +insert into t1 values ('rowkey10', 'data1-value', 123456); +insert into t1 values ('rowkey11', 'data1-value2', 34543); +insert into t1 values ('rowkey12', 'data1-value3', 454); +select * from t1; + +update t1 set data1='updated-1' where pk='rowkey11'; +select * from t1; +update t1 set pk='new-rowkey12' where pk='rowkey12'; +select * from t1; + +delete from t1; +drop table t1; + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index e46d02f48d9..2239323bd20 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -99,6 +99,8 @@ public: void clear_insert_buffer(); void start_row_insert(const char *key, int key_len); void add_insert_column(const char *name, const char *value, int value_len); + void add_row_deletion(const char *key, int key_len, + Column_name_enumerator *col_names); bool do_insert(); @@ -313,6 +315,42 @@ void Cassandra_se_impl::start_row_insert(const char *key, int key_len) } +void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, + Column_name_enumerator *col_names) +{ + std::string key_to_delete; + key_to_delete.assign(key, key_len); + + batch_mutation[key_to_delete]= ColumnFamilyToMutation(); + ColumnFamilyToMutation& cf_mut= batch_mutation[key_to_delete]; + + cf_mut[column_family]= std::vector(); + std::vector &mutation_list= cf_mut[column_family]; + + Mutation mut; + mut.__isset.deletion= true; + mut.deletion.__isset.timestamp= true; + mut.deletion.timestamp= get_i64_timestamp(); + mut.deletion.__isset.predicate= true; + + /* + Attempting to delete columns with SliceRange causes exception with message + "Deletion does not yet support SliceRange predicates". + + Delete all columns individually. + */ + SlicePredicate slice_pred; + slice_pred.__isset.column_names= true; + const char *col_name; + while ((col_name= col_names->get_next_name())) + slice_pred.column_names.push_back(std::string(col_name)); + + mut.deletion.predicate= slice_pred; + + mutation_list.push_back(mut); +} + + void Cassandra_se_impl::add_insert_column(const char *name, const char *value, int value_len) { @@ -531,7 +569,13 @@ restart: } } - if (have_rowkey_to_skip && !rowkey_to_skip.compare(key_slice_it->key)) + /* + (1) - skip the last row that we have read in the previous batch. + (2) - Rows that were deleted show up as rows without any columns. Skip + them, like CQL does. + */ + if ((have_rowkey_to_skip && !rowkey_to_skip.compare(key_slice_it->key)) || // (1) + key_slice_it->columns.size() == 0) // (2) { key_slice_it++; goto restart; diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index c6de779f8bc..069a3b238f9 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -20,6 +20,14 @@ typedef enum THREE = 8-1, } enum_cassandra_consistency_level; + +class Column_name_enumerator +{ +public: + virtual const char* get_next_name()=0; + virtual ~Column_name_enumerator(){} +}; + /* Interface to one cassandra column family, i.e. one 'table' */ @@ -45,6 +53,8 @@ public: /* Writes */ virtual void clear_insert_buffer()=0; + virtual void add_row_deletion(const char *key, int key_len, + Column_name_enumerator *col_names)=0; virtual void start_row_insert(const char *key, int key_len)=0; virtual void add_insert_column(const char *name, const char *value, int value_len)=0; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index f9aa8cd40a8..7ec7f7aa4eb 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1605,11 +1605,95 @@ ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, } +class Column_name_enumerator_impl : public Column_name_enumerator +{ + ha_cassandra *obj; + uint idx; +public: + Column_name_enumerator_impl(ha_cassandra *obj_arg) : obj(obj_arg), idx(1) {} + const char* get_next_name() + { + if (idx == obj->table->s->fields) + return NULL; + else + return obj->table->field[idx++]->field_name; + } +}; + + int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) { - + my_bitmap_map *old_map; DBUG_ENTER("ha_cassandra::update_row"); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); + /* Currently, it is guaranteed that new_data == table->record[0] */ + + /* For now, just rewrite the full record */ + se->clear_insert_buffer(); + + + old_map= dbug_tmp_use_all_columns(table, table->read_set); + + char *old_key; + int old_key_len; + se->get_read_rowkey(&old_key, &old_key_len); + + /* Get the key we're going to write */ + char *new_key; + int new_key_len; + if (rowkey_converter->mariadb_to_cassandra(&new_key, &new_key_len)) + { + my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), + rowkey_converter->field->field_name, insert_lineno); + dbug_tmp_restore_column_map(table->read_set, old_map); + DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + } + + /* + Compare it to the key we've read. For all types that Cassandra supports, + binary byte-wise comparison can be used + */ + bool new_primary_key; + if (new_key_len != old_key_len || memcmp(old_key, new_key, new_key_len)) + new_primary_key= true; + else + new_primary_key= false; + + + if (new_primary_key) + { + /* + Primary key value changed. This is essentially a DELETE + INSERT. + Add a DELETE operation into the batch + */ + Column_name_enumerator_impl name_enumerator(this); + se->add_row_deletion(old_key, old_key_len, &name_enumerator); + } + + se->start_row_insert(new_key, new_key_len); + + /* Convert other fields */ + for (uint i= 1; i < table->s->fields; i++) + { + char *cass_data; + int cass_data_len; + if (field_converters[i]->mariadb_to_cassandra(&cass_data, &cass_data_len)) + { + my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), + field_converters[i]->field->field_name, insert_lineno); + dbug_tmp_restore_column_map(table->read_set, old_map); + DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + } + se->add_insert_column(field_converters[i]->field->field_name, + cass_data, cass_data_len); + } + dbug_tmp_restore_column_map(table->read_set, old_map); + + bool res= se->do_insert(); + + if (res) + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + + DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); } diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 52fd46fa5ef..f94dbc1c49d 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -45,6 +45,7 @@ struct ha_table_option_struct; */ class ha_cassandra: public handler { + friend class Column_name_enumerator_impl; THR_LOCK_DATA lock; ///< MySQL lock CASSANDRA_SHARE *share; ///< Shared lock info From 4db207d56da2f832d8bc6cc1d935a17efcbc1035 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 27 Sep 2012 16:08:28 +0400 Subject: [PATCH 257/439] Cassandra SE: lazy connections - Don't connect right away in ha_cassandra::open. If we do this, it becomes impossible to do SHOW CREATE TABLE when the server is not present. - Note: CREATE TABLE still requires that connection is present, as it needs to check whether the specified DDL can be used with Cassandra. We could delay that check also, but then one would not be able to find out about errors in table DDL until they do a SELECT. --- storage/cassandra/cassandra_se.cc | 2 +- storage/cassandra/cassandra_se.h | 2 +- storage/cassandra/ha_cassandra.cc | 104 ++++++++++++++++-------------- storage/cassandra/ha_cassandra.h | 4 +- 4 files changed, 62 insertions(+), 50 deletions(-) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 2239323bd20..7d48bbc30d6 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -159,7 +159,7 @@ private: ///////////////////////////////////////////////////////////////////////////// // Connection and setup ///////////////////////////////////////////////////////////////////////////// -Cassandra_se_interface *get_cassandra_se() +Cassandra_se_interface *create_cassandra_se() { return new Cassandra_se_impl; } diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 069a3b238f9..33c602d93a6 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -110,5 +110,5 @@ public: extern Cassandra_status_vars cassandra_counters; -Cassandra_se_interface *get_cassandra_se(); +Cassandra_se_interface *create_cassandra_se(); diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 7ec7f7aa4eb..c4069458c41 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -375,21 +375,16 @@ const char **ha_cassandra::bas_ext() const } -int ha_cassandra::open(const char *name, int mode, uint test_if_locked) +int ha_cassandra::connect_and_check_options(TABLE *table_arg) { - ha_table_option_struct *options= table->s->option_struct; + ha_table_option_struct *options= table_arg->s->option_struct; int res; - DBUG_ENTER("ha_cassandra::open"); + DBUG_ENTER("ha_cassandra::connect_and_check_options"); - if (!(share = get_share(name, table))) - DBUG_RETURN(1); - thr_lock_data_init(&share->lock,&lock,NULL); - - DBUG_ASSERT(!se); if ((res= check_table_options(options))) DBUG_RETURN(res); - se= get_cassandra_se(); + se= create_cassandra_se(); se->set_column_family(options->column_family); const char *thrift_host= options->thrift_host? options->thrift_host: cassandra_default_thrift_host; @@ -399,11 +394,36 @@ int ha_cassandra::open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(HA_ERR_NO_CONNECTION); } - if (setup_field_converters(table->field, table->s->fields)) + if (setup_field_converters(table_arg->field, table_arg->s->fields)) { DBUG_RETURN(HA_ERR_NO_CONNECTION); } + DBUG_RETURN(0); +} + + +int ha_cassandra::open(const char *name, int mode, uint test_if_locked) +{ + DBUG_ENTER("ha_cassandra::open"); + + if (!(share = get_share(name, table))) + DBUG_RETURN(1); + thr_lock_data_init(&share->lock,&lock,NULL); + + DBUG_ASSERT(!se); + /* + Don't do the following on open: it prevents SHOW CREATE TABLE when the server + has gone away. + */ + /* + int res; + if ((res= connect_and_check_options(table))) + { + DBUG_RETURN(res); + } + */ + info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); insert_lineno= 0; @@ -444,7 +464,7 @@ int ha_cassandra::check_table_options(ha_table_option_struct *options) /** @brief - create() is called to create a database. The variable name will have the name + create() is called to create a table. The variable name will have the name of the table. @details @@ -485,45 +505,10 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, DBUG_RETURN(HA_WRONG_CREATE_OPTION); } -#ifndef DBUG_OFF -/* - DBUG_PRINT("info", ("strparam: '%-.64s' ullparam: %llu enumparam: %u "\ - "boolparam: %u", - (options->strparam ? options->strparam : ""), - options->ullparam, options->enumparam, options->boolparam)); - - psergey-todo: check table definition! - for (Field **field= table_arg->s->field; *field; field++) - { - ha_field_option_struct *field_options= (*field)->option_struct; - DBUG_ASSERT(field_options); - DBUG_PRINT("info", ("field: %s complex: '%-.64s'", - (*field)->field_name, - (field_options->complex_param_to_parse_it_in_engine ? - field_options->complex_param_to_parse_it_in_engine : - ""))); - } -*/ -#endif DBUG_ASSERT(!se); - if ((res= check_table_options(options))) + if ((res= connect_and_check_options(table_arg))) DBUG_RETURN(res); - se= get_cassandra_se(); - se->set_column_family(options->column_family); - const char *thrift_host= options->thrift_host? options->thrift_host: - cassandra_default_thrift_host; - if (se->connect(thrift_host, options->thrift_port, options->keyspace)) - { - my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str()); - DBUG_RETURN(HA_ERR_NO_CONNECTION); - } - - if (setup_field_converters(table_arg->s->field, table_arg->s->fields)) - { - my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "setup_field_converters"); - DBUG_RETURN(HA_ERR_NO_CONNECTION); - } insert_lineno= 0; DBUG_RETURN(0); } @@ -1064,6 +1049,14 @@ void ha_cassandra::free_field_converters() } +int ha_cassandra::index_init(uint idx, bool sorted) +{ + int ires; + if (!se && (ires= connect_and_check_options(table))) + return ires; + return 0; +} + void store_key_image_to_rec(Field *field, uchar *ptr, uint len); int ha_cassandra::index_read_map(uchar *buf, const uchar *key, @@ -1198,8 +1191,12 @@ err: int ha_cassandra::write_row(uchar *buf) { my_bitmap_map *old_map; + int ires; DBUG_ENTER("ha_cassandra::write_row"); + if (!se && (ires= connect_and_check_options(table))) + DBUG_RETURN(ires); + if (!doing_insert_batch) se->clear_insert_buffer(); @@ -1260,6 +1257,10 @@ int ha_cassandra::write_row(uchar *buf) void ha_cassandra::start_bulk_insert(ha_rows rows) { + int ires; + if (!se && (ires= connect_and_check_options(table))) + return; + doing_insert_batch= true; insert_rows_batched= 0; @@ -1283,7 +1284,12 @@ int ha_cassandra::end_bulk_insert() int ha_cassandra::rnd_init(bool scan) { bool bres; + int ires; DBUG_ENTER("ha_cassandra::rnd_init"); + + if (!se && (ires= connect_and_check_options(table))) + DBUG_RETURN(ires); + if (!scan) { /* Prepare for rnd_pos() calls. We don't need to anything. */ @@ -1338,8 +1344,12 @@ int ha_cassandra::rnd_next(uchar *buf) int ha_cassandra::delete_all_rows() { bool bres; + int ires; DBUG_ENTER("ha_cassandra::delete_all_rows"); + if (!se && (ires= connect_and_check_options(table))) + DBUG_RETURN(ires); + bres= se->truncate(); if (bres) diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index f94dbc1c49d..fb5236bf118 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -69,6 +69,7 @@ class ha_cassandra: public handler ha_rows insert_lineno; void print_conversion_error(const char *field_name, char *cass_value, int cass_value_len); + int connect_and_check_options(TABLE *table_arg); public: ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg); ~ha_cassandra() @@ -152,7 +153,8 @@ public: */ uint max_supported_key_length() const { return 16*1024; /* just to return something*/ } - /* At the moment, we're ok with default handler::index_init() implementation. */ + int index_init(uint idx, bool sorted); + int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); From 7327cd9717f0b98499f0f5b19c84e5e3e48241df Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Sep 2012 14:01:17 +0300 Subject: [PATCH 258/439] =?UTF-8?q?MDEV-377=20Name=20support=20for=20dynam?= =?UTF-8?q?ic=20columns=20MDEV-127=20Optimization=20of=20memory=20allocati?= =?UTF-8?q?on=20MDEV-483=20Make=20column=5Fcheck=20function=20which=20che?= =?UTF-8?q?=D1=81ks=20dynamic=20columns=20integrit=20JSON=20conversion=20f?= =?UTF-8?q?unction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/ma_dyncol.h | 32 + include/my_sys.h | 6 + mysql-test/r/dyncol.result | 292 +++- mysql-test/t/dyncol.test | 122 ++ mysys/ma_dyncol.c | 2672 ++++++++++++++++++++++++++++-------- mysys/string.c | 102 ++ sql/item.h | 2 +- sql/item_cmpfunc.cc | 73 +- sql/item_cmpfunc.h | 8 + sql/item_create.cc | 14 +- sql/item_create.h | 1 + sql/item_strfunc.cc | 226 ++- sql/item_strfunc.h | 18 +- sql/lex.h | 2 + sql/sql_string.cc | 73 - sql/sql_yacc.yy | 20 +- 16 files changed, 2940 insertions(+), 723 deletions(-) diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index 6174328d62a..b4b9df7da19 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -102,6 +102,13 @@ dynamic_column_create_many(DYNAMIC_COLUMN *str, uint *column_numbers, DYNAMIC_COLUMN_VALUE *values); +enum enum_dyncol_func_result +dynamic_column_create_many_fmt(DYNAMIC_COLUMN *str, + uint column_count, + uchar *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool names); + enum enum_dyncol_func_result dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr, DYNAMIC_COLUMN_VALUE *value); @@ -110,16 +117,30 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, uint add_column_count, uint *column_numbers, DYNAMIC_COLUMN_VALUE *values); +enum enum_dyncol_func_result +dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, + uint add_column_count, + void *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool string_keys); enum enum_dyncol_func_result dynamic_column_delete(DYNAMIC_COLUMN *org, uint column_nr); enum enum_dyncol_func_result dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr); +enum enum_dyncol_func_result +dynamic_column_exists_str(DYNAMIC_COLUMN *str, LEX_STRING *name); +enum enum_dyncol_func_result +dynamic_column_exists_fmt(DYNAMIC_COLUMN *str, void *key, my_bool string_keys); /* List of not NULL columns */ enum enum_dyncol_func_result dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); +enum enum_dyncol_func_result +dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr); +enum enum_dyncol_func_result +dynamic_column_list_fmt(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array, my_bool string_keys); /* if the column do not exists it is NULL @@ -127,6 +148,17 @@ dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); enum enum_dyncol_func_result dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr, DYNAMIC_COLUMN_VALUE *store_it_here); +enum enum_dyncol_func_result +dynamic_column_get_str(DYNAMIC_COLUMN *str, LEX_STRING *name, + DYNAMIC_COLUMN_VALUE *store_it_here); + +my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str); + +enum enum_dyncol_func_result +dynamic_column_check(DYNAMIC_COLUMN *str); + +enum enum_dyncol_func_result +dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json); #define dynamic_column_initialize(A) memset((A), 0, sizeof(*(A))) #define dynamic_column_column_free(V) dynstr_free(V) diff --git a/include/my_sys.h b/include/my_sys.h index a02c390fe4b..58a343bb789 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -793,12 +793,18 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, size_t length); extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...); +extern my_bool dynstr_append_quoted(DYNAMIC_STRING *str, + const char *append, size_t len); extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); extern void dynstr_free(DYNAMIC_STRING *str); extern void dynstr_reassociate(DYNAMIC_STRING *str, char **res, size_t *length, size_t *alloc_length); +extern uint32 copy_and_convert_extended(char *to, uint32 to_length, + CHARSET_INFO *to_cs, + const char *from, uint32 from_length, + CHARSET_INFO *from_cs, uint *errors); #ifdef HAVE_MLOCK extern void *my_malloc_lock(size_t length,myf flags); extern void my_free_lock(void *ptr); diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 13543223ad8..2e9a8462eee 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1088,7 +1088,7 @@ column_list(column_add(column_create(1, 1), 1, null)) select column_list(column_add(column_create(1, 1), 1, "")); column_list(column_add(column_create(1, 1), 1, "")) -1 +`1` select hex(column_add("", 1, 1)); hex(column_add("", 1, 1)) 00010001000002 @@ -1133,10 +1133,10 @@ column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4) # column list select column_list(column_create(1, 1212 as integer, 2, 1212 as integer)); column_list(column_create(1, 1212 as integer, 2, 1212 as integer)) -1,2 +`1`,`2` select column_list(column_create(1, 1212 as integer)); column_list(column_create(1, 1212 as integer)) -1 +`1` select column_list(column_create(1, NULL as integer)); column_list(column_create(1, NULL as integer)) @@ -1218,35 +1218,35 @@ sum(column_get(str, 1 as int)) 11 select id, column_list(str) from t1 where id= 5; id column_list(str) -5 1,2,3,10 +5 `1`,`2`,`3`,`10` update t1 set str=column_delete(str, 3, 4, 2) where id= 5; select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1; id length(str) column_list(str) column_get(str, 1 as int) column_get(str, 2 as char) column_get(str, 3 as int) -1 12 1,2 1 a NULL -2 12 1,2 2 a NULL -3 12 2,3 NULL c 100 -4 16 1,2,3 5 c 100 -5 15 1,10 6 NULL NULL -6 21 2,3,10 NULL c 100 +1 12 `1`,`2` 1 a NULL +2 12 `1`,`2` 2 a NULL +3 12 `2`,`3` NULL c 100 +4 16 `1`,`2`,`3` 5 c 100 +5 15 `1`,`10` 6 NULL NULL +6 21 `2`,`3`,`10` NULL c 100 update t1 set str=column_add(str, 4, 45 as char, 2, 'c') where id= 5; select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1 where id = 5; id length(str) column_list(str) column_get(str, 1 as int) column_get(str, 2 as char) column_get(str, 3 as int) -5 26 1,2,4,10 6 c NULL +5 26 `1`,`2`,`4`,`10` 6 c NULL select id, length(str), column_list(str), column_exists(str, 4) from t1; id length(str) column_list(str) column_exists(str, 4) -1 12 1,2 0 -2 12 1,2 0 -3 12 2,3 0 -4 16 1,2,3 0 -5 26 1,2,4,10 1 -6 21 2,3,10 0 +1 12 `1`,`2` 0 +2 12 `1`,`2` 0 +3 12 `2`,`3` 0 +4 16 `1`,`2`,`3` 0 +5 26 `1`,`2`,`4`,`10` 1 +6 21 `2`,`3`,`10` 0 select sum(column_get(str, 1 as int)), column_list(str) from t1 group by 2; sum(column_get(str, 1 as int)) column_list(str) -3 1,2 -5 1,2,3 -6 1,2,4,10 -NULL 2,3 -NULL 2,3,10 +3 `1`,`2` +5 `1`,`2`,`3` +6 `1`,`2`,`4`,`10` +NULL `2`,`3` +NULL `2`,`3`,`10` select id, hex(str) from t1; id hex(str) 1 00020001000002000B020861 @@ -1282,11 +1282,11 @@ id 5 select id, column_list(str), length(str) from t1 where id=5; id column_list(str) length(str) -5 1,2,4,5,10 100048 +5 `1`,`2`,`4`,`5`,`10` 100048 update t1 set str=column_delete(str, 5) where id=5; select id, column_list(str), length(str) from t1 where id=5; id column_list(str) length(str) -5 1,2,4,10 34 +5 `1`,`2`,`4`,`10` 34 drop table t1; # # LP#778905: Assertion `value->year <= 9999' failed in @@ -1306,7 +1306,7 @@ INSERT INTO t1 SET f1 = COLUMN_CREATE( 2 , 'cde' ); SELECT HEX(COLUMN_ADD(f1, 1, 'abc')), COLUMN_LIST(f1) FROM t1; HEX(COLUMN_ADD(f1, 1, 'abc')) COLUMN_LIST(f1) NULL NULL -0002000100030200230861626308636465 2 +0002000100030200230861626308636465 `2` SELECT COLUMN_ADD(f1, 1, 'abc'), COLUMN_LIST(f1) FROM t1; DROP TABLE t1; # @@ -1335,3 +1335,245 @@ hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal)) select hex(COLUMN_CREATE(0, 0.0 as decimal)); hex(COLUMN_CREATE(0, 0.0 as decimal)) 000100000004 +# +# test of symbolic names +# +# creation test (names) +set names utf8; +select hex(column_create("адын", 1212)); +hex(column_create("адын", 1212)) +040100080008000000D0B0D0B4D18BD0BD7809 +select hex(column_create("1212", 1212)); +hex(column_create("1212", 1212)) +040100040004000000313231327809 +select hex(column_create(1212, 2, "www", 3)); +hex(column_create(1212, 2, "www", 3)) +04020007000300000004030008777777313231320604 +select hex(column_create("1212", 2, "www", 3)); +hex(column_create("1212", 2, "www", 3)) +04020007000300000004030008777777313231320604 +select hex(column_create("1212", 2, 3, 3)); +hex(column_create("1212", 2, 3, 3)) +0402000500010000000401000833313231320604 +select hex(column_create("1212", 2, "адын", 1, 3, 3)); +hex(column_create("1212", 2, "адын", 1, 3, 3)) +0403000D000100000004010008080500103331323132D0B0D0B4D18BD0BD060402 +set names default; +# fetching column test (names) +set names utf8; +select column_get(column_create("адын", 1212), "адын" as int); +column_get(column_create("адын", 1212), "адын" as int) +1212 +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int); +column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int) +1 +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int); +column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int) +2 +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int); +column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int) +3 +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int); +column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int) +3 +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int); +column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int) +NULL +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int); +column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int) +NULL +set names default; +# column existance test (names) +set names utf8; +select column_exists(column_create("адын", 1212), "адын"); +column_exists(column_create("адын", 1212), "адын") +1 +select column_exists(column_create("адын", 1212), "aады"); +column_exists(column_create("адын", 1212), "aады") +0 +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын"); +column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын") +1 +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212); +column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212) +1 +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3"); +column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3") +1 +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3); +column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3) +1 +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4); +column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4) +0 +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4"); +column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4") +0 +set names default; +# column changing test (names) +select hex(column_add(column_create(1, "AAA"), "b", "BBB")); +hex(column_add(column_create(1, "AAA"), "b", "BBB")) +0402000200010000030101002331620841414108424242 +select hex(column_add(column_create("1", "AAA"), "b", "BBB")); +hex(column_add(column_create("1", "AAA"), "b", "BBB")) +0402000200010000030101002331620841414108424242 +select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char); +column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char) +AAA +select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char); +column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char) +BBB +select hex(column_add(column_create("a", "AAA"), 1, "BBB")); +hex(column_add(column_create("a", "AAA"), 1, "BBB")) +0402000200010000030101002331610842424208414141 +select hex(column_add(column_create("a", "AAA"), "1", "BBB")); +hex(column_add(column_create("a", "AAA"), "1", "BBB")) +0402000200010000030101002331610842424208414141 +select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)); +hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)) +04020002000100000001010010616278097809 +select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)); +hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)) +040100010001000000617809 +select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)); +hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)) +0400000000 +select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)); +hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)) +040100010001000000617809 +select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)); +hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)) +040200020001000000010100086162167809 +select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer); +column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer) +11 +select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer); +column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer) +1212 +select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)); +hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)) +040200020001000000010100106162780916 +select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)); +hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)) +040200020001000000010100106162780916 +select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)); +hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)) +040200020001000000010100086162167809 +select hex(column_add(column_create("a", 1), "a", null)); +hex(column_add(column_create("a", 1), "a", null)) +0400000000 +select column_list(column_add(column_create("a", 1), "a", null)); +column_list(column_add(column_create("a", 1), "a", null)) + +select column_list(column_add(column_create("a", 1), "a", "")); +column_list(column_add(column_create("a", 1), "a", "")) +`a` +select hex(column_add("", "a", 1)); +hex(column_add("", "a", 1)) +0401000100010000006102 +# column delete (names) +select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")); +hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")) +040100010001000000627809 +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")); +hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")) +0402000200010000000101000861630206 +select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)); +hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)) +0403000300010000000101000801020010616263020406 +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")); +hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")) +0402000200010000000101000861620204 +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")); +hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")) +0403000300010000000101000801020010616263020406 +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")); +hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")) +0401000100010000006306 +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")); +hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")) +0401000100010000006102 +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")); +hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")) +0400000000 +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e")); +hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e")) +0400000000 +select hex(column_delete(column_create("a", 1), "a")); +hex(column_delete(column_create("a", 1), "a")) +0400000000 +select hex(column_delete("", "a")); +hex(column_delete("", "a")) + +# +# MDEV-458 DNAMES: Server crashes on using an unquoted string +# as a dynamic column name +# +select COLUMN_CREATE(color, "black"); +ERROR 42S22: Unknown column 'color' in 'field list' +# +# MDEV-489 Assertion `offset < 0x1f' failed in +# type_and_offset_store on COLUMN_ADD +# +CREATE TABLE t1 (f1 tinyblob); +INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30))); +UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' ); +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' ); +ERROR HY000: Encountered illegal format of dynamic column string +drop table t1; +# +# MDEV-490/MDEV-491 null as arguments +# +SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR ); +COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR ) +NULL +SELECT COLUMN_GET( NULL, 'col' as char ); +COLUMN_GET( NULL, 'col' as char ) +NULL +SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL); +COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL) +NULL +SELECT COLUMN_EXISTS( NULL, 'col'); +COLUMN_EXISTS( NULL, 'col') +NULL +SELECT COLUMN_CREATE( NULL, 'val' ); +COLUMN_CREATE( NULL, 'val' ) +NULL +SELECT COLUMN_ADD( NULL, 'val', 'col'); +COLUMN_ADD( NULL, 'val', 'col') +NULL +# +# MDEV-488: Assertion `column_name->length < 255' failed on a +# column name with length 255 (precisely) +# +SELECT hex(COLUMN_CREATE(REPEAT('a',255),1)); +hex(COLUMN_CREATE(REPEAT('a',255),1)) +040100FF00FF00000061616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616102 +SELECT hex(COLUMN_CREATE(REPEAT('a',256),1)); +ERROR 22007: Illegal value used as argument of dynamic column function +# +# JSON conversion +# +select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date)); +column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" +[{"int":-1212},{"date":"2011-04-05"},{"time":"00:45:49.000001"},{"uint":12334},{"double":"1.23444e+50"},{"string":"gdgd\\dhdjh\"dhdhd"},{"decimal":23.344},{"datetime":"2011-04-05 00:45:49.000001"}] +select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)); +column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)) +[{"1":-1212},{"2":12334},{"3":23.344},{"4":"1.23444e+50"},{"5":"gdgd\\dhdjh\"dhdhd"},{"6":"00:45:49.000001"},{"7":"2011-04-05 00:45:49.000001"},{"8":"2011-04-05"}] +# +# CHECK test +# +SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a')); +COLUMN_CHECK(COLUMN_CREATE(1,'a')) +1 +SELECT COLUMN_CHECK('abracadabra'); +COLUMN_CHECK('abracadabra') +0 +SELECT COLUMN_CHECK(''); +COLUMN_CHECK('') +1 +SELECT COLUMN_CHECK(NULL); +COLUMN_CHECK(NULL) +NULL diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 66e308540f4..143a833fe8d 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -550,3 +550,125 @@ select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0)))); select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal))); select hex(COLUMN_CREATE(0, 0.0 as decimal)); + +--echo # +--echo # test of symbolic names +--echo # +--echo # creation test (names) +set names utf8; +select hex(column_create("адын", 1212)); +select hex(column_create("1212", 1212)); +select hex(column_create(1212, 2, "www", 3)); +select hex(column_create("1212", 2, "www", 3)); +select hex(column_create("1212", 2, 3, 3)); +select hex(column_create("1212", 2, "адын", 1, 3, 3)); +set names default; + +--echo # fetching column test (names) +set names utf8; +select column_get(column_create("адын", 1212), "адын" as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int); +select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int); +set names default; + +--echo # column existance test (names) +set names utf8; +select column_exists(column_create("адын", 1212), "адын"); +select column_exists(column_create("адын", 1212), "aады"); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын"); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3"); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4); +select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4"); +set names default; + +--echo # column changing test (names) +select hex(column_add(column_create(1, "AAA"), "b", "BBB")); +select hex(column_add(column_create("1", "AAA"), "b", "BBB")); +select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char); +select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char); +select hex(column_add(column_create("a", "AAA"), 1, "BBB")); +select hex(column_add(column_create("a", "AAA"), "1", "BBB")); +select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)); +select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)); +select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)); +select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)); +select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)); +select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer); +select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer); +select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)); +select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)); +select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)); +select hex(column_add(column_create("a", 1), "a", null)); +select column_list(column_add(column_create("a", 1), "a", null)); +select column_list(column_add(column_create("a", 1), "a", "")); +select hex(column_add("", "a", 1)); + +-- echo # column delete (names) +select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")); +select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")); +select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e")); +select hex(column_delete(column_create("a", 1), "a")); +select hex(column_delete("", "a")); + +--echo # +--echo # MDEV-458 DNAMES: Server crashes on using an unquoted string +--echo # as a dynamic column name +--echo # +--error ER_BAD_FIELD_ERROR +select COLUMN_CREATE(color, "black"); + +--echo # +--echo # MDEV-489 Assertion `offset < 0x1f' failed in +--echo # type_and_offset_store on COLUMN_ADD +--echo # +CREATE TABLE t1 (f1 tinyblob); + +INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30))); +UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' ); +--error ER_DYN_COL_WRONG_FORMAT +UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' ); +drop table t1; + +--echo # +--echo # MDEV-490/MDEV-491 null as arguments +--echo # +SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR ); +SELECT COLUMN_GET( NULL, 'col' as char ); +SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL); +SELECT COLUMN_EXISTS( NULL, 'col'); +SELECT COLUMN_CREATE( NULL, 'val' ); +SELECT COLUMN_ADD( NULL, 'val', 'col'); + +--echo # +--echo # MDEV-488: Assertion `column_name->length < 255' failed on a +--echo # column name with length 255 (precisely) +--echo # +SELECT hex(COLUMN_CREATE(REPEAT('a',255),1)); +--error ER_DYN_COL_DATA +SELECT hex(COLUMN_CREATE(REPEAT('a',256),1)); + +--echo # +--echo # JSON conversion +--echo # +select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date)); +select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)); + +--echo # +--echo # CHECK test +--echo # +SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a')); +SELECT COLUMN_CHECK('abracadabra'); +SELECT COLUMN_CHECK(''); +SELECT COLUMN_CHECK(NULL); diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index c717f69c3e5..70ae4935528 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -29,7 +29,11 @@ #include "mysys_priv.h" #include #include +#include +uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, + const char *from, uint32 from_length, + CHARSET_INFO *from_cs, uint *errors); /* Flag byte bits @@ -37,19 +41,40 @@ */ /* mask to get above bits */ #define DYNCOL_FLG_OFFSET 3 +#define DYNCOL_FLG_NAMES 4 /* All known flags mask */ -#define DYNCOL_FLG_KNOWN 3 +#define DYNCOL_FLG_KNOWN 7 + +/* formats */ +#define DYNCOL_FMT_NUM 0 +#define DYNCOL_FMT_STR 1 /* dynamic column size reserve */ #define DYNCOL_SYZERESERVE 80 +#define DYNCOL_OFFSET_ERROR 0xffffffff + /* length of fixed string header 1 byte - flags, 2 bytes - columns counter */ #define FIXED_HEADER_SIZE 3 +/* + length of fixed string header with names + 1 byte - flags, 2 bytes - columns counter, 2 bytes - name pool size +*/ +#define FIXED_HEADER_SIZE_NM 5 #define COLUMN_NUMBER_SIZE 2 +/* 1 byte name length + 2 bytes offset from the name pool */ +#define COLUMN_NAMEPTR_SIZE 3 #define MAX_OFFSET_LENGTH 5 +my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str) +{ + if (str->length < 1) + return FALSE; + return test(str->str[0] & DYNCOL_FLG_NAMES); +} + static enum enum_dyncol_func_result dynamic_column_time_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value); @@ -62,6 +87,311 @@ dynamic_column_time_read_internal(DYNAMIC_COLUMN_VALUE *store_it_here, static enum enum_dyncol_func_result dynamic_column_date_read_internal(DYNAMIC_COLUMN_VALUE *store_it_here, uchar *data, size_t length); +static enum enum_dyncol_func_result +dynamic_column_get_internal(DYNAMIC_COLUMN *str, + DYNAMIC_COLUMN_VALUE *store_it_here, + uint num_key, LEX_STRING *str_key); +static enum enum_dyncol_func_result +dynamic_column_exists_internal(DYNAMIC_COLUMN *str, uint num_key, + LEX_STRING *str_key); +enum enum_dyncol_func_result +dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, + uint add_column_count, + void *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool string_keys); +static int plan_sort_num(const void *a, const void *b); +static int plan_sort_str(const void *a, const void *b); + +/* + Structure to hold information about dynamic columns record and + iterate through it. +*/ + +struct st_dyn_header +{ + uchar *header, *nmpool, *dtpool, *data_end; + size_t offset_size; + size_t entry_size; + size_t header_size; + size_t nmpool_size; + size_t data_size; + /* DYNCOL_FMT_NUM - numeric columns, DYNCOL_FMT_STR - column names */ + uint format; + uint column_count; + + uchar *entry, *data, *name; + size_t offset; + uint length; + enum enum_dynamic_column_type type; +}; + +typedef struct st_dyn_header DYN_HEADER; + +static inline my_bool read_fixed_header(DYN_HEADER *hdr, + DYNAMIC_COLUMN *str); +static void set_fixed_header(DYNAMIC_COLUMN *str, + uint offset_size, + uint column_count); +static my_bool type_and_offset_store(uchar *place, size_t offset_size, + DYNAMIC_COLUMN_TYPE type, + size_t offset); + +/* + Calculate entry size (E) and header size (H) by offset size (O) and column + count (C) and fixed part of entry size (F). +*/ + +#define calc_param(E,H,F,O,C) do { \ + (*(E))= (O) + F; \ + (*(H))= (*(E)) * (C); \ +}while(0); + + +/** + Name pool size functions, for numeric format it is 0 +*/ + +size_t name_size_num(void *keys __attribute__((unused)), + uint i __attribute__((unused))) +{ + return 0; +} + + +/** + Name pool size functions. +*/ +size_t name_size_str(void *keys, uint i) +{ + return ((LEX_STRING *) keys)[i].length; +} + + +/** + Comparator function for references on column numbers for qsort + (numeric format) +*/ + +static int column_sort_num(const void *a, const void *b) +{ + return **((uint **)a) - **((uint **)b); +} + + +/** + Comparator function for references on column numbers for qsort + (names format) +*/ + +static int column_sort_str(const void *a, const void *b) +{ + LEX_STRING *s1= *((LEX_STRING **)a); + LEX_STRING *s2= *((LEX_STRING **)b); + int rc= s1->length - s2->length; + if (rc == 0) + rc= memcmp((void *)s1->str, (void *)s2->str, (size_t) s1->length); + return rc; +} + + +/** + Check limit function (numeric format) +*/ + +static my_bool check_limit_num(const void *val) +{ + return **((uint **)val) > UINT_MAX16; +} + + +/** + Check limit function (names format) +*/ + +static my_bool check_limit_str(const void *val) +{ + return (*((LEX_STRING **)val))->length > 255; +} + + +/** + Write numeric format static header part. +*/ + +void set_fixed_header_num(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) +{ + set_fixed_header(str, hdr->offset_size, hdr->column_count); + hdr->header= (uchar *)str->str + FIXED_HEADER_SIZE; + hdr->nmpool= hdr->dtpool= hdr->header + hdr->header_size; +} + + +/** + Write names format static header part. +*/ + +void set_fixed_header_str(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) +{ + set_fixed_header(str, hdr->offset_size, hdr->column_count); + str->str[0]|= DYNCOL_FLG_NAMES; + int2store(str->str + 3, hdr->nmpool_size); + hdr->header= (uchar *)str->str + FIXED_HEADER_SIZE_NM; + hdr->nmpool= hdr->header + hdr->header_size; + hdr->dtpool= hdr->nmpool + hdr->nmpool_size; +} + + +/** + Write numeric format header entry + 2 bytes - column number + 1-4 bytes - data offset combined with type + + @param hdr descriptor of dynamic column record + @param column_key pointer to uint (column number) + @param value value which will be written (only type used) + @param offset offset of the data +*/ + +my_bool put_header_entry_num(DYN_HEADER *hdr, + void *column_key, + DYNAMIC_COLUMN_VALUE *value, + size_t offset) +{ + uint *column_number= (uint *)column_key; + int2store(hdr->entry, *column_number); + DBUG_ASSERT(hdr->nmpool_size == 0); + if (type_and_offset_store(hdr->entry, hdr->offset_size, + value->type, + offset)) + return TRUE; + hdr->entry= hdr->entry + hdr->entry_size; + return FALSE; +} + + +/** + Write names format header entry + 1 byte - name length + 2 bytes - name offset in the name pool + 1-4 bytes - data offset combined with type + + @param hdr descriptor of dynamic column record + @param column_key pointer to LEX_STRING (column name) + @param value value which will be written (only type used) + @param offset offset of the data +*/ + +my_bool put_header_entry_str(DYN_HEADER *hdr, + void *column_key, + DYNAMIC_COLUMN_VALUE *value, + size_t offset) +{ + LEX_STRING *column_name= (LEX_STRING *)column_key; + DBUG_ASSERT(column_name->length <= 255); + hdr->entry[0]= column_name->length; + DBUG_ASSERT(hdr->name - hdr->nmpool < (long) 0x10000L); + int2store(hdr->entry + 1, hdr->name - hdr->nmpool); + memcpy(hdr->name, column_name->str, column_name->length); + DBUG_ASSERT(hdr->nmpool_size != 0 || column_name->length == 0); + if (type_and_offset_store(hdr->entry + 1, hdr->offset_size, + value->type, + offset)) + return TRUE; + hdr->entry+= hdr->entry_size; + hdr->name+= column_name->length; + return FALSE; +} + + +/** + Format descriptor, contain constants and function references for + format processing +*/ + +struct st_service_funcs +{ + /* size of fixed header */ + uint fixed_hdr; + /* size of fixed part of header entry */ + uint fixed_hdr_entry; + + /*size of array element which stores keys */ + uint key_size_in_array; + + size_t (*name_size) + (void *, uint); + int (*column_sort) + (const void *a, const void *b); + my_bool (*check_limit) + (const void *val); + void (*set_fixed_hdr) + (DYNAMIC_COLUMN *str, DYN_HEADER *hdr); + my_bool (*put_header_entry)(DYN_HEADER *hdr, + void *column_key, + DYNAMIC_COLUMN_VALUE *value, + size_t offset); + int (*plan_sort)(const void *a, const void *b); +}; + + +/** + Actual our 2 format descriptors +*/ + +static struct st_service_funcs fmt_data[2]= +{ + { + FIXED_HEADER_SIZE, + COLUMN_NUMBER_SIZE, + sizeof(uint), + &name_size_num, + &column_sort_num, + &check_limit_num, + &set_fixed_header_num, + &put_header_entry_num, + &plan_sort_num + }, + { + FIXED_HEADER_SIZE_NM, + COLUMN_NAMEPTR_SIZE, + sizeof(LEX_STRING), + &name_size_str, + &column_sort_str, + &check_limit_str, + &set_fixed_header_str, + &put_header_entry_str, + &plan_sort_str + } +}; + + +/** + Read dynamic column record header and fill the descriptor + + @param hdr dynamic columns record descriptor to fill + @param str dynamic columns record + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +init_read_hdr(DYN_HEADER *hdr, DYNAMIC_COLUMN *str) +{ + if (read_fixed_header(hdr, str)) + return ER_DYNCOL_FORMAT; + hdr->header= (uchar*)str->str + fmt_data[hdr->format].fixed_hdr; + calc_param(&hdr->entry_size, &hdr->header_size, + fmt_data[hdr->format].fixed_hdr_entry, hdr->offset_size, + hdr->column_count); + hdr->nmpool= hdr->header + hdr->header_size; + hdr->dtpool= hdr->nmpool + hdr->nmpool_size; + hdr->data_size= str->length - fmt_data[hdr->format].fixed_hdr - + hdr->header_size - hdr->nmpool_size; + hdr->data_end= (uchar*)str->str + str->length; + return ER_DYNCOL_OK; +} + /** Initialize dynamic column string with (make it empty but correct format) @@ -82,11 +412,8 @@ static my_bool dynamic_column_init_str(DYNAMIC_COLUMN *str, size_t size) - First \0 is flags - other 2 \0 is number of fields */ - if (init_dynamic_string(str, NULL, - size + FIXED_HEADER_SIZE, DYNCOL_SYZERESERVE)) + if (init_dynamic_string(str, NULL, size, DYNCOL_SYZERESERVE)) return TRUE; - bzero(str->str, FIXED_HEADER_SIZE); - str->length= FIXED_HEADER_SIZE; return FALSE; } @@ -902,37 +1229,42 @@ static size_t dynamic_column_offset_bytes(size_t data_length) @param offset Offset to be written */ -static void type_and_offset_store(uchar *place, size_t offset_size, - DYNAMIC_COLUMN_TYPE type, - size_t offset) +static my_bool type_and_offset_store(uchar *place, size_t offset_size, + DYNAMIC_COLUMN_TYPE type, + size_t offset) { ulong val = (((ulong) offset) << 3) | (type - 1); DBUG_ASSERT(type != DYN_COL_NULL); DBUG_ASSERT(((type - 1) & (~7)) == 0); /* fit in 3 bits */ /* Index entry starts with column number; Jump over it */ - place+= COLUMN_NUMBER_SIZE; + place+= COLUMN_NUMBER_SIZE; switch (offset_size) { case 1: - DBUG_ASSERT(offset < 0x1f); /* all 1 value is reserved */ + if (offset >= 0x1f) /* all 1 value is reserved */ + return TRUE; place[0]= (uchar)val; break; case 2: - DBUG_ASSERT(offset < 0x1fff); /* all 1 value is reserved */ + if (offset >= 0x1fff) /* all 1 value is reserved */ + return TRUE; int2store(place, val); break; case 3: - DBUG_ASSERT(offset < 0x1fffff); /* all 1 value is reserved */ + if (offset >= 0x1fffff) /* all 1 value is reserved */ + return TRUE; int3store(place, val); break; case 4: - DBUG_ASSERT(offset < 0x1fffffff); /* all 1 value is reserved */ + if (offset >= 0x1fffffff) /* all 1 value is reserved */ + return TRUE; int4store(place, val); break; default: - DBUG_ASSERT(0); /* impossible */ + return TRUE; } + return FALSE; } @@ -941,45 +1273,40 @@ static void type_and_offset_store(uchar *place, size_t offset_size, @param type Where to put type info @param offset Where to put offset info - @param place Beginning of the index entry + @param place beginning of the type and offset @param offset_size Size of offset field in bytes */ -static void type_and_offset_read(DYNAMIC_COLUMN_TYPE *type, - size_t *offset, - uchar *place, size_t offset_size) +static my_bool type_and_offset_read(DYNAMIC_COLUMN_TYPE *type, + size_t *offset, + uchar *place, size_t offset_size) { ulong UNINIT_VAR(val); + ulong UNINIT_VAR(lim); - place+= COLUMN_NUMBER_SIZE; /* skip column number */ switch (offset_size) { case 1: val= (ulong)place[0]; + lim= 0x1f; break; case 2: val= uint2korr(place); + lim= 0x1fff; break; case 3: val= uint3korr(place); + lim= 0x1fffff; break; case 4: val= uint4korr(place); + lim= 0x1fffffff; break; default: DBUG_ASSERT(0); /* impossible */ } *type= (val & 0x7) + 1; *offset= val >> 3; -} - - -/** - Comparator function for references on column numbers for qsort -*/ - -static int column_sort(const void *a, const void *b) -{ - return **((uint **)a) - **((uint **)b); + return (*offset >= lim); } @@ -1003,27 +1330,13 @@ static void set_fixed_header(DYNAMIC_COLUMN *str, DBUG_ASSERT((str->str[0] & (~DYNCOL_FLG_KNOWN)) == 0); } -/* - Calculate entry size (E) and header size (H) by offset size (O) and column - count (C). -*/ - -#define calc_param(E,H,O,C) do { \ - (*(E))= (O) + COLUMN_NUMBER_SIZE; \ - (*(H))= (*(E)) * (C); \ -}while(0); - - /** Adds columns into the empty string - @param str String where to write the data - @param header_size Size of the header without fixed part - @param offset_size Size of offset field in bytes + @param str String where to write the data (the record) + @param hdr Dynamic columns record descriptor @param column_count Number of columns in the arrays - @parem not_null_count Number of non-null columns in the arrays - @param data_size Size of the data segment - @param column_numbers Array of columns numbers + @param column_keys Array of columns keys (uint or LEX_STRING) @param values Array of columns values @param new_str True if we need to allocate new string @@ -1032,42 +1345,51 @@ static void set_fixed_header(DYNAMIC_COLUMN *str, static enum enum_dyncol_func_result dynamic_new_column_store(DYNAMIC_COLUMN *str, - size_t header_size, - size_t offset_size, + DYN_HEADER *hdr, uint column_count, - uint not_null_count, - size_t data_size, - uint *column_numbers, + void *column_keys, DYNAMIC_COLUMN_VALUE *values, my_bool new_str) { - uchar *header_end; - uint **columns_order; + struct st_service_funcs *fmt= fmt_data + hdr->format; + void **columns_order; + uchar *element; uint i; - uint entry_size= COLUMN_NUMBER_SIZE + offset_size; enum enum_dyncol_func_result rc= ER_DYNCOL_RESOURCE; + size_t all_headers_size; - if (!(columns_order= malloc(sizeof(uint*)*column_count))) + if (!(columns_order= malloc(sizeof(void*)*column_count))) return ER_DYNCOL_RESOURCE; if (new_str) { if (dynamic_column_init_str(str, - data_size + header_size + DYNCOL_SYZERESERVE)) + fmt->fixed_hdr + + hdr->header_size + + hdr->nmpool_size + + hdr->data_size + + DYNCOL_SYZERESERVE)) goto err; } else { str->length= 0; - if (dynstr_realloc(str, data_size + header_size + DYNCOL_SYZERESERVE)) + if (dynstr_realloc(str, + fmt->fixed_hdr + + hdr->header_size + + hdr->nmpool_size + + hdr->data_size + + DYNCOL_SYZERESERVE)) goto err; - bzero(str->str, FIXED_HEADER_SIZE); - str->length= FIXED_HEADER_SIZE; } + bzero(str->str, fmt->fixed_hdr); + str->length= fmt->fixed_hdr; /* sort columns for the header */ - for (i= 0; i < column_count; i++) - columns_order[i]= column_numbers + i; - qsort(columns_order, (size_t)column_count, sizeof(uint*), &column_sort); + for (i= 0, element= (uchar *) column_keys; + i < column_count; + i++, element+= fmt->key_size_in_array) + columns_order[i]= (void *)element; + qsort(columns_order, (size_t)column_count, sizeof(void*), fmt->column_sort); /* For now we don't allow creating two columns with the same number @@ -1076,38 +1398,43 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, */ for (i= 0; i < column_count - 1; i++) { - if (columns_order[i][0] > UINT_MAX16 || - columns_order[i][0] == columns_order[i + 1][0]) + if ((*fmt->check_limit)(&columns_order[i]) || + (*fmt->column_sort)(&columns_order[i], &columns_order[i + 1]) == 0) { rc= ER_DYNCOL_DATA; goto err; } } - if (columns_order[i][0] > UINT_MAX16) + if ((*fmt->check_limit)(&columns_order[i])) { rc= ER_DYNCOL_DATA; goto err; } - DBUG_ASSERT(str->max_length >= str->length + header_size); - set_fixed_header(str, offset_size, not_null_count); - str->length+= header_size; /* reserve place for header */ - header_end= (uchar *)str->str + FIXED_HEADER_SIZE; + (*fmt->set_fixed_hdr)(str, hdr); + /* reserve place for header and name pool */ + str->length+= hdr->header_size + hdr->nmpool_size; + + hdr->entry= hdr->header; + hdr->name= hdr->nmpool; + all_headers_size= fmt->fixed_hdr + hdr->header_size + hdr->nmpool_size; for (i= 0; i < column_count; i++) { - uint ord= columns_order[i] - column_numbers; + uint ord= ((uchar*)columns_order[i] - (uchar*)column_keys) / + fmt->key_size_in_array; if (values[ord].type != DYN_COL_NULL) { /* Store header first in the str */ - int2store(header_end, column_numbers[ord]); - type_and_offset_store(header_end, offset_size, - values[ord].type, - str->length - header_size - FIXED_HEADER_SIZE); + if ((*fmt->put_header_entry)(hdr, columns_order[i], values + ord, + str->length - all_headers_size)) + { + rc= ER_DYNCOL_FORMAT; + goto err; + } /* Store value in 'str + str->length' and increase str->length */ if ((rc= data_store(str, values + ord))) goto err; - header_end+= entry_size; } } rc= ER_DYNCOL_OK; @@ -1117,28 +1444,75 @@ err: } /** - Create packed string which contains given columns (internal) + Calculate size of header, name pool and data pool - @param str String where to write the data + @param hdr descriptor of dynamic column record + @param column_count number of elements in arrays @param column_count Number of columns in the arrays - @param column_numbers Array of columns numbers + @param column_keys Array of columns keys (uint or LEX_STRING) @param values Array of columns values - @param new_str True if we need allocate new string @return ER_DYNCOL_* return code */ static enum enum_dyncol_func_result -dynamic_column_create_many_internal(DYNAMIC_COLUMN *str, - uint column_count, - uint *column_numbers, - DYNAMIC_COLUMN_VALUE *values, - my_bool new_str) +calc_var_sizes(DYN_HEADER *hdr, + uint column_count, + void *column_keys, + DYNAMIC_COLUMN_VALUE *values) { - size_t data_size= 0; - size_t header_size, offset_size; + struct st_service_funcs *fmt= fmt_data + hdr->format; uint i; - int not_null_column_count= 0; + hdr->nmpool_size= hdr->data_size= 0; + hdr->column_count= 0; + for (i= 0; i < column_count; i++) + { + if (values[i].type != DYN_COL_NULL) + { + size_t tmp; + hdr->column_count++; + hdr->data_size+= (tmp= dynamic_column_value_len(values + i)); + if (tmp == (size_t) ~0) + return ER_DYNCOL_DATA; + hdr->nmpool_size+= (*fmt->name_size)(column_keys, i); + } + } + /* We can handle data up to 1fffffff = 536870911 bytes now */ + if ((hdr->offset_size= dynamic_column_offset_bytes(hdr->data_size)) >= + MAX_OFFSET_LENGTH) + return ER_DYNCOL_LIMIT; + + /* header entry is column number or string pointer + offset & type */ + hdr->entry_size= fmt->fixed_hdr_entry + hdr->offset_size; + hdr->header_size= hdr->column_count * hdr->entry_size; + return ER_DYNCOL_OK; +} + +/** + Create packed string which contains given columns (internal multi format) + + @param str String where to write the data + @param column_count Number of columns in the arrays + @param column_keys Array of columns keys (format dependent) + @param values Array of columns values + @param new_str True if we need allocate new string + @param string_keys keys are strings + + @return ER_DYNCOL_* return code +*/ + +static enum enum_dyncol_func_result +dynamic_column_create_many_internal_fmt(DYNAMIC_COLUMN *str, + uint column_count, + void *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool new_str, + my_bool string_keys) +{ + DYN_HEADER header; + enum enum_dyncol_func_result rc; + bzero(&header, sizeof(header)); + header.format= (string_keys ? 1 : 0); if (new_str) { @@ -1146,32 +1520,12 @@ dynamic_column_create_many_internal(DYNAMIC_COLUMN *str, bzero(str, sizeof(DYNAMIC_COLUMN)); } - for (i= 0; i < column_count; i++) - { - if (values[i].type != DYN_COL_NULL) - { - size_t tmp; - not_null_column_count++; - data_size+= (tmp=dynamic_column_value_len(values + i)); - if (tmp == (size_t) ~0) - return ER_DYNCOL_DATA; - } - } + if ((rc= calc_var_sizes(&header, column_count, column_keys, values)) < 0) + return rc; - /* We can handle data up to 1fffffff = 536870911 bytes now */ - if ((offset_size= dynamic_column_offset_bytes(data_size)) >= - MAX_OFFSET_LENGTH) - return ER_DYNCOL_LIMIT; - - /* header entry is column number + offset & type */ - header_size= not_null_column_count * (offset_size + 2); - - return dynamic_new_column_store(str, - header_size, offset_size, + return dynamic_new_column_store(str, &header, column_count, - not_null_column_count, - data_size, - column_numbers, values, + column_keys, values, new_str); } @@ -1194,11 +1548,35 @@ dynamic_column_create_many(DYNAMIC_COLUMN *str, DYNAMIC_COLUMN_VALUE *values) { DBUG_ENTER("dynamic_column_create_many"); - DBUG_RETURN(dynamic_column_create_many_internal(str, column_count, - column_numbers, values, - TRUE)); + DBUG_RETURN(dynamic_column_create_many_internal_fmt(str, column_count, + column_numbers, values, + TRUE, FALSE)); } +/** + Create packed string which contains given columns + + @param str String where to write the data + @param column_count Number of columns in the arrays + @param column_keys Array of columns keys + @param values Array of columns value + @param names use string names as keys + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_create_many_fmt(DYNAMIC_COLUMN *str, + uint column_count, + uchar *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool names) +{ + DBUG_ENTER("dynamic_column_create_many"); + DBUG_RETURN(dynamic_column_create_many_internal_fmt(str, column_count, + column_keys, values, + TRUE, names)); +} /** Create packed string which contains given column @@ -1239,32 +1617,46 @@ static size_t get_length_interval(uchar *entry, uchar *entry_next, DYNAMIC_COLUMN_TYPE type, type_next; DBUG_ASSERT(entry < entry_next); - type_and_offset_read(&type, &offset, entry, offset_size); + if (type_and_offset_read(&type, &offset, entry + COLUMN_NUMBER_SIZE, + offset_size)) + return DYNCOL_OFFSET_ERROR; if (entry_next >= header_end) return (last_offset - offset); - type_and_offset_read(&type_next, &offset_next, entry_next, offset_size); + if (type_and_offset_read(&type_next, &offset_next, + entry_next + COLUMN_NUMBER_SIZE, offset_size)) + return DYNCOL_OFFSET_ERROR; return (offset_next - offset); } -/* - Calculate length of data of one column +/** + Calculate length of data between given hdr->entry and next_entry - @param entry Pointer to the first entry - @param header_end Pointer to the header end - @param offset_size Size of offset field in bytes - @param last_offset Size of the data segment + @param hdr descriptor of dynamic column record + @param next_entry next header entry (can point just after last header + entry) @return number of bytes */ -static size_t get_length(uchar *entry, uchar *header_end, - size_t offset_size, - size_t last_offset) +static size_t hdr_interval_length(DYN_HEADER *hdr, uchar *next_entry) { - return get_length_interval(entry, - entry + offset_size + COLUMN_NUMBER_SIZE, - header_end, offset_size, last_offset); + struct st_service_funcs *fmt= fmt_data + hdr->format; + size_t next_entry_offset; + DYNAMIC_COLUMN_TYPE next_entry_type; + DBUG_ASSERT(hdr->entry < next_entry); + DBUG_ASSERT(hdr->entry >= hdr->header); + DBUG_ASSERT(next_entry <= hdr->header + hdr->header_size); + + if (type_and_offset_read(&hdr->type, &hdr->offset, + hdr->entry + fmt->fixed_hdr_entry, hdr->offset_size)) + return DYNCOL_OFFSET_ERROR; + if (next_entry == hdr->header + hdr->header_size) + return hdr->data_size - hdr->offset; + if (type_and_offset_read(&next_entry_type, &next_entry_offset, + next_entry + fmt->fixed_hdr_entry, hdr->offset_size)) + return DYNCOL_OFFSET_ERROR; + return (next_entry_offset - hdr->offset); } @@ -1272,78 +1664,156 @@ static size_t get_length(uchar *entry, uchar *header_end, Comparator function for references to header entries for qsort */ -static int header_compar(const void *a, const void *b) +static int header_compar_num(const void *a, const void *b) { uint va= uint2korr((uchar*)a), vb= uint2korr((uchar*)b); return (va > vb ? 1 : (va < vb ? -1 : 0)); } +/** + Find entry in the numeric format header by the column number + + @param hdr descriptor of dynamic column record + @param key number to find + + @return pointer to the entry or NULL +*/ + +static uchar *find_entry_num(DYN_HEADER *hdr, uint key) +{ + uchar header_entry[2+4]; + DBUG_ASSERT(hdr->format == DYNCOL_FMT_NUM); + int2store(header_entry, key); + return hdr->entry= bsearch(header_entry, hdr->header, + (size_t)hdr->column_count, + hdr->entry_size, &header_compar_num); +} + + +/** + Find entry in the names format header by the column number + + @param hdr descriptor of dynamic column record + @param key name to find + + @return pointer to the entry or NULL +*/ +static uchar *find_entry_str(DYN_HEADER *hdr, LEX_STRING *key) +{ + uchar *min= hdr->header; + uchar *max= hdr->header + (hdr->column_count - 1) * hdr->entry_size; + uchar *mid; + DBUG_ASSERT(hdr->format == DYNCOL_FMT_STR); + DBUG_ASSERT(hdr->nmpool != NULL); + while (max >= min) + { + uint len; + int cmp; + mid= hdr->header + ((min - hdr->header) + (max - hdr->header)) / 2 / hdr->entry_size * hdr->entry_size; + len= mid[0]; + cmp= len - key->length; + if (cmp == 0) + cmp= memcmp(hdr->nmpool + uint2korr(mid + 1), key->str, len); + if (cmp < 0) + min= mid + hdr->entry_size; + else if (cmp > 0) + max= mid - hdr->entry_size; + else + return mid; + } + return NULL; +} + + +/** + Write number in the buffer (backward direction - starts from the buffer end) + + @return pointer on the number begining +*/ + +static char *backwritenum(char *chr, uint numkey) +{ + if (numkey == 0) + *(--chr)= '0'; + else + while (numkey > 0) + { + *(--chr)= '0' + numkey % 10; + numkey/= 10; + } + return chr; +} + + /** Find column and fill information about it - @param type Returns type of the column - @param data Returns a pointer to the data - @param length Returns length of the data - @param offset_size Size of offset field in bytes - @param column_count Number of column in the packed string - @param data_end Pointer to the data end - @param num Number of the column we want to fetch - @param entry_pos NULL or place where to put reference to the entry + @param hdr descriptor of dynamic column record + @param numkey Number of the column to fetch (if strkey is NULL) + @param strkey Name of the column to fetch (or NULL) @return 0 ok @return 1 error in data */ static my_bool -find_column(DYNAMIC_COLUMN_TYPE *type, uchar **data, size_t *length, - uchar *header, size_t offset_size, uint column_count, - uchar *data_end, uint num, uchar **entry_pos) +find_column(DYN_HEADER *hdr, uint numkey, LEX_STRING *strkey) { - uchar *entry; - size_t offset, total_data, header_size, entry_size; - uchar key[2+4]; + LEX_STRING nmkey; + char nmkeybuff[6]; /* to fit max 2 bytes number */ + DBUG_ASSERT(hdr->header != NULL); - if (!entry_pos) - entry_pos= &entry; + if (hdr->header + hdr->header_size > hdr->data_end) + return TRUE; - calc_param(&entry_size, &header_size, offset_size, column_count); + /* fix key */ + if (hdr->format == DYNCOL_FMT_NUM && strkey != NULL) + { + char *end; + numkey= (uint) strtoul(strkey->str, &end, 10); + if (end != strkey->str + strkey->length) + { + /* we can't find non-numeric key among numeric ones */ + hdr->type= DYN_COL_NULL; + return 0; + } + } + else if (hdr->format == DYNCOL_FMT_STR && strkey == NULL) + { + nmkey.str= backwritenum(nmkeybuff + sizeof(nmkeybuff), numkey); + nmkey.length= (nmkeybuff + sizeof(nmkeybuff)) - nmkey.str; + strkey= &nmkey; + } + if (hdr->format == DYNCOL_FMT_NUM) + hdr->entry= find_entry_num(hdr, numkey); + else + hdr->entry= find_entry_str(hdr, strkey); - if (header + header_size > data_end) - return 1; - - int2store(key, num); - entry= bsearch(key, header, (size_t)column_count, entry_size, - &header_compar); - if (!entry) + if (!hdr->entry) { /* Column not found */ - *type= DYN_COL_NULL; - *entry_pos= NULL; + hdr->type= DYN_COL_NULL; return 0; } - type_and_offset_read(type, &offset, entry, offset_size); - total_data= data_end - (header + header_size); - if (offset > total_data) - return 1; - *data= header + header_size + offset; - *length= get_length(entry, header + header_size, offset_size, - total_data); + hdr->length= hdr_interval_length(hdr, hdr->entry + hdr->entry_size); + hdr->data= hdr->dtpool + hdr->offset; /* Check that the found data is withing the ranges. This can happen if we get data with wrong offsets. */ - if ((long) *length < 0 || offset + *length > total_data) + if (hdr->length == DYNCOL_OFFSET_ERROR || + hdr->length > INT_MAX || hdr->offset > hdr->data_size) return 1; - *entry_pos= entry; return 0; } /** - Read and check the header of the dynamic string + Read and check the header of the dynamic string + @param hdr descriptor of dynamic column record @param str Dynamic string @retval FALSE OK @@ -1354,22 +1824,30 @@ find_column(DYNAMIC_COLUMN_TYPE *type, uchar **data, size_t *length, already have handled this case. */ -static inline my_bool read_fixed_header(DYNAMIC_COLUMN *str, - size_t *offset_size, - uint *column_count) +static inline my_bool read_fixed_header(DYN_HEADER *hdr, + DYNAMIC_COLUMN *str) { DBUG_ASSERT(str != NULL && str->length != 0); - if ((str->length < FIXED_HEADER_SIZE) || + if ((str->length < 1) || (str->str[0] & (~DYNCOL_FLG_KNOWN))) + return 1; + hdr->format= ((str->str[0] & DYNCOL_FLG_NAMES) ? + DYNCOL_FMT_STR: + DYNCOL_FMT_NUM); + if ((str->length < fmt_data[hdr->format].fixed_hdr)) return 1; /* Wrong header */ - *offset_size= (str->str[0] & DYNCOL_FLG_OFFSET) + 1; - *column_count= uint2korr(str->str + 1); + hdr->offset_size= (str->str[0] & DYNCOL_FLG_OFFSET) + 1; + hdr->column_count= uint2korr(str->str + 1); + if (hdr->format == DYNCOL_FMT_STR) + hdr->nmpool_size= uint2korr(str->str + 3); + else + hdr->nmpool_size= 0; return 0; } /** - Get dynamic column value + Get dynamic column value by column number @param str The packed string to extract the column @param column_nr Number of column to fetch @@ -1378,61 +1856,133 @@ static inline my_bool read_fixed_header(DYNAMIC_COLUMN *str, @return ER_DYNCOL_* return code */ -int dynamic_column_get(DYNAMIC_COLUMN *str, uint column_nr, +enum enum_dyncol_func_result +dynamic_column_get(DYNAMIC_COLUMN *str, uint column_nr, DYNAMIC_COLUMN_VALUE *store_it_here) { - uchar *data; - size_t offset_size, length; - uint column_count; - enum enum_dyncol_func_result rc= ER_DYNCOL_FORMAT; + return dynamic_column_get_internal(str, store_it_here, column_nr, NULL); +} - if (str->length == 0) - goto null; - if (read_fixed_header(str, &offset_size, &column_count)) - goto err; +/** + Get dynamic column value by name - if (column_count == 0) - goto null; + @param str The packed string to extract the column + @param name Name of column to fetch + @param store_it_here Where to store the extracted value - if (find_column(&store_it_here->type, &data, &length, - (uchar*)str->str + FIXED_HEADER_SIZE, - offset_size, column_count, (uchar*)str->str + str->length, - column_nr, NULL)) - goto err; + @return ER_DYNCOL_* return code +*/ - switch (store_it_here->type) { +enum enum_dyncol_func_result +dynamic_column_get_str(DYNAMIC_COLUMN *str, LEX_STRING *name, + DYNAMIC_COLUMN_VALUE *store_it_here) +{ + DBUG_ASSERT(name != NULL); + return dynamic_column_get_internal(str, store_it_here, 0, name); +} + + +/** + Get dynamic column value by number or name + + @param str The packed string to extract the column + @param key Name or number of column to fetch + (depends on string_key) + @param store_it_here Where to store the extracted value + @param string_key True if we gave pointer to LEX_STRING. + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_get_fmt(DYNAMIC_COLUMN *str, void *key, + DYNAMIC_COLUMN_VALUE *store_it_here, + my_bool string_key) +{ + DBUG_ASSERT(key != NULL); + if (string_key) + return dynamic_column_get_internal(str, store_it_here, + 0, (LEX_STRING *)key); + return dynamic_column_get_internal(str, store_it_here, + *((uint *)key), NULL); +} + +static enum enum_dyncol_func_result +dynamic_column_get_value(DYN_HEADER *hdr, DYNAMIC_COLUMN_VALUE *store_it_here) +{ + static enum enum_dyncol_func_result rc; + switch ((store_it_here->type= hdr->type)) { case DYN_COL_INT: - rc= dynamic_column_sint_read(store_it_here, data, length); + rc= dynamic_column_sint_read(store_it_here, hdr->data, hdr->length); break; case DYN_COL_UINT: - rc= dynamic_column_uint_read(store_it_here, data, length); + rc= dynamic_column_uint_read(store_it_here, hdr->data, hdr->length); break; case DYN_COL_DOUBLE: - rc= dynamic_column_double_read(store_it_here, data, length); + rc= dynamic_column_double_read(store_it_here, hdr->data, hdr->length); break; case DYN_COL_STRING: - rc= dynamic_column_string_read(store_it_here, data, length); + rc= dynamic_column_string_read(store_it_here, hdr->data, hdr->length); break; case DYN_COL_DECIMAL: - rc= dynamic_column_decimal_read(store_it_here, data, length); + rc= dynamic_column_decimal_read(store_it_here, hdr->data, hdr->length); break; case DYN_COL_DATETIME: - rc= dynamic_column_date_time_read(store_it_here, data, length); + rc= dynamic_column_date_time_read(store_it_here, hdr->data, + hdr->length); break; case DYN_COL_DATE: - rc= dynamic_column_date_read(store_it_here, data, length); + rc= dynamic_column_date_read(store_it_here, hdr->data, hdr->length); break; case DYN_COL_TIME: - rc= dynamic_column_time_read(store_it_here, data, length); + rc= dynamic_column_time_read(store_it_here, hdr->data, hdr->length); break; case DYN_COL_NULL: rc= ER_DYNCOL_OK; break; default: - goto err; + rc= ER_DYNCOL_FORMAT; + store_it_here->type= DYN_COL_NULL; + break; } return rc; +} + +/** + Get dynamic column value by number or name + + @param str The packed string to extract the column + @param store_it_here Where to store the extracted value + @param numkey Number of the column to fetch (if strkey is NULL) + @param strkey Name of the column to fetch (or NULL) + + @return ER_DYNCOL_* return code +*/ + +static enum enum_dyncol_func_result +dynamic_column_get_internal(DYNAMIC_COLUMN *str, + DYNAMIC_COLUMN_VALUE *store_it_here, + uint num_key, LEX_STRING *str_key) +{ + DYN_HEADER header; + enum enum_dyncol_func_result rc= ER_DYNCOL_FORMAT; + bzero(&header, sizeof(header)); + + if (str->length == 0) + goto null; + + if ((rc= init_read_hdr(&header, str)) < 0) + goto err; + + if (header.column_count == 0) + goto null; + + if (find_column(&header, num_key, str_key)) + goto err; + + rc= dynamic_column_get_value(&header, store_it_here); + return rc; null: rc= ER_DYNCOL_OK; @@ -1441,128 +1991,9 @@ err: return rc; } -/** - Delete column with given number from the packed string - - @param str The packed string to delete the column - @param column_nr Number of column to delete - - @return ER_DYNCOL_* return code -*/ - -int dynamic_column_delete(DYNAMIC_COLUMN *str, uint column_nr) -{ - uchar *data, *header_entry, *read, *write; - size_t offset_size, new_offset_size, length, entry_size, new_entry_size, - header_size, new_header_size, data_size, new_data_size, - deleted_entry_offset; - uint column_count, i; - DYNAMIC_COLUMN_TYPE type; - - if (str->length == 0) - return ER_DYNCOL_OK; /* no columns */ - - if (read_fixed_header(str, &offset_size, &column_count)) - return ER_DYNCOL_FORMAT; - - if (column_count == 0) - { - str->length= 0; - return ER_DYNCOL_OK; /* no columns */ - } - - if (find_column(&type, &data, &length, (uchar*)str->str + FIXED_HEADER_SIZE, - offset_size, column_count, (uchar*)str->str + str->length, - column_nr, &header_entry)) - return ER_DYNCOL_FORMAT; - - if (type == DYN_COL_NULL) - return ER_DYNCOL_OK; /* no such column */ - - if (column_count == 1) - { - /* delete the only column; Return empty string */ - str->length= 0; - return ER_DYNCOL_OK; - } - - /* Calculate entry_size and header_size */ - calc_param(&entry_size, &header_size, offset_size, column_count); - data_size= str->length - FIXED_HEADER_SIZE - header_size; - - new_data_size= data_size - length; - if ((new_offset_size= dynamic_column_offset_bytes(new_data_size)) >= - MAX_OFFSET_LENGTH) - return ER_DYNCOL_LIMIT; - DBUG_ASSERT(new_offset_size <= offset_size); - - calc_param(&new_entry_size, &new_header_size, - new_offset_size, column_count - 1); - - deleted_entry_offset= ((data - (uchar*) str->str) - - header_size - FIXED_HEADER_SIZE); - - /* rewrite header*/ - set_fixed_header(str, new_offset_size, column_count - 1); - for (i= 0, write= read= (uchar *)str->str + FIXED_HEADER_SIZE; - i < column_count; - i++, read+= entry_size, write+= new_entry_size) - { - size_t offs; - uint nm; - DYNAMIC_COLUMN_TYPE tp; - if (read == header_entry) - { -#ifndef DBUG_OFF - nm= uint2korr(read); - type_and_offset_read(&tp, &offs, read, - offset_size); - DBUG_ASSERT(nm == column_nr); - DBUG_ASSERT(offs == deleted_entry_offset); -#endif - write-= new_entry_size; /* do not move writer */ - continue; /* skip removed field */ - } - - nm= uint2korr(read), - type_and_offset_read(&tp, &offs, read, - offset_size); - - if (offs > deleted_entry_offset) - offs-= length; /* data stored after removed data */ - - int2store(write, nm); - type_and_offset_store(write, new_offset_size, tp, offs); - } - - /* move data */ - { - size_t first_chunk_len= ((data - (uchar *)str->str) - - FIXED_HEADER_SIZE - header_size); - size_t second_chunk_len= new_data_size - first_chunk_len; - if (first_chunk_len) - memmove(str->str + FIXED_HEADER_SIZE + new_header_size, - str->str + FIXED_HEADER_SIZE + header_size, - first_chunk_len); - if (second_chunk_len) - memmove(str->str + - FIXED_HEADER_SIZE + new_header_size + first_chunk_len, - str->str + - FIXED_HEADER_SIZE + header_size + first_chunk_len + length, - second_chunk_len); - } - - /* fix str length */ - DBUG_ASSERT(str->length >= - FIXED_HEADER_SIZE + new_header_size + new_data_size); - str->length= FIXED_HEADER_SIZE + new_header_size + new_data_size; - - return ER_DYNCOL_OK; -} - /** - Check existence of the column in the packed string + Check existence of the column in the packed string (by number) @param str The packed string to check the column @param column_nr Number of column to check @@ -1573,31 +2004,84 @@ int dynamic_column_delete(DYNAMIC_COLUMN *str, uint column_nr) enum enum_dyncol_func_result dynamic_column_exists(DYNAMIC_COLUMN *str, uint column_nr) { - uchar *data; - size_t offset_size, length; - uint column_count; - DYNAMIC_COLUMN_TYPE type; - - if (str->length == 0) - return ER_DYNCOL_NO; /* no columns */ - - if (read_fixed_header(str, &offset_size, &column_count)) - return ER_DYNCOL_FORMAT; - - if (column_count == 0) - return ER_DYNCOL_NO; /* no columns */ - - if (find_column(&type, &data, &length, (uchar*)str->str + FIXED_HEADER_SIZE, - offset_size, column_count, (uchar*)str->str + str->length, - column_nr, NULL)) - return ER_DYNCOL_FORMAT; - - return (type != DYN_COL_NULL ? ER_DYNCOL_YES : ER_DYNCOL_NO); + return dynamic_column_exists_internal(str, column_nr, NULL); } /** - List not-null columns in the packed string + Check existence of the column in the packed string (by name) + + @param str The packed string to check the column + @param name Name of column to check + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_exists_str(DYNAMIC_COLUMN *str, LEX_STRING *name) +{ + DBUG_ASSERT(name != NULL); + return dynamic_column_exists_internal(str, 0, name); +} + + +/** + Check existence of the column in the packed string (by name of number) + + @param str The packed string to check the column + @param key Name or number of column to fetch + (depends on string_key) + @param string_key True if we gave pointer to LEX_STRING. + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_exists_fmt(DYNAMIC_COLUMN *str, void *key, my_bool string_key) +{ + DBUG_ASSERT(key != NULL); + if (string_key) + return dynamic_column_exists_internal(str, 0, (LEX_STRING *) key); + return dynamic_column_exists_internal(str, *((uint *)key), NULL); +} + + +/** + Check existence of the column in the packed string (by name of number) + + @param str The packed string to check the column + @param num_key Number of the column to fetch (if strkey is NULL) + @param str_key Name of the column to fetch (or NULL) + + @return ER_DYNCOL_* return code +*/ + +static enum enum_dyncol_func_result +dynamic_column_exists_internal(DYNAMIC_COLUMN *str, uint num_key, + LEX_STRING *str_key) +{ + DYN_HEADER header; + enum enum_dyncol_func_result rc; + bzero(&header, sizeof(header)); + + if (str->length == 0) + return ER_DYNCOL_NO; /* no columns */ + + if ((rc= init_read_hdr(&header, str)) < 0) + return rc; + + if (header.column_count == 0) + return ER_DYNCOL_NO; /* no columns */ + + if (find_column(&header, num_key, str_key)) + return ER_DYNCOL_FORMAT; + + return (header.type != DYN_COL_NULL ? ER_DYNCOL_YES : ER_DYNCOL_NO); +} + + +/** + List not-null columns in the packed string (only numeric foemat) @param str The packed string @param array_of_uint Where to put reference on created array @@ -1608,28 +2092,31 @@ dynamic_column_exists(DYNAMIC_COLUMN *str, uint column_nr) enum enum_dyncol_func_result dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) { + DYN_HEADER header; uchar *read; - size_t offset_size, entry_size; - uint column_count, i; + uint i; + enum enum_dyncol_func_result rc; bzero(array_of_uint, sizeof(*array_of_uint)); /* In case of errors */ if (str->length == 0) return ER_DYNCOL_OK; /* no columns */ - if (read_fixed_header(str, &offset_size, &column_count)) + if ((rc= init_read_hdr(&header, str)) < 0) + return rc; + + if (header.format != DYNCOL_FMT_NUM) return ER_DYNCOL_FORMAT; - entry_size= COLUMN_NUMBER_SIZE + offset_size; - - if (entry_size * column_count + FIXED_HEADER_SIZE > str->length) + if (header.entry_size * header.column_count + FIXED_HEADER_SIZE > + str->length) return ER_DYNCOL_FORMAT; - if (init_dynamic_array(array_of_uint, sizeof(uint), column_count, 0)) + if (init_dynamic_array(array_of_uint, sizeof(uint), header.column_count, 0)) return ER_DYNCOL_RESOURCE; - for (i= 0, read= (uchar *)str->str + FIXED_HEADER_SIZE; - i < column_count; - i++, read+= entry_size) + for (i= 0, read= header.header; + i < header.column_count; + i++, read+= header.entry_size) { uint nm= uint2korr(read); /* Insert can't never fail as it's pre-allocated above */ @@ -1639,72 +2126,205 @@ dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) } +/** + List not-null columns in the packed string (any format) + + @param str The packed string + @param array_of_lexstr Where to put reference on created array + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr) +{ + DYN_HEADER header; + uchar *read; + struct st_service_funcs *fmt; + uint i; + enum enum_dyncol_func_result rc; + + bzero(array_of_lexstr, sizeof(*array_of_lexstr)); /* In case of errors */ + if (str->length == 0) + return ER_DYNCOL_OK; /* no columns */ + + if ((rc= init_read_hdr(&header, str)) < 0) + return rc; + + fmt= fmt_data + header.format; + + if (header.entry_size * header.column_count + fmt->fixed_hdr > + str->length) + return ER_DYNCOL_FORMAT; + + if (init_dynamic_array(array_of_lexstr, sizeof(LEX_STRING), + header.column_count, 0)) + return ER_DYNCOL_RESOURCE; + + for (i= 0, read= header.header; + i < header.column_count; + i++, read+= header.entry_size) + { + LEX_STRING tmp; + if (header.format == DYNCOL_FMT_NUM) + { + uint nm= uint2korr(read); + tmp.str= my_malloc(6, MYF(0)); + if (!tmp.str) + return ER_DYNCOL_RESOURCE; + tmp.length= snprintf(tmp.str, 6, "%u", nm); + } + else + { + tmp.length= read[0]; + tmp.str= my_malloc(tmp.length + 1, MYF(0)); + if(!tmp.str) + return ER_DYNCOL_RESOURCE; + memcpy(tmp.str, (const void *)header.nmpool + uint2korr(read + 1), + tmp.length); + tmp.str[tmp.length]= '\0'; // just for safety + } + /* Insert can't never fail as it's pre-allocated above */ + (void) insert_dynamic(array_of_lexstr, (uchar *)&tmp); + } + return ER_DYNCOL_OK; +} + /** Find the place of the column in the header or place where it should be put - @param num Number of the column - @param header Pointer to the header - @param entry_size Size of a header entry - @param column_count Number of columns in the packed string - @param entry Return pointer to the entry or next entry + @param hdr descriptor of dynamic column record + @param key Name or number of column to fetch + (depends on string_key) + @param string_key True if we gave pointer to LEX_STRING. @retval TRUE found @retval FALSE pointer set to the next row */ static my_bool -find_place(uint num, uchar *header, size_t entry_size, - uint column_count, uchar **entry) +find_place(DYN_HEADER *hdr, void *key, my_bool string_keys) { uint mid, start, end, val; int flag; + LEX_STRING str; + char buff[6]; + my_bool need_conversion= ((string_keys ? DYNCOL_FMT_STR : DYNCOL_FMT_NUM) != + hdr->format); LINT_INIT(flag); /* 100 % safe */ + /* new format can't be numeric if the old one is names */ + DBUG_ASSERT(string_keys || + hdr->format == DYNCOL_FMT_NUM); start= 0; - end= column_count -1; + end= hdr->column_count -1; mid= 1; while (start != end) { - uint val; - mid= (start + end) / 2; - val= uint2korr(header + mid * entry_size); - if ((flag= CMP_NUM(num, val)) <= 0) - end= mid; - else - start= mid + 1; + uint val; + mid= (start + end) / 2; + hdr->entry= hdr->header + mid * hdr->entry_size; + if (!string_keys) + { + val= uint2korr(hdr->entry); + flag= CMP_NUM(*((uint *)key), val); + } + else + { + if (need_conversion) + { + str.str= backwritenum(buff + sizeof(buff), uint2korr(hdr->entry)); + str.length= (buff + sizeof(buff)) - str.str; + } + else + { + DBUG_ASSERT(hdr->format == DYNCOL_FMT_STR); + str.length= hdr->entry[0]; + str.str= (char *)hdr->nmpool + uint2korr(hdr->entry + 1); + } + flag= ((LEX_STRING *) key)->length - str.length; + if (flag == 0) + flag= memcmp(((LEX_STRING *) key)->str, str.str, str.length); + } + if (flag <= 0) + end= mid; + else + start= mid + 1; } + hdr->entry= hdr->header + start * hdr->entry_size; if (start != mid) { - val= uint2korr(header + start * entry_size); - flag= CMP_NUM(num, val); + if (!string_keys) + { + val= uint2korr(hdr->entry); + flag= CMP_NUM(*((uint *)key), val); + } + else + { + if (need_conversion) + { + str.str= backwritenum(buff + sizeof(buff), uint2korr(hdr->entry)); + str.length= (buff + sizeof(buff)) - str.str; + } + else + { + DBUG_ASSERT(hdr->format == DYNCOL_FMT_STR); + str.length= hdr->entry[0]; + str.str= (char*) hdr->nmpool + uint2korr(hdr->entry + 1); + } + flag= ((LEX_STRING *) key)->length - str.length; + if (flag == 0) + flag= memcmp(((LEX_STRING *) key)->str, str.str, str.length); + } } - *entry= header + start * entry_size; if (flag > 0) - *entry+= entry_size; /* Point at next bigger key */ + hdr->entry+= hdr->entry_size; /* Point at next bigger key */ return flag == 0; } /* - Description of plan of adding/removing/updating a packed string + It is internal structure which describes plan of chenging the record + of dynamic columns */ typedef enum {PLAN_REPLACE, PLAN_ADD, PLAN_DELETE, PLAN_NOP} PLAN_ACT; struct st_plan { DYNAMIC_COLUMN_VALUE *val; - uint *num; + void *key; uchar *place; size_t length; - int hdelta, ddelta; + int hdelta, ddelta, ndelta; + uint mv_offset, mv_length, mv_end; PLAN_ACT act; }; typedef struct st_plan PLAN; -static int plan_sort(const void *a, const void *b) +/** + Sort function for plan by column number +*/ + +static int plan_sort_num(const void *a, const void *b) { - return ((PLAN *)a)->num[0] - ((PLAN *)b)->num[0]; + return *((uint *)((PLAN *)a)->key) - *((uint *)((PLAN *)b)->key); +} + + +/** + Sort function for plan by column name +*/ + +static int plan_sort_str(const void *a, const void *b) +{ + int res= (((LEX_STRING *)((PLAN *)a)->key)->length - + ((LEX_STRING *)((PLAN *)b)->key)->length); + if (res == 0) + res= memcmp(((LEX_STRING *)((PLAN *)a)->key)->str, + ((LEX_STRING *)((PLAN *)b)->key)->str, + ((LEX_STRING *)((PLAN *)a)->key)->length); + return res; } #define DELTA_CHECK(S, D, C) \ @@ -1714,8 +2334,555 @@ static int plan_sort(const void *a, const void *b) ((S) < 0 && (D) > 0)) \ { \ (C)= TRUE; \ - break; \ - } \ + } + +/** + Update dynamic column by copying in a new record (string). + + @param str Dynamic column record to change + @param plan Plan of changing the record + @param add_column_count number of records in the plan array. + @param hdr descriptor of old dynamic column record + @param new_hdr descriptor of new dynamic column record + @param convert need conversion from numeric to names format + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, + uint add_column_count, + DYN_HEADER *hdr, DYN_HEADER *new_hdr, + my_bool convert) +{ + DYNAMIC_COLUMN tmp; + struct st_service_funcs *fmt= fmt_data + hdr->format, + *new_fmt= fmt_data + new_hdr->format; + uint i, j, k; + size_t all_headers_size; + + if (dynamic_column_init_str(&tmp, + (new_fmt->fixed_hdr + new_hdr->header_size + + new_hdr->nmpool_size + + new_hdr->data_size + DYNCOL_SYZERESERVE))) + { + return ER_DYNCOL_RESOURCE; + } + bzero(tmp.str, new_fmt->fixed_hdr); + (*new_fmt->set_fixed_hdr)(&tmp, new_hdr); + /* Adjust tmp to contain whole the future header */ + tmp.length= new_fmt->fixed_hdr + new_hdr->header_size + new_hdr->nmpool_size; + + + /* + Copy data to the new string + i= index in array of changes + j= index in packed string header index + */ + new_hdr->entry= new_hdr->header; + new_hdr->name= new_hdr->nmpool; + all_headers_size= new_fmt->fixed_hdr + + new_hdr->header_size + new_hdr->nmpool_size; + for (i= 0, j= 0; i < add_column_count || j < hdr->column_count; i++) + { + size_t first_offset; + uint start= j, end; + LINT_INIT(first_offset); + + /* + Search in i and j for the next column to add from i and where to + add. + */ + + while (i < add_column_count && plan[i].act == PLAN_NOP) + i++; /* skip NOP */ + + if (i == add_column_count) + j= end= hdr->column_count; + else + { + /* + old data portion. We don't need to check that j < column_count + as plan[i].place is guaranteed to have a pointer inside the + data. + */ + while (hdr->header + j * hdr->entry_size < plan[i].place) + j++; + end= j; + if ((plan[i].act == PLAN_REPLACE || plan[i].act == PLAN_DELETE)) + j++; /* data at 'j' will be removed */ + } + + /* + Adjust all headers since last loop. + We have to do this as the offset for data has moved + */ + for (k= start; k < end; k++) + { + uchar *read= hdr->header + k * hdr->entry_size; + void *key; + LEX_STRING name; + size_t offs; + uint nm; + DYNAMIC_COLUMN_TYPE tp; + char buff[6]; + + if (hdr->format == DYNCOL_FMT_NUM) + { + if (convert) + { + name.str= backwritenum(buff + sizeof(buff), uint2korr(read)); + name.length= (buff + sizeof(buff)) - name.str; + key= &name; + } + else + { + nm= uint2korr(read); /* Column nummber */ + key= &nm; + } + } + else + { + name.length= read[0]; + name.str= (char *) hdr->nmpool + uint2korr(read + 1); + key= &name; + } + if (type_and_offset_read(&tp, &offs, + read + fmt->fixed_hdr_entry, hdr->offset_size)) + goto err; + if (k == start) + first_offset= offs; + else if (offs < first_offset) + goto err; + + offs+= plan[i].ddelta; + { + DYNAMIC_COLUMN_VALUE val; + val.type= tp; // only the type used in the header + if ((*new_fmt->put_header_entry)(new_hdr, key, &val, offs)) + goto err; + } + } + + /* copy first the data that was not replaced in original packed data */ + if (start < end) + { + size_t data_size; + /* Add old data last in 'tmp' */ + hdr->entry= hdr->header + start * hdr->entry_size; + data_size= + hdr_interval_length(hdr, hdr->header + end * hdr->entry_size); + if (data_size == DYNCOL_OFFSET_ERROR || + (long) data_size < 0 || + data_size > hdr->data_size - first_offset) + goto err; + + memcpy(tmp.str + tmp.length, (char *)hdr->dtpool + first_offset, + data_size); + tmp.length+= data_size; + } + + /* new data adding */ + if (i < add_column_count) + { + if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) + { + if ((*new_fmt->put_header_entry)(new_hdr, plan[i].key, + plan[i].val, + tmp.length - all_headers_size)) + goto err; + data_store(&tmp, plan[i].val); /* Append new data */ + } + } + } + dynamic_column_column_free(str); + *str= tmp; + return ER_DYNCOL_OK; +err: + dynamic_column_column_free(&tmp); + return ER_DYNCOL_FORMAT; +} + +enum enum_dyncol_func_result +dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, + size_t offset_size, + size_t entry_size, + size_t header_size, + size_t new_offset_size, + size_t new_entry_size, + size_t new_header_size, + uint column_count, + uint new_column_count, + uint add_column_count, + uchar *header_end, + size_t max_offset) +{ + uchar *write; + uchar *header_base= (uchar *)str->str + FIXED_HEADER_SIZE; + uint i, j, k; + size_t curr_offset; + + write= (uchar *)str->str + FIXED_HEADER_SIZE; + set_fixed_header(str, new_offset_size, new_column_count); + + /* + Move headers first. + i= index in array of changes + j= index in packed string header index + */ + for (curr_offset= 0, i= 0, j= 0; + i < add_column_count || j < column_count; + i++) + { + size_t first_offset; + uint start= j, end; + LINT_INIT(first_offset); + + /* + Search in i and j for the next column to add from i and where to + add. + */ + + while (i < add_column_count && plan[i].act == PLAN_NOP) + i++; /* skip NOP */ + + if (i == add_column_count) + j= end= column_count; + else + { + /* + old data portion. We don't need to check that j < column_count + as plan[i].place is guaranteed to have a pointer inside the + data. + */ + while (header_base + j * entry_size < plan[i].place) + j++; + end= j; + if ((plan[i].act == PLAN_REPLACE || plan[i].act == PLAN_DELETE)) + j++; /* data at 'j' will be removed */ + } + plan[i].mv_end= end; + + { + DYNAMIC_COLUMN_TYPE tp; + if (type_and_offset_read(&tp, &first_offset, + header_base + start * entry_size + + COLUMN_NUMBER_SIZE, offset_size)) + return ER_DYNCOL_FORMAT; + } + /* find data to be moved */ + if (start < end) + { + size_t data_size= + get_length_interval(header_base + start * entry_size, + header_base + end * entry_size, + header_end, offset_size, max_offset); + if (data_size == DYNCOL_OFFSET_ERROR || + (long) data_size < 0 || + data_size > max_offset - first_offset) + { + str->length= 0; // just something valid + return ER_DYNCOL_FORMAT; + } + DBUG_ASSERT(curr_offset == first_offset + plan[i].ddelta); + plan[i].mv_offset= first_offset; + plan[i].mv_length= data_size; + curr_offset+= data_size; + } + else + { + plan[i].mv_length= 0; + plan[i].mv_offset= curr_offset; + } + + if (plan[i].ddelta == 0 && offset_size == new_offset_size && + plan[i].act != PLAN_DELETE) + write+= entry_size * (end - start); + else + { + /* + Adjust all headers since last loop. + We have to do this as the offset for data has moved + */ + for (k= start; k < end; k++) + { + uchar *read= header_base + k * entry_size; + size_t offs; + uint nm; + DYNAMIC_COLUMN_TYPE tp; + + nm= uint2korr(read); /* Column nummber */ + if (type_and_offset_read(&tp, &offs, read + COLUMN_NUMBER_SIZE, + offset_size)) + return ER_DYNCOL_FORMAT; + + if (k > start && offs < first_offset) + { + str->length= 0; // just something valid + return ER_DYNCOL_FORMAT; + } + + offs+= plan[i].ddelta; + int2store(write, nm); + /* write rest of data at write + COLUMN_NUMBER_SIZE */ + type_and_offset_store(write, new_offset_size, tp, offs); + write+= new_entry_size; + } + } + + /* new data adding */ + if (i < add_column_count) + { + if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) + { + int2store(write, *((uint *)plan[i].key)); + type_and_offset_store(write, new_offset_size, + plan[i].val[0].type, + curr_offset); + write+= new_entry_size; + curr_offset+= plan[i].length; + } + } + } + + /* + Move data. + i= index in array of changes + j= index in packed string header index + */ + str->length= (FIXED_HEADER_SIZE + new_header_size); + for (i= 0, j= 0; + i < add_column_count || j < column_count; + i++) + { + uint start= j, end; + + /* + Search in i and j for the next column to add from i and where to + add. + */ + + while (i < add_column_count && plan[i].act == PLAN_NOP) + i++; /* skip NOP */ + + j= end= plan[i].mv_end; + if (i != add_column_count && + (plan[i].act == PLAN_REPLACE || plan[i].act == PLAN_DELETE)) + j++; + + /* copy first the data that was not replaced in original packed data */ + if (start < end && plan[i].mv_length) + { + memmove((header_base + new_header_size + + plan[i].mv_offset + plan[i].ddelta), + header_base + header_size + plan[i].mv_offset, + plan[i].mv_length); + } + str->length+= plan[i].mv_length; + + /* new data adding */ + if (i < add_column_count) + { + if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) + { + data_store(str, plan[i].val); /* Append new data */ + } + } + } + return ER_DYNCOL_OK; +} + +enum enum_dyncol_func_result +dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, + size_t offset_size, + size_t entry_size, + size_t header_size, + size_t new_offset_size, + size_t new_entry_size, + size_t new_header_size, + uint column_count, + uint new_column_count, + uint add_column_count, + uchar *header_end, + size_t max_offset) +{ + uchar *write; + uchar *header_base= (uchar *)str->str + FIXED_HEADER_SIZE; + uint i, j, k; + size_t curr_offset; + + write= (uchar *)str->str + FIXED_HEADER_SIZE; + set_fixed_header(str, new_offset_size, new_column_count); + + /* + Move data first. + i= index in array of changes + j= index in packed string header index + */ + for (curr_offset= 0, i= 0, j= 0; + i < add_column_count || j < column_count; + i++) + { + size_t first_offset; + uint start= j, end; + LINT_INIT(first_offset); + + /* + Search in i and j for the next column to add from i and where to + add. + */ + + while (i < add_column_count && plan[i].act == PLAN_NOP) + i++; /* skip NOP */ + + if (i == add_column_count) + j= end= column_count; + else + { + /* + old data portion. We don't need to check that j < column_count + as plan[i].place is guaranteed to have a pointer inside the + data. + */ + while (header_base + j * entry_size < plan[i].place) + j++; + end= j; + if ((plan[i].act == PLAN_REPLACE || plan[i].act == PLAN_DELETE)) + j++; /* data at 'j' will be removed */ + } + plan[i].mv_end= end; + + { + DYNAMIC_COLUMN_TYPE tp; + type_and_offset_read(&tp, &first_offset, + header_base + start * entry_size + COLUMN_NUMBER_SIZE, offset_size); + } + /* find data to be moved */ + if (start < end) + { + size_t data_size= + get_length_interval(header_base + start * entry_size, + header_base + end * entry_size, + header_end, offset_size, max_offset); + if (data_size == DYNCOL_OFFSET_ERROR || + (long) data_size < 0 || + data_size > max_offset - first_offset) + { + str->length= 0; // just something valid + return ER_DYNCOL_FORMAT; + } + DBUG_ASSERT(curr_offset == first_offset + plan[i].ddelta); + plan[i].mv_offset= first_offset; + plan[i].mv_length= data_size; + curr_offset+= data_size; + } + else + { + plan[i].mv_length= 0; + plan[i].mv_offset= curr_offset; + } + + if (plan[i].ddelta == 0 && offset_size == new_offset_size && + plan[i].act != PLAN_DELETE) + write+= entry_size * (end - start); + else + { + /* + Adjust all headers since last loop. + We have to do this as the offset for data has moved + */ + for (k= start; k < end; k++) + { + uchar *read= header_base + k * entry_size; + size_t offs; + uint nm; + DYNAMIC_COLUMN_TYPE tp; + + nm= uint2korr(read); /* Column nummber */ + type_and_offset_read(&tp, &offs, read + COLUMN_NUMBER_SIZE, offset_size); + if (k > start && offs < first_offset) + { + str->length= 0; // just something valid + return ER_DYNCOL_FORMAT; + } + + offs+= plan[i].ddelta; + int2store(write, nm); + /* write rest of data at write + COLUMN_NUMBER_SIZE */ + if (type_and_offset_store(write, new_offset_size, tp, offs)) + { + str->length= 0; // just something valid + return ER_DYNCOL_FORMAT; + } + write+= new_entry_size; + } + } + + /* new data adding */ + if (i < add_column_count) + { + if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) + { + int2store(write, *((uint *)plan[i].key)); + if (type_and_offset_store(write, new_offset_size, + plan[i].val[0].type, + curr_offset)) + { + str->length= 0; // just something valid + return ER_DYNCOL_FORMAT; + } + write+= new_entry_size; + curr_offset+= plan[i].length; + } + } + } + + /* + Move headers. + i= index in array of changes + j= index in packed string header index + */ + str->length= (FIXED_HEADER_SIZE + new_header_size); + for (i= 0, j= 0; + i < add_column_count || j < column_count; + i++) + { + uint start= j, end; + + /* + Search in i and j for the next column to add from i and where to + add. + */ + + while (i < add_column_count && plan[i].act == PLAN_NOP) + i++; /* skip NOP */ + + j= end= plan[i].mv_end; + if (i != add_column_count && + (plan[i].act == PLAN_REPLACE || plan[i].act == PLAN_DELETE)) + j++; + + /* copy first the data that was not replaced in original packed data */ + if (start < end && plan[i].mv_length) + { + memmove((header_base + new_header_size + + plan[i].mv_offset + plan[i].ddelta), + header_base + header_size + plan[i].mv_offset, + plan[i].mv_length); + } + str->length+= plan[i].mv_length; + + /* new data adding */ + if (i < add_column_count) + { + if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) + { + data_store(str, plan[i].val); /* Append new data */ + } + } + } + return ER_DYNCOL_OK; +} /** @@ -1728,6 +2895,8 @@ static int plan_sort(const void *a, const void *b) @return ER_DYNCOL_* return code */ +/* plan allocated on the stack */ +#define IN_PLACE_PLAN 4 enum enum_dyncol_func_result dynamic_column_update_many(DYNAMIC_COLUMN *str, @@ -1735,39 +2904,75 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, uint *column_numbers, DYNAMIC_COLUMN_VALUE *values) { - PLAN *plan; - uchar *header_end; - long data_delta= 0; - uint i, j, k; - uint new_column_count, column_count, not_null; + return dynamic_column_update_many_fmt(str, add_column_count, column_numbers, + values, FALSE); +} + +uint numlen(uint val) +{ + uint res; + if (val == 0) + return 1; + res= 0; + while(val) + { + res++; + val/=10; + } + return res; +} + +enum enum_dyncol_func_result +dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, + uint add_column_count, + void *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool string_keys) +{ + PLAN *plan, *alloc_plan= NULL, in_place_plan[IN_PLACE_PLAN]; + uchar *element; + DYN_HEADER header, new_header; + struct st_service_funcs *fmt, *new_fmt; + long data_delta= 0, name_delta= 0; + uint i; + uint not_null; + int header_delta= 0; + int copy= FALSE; + int header_delta_sign, data_delta_sign; enum enum_dyncol_func_result rc; - int header_delta; - size_t offset_size, entry_size, header_size, data_size; - size_t new_offset_size, new_entry_size, new_header_size, new_data_size; - size_t max_offset; + my_bool convert; if (add_column_count == 0) return ER_DYNCOL_OK; + bzero(&header, sizeof(header)); + bzero(&new_header, sizeof(new_header)); + new_header.format= (string_keys ? DYNCOL_FMT_STR : DYNCOL_FMT_NUM); + new_fmt= fmt_data + new_header.format; + /* Get columns in column order. As the data in 'str' is already in column order this allows to replace all columns in one loop. */ - - if (!(plan= my_malloc(sizeof(PLAN) * (add_column_count + 1), MYF(0)))) + if (IN_PLACE_PLAN > add_column_count) + plan= in_place_plan; + else if (!(alloc_plan= plan= + my_malloc(sizeof(PLAN) * (add_column_count + 1), MYF(0)))) return ER_DYNCOL_RESOURCE; not_null= add_column_count; - for (i= 0; i < add_column_count; i++) + for (i= 0, element= (uchar *) column_keys; + i < add_column_count; + i++, element+= new_fmt->key_size_in_array) { - if (column_numbers[i] > UINT_MAX16) + if ((*new_fmt->check_limit)(&element)) { rc= ER_DYNCOL_DATA; goto end; } plan[i].val= values + i; - plan[i].num= column_numbers + i; + plan[i].key= element; if (values[i].type == DYN_COL_NULL) not_null--; @@ -1783,22 +2988,32 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, } /* Check that header is ok */ - if (read_fixed_header(str, &offset_size, &column_count)) - { - rc= ER_DYNCOL_FORMAT; + if ((rc= init_read_hdr(&header, str)) < 0) goto end; - } - if (column_count == 0) + fmt= fmt_data + header.format; + /* new format can't be numeric if the old one is names */ + DBUG_ASSERT(new_header.format == DYNCOL_FMT_STR || + header.format == DYNCOL_FMT_NUM); + if (header.column_count == 0) goto create_new_string; - qsort(plan, (size_t)add_column_count, sizeof(PLAN), &plan_sort); + qsort(plan, (size_t)add_column_count, sizeof(PLAN), new_fmt->plan_sort); - new_column_count= column_count; - calc_param(&entry_size, &header_size, offset_size, column_count); - max_offset= str->length - (FIXED_HEADER_SIZE + header_size); - header_end= (uchar*) str->str + FIXED_HEADER_SIZE + header_size; + new_header.column_count= header.column_count; + new_header.nmpool_size= header.nmpool_size; + if ((convert= (new_header.format == DYNCOL_FMT_STR && + header.format == DYNCOL_FMT_NUM))) + { + DBUG_ASSERT(new_header.nmpool_size == 0); + for(i= 0, header.entry= header.header; + i < header.column_count; + i++, header.entry+= header.entry_size) + { + new_header.nmpool_size+= numlen(uint2korr(header.entry)); + } + } - if (header_size + FIXED_HEADER_SIZE > str->length) + if (fmt->fixed_hdr + header.header_size + header.nmpool_size > str->length) { rc= ER_DYNCOL_FORMAT; goto end; @@ -1808,17 +3023,15 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, Calculate how many columns and data is added/deleted and make a 'plan' for each of them. */ - header_delta= 0; for (i= 0; i < add_column_count; i++) { - uchar *entry; - /* For now we don't allow creating two columns with the same number at the time of create. This can be fixed later to just use the later by comparing the pointers. */ - if (i < add_column_count - 1 && plan[i].num[0] == plan[i + 1].num[0]) + if (i < add_column_count - 1 && + new_fmt->column_sort(&plan[i].key, &plan[i + 1].key) == 0) { rc= ER_DYNCOL_DATA; goto end; @@ -1826,26 +3039,36 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, /* Set common variables for all plans */ plan[i].ddelta= data_delta; + plan[i].ndelta= name_delta; /* get header delta in entries */ plan[i].hdelta= header_delta; plan[i].length= 0; /* Length if NULL */ - if (find_place(plan[i].num[0], - (uchar *)str->str + FIXED_HEADER_SIZE, - entry_size, column_count, &entry)) + if (find_place(&header, plan[i].key, string_keys)) { - size_t entry_data_size; + size_t entry_data_size, entry_name_size= 0; /* Data existed; We have to replace or delete it */ - entry_data_size= get_length(entry, header_end, - offset_size, max_offset); - if ((long) entry_data_size < 0) + entry_data_size= hdr_interval_length(&header, header.entry + + header.entry_size); + if (entry_data_size == DYNCOL_OFFSET_ERROR || + (long) entry_data_size < 0) { rc= ER_DYNCOL_FORMAT; goto end; } + //get_length(header.entry, header.dtpool, header.offset_size, + //header.data_size); + if (new_header.format == DYNCOL_FMT_STR) + { + if (header.format == DYNCOL_FMT_STR) + entry_name_size= header.entry[0]; + else + entry_name_size= numlen(uint2korr(header.entry)); + } + if (plan[i].val->type == DYN_COL_NULL) { /* Inserting a NULL means delete the old data */ @@ -1853,6 +3076,7 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, plan[i].act= PLAN_DELETE; /* Remove old value */ header_delta--; /* One row less in header */ data_delta-= entry_data_size; /* Less data to store */ + name_delta-= entry_name_size; } else { @@ -1867,6 +3091,10 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, goto end; } data_delta+= plan[i].length - entry_data_size; + if (new_header.format == DYNCOL_FMT_STR) + { + name_delta+= ((LEX_STRING *)(plan[i].key))->length - entry_name_size; + } } } else @@ -1891,202 +3119,105 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, goto end; } data_delta+= plan[i].length; + if (new_header.format == DYNCOL_FMT_STR) + name_delta+= ((LEX_STRING *)plan[i].key)->length; } } - plan[i].place= entry; + plan[i].place= header.entry; } plan[add_column_count].hdelta= header_delta; plan[add_column_count].ddelta= data_delta; - new_column_count= column_count + header_delta; + plan[add_column_count].act= PLAN_NOP; + plan[add_column_count].place= header.dtpool; + + new_header.column_count= header.column_count + header_delta; /* Check if it is only "increasing" or only "decreasing" plan for (header and data separately). */ - data_size= str->length - header_size - FIXED_HEADER_SIZE; - new_data_size= data_size + data_delta; - if ((new_offset_size= dynamic_column_offset_bytes(new_data_size)) >= + new_header.data_size= header.data_size + data_delta; + new_header.nmpool_size= new_header.nmpool_size + name_delta; + DBUG_ASSERT(new_header.format != DYNCOL_FMT_NUM || + new_header.nmpool_size == 0); + if ((new_header.offset_size= + dynamic_column_offset_bytes(new_header.data_size)) >= MAX_OFFSET_LENGTH) { rc= ER_DYNCOL_LIMIT; goto end; } -#ifdef NOT_IMPLEMENTED - /* if (new_offset_size != offset_size) then we have to rewrite header */ - header_delta_sign= new_offset_size - offset_size; + copy= ((header.format != new_header.format) || + (new_header.format == DYNCOL_FMT_STR)); + /* if (new_header.offset_size!=offset_size) then we have to rewrite header */ + header_delta_sign= + ((int)new_header.offset_size + new_fmt->fixed_hdr_entry) - + ((int)header.offset_size + fmt->fixed_hdr_entry); data_delta_sign= 0; - for (i= 0; i < add_column_count; i++) + // plan[add_column_count] contains last deltas. + for (i= 0; i <= add_column_count && !copy; i++) { /* This is the check for increasing/decreasing */ DELTA_CHECK(header_delta_sign, plan[i].hdelta, copy); DELTA_CHECK(data_delta_sign, plan[i].ddelta, copy); } -#endif - calc_param(&new_entry_size, &new_header_size, - new_offset_size, new_column_count); + calc_param(&new_header.entry_size, &new_header.header_size, + new_fmt->fixed_hdr_entry, + new_header.offset_size, new_header.column_count); /* - The following code always make a copy. In future we can do a more - optimized version when data is only increasing / decreasing. + Need copy because: + 1. Header/data parts moved in different directions. + 2. There is no enough allocated space in the string. + 3. Header and data moved in different directions. */ - - /*if (copy) */ - { - DYNAMIC_COLUMN tmp; - uchar *header_base= (uchar *)str->str + FIXED_HEADER_SIZE, - *write; - if (dynamic_column_init_str(&tmp, - (FIXED_HEADER_SIZE + new_header_size + - new_data_size + DYNCOL_SYZERESERVE))) - { - rc= ER_DYNCOL_RESOURCE; - goto end; - } - write= (uchar *)tmp.str + FIXED_HEADER_SIZE; - /* Adjust tmp to contain whole the future header */ - tmp.length= FIXED_HEADER_SIZE + new_header_size; - set_fixed_header(&tmp, new_offset_size, new_column_count); - data_delta= 0; - - /* - Copy data to the new string - i= index in array of changes - j= index in packed string header index - */ - - for (i= 0, j= 0; i < add_column_count || j < column_count; i++) - { - size_t first_offset; - uint start= j, end; - LINT_INIT(first_offset); - + if (copy || /*1*/ + str->max_length < str->length + header_delta + data_delta || /*2*/ + ((header_delta_sign < 0 && data_delta_sign > 0) || + (header_delta_sign > 0 && data_delta_sign < 0))) /*3*/ + rc= dynamic_column_update_copy(str, plan, add_column_count, + &header, &new_header, + convert); + else + if (header_delta_sign < 0) + rc= dynamic_column_update_move_left(str, plan, header.offset_size, + header.entry_size, + header.header_size, + new_header.offset_size, + new_header.entry_size, + new_header.header_size, + header.column_count, + new_header.column_count, + add_column_count, header.dtpool, + header.data_size); + else /* - Search in i and j for the next column to add from i and where to - add. - */ - - while (i < add_column_count && plan[i].act == PLAN_NOP) - i++; /* skip NOP */ - if (i == add_column_count) - j= end= column_count; - else - { - /* - old data portion. We don't need to check that j < column_count - as plan[i].place is guaranteed to have a pointer inside the - data. - */ - while (header_base + j * entry_size < plan[i].place) - j++; - end= j; - if ((plan[i].act == PLAN_REPLACE || plan[i].act == PLAN_DELETE)) - j++; /* data at 'j' will be removed */ - } - - if (plan[i].ddelta == 0 && offset_size == new_offset_size) - { - uchar *read= header_base + start * entry_size; - DYNAMIC_COLUMN_TYPE tp; - /* - It's safe to copy the header unchanged. This is usually the - case for the first header block before any changed data. - */ - if (start < end) /* Avoid memcpy with 0 */ - { - size_t length= entry_size * (end - start); - memcpy(write, read, length); - write+= length; - } - /* Read first_offset */ - type_and_offset_read(&tp, &first_offset, read, offset_size); - } - else - { - /* - Adjust all headers since last loop. - We have to do this as the offset for data has moved - */ - for (k= start; k < end; k++) - { - uchar *read= header_base + k * entry_size; - size_t offs; - uint nm; - DYNAMIC_COLUMN_TYPE tp; - - nm= uint2korr(read); /* Column nummber */ - type_and_offset_read(&tp, &offs, read, offset_size); - if (k == start) - first_offset= offs; - else if (offs < first_offset) - { - dynamic_column_column_free(&tmp); - rc= ER_DYNCOL_FORMAT; - goto end; - } - - offs+= plan[i].ddelta; - int2store(write, nm); - /* write rest of data at write + COLUMN_NUMBER_SIZE */ - type_and_offset_store(write, new_offset_size, tp, offs); - write+= new_entry_size; - } - } - - /* copy first the data that was not replaced in original packed data */ - if (start < end) - { - /* Add old data last in 'tmp' */ - size_t data_size= - get_length_interval(header_base + start * entry_size, - header_base + end * entry_size, - header_end, offset_size, max_offset); - if ((long) data_size < 0 || - data_size > max_offset - first_offset) - { - dynamic_column_column_free(&tmp); - rc= ER_DYNCOL_FORMAT; - goto end; - } - - memcpy(tmp.str + tmp.length, (char *)header_end + first_offset, - data_size); - tmp.length+= data_size; - } - - /* new data adding */ - if (i < add_column_count) - { - if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) - { - int2store(write, plan[i].num[0]); - type_and_offset_store(write, new_offset_size, - plan[i].val[0].type, - tmp.length - - (FIXED_HEADER_SIZE + new_header_size)); - write+= new_entry_size; - data_store(&tmp, plan[i].val); /* Append new data */ - } - data_delta= plan[i].ddelta; - } - } - dynamic_column_column_free(str); - *str= tmp; - } - - rc= ER_DYNCOL_OK; - + rc= dynamic_column_update_move_right(str, plan, offset_size, + entry_size, header_size, + new_header.offset_size, + new_header.entry_size, + new_heder.header_size, column_count, + new_header.column_count, + add_column_count, header_end, + header.data_size); + */ + rc= dynamic_column_update_copy(str, plan, add_column_count, + &header, &new_header, + convert); end: - my_free(plan); + my_free(alloc_plan); return rc; create_new_string: /* There is no columns from before, so let's just add the new ones */ rc= ER_DYNCOL_OK; + my_free(alloc_plan); if (not_null != 0) - rc= dynamic_column_create_many_internal(str, add_column_count, - column_numbers, values, - str->str == NULL); + rc= dynamic_column_create_many_internal_fmt(str, add_column_count, + (uint*)column_keys, values, + str->str == NULL, + string_keys); goto end; } @@ -2107,3 +3238,396 @@ int dynamic_column_update(DYNAMIC_COLUMN *str, uint column_nr, { return dynamic_column_update_many(str, 1, &column_nr, value); } + + +enum enum_dyncol_func_result +dynamic_column_check(DYNAMIC_COLUMN *str) +{ + struct st_service_funcs *fmt; + enum enum_dyncol_func_result rc= ER_DYNCOL_FORMAT; + DYN_HEADER header; + uint i; + size_t data_offset= 0, name_offset= 0; + size_t prev_data_offset= 0, prev_name_offset= 0; + LEX_STRING name= {0,0}, prev_name= {0,0}; + uint num= 0, prev_num= 0; + void *key, *prev_key; + enum enum_dynamic_column_type type= DYN_COL_NULL, prev_type= DYN_COL_NULL; + + DBUG_ENTER("dynamic_column_check"); + + if (str->length == 0) + { + DBUG_PRINT("info", ("empty string is OK")); + DBUG_RETURN(ER_DYNCOL_OK); + } + + bzero(&header, sizeof(header)); + + /* Check that header is OK */ + if (read_fixed_header(&header, str)) + { + DBUG_PRINT("info", ("Reading fixed string header failed")); + goto end; + } + fmt= fmt_data + header.format; + calc_param(&header.entry_size, &header.header_size, + fmt->fixed_hdr_entry, header.offset_size, + header.column_count); + /* headers are out of string length (no space for data and part of headers) */ + if (fmt->fixed_hdr + header.header_size + header.nmpool_size > str->length) + { + DBUG_PRINT("info", ("Fixed header: %u Header size: %u " + "Name pool size: %u but Strig length: %u", + (uint)fmt->fixed_hdr, + (uint)header.header_size, + (uint)header.nmpool_size, + (uint)str->length)); + goto end; + } + header.header= (uchar*)str->str + fmt->fixed_hdr; + header.nmpool= header.header + header.header_size; + header.dtpool= header.nmpool + header.nmpool_size; + header.data_size= str->length - fmt->fixed_hdr - + header.header_size - header.nmpool_size; + + /* read and check headers */ + if (header.format == DYNCOL_FMT_NUM) + { + key= # + prev_key= &prev_num; + } + else + { + key= &name; + prev_key= &prev_name; + } + for (i= 0, header.entry= header.header; + i < header.column_count; + i++, header.entry+= header.entry_size) + { + + if (header.format == DYNCOL_FMT_NUM) + { + num= uint2korr(header.entry); + } + else + { + DBUG_ASSERT(header.format == DYNCOL_FMT_STR); + name.length= header.entry[0]; + name_offset= uint2korr(header.entry + 1); + name.str= (char *)header.nmpool + name_offset; + } + if (type_and_offset_read(&type, &data_offset, + header.entry + fmt->fixed_hdr_entry, + header.offset_size)) + goto end; + + DBUG_ASSERT(type != DYN_COL_NULL); + if (data_offset > header.data_size) + { + DBUG_PRINT("info", ("Field order: %u Data offset: %u" + " > Data pool size: %u", + (uint)i, + (uint)name_offset, + (uint)header.nmpool_size)); + goto end; + } + if (name_offset > header.nmpool_size) + { + DBUG_PRINT("info", ("Field order: %u Name offset: %u" + " > Name pool size: %u", + (uint)i, + (uint)name_offset, + (uint)header.nmpool_size)); + goto end; + } + if (prev_type != DYN_COL_NULL) + { + /* It is not first entry */ + if (prev_data_offset >= data_offset) + { + DBUG_PRINT("info", ("Field order: %u Previous data offset: %u" + " >= Current data offset: %u", + (uint)i, + (uint)prev_data_offset, + (uint)data_offset)); + goto end; + } + if (prev_name_offset > name_offset) + { + DBUG_PRINT("info", ("Field order: %u Previous name offset: %u" + " > Current name offset: %u", + (uint)i, + (uint)prev_data_offset, + (uint)data_offset)); + goto end; + } + if ((*fmt->column_sort)(&prev_key, &key) >= 0) + { + DBUG_PRINT("info", ("Field order: %u Previous key >= Current key", + (uint)i)); + goto end; + } + } + prev_num= num; + prev_name= name; + prev_data_offset= data_offset; + prev_name_offset= name_offset; + prev_type= type; + } + + /* check data, which we can */ + for (i= 0, header.entry= header.header; + i < header.column_count; + i++, header.entry+= header.entry_size) + { + DYNAMIC_COLUMN_VALUE store; + // already checked by previouse pass + type_and_offset_read(&header.type, &header.offset, + header.entry + fmt->fixed_hdr_entry, + header.offset_size); + header.length= + hdr_interval_length(&header, header.entry + header.entry_size); + header.data= header.dtpool + header.offset; + switch ((header.type)) { + case DYN_COL_INT: + rc= dynamic_column_sint_read(&store, header.data, header.length); + break; + case DYN_COL_UINT: + rc= dynamic_column_uint_read(&store, header.data, header.length); + break; + case DYN_COL_DOUBLE: + rc= dynamic_column_double_read(&store, header.data, header.length); + break; + case DYN_COL_STRING: + rc= dynamic_column_string_read(&store, header.data, header.length); + break; + case DYN_COL_DECIMAL: + rc= dynamic_column_decimal_read(&store, header.data, header.length); + break; + case DYN_COL_DATETIME: + rc= dynamic_column_date_time_read(&store, header.data, + header.length); + break; + case DYN_COL_DATE: + rc= dynamic_column_date_read(&store, header.data, header.length); + break; + case DYN_COL_TIME: + rc= dynamic_column_time_read(&store, header.data, header.length); + break; + case DYN_COL_NULL: + default: + rc= ER_DYNCOL_FORMAT; + goto end; + } + if (rc != ER_DYNCOL_OK) + { + DBUG_ASSERT(rc < 0); + DBUG_PRINT("info", ("Field order: %u Can't read data: %i", + (uint)i, (int) rc)); + goto end; + } + } + + rc= ER_DYNCOL_OK; +end: + DBUG_RETURN(rc); +} + + +enum enum_dyncol_func_result +dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, + my_bool quote) +{ + char buff[40]; + int len; + switch (val->type) { + case DYN_COL_INT: + len= snprintf(buff, sizeof(buff), "%lld", val->x.long_value); + if (dynstr_append_mem(str, buff, len)) + return ER_DYNCOL_RESOURCE; + break; + case DYN_COL_UINT: + len= snprintf(buff, sizeof(buff), "%llu", val->x.ulong_value); + if (dynstr_append_mem(str, buff, len)) + return ER_DYNCOL_RESOURCE; + break; + case DYN_COL_DOUBLE: + len= snprintf(buff, sizeof(buff), "%lg", val->x.double_value); + if (dynstr_realloc(str, len + (quote ? 2 : 0))) + return ER_DYNCOL_RESOURCE; + if (quote) + str->str[str->length++]= '"'; + dynstr_append_mem(str, buff, len); + if (quote) + str->str[str->length++]= '"'; + break; + case DYN_COL_STRING: + { + char *alloc= NULL; + char *from= val->x.string.value.str; + uint bufflen; + my_bool conv= !my_charset_same(val->x.string.charset, + &my_charset_utf8_general_ci); + my_bool rc; + len= val->x.string.value.length; + bufflen= (len * (conv ? my_charset_utf8_general_ci.mbmaxlen : 1)); + if (dynstr_realloc(str, bufflen)) + return ER_DYNCOL_RESOURCE; + + // guaranty UTF-8 string for value + if (!my_charset_same(val->x.string.charset, + &my_charset_utf8_general_ci)) + { + uint dummy_errors; + if (!quote) + { + /* convert to the destination */ + str->length+= copy_and_convert_extended(str->str, bufflen, + &my_charset_utf8_general_ci, + from, len, + val->x.string.charset, + &dummy_errors); + return ER_DYNCOL_OK; + } + if ((alloc= (char *)my_malloc(bufflen, MYF(0)))) + { + len= + copy_and_convert_extended(alloc, bufflen, + &my_charset_utf8_general_ci, + from, len, val->x.string.charset, + &dummy_errors); + from= alloc; + } + else + return ER_DYNCOL_RESOURCE; + } + if (quote) + rc= dynstr_append_quoted(str, from, len); + else + rc= dynstr_append_mem(str, from, len); + if (alloc) + my_free(alloc); + if (rc) + return ER_DYNCOL_RESOURCE; + break; + } + case DYN_COL_DECIMAL: + len= sizeof(buff); + decimal2string(&val->x.decimal.value, buff, &len, + 0, val->x.decimal.value.frac, + '0'); + if (dynstr_append_mem(str, buff, len)) + return ER_DYNCOL_RESOURCE; + break; + case DYN_COL_DATETIME: + case DYN_COL_DATE: + case DYN_COL_TIME: + len= my_TIME_to_str(&val->x.time_value, buff, AUTO_SEC_PART_DIGITS); + if (dynstr_realloc(str, len + (quote ? 2 : 0))) + return ER_DYNCOL_RESOURCE; + if (quote) + str->str[str->length++]= '"'; + dynstr_append_mem(str, buff, len); + if (quote) + str->str[str->length++]= '"'; + break; + case DYN_COL_NULL: + if (dynstr_append_mem(str, "null", 4)) + return ER_DYNCOL_RESOURCE; + break; + default: + return(ER_DYNCOL_FORMAT); + } + return(ER_DYNCOL_OK); +} + +/** + Convert to JSON + + @param str The packed string + @param json Where to put json result + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json) +{ + DYN_HEADER header; + uint i; + enum enum_dyncol_func_result rc; + + bzero(json, sizeof(DYNAMIC_STRING)); /* In case of errors */ + if (str->length == 0) + return ER_DYNCOL_OK; /* no columns */ + + if ((rc= init_read_hdr(&header, str)) < 0) + return rc; + + if (header.entry_size * header.column_count + FIXED_HEADER_SIZE > + str->length) + return ER_DYNCOL_FORMAT; + + if (init_dynamic_string(json, NULL, str->length * 2, 100)) + return ER_DYNCOL_RESOURCE; + + if (dynstr_append_mem(json, "[", 1)) + return ER_DYNCOL_RESOURCE; + rc= ER_DYNCOL_RESOURCE; + for (i= 0, header.entry= header.header; + i < header.column_count; + i++, header.entry+= header.entry_size) + { + DYNAMIC_COLUMN_VALUE val; + if (i != 0 && dynstr_append_mem(json, ",", 1)) + goto err; + header.length= + hdr_interval_length(&header, header.entry + header.entry_size); + header.data= header.dtpool + header.offset; + /* + Check that the found data is withing the ranges. This can happen if + we get data with wrong offsets. + */ + if (header.length == DYNCOL_OFFSET_ERROR || + header.length > INT_MAX || header.offset > header.data_size) + { + rc= ER_DYNCOL_FORMAT; + goto err; + } + if ((rc= dynamic_column_get_value(&header, &val)) < 0 || + dynstr_append_mem(json, "{", 1)) + goto err; + if (header.format == DYNCOL_FMT_NUM) + { + uint nm= uint2korr(header.entry); + if (dynstr_realloc(json, 6 + 3)) + goto err; + json->str[json->length++]= '"'; + json->length+= (snprintf(json->str + json->length, 6, "%u", nm)); + } + else + { + uint len= header.entry[0]; + if (dynstr_realloc(json, len + 3)) + goto err; + json->str[json->length++]= '"'; + memcpy(json->str + json->length, (const void *)header.nmpool + + uint2korr(header.entry + 1), len); + json->length+= len; + } + json->str[json->length++]= '"'; + json->str[json->length++]= ':'; + if ((rc= dynamic_column_val_str(json, &val, TRUE)) < 0 || + dynstr_append_mem(json, "}", 1)) + goto err; + } + if (dynstr_append_mem(json, "]", 1)) + return ER_DYNCOL_RESOURCE; + return ER_DYNCOL_OK; + +err: + json->length= 0; + return rc; +} diff --git a/mysys/string.c b/mysys/string.c index d9791341c60..0cf8f939260 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -175,6 +175,34 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) return ret; } +my_bool dynstr_append_quoted(DYNAMIC_STRING *str, + const char *append, size_t len) +{ + uint additional= (str->alloc_increment ? str->alloc_increment : 10); + uint lim= additional; + uint i; + if (dynstr_realloc(str, len + additional + 2)) + return TRUE; + str->str[str->length++]= '"'; + for (i= 0; i < len; i++) + { + register char c= append[i]; + if (c == '"' || c == '\\') + { + if (!lim) + { + if (dynstr_realloc(str, additional)) + return TRUE; + lim= additional; + } + lim--; + str->str[str->length++]= '\\'; + } + str->str[str->length++]= c; + } + str->str[str->length++]= '"'; + return FALSE; +} void dynstr_free(DYNAMIC_STRING *str) { @@ -193,3 +221,77 @@ void dynstr_reassociate(DYNAMIC_STRING *str, char **ptr, size_t *length, *alloc_length= str->max_length; str->str=0; } + + +/* + copy a string from one character set to another + + SYNOPSIS + copy_and_convert() + to Store result here + to_cs Character set of result string + from Copy from here + from_length Length of from string + from_cs From character set + + NOTES + 'to' must be big enough as form_length * to_cs->mbmaxlen + + RETURN + length of bytes copied to 'to' +*/ + +uint32 +copy_and_convert_extended(char *to, uint32 to_length, CHARSET_INFO *to_cs, + const char *from, uint32 from_length, + CHARSET_INFO *from_cs, + uint *errors) +{ + int cnvres; + my_wc_t wc; + const uchar *from_end= (const uchar*) from+from_length; + char *to_start= to; + uchar *to_end= (uchar*) to+to_length; + my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc; + my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb; + uint error_count= 0; + + while (1) + { + if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from, + from_end)) > 0) + from+= cnvres; + else if (cnvres == MY_CS_ILSEQ) + { + error_count++; + from++; + wc= '?'; + } + else if (cnvres > MY_CS_TOOSMALL) + { + /* + A correct multibyte sequence detected + But it doesn't have Unicode mapping. + */ + error_count++; + from+= (-cnvres); + wc= '?'; + } + else + break; // Not enough characters + +outp: + if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0) + to+= cnvres; + else if (cnvres == MY_CS_ILUNI && wc != '?') + { + error_count++; + wc= '?'; + goto outp; + } + else + break; + } + *errors= error_count; + return (uint32) (to - to_start); +} diff --git a/sql/item.h b/sql/item.h index f7f3edda384..906d3d21d6f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -523,7 +523,7 @@ public: struct st_dyncall_create_def { - Item *num, *value; + Item *key, *value; CHARSET_INFO *cs; uint len, frac; DYNAMIC_COLUMN_TYPE type; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 2a0ca19a4e9..72d28bb2e7e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -6048,24 +6048,87 @@ Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item) return NULL; } - -longlong Item_func_dyncol_exists::val_int() +longlong Item_func_dyncol_check::val_int() { char buff[STRING_BUFFER_USUAL_SIZE]; String tmp(buff, sizeof(buff), &my_charset_bin); DYNAMIC_COLUMN col; String *str; - ulonglong num; enum enum_dyncol_func_result rc; - num= args[1]->val_int(); + str= args[0]->val_str(&tmp); + if (args[0]->null_value) + goto null; + col.length= str->length(); + /* We do not change the string, so could do this trick */ + col.str= (char *)str->ptr(); + rc= dynamic_column_check(&col); + if (rc < 0 && rc != ER_DYNCOL_FORMAT) + { + dynamic_column_error_message(rc); + goto null; + } + null_value= FALSE; + return rc == ER_DYNCOL_OK; + +null: + null_value= TRUE; + return 0; +} + +longlong Item_func_dyncol_exists::val_int() +{ + char buff[STRING_BUFFER_USUAL_SIZE], nmstrbuf[11]; + String tmp(buff, sizeof(buff), &my_charset_bin), + nmbuf(nmstrbuf, sizeof(nmstrbuf), system_charset_info); + DYNAMIC_COLUMN col; + String *str; + LEX_STRING buf, *name= NULL; + ulonglong num= 0; + enum enum_dyncol_func_result rc; + + if (args[1]->result_type() == INT_RESULT) + num= args[1]->val_int(); + else + { + String *nm= args[1]->val_str(&nmbuf); + if (!nm || args[1]->null_value) + { + null_value= 1; + return 1; + } + if (my_charset_same(nm->charset(), &my_charset_utf8_general_ci)) + { + buf.str= (char *) nm->ptr(); + buf.length= nm->length(); + } + else + { + uint strlen; + uint dummy_errors; + buf.str= (char *)sql_alloc((strlen= nm->length() * + my_charset_utf8_general_ci.mbmaxlen + 1)); + if (buf.str) + { + buf.length= + copy_and_convert(buf.str, strlen, &my_charset_utf8_general_ci, + nm->ptr(), nm->length(), nm->charset(), + &dummy_errors); + } + else + buf.length= 0; + } + name= &buf; + } str= args[0]->val_str(&tmp); if (args[0]->null_value || args[1]->null_value || num > UINT_MAX16) goto null; col.length= str->length(); /* We do not change the string, so could do this trick */ col.str= (char *)str->ptr(); - rc= dynamic_column_exists(&col, (uint) num); + rc= ((name == NULL) ? + dynamic_column_exists(&col, (uint) num) : + dynamic_column_exists_str(&col, name)); if (rc < 0) { dynamic_column_error_message(rc); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 34d1a0bd0ae..f183ee9f8a8 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1861,6 +1861,14 @@ public: Item *neg_transformer(THD *thd); }; +class Item_func_dyncol_check :public Item_bool_func +{ +public: + Item_func_dyncol_check(Item *str) :Item_bool_func(str) {} + longlong val_int(); + const char *func_name() const { return "column_check"; } +}; + class Item_func_dyncol_exists :public Item_bool_func { public: diff --git a/sql/item_create.cc b/sql/item_create.cc index 96837a8f262..f886b3d598b 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -5704,7 +5704,7 @@ static List *create_func_dyncol_prepare(THD *thd, for (uint i= 0; (def= li++) ;) { dfs[0][i++]= *def; - args->push_back(def->num); + args->push_back(def->key); args->push_back(def->value); } return args; @@ -5720,6 +5720,10 @@ Item *create_func_dyncol_create(THD *thd, List &list) return new (thd->mem_root) Item_func_dyncol_create(*args, dfs); } +Item *create_func_dyncol_json(THD *thd, Item *str) +{ + return new (thd->mem_root) Item_func_dyncol_json(str); +} Item *create_func_dyncol_add(THD *thd, Item *str, List &list) @@ -5740,7 +5744,7 @@ Item *create_func_dyncol_add(THD *thd, Item *str, Item *create_func_dyncol_delete(THD *thd, Item *str, List &nums) { DYNCALL_CREATE_DEF *dfs; - Item *num; + Item *key; List_iterator_fast it(nums); List *args= new (thd->mem_root) List; @@ -5750,12 +5754,12 @@ Item *create_func_dyncol_delete(THD *thd, Item *str, List &nums) if (!args || !dfs) return NULL; - for (uint i= 0; (num= it++); i++) + for (uint i= 0; (key= it++); i++) { - dfs[i].num= num; + dfs[i].key= key; dfs[i].value= new Item_null(); dfs[i].type= DYN_COL_INT; - args->push_back(dfs[i].num); + args->push_back(dfs[i].key); args->push_back(dfs[i].value); } diff --git a/sql/item_create.h b/sql/item_create.h index ac6b0f8454f..5ecb45e9eae 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -180,5 +180,6 @@ Item *create_func_dyncol_get(THD *thd, Item *num, Item *str, Cast_target cast_type, const char *c_len, const char *c_dec, CHARSET_INFO *cs); +Item *create_func_dyncol_json(THD *thd, Item *str); #endif diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c5d1edbe475..ca6a6b2cea3 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -3760,7 +3760,8 @@ String *Item_func_uuid::val_str(String *str) Item_func_dyncol_create::Item_func_dyncol_create(List &args, DYNCALL_CREATE_DEF *dfs) - : Item_str_func(args), defs(dfs), vals(0), nums(0) + : Item_str_func(args), defs(dfs), vals(0), keys(NULL), names(FALSE), + force_names(FALSE) { DBUG_ASSERT((args.elements & 0x1) == 0); // even number of arguments } @@ -3768,13 +3769,26 @@ Item_func_dyncol_create::Item_func_dyncol_create(List &args, bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref) { + uint i; bool res= Item_func::fix_fields(thd, ref); // no need Item_str_func here - vals= (DYNAMIC_COLUMN_VALUE *) alloc_root(thd->mem_root, - sizeof(DYNAMIC_COLUMN_VALUE) * - (arg_count / 2)); - nums= (uint *) alloc_root(thd->mem_root, - sizeof(uint) * (arg_count / 2)); - return res || vals == 0 || nums == 0; + if (!res) + { + vals= (DYNAMIC_COLUMN_VALUE *) alloc_root(thd->mem_root, + sizeof(DYNAMIC_COLUMN_VALUE) * + (arg_count / 2)); + for (i= 0; i + 1 < arg_count && args[i]->result_type() == INT_RESULT; i+= 2); + if (i + 1 < arg_count) + { + names= TRUE; + } + + keys= (uchar *) alloc_root(thd->mem_root, + (sizeof(LEX_STRING) > sizeof(uint) ? + sizeof(LEX_STRING) : + sizeof(uint)) * + (arg_count / 2)); + } + return res || vals == 0 || keys == 0; } @@ -3785,13 +3799,14 @@ void Item_func_dyncol_create::fix_length_and_dec() decimals= 0; } -void Item_func_dyncol_create::prepare_arguments() +bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) { char buff[STRING_BUFFER_USUAL_SIZE]; String *res, tmp(buff, sizeof(buff), &my_charset_bin); uint column_count= (arg_count / 2); uint i; my_decimal dtmp, *dres; + force_names= force_names_arg; /* get values */ for (i= 0; i < column_count; i++) @@ -3850,7 +3865,54 @@ void Item_func_dyncol_create::prepare_arguments() break; } } - nums[i]= (uint) args[i * 2]->val_int(); + if (names || force_names) + { + res= args[i * 2]->val_str(&tmp); + if (res) + { + // guaranty UTF-8 string for names + if (my_charset_same(res->charset(), &my_charset_utf8_general_ci)) + { + ((LEX_STRING *)keys)[i].length= res->length(); + if (!(((LEX_STRING *)keys)[i].str= + (char *)sql_memdup(res->ptr(), res->length()))) + ((LEX_STRING *)keys)[i].length= 0; + } + else + { + uint strlen; + uint dummy_errors; + char *str= + (char *)sql_alloc((strlen= res->length() * + my_charset_utf8_general_ci.mbmaxlen + 1)); + if (str) + { + ((LEX_STRING *)keys)[i].length= + copy_and_convert(str, strlen, &my_charset_utf8_general_ci, + res->ptr(), res->length(), res->charset(), + &dummy_errors); + ((LEX_STRING *)keys)[i].str= str; + } + else + ((LEX_STRING *)keys)[i].length= 0; + + } + } + else + { + ((LEX_STRING *)keys)[i].length= 0; + ((LEX_STRING *)keys)[i].str= NULL; + } + } + else + ((uint *)keys)[i]= (uint) args[i * 2]->val_int(); + if (args[i * 2]->null_value) + { + /* to make cleanup possible */ + for (; i < column_count; i++) + vals[i].type= DYN_COL_NULL; + return 1; + } vals[i].type= type; switch (type) { case DYN_COL_NULL: @@ -3918,6 +3980,7 @@ void Item_func_dyncol_create::prepare_arguments() vals[i].type= DYN_COL_NULL; } } + return FALSE; } void Item_func_dyncol_create::cleanup_arguments() @@ -3930,6 +3993,7 @@ void Item_func_dyncol_create::cleanup_arguments() if (vals[i].type == DYN_COL_STRING) my_free(vals[i].x.string.value.str); } + force_names= FALSE; } String *Item_func_dyncol_create::val_str(String *str) @@ -3940,25 +4004,32 @@ String *Item_func_dyncol_create::val_str(String *str) enum enum_dyncol_func_result rc; DBUG_ASSERT((arg_count & 0x1) == 0); // even number of arguments - prepare_arguments(); - - if ((rc= dynamic_column_create_many(&col, column_count, nums, vals))) + if (prepare_arguments(FALSE)) { - dynamic_column_error_message(rc); - dynamic_column_column_free(&col); res= NULL; - null_value= TRUE; + null_value= 1; } else { - /* Move result from DYNAMIC_COLUMN to str_value */ - char *ptr; - size_t length, alloc_length; - dynamic_column_reassociate(&col, &ptr, &length, &alloc_length); - str_value.reassociate(ptr, (uint32) length, (uint32) alloc_length, - &my_charset_bin); - res= &str_value; - null_value= FALSE; + if ((rc= dynamic_column_create_many_fmt(&col, column_count, keys, + vals, names || force_names))) + { + dynamic_column_error_message(rc); + dynamic_column_column_free(&col); + res= NULL; + null_value= TRUE; + } + else + { + /* Move result from DYNAMIC_COLUMN to str_value */ + char *ptr; + size_t length, alloc_length; + dynamic_column_reassociate(&col, &ptr, &length, &alloc_length); + str_value.reassociate(ptr, (uint32) length, (uint32) alloc_length, + &my_charset_bin); + res= &str_value; + null_value= FALSE; + } } /* cleanup */ @@ -4026,6 +4097,40 @@ void Item_func_dyncol_create::print(String *str, str->append(')'); } +String *Item_func_dyncol_json::val_str(String *str) +{ + DYNAMIC_STRING json, col; + String *res; + enum enum_dyncol_func_result rc; + + res= args[0]->val_str(str); + if (args[0]->null_value) + goto null; + + col.str= (char *)res->ptr(); + col.length= res->length(); + if ((rc= dynamic_column_json(&col, &json))) + { + dynamic_column_error_message(rc); + goto null; + } + bzero(&col, sizeof(col)); + { + /* Move result from DYNAMIC_COLUMN to str */ + char *ptr; + size_t length, alloc_length; + dynstr_reassociate(&json, &ptr, &length, &alloc_length); + str->reassociate(ptr, (uint32) length, (uint32) alloc_length, + &my_charset_utf8_general_ci); + null_value= FALSE; + } + return str; + +null: + bzero(&col, sizeof(col)); + null_value= TRUE; + return NULL; +} String *Item_func_dyncol_add::val_str(String *str) { @@ -4037,17 +4142,19 @@ String *Item_func_dyncol_add::val_str(String *str) /* We store the packed data last */ res= args[arg_count - 1]->val_str(str); - if (args[arg_count - 1]->null_value) + if (args[arg_count - 1]->null_value || + init_dynamic_string(&col, NULL, res->length() + STRING_BUFFER_USUAL_SIZE, + STRING_BUFFER_USUAL_SIZE)) goto null; - init_dynamic_string(&col, NULL, res->length() + STRING_BUFFER_USUAL_SIZE, - STRING_BUFFER_USUAL_SIZE); col.length= res->length(); memcpy(col.str, res->ptr(), col.length); - prepare_arguments(); + if (prepare_arguments(dynamic_column_has_names(&col))) + goto null; - if ((rc= dynamic_column_update_many(&col, column_count, nums, vals))) + if ((rc= dynamic_column_update_many_fmt(&col, column_count, keys, + vals, names || force_names))) { dynamic_column_error_message(rc); dynamic_column_column_free(&col); @@ -4066,7 +4173,6 @@ String *Item_func_dyncol_add::val_str(String *str) } /* cleanup */ - dynamic_column_column_free(&col); cleanup_arguments(); return str; @@ -4100,10 +4206,48 @@ bool Item_dyncol_get::get_dyn_value(DYNAMIC_COLUMN_VALUE *val, String *tmp) { DYNAMIC_COLUMN dyn_str; String *res; - longlong num; + longlong num= 0; + LEX_STRING buf, *name= NULL; + char nmstrbuf[11]; + String nmbuf(nmstrbuf, sizeof(nmstrbuf), system_charset_info); enum enum_dyncol_func_result rc; - num= args[1]->val_int(); + if (args[1]->result_type() == INT_RESULT) + num= args[1]->val_int(); + else + { + String *nm= args[1]->val_str(&nmbuf); + if (!nm || args[1]->null_value) + { + null_value= 1; + return 1; + } + + if (my_charset_same(nm->charset(), &my_charset_utf8_general_ci)) + { + buf.str= (char *) nm->ptr(); + buf.length= nm->length(); + } + else + { + uint strlen; + uint dummy_errors; + buf.str= (char *)sql_alloc((strlen= nm->length() * + my_charset_utf8_general_ci.mbmaxlen + 1)); + if (buf.str) + { + buf.length= + copy_and_convert(buf.str, strlen, &my_charset_utf8_general_ci, + nm->ptr(), nm->length(), nm->charset(), + &dummy_errors); + } + else + buf.length= 0; + } + name= &buf; + } + + if (args[1]->null_value || num < 0 || num > INT_MAX) { null_value= 1; @@ -4119,7 +4263,9 @@ bool Item_dyncol_get::get_dyn_value(DYNAMIC_COLUMN_VALUE *val, String *tmp) dyn_str.str= (char*) res->ptr(); dyn_str.length= res->length(); - if ((rc= dynamic_column_get(&dyn_str, (uint) num, val))) + if ((rc= ((name == NULL) ? + dynamic_column_get(&dyn_str, (uint) num, val) : + dynamic_column_get_str(&dyn_str, name, val)))) { dynamic_column_error_message(rc); null_value= 1; @@ -4468,6 +4614,8 @@ null: return 1; } +void +append_identifier(THD *thd, String *packet, const char *name, uint length); void Item_dyncol_get::print(String *str, enum_query_type query_type) { @@ -4492,26 +4640,30 @@ String *Item_func_dyncol_list::val_str(String *str) col.length= res->length(); /* We do not change the string, so could do this trick */ col.str= (char *)res->ptr(); - if ((rc= dynamic_column_list(&col, &arr))) + if ((rc= dynamic_column_list_str(&col, &arr))) { dynamic_column_error_message(rc); + for (i= 0; i < arr.elements; i++) + my_free(dynamic_element(&arr, i, LEX_STRING*)->str); delete_dynamic(&arr); goto null; } /* - We support elements from 0 - 65536, so max size for one element is - 6 (including ,). + We estimate average name length as 10 */ - if (str->alloc(arr.elements * 6)) + if (str->alloc(arr.elements * 13)) goto null; str->length(0); + str->set_charset(&my_charset_utf8_general_ci); for (i= 0; i < arr.elements; i++) { - str->qs_append(*dynamic_element(&arr, i, uint*)); + LEX_STRING *name= dynamic_element(&arr, i, LEX_STRING *); + append_identifier(current_thd, str, name->str, name->length); if (i < arr.elements - 1) str->qs_append(','); + my_free(name->str); } null_value= FALSE; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 9ed2627a518..e6a7e1291b8 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1001,8 +1001,9 @@ class Item_func_dyncol_create: public Item_str_func protected: DYNCALL_CREATE_DEF *defs; DYNAMIC_COLUMN_VALUE *vals; - uint *nums; - void prepare_arguments(); + uchar *keys; + bool names, force_names; + bool prepare_arguments(bool force_names); void cleanup_arguments(); void print_arguments(String *str, enum_query_type query_type); public: @@ -1026,6 +1027,19 @@ public: virtual void print(String *str, enum_query_type query_type); }; +class Item_func_dyncol_json: public Item_str_func +{ +public: + Item_func_dyncol_json(Item *str) :Item_str_func(str) {} + const char *func_name() const{ return "column_json"; } + String *val_str(String *); + void fix_length_and_dec() + { + maybe_null= TRUE; + collation.set(&my_charset_bin); + decimals= 0; + } +}; /* The following functions is always called from an Item_cast function diff --git a/sql/lex.h b/sql/lex.h index 9f4369630a0..ea68ea0972a 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -123,10 +123,12 @@ static SYMBOL symbols[] = { { "COLUMN_NAME", SYM(COLUMN_NAME_SYM)}, { "COLUMNS", SYM(COLUMNS)}, { "COLUMN_ADD", SYM(COLUMN_ADD_SYM)}, + { "COLUMN_CHECK", SYM(COLUMN_CHECK_SYM)}, { "COLUMN_CREATE", SYM(COLUMN_CREATE_SYM)}, { "COLUMN_DELETE", SYM(COLUMN_DELETE_SYM)}, { "COLUMN_EXISTS", SYM(COLUMN_EXISTS_SYM)}, { "COLUMN_GET", SYM(COLUMN_GET_SYM)}, + { "COLUMN_JSON", SYM(COLUMN_JSON_SYM)}, { "COLUMN_LIST", SYM(COLUMN_LIST_SYM)}, { "COMMENT", SYM(COMMENT_SYM)}, { "COMMIT", SYM(COMMIT_SYM)}, diff --git a/sql/sql_string.cc b/sql/sql_string.cc index c4f5f315b08..bfd0d82c40a 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -750,79 +750,6 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length) Help functions ****************************************************************************/ -/* - copy a string from one character set to another - - SYNOPSIS - copy_and_convert() - to Store result here - to_cs Character set of result string - from Copy from here - from_length Length of from string - from_cs From character set - - NOTES - 'to' must be big enough as form_length * to_cs->mbmaxlen - - RETURN - length of bytes copied to 'to' -*/ - - -static uint32 -copy_and_convert_extended(char *to, uint32 to_length, CHARSET_INFO *to_cs, - const char *from, uint32 from_length, - CHARSET_INFO *from_cs, - uint *errors) -{ - int cnvres; - my_wc_t wc; - const uchar *from_end= (const uchar*) from+from_length; - char *to_start= to; - uchar *to_end= (uchar*) to+to_length; - my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc; - my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb; - uint error_count= 0; - - while (1) - { - if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from, - from_end)) > 0) - from+= cnvres; - else if (cnvres == MY_CS_ILSEQ) - { - error_count++; - from++; - wc= '?'; - } - else if (cnvres > MY_CS_TOOSMALL) - { - /* - A correct multibyte sequence detected - But it doesn't have Unicode mapping. - */ - error_count++; - from+= (-cnvres); - wc= '?'; - } - else - break; // Not enough characters - -outp: - if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0) - to+= cnvres; - else if (cnvres == MY_CS_ILUNI && wc != '?') - { - error_count++; - wc= '?'; - goto outp; - } - else - break; - } - *errors= error_count; - return (uint32) (to - to_start); -} /* diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 4e3629080be..48dd47bccea 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -882,10 +882,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token COLLATION_SYM /* SQL-2003-N */ %token COLUMNS %token COLUMN_ADD_SYM +%token COLUMN_CHECK_SYM %token COLUMN_CREATE_SYM %token COLUMN_DELETE_SYM %token COLUMN_EXISTS_SYM %token COLUMN_GET_SYM +%token COLUMN_JSON_SYM %token COLUMN_LIST_SYM %token COLUMN_SYM /* SQL-2003-R */ %token COLUMN_NAME_SYM /* SQL-2003-N */ @@ -8245,7 +8247,7 @@ dyncall_create_element: alloc_root(YYTHD->mem_root, sizeof(DYNCALL_CREATE_DEF)); if ($$ == NULL) MYSQL_YYABORT; - $$->num= $1; + $$->key= $1; $$->value= $3; $$->type= (DYNAMIC_COLUMN_TYPE)$4; $$->cs= lex->charset; @@ -8798,6 +8800,13 @@ function_call_nonkeyword: if ($$ == NULL) MYSQL_YYABORT; } + | + COLUMN_CHECK_SYM '(' expr ')' + { + $$= new (YYTHD->mem_root) Item_func_dyncol_check($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | COLUMN_EXISTS_SYM '(' expr ',' expr ')' { @@ -8819,6 +8828,13 @@ function_call_nonkeyword: if ($$ == NULL) MYSQL_YYABORT; } + | + COLUMN_JSON_SYM '(' expr ')' + { + $$= create_func_dyncol_json(YYTHD, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } | COLUMN_GET_SYM '(' expr ',' expr AS cast_type ')' { @@ -12908,10 +12924,12 @@ keyword: | CHECKPOINT_SYM {} | CLOSE_SYM {} | COLUMN_ADD_SYM {} + | COLUMN_CHECK_SYM {} | COLUMN_CREATE_SYM {} | COLUMN_DELETE_SYM {} | COLUMN_EXISTS_SYM {} | COLUMN_GET_SYM {} + | COLUMN_JSON_SYM {} | COLUMN_LIST_SYM {} | COMMENT_SYM {} | COMMIT_SYM {} From 245298f25debbeb9556abbea195fc24c4a2845de Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Sep 2012 15:27:16 +0300 Subject: [PATCH 259/439] MDEV-506 Cassandra dynamic columns access --- include/ma_dyncol.h | 32 +- mysql-test/r/cassandra.result | 143 ++- mysql-test/r/mysqld--help.result | 26 + mysql-test/t/cassandra.test | 126 +- mysys/ma_dyncol.c | 289 ++++- sql/sql_base.cc | 1 + sql/sql_base.h | 1 + storage/cassandra/CMakeLists.txt | 2 +- storage/cassandra/cassandra_se.cc | 79 +- storage/cassandra/cassandra_se.h | 19 +- .../cassandra/gen-cpp/cassandra_constants.cpp | 2 +- storage/cassandra/ha_cassandra.cc | 1043 +++++++++++++++-- storage/cassandra/ha_cassandra.h | 53 +- 13 files changed, 1673 insertions(+), 143 deletions(-) diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index b4b9df7da19..2264ec6f53f 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -39,6 +39,12 @@ */ #define MAX_DYNAMIC_COLUMN_LENGTH 0X1FFFFFFFL +/* + Limits of implementation +*/ +#define MAX_NAME_LENGTH 255 +#define MAX_TOTAL_NAME_LENGTH 65535 + /* NO and OK is the same used just to show semantics */ #define ER_DYNCOL_NO ER_DYNCOL_OK @@ -50,7 +56,8 @@ enum enum_dyncol_func_result ER_DYNCOL_LIMIT= -2, /* Some limit reached */ ER_DYNCOL_RESOURCE= -3, /* Out of resourses */ ER_DYNCOL_DATA= -4, /* Incorrect input data */ - ER_DYNCOL_UNKNOWN_CHARSET= -5 /* Unknown character set */ + ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */ + ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */ }; typedef DYNAMIC_STRING DYNAMIC_COLUMN; @@ -81,6 +88,7 @@ struct st_dynamic_column_value struct { LEX_STRING value; CHARSET_INFO *charset; + my_bool nonfreeable; } string; struct { decimal_digit_t buffer[DECIMAL_BUFF_LENGTH]; @@ -108,6 +116,13 @@ dynamic_column_create_many_fmt(DYNAMIC_COLUMN *str, uchar *column_keys, DYNAMIC_COLUMN_VALUE *values, my_bool names); +enum enum_dyncol_func_result +dynamic_column_create_many_internal_fmt(DYNAMIC_COLUMN *str, + uint column_count, + void *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool new_str, + my_bool string_keys); enum enum_dyncol_func_result dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr, @@ -163,6 +178,21 @@ dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json); #define dynamic_column_initialize(A) memset((A), 0, sizeof(*(A))) #define dynamic_column_column_free(V) dynstr_free(V) +/* conversion of values to 3 base types */ +enum enum_dyncol_func_result +dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, + CHARSET_INFO *cs, my_bool quote); +enum enum_dyncol_func_result +dynamic_column_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val); +enum enum_dyncol_func_result +dynamic_column_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val); + + +enum enum_dyncol_func_result +dynamic_column_vals(DYNAMIC_COLUMN *str, + DYNAMIC_ARRAY *names, DYNAMIC_ARRAY *vals, + char **free_names); + /*************************************************************************** Internal functions, don't use if you don't know what you are doing... ***************************************************************************/ diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 07720bb5b23..3cf286013b8 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -365,8 +365,9 @@ CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; select * from t2; rowkey datecol -1 1346189025000 -10 1346189026000 +1 1346192625000 +10 1346192626000 +delete from t2; drop table t2; # # Check whether changing parameters with ALTER TABLE works. @@ -407,3 +408,141 @@ new-rowkey12 data1-value3 454 rowkey11 updated-1 34543 delete from t1; drop table t1; +# +# Dynamic columns support +# +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +drop table t2; +#error: dynamic column is not a blob +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36) DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +ERROR 42000: Incorrect column specifier for column 'uuidcol' +#error: double dynamic column +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1, textcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +ERROR 42000: Incorrect column specifier for column 'textcol' +# +# Dynamic column read +# +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; +insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09'); +insert into t2 values(2,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); +drop table t2; +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +select rowkey, column_list(dyn), column_get(dyn, 'uuidcol' as char) from t2; +rowkey column_list(dyn) column_get(dyn, 'uuidcol' as char) +1 `uuidcol` 9b5658dc-f32f-11e1-94cd-f46d046e9f09 +2 `uuidcol` 9b5658dc-f32f-11e1-94cd-f46d046e9f0a +drop table t2; +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA +thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; +drop table t2; +# +# Dynamic column insert +# +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +insert into t2 values (1, column_create("dyn1", 1, "dyn2", "two")); +select rowkey, column_json(dyn) from t2; +rowkey column_json(dyn) +1 [{"dyn1":"1"},{"dyn2":"two"}] +delete from t2; +drop table t2; +# bigint +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'a', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'a', 2543)); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"a":254324},{"dyn1":"1"},{"dyn2":"two"}] +2 [{"a":2543},{"dyn1":"1"},{"dyn2":"two"}] +delete from t1; +drop table t1; +# int +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'intcol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'intcol', 2543)); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"dyn1":"1"},{"dyn2":"two"},{"intcol":254324}] +2 [{"dyn1":"1"},{"dyn2":"two"},{"intcol":2543}] +delete from t1; +drop table t1; +# timestamp +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'datecol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'datecol', 2543)); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"dyn1":"1"},{"dyn2":"two"},{"datecol":254324}] +2 [{"dyn1":"1"},{"dyn2":"two"},{"datecol":2543}] +delete from t1; +drop table t1; +# boolean +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 0)); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":1}] +2 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":0}] +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":1}] +2 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":0}] +update t1 set dyn=column_add(dyn, "dyn2", null, "dyn3", "3"); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"dyn1":"1"},{"dyn3":"3"},{"boolcol":1}] +2 [{"dyn1":"1"},{"dyn3":"3"},{"boolcol":0}] +update t1 set dyn=column_add(dyn, "dyn1", null) where rowkey= 1; +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"dyn3":"3"},{"boolcol":1}] +2 [{"dyn1":"1"},{"dyn3":"3"},{"boolcol":0}] +update t1 set dyn=column_add(dyn, "dyn3", null, "a", "ddd"); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"a":"ddd"},{"boolcol":1}] +2 [{"a":"ddd"},{"dyn1":"1"},{"boolcol":0}] +update t1 set dyn=column_add(dyn, "12345678901234", "ddd"); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"a":"ddd"},{"boolcol":1},{"12345678901234":"ddd"}] +2 [{"a":"ddd"},{"dyn1":"1"},{"boolcol":0},{"12345678901234":"ddd"}] +update t1 set dyn=column_add(dyn, "12345678901234", null); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"a":"ddd"},{"boolcol":1}] +2 [{"a":"ddd"},{"dyn1":"1"},{"boolcol":0}] +update t1 set dyn=column_add(dyn, 'boolcol', null) where rowkey= 2; +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"a":"ddd"},{"boolcol":1}] +2 [{"a":"ddd"},{"dyn1":"1"}] +update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2; +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +1 [{"a":"ddd"},{"boolcol":1}] +3 [{"a":"ddd"},{"boolcol":0}] +delete from t1; +drop table t1; +CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1'; +select * from t1; +ERROR HY000: Internal error: 'Unable to convert value for field `dyn` from Cassandra's data format. Name length exceed limit of 255: 'very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_ver' +drop table t1; +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +DELETE FROM t1; +insert into t1 values (1, column_create("dyn", 1)); +select rowkey, column_list(dyn) from t1; +rowkey column_list(dyn) +1 `dyn` +delete from t1; +DROP TABLE t1; +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); +ERROR HY000: Encountered illegal format of dynamic column string +delete from t1; +DROP TABLE t1; diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index ad55bfa3003..e3c08d80876 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -89,6 +89,24 @@ The following options may be given as the first argument: --bulk-insert-buffer-size=# Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread! + --cassandra[=name] Enable or disable CASSANDRA plugin. Possible values are + ON, OFF, FORCE (don't start if the plugin fails to load). + --cassandra-default-thrift-host=name + Default host for Cassandra thrift connections + --cassandra-failure-retries=# + Number of times to retry Cassandra calls that failed due + to timeouts or network communication problems. The + default, 0, means not to retry. + --cassandra-insert-batch-size=# + Number of rows in an INSERT batch + --cassandra-multiget-batch-size=# + Number of rows in a multiget(MRR) batch + --cassandra-read-consistency=name + Cassandra consistency level to use for read operations + --cassandra-rnd-batch-size=# + Number of rows in an rnd_read (full scan) batch + --cassandra-write-consistency=name + Cassandra consistency level to use for write operations --character-set-client-handshake Don't ignore client side character set value sent during handshake. @@ -863,6 +881,14 @@ binlog-optimize-thread-scheduling TRUE binlog-row-event-max-size 1024 binlog-stmt-cache-size 32768 bulk-insert-buffer-size 8388608 +cassandra ON +cassandra-default-thrift-host (No default value) +cassandra-failure-retries 0 +cassandra-insert-batch-size 100 +cassandra-multiget-batch-size 100 +cassandra-read-consistency ONE +cassandra-rnd-batch-size 10000 +cassandra-write-consistency ONE character-set-client-handshake TRUE character-set-filesystem binary character-set-server latin1 diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 7e5b327580c..b0b29c52f21 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -94,6 +94,18 @@ CREATE COLUMN FAMILY cf10 WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND default_validation_class = UTF8Type; + +CREATE COLUMN FAMILY cfd1 + WITH comparator = UTF8Type + AND key_validation_class=UTF8Type + AND default_validation_class = UTF8Type; +SET cfd1['1']['very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_name']='1'; + +CREATE COLUMN FAMILY cfd2 + WITH comparator = UTF8Type + AND key_validation_class=Int32Type + AND default_validation_class = UTF8Type; + EOF --error 0,1,2 @@ -463,7 +475,7 @@ drop table t2; CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; select * from t2; - +delete from t2; drop table t2; --echo # @@ -511,6 +523,118 @@ select * from t1; delete from t1; drop table t1; +--echo # +--echo # Dynamic columns support +--echo # +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +drop table t2; + +--echo #error: dynamic column is not a blob +--error ER_WRONG_FIELD_SPEC +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36) DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; + +--echo #error: double dynamic column +--error ER_WRONG_FIELD_SPEC +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1, textcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; + +--echo # +--echo # Dynamic column read +--echo # +#prepare data +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; +insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09'); +insert into t2 values(2,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); +drop table t2; + +#test dynamic column read +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +select rowkey, column_list(dyn), column_get(dyn, 'uuidcol' as char) from t2; +drop table t2; + +#cleanup data +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA + thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +delete from t2; +drop table t2; + +--echo # +--echo # Dynamic column insert +--echo # +CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5'; +insert into t2 values (1, column_create("dyn1", 1, "dyn2", "two")); +select rowkey, column_json(dyn) from t2; +delete from t2; +drop table t2; +--echo # bigint +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'a', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'a', 2543)); +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; +--echo # int +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'intcol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'intcol', 2543)); +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; +--echo # timestamp +CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'datecol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'datecol', 2543)); +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; +--echo # boolean +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7'; +insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 254324)); +insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 0)); +select rowkey, column_json(dyn) from t1; +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "dyn2", null, "dyn3", "3"); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "dyn1", null) where rowkey= 1; +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "dyn3", null, "a", "ddd"); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "12345678901234", "ddd"); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, "12345678901234", null); +select rowkey, column_json(dyn) from t1; +update t1 set dyn=column_add(dyn, 'boolcol', null) where rowkey= 2; +select rowkey, column_json(dyn) from t1; +update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2; +select rowkey, column_json(dyn) from t1; +delete from t1; +drop table t1; + +CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1'; +--error ER_INTERNAL_ERROR +select * from t1; +drop table t1; + +# MDEV-560 +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +DELETE FROM t1; +insert into t1 values (1, column_create("dyn", 1)); +select rowkey, column_list(dyn) from t1; +# Cleanup +delete from t1; +DROP TABLE t1; + +# MDEV-561 (incorrect format data to dynamic column) +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +--error ER_DYN_COL_WRONG_FORMAT +insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); +delete from t1; +DROP TABLE t1; + + ############################################################################ ## Cassandra cleanup ############################################################################ diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 70ae4935528..e7c9b835454 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -68,6 +68,8 @@ uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, #define MAX_OFFSET_LENGTH 5 +#define DYNCOL_NUM_CHAR 6 + my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str) { if (str->length < 1) @@ -211,7 +213,7 @@ static my_bool check_limit_num(const void *val) static my_bool check_limit_str(const void *val) { - return (*((LEX_STRING **)val))->length > 255; + return (*((LEX_STRING **)val))->length > MAX_NAME_LENGTH; } @@ -288,7 +290,7 @@ my_bool put_header_entry_str(DYN_HEADER *hdr, size_t offset) { LEX_STRING *column_name= (LEX_STRING *)column_key; - DBUG_ASSERT(column_name->length <= 255); + DBUG_ASSERT(column_name->length <= MAX_NAME_LENGTH); hdr->entry[0]= column_name->length; DBUG_ASSERT(hdr->name - hdr->nmpool < (long) 0x10000L); int2store(hdr->entry + 1, hdr->name - hdr->nmpool); @@ -1381,6 +1383,9 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, DYNCOL_SYZERESERVE)) goto err; } + if (!column_count) + return ER_DYNCOL_OK; + bzero(str->str, fmt->fixed_hdr); str->length= fmt->fixed_hdr; @@ -1501,7 +1506,7 @@ calc_var_sizes(DYN_HEADER *hdr, @return ER_DYNCOL_* return code */ -static enum enum_dyncol_func_result +enum enum_dyncol_func_result dynamic_column_create_many_internal_fmt(DYNAMIC_COLUMN *str, uint column_count, void *column_keys, @@ -1761,7 +1766,7 @@ static my_bool find_column(DYN_HEADER *hdr, uint numkey, LEX_STRING *strkey) { LEX_STRING nmkey; - char nmkeybuff[6]; /* to fit max 2 bytes number */ + char nmkeybuff[DYNCOL_NUM_CHAR]; /* to fit max 2 bytes number */ DBUG_ASSERT(hdr->header != NULL); if (hdr->header + hdr->header_size > hdr->data_end) @@ -2169,10 +2174,10 @@ dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr) if (header.format == DYNCOL_FMT_NUM) { uint nm= uint2korr(read); - tmp.str= my_malloc(6, MYF(0)); + tmp.str= my_malloc(DYNCOL_NUM_CHAR, MYF(0)); if (!tmp.str) return ER_DYNCOL_RESOURCE; - tmp.length= snprintf(tmp.str, 6, "%u", nm); + tmp.length= snprintf(tmp.str, DYNCOL_NUM_CHAR, "%u", nm); } else { @@ -2208,7 +2213,7 @@ find_place(DYN_HEADER *hdr, void *key, my_bool string_keys) uint mid, start, end, val; int flag; LEX_STRING str; - char buff[6]; + char buff[DYNCOL_NUM_CHAR]; my_bool need_conversion= ((string_keys ? DYNCOL_FMT_STR : DYNCOL_FMT_NUM) != hdr->format); LINT_INIT(flag); /* 100 % safe */ @@ -2425,7 +2430,7 @@ dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, size_t offs; uint nm; DYNAMIC_COLUMN_TYPE tp; - char buff[6]; + char buff[DYNCOL_NUM_CHAR]; if (hdr->format == DYNCOL_FMT_NUM) { @@ -3438,7 +3443,7 @@ end: enum enum_dyncol_func_result dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, - my_bool quote) + CHARSET_INFO *cs, my_bool quote) { char buff[40]; int len; @@ -3468,24 +3473,22 @@ dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, char *alloc= NULL; char *from= val->x.string.value.str; uint bufflen; - my_bool conv= !my_charset_same(val->x.string.charset, - &my_charset_utf8_general_ci); + my_bool conv= !my_charset_same(val->x.string.charset, cs); my_bool rc; len= val->x.string.value.length; - bufflen= (len * (conv ? my_charset_utf8_general_ci.mbmaxlen : 1)); + bufflen= (len * (conv ? cs->mbmaxlen : 1)); if (dynstr_realloc(str, bufflen)) return ER_DYNCOL_RESOURCE; // guaranty UTF-8 string for value - if (!my_charset_same(val->x.string.charset, - &my_charset_utf8_general_ci)) + if (!my_charset_same(val->x.string.charset, cs)) { uint dummy_errors; if (!quote) { /* convert to the destination */ str->length+= copy_and_convert_extended(str->str, bufflen, - &my_charset_utf8_general_ci, + cs, from, len, val->x.string.charset, &dummy_errors); @@ -3494,8 +3497,7 @@ dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, if ((alloc= (char *)my_malloc(bufflen, MYF(0)))) { len= - copy_and_convert_extended(alloc, bufflen, - &my_charset_utf8_general_ci, + copy_and_convert_extended(alloc, bufflen, cs, from, len, val->x.string.charset, &dummy_errors); from= alloc; @@ -3543,6 +3545,155 @@ dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, return(ER_DYNCOL_OK); } + +enum enum_dyncol_func_result +dynamic_column_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) +{ + enum enum_dyncol_func_result rc= ER_DYNCOL_OK; + *ll= 0; + switch (val->type) { + case DYN_COL_INT: + *ll= val->x.long_value; + break; + case DYN_COL_UINT: + *ll= (longlong)val->x.ulong_value; + if (val->x.ulong_value > ULONGLONG_MAX) + rc= ER_DYNCOL_TRUNCATED; + break; + case DYN_COL_DOUBLE: + *ll= (longlong)val->x.double_value; + if (((double) *ll) != val->x.double_value) + rc= ER_DYNCOL_TRUNCATED; + break; + case DYN_COL_STRING: + { + longlong i= 0, sign= 1; + char *src= val->x.string.value.str; + uint len= val->x.string.value.length; + + while (len && my_isspace(&my_charset_latin1, *src)) src++,len--; + + if (len) + { + if (*src == '-') + { + sign= -1; + src++; + } else if (*src == '-') + src++; + while(len && my_isdigit(&my_charset_latin1, *src)) + { + i= i * 10 + (*src - '0'); + src++; + } + } + else + rc= ER_DYNCOL_TRUNCATED; + if (len) + rc= ER_DYNCOL_TRUNCATED; + *ll= i * sign; + break; + } + case DYN_COL_DECIMAL: + if (decimal2longlong(&val->x.decimal.value, ll) != E_DEC_OK) + rc= ER_DYNCOL_TRUNCATED; + break; + case DYN_COL_DATETIME: + *ll= (val->x.time_value.year * 10000000000L + + val->x.time_value.month * 100000000L + + val->x.time_value.day * 1000000 + + val->x.time_value.hour * 10000 + + val->x.time_value.minute * 100 + + val->x.time_value.second) * + (val->x.time_value.neg ? -1 : 1); + break; + case DYN_COL_DATE: + *ll= (val->x.time_value.year * 10000 + + val->x.time_value.month * 100 + + val->x.time_value.day) * + (val->x.time_value.neg ? -1 : 1); + break; + case DYN_COL_TIME: + *ll= (val->x.time_value.hour * 10000 + + val->x.time_value.minute * 100 + + val->x.time_value.second) * + (val->x.time_value.neg ? -1 : 1); + break; + case DYN_COL_NULL: + rc= ER_DYNCOL_TRUNCATED; + break; + default: + return(ER_DYNCOL_FORMAT); + } + return(rc); +} + + +enum enum_dyncol_func_result +dynamic_column_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) +{ + enum enum_dyncol_func_result rc= ER_DYNCOL_OK; + *dbl= 0; + switch (val->type) { + case DYN_COL_INT: + *dbl= (double)val->x.long_value; + if (((longlong) *dbl) != val->x.long_value) + rc= ER_DYNCOL_TRUNCATED; + break; + case DYN_COL_UINT: + *dbl= (double)val->x.ulong_value; + if (((ulonglong) *dbl) != val->x.ulong_value) + rc= ER_DYNCOL_TRUNCATED; + break; + case DYN_COL_DOUBLE: + *dbl= val->x.double_value; + break; + case DYN_COL_STRING: + { + char *str, *end; + if ((str= malloc(val->x.string.value.length + 1))) + return ER_DYNCOL_RESOURCE; + memcpy(str, val->x.string.value.str, val->x.string.value.length); + str[val->x.string.value.length]= '\0'; + *dbl= strtod(str, &end); + if (*end != '\0') + rc= ER_DYNCOL_TRUNCATED; + } + case DYN_COL_DECIMAL: + if (decimal2double(&val->x.decimal.value, dbl) != E_DEC_OK) + rc= ER_DYNCOL_TRUNCATED; + break; + case DYN_COL_DATETIME: + *dbl= (double)(val->x.time_value.year * 10000000000L + + val->x.time_value.month * 100000000L + + val->x.time_value.day * 1000000 + + val->x.time_value.hour * 10000 + + val->x.time_value.minute * 100 + + val->x.time_value.second) * + (val->x.time_value.neg ? -1 : 1); + break; + case DYN_COL_DATE: + *dbl= (double)(val->x.time_value.year * 10000 + + val->x.time_value.month * 100 + + val->x.time_value.day) * + (val->x.time_value.neg ? -1 : 1); + break; + case DYN_COL_TIME: + *dbl= (double)(val->x.time_value.hour * 10000 + + val->x.time_value.minute * 100 + + val->x.time_value.second) * + (val->x.time_value.neg ? -1 : 1); + break; + case DYN_COL_NULL: + rc= ER_DYNCOL_TRUNCATED; + break; + default: + return(ER_DYNCOL_FORMAT); + } + return(rc); +} + + /** Convert to JSON @@ -3602,10 +3753,11 @@ dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json) if (header.format == DYNCOL_FMT_NUM) { uint nm= uint2korr(header.entry); - if (dynstr_realloc(json, 6 + 3)) + if (dynstr_realloc(json, DYNCOL_NUM_CHAR + 3)) goto err; json->str[json->length++]= '"'; - json->length+= (snprintf(json->str + json->length, 6, "%u", nm)); + json->length+= (snprintf(json->str + json->length, + DYNCOL_NUM_CHAR, "%u", nm)); } else { @@ -3619,7 +3771,8 @@ dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json) } json->str[json->length++]= '"'; json->str[json->length++]= ':'; - if ((rc= dynamic_column_val_str(json, &val, TRUE)) < 0 || + if ((rc= dynamic_column_val_str(json, &val, + &my_charset_utf8_general_ci, TRUE)) < 0 || dynstr_append_mem(json, "}", 1)) goto err; } @@ -3631,3 +3784,99 @@ err: json->length= 0; return rc; } + + +/** + Convert to DYNAMIC_COLUMN_VALUE values and names (LEX_STING) dynamic array + + @param str The packed string + @param names Where to put names + @param vals Where to put values + @param free_names pointer to free names buffer if there is it. + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +dynamic_column_vals(DYNAMIC_COLUMN *str, + DYNAMIC_ARRAY *names, DYNAMIC_ARRAY *vals, + char **free_names) +{ + DYN_HEADER header; + char *nm; + uint i; + enum enum_dyncol_func_result rc; + + *free_names= 0; + bzero(names, sizeof(DYNAMIC_ARRAY)); /* In case of errors */ + bzero(vals, sizeof(DYNAMIC_ARRAY)); /* In case of errors */ + if (str->length == 0) + return ER_DYNCOL_OK; /* no columns */ + + if ((rc= init_read_hdr(&header, str)) < 0) + return rc; + + if (header.entry_size * header.column_count + FIXED_HEADER_SIZE > + str->length) + return ER_DYNCOL_FORMAT; + + if (init_dynamic_array(names, sizeof(LEX_STRING), + header.column_count, 0) || + init_dynamic_array(vals, sizeof(DYNAMIC_COLUMN_VALUE), + header.column_count, 0) || + (header.format == DYNCOL_FMT_NUM && + !(*free_names= (char *)malloc(DYNCOL_NUM_CHAR * header.column_count)))) + { + rc= ER_DYNCOL_RESOURCE; + goto err; + } + nm= *free_names; + + for (i= 0, header.entry= header.header; + i < header.column_count; + i++, header.entry+= header.entry_size) + { + DYNAMIC_COLUMN_VALUE val; + LEX_STRING name; + header.length= + hdr_interval_length(&header, header.entry + header.entry_size); + header.data= header.dtpool + header.offset; + /* + Check that the found data is withing the ranges. This can happen if + we get data with wrong offsets. + */ + if (header.length == DYNCOL_OFFSET_ERROR || + header.length > INT_MAX || header.offset > header.data_size) + { + rc= ER_DYNCOL_FORMAT; + goto err; + } + if ((rc= dynamic_column_get_value(&header, &val)) < 0) + goto err; + + if (header.format == DYNCOL_FMT_NUM) + { + uint num= uint2korr(header.entry); + name.str= nm; + name.length= snprintf(nm, DYNCOL_NUM_CHAR, "%u", num); + nm+= name.length + 1; + } + else + { + name.length= header.entry[0]; + name.str= (char *)header.nmpool + uint2korr(header.entry + 1); + } + /* following is preallocated and so do not fail */ + (void) insert_dynamic(names, (uchar *)&name); + (void) insert_dynamic(vals, (uchar *)&val); + } + return ER_DYNCOL_OK; + +err: + delete_dynamic(names); + delete_dynamic(vals); + if (*free_names) + my_free(*free_names); + *free_names= 0; + return rc; +} diff --git a/sql/sql_base.cc b/sql/sql_base.cc index acd330dd4d2..8f793f641ce 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -9773,6 +9773,7 @@ int dynamic_column_error_message(enum_dyncol_func_result rc) switch (rc) { case ER_DYNCOL_YES: case ER_DYNCOL_OK: + case ER_DYNCOL_TRUNCATED: break; // it is not an error case ER_DYNCOL_FORMAT: my_error(ER_DYN_COL_WRONG_FORMAT, MYF(0)); diff --git a/sql/sql_base.h b/sql/sql_base.h index 3deb97c9730..cb7abc972ea 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -272,6 +272,7 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db, const char *table_name); bool is_equal(const LEX_STRING *a, const LEX_STRING *b); +class Open_tables_backup; /* Functions to work with system tables. */ bool open_system_tables_for_read(THD *thd, TABLE_LIST *table_list, Open_tables_backup *backup); diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index 7986b0244bb..f11dfaf4a29 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -12,7 +12,7 @@ SET(cassandra_sources gen-cpp/Cassandra.h) #INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) -INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) +INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) # STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 7d48bbc30d6..99a9a08b69d 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -17,6 +17,12 @@ #include "cassandra_se.h" +struct st_mysql_lex_string +{ + char *str; + size_t length; +}; + using namespace std; using namespace apache::thrift; using namespace apache::thrift::transport; @@ -74,6 +80,7 @@ class Cassandra_se_impl: public Cassandra_se_interface std::string rowkey; /* key of the record we're returning now */ SlicePredicate slice_pred; + SliceRange slice_pred_sr; bool get_slices_returned_less; bool get_slice_found_rows; public: @@ -91,6 +98,8 @@ public: void first_ddl_column(); bool next_ddl_column(char **name, int *name_len, char **value, int *value_len); void get_rowkey_type(char **name, char **type); + size_t get_ddl_size(); + const char* get_default_validator(); /* Settings */ void set_consistency_levels(ulong read_cons_level, ulong write_cons_level); @@ -98,15 +107,19 @@ public: /* Writes */ void clear_insert_buffer(); void start_row_insert(const char *key, int key_len); - void add_insert_column(const char *name, const char *value, int value_len); + void add_insert_column(const char *name, int name_len, + const char *value, int value_len); + void add_insert_delete_column(const char *name, int name_len); void add_row_deletion(const char *key, int key_len, - Column_name_enumerator *col_names); - + Column_name_enumerator *col_names, + LEX_STRING *names, uint nnames); + bool do_insert(); /* Reads, point lookups */ bool get_slice(char *key, size_t key_len, bool *found); - bool get_next_read_column(char **name, char **value, int *value_len); + bool get_next_read_column(char **name, int *name_len, + char **value, int *value_len ); void get_read_rowkey(char **value, int *value_len); /* Reads, multi-row scans */ @@ -122,6 +135,7 @@ public: /* Setup that's necessary before a multi-row read. (todo: use it before point lookups, too) */ void clear_read_columns(); + void clear_read_all_columns(); void add_read_column(const char *name); /* Reads, MRR scans */ @@ -277,6 +291,16 @@ void Cassandra_se_impl::get_rowkey_type(char **name, char **type) *name= NULL; } +size_t Cassandra_se_impl::get_ddl_size() +{ + return cf_def.column_metadata.size(); +} + +const char* Cassandra_se_impl::get_default_validator() +{ + return cf_def.default_validation_class.c_str(); +} + ///////////////////////////////////////////////////////////////////////////// // Data writes @@ -315,8 +339,9 @@ void Cassandra_se_impl::start_row_insert(const char *key, int key_len) } -void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, - Column_name_enumerator *col_names) +void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, + Column_name_enumerator *col_names, + LEX_STRING *names, uint nnames) { std::string key_to_delete; key_to_delete.assign(key, key_len); @@ -344,6 +369,9 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, const char *col_name; while ((col_name= col_names->get_next_name())) slice_pred.column_names.push_back(std::string(col_name)); + for (uint i= 0; i < nnames; i++) + slice_pred.column_names.push_back(std::string(names[i].str, + names[i].length)); mut.deletion.predicate= slice_pred; @@ -351,7 +379,9 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, } -void Cassandra_se_impl::add_insert_column(const char *name, const char *value, +void Cassandra_se_impl::add_insert_column(const char *name, + int name_len, + const char *value, int value_len) { Mutation mut; @@ -359,7 +389,10 @@ void Cassandra_se_impl::add_insert_column(const char *name, const char *value, mut.column_or_supercolumn.__isset.column= true; Column& col=mut.column_or_supercolumn.column; - col.name.assign(name); + if (name_len) + col.name.assign(name, name_len); + else + col.name.assign(name); col.value.assign(value, value_len); col.timestamp= insert_timestamp; col.__isset.value= true; @@ -367,6 +400,23 @@ void Cassandra_se_impl::add_insert_column(const char *name, const char *value, insert_list->push_back(mut); } +void Cassandra_se_impl::add_insert_delete_column(const char *name, + int name_len) +{ + Mutation mut; + mut.__isset.deletion= true; + mut.deletion.__isset.timestamp= true; + mut.deletion.timestamp= insert_timestamp; + mut.deletion.__isset.predicate= true; + + SlicePredicate slice_pred; + slice_pred.__isset.column_names= true; + slice_pred.column_names.push_back(std::string(name, name_len)); + mut.deletion.predicate= slice_pred; + + insert_list->push_back(mut); +} + bool Cassandra_se_impl::retryable_do_insert() { @@ -444,8 +494,8 @@ bool Cassandra_se_impl::retryable_get_slice() } -bool Cassandra_se_impl::get_next_read_column(char **name, char **value, - int *value_len) +bool Cassandra_se_impl::get_next_read_column(char **name, int *name_len, + char **value, int *value_len) { bool use_counter=false; while (1) @@ -468,12 +518,14 @@ bool Cassandra_se_impl::get_next_read_column(char **name, char **value, ColumnOrSuperColumn& cs= *column_data_it; if (use_counter) { + *name_len= cs.counter_column.name.size(); *name= (char*)cs.counter_column.name.c_str(); *value= (char*)&cs.counter_column.value; *value_len= sizeof(cs.counter_column.value); } else { + *name_len= cs.column.name.size(); *name= (char*)cs.column.name.c_str(); *value= (char*)cs.column.value.c_str(); *value_len= cs.column.value.length(); @@ -601,6 +653,13 @@ void Cassandra_se_impl::clear_read_columns() slice_pred.column_names.clear(); } +void Cassandra_se_impl::clear_read_all_columns() +{ + slice_pred_sr.start = ""; + slice_pred_sr.finish = ""; + slice_pred.__set_slice_range(slice_pred_sr); +} + void Cassandra_se_impl::add_read_column(const char *name_arg) { diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index 33c602d93a6..f74d8cbd909 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -6,6 +6,8 @@ both together causes compile errors due to conflicts). */ +struct st_mysql_lex_string; +typedef struct st_mysql_lex_string LEX_STRING; /* We need to define this here so that ha_cassandra.cc also has access to it */ typedef enum @@ -50,19 +52,25 @@ public: virtual bool next_ddl_column(char **name, int *name_len, char **value, int *value_len)=0; virtual void get_rowkey_type(char **name, char **type)=0; + virtual size_t get_ddl_size()=0; + virtual const char* get_default_validator()=0; /* Writes */ virtual void clear_insert_buffer()=0; virtual void add_row_deletion(const char *key, int key_len, - Column_name_enumerator *col_names)=0; + Column_name_enumerator *col_names, + LEX_STRING *names, uint nnames)=0; virtual void start_row_insert(const char *key, int key_len)=0; - virtual void add_insert_column(const char *name, const char *value, + virtual void add_insert_delete_column(const char *name, int name_len)= 0; + virtual void add_insert_column(const char *name, int name_len, + const char *value, int value_len)=0; virtual bool do_insert()=0; /* Reads */ virtual bool get_slice(char *key, size_t key_len, bool *found)=0 ; - virtual bool get_next_read_column(char **name, char **value, int *value_len)=0; + virtual bool get_next_read_column(char **name, int *name_len, + char **value, int *value_len)=0; virtual void get_read_rowkey(char **value, int *value_len)=0; /* Reads, multi-row scans */ @@ -70,7 +78,7 @@ public: virtual bool get_range_slices(bool last_key_as_start_key)=0; virtual void finish_reading_range_slices()=0; virtual bool get_next_range_slice_row(bool *eof)=0; - + /* Reads, MRR scans */ virtual void new_lookup_keys()=0; virtual int add_lookup_key(const char *key, size_t key_len)=0; @@ -79,8 +87,9 @@ public: /* read_set setup */ virtual void clear_read_columns()=0; + virtual void clear_read_all_columns()=0; virtual void add_read_column(const char *name)=0; - + virtual bool truncate()=0; virtual bool remove_row()=0; diff --git a/storage/cassandra/gen-cpp/cassandra_constants.cpp b/storage/cassandra/gen-cpp/cassandra_constants.cpp index 621d39027ad..49a01d2773e 100644 --- a/storage/cassandra/gen-cpp/cassandra_constants.cpp +++ b/storage/cassandra/gen-cpp/cassandra_constants.cpp @@ -11,7 +11,7 @@ namespace org { namespace apache { namespace cassandra { const cassandraConstants g_cassandra_constants; cassandraConstants::cassandraConstants() { - cassandra_const_VERSION = "19.32.0"; + cassandra_const_VERSION = (char *)"19.32.0"; } }}} // namespace diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index c4069458c41..8459e1abf7b 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2012, Monty Program Ab This program is free software; you can redistribute it and/or modify @@ -22,15 +22,21 @@ #include "ha_cassandra.h" #include "sql_class.h" +#define DYNCOL_USUAL 20 +#define DYNCOL_DELTA 100 +#define DYNCOL_USUAL_REC 1024 +#define DYNCOL_DELTA_REC 1024 + static handler *cassandra_create_handler(handlerton *hton, - TABLE_SHARE *table, + TABLE_SHARE *table, MEM_ROOT *mem_root); +extern int dynamic_column_error_message(enum_dyncol_func_result rc); handlerton *cassandra_hton; -/* +/* Hash used to track the number of open tables; variable for example share methods */ @@ -69,6 +75,25 @@ ha_create_table_option cassandra_table_option_list[]= HA_TOPTION_END }; +/** + Structure for CREATE TABLE options (field options). +*/ + +struct ha_field_option_struct +{ + bool dyncol_field; +}; + +ha_create_table_option cassandra_field_option_list[]= +{ + /* + Collect all other columns as dynamic here, + the valid values are YES/NO, ON/OFF, 1/0. + The default is 0, that is true, yes, on. + */ + HA_FOPTION_BOOL("DYNAMIC_COLUMN_STORAGE", dyncol_field, 0), + HA_FOPTION_END +}; static MYSQL_THDVAR_ULONG(insert_batch_size, PLUGIN_VAR_RQCMDARG, "Number of rows in an INSERT batch", @@ -245,17 +270,16 @@ static int cassandra_init_func(void *p) cassandra_hton->state= SHOW_OPTION_YES; cassandra_hton->create= cassandra_create_handler; - /* + /* Don't specify HTON_CAN_RECREATE in flags. re-create is used by TRUNCATE TABLE to create an *empty* table from scratch. Cassandra table won't be emptied if re-created. */ - cassandra_hton->flags= 0; + cassandra_hton->flags= 0; cassandra_hton->table_options= cassandra_table_option_list; - //cassandra_hton->field_options= example_field_option_list; - cassandra_hton->field_options= NULL; - - mysql_mutex_init(0 /* no instrumentation */, + cassandra_hton->field_options= cassandra_field_option_list; + + mysql_mutex_init(0 /* no instrumentation */, &cassandra_default_host_lock, MY_MUTEX_INIT_FAST); DBUG_RETURN(0); @@ -352,7 +376,7 @@ static int free_share(CASSANDRA_SHARE *share) static handler* cassandra_create_handler(handlerton *hton, - TABLE_SHARE *table, + TABLE_SHARE *table, MEM_ROOT *mem_root) { return new (mem_root) ha_cassandra(hton, table); @@ -361,7 +385,11 @@ static handler* cassandra_create_handler(handlerton *hton, ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), - se(NULL), field_converters(NULL), rowkey_converter(NULL) + se(NULL), field_converters(NULL), + special_type_field_converters(NULL), + special_type_field_names(NULL), n_special_type_fields(0), + rowkey_converter(NULL), + dyncol_field(0), dyncol_set(0) {} @@ -381,7 +409,8 @@ int ha_cassandra::connect_and_check_options(TABLE *table_arg) int res; DBUG_ENTER("ha_cassandra::connect_and_check_options"); - if ((res= check_table_options(options))) + if ((res= check_field_options(table_arg->s->field)) || + (res= check_table_options(options))) DBUG_RETURN(res); se= create_cassandra_se(); @@ -403,6 +432,32 @@ int ha_cassandra::connect_and_check_options(TABLE *table_arg) } +int ha_cassandra::check_field_options(Field **fields) +{ + Field **field; + uint i; + DBUG_ENTER("ha_cassandra::check_field_options"); + for (field= fields, i= 0; *field; field++, i++) + { + ha_field_option_struct *field_options= (*field)->option_struct; + if (field_options && field_options->dyncol_field) + { + if (dyncol_set || (*field)->type() != MYSQL_TYPE_BLOB) + { + my_error(ER_WRONG_FIELD_SPEC, MYF(0), (*field)->field_name); + DBUG_RETURN(HA_WRONG_CREATE_OPTION); + } + dyncol_set= 1; + dyncol_field= i; + bzero(&dynamic_values, sizeof(dynamic_values)); + bzero(&dynamic_names, sizeof(dynamic_names)); + bzero(&dynamic_rec, sizeof(dynamic_rec)); + } + } + DBUG_RETURN(0); +} + + int ha_cassandra::open(const char *name, int mode, uint test_if_locked) { DBUG_ENTER("ha_cassandra::open"); @@ -578,7 +633,7 @@ public: field->store(*pdata); return 0; } - + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { buf= field->val_real(); @@ -770,6 +825,43 @@ static int convert_hex_digit(const char c) const char map2number[]="0123456789abcdef"; +static void convert_uuid2string(char *str, const char *cass_data) +{ + char *ptr= str; + /* UUID arrives as 16-byte number in network byte order */ + for (uint i=0; i < 16; i++) + { + *(ptr++)= map2number[(cass_data[i] >> 4) & 0xF]; + *(ptr++)= map2number[cass_data[i] & 0xF]; + if (i == 3 || i == 5 || i == 7 || i == 9) + *(ptr++)= '-'; + } + *ptr= 0; +} + +static bool convert_string2uuid(char *buf, const char *str) +{ + int lower, upper; + for (uint i= 0; i < 16; i++) + { + if ((upper= convert_hex_digit(str[0])) == -1 || + (lower= convert_hex_digit(str[1])) == -1) + { + return true; + } + buf[i]= lower | (upper << 4); + str += 2; + if (i == 3 || i == 5 || i == 7 || i == 9) + { + if (str[0] != '-') + return true; + str++; + } + } + return false; +} + + class UuidDataConverter : public ColumnDataConverter { char buf[16]; /* Binary UUID representation */ @@ -779,16 +871,7 @@ public: { DBUG_ASSERT(cass_data_len==16); char str[37]; - char *ptr= str; - /* UUID arrives as 16-byte number in network byte order */ - for (uint i=0; i < 16; i++) - { - *(ptr++)= map2number[(cass_data[i] >> 4) & 0xF]; - *(ptr++)= map2number[cass_data[i] & 0xF]; - if (i == 3 || i == 5 || i == 7 || i == 9) - *(ptr++)= '-'; - } - *ptr= 0; + convert_uuid2string(str, cass_data); field->store(str, 36,field->charset()); return 0; } @@ -796,29 +879,12 @@ public: bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { String *uuid_str= field->val_str(&str_buf); - char *pstr= (char*)uuid_str->c_ptr(); - if (uuid_str->length() != 36) + if (uuid_str->length() != 36) + return true; + + if (convert_string2uuid(buf, (char*)uuid_str->c_ptr())) return true; - - int lower, upper; - for (uint i=0; i < 16; i++) - { - if ((upper= convert_hex_digit(pstr[0])) == -1 || - (lower= convert_hex_digit(pstr[1])) == -1) - { - return true; - } - buf[i]= lower | (upper << 4); - pstr += 2; - if (i == 3 || i == 5 || i == 7 || i == 9) - { - if (pstr[0] != '-') - return true; - pstr++; - } - } - *cass_data= buf; *cass_data_len= 16; return false; @@ -826,6 +892,302 @@ public: ~UuidDataConverter(){} }; +/** + Converting dynamic columns types to/from casandra types +*/ +bool cassandra_to_dyncol_intLong(const char *cass_data, + int cass_data_len __attribute__((unused)), + DYNAMIC_COLUMN_VALUE *value) +{ + value->type= DYN_COL_INT; +#ifdef WORDS_BIGENDIAN + value->x.long_value= (longlong *)*cass_data; +#else + flip64(cass_data, (char *)&value->x.long_value); +#endif + return 0; +} + +bool dyncol_to_cassandraLong(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + longlong *tmp= (longlong *) buff; + enum enum_dyncol_func_result rc= + dynamic_column_val_long(tmp, value); + if (rc < 0) + return true; + *cass_data_len= sizeof(longlong); +#ifdef WORDS_BIGENDIAN + *cass_data= (char *)buff; +#else + flip64((char *)buff, (char *)buff + sizeof(longlong)); + *cass_data= (char *)buff + sizeof(longlong); +#endif + *freemem= NULL; + return false; +} + +bool cassandra_to_dyncol_intInt32(const char *cass_data, + int cass_data_len __attribute__((unused)), + DYNAMIC_COLUMN_VALUE *value) +{ + int32 tmp; + value->type= DYN_COL_INT; +#ifdef WORDS_BIGENDIAN + tmp= *((int32 *)cass_data); +#else + flip32(cass_data, (char *)&tmp); +#endif + value->x.long_value= tmp; + return 0; +} + + +bool dyncol_to_cassandraInt32(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + longlong *tmp= (longlong *) ((char *)buff + sizeof(longlong)); + enum enum_dyncol_func_result rc= + dynamic_column_val_long(tmp, value); + if (rc < 0) + return true; + *cass_data_len= sizeof(int32); + *cass_data= (char *)buff; +#ifdef WORDS_BIGENDIAN + *((int32 *) buff) = (int32) *tmp; +#else + { + int32 tmp2= (int32) *tmp; + flip32((char *)&tmp2, (char *)buff); + } +#endif + *freemem= NULL; + return false; +} + + +bool cassandra_to_dyncol_intCounter(const char *cass_data, + int cass_data_len __attribute__((unused)), + DYNAMIC_COLUMN_VALUE *value) +{ + value->type= DYN_COL_INT; + value->x.long_value= *((longlong *)cass_data); + return 0; +} + + +bool dyncol_to_cassandraCounter(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + longlong *tmp= (longlong *)buff; + enum enum_dyncol_func_result rc= + dynamic_column_val_long(tmp, value); + if (rc < 0) + return true; + *cass_data_len= sizeof(longlong); + *cass_data= (char *)buff; + *freemem= NULL; + return false; +} + +bool cassandra_to_dyncol_doubleFloat(const char *cass_data, + int cass_data_len __attribute__((unused)), + DYNAMIC_COLUMN_VALUE *value) +{ + value->type= DYN_COL_DOUBLE; + value->x.double_value= *((float *)cass_data); + return 0; +} + +bool dyncol_to_cassandraFloat(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + double tmp; + enum enum_dyncol_func_result rc= + dynamic_column_val_double(&tmp, value); + if (rc < 0) + return true; + *((float *)buff)= (float) tmp; + *cass_data_len= sizeof(float); + *cass_data= (char *)buff; + *freemem= NULL; + return false; +} + +bool cassandra_to_dyncol_doubleDouble(const char *cass_data, + int cass_data_len __attribute__((unused)), + DYNAMIC_COLUMN_VALUE *value) +{ + value->type= DYN_COL_DOUBLE; + value->x.double_value= *((double *)cass_data); + return 0; +} + +bool dyncol_to_cassandraDouble(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + double *tmp= (double *)buff; + enum enum_dyncol_func_result rc= + dynamic_column_val_double(tmp, value); + if (rc < 0) + return true; + *cass_data_len= sizeof(double); + *cass_data= (char *)buff; + *freemem= NULL; + return false; +} + +bool cassandra_to_dyncol_strStr(const char *cass_data, + int cass_data_len, + DYNAMIC_COLUMN_VALUE *value, + CHARSET_INFO *cs) +{ + value->type= DYN_COL_STRING; + value->x.string.charset= cs; + value->x.string.value.str= (char *)cass_data; + value->x.string.value.length= cass_data_len; + value->x.string.nonfreeable= TRUE; // do not try to free + return 0; +} + +bool dyncol_to_cassandraStr(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem, CHARSET_INFO *cs) +{ + DYNAMIC_STRING tmp; + if (init_dynamic_string(&tmp, NULL, 1024, 1024)) + return 1; + enum enum_dyncol_func_result rc= + dynamic_column_val_str(&tmp, value, cs, FALSE); + if (rc < 0) + { + dynstr_free(&tmp); + return 1; + } + *cass_data_len= tmp.length; + *(cass_data)= tmp.str; + *freemem= tmp.str; + return 0; +} + +bool cassandra_to_dyncol_strBytes(const char *cass_data, + int cass_data_len, + DYNAMIC_COLUMN_VALUE *value) +{ + return cassandra_to_dyncol_strStr(cass_data, cass_data_len, value, + &my_charset_bin); +} + +bool dyncol_to_cassandraBytes(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + return dyncol_to_cassandraStr(value, cass_data, cass_data_len, + buff, freemem, &my_charset_bin); +} + +bool cassandra_to_dyncol_strAscii(const char *cass_data, + int cass_data_len, + DYNAMIC_COLUMN_VALUE *value) +{ + return cassandra_to_dyncol_strStr(cass_data, cass_data_len, value, + &my_charset_latin1_bin); +} + +bool dyncol_to_cassandraAscii(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + return dyncol_to_cassandraStr(value, cass_data, cass_data_len, + buff, freemem, &my_charset_latin1_bin); +} + +bool cassandra_to_dyncol_strUTF8(const char *cass_data, + int cass_data_len, + DYNAMIC_COLUMN_VALUE *value) +{ + return cassandra_to_dyncol_strStr(cass_data, cass_data_len, value, + &my_charset_utf8_unicode_ci); +} + +bool dyncol_to_cassandraUTF8(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + return dyncol_to_cassandraStr(value, cass_data, cass_data_len, + buff, freemem, &my_charset_utf8_unicode_ci); +} + +bool cassandra_to_dyncol_strUUID(const char *cass_data, + int cass_data_len, + DYNAMIC_COLUMN_VALUE *value) +{ + value->type= DYN_COL_STRING; + value->x.string.charset= &my_charset_bin; + value->x.string.value.str= (char *)my_malloc(37, MYF(0)); + if (!value->x.string.value.str) + { + value->x.string.value.length= 0; + value->x.string.nonfreeable= TRUE; + return 1; + } + convert_uuid2string(value->x.string.value.str, cass_data); + value->x.string.value.length= 36; + value->x.string.nonfreeable= FALSE; + return 0; +} + +bool dyncol_to_cassandraUUID(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + DYNAMIC_STRING tmp; + if (init_dynamic_string(&tmp, NULL, 1024, 1024)) + return true; + enum enum_dyncol_func_result rc= + dynamic_column_val_str(&tmp, value, &my_charset_latin1_bin, FALSE); + if (rc < 0 || tmp.length != 36 || convert_string2uuid((char *)buff, tmp.str)) + { + dynstr_free(&tmp); + return true; + } + + *cass_data_len= tmp.length; + *(cass_data)= tmp.str; + *freemem= tmp.str; + return 0; +} + +bool cassandra_to_dyncol_intBool(const char *cass_data, + int cass_data_len, + DYNAMIC_COLUMN_VALUE *value) +{ + value->type= DYN_COL_INT; + value->x.long_value= (cass_data[0] ? 1 : 0); + return 0; +} + +bool dyncol_to_cassandraBool(DYNAMIC_COLUMN_VALUE *value, + char **cass_data, int *cass_data_len, + void* buff, void **freemem) +{ + longlong tmp; + enum enum_dyncol_func_result rc= + dynamic_column_val_long(&tmp, value); + if (rc < 0) + return true; + ((char *)buff)[0]= (tmp ? 1 : 0); + *cass_data_len= 1; + *(cass_data)= (char *)buff; + *freemem= 0; + return 0; +} + const char * const validator_bigint= "org.apache.cassandra.db.marshal.LongType"; const char * const validator_int= "org.apache.cassandra.db.marshal.Int32Type"; @@ -849,6 +1211,126 @@ const char * const validator_varint= "org.apache.cassandra.db.marshal.IntegerTyp const char * const validator_decimal= "org.apache.cassandra.db.marshal.DecimalType"; +static CASSANDRA_TYPE_DEF cassandra_types[]= +{ + { + validator_bigint, + &cassandra_to_dyncol_intLong, + &dyncol_to_cassandraLong + }, + { + validator_int, + &cassandra_to_dyncol_intInt32, + &dyncol_to_cassandraInt32 + }, + { + validator_counter, + cassandra_to_dyncol_intCounter, + &dyncol_to_cassandraCounter + }, + { + validator_float, + &cassandra_to_dyncol_doubleFloat, + &dyncol_to_cassandraFloat + }, + { + validator_double, + &cassandra_to_dyncol_doubleDouble, + &dyncol_to_cassandraDouble + }, + { + validator_blob, + &cassandra_to_dyncol_strBytes, + &dyncol_to_cassandraBytes + }, + { + validator_ascii, + &cassandra_to_dyncol_strAscii, + &dyncol_to_cassandraAscii + }, + { + validator_text, + &cassandra_to_dyncol_strUTF8, + &dyncol_to_cassandraUTF8 + }, + { + validator_timestamp, + &cassandra_to_dyncol_intLong, + &dyncol_to_cassandraLong + }, + { + validator_uuid, + &cassandra_to_dyncol_strUUID, + &dyncol_to_cassandraUUID + }, + { + validator_boolean, + &cassandra_to_dyncol_intBool, + &dyncol_to_cassandraBool + }, + { + validator_varint, + &cassandra_to_dyncol_strBytes, + &dyncol_to_cassandraBytes + }, + { + validator_decimal, + &cassandra_to_dyncol_strBytes, + &dyncol_to_cassandraBytes + } +}; + +CASSANDRA_TYPE get_cassandra_type(const char *validator) +{ + CASSANDRA_TYPE rc; + switch(validator[32]) + { + case 'L': + rc= CT_BIGINT; + break; + case 'I': + rc= (validator[35] == '3' ? CT_INT : CT_VARINT); + rc= CT_INT; + break; + case 'C': + rc= CT_COUNTER; + break; + case 'F': + rc= CT_FLOAT; + break; + case 'D': + switch (validator[33]) + { + case 'o': + rc= CT_DOUBLE; + break; + case 'a': + rc= CT_TIMESTAMP; + break; + case 'e': + rc= CT_DECIMAL; + break; + default: + rc= CT_BLOB; + break; + } + break; + case 'B': + rc= (validator[33] == 'o' ? CT_BOOLEAN : CT_BLOB); + break; + case 'A': + rc= CT_ASCII; + break; + case 'U': + rc= (validator[33] == 'T' ? CT_TEXT : CT_UUID); + break; + default: + rc= CT_BLOB; + } + DBUG_ASSERT(strcmp(cassandra_types[rc].name, validator) == 0); + return rc; +} + ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_name) { ColumnDataConverter *res= NULL; @@ -880,16 +1362,16 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ if (!strcmp(validator_name, validator_double)) res= new DoubleDataConverter; break; - + case MYSQL_TYPE_TIMESTAMP: if (!strcmp(validator_name, validator_timestamp)) res= new TimestampDataConverter; break; case MYSQL_TYPE_STRING: // these are space padded CHAR(n) strings. - if (!strcmp(validator_name, validator_uuid) && + if (!strcmp(validator_name, validator_uuid) && field->real_type() == MYSQL_TYPE_STRING && - field->field_length == 36) + field->field_length == 36) { // UUID maps to CHAR(36), its text representation res= new UuidDataConverter; @@ -943,39 +1425,117 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) int col_name_len; char *col_type; int col_type_len; + size_t ddl_fields= se->get_ddl_size(); + const char *default_type= se->get_default_validator(); + uint max_non_default_fields; + DBUG_ENTER("ha_cassandra::setup_field_converters"); + DBUG_ASSERT(default_type); DBUG_ASSERT(!field_converters); - size_t memsize= sizeof(ColumnDataConverter*) * n_fields; + DBUG_ASSERT(dyncol_set == 0 || dyncol_set == 1); + + /* + We always should take into account that in case of using dynamic columns + sql description contain one field which does not described in + Cassandra DDL also key field is described separately. So that + is why we use "n_fields - dyncol_set - 1" or "ddl_fields + 2". + */ + max_non_default_fields= ddl_fields + 2 - n_fields; + if (ddl_fields < (n_fields - dyncol_set - 1)) + { + se->print_error("Some of SQL fields were not mapped to Cassandra's fields"); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + DBUG_RETURN(true); + } + + /* allocate memory in one chunk */ + size_t memsize= sizeof(ColumnDataConverter*) * n_fields + + (sizeof(LEX_STRING) + sizeof(CASSANDRA_TYPE_DEF))* + (dyncol_set ? max_non_default_fields : 0); if (!(field_converters= (ColumnDataConverter**)my_malloc(memsize, MYF(0)))) - return true; + DBUG_RETURN(true); bzero(field_converters, memsize); n_field_converters= n_fields; + if (dyncol_set) + { + special_type_field_converters= + (CASSANDRA_TYPE_DEF *)(field_converters + n_fields); + special_type_field_names= + ((LEX_STRING*)(special_type_field_converters + max_non_default_fields)); + } + + if (dyncol_set) + { + if (init_dynamic_array(&dynamic_values, + sizeof(DYNAMIC_COLUMN_VALUE), + DYNCOL_USUAL, DYNCOL_DELTA)) + DBUG_RETURN(true); + else + if (init_dynamic_array(&dynamic_names, + sizeof(LEX_STRING), + DYNCOL_USUAL, DYNCOL_DELTA)) + { + delete_dynamic(&dynamic_values); + DBUG_RETURN(true); + } + else + if (init_dynamic_string(&dynamic_rec, NULL, + DYNCOL_USUAL_REC, DYNCOL_DELTA_REC)) + { + delete_dynamic(&dynamic_values); + delete_dynamic(&dynamic_names); + DBUG_RETURN(true); + } + + /* Dynamic column field has special processing */ + field_converters[dyncol_field]= NULL; + + default_type_def= cassandra_types + get_cassandra_type(default_type); + } + se->first_ddl_column(); uint n_mapped= 0; while (!se->next_ddl_column(&col_name, &col_name_len, &col_type, &col_type_len)) { + Field **field; + uint i; /* Mapping for the 1st field is already known */ - for (Field **field= field_arg + 1; *field; field++) + for (field= field_arg + 1, i= 1; *field; field++, i++) { - if (!strcmp((*field)->field_name, col_name)) + if ((!dyncol_set || dyncol_field != i) && + !strcmp((*field)->field_name, col_name)) { n_mapped++; ColumnDataConverter **conv= field_converters + (*field)->field_index; if (!(*conv= map_field_to_validator(*field, col_type))) { - se->print_error("Failed to map column %s to datatype %s", + se->print_error("Failed to map column %s to datatype %s", (*field)->field_name, col_type); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - return true; + DBUG_RETURN(true); } (*conv)->field= *field; } } + if (dyncol_set && !(*field)) // is needed and not found + { + DBUG_PRINT("info",("Field not found: %s", col_name)); + if (strcmp(col_type, default_type)) + { + DBUG_PRINT("info",("Field '%s' non-default type: '%s'", + col_name, col_type)); + special_type_field_names[n_special_type_fields].length= col_name_len; + special_type_field_names[n_special_type_fields].str= col_name; + special_type_field_converters[n_special_type_fields]= + cassandra_types[get_cassandra_type(col_type)]; + n_special_type_fields++; + } + } } - if (n_mapped != n_fields - 1) + if (n_mapped != n_fields - 1 - dyncol_set) { Field *first_unmapped= NULL; /* Find the first field */ @@ -990,27 +1550,28 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) DBUG_ASSERT(first_unmapped); se->print_error("Field `%s` could not be mapped to any field in Cassandra", - first_unmapped->field_name); + first_unmapped->field_name); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - return true; + DBUG_RETURN(true); } - - /* + + /* Setup type conversion for row_key. */ se->get_rowkey_type(&col_name, &col_type); if (col_name && strcmp(col_name, (*field_arg)->field_name)) { - se->print_error("PRIMARY KEY column must match Cassandra's name '%s'", col_name); + se->print_error("PRIMARY KEY column must match Cassandra's name '%s'", + col_name); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - return true; + DBUG_RETURN(true); } if (!col_name && strcmp("rowkey", (*field_arg)->field_name)) { se->print_error("target column family has no key_alias defined, " "PRIMARY KEY column must be named 'rowkey'"); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - return true; + DBUG_RETURN(true); } if (col_type != NULL) @@ -1019,7 +1580,7 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) { se->print_error("Failed to map PRIMARY KEY to datatype %s", col_type); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - return true; + DBUG_RETURN(true); } rowkey_converter->field= *field_arg; } @@ -1027,10 +1588,10 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) { se->print_error("Cassandra's rowkey has no defined datatype (todo: support this)"); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - return true; + DBUG_RETURN(true); } - return false; + DBUG_RETURN(false); } @@ -1039,10 +1600,20 @@ void ha_cassandra::free_field_converters() delete rowkey_converter; rowkey_converter= NULL; + if (dyncol_set) + { + delete_dynamic(&dynamic_values); + delete_dynamic(&dynamic_names); + dynstr_free(&dynamic_rec); + } if (field_converters) { for (uint i=0; i < n_field_converters; i++) - delete field_converters[i]; + if (field_converters[i]) + { + DBUG_ASSERT(!dyncol_set || i == dyncol_field); + delete field_converters[i]; + } my_free(field_converters); field_converters= NULL; } @@ -1065,7 +1636,7 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, { int rc= 0; DBUG_ENTER("ha_cassandra::index_read_map"); - + if (find_flag != HA_READ_KEY_EXACT) DBUG_RETURN(HA_ERR_WRONG_COMMAND); @@ -1081,6 +1652,7 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, if (rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len)) { /* We get here when making lookups like uuid_column='not-an-uuid' */ + dbug_tmp_restore_column_map(table->read_set, old_map); DBUG_RETURN(HA_ERR_KEY_NOT_FOUND); } @@ -1092,7 +1664,7 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); rc= HA_ERR_INTERNAL_ERROR; } - + /* TODO: what if we're not reading all columns?? */ if (!found) rc= HA_ERR_KEY_NOT_FOUND; @@ -1125,15 +1697,42 @@ void ha_cassandra::print_conversion_error(const char *field_name, } +void free_strings(DYNAMIC_COLUMN_VALUE *vals, uint num) +{ + for (uint i= 0; i < num; i++) + if (vals[i].type == DYN_COL_STRING && + !vals[i].x.string.nonfreeable) + my_free(vals[i].x.string.value.str); +} + + +CASSANDRA_TYPE_DEF * ha_cassandra::get_cassandra_field_def(char *cass_name, + int cass_name_len) +{ + CASSANDRA_TYPE_DEF *type= default_type_def; + for(uint i= 0; i < n_special_type_fields; i++) + { + if (cass_name_len == (int)special_type_field_names[i].length && + memcmp(cass_name, special_type_field_names[i].str, + cass_name_len) == 0) + { + type= special_type_field_converters + i; + break; + } + } + return type; +} + int ha_cassandra::read_cassandra_columns(bool unpack_pk) { char *cass_name; char *cass_value; - int cass_value_len; + int cass_value_len, cass_name_len; Field **field; int res= 0; - - /* + ulong total_name_len= 0; + + /* cassandra_to_mariadb() calls will use field->store(...) methods, which require that the column is in the table->write_set */ @@ -1144,16 +1743,18 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk) for (field= table->field + 1; *field; field++) (*field)->set_null(); - while (!se->get_next_read_column(&cass_name, &cass_value, &cass_value_len)) + while (!se->get_next_read_column(&cass_name, &cass_name_len, + &cass_value, &cass_value_len)) { // map to our column. todo: use hash or something.. - int idx=1; + bool found= 0; for (field= table->field + 1; *field; field++) { - idx++; - if (!strcmp((*field)->field_name, cass_name)) + uint fieldnr= (*field)->field_index; + if ((!dyncol_set || dyncol_field != fieldnr) && + !strcmp((*field)->field_name, cass_name)) { - int fieldnr= (*field)->field_index; + found= 1; (*field)->set_notnull(); if (field_converters[fieldnr]->cassandra_to_mariadb(cass_value, cass_value_len)) @@ -1166,8 +1767,86 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk) break; } } + if (dyncol_set && !found) + { + DYNAMIC_COLUMN_VALUE val; + LEX_STRING nm; + CASSANDRA_TYPE_DEF *type= get_cassandra_field_def(cass_name, + cass_name_len); + nm.str= cass_name; + nm.length= cass_name_len; + if (nm.length > MAX_NAME_LENGTH) + { + se->print_error("Unable to convert value for field `%s`" + " from Cassandra's data format. Name" + " length exceed limit of %u: '%s'", + table->field[dyncol_field]->field_name, + (uint)MAX_NAME_LENGTH, cass_name); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + res=1; + goto err; + } + total_name_len+= cass_name_len; + if (nm.length > MAX_TOTAL_NAME_LENGTH) + { + se->print_error("Unable to convert value for field `%s`" + " from Cassandra's data format. Sum of all names" + " length exceed limit of %lu", + table->field[dyncol_field]->field_name, + cass_name, (uint)MAX_TOTAL_NAME_LENGTH); + my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); + res=1; + goto err; + } + + if ((res= (*(type->cassandra_to_dynamic))(cass_value, + cass_value_len, &val)) || + insert_dynamic(&dynamic_names, (uchar *) &nm) || + insert_dynamic(&dynamic_values, (uchar *) &val)) + { + if (res) + { + print_conversion_error(cass_name, cass_value, cass_value_len); + } + free_strings((DYNAMIC_COLUMN_VALUE *)dynamic_values.buffer, + dynamic_values.elements); + // EOM shouldm be already reported if happened + res=1; + goto err; + } + } } - + + dynamic_rec.length= 0; + if (dyncol_set) + { + if (dynamic_column_create_many_internal_fmt(&dynamic_rec, + dynamic_names.elements, + dynamic_names.buffer, + (DYNAMIC_COLUMN_VALUE *) + dynamic_values.buffer, + FALSE, + TRUE) < 0) + dynamic_rec.length= 0; + + free_strings((DYNAMIC_COLUMN_VALUE *)dynamic_values.buffer, + dynamic_values.elements); + dynamic_values.elements= dynamic_names.elements= 0; + } + if (dyncol_set) + { + if (dynamic_rec.length == 0) + table->field[dyncol_field]->set_null(); + else + { + Field_blob *blob= (Field_blob *)table->field[dyncol_field]; + blob->set_notnull(); + blob->store_length(dynamic_rec.length); + *((char **)(((char *)blob->ptr) + blob->pack_length_no_ptr()))= + dynamic_rec.str; + } + } + if (unpack_pk) { /* Unpack rowkey to primary key */ @@ -1187,6 +1866,82 @@ err: return res; } +int ha_cassandra::read_dyncol(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, + String *valcol, char **freenames) +{ + String *strcol; + DYNAMIC_COLUMN col; + enum enum_dyncol_func_result rc; + DBUG_ENTER("ha_cassandra::read_dyncol"); + + Field *field= table->field[dyncol_field]; + DBUG_ASSERT(field->type() == MYSQL_TYPE_BLOB); + /* It is blob and it does not use buffer */ + strcol= field->val_str(NULL, valcol); + if (field->is_null()) + { + bzero(vals, sizeof(DYNAMIC_ARRAY)); + bzero(names, sizeof(DYNAMIC_ARRAY)); + DBUG_RETURN(0); // nothing to write + } + /* + dynamic_column_vals only read the string so we can + cheat here with assignment + */ + bzero(&col, sizeof(col)); + col.str= (char *)strcol->ptr(); + col.length= strcol->length(); + if ((rc= dynamic_column_vals(&col, names, vals, freenames)) < 0) + { + dynamic_column_error_message(rc); + DBUG_RETURN(HA_ERR_INTERNAL_ERROR); + } + DBUG_RETURN(0); +} + +int ha_cassandra::write_dynamic_row(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names) +{ + uint i; + DBUG_ENTER("ha_cassandra::write_dynamic_row"); + DBUG_ASSERT(dyncol_set); + + + DBUG_ASSERT(names->elements == vals->elements); + for (i= 0; i < names->elements; i++) + { + char buff[16]; + CASSANDRA_TYPE_DEF *type; + void *freemem= NULL; + char *cass_data; + int cass_data_len; + LEX_STRING *name= dynamic_element(names, i, LEX_STRING*); + DYNAMIC_COLUMN_VALUE *val= dynamic_element(vals, i, DYNAMIC_COLUMN_VALUE*); + + DBUG_PRINT("info", ("field %*s", (int)name->length, name->str)); + type= get_cassandra_field_def(name->str, (int) name->length); + if ((*type->dynamic_to_cassandra)(val, &cass_data, &cass_data_len, + buff, &freemem)) + { + my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), + name->str, insert_lineno); + DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + } + se->add_insert_column(name->str, name->length, + cass_data, cass_data_len); + if (freemem) + my_free(freemem); + } + DBUG_RETURN(0); +} + +void ha_cassandra::free_dynamic_row(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, + char *free_names) +{ + delete_dynamic(names); + delete_dynamic(vals); + if (free_names) + my_free(free_names); +} int ha_cassandra::write_row(uchar *buf) { @@ -1221,15 +1976,35 @@ int ha_cassandra::write_row(uchar *buf) { char *cass_data; int cass_data_len; - if (field_converters[i]->mariadb_to_cassandra(&cass_data, &cass_data_len)) + if (dyncol_set && dyncol_field == i) { - my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), - field_converters[i]->field->field_name, insert_lineno); - dbug_tmp_restore_column_map(table->read_set, old_map); - DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + String valcol; + DYNAMIC_ARRAY vals, names; + char *free_names; + int rc; + DBUG_ASSERT(field_converters[i] == NULL); + if (!(rc= read_dyncol(&vals, &names, &valcol, &free_names))) + rc= write_dynamic_row(&vals, &names); + free_dynamic_row(&vals, &names, free_names); + if (rc) + { + dbug_tmp_restore_column_map(table->read_set, old_map); + DBUG_RETURN(rc); + } + } + else + { + if (field_converters[i]->mariadb_to_cassandra(&cass_data, + &cass_data_len)) + { + my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), + field_converters[i]->field->field_name, insert_lineno); + dbug_tmp_restore_column_map(table->read_set, old_map); + DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + } + se->add_insert_column(field_converters[i]->field->field_name, 0, + cass_data, cass_data_len); } - se->add_insert_column(field_converters[i]->field->field_name, - cass_data, cass_data_len); } dbug_tmp_restore_column_map(table->read_set, old_map); @@ -1296,9 +2071,16 @@ int ha_cassandra::rnd_init(bool scan) DBUG_RETURN(0); } - se->clear_read_columns(); - for (uint i= 1; i < table->s->fields; i++) - se->add_read_column(table->field[i]->field_name); + if (dyncol_set) + { + se->clear_read_all_columns(); + } + else + { + se->clear_read_columns(); + for (uint i= 1; i < table->s->fields; i++) + se->add_read_column(table->field[i]->field_name); + } se->read_batch_size= THDVAR(table->in_use, rnd_batch_size); bres= se->get_range_slices(false); @@ -1633,13 +2415,16 @@ public: int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) { + DYNAMIC_ARRAY oldvals, oldnames, vals, names; + String oldvalcol, valcol; + char *oldfree_names= NULL, *free_names= NULL; my_bitmap_map *old_map; + int res; DBUG_ENTER("ha_cassandra::update_row"); /* Currently, it is guaranteed that new_data == table->record[0] */ - + DBUG_ASSERT(new_data == table->record[0]); /* For now, just rewrite the full record */ se->clear_insert_buffer(); - old_map= dbug_tmp_use_all_columns(table, table->read_set); @@ -1668,6 +2453,22 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) else new_primary_key= false; + if (dyncol_set) + { + Field *field= table->field[dyncol_field]; + /* move to get old_data */ + my_ptrdiff_t diff; + diff= (my_ptrdiff_t) (old_data - new_data); + field->move_field_offset(diff); // Points now at old_data + if ((res= read_dyncol(&oldvals, &oldnames, &oldvalcol, &oldfree_names))) + DBUG_RETURN(res); + field->move_field_offset(-diff); // back to new_data + if ((res= read_dyncol(&vals, &names, &valcol, &free_names))) + { + free_dynamic_row(&oldnames, &oldvals, oldfree_names); + DBUG_RETURN(res); + } + } if (new_primary_key) { @@ -1676,7 +2477,10 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) Add a DELETE operation into the batch */ Column_name_enumerator_impl name_enumerator(this); - se->add_row_deletion(old_key, old_key_len, &name_enumerator); + se->add_row_deletion(old_key, old_key_len, &name_enumerator, + (LEX_STRING *)oldnames.buffer, + (dyncol_set ? oldnames.elements : 0)); + oldnames.elements= oldvals.elements= 0; // they will be deleted } se->start_row_insert(new_key, new_key_len); @@ -1686,23 +2490,64 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) { char *cass_data; int cass_data_len; - if (field_converters[i]->mariadb_to_cassandra(&cass_data, &cass_data_len)) + if (dyncol_set && dyncol_field == i) { - my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), - field_converters[i]->field->field_name, insert_lineno); - dbug_tmp_restore_column_map(table->read_set, old_map); - DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + DBUG_ASSERT(field_converters[i] == NULL); + if ((res= write_dynamic_row(&vals, &names))) + goto err; + } + else + { + if (field_converters[i]->mariadb_to_cassandra(&cass_data, &cass_data_len)) + { + my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), + field_converters[i]->field->field_name, insert_lineno); + dbug_tmp_restore_column_map(table->read_set, old_map); + DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + } + se->add_insert_column(field_converters[i]->field->field_name, 0, + cass_data, cass_data_len); } - se->add_insert_column(field_converters[i]->field->field_name, - cass_data, cass_data_len); } + if (dyncol_set) + { + /* find removed fields */ + uint i= 0, j= 0; + LEX_STRING *onames= (LEX_STRING *)oldnames.buffer; + LEX_STRING *nnames= (LEX_STRING *)names.buffer; + /* both array are sorted */ + for(; i < oldnames.elements; i++) + { + int scmp= 0; + while (j < names.elements && + (nnames[j].length < onames[i].length || + (nnames[j].length == onames[i].length && + (scmp= memcmp(nnames[j].str, onames[i].str, + onames[i].length)) < 0))) + j++; + if (j < names.elements && + nnames[j].length == onames[i].length && + scmp == 0) + j++; + else + se->add_insert_delete_column(onames[i].str, onames[i].length); + } + } + dbug_tmp_restore_column_map(table->read_set, old_map); - - bool res= se->do_insert(); + + res= se->do_insert(); if (res) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - + +err: + if (dyncol_set) + { + free_dynamic_row(&oldnames, &oldvals, oldfree_names); + free_dynamic_row(&names, &vals, free_names); + } + DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); } diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index fb5236bf118..f32151849e5 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -40,6 +40,33 @@ class ColumnDataConverter; struct ha_table_option_struct; + +struct st_dynamic_column_value; + +typedef bool (* CAS2DYN_CONVERTER)(const char *cass_data, + int cass_data_len, + struct st_dynamic_column_value *value); +typedef bool (* DYN2CAS_CONVERTER)(struct st_dynamic_column_value *value, + char **cass_data, + int *cass_data_len, + void *buf, void **freemem); +struct cassandra_type_def +{ + const char *name; + CAS2DYN_CONVERTER cassandra_to_dynamic; + DYN2CAS_CONVERTER dynamic_to_cassandra; +}; + +typedef struct cassandra_type_def CASSANDRA_TYPE_DEF; + +enum cassandtra_type_enum {CT_BIGINT, CT_INT, CT_COUNTER, CT_FLOAT, CT_DOUBLE, + CT_BLOB, CT_ASCII, CT_TEXT, CT_TIMESTAMP, CT_UUID, CT_BOOLEAN, CT_VARINT, + CT_DECIMAL}; + +typedef enum cassandtra_type_enum CASSANDRA_TYPE; + + + /** @brief Class definition for the storage engine */ @@ -48,23 +75,35 @@ class ha_cassandra: public handler friend class Column_name_enumerator_impl; THR_LOCK_DATA lock; ///< MySQL lock CASSANDRA_SHARE *share; ///< Shared lock info - + Cassandra_se_interface *se; + /* description of static part of the table definition */ ColumnDataConverter **field_converters; uint n_field_converters; + CASSANDRA_TYPE_DEF *default_type_def; + /* description of dynamic columns part */ + CASSANDRA_TYPE_DEF *special_type_field_converters; + LEX_STRING *special_type_field_names; + uint n_special_type_fields; + DYNAMIC_ARRAY dynamic_values, dynamic_names; + DYNAMIC_STRING dynamic_rec; + ColumnDataConverter *rowkey_converter; bool setup_field_converters(Field **field, uint n_fields); void free_field_converters(); - + int read_cassandra_columns(bool unpack_pk); int check_table_options(struct ha_table_option_struct* options); bool doing_insert_batch; ha_rows insert_rows_batched; - + + uint dyncol_field; + bool dyncol_set; + /* Used to produce 'wrong column %s at row %lu' warnings */ ha_rows insert_lineno; void print_conversion_error(const char *field_name, @@ -191,6 +230,14 @@ public: private: bool source_exhausted; bool mrr_start_read(); + int check_field_options(Field **fields); + int read_dyncol(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, + String *valcol, char **freenames); + int write_dynamic_row(DYNAMIC_ARRAY *names, DYNAMIC_ARRAY *vals); + void static free_dynamic_row(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, + char *free_names); + CASSANDRA_TYPE_DEF * get_cassandra_field_def(char *cass_name, + int cass_name_length); public: /* From 3f8eaf7e87a0a77edf511856429baf517ada6fea Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Sep 2012 15:30:49 +0300 Subject: [PATCH 260/439] Ending spaces removed. --- storage/cassandra/cassandra_se.cc | 64 +++++++++--------- storage/cassandra/cassandra_se.h | 8 +-- storage/cassandra/ha_cassandra.cc | 104 +++++++++++++++--------------- storage/cassandra/ha_cassandra.h | 24 +++---- 4 files changed, 100 insertions(+), 100 deletions(-) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 99a9a08b69d..9e2b815c488 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -51,11 +51,11 @@ class Cassandra_se_impl: public Cassandra_se_interface ConsistencyLevel::type write_consistency; ConsistencyLevel::type read_consistency; - + /* How many times to retry an operation before giving up */ int thrift_call_retries_to_do; - + /* DDL data */ KsDef ks_def; /* KeySpace we're using (TODO: put this in table->share) */ CfDef cf_def; /* Column family we're using (TODO: put in table->share)*/ @@ -68,15 +68,15 @@ class Cassandra_se_impl: public Cassandra_se_interface /* Insert preparation */ typedef std::map > ColumnFamilyToMutation; typedef std::map KeyToCfMutationMap; - + KeyToCfMutationMap batch_mutation; /* Prepare operation here */ int64_t insert_timestamp; std::vector* insert_list; - + /* Resultset we're reading */ std::vector key_slice_vec; std::vector::iterator key_slice_it; - + std::string rowkey; /* key of the record we're returning now */ SlicePredicate slice_pred; @@ -84,12 +84,12 @@ class Cassandra_se_impl: public Cassandra_se_interface bool get_slices_returned_less; bool get_slice_found_rows; public: - Cassandra_se_impl() : cass(NULL), + Cassandra_se_impl() : cass(NULL), write_consistency(ConsistencyLevel::ONE), read_consistency(ConsistencyLevel::ONE), thrift_call_retries_to_do(0) {} virtual ~Cassandra_se_impl(){ delete cass; } - + /* Connection and DDL checks */ bool connect(const char *host, int port, const char *keyspace); void set_column_family(const char *cfname) { column_family.assign(cfname); } @@ -137,7 +137,7 @@ public: void clear_read_columns(); void clear_read_all_columns(); void add_read_column(const char *name); - + /* Reads, MRR scans */ void new_lookup_keys(); int add_lookup_key(const char *key, size_t key_len); @@ -164,7 +164,7 @@ private: /* Non-inherited utility functions: */ int64_t get_i64_timestamp(); - + typedef bool (Cassandra_se_impl::*retryable_func_t)(); bool try_operation(retryable_func_t func); }; @@ -182,17 +182,17 @@ Cassandra_se_interface *create_cassandra_se() bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace_arg) { bool res= true; - + keyspace.assign(keyspace_arg); - + try { - boost::shared_ptr socket = + boost::shared_ptr socket = boost::shared_ptr(new TSocket(host, port)); - boost::shared_ptr tr = + boost::shared_ptr tr = boost::shared_ptr(new TFramedTransport (socket)); - boost::shared_ptr p = + boost::shared_ptr p = boost::shared_ptr(new TBinaryProtocol(tr)); - + cass= new CassandraClient(p); tr->open(); cass->set_keyspace(keyspace_arg); @@ -216,7 +216,7 @@ bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace } -void Cassandra_se_impl::set_consistency_levels(ulong read_cons_level, +void Cassandra_se_impl::set_consistency_levels(ulong read_cons_level, ulong write_cons_level) { write_cons_level= (ConsistencyLevel::type)(write_cons_level + 1); @@ -229,7 +229,7 @@ bool Cassandra_se_impl::retryable_setup_ddl_checks() try { cass->describe_keyspace(ks_def, keyspace); - + } catch (NotFoundException nfe) { print_error("keyspace `%s` not found: %s", keyspace.c_str(), nfe.what()); return true; @@ -261,7 +261,7 @@ void Cassandra_se_impl::first_ddl_column() } -bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len, +bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len, char **type, int *type_len) { if (column_ddl_it == cf_def.column_metadata.end()) @@ -314,7 +314,7 @@ int64_t Cassandra_se_impl::get_i64_timestamp() int64_t usec = td.tv_usec; usec = usec / 1000; ms += usec; - + return ms; } @@ -345,7 +345,7 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, { std::string key_to_delete; key_to_delete.assign(key, key_len); - + batch_mutation[key_to_delete]= ColumnFamilyToMutation(); ColumnFamilyToMutation& cf_mut= batch_mutation[key_to_delete]; @@ -357,7 +357,7 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, mut.deletion.__isset.timestamp= true; mut.deletion.timestamp= get_i64_timestamp(); mut.deletion.__isset.predicate= true; - + /* Attempting to delete columns with SliceRange causes exception with message "Deletion does not yet support SliceRange predicates". @@ -439,7 +439,7 @@ bool Cassandra_se_impl::do_insert() */ if (batch_mutation.empty()) return false; - + return try_operation(&Cassandra_se_impl::retryable_do_insert); } @@ -449,7 +449,7 @@ bool Cassandra_se_impl::do_insert() ///////////////////////////////////////////////////////////////////////////// /* - Make one key lookup. If the record is found, the result is stored locally and + Make one key lookup. If the record is found, the result is stored locally and the caller should iterate over it. */ @@ -475,7 +475,7 @@ bool Cassandra_se_impl::retryable_get_slice() sr.finish = ""; slice_pred.__set_slice_range(sr); - cass->get_slice(column_data_vec, rowkey, cparent, slice_pred, + cass->get_slice(column_data_vec, rowkey, cparent, slice_pred, read_consistency); if (column_data_vec.size() == 0) @@ -548,7 +548,7 @@ void Cassandra_se_impl::get_read_rowkey(char **value, int *value_len) bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) { get_range_slices_param_last_key_as_start_key= last_key_as_start_key; - + return try_operation(&Cassandra_se_impl::retryable_get_range_slices); } @@ -556,10 +556,10 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) bool Cassandra_se_impl::retryable_get_range_slices() { bool last_key_as_start_key= get_range_slices_param_last_key_as_start_key; - + ColumnParent cparent; cparent.column_family= column_family; - + /* SlicePredicate can be used to limit columns we will retrieve */ KeyRange key_range; @@ -620,7 +620,7 @@ restart: return false; } } - + /* (1) - skip the last row that we have read in the previous batch. (2) - Rows that were deleted show up as rows without any columns. Skip @@ -710,16 +710,16 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call) res= true; try { - + if ((res= (this->*func_to_call)())) { /* The function call was made successfully (without timeouts, etc), - but something inside it returned 'true'. + but something inside it returned 'true'. This is supposedly a failure (or "not found" or other negative result). We need to return this to the caller. */ - n_retries= 0; + n_retries= 0; } } catch (InvalidRequestException ire) { @@ -735,7 +735,7 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call) print_error("TimedOutException: %s", te.what()); }catch(TException e){ /* todo: we may use retry for certain kinds of Thrift errors */ - n_retries= 0; + n_retries= 0; print_error("Thrift exception: %s", e.what()); } catch (...) { n_retries= 0; /* Don't retry */ diff --git a/storage/cassandra/cassandra_se.h b/storage/cassandra/cassandra_se.h index f74d8cbd909..050c65e6dde 100644 --- a/storage/cassandra/cassandra_se.h +++ b/storage/cassandra/cassandra_se.h @@ -37,7 +37,7 @@ class Cassandra_se_interface { public: Cassandra_se_interface() { err_buffer[0]=0; } - + virtual ~Cassandra_se_interface(){}; /* Init */ virtual bool connect(const char *host, int port, const char *keyspace)=0; @@ -45,11 +45,11 @@ public: /* Settings */ virtual void set_consistency_levels(ulong read_cons_level, ulong write_cons_level)=0; - + /* Check underlying DDL */ virtual bool setup_ddl_checks()=0; virtual void first_ddl_column()=0; - virtual bool next_ddl_column(char **name, int *name_len, char **value, + virtual bool next_ddl_column(char **name, int *name_len, char **value, int *value_len)=0; virtual void get_rowkey_type(char **name, char **type)=0; virtual size_t get_ddl_size()=0; @@ -106,7 +106,7 @@ class Cassandra_status_vars public: ulong row_inserts; ulong row_insert_batches; - + ulong multiget_reads; ulong multiget_keys_scanned; ulong multiget_rows_read; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 8459e1abf7b..d77a89bded3 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -113,7 +113,7 @@ static MYSQL_THDVAR_ULONG(failure_retries, PLUGIN_VAR_RQCMDARG, NULL, NULL, /*default*/ 0, /*min*/ 0, /*max*/ 1024*1024*1024, 0); /* These match values in enum_cassandra_consistency_level */ -const char *cassandra_consistency_level[] = +const char *cassandra_consistency_level[] = { "ONE", "QUORUM", @@ -145,19 +145,19 @@ mysql_mutex_t cassandra_default_host_lock; static char* cassandra_default_thrift_host = NULL; static char cassandra_default_host_buf[256]=""; -static void -cassandra_default_thrift_host_update(THD *thd, +static void +cassandra_default_thrift_host_update(THD *thd, struct st_mysql_sys_var* var, void* var_ptr, /*!< out: where the formal string goes */ - const void* save) /*!< in: immediate result + const void* save) /*!< in: immediate result from check function */ { const char *new_host= *((char**)save); const size_t max_len= sizeof(cassandra_default_host_buf); mysql_mutex_lock(&cassandra_default_host_lock); - + if (new_host) { strncpy(cassandra_default_host_buf, new_host, max_len); @@ -169,7 +169,7 @@ cassandra_default_thrift_host_update(THD *thd, cassandra_default_host_buf[0]= 0; cassandra_default_thrift_host= NULL; } - + *((const char**)var_ptr)= cassandra_default_thrift_host; mysql_mutex_unlock(&cassandra_default_host_lock); @@ -177,10 +177,10 @@ cassandra_default_thrift_host_update(THD *thd, static MYSQL_SYSVAR_STR(default_thrift_host, cassandra_default_thrift_host, - PLUGIN_VAR_RQCMDARG, - "Default host for Cassandra thrift connections", + PLUGIN_VAR_RQCMDARG, + "Default host for Cassandra thrift connections", /*check*/NULL, - cassandra_default_thrift_host_update, + cassandra_default_thrift_host_update, /*default*/NULL); static struct st_mysql_sys_var* cassandra_system_variables[]= { @@ -465,7 +465,7 @@ int ha_cassandra::open(const char *name, int mode, uint test_if_locked) if (!(share = get_share(name, table))) DBUG_RETURN(1); thr_lock_data_init(&share->lock,&lock,NULL); - + DBUG_ASSERT(!se); /* Don't do the following on open: it prevents SHOW CREATE TABLE when the server @@ -501,7 +501,7 @@ int ha_cassandra::check_table_options(ha_table_option_struct *options) if (!options->thrift_host && (!cassandra_default_thrift_host || !cassandra_default_thrift_host[0])) { - my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "thrift_host table option must be specified, or " "@@cassandra_default_thrift_host must be set"); return HA_WRONG_CREATE_OPTION; @@ -509,7 +509,7 @@ int ha_cassandra::check_table_options(ha_table_option_struct *options) if (!options->keyspace || !options->column_family) { - my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), + my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "keyspace and column_family table options must be specified"); return HA_WRONG_CREATE_OPTION; } @@ -543,7 +543,7 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, int res; DBUG_ENTER("ha_cassandra::create"); DBUG_ASSERT(options); - + Field **pfield= table_arg->s->field; if (!((*pfield)->flags & NOT_NULL_FLAG)) { @@ -555,7 +555,7 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, table_arg->key_info[0].key_parts != 1 || table_arg->key_info[0].key_part[0].fieldnr != 1) { - my_error(ER_WRONG_COLUMN_NAME, MYF(0), + my_error(ER_WRONG_COLUMN_NAME, MYF(0), "Table must have PRIMARY KEY defined over the first column"); DBUG_RETURN(HA_WRONG_CREATE_OPTION); } @@ -582,7 +582,7 @@ public: Field *field; /* This will save Cassandra's data in the Field */ - virtual int cassandra_to_mariadb(const char *cass_data, + virtual int cassandra_to_mariadb(const char *cass_data, int cass_data_len)=0; /* @@ -610,7 +610,7 @@ public: field->store(*pdata); return 0; } - + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { buf= field->val_real(); @@ -672,7 +672,7 @@ public: field->store(tmp); return 0; } - + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { longlong tmp= field->val_int(); @@ -731,7 +731,7 @@ public: field->store(tmp); return 0; } - + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { int32_t tmp= field->val_int(); @@ -756,7 +756,7 @@ public: field->store(cass_data, cass_data_len,field->charset()); return 0; } - + bool mariadb_to_cassandra(char **cass_data, int *cass_data_len) { String *pstr= field->val_str(&buf); @@ -780,7 +780,7 @@ public: DBUG_ASSERT(cass_data_len==8); flip64(cass_data, (char*)&tmp); /* - store_TIME's arguments: + store_TIME's arguments: - seconds since epoch - microsecond fraction of a second. */ @@ -794,7 +794,7 @@ public: ulong ts_microsec; int64_t tmp; ts_time= ((Field_timestamp*)field)->get_timestamp(&ts_microsec); - + /* Cassandra needs milliseconds-since-epoch */ tmp= ((int64_t)ts_time) * 1000 + ts_microsec/1000; flip64((const char*)&tmp, (char*)&buf); @@ -1383,7 +1383,7 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ { /* Cassandra's "varint" type is a binary-encoded arbitary-length - big-endian number. + big-endian number. - It can be mapped to VARBINARY(N), with sufficiently big N. - If the value does not fit into N bytes, it is an error. We should not truncate it, because that is just as good as returning garbage. @@ -1391,7 +1391,7 @@ ColumnDataConverter *map_field_to_validator(Field *field, const char *validator_ are zero-padded, which will work as multiplying the value by 2^k for some value of k. */ - if (field->type() == MYSQL_TYPE_VARCHAR && + if (field->type() == MYSQL_TYPE_VARCHAR && field->binary() && (!strcmp(validator_name, validator_varint) || !strcmp(validator_name, validator_decimal))) @@ -1675,7 +1675,7 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, } -void ha_cassandra::print_conversion_error(const char *field_name, +void ha_cassandra::print_conversion_error(const char *field_name, char *cass_value, int cass_value_len) { @@ -1691,7 +1691,7 @@ void ha_cassandra::print_conversion_error(const char *field_name, se->print_error("Unable to convert value for field `%s` from Cassandra's data" " format. Source data is %d bytes, 0x%s%s", - field_name, cass_value_len, buf, + field_name, cass_value_len, buf, (i == sizeof(buf) - 1)? "..." : ""); my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); } @@ -1759,7 +1759,7 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk) if (field_converters[fieldnr]->cassandra_to_mariadb(cass_value, cass_value_len)) { - print_conversion_error((*field)->field_name, cass_value, + print_conversion_error((*field)->field_name, cass_value, cass_value_len); res=1; goto err; @@ -1948,7 +1948,7 @@ int ha_cassandra::write_row(uchar *buf) my_bitmap_map *old_map; int ires; DBUG_ENTER("ha_cassandra::write_row"); - + if (!se && (ires= connect_and_check_options(table))) DBUG_RETURN(ires); @@ -1956,7 +1956,7 @@ int ha_cassandra::write_row(uchar *buf) se->clear_insert_buffer(); old_map= dbug_tmp_use_all_columns(table, table->read_set); - + insert_lineno++; /* Convert the key */ @@ -2008,9 +2008,9 @@ int ha_cassandra::write_row(uchar *buf) } dbug_tmp_restore_column_map(table->read_set, old_map); - + bool res; - + if (doing_insert_batch) { res= 0; @@ -2025,7 +2025,7 @@ int ha_cassandra::write_row(uchar *buf) if (res) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - + DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); } @@ -2046,7 +2046,7 @@ void ha_cassandra::start_bulk_insert(ha_rows rows) int ha_cassandra::end_bulk_insert() { DBUG_ENTER("ha_cassandra::end_bulk_insert"); - + /* Flush out the insert buffer */ doing_insert_batch= false; bool bres= se->do_insert(); @@ -2133,7 +2133,7 @@ int ha_cassandra::delete_all_rows() DBUG_RETURN(ires); bres= se->truncate(); - + if (bres) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); @@ -2145,12 +2145,12 @@ int ha_cassandra::delete_row(const uchar *buf) { bool bres; DBUG_ENTER("ha_cassandra::delete_row"); - + bres= se->remove_row(); - + if (bres) my_error(ER_INTERNAL_ERROR, MYF(0), se->error_str()); - + DBUG_RETURN(bres? HA_ERR_INTERNAL_ERROR: 0); } @@ -2158,7 +2158,7 @@ int ha_cassandra::delete_row(const uchar *buf) int ha_cassandra::info(uint flag) { DBUG_ENTER("ha_cassandra::info"); - + if (!table) return 1; @@ -2183,7 +2183,7 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, void ha_cassandra::position(const uchar *record) { DBUG_ENTER("ha_cassandra::position"); - + /* Copy the primary key to rowid */ key_copy(ref, (uchar*)record, &table->key_info[0], table->field[0]->key_length(), true); @@ -2196,7 +2196,7 @@ int ha_cassandra::rnd_pos(uchar *buf, uchar *pos) { int rc; DBUG_ENTER("ha_cassandra::rnd_pos"); - + int save_active_index= active_index; active_index= 0; /* The primary key */ rc= index_read_map(buf, pos, key_part_map(1), HA_READ_KEY_EXACT); @@ -2230,7 +2230,7 @@ int ha_cassandra::reset() - anything else? */ ha_rows ha_cassandra::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, - void *seq_init_param, + void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, COST_VECT *cost) { @@ -2240,7 +2240,7 @@ ha_rows ha_cassandra::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, ha_rows ha_cassandra::multi_range_read_info(uint keyno, uint n_ranges, uint keys, - uint key_parts, uint *bufsz, + uint key_parts, uint *bufsz, uint *flags, COST_VECT *cost) { /* Can only be equality lookups on the primary key... */ @@ -2269,14 +2269,14 @@ bool ha_cassandra::mrr_start_read() my_bitmap_map *old_map; old_map= dbug_tmp_use_all_columns(table, table->read_set); - + se->new_lookup_keys(); while (!(source_exhausted= mrr_funcs.next(mrr_iter, &mrr_cur_range))) { char *cass_key; int cass_key_len; - + DBUG_ASSERT(mrr_cur_range.range_flag & EQ_RANGE); uchar *key= (uchar*)mrr_cur_range.start_key.key; @@ -2285,9 +2285,9 @@ bool ha_cassandra::mrr_start_read() store_key_image_to_rec(table->field[0], (uchar*)key, key_len); rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len); - + // Primitive buffer control - if (se->add_lookup_key(cass_key, cass_key_len) > + if (se->add_lookup_key(cass_key, cass_key_len) > THDVAR(table->in_use, multiget_batch_size)) break; } @@ -2308,7 +2308,7 @@ int ha_cassandra::multi_range_read_next(range_id_t *range_info) res= read_cassandra_columns(true); break; } - else + else { if (source_exhausted) { @@ -2324,7 +2324,7 @@ int ha_cassandra::multi_range_read_next(range_id_t *range_info) } } } - /* + /* We get here if we've refilled the buffer and done another read. Try reading from results again */ @@ -2444,7 +2444,7 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) } /* - Compare it to the key we've read. For all types that Cassandra supports, + Compare it to the key we've read. For all types that Cassandra supports, binary byte-wise comparison can be used */ bool new_primary_key; @@ -2472,8 +2472,8 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) if (new_primary_key) { - /* - Primary key value changed. This is essentially a DELETE + INSERT. + /* + Primary key value changed. This is essentially a DELETE + INSERT. Add a DELETE operation into the batch */ Column_name_enumerator_impl name_enumerator(this); @@ -2606,7 +2606,7 @@ int ha_cassandra::external_lock(THD *thd, int lock_type) int ha_cassandra::delete_table(const char *name) { DBUG_ENTER("ha_cassandra::delete_table"); - /* + /* Cassandra table is just a view. Dropping it doesn't affect the underlying column family. */ @@ -2640,7 +2640,7 @@ bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info, static int show_cassandra_vars(THD *thd, SHOW_VAR *var, char *buff) { - cassandra_counters_copy= cassandra_counters; + cassandra_counters_copy= cassandra_counters; var->type= SHOW_ARRAY; var->value= (char *) &cassandra_status_variables; diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index f32151849e5..947834685fd 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2012, Monty Program Ab This program is free software; you can redistribute it and/or modify @@ -106,7 +106,7 @@ class ha_cassandra: public handler /* Used to produce 'wrong column %s at row %lu' warnings */ ha_rows insert_lineno; - void print_conversion_error(const char *field_name, + void print_conversion_error(const char *field_name, char *cass_value, int cass_value_len); int connect_and_check_options(TABLE *table_arg); public: @@ -144,12 +144,12 @@ public: We are saying that this engine is just statement capable to have an engine that can only handle statement-based logging. This is used in testing. - HA_REC_NOT_IN_SEQ - If we don't set it, filesort crashes, because it assumes rowids are - 1..8 byte numbers + HA_REC_NOT_IN_SEQ + If we don't set it, filesort crashes, because it assumes rowids are + 1..8 byte numbers */ - return HA_BINLOG_STMT_CAPABLE | - HA_REC_NOT_IN_SEQ; + return HA_BINLOG_STMT_CAPABLE | + HA_REC_NOT_IN_SEQ; } @@ -191,7 +191,7 @@ public: support indexes. */ uint max_supported_key_length() const { return 16*1024; /* just to return something*/ } - + int index_init(uint idx, bool sorted); int index_read_map(uchar * buf, const uchar * key, @@ -211,19 +211,19 @@ public: virtual void start_bulk_insert(ha_rows rows); virtual int end_bulk_insert(); - + virtual int reset(); - + int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf); int multi_range_read_next(range_id_t *range_info); ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, - void *seq_init_param, + void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, COST_VECT *cost); ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, - uint key_parts, uint *bufsz, + uint key_parts, uint *bufsz, uint *flags, COST_VECT *cost); int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size); From 40d62823cdd635d3aa11e7677faf6ccf2f11633b Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 28 Sep 2012 14:01:52 +0400 Subject: [PATCH 261/439] Fix compile warnings --- storage/cassandra/ha_cassandra.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index d77a89bded3..3b0db24cff0 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -160,8 +160,8 @@ cassandra_default_thrift_host_update(THD *thd, if (new_host) { - strncpy(cassandra_default_host_buf, new_host, max_len); - cassandra_default_host_buf[max_len]= 0; + strncpy(cassandra_default_host_buf, new_host, max_len-1); + cassandra_default_host_buf[max_len-1]= 0; cassandra_default_thrift_host= cassandra_default_host_buf; } else @@ -539,10 +539,8 @@ int ha_cassandra::check_table_options(ha_table_option_struct *options) int ha_cassandra::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) { - ha_table_option_struct *options= table_arg->s->option_struct; int res; DBUG_ENTER("ha_cassandra::create"); - DBUG_ASSERT(options); Field **pfield= table_arg->s->field; if (!((*pfield)->flags & NOT_NULL_FLAG)) From aec2c55ac23bbbe32dd669eb291cb3d490795104 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 28 Sep 2012 14:02:59 +0400 Subject: [PATCH 262/439] Fix compile: expect Thrift where it is at buildbot. --- storage/cassandra/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index f11dfaf4a29..d5f63229512 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -12,7 +12,8 @@ SET(cassandra_sources gen-cpp/Cassandra.h) #INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) -INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) +INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) + # STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) From b59a64e2f3a48b9e584f73fde0962f4876b20f05 Mon Sep 17 00:00:00 2001 From: Annamalai Gurusami Date: Fri, 28 Sep 2012 16:02:58 +0530 Subject: [PATCH 263/439] 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 703d82c4ca62081cf1b890e56f6eac342b565b4c Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 28 Sep 2012 15:29:59 +0400 Subject: [PATCH 264/439] Include cassandra storage engine in tarballs --- cmake/build_configurations/mysql_release.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 5b2596491ad..1387eea4dcc 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -46,6 +46,8 @@ SET(FEATURE_SET_large 5) SET(FEATURE_SET_xlarge 6) SET(FEATURE_SET_community 7) +SET(WITH_CASSANDRA_STORAGE_ENGINE ON) + IF(FEATURE_SET) STRING(TOLOWER ${FEATURE_SET} feature_set) SET(num ${FEATURE_SET_${feature_set}}) From ce8484548b2a1e55bb6e1f798732f7d3a0e0c30d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 29 Sep 2012 16:01:24 +0300 Subject: [PATCH 265/439] Fix of MDEV-565: Server crashes in ha_cassandra::write_row on inserting NULL into a dynamic column Fixed incorrect initialization of variable which caused freeing memory by random address in case of error. --- mysql-test/r/cassandra.result | 9 +++++++++ mysql-test/t/cassandra.test | 10 ++++++++++ storage/cassandra/CMakeLists.txt | 2 ++ storage/cassandra/ha_cassandra.cc | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 3cf286013b8..f6703580b7b 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -546,3 +546,12 @@ insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); ERROR HY000: Encountered illegal format of dynamic column string delete from t1; DROP TABLE t1; +# +# MDEV-565: Server crashes in ha_cassandra::write_row on +# inserting NULL into a dynamic column +# +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +insert into t1 values (1, NULL); +delete from t1; +DROP TABLE t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index b0b29c52f21..9ddd6e23d55 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -634,6 +634,16 @@ insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a'); delete from t1; DROP TABLE t1; +--echo # +--echo # MDEV-565: Server crashes in ha_cassandra::write_row on +--echo # inserting NULL into a dynamic column +--echo # +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +insert into t1 values (1, NULL); +delete from t1; +DROP TABLE t1; + ############################################################################ ## Cassandra cleanup diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index d5f63229512..990012760e3 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -12,6 +12,8 @@ SET(cassandra_sources gen-cpp/Cassandra.h) #INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) + +#INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) # diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 3b0db24cff0..3b0772fc3e1 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1978,7 +1978,7 @@ int ha_cassandra::write_row(uchar *buf) { String valcol; DYNAMIC_ARRAY vals, names; - char *free_names; + char *free_names= NULL; int rc; DBUG_ASSERT(field_converters[i] == NULL); if (!(rc= read_dyncol(&vals, &names, &valcol, &free_names))) From 665c93f8a79a835f3eea642a90cce752ec123bdf Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 30 Sep 2012 07:58:01 +0300 Subject: [PATCH 266/439] Check of deleting whole dynamic columns. --- mysql-test/t/cassandra.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 9ddd6e23d55..cf0783a0ac8 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -644,6 +644,23 @@ insert into t1 values (1, NULL); delete from t1; DROP TABLE t1; +--echo # +--echo # strange side effect of Cassandra - remiving all columns of primary +--echo # key removes all row. +--echo # +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +INSERT INTO t1 VALUES(2,column_create("ab","ab")); +select rowkey, column_json(dyn) from t1; +UPDATE t1 set dyn=NULL; +select rowkey, column_json(dyn) from t1; +INSERT INTO t1 VALUES(2,column_create("ab","ab")); +select rowkey, column_json(dyn) from t1; +UPDATE t1 set dyn=""; +select rowkey, column_json(dyn) from t1; +delete from t1; +DROP TABLE t1; + ############################################################################ ## Cassandra cleanup From 540d0cd28eeb11abab578d189bbe748b930d8edc Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Mon, 1 Oct 2012 13:12:38 +0200 Subject: [PATCH 267/439] 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 268/439] 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 269/439] 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 270/439] 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 271/439] 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 272/439] 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 273/439] 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 274/439] 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 275/439] 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 276/439] 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 277/439] 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 278/439] 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 279/439] 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 280/439] 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 281/439] 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 282/439] 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 283/439] 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 284/439] 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 285/439] 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 286/439] From 93d60018dbe15effc540be37f7e52c8d3926fa1d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Oct 2012 16:02:27 +0200 Subject: [PATCH 287/439] From bdb4104cf6b658b0b614f2b5b3c690535fde3726 Mon Sep 17 00:00:00 2001 From: Neeraj Bisht Date: Tue, 16 Oct 2012 23:18:48 +0530 Subject: [PATCH 288/439] 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 289/439] 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 290/439] 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 291/439] 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 292/439] 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 293/439] 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 294/439] 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 295/439] 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 296/439] 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 297/439] 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 298/439] 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 299/439] 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 300/439] 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 301/439] 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 302/439] 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 303/439] From 7de6a91bfa3a040137ba5f5e54e232ed8b58558b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Oct 2012 14:52:17 +0100 Subject: [PATCH 304/439] From b5ee1cf5498eda48f8b3d3c2b9f51abd741be8ae Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Oct 2012 16:20:57 +0100 Subject: [PATCH 305/439] From 7c7de142a3816c787d82aa0be42a410c18880466 Mon Sep 17 00:00:00 2001 From: Shivji Kumar Jha Date: Tue, 30 Oct 2012 10:40:07 +0530 Subject: [PATCH 306/439] 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 307/439] 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 308/439] 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 309/439] 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 310/439] 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 311/439] 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 312/439] 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 313/439] 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 314/439] 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 315/439] 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 316/439] 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 317/439] 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 318/439] 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 319/439] 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 320/439] 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 321/439] 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 322/439] 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 323/439] 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 324/439] 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 325/439] 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 326/439] 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 327/439] From 14ba37f76f87cc48cae62eb6bdf3cda294dff78d Mon Sep 17 00:00:00 2001 From: Dmitry Lenev Date: Mon, 10 Dec 2012 10:06:37 +0400 Subject: [PATCH 328/439] 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 329/439] 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 330/439] 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 7e5ef4077918841e24fb5309a90bbaebbc530ebe Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 20 Dec 2012 13:10:09 +0400 Subject: [PATCH 331/439] Cassandra Storage Engine: - Partially address review feedback. - Update cassandra.test result result - make cassandra.test timezone-agnostic --- mysql-test/r/cassandra.result | 31 +++++++++-- mysql-test/t/cassandra.test | 7 ++- storage/cassandra/CMakeLists.txt | 3 +- storage/cassandra/cassandra_se.cc | 9 ---- storage/cassandra/ha_cassandra.cc | 90 +++++++------------------------ storage/cassandra/ha_cassandra.h | 75 +++----------------------- 6 files changed, 61 insertions(+), 154 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index f6703580b7b..4eae1983bf3 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -1,7 +1,7 @@ drop table if exists t0, t1; create table t1 (a int) engine=cassandra thrift_host='localhost' keyspace='foo' column_family='colfam'; -ERROR 42000: Incorrect column name 'First column must be NOT NULL' +ERROR 42000: This table type requires a primary key create table t1 (a int primary key, b int) engine=cassandra thrift_host='localhost' keyspace='foo' column_family='colfam'; ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace foo does not exist] @@ -356,6 +356,8 @@ drop table t2; # # Mapping TIMESTAMP -> int64 # +set @save_tz= @@time_zone; +set time_zone='UTC'; CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; insert into t2 values (1, '2012-08-29 01:23:45'); @@ -365,10 +367,11 @@ CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; select * from t2; rowkey datecol -1 1346192625000 -10 1346192626000 +1 1346203425000 +10 1346203426000 delete from t2; drop table t2; +set time_zone=@save_tz; # # Check whether changing parameters with ALTER TABLE works. # @@ -555,3 +558,25 @@ ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = insert into t1 values (1, NULL); delete from t1; DROP TABLE t1; +# +# strange side effect of Cassandra - remiving all columns of primary +# key removes all row. +# +CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) +ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; +INSERT INTO t1 VALUES(2,column_create("ab","ab")); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +2 [{"ab":"ab"}] +UPDATE t1 set dyn=NULL; +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +INSERT INTO t1 VALUES(2,column_create("ab","ab")); +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +2 [{"ab":"ab"}] +UPDATE t1 set dyn=""; +select rowkey, column_json(dyn) from t1; +rowkey column_json(dyn) +delete from t1; +DROP TABLE t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index cf0783a0ac8..542987a869a 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -8,9 +8,9 @@ drop table if exists t0, t1; --enable_warnings # Test various errors on table creation. ---error ER_WRONG_COLUMN_NAME +--error ER_REQUIRES_PRIMARY_KEY create table t1 (a int) engine=cassandra - thrift_host='localhost' keyspace='foo' column_family='colfam'; + thrift_host='localhost' keyspace='foo' column_family='colfam'; --error ER_CONNECT_TO_FOREIGN_DATA_SOURCE create table t1 (a int primary key, b int) engine=cassandra @@ -466,6 +466,8 @@ drop table t2; --echo # --echo # Mapping TIMESTAMP -> int64 --echo # +set @save_tz= @@time_zone; +set time_zone='UTC'; CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4'; insert into t2 values (1, '2012-08-29 01:23:45'); @@ -477,6 +479,7 @@ CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA select * from t2; delete from t2; drop table t2; +set time_zone=@save_tz; --echo # --echo # Check whether changing parameters with ALTER TABLE works. diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index 990012760e3..7e92d3cc0bd 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -14,7 +14,8 @@ SET(cassandra_sources #INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) #INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) -INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) +#INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) +INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) # STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) diff --git a/storage/cassandra/cassandra_se.cc b/storage/cassandra/cassandra_se.cc index 9e2b815c488..0d62c5af7a6 100644 --- a/storage/cassandra/cassandra_se.cc +++ b/storage/cassandra/cassandra_se.cc @@ -30,15 +30,6 @@ using namespace apache::thrift::protocol; using namespace org::apache::cassandra; -void Cassandra_se_interface::print_error(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - // it's not a problem if output was truncated - vsnprintf(err_buffer, sizeof(err_buffer), format, ap); - va_end(ap); -} - /* Implementation of connection to one Cassandra column family (ie., table) */ diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 3b0772fc3e1..5aa3226c9b4 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -542,13 +542,6 @@ int ha_cassandra::create(const char *name, TABLE *table_arg, int res; DBUG_ENTER("ha_cassandra::create"); - Field **pfield= table_arg->s->field; - if (!((*pfield)->flags & NOT_NULL_FLAG)) - { - my_error(ER_WRONG_COLUMN_NAME, MYF(0), "First column must be NOT NULL"); - DBUG_RETURN(HA_WRONG_CREATE_OPTION); - } - if (table_arg->s->keys != 1 || table_arg->s->primary_key !=0 || table_arg->key_info[0].key_parts != 1 || table_arg->key_info[0].key_part[0].fieldnr != 1) @@ -1680,7 +1673,7 @@ void ha_cassandra::print_conversion_error(const char *field_name, char buf[32]; char *p= cass_value; size_t i= 0; - for (; (i < (int)sizeof(buf)-1) && (p < cass_value + cass_value_len); p++) + for (; (i < sizeof(buf)-1) && (p < cass_value + cass_value_len); p++) { buf[i++]= map2number[(*p >> 4) & 0xF]; buf[i++]= map2number[*p & 0xF]; @@ -2163,7 +2156,7 @@ int ha_cassandra::info(uint flag) if (flag & HA_STATUS_VARIABLE) { stats.records= 1000; - //TODO: any other stats? + stats.deleted= 0; } if (flag & HA_STATUS_CONST) { @@ -2346,55 +2339,6 @@ int ha_cassandra::multi_range_read_explain_info(uint mrr_mode, char *str, size_t } -///////////////////////////////////////////////////////////////////////////// -// Dummy implementations start -///////////////////////////////////////////////////////////////////////////// - - -int ha_cassandra::index_next(uchar *buf) -{ - int rc; - DBUG_ENTER("ha_cassandra::index_next"); - rc= HA_ERR_WRONG_COMMAND; - DBUG_RETURN(rc); -} - - -int ha_cassandra::index_prev(uchar *buf) -{ - int rc; - DBUG_ENTER("ha_cassandra::index_prev"); - rc= HA_ERR_WRONG_COMMAND; - DBUG_RETURN(rc); -} - - -int ha_cassandra::index_first(uchar *buf) -{ - int rc; - DBUG_ENTER("ha_cassandra::index_first"); - rc= HA_ERR_WRONG_COMMAND; - DBUG_RETURN(rc); -} - -int ha_cassandra::index_last(uchar *buf) -{ - int rc; - DBUG_ENTER("ha_cassandra::index_last"); - rc= HA_ERR_WRONG_COMMAND; - DBUG_RETURN(rc); -} - - -ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, - key_range *max_key) -{ - DBUG_ENTER("ha_cassandra::records_in_range"); - //DBUG_RETURN(10); // low number to force index usage - DBUG_RETURN(HA_POS_ERROR); -} - - class Column_name_enumerator_impl : public Column_name_enumerator { ha_cassandra *obj; @@ -2550,13 +2494,6 @@ err: } -int ha_cassandra::extra(enum ha_extra_function operation) -{ - DBUG_ENTER("ha_cassandra::extra"); - DBUG_RETURN(0); -} - - /* The following function was copied from ha_blackhole::store_lock: */ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, THR_LOCK_DATA **to, @@ -2595,18 +2532,20 @@ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, } -int ha_cassandra::external_lock(THD *thd, int lock_type) +ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, + key_range *max_key) { - DBUG_ENTER("ha_cassandra::external_lock"); - DBUG_RETURN(0); + DBUG_ENTER("ha_cassandra::records_in_range"); + DBUG_RETURN(HA_POS_ERROR); /* Range scans are not supported */ } + int ha_cassandra::delete_table(const char *name) { DBUG_ENTER("ha_cassandra::delete_table"); /* Cassandra table is just a view. Dropping it doesn't affect the underlying - column family. + column family, so we do nothing here. */ DBUG_RETURN(0); } @@ -2632,9 +2571,15 @@ bool ha_cassandra::check_if_incompatible_data(HA_CREATE_INFO *info, } -///////////////////////////////////////////////////////////////////////////// -// Dummy implementations end -///////////////////////////////////////////////////////////////////////////// +void Cassandra_se_interface::print_error(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + // it's not a problem if output was truncated + my_vsnprintf(err_buffer, sizeof(err_buffer), format, ap); + va_end(ap); +} + static int show_cassandra_vars(THD *thd, SHOW_VAR *var, char *buff) { @@ -2655,6 +2600,7 @@ static struct st_mysql_show_var func_status[]= {0,0,SHOW_UNDEF} }; + maria_declare_plugin(cassandra) { MYSQL_STORAGE_ENGINE_PLUGIN, diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 947834685fd..3954c7850ef 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -139,18 +139,13 @@ public: */ ulonglong table_flags() const { - /* - HA_BINLOG_STMT_CAPABLE - We are saying that this engine is just statement capable to have - an engine that can only handle statement-based logging. This is - used in testing. - HA_REC_NOT_IN_SEQ - If we don't set it, filesort crashes, because it assumes rowids are - 1..8 byte numbers - */ return HA_BINLOG_STMT_CAPABLE | - HA_REC_NOT_IN_SEQ; - + HA_REC_NOT_IN_SEQ | + HA_NO_TRANSACTIONS | + HA_REQUIRE_PRIMARY_KEY | + HA_PRIMARY_KEY_IN_READ_INDEX | + HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | + HA_NO_AUTO_INCREMENT; } /** @brief @@ -239,65 +234,13 @@ private: CASSANDRA_TYPE_DEF * get_cassandra_field_def(char *cass_name, int cass_name_length); public: + int open(const char *name, int mode, uint test_if_locked); + int close(void); - /* - Everything below are methods that we implement in ha_example.cc. - - Most of these methods are not obligatory, skip them and - MySQL will treat them as not implemented - */ - /** @brief - We implement this in ha_example.cc; it's a required method. - */ - int open(const char *name, int mode, uint test_if_locked); // required - - /** @brief - We implement this in ha_example.cc; it's a required method. - */ - int close(void); // required - - /** @brief - We implement this in ha_example.cc. It's not an obligatory method; - skip it and and MySQL will treat it as not implemented. - */ int write_row(uchar *buf); - - /** @brief - We implement this in ha_example.cc. It's not an obligatory method; - skip it and and MySQL will treat it as not implemented. - */ int update_row(const uchar *old_data, uchar *new_data); - - /** @brief - We implement this in ha_example.cc. It's not an obligatory method; - skip it and and MySQL will treat it as not implemented. - */ int delete_row(const uchar *buf); - /** @brief - We implement this in ha_example.cc. It's not an obligatory method; - skip it and and MySQL will treat it as not implemented. - */ - int index_next(uchar *buf); - - /** @brief - We implement this in ha_example.cc. It's not an obligatory method; - skip it and and MySQL will treat it as not implemented. - */ - int index_prev(uchar *buf); - - /** @brief - We implement this in ha_example.cc. It's not an obligatory method; - skip it and and MySQL will treat it as not implemented. - */ - int index_first(uchar *buf); - - /** @brief - We implement this in ha_example.cc. It's not an obligatory method; - skip it and and MySQL will treat it as not implemented. - */ - int index_last(uchar *buf); - /** @brief Unlike index_init(), rnd_init() can be called two consecutive times without rnd_end() in between (it only makes sense if scan=1). In this @@ -312,8 +255,6 @@ public: int rnd_pos(uchar *buf, uchar *pos); ///< required void position(const uchar *record); ///< required int info(uint); ///< required - int extra(enum ha_extra_function operation); - int external_lock(THD *thd, int lock_type); ///< required int delete_all_rows(void); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); From 6b47b2fe986f22cc3db4c3b8727783a4b392909e Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 20 Dec 2012 14:15:56 +0400 Subject: [PATCH 332/439] Cassandra Storage Engine: Address review feedback part # 2 - Register counters directly in the array passed to maria_declare_plugin. As a consequence, FLUSH TABLES will reset the counters. - Update test results accordingly. --- mysql-test/r/cassandra.result | 14 +++---- storage/cassandra/ha_cassandra.cc | 62 +++++++++++-------------------- 2 files changed, 29 insertions(+), 47 deletions(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 4eae1983bf3..55607726458 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -74,8 +74,8 @@ Variable_name Value cassandra_insert_batch_size 100 show status like 'cassandra_row_insert%'; Variable_name Value -Cassandra_row_inserts 8 Cassandra_row_insert_batches 7 +Cassandra_row_inserts 8 CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; delete from t1; @@ -84,14 +84,14 @@ DELETE FROM t1 ORDER BY a LIMIT 1; DROP TABLE t1; show status like 'cassandra_row_insert%'; Variable_name Value -Cassandra_row_inserts 10 Cassandra_row_insert_batches 8 +Cassandra_row_inserts 10 # FLUSH STATUS doesn't work for our variables, just like with InnoDB. flush status; show status like 'cassandra_row_insert%'; Variable_name Value -Cassandra_row_inserts 10 -Cassandra_row_insert_batches 8 +Cassandra_row_insert_batches 0 +Cassandra_row_inserts 0 # # Batched Key Access # @@ -102,8 +102,8 @@ cassandra_multiget_batch_size 100 # MRR-related status variables: show status like 'cassandra_multi%'; Variable_name Value -Cassandra_multiget_reads 0 Cassandra_multiget_keys_scanned 0 +Cassandra_multiget_reads 0 Cassandra_multiget_rows_read 0 CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2'; @@ -129,8 +129,8 @@ rowkey a rowkey a 9 9 9 9 show status like 'cassandra_multi%'; Variable_name Value -Cassandra_multiget_reads 1 Cassandra_multiget_keys_scanned 10 +Cassandra_multiget_reads 1 Cassandra_multiget_rows_read 10 insert into t1 values(1, 8); insert into t1 values(3, 8); @@ -150,8 +150,8 @@ rowkey a rowkey a 9 9 9 9 show status like 'cassandra_multi%'; Variable_name Value -Cassandra_multiget_reads 2 Cassandra_multiget_keys_scanned 16 +Cassandra_multiget_reads 2 Cassandra_multiget_rows_read 16 delete from t1; drop table t1; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 5aa3226c9b4..d85fa942029 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -195,31 +195,7 @@ static struct st_mysql_sys_var* cassandra_system_variables[]= { NULL }; - -static SHOW_VAR cassandra_status_variables[]= { - {"row_inserts", - (char*) &cassandra_counters.row_inserts, SHOW_LONG}, - {"row_insert_batches", - (char*) &cassandra_counters.row_insert_batches, SHOW_LONG}, - - {"multiget_reads", - (char*) &cassandra_counters.multiget_reads, SHOW_LONG}, - {"multiget_keys_scanned", - (char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG}, - {"multiget_rows_read", - (char*) &cassandra_counters.multiget_rows_read, SHOW_LONG}, - - {"timeout_exceptions", - (char*) &cassandra_counters.timeout_exceptions, SHOW_LONG}, - {"unavailable_exceptions", - (char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG}, - {NullS, NullS, SHOW_LONG} -}; - - Cassandra_status_vars cassandra_counters; -Cassandra_status_vars cassandra_counters_copy; - /** @brief @@ -2581,26 +2557,32 @@ void Cassandra_se_interface::print_error(const char *format, ...) } -static int show_cassandra_vars(THD *thd, SHOW_VAR *var, char *buff) -{ - cassandra_counters_copy= cassandra_counters; - - var->type= SHOW_ARRAY; - var->value= (char *) &cassandra_status_variables; - return 0; -} - - struct st_mysql_storage_engine cassandra_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; -static struct st_mysql_show_var func_status[]= -{ - {"Cassandra", (char *)show_cassandra_vars, SHOW_FUNC}, - {0,0,SHOW_UNDEF} +static SHOW_VAR cassandra_status_variables[]= { + {"Cassandra_row_inserts", + (char*) &cassandra_counters.row_inserts, SHOW_LONG}, + {"Cassandra_row_insert_batches", + (char*) &cassandra_counters.row_insert_batches, SHOW_LONG}, + + {"Cassandra_multiget_keys_scanned", + (char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG}, + {"Cassandra_multiget_reads", + (char*) &cassandra_counters.multiget_reads, SHOW_LONG}, + {"Cassandra_multiget_rows_read", + (char*) &cassandra_counters.multiget_rows_read, SHOW_LONG}, + + {"Cassandra_timeout_exceptions", + (char*) &cassandra_counters.timeout_exceptions, SHOW_LONG}, + {"Cassandra_unavailable_exceptions", + (char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG}, + {NullS, NullS, SHOW_LONG} }; + + maria_declare_plugin(cassandra) { MYSQL_STORAGE_ENGINE_PLUGIN, @@ -2611,8 +2593,8 @@ maria_declare_plugin(cassandra) PLUGIN_LICENSE_GPL, cassandra_init_func, /* Plugin Init */ cassandra_done_func, /* Plugin Deinit */ - 0x0001, /* version number (0.1) */ - func_status, /* status variables */ + 0x0001, /* version number (0.1) */ + cassandra_status_variables, /* status variables */ cassandra_system_variables, /* system variables */ "0.1", /* string version */ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* maturity */ From 28c9e1a550bc9f2c2dbb28304d22552ea944cf07 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 20 Dec 2012 14:30:09 +0400 Subject: [PATCH 333/439] Cassandra Storage Engine: Address review feedback part #3 - Cleanup ha_cassandra::store_lock() - Remove dummy ha_cassandra::delete_table() - Add HA_TABLE_SCAN_ON_INDEX to table_flags() --- storage/cassandra/ha_cassandra.cc | 47 +++++++++++-------------------- storage/cassandra/ha_cassandra.h | 4 +-- 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index d85fa942029..a54190e080c 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1605,7 +1605,10 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, DBUG_ENTER("ha_cassandra::index_read_map"); if (find_flag != HA_READ_KEY_EXACT) + { + DBUG_ASSERT(0); /* Non-equality lookups should never be done */ DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } uint key_len= calculate_key_len(table, active_index, key, keypart_map); store_key_image_to_rec(table->field[0], (uchar*)key, key_len); @@ -2470,7 +2473,16 @@ err: } -/* The following function was copied from ha_blackhole::store_lock: */ +/* + We can't really have any locks for Cassandra Storage Engine. We're reading + from Cassandra cluster, and other clients can asynchronously modify the data. + + We can enforce locking within this process, but this will not be useful. + + Thus, store_lock() should express that: + - Writes do not block other writes + - Reads should not block anything either, including INSERTs. +*/ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) @@ -2478,27 +2490,13 @@ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, DBUG_ENTER("ha_cassandra::store_lock"); if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) { - /* - Here is where we get into the guts of a row level lock. - If TL_UNLOCK is set - If we are not doing a LOCK TABLE or DISCARD/IMPORT - TABLESPACE, then allow multiple writers - */ - + /* Writes allow other writes */ if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && - lock_type <= TL_WRITE) && !thd_in_lock_tables(thd) - && !thd_tablespace_op(thd)) + lock_type <= TL_WRITE)) lock_type = TL_WRITE_ALLOW_WRITE; - /* - In queries of type INSERT INTO t1 SELECT ... FROM t2 ... - MySQL would use the lock TL_READ_NO_INSERT on t2, and that - would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts - to t2. Convert the lock to a normal read lock to allow - concurrent inserts to t2. - */ - - if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) + /* Reads allow everything, including INSERTs */ + if (lock_type == TL_READ_NO_INSERT) lock_type = TL_READ; lock.type= lock_type; @@ -2516,17 +2514,6 @@ ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, } -int ha_cassandra::delete_table(const char *name) -{ - DBUG_ENTER("ha_cassandra::delete_table"); - /* - Cassandra table is just a view. Dropping it doesn't affect the underlying - column family, so we do nothing here. - */ - DBUG_RETURN(0); -} - - /** check_if_incompatible_data() called if ALTER TABLE can't detect otherwise if new and old definition are compatible diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 3954c7850ef..be8a49af493 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -145,7 +145,8 @@ public: HA_REQUIRE_PRIMARY_KEY | HA_PRIMARY_KEY_IN_READ_INDEX | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | - HA_NO_AUTO_INCREMENT; + HA_NO_AUTO_INCREMENT | + HA_TABLE_SCAN_ON_INDEX; } /** @brief @@ -258,7 +259,6 @@ public: int delete_all_rows(void); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); - int delete_table(const char *from); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); ///< required bool check_if_incompatible_data(HA_CREATE_INFO *info, From 7885b38cbb22df3c2d22a57ecb8993d540a36652 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 21 Dec 2012 15:17:26 +0100 Subject: [PATCH 334/439] 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 40ae63dd65fb9e812f29d3520acb0ba6b64d3005 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 23 Dec 2012 20:57:54 +0200 Subject: [PATCH 335/439] backport to 5.5 dyncol changes and names support --- include/ma_dyncol.h | 110 ++- include/my_sys.h | 7 +- mysql-test/r/cassandra.result | 2 +- mysql-test/r/dyncol.result | 116 ++- mysql-test/t/cassandra.test | 2 +- mysql-test/t/dyncol.test | 43 +- mysys/ma_dyncol.c | 1379 +++++++++++++++++++---------- mysys/string.c | 10 +- sql/item_cmpfunc.cc | 7 +- sql/item_create.cc | 89 +- sql/item_func.h | 2 +- sql/item_strfunc.cc | 154 ++-- sql/item_strfunc.h | 6 +- sql/lex.h | 3 - sql/sql_join_cache.cc | 4 +- sql/sql_yacc.yy | 27 - storage/cassandra/CMakeLists.txt | 4 +- storage/cassandra/ha_cassandra.cc | 227 ++--- storage/cassandra/ha_cassandra.h | 18 +- 19 files changed, 1428 insertions(+), 782 deletions(-) diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index 2264ec6f53f..78d3f15978c 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -38,12 +38,13 @@ how the offset are stored. */ #define MAX_DYNAMIC_COLUMN_LENGTH 0X1FFFFFFFL +#define MAX_DYNAMIC_COLUMN_LENGTH_NM 0XFFFFFFFFFL /* Limits of implementation */ -#define MAX_NAME_LENGTH 255 #define MAX_TOTAL_NAME_LENGTH 65535 +#define MAX_NAME_LENGTH (MAX_TOTAL_NAME_LENGTH/4) /* NO and OK is the same used just to show semantics */ #define ER_DYNCOL_NO ER_DYNCOL_OK @@ -72,7 +73,8 @@ enum enum_dynamic_column_type DYN_COL_DECIMAL, DYN_COL_DATETIME, DYN_COL_DATE, - DYN_COL_TIME + DYN_COL_TIME, + DYN_COL_DYNCOL }; typedef enum enum_dynamic_column_type DYNAMIC_COLUMN_TYPE; @@ -88,7 +90,6 @@ struct st_dynamic_column_value struct { LEX_STRING value; CHARSET_INFO *charset; - my_bool nonfreeable; } string; struct { decimal_digit_t buffer[DECIMAL_BUFF_LENGTH]; @@ -100,6 +101,8 @@ struct st_dynamic_column_value typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE; +/* old functions (deprecated) */ +#ifdef MADYNCOL_DEPRECATED enum enum_dyncol_func_result dynamic_column_create(DYNAMIC_COLUMN *str, uint column_nr, DYNAMIC_COLUMN_VALUE *value); @@ -109,21 +112,6 @@ dynamic_column_create_many(DYNAMIC_COLUMN *str, uint column_count, uint *column_numbers, DYNAMIC_COLUMN_VALUE *values); - -enum enum_dyncol_func_result -dynamic_column_create_many_fmt(DYNAMIC_COLUMN *str, - uint column_count, - uchar *column_keys, - DYNAMIC_COLUMN_VALUE *values, - my_bool names); -enum enum_dyncol_func_result -dynamic_column_create_many_internal_fmt(DYNAMIC_COLUMN *str, - uint column_count, - void *column_keys, - DYNAMIC_COLUMN_VALUE *values, - my_bool new_str, - my_bool string_keys); - enum enum_dyncol_func_result dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr, DYNAMIC_COLUMN_VALUE *value); @@ -133,73 +121,105 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, uint *column_numbers, DYNAMIC_COLUMN_VALUE *values); enum enum_dyncol_func_result -dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, - uint add_column_count, - void *column_keys, - DYNAMIC_COLUMN_VALUE *values, - my_bool string_keys); - -enum enum_dyncol_func_result dynamic_column_delete(DYNAMIC_COLUMN *org, uint column_nr); enum enum_dyncol_func_result dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr); + enum enum_dyncol_func_result -dynamic_column_exists_str(DYNAMIC_COLUMN *str, LEX_STRING *name); +dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); + enum enum_dyncol_func_result -dynamic_column_exists_fmt(DYNAMIC_COLUMN *str, void *key, my_bool string_keys); +dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr, + DYNAMIC_COLUMN_VALUE *store_it_here); +#endif + +/* new functions */ +enum enum_dyncol_func_result +mariadb_dyncol_create_many(DYNAMIC_COLUMN *str, + uint column_count, + uint *column_numbers, + DYNAMIC_COLUMN_VALUE *values, + my_bool new_string); +enum enum_dyncol_func_result +mariadb_dyncol_create_many_named(DYNAMIC_COLUMN *str, + uint column_count, + LEX_STRING *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool new_string); + + +enum enum_dyncol_func_result +mariadb_dyncol_update_many(DYNAMIC_COLUMN *str, + uint add_column_count, + uint *column_keys, + DYNAMIC_COLUMN_VALUE *values); +enum enum_dyncol_func_result +mariadb_dyncol_update_many_named(DYNAMIC_COLUMN *str, + uint add_column_count, + LEX_STRING *column_keys, + DYNAMIC_COLUMN_VALUE *values); + + +enum enum_dyncol_func_result +mariadb_dyncol_exists(DYNAMIC_COLUMN *org, uint column_nr); +enum enum_dyncol_func_result +mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, LEX_STRING *name); /* List of not NULL columns */ enum enum_dyncol_func_result -dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); +mariadb_dyncol_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); enum enum_dyncol_func_result -dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr); -enum enum_dyncol_func_result -dynamic_column_list_fmt(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array, my_bool string_keys); +mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, LEX_STRING **names); /* if the column do not exists it is NULL */ enum enum_dyncol_func_result -dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr, +mariadb_dyncol_get(DYNAMIC_COLUMN *org, uint column_nr, DYNAMIC_COLUMN_VALUE *store_it_here); enum enum_dyncol_func_result -dynamic_column_get_str(DYNAMIC_COLUMN *str, LEX_STRING *name, - DYNAMIC_COLUMN_VALUE *store_it_here); +mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, LEX_STRING *name, + DYNAMIC_COLUMN_VALUE *store_it_here); -my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str); +my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str); enum enum_dyncol_func_result -dynamic_column_check(DYNAMIC_COLUMN *str); +mariadb_dyncol_check(DYNAMIC_COLUMN *str); enum enum_dyncol_func_result -dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json); +mariadb_dyncol_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json); #define dynamic_column_initialize(A) memset((A), 0, sizeof(*(A))) #define dynamic_column_column_free(V) dynstr_free(V) /* conversion of values to 3 base types */ enum enum_dyncol_func_result -dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, +mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, CHARSET_INFO *cs, my_bool quote); enum enum_dyncol_func_result -dynamic_column_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val); +mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val); enum enum_dyncol_func_result -dynamic_column_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val); +mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val); enum enum_dyncol_func_result -dynamic_column_vals(DYNAMIC_COLUMN *str, - DYNAMIC_ARRAY *names, DYNAMIC_ARRAY *vals, - char **free_names); +mariadb_dyncol_unpack(DYNAMIC_COLUMN *str, + uint *count, + LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals); + +int mariadb_dyncol_column_cmp_named(const LEX_STRING *s1, const LEX_STRING *s2); + +enum enum_dyncol_func_result +mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count); /*************************************************************************** Internal functions, don't use if you don't know what you are doing... ***************************************************************************/ -#define dynamic_column_reassociate(V,P,L, A) dynstr_reassociate((V),(P),(L),(A)) +#define mariadb_dyncol_reassociate(V,P,L, A) dynstr_reassociate((V),(P),(L),(A)) -#define dynamic_column_value_init(V) (V)->type= DYN_COL_NULL +#define dyncol_value_init(V) (V)->type= DYN_COL_NULL /* Prepare value for using as decimal diff --git a/include/my_sys.h b/include/my_sys.h index 58a343bb789..f56c29afeae 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -794,11 +794,16 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...); extern my_bool dynstr_append_quoted(DYNAMIC_STRING *str, - const char *append, size_t len); + const char *append, size_t len, + char quote); extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); extern void dynstr_free(DYNAMIC_STRING *str); +extern uint32 copy_and_convert_extended(char *to, uint32 to_length, + CHARSET_INFO *to_cs, + const char *from, uint32 from_length, + CHARSET_INFO *from_cs, uint *errors); extern void dynstr_reassociate(DYNAMIC_STRING *str, char **res, size_t *length, size_t *alloc_length); extern uint32 copy_and_convert_extended(char *to, uint32 to_length, diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index 55607726458..b5ff3194480 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -532,7 +532,7 @@ delete from t1; drop table t1; CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1'; select * from t1; -ERROR HY000: Internal error: 'Unable to convert value for field `dyn` from Cassandra's data format. Name length exceed limit of 255: 'very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_ver' +ERROR HY000: Internal error: 'Unable to convert value for field `dyn` from Cassandra's data format. Name length exceed limit of 16383: 'very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_v' drop table t1; CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2'; diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 2e9a8462eee..c8d23d75d6c 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1342,22 +1342,22 @@ hex(COLUMN_CREATE(0, 0.0 as decimal)) set names utf8; select hex(column_create("адын", 1212)); hex(column_create("адын", 1212)) -040100080008000000D0B0D0B4D18BD0BD7809 +040100080000000000D0B0D0B4D18BD0BD7809 select hex(column_create("1212", 1212)); hex(column_create("1212", 1212)) -040100040004000000313231327809 +040100040000000000313231327809 select hex(column_create(1212, 2, "www", 3)); hex(column_create(1212, 2, "www", 3)) -04020007000300000004030008777777313231320604 +04020007000000000003001000777777313231320604 select hex(column_create("1212", 2, "www", 3)); hex(column_create("1212", 2, "www", 3)) -04020007000300000004030008777777313231320604 +04020007000000000003001000777777313231320604 select hex(column_create("1212", 2, 3, 3)); hex(column_create("1212", 2, 3, 3)) -0402000500010000000401000833313231320604 +0402000500000000000100100033313231320604 select hex(column_create("1212", 2, "адын", 1, 3, 3)); hex(column_create("1212", 2, "адын", 1, 3, 3)) -0403000D000100000004010008080500103331323132D0B0D0B4D18BD0BD060402 +0403000D000000000001001000050020003331323132D0B0D0B4D18BD0BD060402 set names default; # fetching column test (names) set names utf8; @@ -1413,10 +1413,10 @@ set names default; # column changing test (names) select hex(column_add(column_create(1, "AAA"), "b", "BBB")); hex(column_add(column_create(1, "AAA"), "b", "BBB")) -0402000200010000030101002331620841414108424242 +0402000200000003000100430031620841414108424242 select hex(column_add(column_create("1", "AAA"), "b", "BBB")); hex(column_add(column_create("1", "AAA"), "b", "BBB")) -0402000200010000030101002331620841414108424242 +0402000200000003000100430031620841414108424242 select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char); column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char) AAA @@ -1425,25 +1425,25 @@ column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char) BBB select hex(column_add(column_create("a", "AAA"), 1, "BBB")); hex(column_add(column_create("a", "AAA"), 1, "BBB")) -0402000200010000030101002331610842424208414141 +0402000200000003000100430031610842424208414141 select hex(column_add(column_create("a", "AAA"), "1", "BBB")); hex(column_add(column_create("a", "AAA"), "1", "BBB")) -0402000200010000030101002331610842424208414141 +0402000200000003000100430031610842424208414141 select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)); hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)) -04020002000100000001010010616278097809 +04020002000000000001002000616278097809 select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)); hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)) -040100010001000000617809 +040100010000000000617809 select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)); hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)) 0400000000 select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)); hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)) -040100010001000000617809 +040100010000000000617809 select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)); hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)) -040200020001000000010100086162167809 +040200020000000000010010006162167809 select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer); column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer) 11 @@ -1452,13 +1452,13 @@ column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, 1212 select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)); hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)) -040200020001000000010100106162780916 +040200020000000000010020006162780916 select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)); hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)) -040200020001000000010100106162780916 +040200020000000000010020006162780916 select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)); hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)) -040200020001000000010100086162167809 +040200020000000000010010006162167809 select hex(column_add(column_create("a", 1), "a", null)); hex(column_add(column_create("a", 1), "a", null)) 0400000000 @@ -1470,29 +1470,29 @@ column_list(column_add(column_create("a", 1), "a", "")) `a` select hex(column_add("", "a", 1)); hex(column_add("", "a", 1)) -0401000100010000006102 +0401000100000000006102 # column delete (names) select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")); hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")) -040100010001000000627809 +040100010000000000627809 select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")); hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")) -0402000200010000000101000861630206 +0402000200000000000100100061630206 select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)); hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)) -0403000300010000000101000801020010616263020406 +0403000300000000000100100002002000616263020406 select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")); hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")) -0402000200010000000101000861620204 +0402000200000000000100100061620204 select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")); hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")) -0403000300010000000101000801020010616263020406 +0403000300000000000100100002002000616263020406 select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")); hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")) -0401000100010000006306 +0401000100000000006306 select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")); hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")) -0401000100010000006102 +0401000100000000006102 select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")); hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")) 0400000000 @@ -1517,11 +1517,21 @@ ERROR 42S22: Unknown column 'color' in 'field list' # CREATE TABLE t1 (f1 tinyblob); INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30))); +select column_check(f1) from t1; +column_check(f1) +1 UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' ); Warnings: Warning 1265 Data truncated for column 'f1' at row 1 +select column_check(f1) from t1; +column_check(f1) +0 UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' ); -ERROR HY000: Encountered illegal format of dynamic column string +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +select column_check(f1) from t1; +column_check(f1) +0 drop table t1; # # MDEV-490/MDEV-491 null as arguments @@ -1550,8 +1560,8 @@ NULL # SELECT hex(COLUMN_CREATE(REPEAT('a',255),1)); hex(COLUMN_CREATE(REPEAT('a',255),1)) -040100FF00FF00000061616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616102 -SELECT hex(COLUMN_CREATE(REPEAT('a',256),1)); +040100FF000000000061616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616102 +SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1)); ERROR 22007: Illegal value used as argument of dynamic column function # # JSON conversion @@ -1577,3 +1587,53 @@ COLUMN_CHECK('') SELECT COLUMN_CHECK(NULL); COLUMN_CHECK(NULL) NULL +# +# escaping check +# +select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever")); +column_json(column_create("string", "'\"/\\`.,whatever")) hex(column_create("string", "'\"/\\`.,whatever")) +[{"string":"'\"/\\`.,whatever"}] 040100060000000300737472696E670827222F5C602E2C7768617465766572 +# +# embedding test +# +select column_json(column_create("val", "val", "emb", column_create("val2", "val2"))); +column_json(column_create("val", "val", "emb", column_create("val2", "val2"))) +[{"emb":[{"val2":"val2"}],{"val":"val"}] +select column_json(column_create(1, "val", 2, column_create(3, "val2"))); +column_json(column_create(1, "val", 2, column_create(3, "val2"))) +[{"1":"val"},{"2":[{"3":"val2"}]] +# +# Time encoding +# +select hex(column_create("t", "800:46:06.23434" AS time)) as hex, +column_json(column_create("t", "800:46:06.23434" AS time)) as json; +hex json +04010001000000070074649363B82003 [{"t":"800:46:06.234340"}] +select hex(column_create(1, "800:46:06.23434" AS time)) as hex, +column_json(column_create(1, "800:46:06.23434" AS time)) as json; +hex json +000100010007649363B82003 [{"1":"800:46:06.234340"}] +select hex(column_create("t", "800:46:06" AS time)) as hex, +column_json(column_create("t", "800:46:06" AS time)) as json; +hex json +04010001000000070074860B32 [{"t":"800:46:06"}] +select hex(column_create(1, "800:46:06" AS time)) as hex, +column_json(column_create(1, "800:46:06" AS time)) as json; +hex json +000100010007000060B82003 [{"1":"800:46:06"}] +select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex, +column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json; +hex json +0401000100000005007495B90F649363B80A00 [{"t":"2012-12-21 10:46:06.234340"}] +select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex, +column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json; +hex json +00010001000595B90F649363B80A00 [{"1":"2012-12-21 10:46:06.234340"}] +select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex, +column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json; +hex json +0401000100000005007495B90F86AB00 [{"t":"2012-12-21 10:46:06"}] +select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex, +column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json; +hex json +00010001000595B90F000060B80A00 [{"1":"2012-12-21 10:46:06"}] diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 542987a869a..93c81086de8 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -99,7 +99,7 @@ CREATE COLUMN FAMILY cfd1 WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND default_validation_class = UTF8Type; -SET cfd1['1']['very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_name']='1'; +SET cfd1['1']['very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_name']='1'; CREATE COLUMN FAMILY cfd2 WITH comparator = UTF8Type diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 143a833fe8d..de30cac610a 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -636,9 +636,14 @@ select COLUMN_CREATE(color, "black"); CREATE TABLE t1 (f1 tinyblob); INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30))); +select column_check(f1) from t1; UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' ); ---error ER_DYN_COL_WRONG_FORMAT +# we can't detect last string cut with 100% probability, +# because we detect it by string end +select column_check(f1) from t1; UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' ); +select column_check(f1) from t1; + drop table t1; --echo # @@ -657,7 +662,7 @@ SELECT COLUMN_ADD( NULL, 'val', 'col'); --echo # SELECT hex(COLUMN_CREATE(REPEAT('a',255),1)); --error ER_DYN_COL_DATA -SELECT hex(COLUMN_CREATE(REPEAT('a',256),1)); +SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1)); --echo # --echo # JSON conversion @@ -672,3 +677,37 @@ SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a')); SELECT COLUMN_CHECK('abracadabra'); SELECT COLUMN_CHECK(''); SELECT COLUMN_CHECK(NULL); + +--echo # +--echo # escaping check +--echo # +select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever")); + +--echo # +--echo # embedding test +--echo # +select column_json(column_create("val", "val", "emb", column_create("val2", "val2"))); +select column_json(column_create(1, "val", 2, column_create(3, "val2"))); + +--echo # +--echo # Time encoding +--echo # +select hex(column_create("t", "800:46:06.23434" AS time)) as hex, + column_json(column_create("t", "800:46:06.23434" AS time)) as json; +select hex(column_create(1, "800:46:06.23434" AS time)) as hex, + column_json(column_create(1, "800:46:06.23434" AS time)) as json; + +select hex(column_create("t", "800:46:06" AS time)) as hex, + column_json(column_create("t", "800:46:06" AS time)) as json; +select hex(column_create(1, "800:46:06" AS time)) as hex, + column_json(column_create(1, "800:46:06" AS time)) as json; + +select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex, + column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json; +select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex, + column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json; + +select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex, + column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json; +select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex, + column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json; diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index e7c9b835454..34bb8b9de3d 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2011, Monty Program Ab - Copyright (c) 2011, Oleksandr Byelkin +/* Copyright (c) 2011,2012 Monty Program Ab; + Copyright (c) 2011,2012 Oleksandr Byelkin Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -26,6 +26,40 @@ SUCH DAMAGE. */ +/* + Numeric format: + =============== + * Fixed header part + 1 byte flags: + 0,1 bits - - 1 + 2-7 bits - 0 + 2 bytes column counter + * Columns directory sorted by column number, each entry contains of: + 2 bytes column number + bytes (1-4) combined offset from beginning of + the data segment + 3 bit type + * Data of above columns size of data and length depend on type + + Columns with names: + =================== + * Fixed header part + 1 byte flags: + 0,1 bits - - 2 + 2 bit - 1 (means format with names) + 3,4 bits - 00 (means - 2, + now 2 is the only supported size) + 5-7 bits - 0 + 2 bytes column counter + * Variable header part (now it is actually fixed part) + (2) bytes size of stored names pool + * Column directory sorted by names, each consists of + (2) bytes offset of name + bytes (2-5)bytes combined offset from beginning of + the data segment + 4 bit type + * Names stored one after another + * Data of above columns size of data and length depend on type +*/ + #include "mysys_priv.h" #include #include @@ -40,14 +74,22 @@ uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, 2 bits which determinate size of offset in the header -1 */ /* mask to get above bits */ -#define DYNCOL_FLG_OFFSET 3 -#define DYNCOL_FLG_NAMES 4 -/* All known flags mask */ -#define DYNCOL_FLG_KNOWN 7 +#define DYNCOL_FLG_OFFSET (1|2) +#define DYNCOL_FLG_NAMES 4 +#define DYNCOL_FLG_NMOFFSET (8|16) +/** + All known flags mask that could be set. + + @note DYNCOL_FLG_NMOFFSET should be 0 for now. +*/ +#define DYNCOL_FLG_KNOWN (1|2|4) /* formats */ -#define DYNCOL_FMT_NUM 0 -#define DYNCOL_FMT_STR 1 +enum enum_dyncol_format +{ + dyncol_fmt_num= 0, + dyncol_fmt_str= 1 +}; /* dynamic column size reserve */ #define DYNCOL_SYZERESERVE 80 @@ -63,14 +105,15 @@ uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, #define FIXED_HEADER_SIZE_NM 5 #define COLUMN_NUMBER_SIZE 2 -/* 1 byte name length + 2 bytes offset from the name pool */ -#define COLUMN_NAMEPTR_SIZE 3 +/* 2 bytes offset from the name pool */ +#define COLUMN_NAMEPTR_SIZE 2 -#define MAX_OFFSET_LENGTH 5 +#define MAX_OFFSET_LENGTH 4 +#define MAX_OFFSET_LENGTH_NM 5 #define DYNCOL_NUM_CHAR 6 -my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str) +my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str) { if (str->length < 1) return FALSE; @@ -79,7 +122,7 @@ my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str) static enum enum_dyncol_func_result dynamic_column_time_store(DYNAMIC_COLUMN *str, - MYSQL_TIME *value); + MYSQL_TIME *value, enum enum_dyncol_format format); static enum enum_dyncol_func_result dynamic_column_date_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value); @@ -96,14 +139,14 @@ dynamic_column_get_internal(DYNAMIC_COLUMN *str, static enum enum_dyncol_func_result dynamic_column_exists_internal(DYNAMIC_COLUMN *str, uint num_key, LEX_STRING *str_key); -enum enum_dyncol_func_result +static enum enum_dyncol_func_result dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, uint add_column_count, void *column_keys, DYNAMIC_COLUMN_VALUE *values, my_bool string_keys); static int plan_sort_num(const void *a, const void *b); -static int plan_sort_str(const void *a, const void *b); +static int plan_sort_named(const void *a, const void *b); /* Structure to hold information about dynamic columns record and @@ -118,8 +161,8 @@ struct st_dyn_header size_t header_size; size_t nmpool_size; size_t data_size; - /* DYNCOL_FMT_NUM - numeric columns, DYNCOL_FMT_STR - column names */ - uint format; + /* dyncol_fmt_num - numeric columns, dyncol_fmt_str - column names */ + enum enum_dyncol_format format; uint column_count; uchar *entry, *data, *name; @@ -135,9 +178,6 @@ static inline my_bool read_fixed_header(DYN_HEADER *hdr, static void set_fixed_header(DYNAMIC_COLUMN *str, uint offset_size, uint column_count); -static my_bool type_and_offset_store(uchar *place, size_t offset_size, - DYNAMIC_COLUMN_TYPE type, - size_t offset); /* Calculate entry size (E) and header size (H) by offset size (O) and column @@ -154,8 +194,8 @@ static my_bool type_and_offset_store(uchar *place, size_t offset_size, Name pool size functions, for numeric format it is 0 */ -size_t name_size_num(void *keys __attribute__((unused)), - uint i __attribute__((unused))) +static size_t name_size_num(void *keys __attribute__((unused)), + uint i __attribute__((unused))) { return 0; } @@ -164,7 +204,7 @@ size_t name_size_num(void *keys __attribute__((unused)), /** Name pool size functions. */ -size_t name_size_str(void *keys, uint i) +static size_t name_size_named(void *keys, uint i) { return ((LEX_STRING *) keys)[i].length; } @@ -180,20 +220,30 @@ static int column_sort_num(const void *a, const void *b) return **((uint **)a) - **((uint **)b); } +/** + Comparator function for references on column numbers for qsort + (names format) +*/ + +int mariadb_dyncol_column_cmp_named(const LEX_STRING *s1, const LEX_STRING *s2) +{ + int rc= s1->length - s2->length; + if (rc == 0) + rc= memcmp((void *)s1->str, (void *)s2->str, + (size_t) s1->length); + return rc; +} + /** Comparator function for references on column numbers for qsort (names format) */ -static int column_sort_str(const void *a, const void *b) +static int column_sort_named(const void *a, const void *b) { - LEX_STRING *s1= *((LEX_STRING **)a); - LEX_STRING *s2= *((LEX_STRING **)b); - int rc= s1->length - s2->length; - if (rc == 0) - rc= memcmp((void *)s1->str, (void *)s2->str, (size_t) s1->length); - return rc; + return mariadb_dyncol_column_cmp_named(*((LEX_STRING **)a), + *((LEX_STRING **)b)); } @@ -211,7 +261,7 @@ static my_bool check_limit_num(const void *val) Check limit function (names format) */ -static my_bool check_limit_str(const void *val) +static my_bool check_limit_named(const void *val) { return (*((LEX_STRING **)val))->length > MAX_NAME_LENGTH; } @@ -221,7 +271,7 @@ static my_bool check_limit_str(const void *val) Write numeric format static header part. */ -void set_fixed_header_num(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) +static void set_fixed_header_num(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) { set_fixed_header(str, hdr->offset_size, hdr->column_count); hdr->header= (uchar *)str->str + FIXED_HEADER_SIZE; @@ -233,10 +283,14 @@ void set_fixed_header_num(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) Write names format static header part. */ -void set_fixed_header_str(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) +static void set_fixed_header_named(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) { - set_fixed_header(str, hdr->offset_size, hdr->column_count); - str->str[0]|= DYNCOL_FLG_NAMES; + DBUG_ASSERT(hdr->column_count <= 0xffff); + DBUG_ASSERT(hdr->offset_size <= MAX_OFFSET_LENGTH_NM); + /* size of data offset, named format flag, size of names offset (0 means 2) */ + str->str[0]= ((str->str[0] & ~(DYNCOL_FLG_OFFSET | DYNCOL_FLG_NMOFFSET)) | + (hdr->offset_size - 2) | DYNCOL_FLG_NAMES); + int2store(str->str + 1, hdr->column_count); /* columns number */ int2store(str->str + 3, hdr->nmpool_size); hdr->header= (uchar *)str->str + FIXED_HEADER_SIZE_NM; hdr->nmpool= hdr->header + hdr->header_size; @@ -244,6 +298,94 @@ void set_fixed_header_str(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) } +/** + Store offset and type information in the given place + + @param place Beginning of the index entry + @param offset_size Size of offset field in bytes + @param type Type to be written + @param offset Offset to be written +*/ + +static my_bool type_and_offset_store_num(uchar *place, size_t offset_size, + DYNAMIC_COLUMN_TYPE type, + size_t offset) +{ + ulong val = (((ulong) offset) << 3) | (type - 1); + DBUG_ASSERT(type != DYN_COL_NULL); + DBUG_ASSERT(((type - 1) & (~7)) == 0); /* fit in 3 bits */ + DBUG_ASSERT(offset_size >= 1 && offset_size <= 4); + + /* Index entry starts with column number; jump over it */ + place+= COLUMN_NUMBER_SIZE; + + switch (offset_size) { + case 1: + if (offset >= 0x1f) /* all 1 value is reserved */ + return TRUE; + place[0]= (uchar)val; + break; + case 2: + if (offset >= 0x1fff) /* all 1 value is reserved */ + return TRUE; + int2store(place, val); + break; + case 3: + if (offset >= 0x1fffff) /* all 1 value is reserved */ + return TRUE; + int3store(place, val); + break; + case 4: + if (offset >= 0x1fffffff) /* all 1 value is reserved */ + return TRUE; + int4store(place, val); + break; + default: + return TRUE; + } + return FALSE; +} + + +static my_bool type_and_offset_store_named(uchar *place, size_t offset_size, + DYNAMIC_COLUMN_TYPE type, + size_t offset) +{ + ulong val = (((ulong) offset) << 4) | (type - 1); + DBUG_ASSERT(type != DYN_COL_NULL); + DBUG_ASSERT(((type - 1) & (~0xf)) == 0); /* fit in 4 bits */ + DBUG_ASSERT(offset_size >= 2 && offset_size <= 5); + + /* Index entry starts with name offset; jump over it */ + place+= COLUMN_NAMEPTR_SIZE; + switch (offset_size) { + case 2: + if (offset >= 0xfff) /* all 1 value is reserved */ + return TRUE; + int2store(place, val); + break; + case 3: + if (offset >= 0xfffff) /* all 1 value is reserved */ + return TRUE; + int3store(place, val); + break; + case 4: + if (offset >= 0xfffffff) /* all 1 value is reserved */ + return TRUE; + int4store(place, val); + break; + case 5: + if (offset >= 0xfffffffff) /* all 1 value is reserved */ + return TRUE; + int5store(place, val); + break; + case 1: + default: + return TRUE; + } + return FALSE; +} + /** Write numeric format header entry 2 bytes - column number @@ -255,17 +397,17 @@ void set_fixed_header_str(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) @param offset offset of the data */ -my_bool put_header_entry_num(DYN_HEADER *hdr, - void *column_key, - DYNAMIC_COLUMN_VALUE *value, - size_t offset) +static my_bool put_header_entry_num(DYN_HEADER *hdr, + void *column_key, + DYNAMIC_COLUMN_VALUE *value, + size_t offset) { uint *column_number= (uint *)column_key; int2store(hdr->entry, *column_number); DBUG_ASSERT(hdr->nmpool_size == 0); - if (type_and_offset_store(hdr->entry, hdr->offset_size, - value->type, - offset)) + if (type_and_offset_store_num(hdr->entry, hdr->offset_size, + value->type, + offset)) return TRUE; hdr->entry= hdr->entry + hdr->entry_size; return FALSE; @@ -284,21 +426,20 @@ my_bool put_header_entry_num(DYN_HEADER *hdr, @param offset offset of the data */ -my_bool put_header_entry_str(DYN_HEADER *hdr, - void *column_key, - DYNAMIC_COLUMN_VALUE *value, - size_t offset) +static my_bool put_header_entry_named(DYN_HEADER *hdr, + void *column_key, + DYNAMIC_COLUMN_VALUE *value, + size_t offset) { LEX_STRING *column_name= (LEX_STRING *)column_key; DBUG_ASSERT(column_name->length <= MAX_NAME_LENGTH); - hdr->entry[0]= column_name->length; DBUG_ASSERT(hdr->name - hdr->nmpool < (long) 0x10000L); - int2store(hdr->entry + 1, hdr->name - hdr->nmpool); + int2store(hdr->entry, hdr->name - hdr->nmpool); memcpy(hdr->name, column_name->str, column_name->length); DBUG_ASSERT(hdr->nmpool_size != 0 || column_name->length == 0); - if (type_and_offset_store(hdr->entry + 1, hdr->offset_size, - value->type, - offset)) + if (type_and_offset_store_named(hdr->entry, hdr->offset_size, + value->type, + offset)) return TRUE; hdr->entry+= hdr->entry_size; hdr->name+= column_name->length; @@ -306,6 +447,119 @@ my_bool put_header_entry_str(DYN_HEADER *hdr, } +/** + Calculate length of offset field for given data length + + @param data_length Length of the data segment + + @return number of bytes +*/ + +static size_t dynamic_column_offset_bytes_num(size_t data_length) +{ + if (data_length < 0x1f) /* all 1 value is reserved */ + return 1; + if (data_length < 0x1fff) /* all 1 value is reserved */ + return 2; + if (data_length < 0x1fffff) /* all 1 value is reserved */ + return 3; + if (data_length < 0x1fffffff) /* all 1 value is reserved */ + return 4; + return MAX_OFFSET_LENGTH + 1; /* For an error generation*/ +} + +static size_t dynamic_column_offset_bytes_named(size_t data_length) +{ + if (data_length < 0xfff) /* all 1 value is reserved */ + return 2; + if (data_length < 0xfffff) /* all 1 value is reserved */ + return 3; + if (data_length < 0xfffffff) /* all 1 value is reserved */ + return 4; + if (data_length < 0xfffffffff) /* all 1 value is reserved */ + return 5; + return MAX_OFFSET_LENGTH_NM + 1; /* For an error generation */ +} + +/** + Read offset and type information from index entry + + @param type Where to put type info + @param offset Where to put offset info + @param place beginning of the type and offset + @param offset_size Size of offset field in bytes +*/ + +static my_bool type_and_offset_read_num(DYNAMIC_COLUMN_TYPE *type, + size_t *offset, + uchar *place, size_t offset_size) +{ + ulong UNINIT_VAR(val); + ulong UNINIT_VAR(lim); + + DBUG_ASSERT(offset_size >= 1 && offset_size <= 4); + + switch (offset_size) { + case 1: + val= (ulong)place[0]; + lim= 0x1f; + break; + case 2: + val= uint2korr(place); + lim= 0x1fff; + break; + case 3: + val= uint3korr(place); + lim= 0x1fffff; + break; + case 4: + val= uint4korr(place); + lim= 0x1fffffff; + break; + default: + DBUG_ASSERT(0); /* impossible */ + return 1; + } + *type= (val & 0x7) + 1; + *offset= val >> 3; + return (*offset >= lim); +} + +static my_bool type_and_offset_read_named(DYNAMIC_COLUMN_TYPE *type, + size_t *offset, + uchar *place, size_t offset_size) +{ + ulong UNINIT_VAR(val); + ulong UNINIT_VAR(lim); + DBUG_ASSERT(offset_size >= 2 && offset_size <= 5); + + switch (offset_size) { + case 2: + val= uint2korr(place); + lim= 0xfff; + break; + case 3: + val= uint3korr(place); + lim= 0xfffff; + break; + case 4: + val= uint4korr(place); + lim= 0xfffffff; + break; + case 5: + val= uint5korr(place); + lim= 0xfffffffff; + break; + case 1: + default: + DBUG_ASSERT(0); /* impossible */ + return 1; + } + *type= (val & 0xf) + 1; + *offset= val >> 4; + return (*offset >= lim); +} + /** Format descriptor, contain constants and function references for format processing @@ -321,6 +575,9 @@ struct st_service_funcs /*size of array element which stores keys */ uint key_size_in_array; + /* Maximum data offset size in bytes */ + size_t max_offset_size; + size_t (*name_size) (void *, uint); int (*column_sort) @@ -334,6 +591,11 @@ struct st_service_funcs DYNAMIC_COLUMN_VALUE *value, size_t offset); int (*plan_sort)(const void *a, const void *b); + size_t (*dynamic_column_offset_bytes)(size_t data_length); + my_bool (*type_and_offset_read)(DYNAMIC_COLUMN_TYPE *type, + size_t *offset, + uchar *place, size_t offset_size); + }; @@ -347,23 +609,29 @@ static struct st_service_funcs fmt_data[2]= FIXED_HEADER_SIZE, COLUMN_NUMBER_SIZE, sizeof(uint), + MAX_OFFSET_LENGTH, &name_size_num, &column_sort_num, &check_limit_num, &set_fixed_header_num, &put_header_entry_num, - &plan_sort_num + &plan_sort_num, + &dynamic_column_offset_bytes_num, + &type_and_offset_read_num }, { FIXED_HEADER_SIZE_NM, COLUMN_NAMEPTR_SIZE, sizeof(LEX_STRING), - &name_size_str, - &column_sort_str, - &check_limit_str, - &set_fixed_header_str, - &put_header_entry_str, - &plan_sort_str + MAX_OFFSET_LENGTH_NM, + &name_size_named, + &column_sort_named, + &check_limit_named, + &set_fixed_header_named, + &put_header_entry_named, + &plan_sort_named, + &dynamic_column_offset_bytes_named, + &type_and_offset_read_named } }; @@ -377,7 +645,7 @@ static struct st_service_funcs fmt_data[2]= @return ER_DYNCOL_* return code */ -enum enum_dyncol_func_result +static enum enum_dyncol_func_result init_read_hdr(DYN_HEADER *hdr, DYNAMIC_COLUMN *str) { if (read_fixed_header(hdr, str)) @@ -405,7 +673,7 @@ init_read_hdr(DYN_HEADER *hdr, DYNAMIC_COLUMN *str) @retval TRUE error */ -static my_bool dynamic_column_init_str(DYNAMIC_COLUMN *str, size_t size) +static my_bool dynamic_column_init_named(DYNAMIC_COLUMN *str, size_t size) { DBUG_ASSERT(size != 0); @@ -647,7 +915,8 @@ dynamic_column_sint_read(DYNAMIC_COLUMN_VALUE *store_it_here, */ static size_t -dynamic_column_value_len(DYNAMIC_COLUMN_VALUE *value) +dynamic_column_value_len(DYNAMIC_COLUMN_VALUE *value, + enum enum_dyncol_format format) { switch (value->type) { case DYN_COL_NULL: @@ -689,14 +958,22 @@ dynamic_column_value_len(DYNAMIC_COLUMN_VALUE *value) decimal_bin_size(precision, scale)); } case DYN_COL_DATETIME: - /* date+time in bits: 14 + 4 + 5 + 10 + 6 + 6 + 20 + 1 66bits ~= 9 bytes */ - return 9; + if (format == dyncol_fmt_num || value->x.time_value.second_part) + /* date+time in bits: 14 + 4 + 5 + 10 + 6 + 6 + 20 + 1 66bits ~= 9 bytes*/ + return 9; + else + return 6; case DYN_COL_DATE: /* date in dits: 14 + 4 + 5 = 23bits ~= 3bytes*/ return 3; case DYN_COL_TIME: - /* time in bits: 10 + 6 + 6 + 20 + 1 = 43bits ~= 6bytes*/ - return 6; + if (format == dyncol_fmt_num || value->x.time_value.second_part) + /* time in bits: 10 + 6 + 6 + 20 + 1 = 43bits ~= 6bytes*/ + return 6; + else + return 3; + case DYN_COL_DYNCOL: + return value->x.string.value.length; } DBUG_ASSERT(0); return 0; @@ -765,6 +1042,22 @@ dynamic_column_string_store(DYNAMIC_COLUMN *str, LEX_STRING *string, return ER_DYNCOL_OK; } +/** + Append the string with given string value. + + @param str the string where to put the value + @param val the value to put in the string + + @return ER_DYNCOL_* return code +*/ + +static enum enum_dyncol_func_result +dynamic_column_dyncol_store(DYNAMIC_COLUMN *str, LEX_STRING *string) +{ + if (dynstr_append_mem(str, string->str, string->length)) + return ER_DYNCOL_RESOURCE; + return ER_DYNCOL_OK; +} /** Read string value of given length from the packed string @@ -793,6 +1086,26 @@ dynamic_column_string_read(DYNAMIC_COLUMN_VALUE *store_it_here, return ER_DYNCOL_OK; } +/** + Read Dynamic columns packet string value of given length + from the packed string + + @param store_it_here The structure to store the value + @param data The packed string which should be read + @param length The length (in bytes) of the value in nthe string + + @return ER_DYNCOL_* return code +*/ + +static enum enum_dyncol_func_result +dynamic_column_dyncol_read(DYNAMIC_COLUMN_VALUE *store_it_here, + uchar *data, size_t length) +{ + store_it_here->x.string.charset= &my_charset_bin; + store_it_here->x.string.value.length= length; + store_it_here->x.string.value.str= (char*) data; + return ER_DYNCOL_OK; +} /** Append the string with given decimal value. @@ -835,7 +1148,7 @@ dynamic_column_decimal_store(DYNAMIC_COLUMN *str, @param value The value structure which sould be setup. */ -void dynamic_column_prepare_decimal(DYNAMIC_COLUMN_VALUE *value) +void mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE *value) { value->x.decimal.value.buf= value->x.decimal.buffer; value->x.decimal.value.len= DECIMAL_BUFF_LENGTH; @@ -844,6 +1157,12 @@ void dynamic_column_prepare_decimal(DYNAMIC_COLUMN_VALUE *value) decimal_make_zero(&value->x.decimal.value); } +void dynamic_column_prepare_decimal(DYNAMIC_COLUMN_VALUE *value) +{ + mariadb_dyncol_prepare_decimal(value); +} + + /** Read decimal value of given length from the string @@ -899,7 +1218,8 @@ dynamic_column_decimal_read(DYNAMIC_COLUMN_VALUE *store_it_here, */ static enum enum_dyncol_func_result -dynamic_column_date_time_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value) +dynamic_column_date_time_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value, + enum enum_dyncol_format format) { enum enum_dyncol_func_result rc; /* @@ -908,7 +1228,7 @@ dynamic_column_date_time_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value) <123456><123456><123456><123456><123456><123456><123456><123456><123456> */ if ((rc= dynamic_column_date_store(str, value)) || - (rc= dynamic_column_time_store(str, value))) + (rc= dynamic_column_time_store(str, value, format))) return rc; return ER_DYNCOL_OK; } @@ -934,11 +1254,12 @@ dynamic_column_date_time_read(DYNAMIC_COLUMN_VALUE *store_it_here, 12345678901234123412345 1123456789012345612345612345678901234567890 <123456><123456><123456><123456><123456><123456><123456><123456><123456> */ - if (length != 9) + if (length != 9 && length != 6) goto err; store_it_here->x.time_value.time_type= MYSQL_TIMESTAMP_DATETIME; if ((rc= dynamic_column_date_read_internal(store_it_here, data, 3)) || - (rc= dynamic_column_time_read_internal(store_it_here, data + 3, 6))) + (rc= dynamic_column_time_read_internal(store_it_here, data + 3, + length - 3))) goto err; return ER_DYNCOL_OK; @@ -958,7 +1279,8 @@ err: */ static enum enum_dyncol_func_result -dynamic_column_time_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value) +dynamic_column_time_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value, + enum enum_dyncol_format format) { uchar *buf; if (dynstr_realloc(str, 6)) @@ -980,19 +1302,35 @@ dynamic_column_time_store(DYNAMIC_COLUMN *str, MYSQL_TIME *value) DBUG_ASSERT(value->minute <= 59); DBUG_ASSERT(value->second <= 59); DBUG_ASSERT(value->second_part <= 999999); + if (format == dyncol_fmt_num || value->second_part) + { /* 00000!<-hours--><---microseconds---> 1123456789012345612345612345678901234567890 <123456><123456><123456><123456><123456><123456> */ - buf[0]= (value->second_part & 0xff); - buf[1]= ((value->second_part & 0xff00) >> 8); - buf[2]= (uchar)(((value->second & 0xf) << 4) | - ((value->second_part & 0xf0000) >> 16)); - buf[3]= ((value->minute << 2) | ((value->second & 0x30) >> 4)); - buf[4]= (value->hour & 0xff); - buf[5]= ((value->neg ? 0x4 : 0) | (value->hour >> 8)); - str->length+= 6; + buf[0]= (value->second_part & 0xff); + buf[1]= ((value->second_part & 0xff00) >> 8); + buf[2]= (uchar)(((value->second & 0xf) << 4) | + ((value->second_part & 0xf0000) >> 16)); + buf[3]= ((value->minute << 2) | ((value->second & 0x30) >> 4)); + buf[4]= (value->hour & 0xff); + buf[5]= ((value->neg ? 0x4 : 0) | (value->hour >> 8)); + str->length+= 6; + } + else + { + /* + !<-hours--> + 11234567890123456123456 + <123456><123456><123456> + */ + buf[0]= (value->second) | ((value->minute & 0x3) << 6); + buf[1]= (value->minute >> 2) | ((value->hour & 0xf) << 4); + buf[2]= (value->hour >> 4) | (value->neg ? 0x80 : 0); + str->length+= 3; + } + return ER_DYNCOL_OK; } @@ -1031,21 +1369,37 @@ static enum enum_dyncol_func_result dynamic_column_time_read_internal(DYNAMIC_COLUMN_VALUE *store_it_here, uchar *data, size_t length) { - if (length != 6) + if (length != 6 && length != 3) goto err; - /* - 00000!<-hours--><---microseconds---> - 1123456789012345612345612345678901234567890 - <123456><123456><123456><123456><123456><123456> - */ - store_it_here->x.time_value.second_part= (data[0] | - (data[1] << 8) | - ((data[2] & 0xf) << 16)); - store_it_here->x.time_value.second= ((data[2] >> 4) | - ((data[3] & 0x3) << 4)); - store_it_here->x.time_value.minute= (data[3] >> 2); - store_it_here->x.time_value.hour= (((((uint)data[5]) & 0x3 ) << 8) | data[4]); - store_it_here->x.time_value.neg= ((data[5] & 0x4) ? 1 : 0); + if (length == 6) + { + /* + 00000!<-hours--><---microseconds---> + 1123456789012345612345612345678901234567890 + <123456><123456><123456><123456><123456><123456> + */ + store_it_here->x.time_value.second_part= (data[0] | + (data[1] << 8) | + ((data[2] & 0xf) << 16)); + store_it_here->x.time_value.second= ((data[2] >> 4) | + ((data[3] & 0x3) << 4)); + store_it_here->x.time_value.minute= (data[3] >> 2); + store_it_here->x.time_value.hour= (((((uint)data[5]) & 0x3 ) << 8) | data[4]); + store_it_here->x.time_value.neg= ((data[5] & 0x4) ? 1 : 0); + } + else + { + /* + !<-hours--> + 11234567890123456123456 + <123456><123456><123456> + */ + store_it_here->x.time_value.second_part= 0; + store_it_here->x.time_value.second= (data[0] & 0x3f); + store_it_here->x.time_value.minute= (data[0] >> 6) | ((data[1] & 0xf) << 2); + store_it_here->x.time_value.hour= (data[1] >> 4) | ((data[2] & 0x3f) << 4); + store_it_here->x.time_value.neg= ((data[2] & 0x80) ? 1 : 0); + } if (store_it_here->x.time_value.second > 59 || store_it_here->x.time_value.minute > 59 || store_it_here->x.time_value.hour > 838 || @@ -1170,7 +1524,8 @@ err: */ static enum enum_dyncol_func_result -data_store(DYNAMIC_COLUMN *str, DYNAMIC_COLUMN_VALUE *value) +data_store(DYNAMIC_COLUMN *str, DYNAMIC_COLUMN_VALUE *value, + enum enum_dyncol_format format) { switch (value->type) { case DYN_COL_INT: @@ -1186,13 +1541,15 @@ data_store(DYNAMIC_COLUMN *str, DYNAMIC_COLUMN_VALUE *value) return dynamic_column_decimal_store(str, &value->x.decimal.value); case DYN_COL_DATETIME: /* date+time in bits: 14 + 4 + 5 + 5 + 6 + 6 40bits = 5 bytes */ - return dynamic_column_date_time_store(str, &value->x.time_value); + return dynamic_column_date_time_store(str, &value->x.time_value, format); case DYN_COL_DATE: /* date in dits: 14 + 4 + 5 = 23bits ~= 3bytes*/ return dynamic_column_date_store(str, &value->x.time_value); case DYN_COL_TIME: /* time in bits: 5 + 6 + 6 = 17bits ~= 3bytes*/ - return dynamic_column_time_store(str, &value->x.time_value); + return dynamic_column_time_store(str, &value->x.time_value, format); + case DYN_COL_DYNCOL: + return dynamic_column_dyncol_store(str, &value->x.string.value); case DYN_COL_NULL: break; /* Impossible */ } @@ -1201,117 +1558,6 @@ data_store(DYNAMIC_COLUMN *str, DYNAMIC_COLUMN_VALUE *value) } -/** - Calculate length of offset field for given data length - - @param data_length Length of the data segment - - @return number of bytes -*/ - -static size_t dynamic_column_offset_bytes(size_t data_length) -{ - if (data_length < 0x1f) /* all 1 value is reserved */ - return 1; - if (data_length < 0x1fff) /* all 1 value is reserved */ - return 2; - if (data_length < 0x1fffff) /* all 1 value is reserved */ - return 3; - if (data_length < 0x1fffffff) /* all 1 value is reserved */ - return 4; - return MAX_OFFSET_LENGTH; /* For future */ -} - -/** - Store offset and type information in the given place - - @param place Beginning of the index entry - @param offset_size Size of offset field in bytes - @param type Type to be written - @param offset Offset to be written -*/ - -static my_bool type_and_offset_store(uchar *place, size_t offset_size, - DYNAMIC_COLUMN_TYPE type, - size_t offset) -{ - ulong val = (((ulong) offset) << 3) | (type - 1); - DBUG_ASSERT(type != DYN_COL_NULL); - DBUG_ASSERT(((type - 1) & (~7)) == 0); /* fit in 3 bits */ - - /* Index entry starts with column number; Jump over it */ - place+= COLUMN_NUMBER_SIZE; - - switch (offset_size) { - case 1: - if (offset >= 0x1f) /* all 1 value is reserved */ - return TRUE; - place[0]= (uchar)val; - break; - case 2: - if (offset >= 0x1fff) /* all 1 value is reserved */ - return TRUE; - int2store(place, val); - break; - case 3: - if (offset >= 0x1fffff) /* all 1 value is reserved */ - return TRUE; - int3store(place, val); - break; - case 4: - if (offset >= 0x1fffffff) /* all 1 value is reserved */ - return TRUE; - int4store(place, val); - break; - default: - return TRUE; - } - return FALSE; -} - - -/** - Read offset and type information from index entry - - @param type Where to put type info - @param offset Where to put offset info - @param place beginning of the type and offset - @param offset_size Size of offset field in bytes -*/ - -static my_bool type_and_offset_read(DYNAMIC_COLUMN_TYPE *type, - size_t *offset, - uchar *place, size_t offset_size) -{ - ulong UNINIT_VAR(val); - ulong UNINIT_VAR(lim); - - switch (offset_size) { - case 1: - val= (ulong)place[0]; - lim= 0x1f; - break; - case 2: - val= uint2korr(place); - lim= 0x1fff; - break; - case 3: - val= uint3korr(place); - lim= 0x1fffff; - break; - case 4: - val= uint4korr(place); - lim= 0x1fffffff; - break; - default: - DBUG_ASSERT(0); /* impossible */ - } - *type= (val & 0x7) + 1; - *offset= val >> 3; - return (*offset >= lim); -} - - /** Write information to the fixed header @@ -1325,7 +1571,7 @@ static void set_fixed_header(DYNAMIC_COLUMN *str, uint column_count) { DBUG_ASSERT(column_count <= 0xffff); - DBUG_ASSERT(offset_size <= 4); + DBUG_ASSERT(offset_size <= MAX_OFFSET_LENGTH); str->str[0]= ((str->str[0] & ~DYNCOL_FLG_OFFSET) | (offset_size - 1)); /* size of offset */ int2store(str->str + 1, column_count); /* columns number */ @@ -1364,12 +1610,12 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, return ER_DYNCOL_RESOURCE; if (new_str) { - if (dynamic_column_init_str(str, - fmt->fixed_hdr + - hdr->header_size + - hdr->nmpool_size + - hdr->data_size + - DYNCOL_SYZERESERVE)) + if (dynamic_column_init_named(str, + fmt->fixed_hdr + + hdr->header_size + + hdr->nmpool_size + + hdr->data_size + + DYNCOL_SYZERESERVE)) goto err; } else @@ -1438,7 +1684,7 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, } /* Store value in 'str + str->length' and increase str->length */ - if ((rc= data_store(str, values + ord))) + if ((rc= data_store(str, values + ord, hdr->format))) goto err; } } @@ -1476,15 +1722,19 @@ calc_var_sizes(DYN_HEADER *hdr, { size_t tmp; hdr->column_count++; - hdr->data_size+= (tmp= dynamic_column_value_len(values + i)); + hdr->data_size+= (tmp= dynamic_column_value_len(values + i, + hdr->format)); if (tmp == (size_t) ~0) return ER_DYNCOL_DATA; hdr->nmpool_size+= (*fmt->name_size)(column_keys, i); } } - /* We can handle data up to 1fffffff = 536870911 bytes now */ - if ((hdr->offset_size= dynamic_column_offset_bytes(hdr->data_size)) >= - MAX_OFFSET_LENGTH) + /* + We can handle data up to 0x1fffffff (old format) and + 0xfffffffff (new format) bytes now. + */ + if ((hdr->offset_size= fmt->dynamic_column_offset_bytes(hdr->data_size)) >= + fmt->max_offset_size) return ER_DYNCOL_LIMIT; /* header entry is column number or string pointer + offset & type */ @@ -1506,7 +1756,7 @@ calc_var_sizes(DYN_HEADER *hdr, @return ER_DYNCOL_* return code */ -enum enum_dyncol_func_result +static enum enum_dyncol_func_result dynamic_column_create_many_internal_fmt(DYNAMIC_COLUMN *str, uint column_count, void *column_keys, @@ -1563,24 +1813,49 @@ dynamic_column_create_many(DYNAMIC_COLUMN *str, @param str String where to write the data @param column_count Number of columns in the arrays - @param column_keys Array of columns keys - @param values Array of columns value - @param names use string names as keys + @param column_numbers Array of columns numbers + @param values Array of columns values + @param new_string True if we need allocate new string @return ER_DYNCOL_* return code */ enum enum_dyncol_func_result -dynamic_column_create_many_fmt(DYNAMIC_COLUMN *str, - uint column_count, - uchar *column_keys, - DYNAMIC_COLUMN_VALUE *values, - my_bool names) +mariadb_dyncol_create_many(DYNAMIC_COLUMN *str, + uint column_count, + uint *column_numbers, + DYNAMIC_COLUMN_VALUE *values, + my_bool new_string) { - DBUG_ENTER("dynamic_column_create_many"); + DBUG_ENTER("mariadb_dyncol_create_many"); + DBUG_RETURN(dynamic_column_create_many_internal_fmt(str, column_count, + column_numbers, values, + new_string, FALSE)); +} + +/** + Create packed string which contains given columns + + @param str String where to write the data + @param column_count Number of columns in the arrays + @param column_keys Array of columns keys + @param values Array of columns value + @param new_string True if we need allocate new string + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +mariadb_dyncol_create_many_named(DYNAMIC_COLUMN *str, + uint column_count, + LEX_STRING *column_keys, + DYNAMIC_COLUMN_VALUE *values, + my_bool new_string) +{ + DBUG_ENTER("mariadb_dyncol_create_many_named"); DBUG_RETURN(dynamic_column_create_many_internal_fmt(str, column_count, column_keys, values, - TRUE, names)); + new_string, TRUE)); } /** @@ -1622,13 +1897,13 @@ static size_t get_length_interval(uchar *entry, uchar *entry_next, DYNAMIC_COLUMN_TYPE type, type_next; DBUG_ASSERT(entry < entry_next); - if (type_and_offset_read(&type, &offset, entry + COLUMN_NUMBER_SIZE, - offset_size)) + if (type_and_offset_read_num(&type, &offset, entry + COLUMN_NUMBER_SIZE, + offset_size)) return DYNCOL_OFFSET_ERROR; if (entry_next >= header_end) return (last_offset - offset); - if (type_and_offset_read(&type_next, &offset_next, - entry_next + COLUMN_NUMBER_SIZE, offset_size)) + if (type_and_offset_read_num(&type_next, &offset_next, + entry_next + COLUMN_NUMBER_SIZE, offset_size)) return DYNCOL_OFFSET_ERROR; return (offset_next - offset); } @@ -1653,13 +1928,15 @@ static size_t hdr_interval_length(DYN_HEADER *hdr, uchar *next_entry) DBUG_ASSERT(hdr->entry >= hdr->header); DBUG_ASSERT(next_entry <= hdr->header + hdr->header_size); - if (type_and_offset_read(&hdr->type, &hdr->offset, - hdr->entry + fmt->fixed_hdr_entry, hdr->offset_size)) + if ((*fmt->type_and_offset_read)(&hdr->type, &hdr->offset, + hdr->entry + fmt->fixed_hdr_entry, + hdr->offset_size)) return DYNCOL_OFFSET_ERROR; if (next_entry == hdr->header + hdr->header_size) return hdr->data_size - hdr->offset; - if (type_and_offset_read(&next_entry_type, &next_entry_offset, - next_entry + fmt->fixed_hdr_entry, hdr->offset_size)) + if ((*fmt->type_and_offset_read)(&next_entry_type, &next_entry_offset, + next_entry + fmt->fixed_hdr_entry, + hdr->offset_size)) return DYNCOL_OFFSET_ERROR; return (next_entry_offset - hdr->offset); } @@ -1688,7 +1965,7 @@ static int header_compar_num(const void *a, const void *b) static uchar *find_entry_num(DYN_HEADER *hdr, uint key) { uchar header_entry[2+4]; - DBUG_ASSERT(hdr->format == DYNCOL_FMT_NUM); + DBUG_ASSERT(hdr->format == dyncol_fmt_num); int2store(header_entry, key); return hdr->entry= bsearch(header_entry, hdr->header, (size_t)hdr->column_count, @@ -1696,6 +1973,39 @@ static uchar *find_entry_num(DYN_HEADER *hdr, uint key) } +/** + Read name from header entry + + @param hdr descriptor of dynamic column record + @param entry pointer to the header entry + @param name where to put name + + @return 0 ok + @return 1 error in data +*/ + +static my_bool read_name(DYN_HEADER *hdr, uchar *entry, LEX_STRING *name) +{ + size_t nmoffset= uint2korr(entry); + uchar *next_entry= entry + hdr->entry_size; + + if (nmoffset > hdr->nmpool_size) + return 1; + + name->str= (char *)hdr->nmpool + nmoffset; + if (next_entry == hdr->header + hdr->header_size) + name->length= hdr->nmpool_size - nmoffset; + else + { + size_t next_nmoffset= uint2korr(next_entry); + if (next_nmoffset > hdr->nmpool_size) + return 1; + name->length= next_nmoffset - nmoffset; + } + return 0; +} + + /** Find entry in the names format header by the column number @@ -1704,22 +2014,24 @@ static uchar *find_entry_num(DYN_HEADER *hdr, uint key) @return pointer to the entry or NULL */ -static uchar *find_entry_str(DYN_HEADER *hdr, LEX_STRING *key) +static uchar *find_entry_named(DYN_HEADER *hdr, LEX_STRING *key) { uchar *min= hdr->header; uchar *max= hdr->header + (hdr->column_count - 1) * hdr->entry_size; uchar *mid; - DBUG_ASSERT(hdr->format == DYNCOL_FMT_STR); + DBUG_ASSERT(hdr->format == dyncol_fmt_str); DBUG_ASSERT(hdr->nmpool != NULL); while (max >= min) { - uint len; + LEX_STRING name; int cmp; - mid= hdr->header + ((min - hdr->header) + (max - hdr->header)) / 2 / hdr->entry_size * hdr->entry_size; - len= mid[0]; - cmp= len - key->length; - if (cmp == 0) - cmp= memcmp(hdr->nmpool + uint2korr(mid + 1), key->str, len); + mid= hdr->header + ((min - hdr->header) + + (max - hdr->header)) / + 2 / + hdr->entry_size * hdr->entry_size; + if (read_name(hdr, mid, &name)) + return NULL; + cmp= mariadb_dyncol_column_cmp_named(&name, key); if (cmp < 0) min= mid + hdr->entry_size; else if (cmp > 0) @@ -1773,7 +2085,7 @@ find_column(DYN_HEADER *hdr, uint numkey, LEX_STRING *strkey) return TRUE; /* fix key */ - if (hdr->format == DYNCOL_FMT_NUM && strkey != NULL) + if (hdr->format == dyncol_fmt_num && strkey != NULL) { char *end; numkey= (uint) strtoul(strkey->str, &end, 10); @@ -1784,16 +2096,16 @@ find_column(DYN_HEADER *hdr, uint numkey, LEX_STRING *strkey) return 0; } } - else if (hdr->format == DYNCOL_FMT_STR && strkey == NULL) + else if (hdr->format == dyncol_fmt_str && strkey == NULL) { nmkey.str= backwritenum(nmkeybuff + sizeof(nmkeybuff), numkey); nmkey.length= (nmkeybuff + sizeof(nmkeybuff)) - nmkey.str; strkey= &nmkey; } - if (hdr->format == DYNCOL_FMT_NUM) + if (hdr->format == dyncol_fmt_num) hdr->entry= find_entry_num(hdr, numkey); else - hdr->entry= find_entry_str(hdr, strkey); + hdr->entry= find_entry_named(hdr, strkey); if (!hdr->entry) { @@ -1837,14 +2149,15 @@ static inline my_bool read_fixed_header(DYN_HEADER *hdr, (str->str[0] & (~DYNCOL_FLG_KNOWN))) return 1; hdr->format= ((str->str[0] & DYNCOL_FLG_NAMES) ? - DYNCOL_FMT_STR: - DYNCOL_FMT_NUM); + dyncol_fmt_str: + dyncol_fmt_num); if ((str->length < fmt_data[hdr->format].fixed_hdr)) return 1; /* Wrong header */ - hdr->offset_size= (str->str[0] & DYNCOL_FLG_OFFSET) + 1; + hdr->offset_size= (str->str[0] & DYNCOL_FLG_OFFSET) + 1 + + (hdr->format == dyncol_fmt_str ? 1 : 0); hdr->column_count= uint2korr(str->str + 1); - if (hdr->format == DYNCOL_FMT_STR) - hdr->nmpool_size= uint2korr(str->str + 3); + if (hdr->format == dyncol_fmt_str) + hdr->nmpool_size= uint2korr(str->str + 3); // only 2 bytes supported for now else hdr->nmpool_size= 0; return 0; @@ -1868,6 +2181,13 @@ dynamic_column_get(DYNAMIC_COLUMN *str, uint column_nr, return dynamic_column_get_internal(str, store_it_here, column_nr, NULL); } +enum enum_dyncol_func_result +mariadb_dyncol_get(DYNAMIC_COLUMN *str, uint column_nr, + DYNAMIC_COLUMN_VALUE *store_it_here) +{ + return dynamic_column_get_internal(str, store_it_here, column_nr, NULL); +} + /** Get dynamic column value by name @@ -1880,39 +2200,14 @@ dynamic_column_get(DYNAMIC_COLUMN *str, uint column_nr, */ enum enum_dyncol_func_result -dynamic_column_get_str(DYNAMIC_COLUMN *str, LEX_STRING *name, - DYNAMIC_COLUMN_VALUE *store_it_here) +mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, LEX_STRING *name, + DYNAMIC_COLUMN_VALUE *store_it_here) { DBUG_ASSERT(name != NULL); return dynamic_column_get_internal(str, store_it_here, 0, name); } -/** - Get dynamic column value by number or name - - @param str The packed string to extract the column - @param key Name or number of column to fetch - (depends on string_key) - @param store_it_here Where to store the extracted value - @param string_key True if we gave pointer to LEX_STRING. - - @return ER_DYNCOL_* return code -*/ - -enum enum_dyncol_func_result -dynamic_column_get_fmt(DYNAMIC_COLUMN *str, void *key, - DYNAMIC_COLUMN_VALUE *store_it_here, - my_bool string_key) -{ - DBUG_ASSERT(key != NULL); - if (string_key) - return dynamic_column_get_internal(str, store_it_here, - 0, (LEX_STRING *)key); - return dynamic_column_get_internal(str, store_it_here, - *((uint *)key), NULL); -} - static enum enum_dyncol_func_result dynamic_column_get_value(DYN_HEADER *hdr, DYNAMIC_COLUMN_VALUE *store_it_here) { @@ -1946,6 +2241,9 @@ dynamic_column_get_value(DYN_HEADER *hdr, DYNAMIC_COLUMN_VALUE *store_it_here) case DYN_COL_NULL: rc= ER_DYNCOL_OK; break; + case DYN_COL_DYNCOL: + rc= dynamic_column_dyncol_read(store_it_here, hdr->data, hdr->length); + break; default: rc= ER_DYNCOL_FORMAT; store_it_here->type= DYN_COL_NULL; @@ -2012,6 +2310,11 @@ dynamic_column_exists(DYNAMIC_COLUMN *str, uint column_nr) return dynamic_column_exists_internal(str, column_nr, NULL); } +enum enum_dyncol_func_result +mariadb_dyncol_exists(DYNAMIC_COLUMN *str, uint column_nr) +{ + return dynamic_column_exists_internal(str, column_nr, NULL); +} /** Check existence of the column in the packed string (by name) @@ -2023,34 +2326,13 @@ dynamic_column_exists(DYNAMIC_COLUMN *str, uint column_nr) */ enum enum_dyncol_func_result -dynamic_column_exists_str(DYNAMIC_COLUMN *str, LEX_STRING *name) +mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, LEX_STRING *name) { DBUG_ASSERT(name != NULL); return dynamic_column_exists_internal(str, 0, name); } -/** - Check existence of the column in the packed string (by name of number) - - @param str The packed string to check the column - @param key Name or number of column to fetch - (depends on string_key) - @param string_key True if we gave pointer to LEX_STRING. - - @return ER_DYNCOL_* return code -*/ - -enum enum_dyncol_func_result -dynamic_column_exists_fmt(DYNAMIC_COLUMN *str, void *key, my_bool string_key) -{ - DBUG_ASSERT(key != NULL); - if (string_key) - return dynamic_column_exists_internal(str, 0, (LEX_STRING *) key); - return dynamic_column_exists_internal(str, *((uint *)key), NULL); -} - - /** Check existence of the column in the packed string (by name of number) @@ -2093,9 +2375,14 @@ dynamic_column_exists_internal(DYNAMIC_COLUMN *str, uint num_key, @return ER_DYNCOL_* return code */ - enum enum_dyncol_func_result dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) +{ + return mariadb_dyncol_list(str, array_of_uint); +} + +enum enum_dyncol_func_result +mariadb_dyncol_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) { DYN_HEADER header; uchar *read; @@ -2109,7 +2396,7 @@ dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) if ((rc= init_read_hdr(&header, str)) < 0) return rc; - if (header.format != DYNCOL_FMT_NUM) + if (header.format != dyncol_fmt_num) return ER_DYNCOL_FORMAT; if (header.entry_size * header.column_count + FIXED_HEADER_SIZE > @@ -2135,21 +2422,24 @@ dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) List not-null columns in the packed string (any format) @param str The packed string - @param array_of_lexstr Where to put reference on created array + @param count Number of names in the list + @param names Where to put names list (should be freed) @return ER_DYNCOL_* return code */ enum enum_dyncol_func_result -dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr) +mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, LEX_STRING **names) { DYN_HEADER header; uchar *read; + char *pool; struct st_service_funcs *fmt; uint i; enum enum_dyncol_func_result rc; - bzero(array_of_lexstr, sizeof(*array_of_lexstr)); /* In case of errors */ + (*names)= 0; (*count)= 0; + if (str->length == 0) return ER_DYNCOL_OK; /* no columns */ @@ -2162,36 +2452,41 @@ dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr) str->length) return ER_DYNCOL_FORMAT; - if (init_dynamic_array(array_of_lexstr, sizeof(LEX_STRING), - header.column_count, 0)) + if (header.format == dyncol_fmt_num) + *names= my_malloc(sizeof(LEX_STRING) * header.column_count + + DYNCOL_NUM_CHAR * header.column_count, MYF(0)); + else + *names= my_malloc(sizeof(LEX_STRING) * header.column_count + + header.nmpool_size + header.column_count, MYF(0)); + if (!(*names)) return ER_DYNCOL_RESOURCE; + pool= ((char *)(*names)) + sizeof(LEX_STRING) * header.column_count; for (i= 0, read= header.header; i < header.column_count; i++, read+= header.entry_size) { - LEX_STRING tmp; - if (header.format == DYNCOL_FMT_NUM) + if (header.format == dyncol_fmt_num) { uint nm= uint2korr(read); - tmp.str= my_malloc(DYNCOL_NUM_CHAR, MYF(0)); - if (!tmp.str) - return ER_DYNCOL_RESOURCE; - tmp.length= snprintf(tmp.str, DYNCOL_NUM_CHAR, "%u", nm); + (*names)[i].str= pool; + pool+= DYNCOL_NUM_CHAR; + (*names)[i].length= + longlong2str(nm, (*names)[i].str, 10) - (*names)[i].str; } else { - tmp.length= read[0]; - tmp.str= my_malloc(tmp.length + 1, MYF(0)); - if(!tmp.str) - return ER_DYNCOL_RESOURCE; - memcpy(tmp.str, (const void *)header.nmpool + uint2korr(read + 1), - tmp.length); - tmp.str[tmp.length]= '\0'; // just for safety + LEX_STRING tmp; + if (read_name(&header, read, &tmp)) + return ER_DYNCOL_FORMAT; + (*names)[i].length= tmp.length; + (*names)[i].str= pool; + pool+= tmp.length + 1; + memcpy((*names)[i].str, (const void *)tmp.str, tmp.length); + (*names)[i].str[tmp.length]= '\0'; // just for safety } - /* Insert can't never fail as it's pre-allocated above */ - (void) insert_dynamic(array_of_lexstr, (uchar *)&tmp); } + (*count)= header.column_count; return ER_DYNCOL_OK; } @@ -2211,15 +2506,14 @@ static my_bool find_place(DYN_HEADER *hdr, void *key, my_bool string_keys) { uint mid, start, end, val; - int flag; + int UNINIT_VAR(flag); LEX_STRING str; char buff[DYNCOL_NUM_CHAR]; - my_bool need_conversion= ((string_keys ? DYNCOL_FMT_STR : DYNCOL_FMT_NUM) != + my_bool need_conversion= ((string_keys ? dyncol_fmt_str : dyncol_fmt_num) != hdr->format); - LINT_INIT(flag); /* 100 % safe */ /* new format can't be numeric if the old one is names */ DBUG_ASSERT(string_keys || - hdr->format == DYNCOL_FMT_NUM); + hdr->format == dyncol_fmt_num); start= 0; end= hdr->column_count -1; @@ -2243,13 +2537,11 @@ find_place(DYN_HEADER *hdr, void *key, my_bool string_keys) } else { - DBUG_ASSERT(hdr->format == DYNCOL_FMT_STR); - str.length= hdr->entry[0]; - str.str= (char *)hdr->nmpool + uint2korr(hdr->entry + 1); + DBUG_ASSERT(hdr->format == dyncol_fmt_str); + if (read_name(hdr, hdr->entry, &str)) + return 0; } - flag= ((LEX_STRING *) key)->length - str.length; - if (flag == 0) - flag= memcmp(((LEX_STRING *) key)->str, str.str, str.length); + flag= mariadb_dyncol_column_cmp_named((LEX_STRING *)key, &str); } if (flag <= 0) end= mid; @@ -2273,13 +2565,11 @@ find_place(DYN_HEADER *hdr, void *key, my_bool string_keys) } else { - DBUG_ASSERT(hdr->format == DYNCOL_FMT_STR); - str.length= hdr->entry[0]; - str.str= (char*) hdr->nmpool + uint2korr(hdr->entry + 1); + DBUG_ASSERT(hdr->format == dyncol_fmt_str); + if (read_name(hdr, hdr->entry, &str)) + return 0; } - flag= ((LEX_STRING *) key)->length - str.length; - if (flag == 0) - flag= memcmp(((LEX_STRING *) key)->str, str.str, str.length); + flag= mariadb_dyncol_column_cmp_named((LEX_STRING *)key, &str); } } if (flag > 0) @@ -2289,7 +2579,7 @@ find_place(DYN_HEADER *hdr, void *key, my_bool string_keys) /* - It is internal structure which describes plan of chenging the record + It is internal structure which describes a plan of changing the record of dynamic columns */ @@ -2321,15 +2611,10 @@ static int plan_sort_num(const void *a, const void *b) Sort function for plan by column name */ -static int plan_sort_str(const void *a, const void *b) +static int plan_sort_named(const void *a, const void *b) { - int res= (((LEX_STRING *)((PLAN *)a)->key)->length - - ((LEX_STRING *)((PLAN *)b)->key)->length); - if (res == 0) - res= memcmp(((LEX_STRING *)((PLAN *)a)->key)->str, - ((LEX_STRING *)((PLAN *)b)->key)->str, - ((LEX_STRING *)((PLAN *)a)->key)->length); - return res; + return mariadb_dyncol_column_cmp_named((LEX_STRING *)((PLAN *)a)->key, + (LEX_STRING *)((PLAN *)b)->key); } #define DELTA_CHECK(S, D, C) \ @@ -2354,7 +2639,7 @@ static int plan_sort_str(const void *a, const void *b) @return ER_DYNCOL_* return code */ -enum enum_dyncol_func_result +static enum enum_dyncol_func_result dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, uint add_column_count, DYN_HEADER *hdr, DYN_HEADER *new_hdr, @@ -2366,7 +2651,7 @@ dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, uint i, j, k; size_t all_headers_size; - if (dynamic_column_init_str(&tmp, + if (dynamic_column_init_named(&tmp, (new_fmt->fixed_hdr + new_hdr->header_size + new_hdr->nmpool_size + new_hdr->data_size + DYNCOL_SYZERESERVE))) @@ -2432,7 +2717,7 @@ dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, DYNAMIC_COLUMN_TYPE tp; char buff[DYNCOL_NUM_CHAR]; - if (hdr->format == DYNCOL_FMT_NUM) + if (hdr->format == dyncol_fmt_num) { if (convert) { @@ -2448,12 +2733,13 @@ dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, } else { - name.length= read[0]; - name.str= (char *) hdr->nmpool + uint2korr(read + 1); + if (read_name(hdr, read, &name)) + goto err; key= &name; } - if (type_and_offset_read(&tp, &offs, - read + fmt->fixed_hdr_entry, hdr->offset_size)) + if (fmt->type_and_offset_read(&tp, &offs, + read + fmt->fixed_hdr_entry, + hdr->offset_size)) goto err; if (k == start) first_offset= offs; @@ -2496,7 +2782,7 @@ dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, plan[i].val, tmp.length - all_headers_size)) goto err; - data_store(&tmp, plan[i].val); /* Append new data */ + data_store(&tmp, plan[i].val, new_hdr->format); /* Append new data */ } } } @@ -2508,7 +2794,7 @@ err: return ER_DYNCOL_FORMAT; } -enum enum_dyncol_func_result +static enum enum_dyncol_func_result dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, size_t offset_size, size_t entry_size, @@ -2570,9 +2856,9 @@ dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, { DYNAMIC_COLUMN_TYPE tp; - if (type_and_offset_read(&tp, &first_offset, - header_base + start * entry_size + - COLUMN_NUMBER_SIZE, offset_size)) + if (type_and_offset_read_num(&tp, &first_offset, + header_base + start * entry_size + + COLUMN_NUMBER_SIZE, offset_size)) return ER_DYNCOL_FORMAT; } /* find data to be moved */ @@ -2617,8 +2903,8 @@ dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, DYNAMIC_COLUMN_TYPE tp; nm= uint2korr(read); /* Column nummber */ - if (type_and_offset_read(&tp, &offs, read + COLUMN_NUMBER_SIZE, - offset_size)) + if (type_and_offset_read_num(&tp, &offs, read + COLUMN_NUMBER_SIZE, + offset_size)) return ER_DYNCOL_FORMAT; if (k > start && offs < first_offset) @@ -2630,7 +2916,7 @@ dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, offs+= plan[i].ddelta; int2store(write, nm); /* write rest of data at write + COLUMN_NUMBER_SIZE */ - type_and_offset_store(write, new_offset_size, tp, offs); + type_and_offset_store_num(write, new_offset_size, tp, offs); write+= new_entry_size; } } @@ -2641,9 +2927,9 @@ dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) { int2store(write, *((uint *)plan[i].key)); - type_and_offset_store(write, new_offset_size, - plan[i].val[0].type, - curr_offset); + type_and_offset_store_num(write, new_offset_size, + plan[i].val[0].type, + curr_offset); write+= new_entry_size; curr_offset+= plan[i].length; } @@ -2690,14 +2976,15 @@ dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, { if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) { - data_store(str, plan[i].val); /* Append new data */ + data_store(str, plan[i].val, dyncol_fmt_num);/* Append new data */ } } } return ER_DYNCOL_OK; } -enum enum_dyncol_func_result +#ifdef UNUSED +static enum enum_dyncol_func_result dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, size_t offset_size, size_t entry_size, @@ -2759,8 +3046,10 @@ dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, { DYNAMIC_COLUMN_TYPE tp; - type_and_offset_read(&tp, &first_offset, - header_base + start * entry_size + COLUMN_NUMBER_SIZE, offset_size); + type_and_offset_read_num(&tp, &first_offset, + header_base + + start * entry_size + COLUMN_NUMBER_SIZE, + offset_size); } /* find data to be moved */ if (start < end) @@ -2804,7 +3093,8 @@ dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, DYNAMIC_COLUMN_TYPE tp; nm= uint2korr(read); /* Column nummber */ - type_and_offset_read(&tp, &offs, read + COLUMN_NUMBER_SIZE, offset_size); + type_and_offset_read_num(&tp, &offs, read + COLUMN_NUMBER_SIZE, + offset_size); if (k > start && offs < first_offset) { str->length= 0; // just something valid @@ -2814,7 +3104,7 @@ dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, offs+= plan[i].ddelta; int2store(write, nm); /* write rest of data at write + COLUMN_NUMBER_SIZE */ - if (type_and_offset_store(write, new_offset_size, tp, offs)) + if (type_and_offset_store_num(write, new_offset_size, tp, offs)) { str->length= 0; // just something valid return ER_DYNCOL_FORMAT; @@ -2829,9 +3119,9 @@ dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) { int2store(write, *((uint *)plan[i].key)); - if (type_and_offset_store(write, new_offset_size, - plan[i].val[0].type, - curr_offset)) + if (type_and_offset_store_num(write, new_offset_size, + plan[i].val[0].type, + curr_offset)) { str->length= 0; // just something valid return ER_DYNCOL_FORMAT; @@ -2882,13 +3172,13 @@ dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, { if( plan[i].act == PLAN_ADD || plan[i].act == PLAN_REPLACE) { - data_store(str, plan[i].val); /* Append new data */ + data_store(str, plan[i].val, dyncol_fmt_num); /* Append new data */ } } } return ER_DYNCOL_OK; } - +#endif /** Update the packed string with the given columns @@ -2913,7 +3203,27 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str, values, FALSE); } -uint numlen(uint val) +enum enum_dyncol_func_result +mariadb_dyncol_update_many(DYNAMIC_COLUMN *str, + uint add_column_count, + uint *column_numbers, + DYNAMIC_COLUMN_VALUE *values) +{ + return dynamic_column_update_many_fmt(str, add_column_count, column_numbers, + values, FALSE); +} + +enum enum_dyncol_func_result +mariadb_dyncol_update_many_named(DYNAMIC_COLUMN *str, + uint add_column_count, + LEX_STRING *column_names, + DYNAMIC_COLUMN_VALUE *values) +{ + return dynamic_column_update_many_fmt(str, add_column_count, column_names, + values, TRUE); +} + +static uint numlen(uint val) { uint res; if (val == 0) @@ -2927,7 +3237,7 @@ uint numlen(uint val) return res; } -enum enum_dyncol_func_result +static enum enum_dyncol_func_result dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, uint add_column_count, void *column_keys, @@ -2952,7 +3262,7 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, bzero(&header, sizeof(header)); bzero(&new_header, sizeof(new_header)); - new_header.format= (string_keys ? DYNCOL_FMT_STR : DYNCOL_FMT_NUM); + new_header.format= (string_keys ? dyncol_fmt_str : dyncol_fmt_num); new_fmt= fmt_data + new_header.format; /* @@ -2997,8 +3307,8 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, goto end; fmt= fmt_data + header.format; /* new format can't be numeric if the old one is names */ - DBUG_ASSERT(new_header.format == DYNCOL_FMT_STR || - header.format == DYNCOL_FMT_NUM); + DBUG_ASSERT(new_header.format == dyncol_fmt_str || + header.format == dyncol_fmt_num); if (header.column_count == 0) goto create_new_string; @@ -3006,8 +3316,8 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, new_header.column_count= header.column_count; new_header.nmpool_size= header.nmpool_size; - if ((convert= (new_header.format == DYNCOL_FMT_STR && - header.format == DYNCOL_FMT_NUM))) + if ((convert= (new_header.format == dyncol_fmt_str && + header.format == dyncol_fmt_num))) { DBUG_ASSERT(new_header.nmpool_size == 0); for(i= 0, header.entry= header.header; @@ -3064,12 +3374,18 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, goto end; } - //get_length(header.entry, header.dtpool, header.offset_size, - //header.data_size); - if (new_header.format == DYNCOL_FMT_STR) + if (new_header.format == dyncol_fmt_str) { - if (header.format == DYNCOL_FMT_STR) - entry_name_size= header.entry[0]; + if (header.format == dyncol_fmt_str) + { + LEX_STRING name; + if (read_name(&header, header.entry, &name)) + { + rc= ER_DYNCOL_FORMAT; + goto end; + } + entry_name_size= name.length; + } else entry_name_size= numlen(uint2korr(header.entry)); } @@ -3089,14 +3405,15 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, plan[i].act= PLAN_REPLACE; /* get data delta in bytes */ - if ((plan[i].length= dynamic_column_value_len(plan[i].val)) == + if ((plan[i].length= dynamic_column_value_len(plan[i].val, + new_header.format)) == (size_t) ~0) { rc= ER_DYNCOL_DATA; goto end; } data_delta+= plan[i].length - entry_data_size; - if (new_header.format == DYNCOL_FMT_STR) + if (new_header.format == dyncol_fmt_str) { name_delta+= ((LEX_STRING *)(plan[i].key))->length - entry_name_size; } @@ -3117,14 +3434,15 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, plan[i].act= PLAN_ADD; header_delta++; /* One more row in header */ /* get data delta in bytes */ - if ((plan[i].length= dynamic_column_value_len(plan[i].val)) == + if ((plan[i].length= dynamic_column_value_len(plan[i].val, + new_header.format)) == (size_t) ~0) { rc= ER_DYNCOL_DATA; goto end; } data_delta+= plan[i].length; - if (new_header.format == DYNCOL_FMT_STR) + if (new_header.format == dyncol_fmt_str) name_delta+= ((LEX_STRING *)plan[i].key)->length; } } @@ -3143,18 +3461,18 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, */ new_header.data_size= header.data_size + data_delta; new_header.nmpool_size= new_header.nmpool_size + name_delta; - DBUG_ASSERT(new_header.format != DYNCOL_FMT_NUM || + DBUG_ASSERT(new_header.format != dyncol_fmt_num || new_header.nmpool_size == 0); if ((new_header.offset_size= - dynamic_column_offset_bytes(new_header.data_size)) >= - MAX_OFFSET_LENGTH) + new_fmt->dynamic_column_offset_bytes(new_header.data_size)) >= + new_fmt->max_offset_size) { rc= ER_DYNCOL_LIMIT; goto end; } copy= ((header.format != new_header.format) || - (new_header.format == DYNCOL_FMT_STR)); + (new_header.format == dyncol_fmt_str)); /* if (new_header.offset_size!=offset_size) then we have to rewrite header */ header_delta_sign= ((int)new_header.offset_size + new_fmt->fixed_hdr_entry) - @@ -3173,14 +3491,14 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, /* Need copy because: - 1. Header/data parts moved in different directions. + 1, Header/data parts moved in different directions. 2. There is no enough allocated space in the string. 3. Header and data moved in different directions. */ - if (copy || /*1*/ - str->max_length < str->length + header_delta + data_delta || /*2*/ + if (copy || /*1.*/ + str->max_length < str->length + header_delta + data_delta || /*2.*/ ((header_delta_sign < 0 && data_delta_sign > 0) || - (header_delta_sign > 0 && data_delta_sign < 0))) /*3*/ + (header_delta_sign > 0 && data_delta_sign < 0))) /*3.*/ rc= dynamic_column_update_copy(str, plan, add_column_count, &header, &new_header, convert); @@ -3246,7 +3564,7 @@ int dynamic_column_update(DYNAMIC_COLUMN *str, uint column_nr, enum enum_dyncol_func_result -dynamic_column_check(DYNAMIC_COLUMN *str) +mariadb_dyncol_check(DYNAMIC_COLUMN *str) { struct st_service_funcs *fmt; enum enum_dyncol_func_result rc= ER_DYNCOL_FORMAT; @@ -3297,7 +3615,7 @@ dynamic_column_check(DYNAMIC_COLUMN *str) header.header_size - header.nmpool_size; /* read and check headers */ - if (header.format == DYNCOL_FMT_NUM) + if (header.format == dyncol_fmt_num) { key= # prev_key= &prev_num; @@ -3312,20 +3630,28 @@ dynamic_column_check(DYNAMIC_COLUMN *str) i++, header.entry+= header.entry_size) { - if (header.format == DYNCOL_FMT_NUM) + if (header.format == dyncol_fmt_num) { num= uint2korr(header.entry); } else { - DBUG_ASSERT(header.format == DYNCOL_FMT_STR); - name.length= header.entry[0]; - name_offset= uint2korr(header.entry + 1); - name.str= (char *)header.nmpool + name_offset; + DBUG_ASSERT(header.format == dyncol_fmt_str); + if (read_name(&header, header.entry, &name)) + { + DBUG_PRINT("info", ("Reading name failed: Field order: %u" + " Name offset: %u" + " Name pool size: %u", + (uint) i, + uint2korr(header.entry), + (uint)header.nmpool_size)); + goto end; + } + name_offset= name.str - (char *)header.nmpool; } - if (type_and_offset_read(&type, &data_offset, - header.entry + fmt->fixed_hdr_entry, - header.offset_size)) + if ((*fmt->type_and_offset_read)(&type, &data_offset, + header.entry + fmt->fixed_hdr_entry, + header.offset_size)) goto end; DBUG_ASSERT(type != DYN_COL_NULL); @@ -3334,17 +3660,8 @@ dynamic_column_check(DYNAMIC_COLUMN *str) DBUG_PRINT("info", ("Field order: %u Data offset: %u" " > Data pool size: %u", (uint)i, - (uint)name_offset, - (uint)header.nmpool_size)); - goto end; - } - if (name_offset > header.nmpool_size) - { - DBUG_PRINT("info", ("Field order: %u Name offset: %u" - " > Name pool size: %u", - (uint)i, - (uint)name_offset, - (uint)header.nmpool_size)); + (uint)data_offset, + (uint)header.data_size)); goto end; } if (prev_type != DYN_COL_NULL) @@ -3389,9 +3706,9 @@ dynamic_column_check(DYNAMIC_COLUMN *str) { DYNAMIC_COLUMN_VALUE store; // already checked by previouse pass - type_and_offset_read(&header.type, &header.offset, - header.entry + fmt->fixed_hdr_entry, - header.offset_size); + (*fmt->type_and_offset_read)(&header.type, &header.offset, + header.entry + fmt->fixed_hdr_entry, + header.offset_size); header.length= hdr_interval_length(&header, header.entry + header.entry_size); header.data= header.dtpool + header.offset; @@ -3421,6 +3738,9 @@ dynamic_column_check(DYNAMIC_COLUMN *str) case DYN_COL_TIME: rc= dynamic_column_time_read(&store, header.data, header.length); break; + case DYN_COL_DYNCOL: + rc= dynamic_column_dyncol_read(&store, header.data, header.length); + break; case DYN_COL_NULL: default: rc= ER_DYNCOL_FORMAT; @@ -3442,13 +3762,13 @@ end: enum enum_dyncol_func_result -dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, - CHARSET_INFO *cs, my_bool quote) +mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, + CHARSET_INFO *cs, char quote) { char buff[40]; int len; switch (val->type) { - case DYN_COL_INT: + case DYN_COL_INT: len= snprintf(buff, sizeof(buff), "%lld", val->x.long_value); if (dynstr_append_mem(str, buff, len)) return ER_DYNCOL_RESOURCE; @@ -3463,11 +3783,12 @@ dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, if (dynstr_realloc(str, len + (quote ? 2 : 0))) return ER_DYNCOL_RESOURCE; if (quote) - str->str[str->length++]= '"'; + str->str[str->length++]= quote; dynstr_append_mem(str, buff, len); if (quote) - str->str[str->length++]= '"'; + str->str[str->length++]= quote; break; + case DYN_COL_DYNCOL: case DYN_COL_STRING: { char *alloc= NULL; @@ -3506,7 +3827,7 @@ dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, return ER_DYNCOL_RESOURCE; } if (quote) - rc= dynstr_append_quoted(str, from, len); + rc= dynstr_append_quoted(str, from, len, quote); else rc= dynstr_append_mem(str, from, len); if (alloc) @@ -3547,7 +3868,7 @@ dynamic_column_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, enum enum_dyncol_func_result -dynamic_column_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) +mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) { enum enum_dyncol_func_result rc= ER_DYNCOL_OK; *ll= 0; @@ -3619,6 +3940,7 @@ dynamic_column_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) val->x.time_value.second) * (val->x.time_value.neg ? -1 : 1); break; + case DYN_COL_DYNCOL: case DYN_COL_NULL: rc= ER_DYNCOL_TRUNCATED; break; @@ -3630,7 +3952,7 @@ dynamic_column_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) enum enum_dyncol_func_result -dynamic_column_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) +mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) { enum enum_dyncol_func_result rc= ER_DYNCOL_OK; *dbl= 0; @@ -3684,6 +4006,7 @@ dynamic_column_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) val->x.time_value.second) * (val->x.time_value.neg ? -1 : 1); break; + case DYN_COL_DYNCOL: case DYN_COL_NULL: rc= ER_DYNCOL_TRUNCATED; break; @@ -3703,30 +4026,40 @@ dynamic_column_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) @return ER_DYNCOL_* return code */ -enum enum_dyncol_func_result -dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json) +#define JSON_STACK_PROTECTION 10 + +static enum enum_dyncol_func_result +mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json, + uint lvl) { DYN_HEADER header; uint i; enum enum_dyncol_func_result rc; - bzero(json, sizeof(DYNAMIC_STRING)); /* In case of errors */ + if (lvl >= JSON_STACK_PROTECTION) + { + rc= ER_DYNCOL_RESOURCE; + goto err; + } + + if (str->length == 0) return ER_DYNCOL_OK; /* no columns */ if ((rc= init_read_hdr(&header, str)) < 0) - return rc; + goto err; if (header.entry_size * header.column_count + FIXED_HEADER_SIZE > str->length) - return ER_DYNCOL_FORMAT; + { + rc= ER_DYNCOL_FORMAT; + goto err; + } - if (init_dynamic_string(json, NULL, str->length * 2, 100)) - return ER_DYNCOL_RESOURCE; + rc= ER_DYNCOL_RESOURCE; if (dynstr_append_mem(json, "[", 1)) - return ER_DYNCOL_RESOURCE; - rc= ER_DYNCOL_RESOURCE; + goto err; for (i= 0, header.entry= header.header; i < header.column_count; i++, header.entry+= header.entry_size) @@ -3750,7 +4083,7 @@ dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json) if ((rc= dynamic_column_get_value(&header, &val)) < 0 || dynstr_append_mem(json, "{", 1)) goto err; - if (header.format == DYNCOL_FMT_NUM) + if (header.format == dyncol_fmt_num) { uint nm= uint2korr(header.entry); if (dynstr_realloc(json, DYNCOL_NUM_CHAR + 3)) @@ -3761,23 +4094,47 @@ dynamic_column_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json) } else { - uint len= header.entry[0]; - if (dynstr_realloc(json, len + 3)) + LEX_STRING name; + if (read_name(&header, header.entry, &name)) + { + rc= ER_DYNCOL_FORMAT; + goto err; + } + if (dynstr_realloc(json, name.length + 3)) goto err; json->str[json->length++]= '"'; - memcpy(json->str + json->length, (const void *)header.nmpool + - uint2korr(header.entry + 1), len); - json->length+= len; + memcpy(json->str + json->length, name.str, name.length); + json->length+= name.length; } json->str[json->length++]= '"'; json->str[json->length++]= ':'; - if ((rc= dynamic_column_val_str(json, &val, - &my_charset_utf8_general_ci, TRUE)) < 0 || - dynstr_append_mem(json, "}", 1)) - goto err; + if (val.type == DYN_COL_DYNCOL) + { + /* here we use it only for read so can cheat a bit */ + DYNAMIC_COLUMN dc; + bzero(&dc, sizeof(dc)); + dc.str= val.x.string.value.str; + dc.length= val.x.string.value.length; + if (mariadb_dyncol_json_internal(&dc, json, lvl + 1) < 0) + { + dc.str= NULL; dc.length= 0; + goto err; + } + dc.str= NULL; dc.length= 0; + } + else + { + if ((rc= mariadb_dyncol_val_str(json, &val, + &my_charset_utf8_general_ci, '"')) < 0 || + dynstr_append_mem(json, "}", 1)) + goto err; + } } if (dynstr_append_mem(json, "]", 1)) - return ER_DYNCOL_RESOURCE; + { + rc= ER_DYNCOL_RESOURCE; + goto err; + } return ER_DYNCOL_OK; err: @@ -3785,59 +4142,73 @@ err: return rc; } +enum enum_dyncol_func_result +mariadb_dyncol_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json) +{ + + if (init_dynamic_string(json, NULL, str->length * 2, 100)) + return ER_DYNCOL_RESOURCE; + + return mariadb_dyncol_json_internal(str, json, 1); +} + /** Convert to DYNAMIC_COLUMN_VALUE values and names (LEX_STING) dynamic array @param str The packed string - @param names Where to put names - @param vals Where to put values - @param free_names pointer to free names buffer if there is it. + @param count number of elements in the arrays + @param names Where to put names (should be free by user) + @param vals Where to put values (should be free by user) @return ER_DYNCOL_* return code */ enum enum_dyncol_func_result -dynamic_column_vals(DYNAMIC_COLUMN *str, - DYNAMIC_ARRAY *names, DYNAMIC_ARRAY *vals, - char **free_names) +mariadb_dyncol_unpack(DYNAMIC_COLUMN *str, + uint *count, + LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals) { DYN_HEADER header; char *nm; uint i; enum enum_dyncol_func_result rc; - *free_names= 0; - bzero(names, sizeof(DYNAMIC_ARRAY)); /* In case of errors */ - bzero(vals, sizeof(DYNAMIC_ARRAY)); /* In case of errors */ + *count= 0; *names= 0; *vals= 0; + if (str->length == 0) return ER_DYNCOL_OK; /* no columns */ if ((rc= init_read_hdr(&header, str)) < 0) return rc; + if (header.entry_size * header.column_count + FIXED_HEADER_SIZE > str->length) return ER_DYNCOL_FORMAT; - if (init_dynamic_array(names, sizeof(LEX_STRING), - header.column_count, 0) || - init_dynamic_array(vals, sizeof(DYNAMIC_COLUMN_VALUE), - header.column_count, 0) || - (header.format == DYNCOL_FMT_NUM && - !(*free_names= (char *)malloc(DYNCOL_NUM_CHAR * header.column_count)))) + *vals= my_malloc(sizeof(DYNAMIC_COLUMN_VALUE)* header.column_count, MYF(0)); + if (header.format == dyncol_fmt_num) + { + *names= my_malloc(sizeof(LEX_STRING) * header.column_count + + DYNCOL_NUM_CHAR * header.column_count, MYF(0)); + nm= (char *)(names + sizeof(LEX_STRING) * header.column_count); + } + else + { + *names= my_malloc(sizeof(LEX_STRING) * header.column_count, MYF(0)); + nm= 0; + } + if (!(*vals) || !(*names)) { rc= ER_DYNCOL_RESOURCE; goto err; } - nm= *free_names; for (i= 0, header.entry= header.header; i < header.column_count; i++, header.entry+= header.entry_size) { - DYNAMIC_COLUMN_VALUE val; - LEX_STRING name; header.length= hdr_interval_length(&header, header.entry + header.entry_size); header.data= header.dtpool + header.offset; @@ -3851,32 +4222,60 @@ dynamic_column_vals(DYNAMIC_COLUMN *str, rc= ER_DYNCOL_FORMAT; goto err; } - if ((rc= dynamic_column_get_value(&header, &val)) < 0) + if ((rc= dynamic_column_get_value(&header, (*vals) + i)) < 0) goto err; - if (header.format == DYNCOL_FMT_NUM) + if (header.format == dyncol_fmt_num) { uint num= uint2korr(header.entry); - name.str= nm; - name.length= snprintf(nm, DYNCOL_NUM_CHAR, "%u", num); - nm+= name.length + 1; + (*names)[i].str= nm; + (*names)[i].length= snprintf(nm, DYNCOL_NUM_CHAR, "%u", num); + nm+= (*names)[i].length + 1; } else { - name.length= header.entry[0]; - name.str= (char *)header.nmpool + uint2korr(header.entry + 1); + if (read_name(&header, header.entry, (*names) + i)) + { + rc= ER_DYNCOL_FORMAT; + goto err; + } } - /* following is preallocated and so do not fail */ - (void) insert_dynamic(names, (uchar *)&name); - (void) insert_dynamic(vals, (uchar *)&val); } + + *count= header.column_count; return ER_DYNCOL_OK; err: - delete_dynamic(names); - delete_dynamic(vals); - if (*free_names) - my_free(*free_names); - *free_names= 0; + if (*vals) + { + my_free(*vals); + *vals= 0; + } + if (*names) + { + my_free(*names); + *names= 0; + } + return rc; +} + +/** + Get not NULL column count + + @param str The packed string + @param column_count Where to put column count + + @return ER_DYNCOL_* return code +*/ + +enum enum_dyncol_func_result +mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count) +{ + DYN_HEADER header; + enum enum_dyncol_func_result rc; + + if ((rc= init_read_hdr(&header, str)) < 0) + return rc; + *column_count= header.column_count; return rc; } diff --git a/mysys/string.c b/mysys/string.c index 0cf8f939260..1263e7824f9 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -176,18 +176,19 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) } my_bool dynstr_append_quoted(DYNAMIC_STRING *str, - const char *append, size_t len) + const char *append, size_t len, + char quote) { uint additional= (str->alloc_increment ? str->alloc_increment : 10); uint lim= additional; uint i; if (dynstr_realloc(str, len + additional + 2)) return TRUE; - str->str[str->length++]= '"'; + str->str[str->length++]= quote; for (i= 0; i < len; i++) { register char c= append[i]; - if (c == '"' || c == '\\') + if (c == quote || c == '\\') { if (!lim) { @@ -200,10 +201,11 @@ my_bool dynstr_append_quoted(DYNAMIC_STRING *str, } str->str[str->length++]= c; } - str->str[str->length++]= '"'; + str->str[str->length++]= quote; return FALSE; } + void dynstr_free(DYNAMIC_STRING *str) { my_free(str->str); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 72d28bb2e7e..ad01f9f83fc 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -6048,6 +6048,7 @@ Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item) return NULL; } + longlong Item_func_dyncol_check::val_int() { char buff[STRING_BUFFER_USUAL_SIZE]; @@ -6062,7 +6063,7 @@ longlong Item_func_dyncol_check::val_int() col.length= str->length(); /* We do not change the string, so could do this trick */ col.str= (char *)str->ptr(); - rc= dynamic_column_check(&col); + rc= mariadb_dyncol_check(&col); if (rc < 0 && rc != ER_DYNCOL_FORMAT) { dynamic_column_error_message(rc); @@ -6127,8 +6128,8 @@ longlong Item_func_dyncol_exists::val_int() /* We do not change the string, so could do this trick */ col.str= (char *)str->ptr(); rc= ((name == NULL) ? - dynamic_column_exists(&col, (uint) num) : - dynamic_column_exists_str(&col, name)); + mariadb_dyncol_exists(&col, (uint) num) : + mariadb_dyncol_exists_named(&col, name)); if (rc < 0) { dynamic_column_error_message(rc); diff --git a/sql/item_create.cc b/sql/item_create.cc index f886b3d598b..bc449b0aaf2 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -526,6 +526,54 @@ protected: virtual ~Create_func_coercibility() {} }; +class Create_func_dyncol_check : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_dyncol_check s_singleton; + +protected: + Create_func_dyncol_check() {} + virtual ~Create_func_dyncol_check() {} +}; + +class Create_func_dyncol_exists : public Create_func_arg2 +{ +public: + virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + + static Create_func_dyncol_exists s_singleton; + +protected: + Create_func_dyncol_exists() {} + virtual ~Create_func_dyncol_exists() {} +}; + +class Create_func_dyncol_list : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_dyncol_list s_singleton; + +protected: + Create_func_dyncol_list() {} + virtual ~Create_func_dyncol_list() {} +}; + +class Create_func_dyncol_json : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_dyncol_json s_singleton; + +protected: + Create_func_dyncol_json() {} + virtual ~Create_func_dyncol_json() {} +}; + class Create_func_compress : public Create_func_arg1 { @@ -3108,6 +3156,38 @@ Create_func_coercibility::create_1_arg(THD *thd, Item *arg1) } +Create_func_dyncol_check Create_func_dyncol_check::s_singleton; + +Item* +Create_func_dyncol_check::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_dyncol_check(arg1); +} + +Create_func_dyncol_exists Create_func_dyncol_exists::s_singleton; + +Item* +Create_func_dyncol_exists::create_2_arg(THD *thd, Item *arg1, Item *arg2) +{ + return new (thd->mem_root) Item_func_dyncol_exists(arg1, arg2); +} + +Create_func_dyncol_list Create_func_dyncol_list::s_singleton; + +Item* +Create_func_dyncol_list::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_dyncol_list(arg1); +} + +Create_func_dyncol_json Create_func_dyncol_json::s_singleton; + +Item* +Create_func_dyncol_json::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_dyncol_json(arg1); +} + Create_func_concat Create_func_concat::s_singleton; Item* @@ -5245,6 +5325,10 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("CHARACTER_LENGTH") }, BUILDER(Create_func_char_length)}, { { C_STRING_WITH_LEN("CHAR_LENGTH") }, BUILDER(Create_func_char_length)}, { { C_STRING_WITH_LEN("COERCIBILITY") }, BUILDER(Create_func_coercibility)}, + { { C_STRING_WITH_LEN("COLUMN_CHECK") }, BUILDER(Create_func_dyncol_check)}, + { { C_STRING_WITH_LEN("COLUMN_EXISTS") }, BUILDER(Create_func_dyncol_exists)}, + { { C_STRING_WITH_LEN("COLUMN_LIST") }, BUILDER(Create_func_dyncol_list)}, + { { C_STRING_WITH_LEN("COLUMN_JSON") }, BUILDER(Create_func_dyncol_json)}, { { C_STRING_WITH_LEN("COMPRESS") }, BUILDER(Create_func_compress)}, { { C_STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat)}, { { C_STRING_WITH_LEN("CONCAT_WS") }, BUILDER(Create_func_concat_ws)}, @@ -5720,11 +5804,6 @@ Item *create_func_dyncol_create(THD *thd, List &list) return new (thd->mem_root) Item_func_dyncol_create(*args, dfs); } -Item *create_func_dyncol_json(THD *thd, Item *str) -{ - return new (thd->mem_root) Item_func_dyncol_json(str); -} - Item *create_func_dyncol_add(THD *thd, Item *str, List &list) { diff --git a/sql/item_func.h b/sql/item_func.h index cb9c1929d7d..ccb86fd03e5 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -58,7 +58,7 @@ public: NOW_FUNC, TRIG_COND_FUNC, SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC, EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC, - NEG_FUNC, GSYSVAR_FUNC }; + NEG_FUNC, GSYSVAR_FUNC, DYNCOL }; enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL, OPTIMIZE_EQUAL }; enum Type type() const { return FUNC_ITEM; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ca6a6b2cea3..706fbbff94d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -3760,8 +3760,8 @@ String *Item_func_uuid::val_str(String *str) Item_func_dyncol_create::Item_func_dyncol_create(List &args, DYNCALL_CREATE_DEF *dfs) - : Item_str_func(args), defs(dfs), vals(0), keys(NULL), names(FALSE), - force_names(FALSE) + : Item_str_func(args), defs(dfs), vals(0), keys_num(NULL), keys_str(NULL), + names(FALSE), force_names(FALSE) { DBUG_ASSERT((args.elements & 0x1) == 0); // even number of arguments } @@ -3782,13 +3782,15 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref) names= TRUE; } - keys= (uchar *) alloc_root(thd->mem_root, + keys_num= (uint *) alloc_root(thd->mem_root, (sizeof(LEX_STRING) > sizeof(uint) ? sizeof(LEX_STRING) : sizeof(uint)) * (arg_count / 2)); + keys_str= (LEX_STRING *) keys_num; + //status_var_increment(thd->status_var.feature_dynamic_columns); } - return res || vals == 0 || keys == 0; + return res || vals == 0 || keys_num == 0; } @@ -3808,6 +3810,41 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) my_decimal dtmp, *dres; force_names= force_names_arg; + if (!(names || force_names)) + { + for (i= 0; i < column_count; i++) + { + uint valpos= i * 2 + 1; + DYNAMIC_COLUMN_TYPE type= defs[i].type; + if (type == DYN_COL_NULL) + switch (args[valpos]->field_type()) + { + case MYSQL_TYPE_VARCHAR: + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + case MYSQL_TYPE_GEOMETRY: + type= DYN_COL_STRING; + break; + default: + break; + } + + if (type == DYN_COL_STRING && + args[valpos]->type() == Item::FUNC_ITEM && + ((Item_func *)args[valpos])->functype() == DYNCOL) + { + force_names= 1; + break; + } + } + } + /* get values */ for (i= 0; i < column_count; i++) { @@ -3865,6 +3902,13 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) break; } } + if (type == DYN_COL_STRING && + args[valpos]->type() == Item::FUNC_ITEM && + ((Item_func *)args[valpos])->functype() == DYNCOL) + { + DBUG_ASSERT(names || force_names); + type= DYN_COL_DYNCOL; + } if (names || force_names) { res= args[i * 2]->val_str(&tmp); @@ -3873,10 +3917,8 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) // guaranty UTF-8 string for names if (my_charset_same(res->charset(), &my_charset_utf8_general_ci)) { - ((LEX_STRING *)keys)[i].length= res->length(); - if (!(((LEX_STRING *)keys)[i].str= - (char *)sql_memdup(res->ptr(), res->length()))) - ((LEX_STRING *)keys)[i].length= 0; + keys_str[i].length= res->length(); + keys_str[i].str= sql_strmake(res->ptr(), res->length()); } else { @@ -3887,25 +3929,25 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) my_charset_utf8_general_ci.mbmaxlen + 1)); if (str) { - ((LEX_STRING *)keys)[i].length= + keys_str[i].length= copy_and_convert(str, strlen, &my_charset_utf8_general_ci, res->ptr(), res->length(), res->charset(), &dummy_errors); - ((LEX_STRING *)keys)[i].str= str; + keys_str[i].str= str; } else - ((LEX_STRING *)keys)[i].length= 0; + keys_str[i].length= 0; } } else { - ((LEX_STRING *)keys)[i].length= 0; - ((LEX_STRING *)keys)[i].str= NULL; + keys_str[i].length= 0; + keys_str[i].str= NULL; } } else - ((uint *)keys)[i]= (uint) args[i * 2]->val_int(); + keys_num[i]= (uint) args[i * 2]->val_int(); if (args[i * 2]->null_value) { /* to make cleanup possible */ @@ -3927,11 +3969,11 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) case DYN_COL_DOUBLE: vals[i].x.double_value= args[valpos]->val_real(); break; + case DYN_COL_DYNCOL: case DYN_COL_STRING: res= args[valpos]->val_str(&tmp); if (res && - (vals[i].x.string.value.str= my_strndup(res->ptr(), res->length(), - MYF(MY_WME)))) + (vals[i].x.string.value.str= sql_strmake(res->ptr(), res->length()))) { vals[i].x.string.value.length= res->length(); vals[i].x.string.charset= res->charset(); @@ -3975,26 +4017,12 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) } if (vals[i].type != DYN_COL_NULL && args[valpos]->null_value) { - if (vals[i].type == DYN_COL_STRING) - my_free(vals[i].x.string.value.str); vals[i].type= DYN_COL_NULL; } } return FALSE; } -void Item_func_dyncol_create::cleanup_arguments() -{ - uint column_count= (arg_count / 2); - uint i; - - for (i= 0; i < column_count; i++) - { - if (vals[i].type == DYN_COL_STRING) - my_free(vals[i].x.string.value.str); - } - force_names= FALSE; -} String *Item_func_dyncol_create::val_str(String *str) { @@ -4011,8 +4039,11 @@ String *Item_func_dyncol_create::val_str(String *str) } else { - if ((rc= dynamic_column_create_many_fmt(&col, column_count, keys, - vals, names || force_names))) + if ((rc= ((names || force_names) ? + mariadb_dyncol_create_many_named(&col, column_count, keys_str, + vals, TRUE) : + mariadb_dyncol_create_many(&col, column_count, keys_num, + vals, TRUE)))) { dynamic_column_error_message(rc); dynamic_column_column_free(&col); @@ -4024,7 +4055,7 @@ String *Item_func_dyncol_create::val_str(String *str) /* Move result from DYNAMIC_COLUMN to str_value */ char *ptr; size_t length, alloc_length; - dynamic_column_reassociate(&col, &ptr, &length, &alloc_length); + mariadb_dyncol_reassociate(&col, &ptr, &length, &alloc_length); str_value.reassociate(ptr, (uint32) length, (uint32) alloc_length, &my_charset_bin); res= &str_value; @@ -4032,9 +4063,6 @@ String *Item_func_dyncol_create::val_str(String *str) } } - /* cleanup */ - cleanup_arguments(); - return res; } @@ -4060,6 +4088,7 @@ void Item_func_dyncol_create::print_arguments(String *str, case DYN_COL_DOUBLE: str->append(STRING_WITH_LEN(" AS double")); break; + case DYN_COL_DYNCOL: case DYN_COL_STRING: str->append(STRING_WITH_LEN(" AS char")); if (defs[i].cs) @@ -4109,7 +4138,7 @@ String *Item_func_dyncol_json::val_str(String *str) col.str= (char *)res->ptr(); col.length= res->length(); - if ((rc= dynamic_column_json(&col, &json))) + if ((rc= mariadb_dyncol_json(&col, &json))) { dynamic_column_error_message(rc); goto null; @@ -4150,15 +4179,17 @@ String *Item_func_dyncol_add::val_str(String *str) col.length= res->length(); memcpy(col.str, res->ptr(), col.length); - if (prepare_arguments(dynamic_column_has_names(&col))) + if (prepare_arguments(mariadb_dyncol_has_names(&col))) goto null; - if ((rc= dynamic_column_update_many_fmt(&col, column_count, keys, - vals, names || force_names))) + if ((rc= ((names || force_names) ? + mariadb_dyncol_update_many_named(&col, column_count, + keys_str, vals) : + mariadb_dyncol_update_many(&col, column_count, + keys_num, vals)))) { dynamic_column_error_message(rc); dynamic_column_column_free(&col); - cleanup_arguments(); goto null; } @@ -4166,15 +4197,12 @@ String *Item_func_dyncol_add::val_str(String *str) /* Move result from DYNAMIC_COLUMN to str */ char *ptr; size_t length, alloc_length; - dynamic_column_reassociate(&col, &ptr, &length, &alloc_length); + mariadb_dyncol_reassociate(&col, &ptr, &length, &alloc_length); str->reassociate(ptr, (uint32) length, (uint32) alloc_length, &my_charset_bin); null_value= FALSE; } - /* cleanup */ - cleanup_arguments(); - return str; null: @@ -4264,8 +4292,8 @@ bool Item_dyncol_get::get_dyn_value(DYNAMIC_COLUMN_VALUE *val, String *tmp) dyn_str.str= (char*) res->ptr(); dyn_str.length= res->length(); if ((rc= ((name == NULL) ? - dynamic_column_get(&dyn_str, (uint) num, val) : - dynamic_column_get_str(&dyn_str, name, val)))) + mariadb_dyncol_get(&dyn_str, (uint) num, val) : + mariadb_dyncol_get_named(&dyn_str, name, val)))) { dynamic_column_error_message(rc); null_value= 1; @@ -4297,6 +4325,7 @@ String *Item_dyncol_get::val_str(String *str_result) case DYN_COL_DOUBLE: str_result->set_real(val.x.double_value, NOT_FIXED_DEC, &my_charset_latin1); break; + case DYN_COL_DYNCOL: case DYN_COL_STRING: if ((char*) tmp.ptr() <= val.x.string.value.str && (char*) tmp.ptr() + tmp.length() >= val.x.string.value.str) @@ -4373,6 +4402,7 @@ longlong Item_dyncol_get::val_int() return 0; switch (val.type) { + case DYN_COL_DYNCOL: case DYN_COL_NULL: goto null; case DYN_COL_UINT: @@ -4453,6 +4483,7 @@ double Item_dyncol_get::val_real() return 0.0; switch (val.type) { + case DYN_COL_DYNCOL: case DYN_COL_NULL: goto null; case DYN_COL_UINT: @@ -4510,6 +4541,7 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value) return NULL; switch (val.type) { + case DYN_COL_DYNCOL: case DYN_COL_NULL: goto null; case DYN_COL_UINT: @@ -4569,6 +4601,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) return 1; // Error switch (val.type) { + case DYN_COL_DYNCOL: case DYN_COL_NULL: goto null; case DYN_COL_INT: @@ -4631,7 +4664,8 @@ String *Item_func_dyncol_list::val_str(String *str) { uint i; enum enum_dyncol_func_result rc; - DYNAMIC_ARRAY arr; + LEX_STRING *names= 0; + uint count; DYNAMIC_COLUMN col; String *res= args[0]->val_str(str); @@ -4640,37 +4674,37 @@ String *Item_func_dyncol_list::val_str(String *str) col.length= res->length(); /* We do not change the string, so could do this trick */ col.str= (char *)res->ptr(); - if ((rc= dynamic_column_list_str(&col, &arr))) + if ((rc= mariadb_dyncol_list_named(&col, &count, &names))) { + bzero(&col, sizeof(col)); dynamic_column_error_message(rc); - for (i= 0; i < arr.elements; i++) - my_free(dynamic_element(&arr, i, LEX_STRING*)->str); - delete_dynamic(&arr); goto null; } + bzero(&col, sizeof(col)); /* We estimate average name length as 10 */ - if (str->alloc(arr.elements * 13)) + if (str->alloc(count * 13)) goto null; str->length(0); str->set_charset(&my_charset_utf8_general_ci); - for (i= 0; i < arr.elements; i++) + for (i= 0; i < count; i++) { - LEX_STRING *name= dynamic_element(&arr, i, LEX_STRING *); - append_identifier(current_thd, str, name->str, name->length); - if (i < arr.elements - 1) + append_identifier(current_thd, str, names[i].str, names[i].length); + if (i < count - 1) str->qs_append(','); - my_free(name->str); } - null_value= FALSE; - delete_dynamic(&arr); + if (names) + my_free(names); return str; null: null_value= TRUE; + if (names) + my_free(names); return NULL; } + diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index e6a7e1291b8..8ef67654b35 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1001,10 +1001,10 @@ class Item_func_dyncol_create: public Item_str_func protected: DYNCALL_CREATE_DEF *defs; DYNAMIC_COLUMN_VALUE *vals; - uchar *keys; + uint *keys_num; + LEX_STRING *keys_str; bool names, force_names; bool prepare_arguments(bool force_names); - void cleanup_arguments(); void print_arguments(String *str, enum_query_type query_type); public: Item_func_dyncol_create(List &args, DYNCALL_CREATE_DEF *dfs); @@ -1013,6 +1013,7 @@ public: const char *func_name() const{ return "column_create"; } String *val_str(String *); virtual void print(String *str, enum_query_type query_type); + virtual enum Functype functype() const { return DYNCOL; } }; @@ -1081,3 +1082,4 @@ public: extern String my_empty_string; #endif /* ITEM_STRFUNC_INCLUDED */ + diff --git a/sql/lex.h b/sql/lex.h index ea68ea0972a..34eda613e71 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -126,10 +126,7 @@ static SYMBOL symbols[] = { { "COLUMN_CHECK", SYM(COLUMN_CHECK_SYM)}, { "COLUMN_CREATE", SYM(COLUMN_CREATE_SYM)}, { "COLUMN_DELETE", SYM(COLUMN_DELETE_SYM)}, - { "COLUMN_EXISTS", SYM(COLUMN_EXISTS_SYM)}, { "COLUMN_GET", SYM(COLUMN_GET_SYM)}, - { "COLUMN_JSON", SYM(COLUMN_JSON_SYM)}, - { "COLUMN_LIST", SYM(COLUMN_LIST_SYM)}, { "COMMENT", SYM(COMMENT_SYM)}, { "COMMIT", SYM(COMMIT_SYM)}, { "COMMITTED", SYM(COMMITTED_SYM)}, diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index d785366ae69..14d4d5fca6c 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -3872,10 +3872,10 @@ int JOIN_TAB_SCAN_MRR::next() int rc= join_tab->table->file->multi_range_read_next((range_id_t*)ptr) ? -1 : 0; if (!rc) { - /* + /* If a record in in an incremental cache contains no fields then the association for the last record in cache will be equal to cache->end_pos - */ + */ /* psergey: this makes no sense where HA_MRR_NO_ASSOC is used. DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) && diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 48dd47bccea..87a7df34986 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -885,10 +885,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token COLUMN_CHECK_SYM %token COLUMN_CREATE_SYM %token COLUMN_DELETE_SYM -%token COLUMN_EXISTS_SYM %token COLUMN_GET_SYM -%token COLUMN_JSON_SYM -%token COLUMN_LIST_SYM %token COLUMN_SYM /* SQL-2003-R */ %token COLUMN_NAME_SYM /* SQL-2003-N */ %token COMMENT_SYM @@ -8807,20 +8804,6 @@ function_call_nonkeyword: if ($$ == NULL) MYSQL_YYABORT; } - | - COLUMN_EXISTS_SYM '(' expr ',' expr ')' - { - $$= new (YYTHD->mem_root) Item_func_dyncol_exists($3, $5); - if ($$ == NULL) - MYSQL_YYABORT; - } - | - COLUMN_LIST_SYM '(' expr ')' - { - $$= new (YYTHD->mem_root) Item_func_dyncol_list($3); - if ($$ == NULL) - MYSQL_YYABORT; - } | COLUMN_CREATE_SYM '(' dyncall_create_list ')' { @@ -8828,13 +8811,6 @@ function_call_nonkeyword: if ($$ == NULL) MYSQL_YYABORT; } - | - COLUMN_JSON_SYM '(' expr ')' - { - $$= create_func_dyncol_json(YYTHD, $3); - if ($$ == NULL) - MYSQL_YYABORT; - } | COLUMN_GET_SYM '(' expr ',' expr AS cast_type ')' { @@ -12927,10 +12903,7 @@ keyword: | COLUMN_CHECK_SYM {} | COLUMN_CREATE_SYM {} | COLUMN_DELETE_SYM {} - | COLUMN_EXISTS_SYM {} | COLUMN_GET_SYM {} - | COLUMN_JSON_SYM {} - | COLUMN_LIST_SYM {} | COMMENT_SYM {} | COMMIT_SYM {} | CONTAINS_SYM {} diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index 7e92d3cc0bd..7852177b9b3 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -13,9 +13,9 @@ SET(cassandra_sources #INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) -#INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) +INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) #INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) -INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) +#INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) # STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index a54190e080c..75eff80a3cf 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -89,7 +89,7 @@ ha_create_table_option cassandra_field_option_list[]= /* Collect all other columns as dynamic here, the valid values are YES/NO, ON/OFF, 1/0. - The default is 0, that is true, yes, on. + The default is 0, that is false, no, off. */ HA_FOPTION_BOOL("DYNAMIC_COLUMN_STORAGE", dyncol_field, 0), HA_FOPTION_END @@ -862,9 +862,37 @@ public: /** Converting dynamic columns types to/from casandra types */ + + +/** + Check and initialize (if it is needed) string MEM_ROOT +*/ +static void alloc_strings_memroot(MEM_ROOT *mem_root) +{ + if (!alloc_root_inited(mem_root)) + { + /* + The mem_root used to allocate UUID (of length 36 + \0) so make + appropriate allocated size + */ + init_alloc_root(mem_root, + (36 + 1 + ALIGN_SIZE(sizeof(USED_MEM))) * 10 + + ALLOC_ROOT_MIN_BLOCK_SIZE, + (36 + 1 + ALIGN_SIZE(sizeof(USED_MEM))) * 10 + + ALLOC_ROOT_MIN_BLOCK_SIZE); + } +} + +static void free_strings_memroot(MEM_ROOT *mem_root) +{ + if (alloc_root_inited(mem_root)) + free_root(mem_root, MYF(0)); +} + bool cassandra_to_dyncol_intLong(const char *cass_data, int cass_data_len __attribute__((unused)), - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { value->type= DYN_COL_INT; #ifdef WORDS_BIGENDIAN @@ -881,7 +909,7 @@ bool dyncol_to_cassandraLong(DYNAMIC_COLUMN_VALUE *value, { longlong *tmp= (longlong *) buff; enum enum_dyncol_func_result rc= - dynamic_column_val_long(tmp, value); + mariadb_dyncol_val_long(tmp, value); if (rc < 0) return true; *cass_data_len= sizeof(longlong); @@ -897,7 +925,8 @@ bool dyncol_to_cassandraLong(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_intInt32(const char *cass_data, int cass_data_len __attribute__((unused)), - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { int32 tmp; value->type= DYN_COL_INT; @@ -917,7 +946,7 @@ bool dyncol_to_cassandraInt32(DYNAMIC_COLUMN_VALUE *value, { longlong *tmp= (longlong *) ((char *)buff + sizeof(longlong)); enum enum_dyncol_func_result rc= - dynamic_column_val_long(tmp, value); + mariadb_dyncol_val_long(tmp, value); if (rc < 0) return true; *cass_data_len= sizeof(int32); @@ -937,7 +966,8 @@ bool dyncol_to_cassandraInt32(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_intCounter(const char *cass_data, int cass_data_len __attribute__((unused)), - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { value->type= DYN_COL_INT; value->x.long_value= *((longlong *)cass_data); @@ -951,7 +981,7 @@ bool dyncol_to_cassandraCounter(DYNAMIC_COLUMN_VALUE *value, { longlong *tmp= (longlong *)buff; enum enum_dyncol_func_result rc= - dynamic_column_val_long(tmp, value); + mariadb_dyncol_val_long(tmp, value); if (rc < 0) return true; *cass_data_len= sizeof(longlong); @@ -962,7 +992,8 @@ bool dyncol_to_cassandraCounter(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_doubleFloat(const char *cass_data, int cass_data_len __attribute__((unused)), - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { value->type= DYN_COL_DOUBLE; value->x.double_value= *((float *)cass_data); @@ -975,7 +1006,7 @@ bool dyncol_to_cassandraFloat(DYNAMIC_COLUMN_VALUE *value, { double tmp; enum enum_dyncol_func_result rc= - dynamic_column_val_double(&tmp, value); + mariadb_dyncol_val_double(&tmp, value); if (rc < 0) return true; *((float *)buff)= (float) tmp; @@ -987,7 +1018,9 @@ bool dyncol_to_cassandraFloat(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_doubleDouble(const char *cass_data, int cass_data_len __attribute__((unused)), - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root + __attribute__((unused))) { value->type= DYN_COL_DOUBLE; value->x.double_value= *((double *)cass_data); @@ -1000,7 +1033,7 @@ bool dyncol_to_cassandraDouble(DYNAMIC_COLUMN_VALUE *value, { double *tmp= (double *)buff; enum enum_dyncol_func_result rc= - dynamic_column_val_double(tmp, value); + mariadb_dyncol_val_double(tmp, value); if (rc < 0) return true; *cass_data_len= sizeof(double); @@ -1018,7 +1051,6 @@ bool cassandra_to_dyncol_strStr(const char *cass_data, value->x.string.charset= cs; value->x.string.value.str= (char *)cass_data; value->x.string.value.length= cass_data_len; - value->x.string.nonfreeable= TRUE; // do not try to free return 0; } @@ -1030,7 +1062,7 @@ bool dyncol_to_cassandraStr(DYNAMIC_COLUMN_VALUE *value, if (init_dynamic_string(&tmp, NULL, 1024, 1024)) return 1; enum enum_dyncol_func_result rc= - dynamic_column_val_str(&tmp, value, cs, FALSE); + mariadb_dyncol_val_str(&tmp, value, cs, '\0'); if (rc < 0) { dynstr_free(&tmp); @@ -1044,7 +1076,8 @@ bool dyncol_to_cassandraStr(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_strBytes(const char *cass_data, int cass_data_len, - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { return cassandra_to_dyncol_strStr(cass_data, cass_data_len, value, &my_charset_bin); @@ -1060,7 +1093,8 @@ bool dyncol_to_cassandraBytes(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_strAscii(const char *cass_data, int cass_data_len, - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { return cassandra_to_dyncol_strStr(cass_data, cass_data_len, value, &my_charset_latin1_bin); @@ -1076,7 +1110,8 @@ bool dyncol_to_cassandraAscii(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_strUTF8(const char *cass_data, int cass_data_len, - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { return cassandra_to_dyncol_strStr(cass_data, cass_data_len, value, &my_charset_utf8_unicode_ci); @@ -1092,20 +1127,20 @@ bool dyncol_to_cassandraUTF8(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_strUUID(const char *cass_data, int cass_data_len, - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root) { value->type= DYN_COL_STRING; value->x.string.charset= &my_charset_bin; - value->x.string.value.str= (char *)my_malloc(37, MYF(0)); + alloc_strings_memroot(mem_root); + value->x.string.value.str= (char *)alloc_root(mem_root, 37); if (!value->x.string.value.str) { value->x.string.value.length= 0; - value->x.string.nonfreeable= TRUE; return 1; } convert_uuid2string(value->x.string.value.str, cass_data); value->x.string.value.length= 36; - value->x.string.nonfreeable= FALSE; return 0; } @@ -1117,7 +1152,7 @@ bool dyncol_to_cassandraUUID(DYNAMIC_COLUMN_VALUE *value, if (init_dynamic_string(&tmp, NULL, 1024, 1024)) return true; enum enum_dyncol_func_result rc= - dynamic_column_val_str(&tmp, value, &my_charset_latin1_bin, FALSE); + mariadb_dyncol_val_str(&tmp, value, &my_charset_latin1_bin, '\0'); if (rc < 0 || tmp.length != 36 || convert_string2uuid((char *)buff, tmp.str)) { dynstr_free(&tmp); @@ -1132,7 +1167,8 @@ bool dyncol_to_cassandraUUID(DYNAMIC_COLUMN_VALUE *value, bool cassandra_to_dyncol_intBool(const char *cass_data, int cass_data_len, - DYNAMIC_COLUMN_VALUE *value) + DYNAMIC_COLUMN_VALUE *value, + MEM_ROOT *mem_root __attribute__((unused))) { value->type= DYN_COL_INT; value->x.long_value= (cass_data[0] ? 1 : 0); @@ -1145,7 +1181,7 @@ bool dyncol_to_cassandraBool(DYNAMIC_COLUMN_VALUE *value, { longlong tmp; enum enum_dyncol_func_result rc= - dynamic_column_val_long(&tmp, value); + mariadb_dyncol_val_long(&tmp, value); if (rc < 0) return true; ((char *)buff)[0]= (tmp ? 1 : 0); @@ -1430,10 +1466,7 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) (CASSANDRA_TYPE_DEF *)(field_converters + n_fields); special_type_field_names= ((LEX_STRING*)(special_type_field_converters + max_non_default_fields)); - } - if (dyncol_set) - { if (init_dynamic_array(&dynamic_values, sizeof(DYNAMIC_COLUMN_VALUE), DYNCOL_USUAL, DYNCOL_DELTA)) @@ -1667,14 +1700,6 @@ void ha_cassandra::print_conversion_error(const char *field_name, } -void free_strings(DYNAMIC_COLUMN_VALUE *vals, uint num) -{ - for (uint i= 0; i < num; i++) - if (vals[i].type == DYN_COL_STRING && - !vals[i].x.string.nonfreeable) - my_free(vals[i].x.string.value.str); -} - CASSANDRA_TYPE_DEF * ha_cassandra::get_cassandra_field_def(char *cass_name, int cass_name_len) @@ -1695,6 +1720,7 @@ CASSANDRA_TYPE_DEF * ha_cassandra::get_cassandra_field_def(char *cass_name, int ha_cassandra::read_cassandra_columns(bool unpack_pk) { + MEM_ROOT strings_root; char *cass_name; char *cass_value; int cass_value_len, cass_name_len; @@ -1702,6 +1728,7 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk) int res= 0; ulong total_name_len= 0; + clear_alloc_root(&strings_root); /* cassandra_to_mariadb() calls will use field->store(...) methods, which require that the column is in the table->write_set @@ -1770,7 +1797,8 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk) } if ((res= (*(type->cassandra_to_dynamic))(cass_value, - cass_value_len, &val)) || + cass_value_len, &val, + &strings_root)) || insert_dynamic(&dynamic_names, (uchar *) &nm) || insert_dynamic(&dynamic_values, (uchar *) &val)) { @@ -1778,10 +1806,9 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk) { print_conversion_error(cass_name, cass_value, cass_value_len); } - free_strings((DYNAMIC_COLUMN_VALUE *)dynamic_values.buffer, - dynamic_values.elements); + free_strings_memroot(&strings_root); // EOM shouldm be already reported if happened - res=1; + res= 1; goto err; } } @@ -1790,21 +1817,17 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk) dynamic_rec.length= 0; if (dyncol_set) { - if (dynamic_column_create_many_internal_fmt(&dynamic_rec, - dynamic_names.elements, - dynamic_names.buffer, - (DYNAMIC_COLUMN_VALUE *) - dynamic_values.buffer, - FALSE, - TRUE) < 0) + if (mariadb_dyncol_create_many_named(&dynamic_rec, + dynamic_names.elements, + (LEX_STRING *)dynamic_names.buffer, + (DYNAMIC_COLUMN_VALUE *) + dynamic_values.buffer, + FALSE) < 0) dynamic_rec.length= 0; - free_strings((DYNAMIC_COLUMN_VALUE *)dynamic_values.buffer, - dynamic_values.elements); + free_strings_memroot(&strings_root); dynamic_values.elements= dynamic_names.elements= 0; - } - if (dyncol_set) - { + if (dynamic_rec.length == 0) table->field[dyncol_field]->set_null(); else @@ -1836,11 +1859,14 @@ err: return res; } -int ha_cassandra::read_dyncol(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, - String *valcol, char **freenames) +int ha_cassandra::read_dyncol(uint *count, + DYNAMIC_COLUMN_VALUE **vals, + LEX_STRING **names, + String *valcol) { String *strcol; DYNAMIC_COLUMN col; + enum enum_dyncol_func_result rc; DBUG_ENTER("ha_cassandra::read_dyncol"); @@ -1850,8 +1876,9 @@ int ha_cassandra::read_dyncol(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, strcol= field->val_str(NULL, valcol); if (field->is_null()) { - bzero(vals, sizeof(DYNAMIC_ARRAY)); - bzero(names, sizeof(DYNAMIC_ARRAY)); + *count= 0; + *names= 0; + *vals= 0; DBUG_RETURN(0); // nothing to write } /* @@ -1861,7 +1888,7 @@ int ha_cassandra::read_dyncol(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, bzero(&col, sizeof(col)); col.str= (char *)strcol->ptr(); col.length= strcol->length(); - if ((rc= dynamic_column_vals(&col, names, vals, freenames)) < 0) + if ((rc= mariadb_dyncol_unpack(&col, count, names, vals)) < 0) { dynamic_column_error_message(rc); DBUG_RETURN(HA_ERR_INTERNAL_ERROR); @@ -1869,34 +1896,33 @@ int ha_cassandra::read_dyncol(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, DBUG_RETURN(0); } -int ha_cassandra::write_dynamic_row(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names) +int ha_cassandra::write_dynamic_row(uint count, + DYNAMIC_COLUMN_VALUE *vals, + LEX_STRING *names) { uint i; DBUG_ENTER("ha_cassandra::write_dynamic_row"); DBUG_ASSERT(dyncol_set); - DBUG_ASSERT(names->elements == vals->elements); - for (i= 0; i < names->elements; i++) + for (i= 0; i < count; i++) { char buff[16]; CASSANDRA_TYPE_DEF *type; void *freemem= NULL; char *cass_data; int cass_data_len; - LEX_STRING *name= dynamic_element(names, i, LEX_STRING*); - DYNAMIC_COLUMN_VALUE *val= dynamic_element(vals, i, DYNAMIC_COLUMN_VALUE*); - DBUG_PRINT("info", ("field %*s", (int)name->length, name->str)); - type= get_cassandra_field_def(name->str, (int) name->length); - if ((*type->dynamic_to_cassandra)(val, &cass_data, &cass_data_len, + DBUG_PRINT("info", ("field %*s", (int)names[i].length, names[i].str)); + type= get_cassandra_field_def(names[i].str, (int) names[i].length); + if ((*type->dynamic_to_cassandra)(vals +i, &cass_data, &cass_data_len, buff, &freemem)) { my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), - name->str, insert_lineno); - DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); + names[i].str, insert_lineno); + DBUG_RETURN(HA_ERR_GENERIC); } - se->add_insert_column(name->str, name->length, + se->add_insert_column(names[i].str, names[i].length, cass_data, cass_data_len); if (freemem) my_free(freemem); @@ -1904,13 +1930,19 @@ int ha_cassandra::write_dynamic_row(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names) DBUG_RETURN(0); } -void ha_cassandra::free_dynamic_row(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, - char *free_names) +void ha_cassandra::free_dynamic_row(DYNAMIC_COLUMN_VALUE **vals, + LEX_STRING **names) { - delete_dynamic(names); - delete_dynamic(vals); - if (free_names) - my_free(free_names); + if (*vals) + { + my_free(*vals); + *vals= 0; + } + if (*names) + { + my_free(*names); + *names= 0; + } } int ha_cassandra::write_row(uchar *buf) @@ -1949,13 +1981,14 @@ int ha_cassandra::write_row(uchar *buf) if (dyncol_set && dyncol_field == i) { String valcol; - DYNAMIC_ARRAY vals, names; - char *free_names= NULL; + DYNAMIC_COLUMN_VALUE *vals; + LEX_STRING *names; + uint count; int rc; DBUG_ASSERT(field_converters[i] == NULL); - if (!(rc= read_dyncol(&vals, &names, &valcol, &free_names))) - rc= write_dynamic_row(&vals, &names); - free_dynamic_row(&vals, &names, free_names); + if (!(rc= read_dyncol(&count, &vals, &names, &valcol))) + rc= write_dynamic_row(count, vals, names); + free_dynamic_row(&vals, &names); if (rc) { dbug_tmp_restore_column_map(table->read_set, old_map); @@ -2336,9 +2369,10 @@ public: int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) { - DYNAMIC_ARRAY oldvals, oldnames, vals, names; + DYNAMIC_COLUMN_VALUE *oldvals, *vals; + LEX_STRING *oldnames, *names; + uint oldcount, count; String oldvalcol, valcol; - char *oldfree_names= NULL, *free_names= NULL; my_bitmap_map *old_map; int res; DBUG_ENTER("ha_cassandra::update_row"); @@ -2381,12 +2415,12 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) my_ptrdiff_t diff; diff= (my_ptrdiff_t) (old_data - new_data); field->move_field_offset(diff); // Points now at old_data - if ((res= read_dyncol(&oldvals, &oldnames, &oldvalcol, &oldfree_names))) + if ((res= read_dyncol(&oldcount, &oldvals, &oldnames, &oldvalcol))) DBUG_RETURN(res); field->move_field_offset(-diff); // back to new_data - if ((res= read_dyncol(&vals, &names, &valcol, &free_names))) + if ((res= read_dyncol(&count, &vals, &names, &valcol))) { - free_dynamic_row(&oldnames, &oldvals, oldfree_names); + free_dynamic_row(&oldvals, &oldnames); DBUG_RETURN(res); } } @@ -2399,9 +2433,9 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) */ Column_name_enumerator_impl name_enumerator(this); se->add_row_deletion(old_key, old_key_len, &name_enumerator, - (LEX_STRING *)oldnames.buffer, - (dyncol_set ? oldnames.elements : 0)); - oldnames.elements= oldvals.elements= 0; // they will be deleted + oldnames, + (dyncol_set ? oldcount : 0)); + oldcount= 0; // they will be deleted } se->start_row_insert(new_key, new_key_len); @@ -2414,7 +2448,7 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) if (dyncol_set && dyncol_field == i) { DBUG_ASSERT(field_converters[i] == NULL); - if ((res= write_dynamic_row(&vals, &names))) + if ((res= write_dynamic_row(count, vals, names))) goto err; } else @@ -2434,24 +2468,19 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) { /* find removed fields */ uint i= 0, j= 0; - LEX_STRING *onames= (LEX_STRING *)oldnames.buffer; - LEX_STRING *nnames= (LEX_STRING *)names.buffer; /* both array are sorted */ - for(; i < oldnames.elements; i++) + for(; i < oldcount; i++) { int scmp= 0; - while (j < names.elements && - (nnames[j].length < onames[i].length || - (nnames[j].length == onames[i].length && - (scmp= memcmp(nnames[j].str, onames[i].str, - onames[i].length)) < 0))) + while (j < count && + (scmp = mariadb_dyncol_column_cmp_named(names + j, + oldnames + i)) < 0) j++; - if (j < names.elements && - nnames[j].length == onames[i].length && + if (j < count && scmp == 0) j++; else - se->add_insert_delete_column(onames[i].str, onames[i].length); + se->add_insert_delete_column(oldnames[i].str, oldnames[i].length); } } @@ -2465,8 +2494,8 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data) err: if (dyncol_set) { - free_dynamic_row(&oldnames, &oldvals, oldfree_names); - free_dynamic_row(&names, &vals, free_names); + free_dynamic_row(&oldvals, &oldnames); + free_dynamic_row(&vals, &names); } DBUG_RETURN(res? HA_ERR_INTERNAL_ERROR: 0); diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index be8a49af493..ecd8bdb57e3 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -37,6 +37,8 @@ typedef struct st_cassandra_share { } CASSANDRA_SHARE; class ColumnDataConverter; +struct st_dynamic_column_value; +typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE; struct ha_table_option_struct; @@ -45,7 +47,8 @@ struct st_dynamic_column_value; typedef bool (* CAS2DYN_CONVERTER)(const char *cass_data, int cass_data_len, - struct st_dynamic_column_value *value); + struct st_dynamic_column_value *value, + MEM_ROOT *mem_root); typedef bool (* DYN2CAS_CONVERTER)(struct st_dynamic_column_value *value, char **cass_data, int *cass_data_len, @@ -227,11 +230,14 @@ private: bool source_exhausted; bool mrr_start_read(); int check_field_options(Field **fields); - int read_dyncol(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, - String *valcol, char **freenames); - int write_dynamic_row(DYNAMIC_ARRAY *names, DYNAMIC_ARRAY *vals); - void static free_dynamic_row(DYNAMIC_ARRAY *vals, DYNAMIC_ARRAY *names, - char *free_names); + int read_dyncol(uint *count, + DYNAMIC_COLUMN_VALUE **vals, LEX_STRING **names, + String *valcol); + int write_dynamic_row(uint count, + DYNAMIC_COLUMN_VALUE *vals, + LEX_STRING *names); + void static free_dynamic_row(DYNAMIC_COLUMN_VALUE **vals, + LEX_STRING **names); CASSANDRA_TYPE_DEF * get_cassandra_field_def(char *cass_name, int cass_name_length); public: From 082ff5931770ed70df0ec1e85f81fa880a4d9e62 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 23 Dec 2012 22:17:22 +0200 Subject: [PATCH 336/439] Post-post review fixes. --- include/ma_dyncol.h | 20 ++---------- mysql-test/r/cassandra.result | 54 +++++++++++++++---------------- mysql-test/r/dyncol.result | 26 +++++++-------- mysys/ma_dyncol.c | 60 +++++++++++++++++++++++++++-------- sql/item_func.h | 2 +- sql/item_strfunc.cc | 12 +++---- sql/item_strfunc.h | 8 ++--- 7 files changed, 100 insertions(+), 82 deletions(-) diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index 78d3f15978c..7f888759207 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -33,13 +33,6 @@ #include #include -/* - Max length for data in a dynamic colums. This comes from how the - how the offset are stored. -*/ -#define MAX_DYNAMIC_COLUMN_LENGTH 0X1FFFFFFFL -#define MAX_DYNAMIC_COLUMN_LENGTH_NM 0XFFFFFFFFFL - /* Limits of implementation */ @@ -101,7 +94,6 @@ struct st_dynamic_column_value typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE; -/* old functions (deprecated) */ #ifdef MADYNCOL_DEPRECATED enum enum_dyncol_func_result dynamic_column_create(DYNAMIC_COLUMN *str, @@ -168,7 +160,7 @@ mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, LEX_STRING *name); /* List of not NULL columns */ enum enum_dyncol_func_result -mariadb_dyncol_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint); +mariadb_dyncol_list(DYNAMIC_COLUMN *str, uint *count, uint **nums); enum enum_dyncol_func_result mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, LEX_STRING **names); @@ -213,17 +205,11 @@ int mariadb_dyncol_column_cmp_named(const LEX_STRING *s1, const LEX_STRING *s2); enum enum_dyncol_func_result mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count); -/*************************************************************************** - Internal functions, don't use if you don't know what you are doing... -***************************************************************************/ - -#define mariadb_dyncol_reassociate(V,P,L, A) dynstr_reassociate((V),(P),(L),(A)) - -#define dyncol_value_init(V) (V)->type= DYN_COL_NULL +#define mariadb_dyncol_value_init(V) (V)->type= DYN_COL_NULL /* Prepare value for using as decimal */ -void dynamic_column_prepare_decimal(DYNAMIC_COLUMN_VALUE *value); +void mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE *value); #endif diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index b5ff3194480..d11e2f66729 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -448,7 +448,7 @@ CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) insert into t2 values (1, column_create("dyn1", 1, "dyn2", "two")); select rowkey, column_json(dyn) from t2; rowkey column_json(dyn) -1 [{"dyn1":"1"},{"dyn2":"two"}] +1 {"dyn1":"1","dyn2":"two"} delete from t2; drop table t2; # bigint @@ -457,8 +457,8 @@ insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'a', 254324)); insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'a', 2543)); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"a":254324},{"dyn1":"1"},{"dyn2":"two"}] -2 [{"a":2543},{"dyn1":"1"},{"dyn2":"two"}] +1 {"a":254324,"dyn1":"1","dyn2":"two"} +2 {"a":2543,"dyn1":"1","dyn2":"two"} delete from t1; drop table t1; # int @@ -467,8 +467,8 @@ insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'intcol', 2543 insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'intcol', 2543)); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"dyn1":"1"},{"dyn2":"two"},{"intcol":254324}] -2 [{"dyn1":"1"},{"dyn2":"two"},{"intcol":2543}] +1 {"dyn1":"1","dyn2":"two","intcol":254324} +2 {"dyn1":"1","dyn2":"two","intcol":2543} delete from t1; drop table t1; # timestamp @@ -477,8 +477,8 @@ insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'datecol', 254 insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'datecol', 2543)); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"dyn1":"1"},{"dyn2":"two"},{"datecol":254324}] -2 [{"dyn1":"1"},{"dyn2":"two"},{"datecol":2543}] +1 {"dyn1":"1","dyn2":"two","datecol":254324} +2 {"dyn1":"1","dyn2":"two","datecol":2543} delete from t1; drop table t1; # boolean @@ -487,47 +487,47 @@ insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 254 insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 0)); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":1}] -2 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":0}] +1 {"dyn1":"1","dyn2":"two","boolcol":1} +2 {"dyn1":"1","dyn2":"two","boolcol":0} select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":1}] -2 [{"dyn1":"1"},{"dyn2":"two"},{"boolcol":0}] +1 {"dyn1":"1","dyn2":"two","boolcol":1} +2 {"dyn1":"1","dyn2":"two","boolcol":0} update t1 set dyn=column_add(dyn, "dyn2", null, "dyn3", "3"); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"dyn1":"1"},{"dyn3":"3"},{"boolcol":1}] -2 [{"dyn1":"1"},{"dyn3":"3"},{"boolcol":0}] +1 {"dyn1":"1","dyn3":"3","boolcol":1} +2 {"dyn1":"1","dyn3":"3","boolcol":0} update t1 set dyn=column_add(dyn, "dyn1", null) where rowkey= 1; select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"dyn3":"3"},{"boolcol":1}] -2 [{"dyn1":"1"},{"dyn3":"3"},{"boolcol":0}] +1 {"dyn3":"3","boolcol":1} +2 {"dyn1":"1","dyn3":"3","boolcol":0} update t1 set dyn=column_add(dyn, "dyn3", null, "a", "ddd"); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"a":"ddd"},{"boolcol":1}] -2 [{"a":"ddd"},{"dyn1":"1"},{"boolcol":0}] +1 {"a":"ddd","boolcol":1} +2 {"a":"ddd","dyn1":"1","boolcol":0} update t1 set dyn=column_add(dyn, "12345678901234", "ddd"); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"a":"ddd"},{"boolcol":1},{"12345678901234":"ddd"}] -2 [{"a":"ddd"},{"dyn1":"1"},{"boolcol":0},{"12345678901234":"ddd"}] +1 {"a":"ddd","boolcol":1,"12345678901234":"ddd"} +2 {"a":"ddd","dyn1":"1","boolcol":0,"12345678901234":"ddd"} update t1 set dyn=column_add(dyn, "12345678901234", null); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"a":"ddd"},{"boolcol":1}] -2 [{"a":"ddd"},{"dyn1":"1"},{"boolcol":0}] +1 {"a":"ddd","boolcol":1} +2 {"a":"ddd","dyn1":"1","boolcol":0} update t1 set dyn=column_add(dyn, 'boolcol', null) where rowkey= 2; select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"a":"ddd"},{"boolcol":1}] -2 [{"a":"ddd"},{"dyn1":"1"}] +1 {"a":"ddd","boolcol":1} +2 {"a":"ddd","dyn1":"1"} update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2; select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -1 [{"a":"ddd"},{"boolcol":1}] -3 [{"a":"ddd"},{"boolcol":0}] +1 {"a":"ddd","boolcol":1} +3 {"a":"ddd","boolcol":0} delete from t1; drop table t1; CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1'; @@ -567,14 +567,14 @@ ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = INSERT INTO t1 VALUES(2,column_create("ab","ab")); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -2 [{"ab":"ab"}] +2 {"ab":"ab"} UPDATE t1 set dyn=NULL; select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) INSERT INTO t1 VALUES(2,column_create("ab","ab")); select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) -2 [{"ab":"ab"}] +2 {"ab":"ab"} UPDATE t1 set dyn=""; select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index c8d23d75d6c..d50a5c0a27d 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1568,10 +1568,10 @@ ERROR 22007: Illegal value used as argument of dynamic column function # select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date)); column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" -[{"int":-1212},{"date":"2011-04-05"},{"time":"00:45:49.000001"},{"uint":12334},{"double":"1.23444e+50"},{"string":"gdgd\\dhdjh\"dhdhd"},{"decimal":23.344},{"datetime":"2011-04-05 00:45:49.000001"}] +{"int":-1212,"date":"2011-04-05","time":"00:45:49.000001","uint":12334,"double":"1.23444e+50","string":"gdgd\\dhdjh\"dhdhd","decimal":23.344,"datetime":"2011-04-05 00:45:49.000001"} select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)); column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)) -[{"1":-1212},{"2":12334},{"3":23.344},{"4":"1.23444e+50"},{"5":"gdgd\\dhdjh\"dhdhd"},{"6":"00:45:49.000001"},{"7":"2011-04-05 00:45:49.000001"},{"8":"2011-04-05"}] +{"1":-1212,"2":12334,"3":23.344,"4":"1.23444e+50","5":"gdgd\\dhdjh\"dhdhd","6":"00:45:49.000001","7":"2011-04-05 00:45:49.000001","8":"2011-04-05"} # # CHECK test # @@ -1592,48 +1592,48 @@ NULL # select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever")); column_json(column_create("string", "'\"/\\`.,whatever")) hex(column_create("string", "'\"/\\`.,whatever")) -[{"string":"'\"/\\`.,whatever"}] 040100060000000300737472696E670827222F5C602E2C7768617465766572 +{"string":"'\"/\\`.,whatever"} 040100060000000300737472696E670827222F5C602E2C7768617465766572 # # embedding test # select column_json(column_create("val", "val", "emb", column_create("val2", "val2"))); column_json(column_create("val", "val", "emb", column_create("val2", "val2"))) -[{"emb":[{"val2":"val2"}],{"val":"val"}] +{"emb":{"val2":"val2"},"val":"val"} select column_json(column_create(1, "val", 2, column_create(3, "val2"))); column_json(column_create(1, "val", 2, column_create(3, "val2"))) -[{"1":"val"},{"2":[{"3":"val2"}]] +{"1":"val","2":{"3":"val2"}} # # Time encoding # select hex(column_create("t", "800:46:06.23434" AS time)) as hex, column_json(column_create("t", "800:46:06.23434" AS time)) as json; hex json -04010001000000070074649363B82003 [{"t":"800:46:06.234340"}] +04010001000000070074649363B82003 {"t":"800:46:06.234340"} select hex(column_create(1, "800:46:06.23434" AS time)) as hex, column_json(column_create(1, "800:46:06.23434" AS time)) as json; hex json -000100010007649363B82003 [{"1":"800:46:06.234340"}] +000100010007649363B82003 {"1":"800:46:06.234340"} select hex(column_create("t", "800:46:06" AS time)) as hex, column_json(column_create("t", "800:46:06" AS time)) as json; hex json -04010001000000070074860B32 [{"t":"800:46:06"}] +04010001000000070074860B32 {"t":"800:46:06"} select hex(column_create(1, "800:46:06" AS time)) as hex, column_json(column_create(1, "800:46:06" AS time)) as json; hex json -000100010007000060B82003 [{"1":"800:46:06"}] +000100010007000060B82003 {"1":"800:46:06"} select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex, column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json; hex json -0401000100000005007495B90F649363B80A00 [{"t":"2012-12-21 10:46:06.234340"}] +0401000100000005007495B90F649363B80A00 {"t":"2012-12-21 10:46:06.234340"} select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex, column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json; hex json -00010001000595B90F649363B80A00 [{"1":"2012-12-21 10:46:06.234340"}] +00010001000595B90F649363B80A00 {"1":"2012-12-21 10:46:06.234340"} select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex, column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json; hex json -0401000100000005007495B90F86AB00 [{"t":"2012-12-21 10:46:06"}] +0401000100000005007495B90F86AB00 {"t":"2012-12-21 10:46:06"} select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex, column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json; hex json -00010001000595B90F000060B80A00 [{"1":"2012-12-21 10:46:06"}] +00010001000595B90F000060B80A00 {"1":"2012-12-21 10:46:06"} diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 34bb8b9de3d..575c2eceb11 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -2368,7 +2368,7 @@ dynamic_column_exists_internal(DYNAMIC_COLUMN *str, uint num_key, /** - List not-null columns in the packed string (only numeric foemat) + List not-null columns in the packed string (only numeric format) @param str The packed string @param array_of_uint Where to put reference on created array @@ -2377,12 +2377,6 @@ dynamic_column_exists_internal(DYNAMIC_COLUMN *str, uint num_key, */ enum enum_dyncol_func_result dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) -{ - return mariadb_dyncol_list(str, array_of_uint); -} - -enum enum_dyncol_func_result -mariadb_dyncol_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) { DYN_HEADER header; uchar *read; @@ -2417,6 +2411,48 @@ mariadb_dyncol_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint) return ER_DYNCOL_OK; } +/** + List not-null columns in the packed string (only numeric format) + + @param str The packed string + @param array_of_uint Where to put reference on created array + + @return ER_DYNCOL_* return code +*/ +enum enum_dyncol_func_result +mariadb_dyncol_list(DYNAMIC_COLUMN *str, uint *count, uint **nums) +{ + DYN_HEADER header; + uchar *read; + uint i; + enum enum_dyncol_func_result rc; + + (*nums)= 0; /* In case of errors */ + if (str->length == 0) + return ER_DYNCOL_OK; /* no columns */ + + if ((rc= init_read_hdr(&header, str)) < 0) + return rc; + + if (header.format != dyncol_fmt_num) + return ER_DYNCOL_FORMAT; + + if (header.entry_size * header.column_count + FIXED_HEADER_SIZE > + str->length) + return ER_DYNCOL_FORMAT; + + if (!((*nums)= my_malloc(sizeof(uint) * header.column_count, MYF(0)))) + return ER_DYNCOL_RESOURCE; + + for (i= 0, read= header.header; + i < header.column_count; + i++, read+= header.entry_size) + { + (*nums)[i]= uint2korr(read); + } + (*count)= header.column_count; + return ER_DYNCOL_OK; +} /** List not-null columns in the packed string (any format) @@ -4058,7 +4094,7 @@ mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json, rc= ER_DYNCOL_RESOURCE; - if (dynstr_append_mem(json, "[", 1)) + if (dynstr_append_mem(json, "{", 1)) goto err; for (i= 0, header.entry= header.header; i < header.column_count; @@ -4080,8 +4116,7 @@ mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json, rc= ER_DYNCOL_FORMAT; goto err; } - if ((rc= dynamic_column_get_value(&header, &val)) < 0 || - dynstr_append_mem(json, "{", 1)) + if ((rc= dynamic_column_get_value(&header, &val)) < 0) goto err; if (header.format == dyncol_fmt_num) { @@ -4125,12 +4160,11 @@ mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json, else { if ((rc= mariadb_dyncol_val_str(json, &val, - &my_charset_utf8_general_ci, '"')) < 0 || - dynstr_append_mem(json, "}", 1)) + &my_charset_utf8_general_ci, '"')) < 0) goto err; } } - if (dynstr_append_mem(json, "]", 1)) + if (dynstr_append_mem(json, "}", 1)) { rc= ER_DYNCOL_RESOURCE; goto err; diff --git a/sql/item_func.h b/sql/item_func.h index ccb86fd03e5..e13fa0834f0 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -58,7 +58,7 @@ public: NOW_FUNC, TRIG_COND_FUNC, SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC, EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC, - NEG_FUNC, GSYSVAR_FUNC, DYNCOL }; + NEG_FUNC, GSYSVAR_FUNC, DYNCOL_FUNC }; enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL, OPTIMIZE_EQUAL }; enum Type type() const { return FUNC_ITEM; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 706fbbff94d..5559ffa6c20 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -3837,7 +3837,7 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) if (type == DYN_COL_STRING && args[valpos]->type() == Item::FUNC_ITEM && - ((Item_func *)args[valpos])->functype() == DYNCOL) + ((Item_func *)args[valpos])->functype() == DYNCOL_FUNC) { force_names= 1; break; @@ -3904,7 +3904,7 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) } if (type == DYN_COL_STRING && args[valpos]->type() == Item::FUNC_ITEM && - ((Item_func *)args[valpos])->functype() == DYNCOL) + ((Item_func *)args[valpos])->functype() == DYNCOL_FUNC) { DBUG_ASSERT(names || force_names); type= DYN_COL_DYNCOL; @@ -3988,7 +3988,7 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) case DYN_COL_DECIMAL: if ((dres= args[valpos]->val_decimal(&dtmp))) { - dynamic_column_prepare_decimal(&vals[i]); + mariadb_dyncol_prepare_decimal(&vals[i]); DBUG_ASSERT(vals[i].x.decimal.value.len == dres->len); vals[i].x.decimal.value.intg= dres->intg; vals[i].x.decimal.value.frac= dres->frac; @@ -3998,7 +3998,7 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg) } else { - dynamic_column_prepare_decimal(&vals[i]); // just to be safe + mariadb_dyncol_prepare_decimal(&vals[i]); // just to be safe DBUG_ASSERT(args[valpos]->null_value); } break; @@ -4055,7 +4055,7 @@ String *Item_func_dyncol_create::val_str(String *str) /* Move result from DYNAMIC_COLUMN to str_value */ char *ptr; size_t length, alloc_length; - mariadb_dyncol_reassociate(&col, &ptr, &length, &alloc_length); + dynstr_reassociate(&col, &ptr, &length, &alloc_length); str_value.reassociate(ptr, (uint32) length, (uint32) alloc_length, &my_charset_bin); res= &str_value; @@ -4197,7 +4197,7 @@ String *Item_func_dyncol_add::val_str(String *str) /* Move result from DYNAMIC_COLUMN to str */ char *ptr; size_t length, alloc_length; - mariadb_dyncol_reassociate(&col, &ptr, &length, &alloc_length); + dynstr_reassociate(&col, &ptr, &length, &alloc_length); str->reassociate(ptr, (uint32) length, (uint32) alloc_length, &my_charset_bin); null_value= FALSE; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 8ef67654b35..d21c938f378 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1013,7 +1013,7 @@ public: const char *func_name() const{ return "column_create"; } String *val_str(String *); virtual void print(String *str, enum_query_type query_type); - virtual enum Functype functype() const { return DYNCOL; } + virtual enum Functype functype() const { return DYNCOL_FUNC; } }; @@ -1051,11 +1051,9 @@ class Item_dyncol_get: public Item_str_func public: Item_dyncol_get(Item *str, Item *num) :Item_str_func(str, num) - { - max_length= MAX_DYNAMIC_COLUMN_LENGTH; - } + {} void fix_length_and_dec() - { maybe_null= 1; } + { maybe_null= 1; max_length= MAX_BLOB_WIDTH; } /* Mark that collation can change between calls */ bool dynamic_result() { return 1; } From ffd5f8c8d4d48167852418cd1a1b17bdb2022e39 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 24 Dec 2012 08:36:22 +0400 Subject: [PATCH 337/439] Post-merge fixes: - update ha_cassandra::start_bulk_insert() definition to match those in class handler. --- storage/cassandra/ha_cassandra.cc | 2 +- storage/cassandra/ha_cassandra.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 5e04c7749d6..ad6fcf081fa 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -2033,7 +2033,7 @@ int ha_cassandra::write_row(uchar *buf) } -void ha_cassandra::start_bulk_insert(ha_rows rows) +void ha_cassandra::start_bulk_insert(ha_rows rows, uint flags) { int ires; if (!se && (ires= connect_and_check_options(table))) diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index ecd8bdb57e3..a57a754979c 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -208,7 +208,7 @@ public: virtual double read_time(uint, uint, ha_rows rows) { return (double) rows / 20.0+1; } - virtual void start_bulk_insert(ha_rows rows); + virtual void start_bulk_insert(ha_rows rows, uint flags); virtual int end_bulk_insert(); virtual int reset(); From 6f26aac9409e3456798e58a4ee4306e43c7ebf7b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Dec 2012 14:41:46 +0200 Subject: [PATCH 338/439] 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 339/439] 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 340/439] 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 341/439] 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 342/439] 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 655e30453135fd95c46ab02644e48e6813fc16f1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jan 2013 08:10:48 +0200 Subject: [PATCH 343/439] MDEV-4005 fix. Field matching fixed. DBUG_ASSERT fixed. --- mysql-test/r/cassandra.result | 11 ++++++++++ mysql-test/t/cassandra.test | 36 +++++++++++++++++++++++++++++++ storage/cassandra/ha_cassandra.cc | 3 ++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/cassandra.result b/mysql-test/r/cassandra.result index d11e2f66729..e26df069f93 100644 --- a/mysql-test/r/cassandra.result +++ b/mysql-test/r/cassandra.result @@ -580,3 +580,14 @@ select rowkey, column_json(dyn) from t1; rowkey column_json(dyn) delete from t1; DROP TABLE t1; +# +# MDEV-4005 #Server crashes on creating a Cassandra table +# with a mix of static and dynamic columns +# +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 ( +pk int primary key, +col_int int, +dyncol blob DYNAMIC_COLUMN_STORAGE=yes +) ENGINE=cassandra keyspace='bug' thrift_host = '127.0.0.1' column_family='cf1'; +drop table t1; diff --git a/mysql-test/t/cassandra.test b/mysql-test/t/cassandra.test index 93c81086de8..2b92956d974 100644 --- a/mysql-test/t/cassandra.test +++ b/mysql-test/t/cassandra.test @@ -664,6 +664,42 @@ select rowkey, column_json(dyn) from t1; delete from t1; DROP TABLE t1; +--echo # +--echo # MDEV-4005 #Server crashes on creating a Cassandra table +--echo # with a mix of static and dynamic columns +--echo # +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_cleanup.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql +drop keyspace bug; +EOF +--error 0,1,2 +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql + +--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cql +--write_file $MYSQLTEST_VARDIR/cassandra_test_init.cql + +CREATE KEYSPACE bug + WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' + AND strategy_options:replication_factor='1'; + +USE bug; +create columnfamily cf1 ( pk int primary key, col_int int, a bigint ); +EOF + +--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql + + +CREATE TABLE t1 ( + pk int primary key, + col_int int, + dyncol blob DYNAMIC_COLUMN_STORAGE=yes +) ENGINE=cassandra keyspace='bug' thrift_host = '127.0.0.1' column_family='cf1'; + +drop table t1; ############################################################################ ## Cassandra cleanup diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index ad6fcf081fa..f2067969a5b 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1517,6 +1517,7 @@ bool ha_cassandra::setup_field_converters(Field **field_arg, uint n_fields) DBUG_RETURN(true); } (*conv)->field= *field; + break; } } if (dyncol_set && !(*field)) // is needed and not found @@ -1611,7 +1612,7 @@ void ha_cassandra::free_field_converters() for (uint i=0; i < n_field_converters; i++) if (field_converters[i]) { - DBUG_ASSERT(!dyncol_set || i == dyncol_field); + DBUG_ASSERT(!dyncol_set || i != dyncol_field); delete field_converters[i]; } my_free(field_converters); From c9ff25f568df9112cb581348e865c79d8d663b4a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 9 Jan 2013 17:29:51 +0100 Subject: [PATCH 344/439] 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 345/439] 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 92d72ea59d73163fd31b572a7a7c28625f1737ca Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jan 2013 22:24:37 +0200 Subject: [PATCH 346/439] The library interface fixed. --- include/ma_dyncol.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index 7f888759207..c57aad1f1be 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -81,7 +81,7 @@ struct st_dynamic_column_value unsigned long long ulong_value; double double_value; struct { - LEX_STRING value; + MYSQL_LEX_STRING value; CHARSET_INFO *charset; } string; struct { @@ -136,7 +136,7 @@ mariadb_dyncol_create_many(DYNAMIC_COLUMN *str, enum enum_dyncol_func_result mariadb_dyncol_create_many_named(DYNAMIC_COLUMN *str, uint column_count, - LEX_STRING *column_keys, + MYSQL_LEX_STRING *column_keys, DYNAMIC_COLUMN_VALUE *values, my_bool new_string); @@ -149,20 +149,21 @@ mariadb_dyncol_update_many(DYNAMIC_COLUMN *str, enum enum_dyncol_func_result mariadb_dyncol_update_many_named(DYNAMIC_COLUMN *str, uint add_column_count, - LEX_STRING *column_keys, + MYSQL_LEX_STRING *column_keys, DYNAMIC_COLUMN_VALUE *values); enum enum_dyncol_func_result mariadb_dyncol_exists(DYNAMIC_COLUMN *org, uint column_nr); enum enum_dyncol_func_result -mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, LEX_STRING *name); +mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name); /* List of not NULL columns */ enum enum_dyncol_func_result mariadb_dyncol_list(DYNAMIC_COLUMN *str, uint *count, uint **nums); enum enum_dyncol_func_result -mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, LEX_STRING **names); +mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, + MYSQL_LEX_STRING **names); /* if the column do not exists it is NULL @@ -171,7 +172,7 @@ enum enum_dyncol_func_result mariadb_dyncol_get(DYNAMIC_COLUMN *org, uint column_nr, DYNAMIC_COLUMN_VALUE *store_it_here); enum enum_dyncol_func_result -mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, LEX_STRING *name, +mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name, DYNAMIC_COLUMN_VALUE *store_it_here); my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str); @@ -198,9 +199,10 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val); enum enum_dyncol_func_result mariadb_dyncol_unpack(DYNAMIC_COLUMN *str, uint *count, - LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals); + MYSQL_LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals); -int mariadb_dyncol_column_cmp_named(const LEX_STRING *s1, const LEX_STRING *s2); +int mariadb_dyncol_column_cmp_named(const MYSQL_LEX_STRING *s1, + const MYSQL_LEX_STRING *s2); enum enum_dyncol_func_result mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count); From d27d9d76a8c13f339b6789c02d3e6eb71bdbf497 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jan 2013 22:32:21 +0200 Subject: [PATCH 347/439] fixed feature counter. --- sql/item_strfunc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 8ea19078524..53a7b9a1fca 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -3805,7 +3805,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref) sizeof(uint)) * (arg_count / 2)); keys_str= (LEX_STRING *) keys_num; - //status_var_increment(thd->status_var.feature_dynamic_columns); + status_var_increment(thd->status_var.feature_dynamic_columns); } return res || vals == 0 || keys_num == 0; } From 363436ede1abb1afcb679db351991b9bbe9ad70b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jan 2013 00:07:44 +0200 Subject: [PATCH 348/439] Make cassandra module and do not load it by default. --- mysql-test/include/have_cassandra.opt | 2 +- sql/sql_plugin.cc | 3 ++- storage/cassandra/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/have_cassandra.opt b/mysql-test/include/have_cassandra.opt index 92d642a5e4c..ee3c12dc46c 100644 --- a/mysql-test/include/have_cassandra.opt +++ b/mysql-test/include/have_cassandra.opt @@ -1 +1 @@ ---cassandra=on +--plugin-load=$HA_CASSANDRA_SO --cassandra=on diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index e15f6339847..45e8adf1f5f 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -175,7 +175,8 @@ static struct /* we disable few other plugins by default */ { "ndbcluster", PLUGIN_OFF }, { "feedback", PLUGIN_OFF }, - { "pbxt", PLUGIN_OFF } + { "pbxt", PLUGIN_OFF }, + { "cassandra", PLUGIN_OFF } }; /* support for Services */ diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index 7852177b9b3..5db15542443 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -22,5 +22,5 @@ STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) #LINK_DIRECTORIES(/home/psergey/cassandra/thrift/lib) -MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE LINK_LIBRARIES thrift) +MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES thrift) # was: STORAGE_ENGINE MANDATORY From 0a5312dc2f257582c64e092ec9b591ff3b20d207 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jan 2013 01:01:15 +0200 Subject: [PATCH 349/439] Make cassandra not built by default --- cmake/build_configurations/mysql_release.cmake | 2 +- storage/cassandra/CMakeLists.txt | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 1387eea4dcc..a8097f03824 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -46,7 +46,7 @@ SET(FEATURE_SET_large 5) SET(FEATURE_SET_xlarge 6) SET(FEATURE_SET_community 7) -SET(WITH_CASSANDRA_STORAGE_ENGINE ON) +#SET(WITH_CASSANDRA_STORAGE_ENGINE ON) IF(FEATURE_SET) STRING(TOLOWER ${FEATURE_SET} feature_set) diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index 5db15542443..98644b7798b 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -1,4 +1,10 @@ + +IF(NOT WITH_CASSANDRA_STORAGE_ENGINE) + SET(WITHOUT_CASSANDRA 1) +ENDIF(NOT WITH_CASSANDRA_STORAGE_ENGINE) + + SET(cassandra_sources ha_cassandra.cc ha_cassandra.h @@ -13,8 +19,8 @@ SET(cassandra_sources #INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) -INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) -#INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) +#INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) +INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) #INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) # From e731331c533c87b14e79bc996cc9d2ec0616ad17 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jan 2013 11:39:43 +0200 Subject: [PATCH 350/439] fix cassandra SE test to be working in case of not built cassandra. --- mysql-test/include/have_cassandra.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/include/have_cassandra.opt b/mysql-test/include/have_cassandra.opt index ee3c12dc46c..98a4a081de5 100644 --- a/mysql-test/include/have_cassandra.opt +++ b/mysql-test/include/have_cassandra.opt @@ -1 +1 @@ ---plugin-load=$HA_CASSANDRA_SO --cassandra=on +--plugin-load=$HA_CASSANDRA_SO --loose-cassandra=on From cd2f2c539566d907405cc9225b4a0c82d6e24563 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jan 2013 13:47:47 +0200 Subject: [PATCH 351/439] append_identifier() declaration fixed. --- sql/item_strfunc.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 53a7b9a1fca..a2bbdd63b40 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -57,6 +57,7 @@ C_MODE_START #include "../mysys/my_static.h" // For soundex_map C_MODE_END +#include "sql_show.h" // append_identifier /** @todo Remove this. It is not safe to use a shared String object. @@ -4664,9 +4665,6 @@ null: return 1; } -void -append_identifier(THD *thd, String *packet, const char *name, uint length); - void Item_dyncol_get::print(String *str, enum_query_type query_type) { str->append(STRING_WITH_LEN("column_get(")); From 26b5351caccbfa1cbd19d6dd55716ddc104a230a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jan 2013 17:12:31 +0200 Subject: [PATCH 352/439] 32 bit systems warnings fixed. --- mysys/ma_dyncol.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 575c2eceb11..411e5295a2c 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -351,7 +351,7 @@ static my_bool type_and_offset_store_named(uchar *place, size_t offset_size, DYNAMIC_COLUMN_TYPE type, size_t offset) { - ulong val = (((ulong) offset) << 4) | (type - 1); + ulonglong val = (((ulong) offset) << 4) | (type - 1); DBUG_ASSERT(type != DYN_COL_NULL); DBUG_ASSERT(((type - 1) & (~0xf)) == 0); /* fit in 4 bits */ DBUG_ASSERT(offset_size >= 2 && offset_size <= 5); @@ -375,7 +375,7 @@ static my_bool type_and_offset_store_named(uchar *place, size_t offset_size, int4store(place, val); break; case 5: - if (offset >= 0xfffffffff) /* all 1 value is reserved */ + if (offset >= 0xfffffffffull) /* all 1 value is reserved */ return TRUE; int5store(place, val); break; @@ -476,7 +476,7 @@ static size_t dynamic_column_offset_bytes_named(size_t data_length) return 3; if (data_length < 0xfffffff) /* all 1 value is reserved */ return 4; - if (data_length < 0xfffffffff) /* all 1 value is reserved */ + if (data_length < 0xfffffffffull) /* all 1 value is reserved */ return 5; return MAX_OFFSET_LENGTH_NM + 1; /* For an error generation */ } @@ -548,7 +548,7 @@ static my_bool type_and_offset_read_named(DYNAMIC_COLUMN_TYPE *type, break; case 5: val= uint5korr(place); - lim= 0xfffffffff; + lim= 0xfffffffffull; break; case 1: default: @@ -3956,7 +3956,7 @@ mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) rc= ER_DYNCOL_TRUNCATED; break; case DYN_COL_DATETIME: - *ll= (val->x.time_value.year * 10000000000L + + *ll= (val->x.time_value.year * 10000000000ull + val->x.time_value.month * 100000000L + val->x.time_value.day * 1000000 + val->x.time_value.hour * 10000 + @@ -4022,7 +4022,7 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) rc= ER_DYNCOL_TRUNCATED; break; case DYN_COL_DATETIME: - *dbl= (double)(val->x.time_value.year * 10000000000L + + *dbl= (double)(val->x.time_value.year * 10000000000ull + val->x.time_value.month * 100000000L + val->x.time_value.day * 1000000 + val->x.time_value.hour * 10000 + From 7b81b641665fcba5aaaebe179c4ebf30c00143df Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 10 Jan 2013 17:10:58 +0400 Subject: [PATCH 353/439] MDEV-3982: show_explain.test fails, times out or crashes Backport the fix from 10.0 tree - The problem was that thd_killed() may be called by innodb from an internal innodb thread. - Fixed by not processing APC requests when we're not in the thread that owns the APC target. --- sql/sql_class.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 5da1cbc90cc..d6a0eaf9b52 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3860,12 +3860,16 @@ void THD::restore_backup_open_tables_state(Open_tables_backup *backup) extern "C" int thd_killed(const MYSQL_THD thd) { + THD* current= current_thd; if (!thd) thd= current_thd; - Apc_target *apc_target= (Apc_target*)&thd->apc_target; - if (apc_target->have_apc_requests()) - apc_target->process_apc_requests(); + if (thd == current) + { + Apc_target *apc_target= (Apc_target*)&thd->apc_target; + if (apc_target->have_apc_requests()) + apc_target->process_apc_requests(); + } if (!(thd->killed & KILL_HARD_BIT)) return 0; From 4d6e5b2fed80b20272d632d4f1b77f10cb2d7789 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jan 2013 19:47:07 +0200 Subject: [PATCH 354/439] fixed crossplatform double values representation. --- mysql-test/r/dyncol.result | 4 ++-- mysys/ma_dyncol.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index d50a5c0a27d..925fb38a0f8 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1568,10 +1568,10 @@ ERROR 22007: Illegal value used as argument of dynamic column function # select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date)); column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" -{"int":-1212,"date":"2011-04-05","time":"00:45:49.000001","uint":12334,"double":"1.23444e+50","string":"gdgd\\dhdjh\"dhdhd","decimal":23.344,"datetime":"2011-04-05 00:45:49.000001"} +{"int":-1212,"date":"2011-04-05","time":"00:45:49.000001","uint":12334,"double":"1.2e50","string":"gdgd\\dhdjh\"dhdhd","decimal":23.344,"datetime":"2011-04-05 00:45:49.000001"} select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)); column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)) -{"1":-1212,"2":12334,"3":23.344,"4":"1.23444e+50","5":"gdgd\\dhdjh\"dhdhd","6":"00:45:49.000001","7":"2011-04-05 00:45:49.000001","8":"2011-04-05"} +{"1":-1212,"2":12334,"3":23.344,"4":"1.2e50","5":"gdgd\\dhdjh\"dhdhd","6":"00:45:49.000001","7":"2011-04-05 00:45:49.000001","8":"2011-04-05"} # # CHECK test # diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 411e5295a2c..0562ac8f064 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -3815,7 +3815,7 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, return ER_DYNCOL_RESOURCE; break; case DYN_COL_DOUBLE: - len= snprintf(buff, sizeof(buff), "%lg", val->x.double_value); + len= my_snprintf(buff, sizeof(buff), "%g", val->x.double_value); if (dynstr_realloc(str, len + (quote ? 2 : 0))) return ER_DYNCOL_RESOURCE; if (quote) From 396f4d62c69335b8f7aefd43bbe099e8bb9e6905 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 10 Jan 2013 23:40:18 +0200 Subject: [PATCH 355/439] 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 356/439] 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 357/439] 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 358/439] 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 359/439] 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 360/439] 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 31efe8e0cb6a3df79fc5890dfad9bce8ae4965d9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Jan 2013 13:27:19 +0200 Subject: [PATCH 361/439] Fix windows compiler warnings. --- mysys/ma_dyncol.c | 56 +++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 0562ac8f064..bae89de2e2f 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -167,7 +167,7 @@ struct st_dyn_header uchar *entry, *data, *name; size_t offset; - uint length; + size_t length; enum enum_dynamic_column_type type; }; @@ -227,7 +227,12 @@ static int column_sort_num(const void *a, const void *b) int mariadb_dyncol_column_cmp_named(const LEX_STRING *s1, const LEX_STRING *s2) { - int rc= s1->length - s2->length; + /* + We compare instead of subtraction to avoid data loss in case of huge + length difference (more then fit in int). + */ + int rc= (s1->length > s2->length ? 1 : + (s1->length < s2->length ? -1 : 0)); if (rc == 0) rc= memcmp((void *)s1->str, (void *)s2->str, (size_t) s1->length); @@ -273,7 +278,7 @@ static my_bool check_limit_named(const void *val) static void set_fixed_header_num(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) { - set_fixed_header(str, hdr->offset_size, hdr->column_count); + set_fixed_header(str, (uint)hdr->offset_size, hdr->column_count); hdr->header= (uchar *)str->str + FIXED_HEADER_SIZE; hdr->nmpool= hdr->dtpool= hdr->header + hdr->header_size; } @@ -288,8 +293,9 @@ static void set_fixed_header_named(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) DBUG_ASSERT(hdr->column_count <= 0xffff); DBUG_ASSERT(hdr->offset_size <= MAX_OFFSET_LENGTH_NM); /* size of data offset, named format flag, size of names offset (0 means 2) */ - str->str[0]= ((str->str[0] & ~(DYNCOL_FLG_OFFSET | DYNCOL_FLG_NMOFFSET)) | - (hdr->offset_size - 2) | DYNCOL_FLG_NAMES); + str->str[0]= + (char) ((str->str[0] & ~(DYNCOL_FLG_OFFSET | DYNCOL_FLG_NMOFFSET)) | + (hdr->offset_size - 2) | DYNCOL_FLG_NAMES); int2store(str->str + 1, hdr->column_count); /* columns number */ int2store(str->str + 3, hdr->nmpool_size); hdr->header= (uchar *)str->str + FIXED_HEADER_SIZE_NM; @@ -529,8 +535,8 @@ static my_bool type_and_offset_read_named(DYNAMIC_COLUMN_TYPE *type, size_t *offset, uchar *place, size_t offset_size) { - ulong UNINIT_VAR(val); - ulong UNINIT_VAR(lim); + ulonglong UNINIT_VAR(val); + ulonglong UNINIT_VAR(lim); DBUG_ASSERT(offset_size >= 2 && offset_size <= 5); switch (offset_size) { @@ -1671,8 +1677,8 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, all_headers_size= fmt->fixed_hdr + hdr->header_size + hdr->nmpool_size; for (i= 0; i < column_count; i++) { - uint ord= ((uchar*)columns_order[i] - (uchar*)column_keys) / - fmt->key_size_in_array; + uint ord= (uint)(((uchar*)columns_order[i] - (uchar*)column_keys) / + fmt->key_size_in_array); if (values[ord].type != DYN_COL_NULL) { /* Store header first in the str */ @@ -2626,8 +2632,8 @@ struct st_plan { void *key; uchar *place; size_t length; - int hdelta, ddelta, ndelta; - uint mv_offset, mv_length, mv_end; + long long hdelta, ddelta, ndelta; + long long mv_offset, mv_length, mv_end; PLAN_ACT act; }; typedef struct st_plan PLAN; @@ -2850,7 +2856,7 @@ dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, size_t curr_offset; write= (uchar *)str->str + FIXED_HEADER_SIZE; - set_fixed_header(str, new_offset_size, new_column_count); + set_fixed_header(str, (uint)new_offset_size, new_column_count); /* Move headers first. @@ -3284,10 +3290,10 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, uchar *element; DYN_HEADER header, new_header; struct st_service_funcs *fmt, *new_fmt; - long data_delta= 0, name_delta= 0; + long long data_delta= 0, name_delta= 0; uint i; uint not_null; - int header_delta= 0; + long long header_delta= 0; int copy= FALSE; int header_delta_sign, data_delta_sign; enum enum_dyncol_func_result rc; @@ -3802,7 +3808,7 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, CHARSET_INFO *cs, char quote) { char buff[40]; - int len; + size_t len; switch (val->type) { case DYN_COL_INT: len= snprintf(buff, sizeof(buff), "%lld", val->x.long_value); @@ -3873,13 +3879,15 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, break; } case DYN_COL_DECIMAL: - len= sizeof(buff); - decimal2string(&val->x.decimal.value, buff, &len, - 0, val->x.decimal.value.frac, - '0'); - if (dynstr_append_mem(str, buff, len)) - return ER_DYNCOL_RESOURCE; - break; + { + int len= sizeof(buff); + decimal2string(&val->x.decimal.value, buff, &len, + 0, val->x.decimal.value.frac, + '0'); + if (dynstr_append_mem(str, buff, len)) + return ER_DYNCOL_RESOURCE; + break; + } case DYN_COL_DATETIME: case DYN_COL_DATE: case DYN_COL_TIME: @@ -3924,9 +3932,9 @@ mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) break; case DYN_COL_STRING: { - longlong i= 0, sign= 1; char *src= val->x.string.value.str; - uint len= val->x.string.value.length; + size_t len= val->x.string.value.length; + longlong i= 0, sign= 1; while (len && my_isspace(&my_charset_latin1, *src)) src++,len--; From d8acafcbf273120726dea27507a1a3ab7b0bd821 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 11 Jan 2013 12:44:21 +0100 Subject: [PATCH 362/439] 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 bc75820fb7fa4c945c164dea9eac8e19058d7605 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Jan 2013 14:12:59 +0200 Subject: [PATCH 363/439] Windows compiler warnings fix. --- mysys/ma_dyncol.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index bae89de2e2f..0fdce15f423 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -2633,7 +2633,8 @@ struct st_plan { uchar *place; size_t length; long long hdelta, ddelta, ndelta; - long long mv_offset, mv_length, mv_end; + long long mv_offset, mv_length; + uint mv_end; PLAN_ACT act; }; typedef struct st_plan PLAN; @@ -3294,8 +3295,8 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, uint i; uint not_null; long long header_delta= 0; + long long header_delta_sign, data_delta_sign; int copy= FALSE; - int header_delta_sign, data_delta_sign; enum enum_dyncol_func_result rc; my_bool convert; @@ -3495,7 +3496,7 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str, plan[add_column_count].act= PLAN_NOP; plan[add_column_count].place= header.dtpool; - new_header.column_count= header.column_count + header_delta; + new_header.column_count= (uint)(header.column_count + header_delta); /* Check if it is only "increasing" or only "decreasing" plan for (header @@ -3835,11 +3836,11 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, { char *alloc= NULL; char *from= val->x.string.value.str; - uint bufflen; + ulong bufflen; my_bool conv= !my_charset_same(val->x.string.charset, cs); my_bool rc; len= val->x.string.value.length; - bufflen= (len * (conv ? cs->mbmaxlen : 1)); + bufflen= (ulong)(len * (conv ? cs->mbmaxlen : 1)); if (dynstr_realloc(str, bufflen)) return ER_DYNCOL_RESOURCE; @@ -3852,7 +3853,7 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, /* convert to the destination */ str->length+= copy_and_convert_extended(str->str, bufflen, cs, - from, len, + from, (uint32)len, val->x.string.charset, &dummy_errors); return ER_DYNCOL_OK; @@ -3861,7 +3862,8 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, { len= copy_and_convert_extended(alloc, bufflen, cs, - from, len, val->x.string.charset, + from, (uint32)len, + val->x.string.charset, &dummy_errors); from= alloc; } From 12bf6fe85893f6a69a74ec1c733e533051058dd3 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 11 Jan 2013 20:26:34 -0800 Subject: [PATCH 364/439] 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 7d5c56cb410bd0363e1c66c31149a79086584bbb Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sun, 13 Jan 2013 00:40:38 -0800 Subject: [PATCH 365/439] Fixed bug mdev-4019. The bug could cause a crash when several connections needed persistent statistics for the same table. Also added a missing call of set_statistics_for_table() in the code of the function mysql_update. --- mysql-test/r/stat_tables_par.result | 20 +++++++++++++ mysql-test/r/stat_tables_par_innodb.result | 20 +++++++++++++ mysql-test/t/stat_tables_par.test | 33 ++++++++++++++++++++++ sql/sql_base.cc | 1 + sql/sql_statistics.cc | 10 +++++-- sql/sql_update.cc | 2 ++ sql/table.h | 1 + 7 files changed, 85 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/stat_tables_par.result b/mysql-test/r/stat_tables_par.result index 76a42e993f6..a98f934fa96 100644 --- a/mysql-test/r/stat_tables_par.result +++ b/mysql-test/r/stat_tables_par.result @@ -219,4 +219,24 @@ set debug_sync='RESET'; set global use_stat_tables=@save_global_use_stat_tables; DROP DATABASE dbt3_s001; use test; +set @save_global_use_stat_tables=@@global.use_stat_tables; +set global use_stat_tables='preferably'; +set debug_sync='RESET'; +create table t1 (a int, b int, key(a)); +insert t1 values (1,1),(2,2); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SET debug_sync='after_open_table_ignore_flush WAIT_FOR go'; +select * from information_schema.statistics where table_schema='test'; +select * from t1; +a b +1 1 +2 2 +SET DEBUG_SYNC= "now SIGNAL go"; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT +def test t1 1 test a 1 a A 2 NULL NULL YES BTREE +set debug_sync='RESET'; +drop table t1; +set global use_stat_tables=@save_global_use_stat_tables; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/stat_tables_par_innodb.result b/mysql-test/r/stat_tables_par_innodb.result index ff1a296e5af..e0c00c482a0 100644 --- a/mysql-test/r/stat_tables_par_innodb.result +++ b/mysql-test/r/stat_tables_par_innodb.result @@ -228,6 +228,26 @@ set debug_sync='RESET'; set global use_stat_tables=@save_global_use_stat_tables; DROP DATABASE dbt3_s001; use test; +set @save_global_use_stat_tables=@@global.use_stat_tables; +set global use_stat_tables='preferably'; +set debug_sync='RESET'; +create table t1 (a int, b int, key(a)); +insert t1 values (1,1),(2,2); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SET debug_sync='after_open_table_ignore_flush WAIT_FOR go'; +select * from information_schema.statistics where table_schema='test'; +select * from t1; +a b +1 1 +2 2 +SET DEBUG_SYNC= "now SIGNAL go"; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT +def test t1 1 test a 1 a A 2 NULL NULL YES BTREE +set debug_sync='RESET'; +drop table t1; +set global use_stat_tables=@save_global_use_stat_tables; set use_stat_tables=@save_use_stat_tables; set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/stat_tables_par.test b/mysql-test/t/stat_tables_par.test index 57b57e3ebba..6c4e1be6e48 100644 --- a/mysql-test/t/stat_tables_par.test +++ b/mysql-test/t/stat_tables_par.test @@ -242,4 +242,37 @@ DROP DATABASE dbt3_s001; use test; +# +# Bug mdev-4019: crash when executing in parallel ANALYZE and +# SELECT * FROM information_schema.statistics +# + +set @save_global_use_stat_tables=@@global.use_stat_tables; +set global use_stat_tables='preferably'; +set debug_sync='RESET'; + +create table t1 (a int, b int, key(a)); +insert t1 values (1,1),(2,2); + +analyze table t1; + +SET debug_sync='after_open_table_ignore_flush WAIT_FOR go'; +send select * from information_schema.statistics where table_schema='test'; + +connect(con1, localhost, root); +connection con1; +select * from t1; +SET DEBUG_SYNC= "now SIGNAL go"; + +connection default; +reap; + +connection default; +disconnect con1; +set debug_sync='RESET'; + +drop table t1; +set global use_stat_tables=@save_global_use_stat_tables; + + set use_stat_tables=@save_use_stat_tables; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index b7f321e6290..cb1555ea142 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4654,6 +4654,7 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables, Field **table_field_ptr= tables->table->field; for ( ; *field_ptr; field_ptr++, table_field_ptr++) (*table_field_ptr)->read_stats= (*field_ptr)->read_stats; + tables->table->stats_is_read= table_share->stats_cb.stats_is_read; } } } diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 9de5aa080e1..68f26ebf90b 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2501,6 +2501,8 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables) } } + table->stats_is_read= TRUE; + DBUG_RETURN(0); } @@ -2559,6 +2561,8 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables) table_share->stats_cb.stats_can_be_read && !table_share->stats_cb.stats_is_read) return TRUE; + if (table_share->stats_cb.stats_is_read) + tl->table->stats_is_read= TRUE; } } @@ -2618,6 +2622,8 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables) (void) read_statistics_for_table(thd, tl->table, stat_tables); table_share->stats_cb.stats_is_read= TRUE; } + if (table_share->stats_cb.stats_is_read) + tl->table->stats_is_read= TRUE; } } @@ -3045,7 +3051,7 @@ void set_statistics_for_table(THD *thd, TABLE *table) Use_stat_tables_mode use_stat_table_mode= get_use_stat_tables_mode(thd); table->used_stat_records= (use_stat_table_mode <= COMPLEMENTARY || - !stats_cb->stats_is_read || read_stats->cardinality_is_null) ? + !table->stats_is_read || read_stats->cardinality_is_null) ? table->file->stats.records : read_stats->cardinality; KEY *key_info, *key_info_end; for (key_info= table->key_info, key_info_end= key_info+table->s->keys; @@ -3053,7 +3059,7 @@ void set_statistics_for_table(THD *thd, TABLE *table) { key_info->is_statistics_from_stat_tables= (use_stat_table_mode > COMPLEMENTARY && - stats_cb->stats_is_read && + table->stats_is_read && key_info->read_stats->avg_frequency_is_inited() && key_info->read_stats->get_avg_frequency(0) > 0.5); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 78b693c5237..31df7a2a4b1 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -32,6 +32,7 @@ #include "sql_view.h" // check_key_in_view #include "sp_head.h" #include "sql_trigger.h" +#include "sql_statistics.h" #include "probes_mysql.h" #include "debug_sync.h" #include "key.h" // is_key_used @@ -404,6 +405,7 @@ int mysql_update(THD *thd, #endif /* Update the table->file->stats.records number */ table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); + set_statistics_for_table(thd, table); select= make_select(table, 0, 0, conds, 0, &error); if (error || !limit || thd->is_error() || diff --git a/sql/table.h b/sql/table.h index a2b197ac1f3..ac0eb0dad89 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1189,6 +1189,7 @@ public: bool no_partitions_used; /* If true, all partitions have been pruned away */ #endif uint max_keys; /* Size of allocated key_info array. */ + bool stats_is_read; /* Persistent statistics is read for the table */ MDL_ticket *mdl_ticket; void init(THD *thd, TABLE_LIST *tl); From 72695309385d19e783f1c4e25fba4f6388bbea30 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Sun, 13 Jan 2013 17:01:34 +0400 Subject: [PATCH 366/439] MDEV-3990: engine tests went out of sync with current MariaDB code Reasons: alter_tablespace.rdiff: tc_rename_error.result: from monty@askmonty.org-20120529213755-876ptdhhaj0t7l8r (Added text for errno in error messages) insert_time.result: from sergii@pisem.net-20120908101555-37w00eyfrd9noc06 (MDEV-457 - Inconsistent data truncation) misc.result: from igor@askmonty.org-20130109033433-5awdv0w6vbpigltw (MDEV-3806/mwl248 - Engine independent statistics) tbl_opt_row_format.rdiff: from monty@askmonty.org-20120706161018-y5teinbuqpchle2m (Fixed wrong error codes) vcol.rdiff: sergii@pisem.net-20121217100039-ikj1820nrku7p6d5 (simplify the handler api) --- .../suite/engines/funcs/r/tc_rename_error.result | 2 +- mysql-test/suite/engines/iuds/r/insert_time.result | 7 ------- mysql-test/suite/storage_engine/misc.result | 9 +++++++++ .../mysql-test/storage_engine/alter_tablespace.rdiff | 11 +++++++++++ .../storage_engine/tbl_opt_row_format.rdiff | 2 +- .../myisammrg/mysql-test/storage_engine/vcol.rdiff | 2 +- 6 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 storage/innobase/mysql-test/storage_engine/alter_tablespace.rdiff diff --git a/mysql-test/suite/engines/funcs/r/tc_rename_error.result b/mysql-test/suite/engines/funcs/r/tc_rename_error.result index 1ac32ddf010..bd1c2abc057 100644 --- a/mysql-test/suite/engines/funcs/r/tc_rename_error.result +++ b/mysql-test/suite/engines/funcs/r/tc_rename_error.result @@ -15,7 +15,7 @@ ERROR 42S01: Table 't1' already exists RENAME TABLE t3 TO t1; ERROR 42S01: Table 't1' already exists RENAME TABLE t3 TO doesnotexist.t1; -ERROR HY000: Can't find file: './test/t3.frm' (errno: 2) +ERROR HY000: Can't find file: './test/t3.frm' (errno: 2 "No such file or directory") SHOW TABLES; Tables_in_test t1 diff --git a/mysql-test/suite/engines/iuds/r/insert_time.result b/mysql-test/suite/engines/iuds/r/insert_time.result index 0f588274fc1..dceba37ae8e 100644 --- a/mysql-test/suite/engines/iuds/r/insert_time.result +++ b/mysql-test/suite/engines/iuds/r/insert_time.result @@ -5167,7 +5167,6 @@ c1 c2 c3 825:23:00 825:23:00 2009-01-05 10:00:00 10:00:00 2009-01-06 00:00:45 00:00:45 2009-01-07 -00:00:00 00:00:00 2009-01-09 838:59:59 838:59:59 2009-01-10 10:11:12 10:11:12 2009-01-11 11:11:12 11:11:12 2009-01-12 @@ -5178,18 +5177,12 @@ c1 c2 c3 11:11:27 11:11:27 2009-01-17 08:03:02 08:03:02 2009-01-18 00:11:12 00:11:12 2009-01-19 -00:00:11 00:00:11 2009-01-20 00:12:30 00:12:30 2009-01-23 09:00:45 09:00:45 2009-01-24 09:36:00 09:36:00 2009-01-25 -00:00:10 00:00:10 2009-01-26 -00:00:00 00:00:00 2009-01-27 -00:00:00 00:00:00 2009-01-28 -00:00:00 00:00:00 2009-01-29 262:22:00 262:22:00 2009-01-30 00:00:12 00:00:12 2009-01-31 08:29:45 NULL 2009-02-01 -00:00:00 07:23:55 NULL TRUNCATE TABLE t5; DROP TABLE t5; DROP TABLE t1,t2,t3,t4; diff --git a/mysql-test/suite/storage_engine/misc.result b/mysql-test/suite/storage_engine/misc.result index 591f172d796..b79c78172ed 100644 --- a/mysql-test/suite/storage_engine/misc.result +++ b/mysql-test/suite/storage_engine/misc.result @@ -28,6 +28,9 @@ DROP EVENT ev1; SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME; TABLE_NAME COLUMN_NAME REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME +column_stats column_name NULL NULL +column_stats db_name NULL NULL +column_stats table_name NULL NULL columns_priv Column_name NULL NULL columns_priv Db NULL NULL columns_priv Host NULL NULL @@ -49,6 +52,10 @@ help_topic help_topic_id NULL NULL help_topic name NULL NULL host Db NULL NULL host Host NULL NULL +index_stats db_name NULL NULL +index_stats index_name NULL NULL +index_stats prefix_arity NULL NULL +index_stats table_name NULL NULL ndb_binlog_index epoch NULL NULL plugin name NULL NULL proc db NULL NULL @@ -64,6 +71,8 @@ proxies_priv Proxied_host NULL NULL proxies_priv Proxied_user NULL NULL proxies_priv User NULL NULL servers Server_name NULL NULL +table_stats db_name NULL NULL +table_stats table_name NULL NULL tables_priv Db NULL NULL tables_priv Host NULL NULL tables_priv Table_name NULL NULL diff --git a/storage/innobase/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/innobase/mysql-test/storage_engine/alter_tablespace.rdiff new file mode 100644 index 00000000000..0cbe1fa48ae --- /dev/null +++ b/storage/innobase/mysql-test/storage_engine/alter_tablespace.rdiff @@ -0,0 +1,11 @@ +--- suite/storage_engine/alter_tablespace.result 2013-01-13 01:03:49.133994000 +0400 ++++ suite/storage_engine/alter_tablespace.reject 2013-01-13 01:04:04.398937286 +0400 +@@ -10,7 +10,7 @@ + 2 + ALTER TABLE t1 DISCARD TABLESPACE; + SELECT * FROM t1; +-ERROR HY000: Got error -1 from storage engine ++ERROR HY000: Got error -1 "Internal error < 0 (Not system error)" from storage engine + ALTER TABLE t1 IMPORT TABLESPACE; + SELECT * FROM t1; + a diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff index 4c0e0c375f5..8bf84115a52 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff @@ -4,7 +4,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a , b ) ENGINE= ROW_FORMAT=FIXED; +Warnings: -+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. ++Warning 140 InnoDB: assuming ROW_FORMAT=COMPACT. SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff index 20431a9c713..094b26668c1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff @@ -67,7 +67,7 @@ < 4 5 < DROP TABLE t1; --- -> ERROR HY000: MRG_MYISAM storage engine does not support computed columns +> ERROR HY000: MRG_MyISAM storage engine does not support computed columns > # ERROR: Statement ended with errno 1910, errname ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS (expected to succeed) > # ------------ UNEXPECTED RESULT ------------ > # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/ GENERATED ALWAYS AS (a+1)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST ] From 936b6fab6063326e54c93eb37755973084fe774d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Jan 2013 13:36:28 +0200 Subject: [PATCH 367/439] Compiler warning fixed. --- mysys/ma_dyncol.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 0fdce15f423..f45f73fbd8e 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -2718,9 +2718,8 @@ dynamic_column_update_copy(DYNAMIC_COLUMN *str, PLAN *plan, new_hdr->header_size + new_hdr->nmpool_size; for (i= 0, j= 0; i < add_column_count || j < hdr->column_count; i++) { - size_t first_offset; + size_t UNINIT_VAR(first_offset); uint start= j, end; - LINT_INIT(first_offset); /* Search in i and j for the next column to add from i and where to @@ -2868,9 +2867,8 @@ dynamic_column_update_move_left(DYNAMIC_COLUMN *str, PLAN *plan, i < add_column_count || j < column_count; i++) { - size_t first_offset; + size_t UNINIT_VAR(first_offset); uint start= j, end; - LINT_INIT(first_offset); /* Search in i and j for the next column to add from i and where to @@ -3058,9 +3056,8 @@ dynamic_column_update_move_right(DYNAMIC_COLUMN *str, PLAN *plan, i < add_column_count || j < column_count; i++) { - size_t first_offset; + size_t UNINIT_VAR(first_offset); uint start= j, end; - LINT_INIT(first_offset); /* Search in i and j for the next column to add from i and where to From cf79c01cc7b9071c68055c90659da58c3b3b7363 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Jan 2013 15:05:05 +0200 Subject: [PATCH 368/439] 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 369/439] 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 370/439] 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 371/439] 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 372/439] 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 373/439] 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 374/439] 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 375/439] 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 376/439] 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 377/439] 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 3546644220725a16fe6577b8483b9597fe5d2385 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Jan 2013 16:12:50 +0100 Subject: [PATCH 378/439] Fix missing #include --- storage/innobase/log/log0log.c | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c index 3914e34ed7d..412fab86858 100644 --- a/storage/innobase/log/log0log.c +++ b/storage/innobase/log/log0log.c @@ -48,6 +48,7 @@ Created 12/9/1995 Heikki Tuuri #include "srv0start.h" #include "trx0sys.h" #include "trx0trx.h" +#include "ha_prototypes.h" /* General philosophy of InnoDB redo-logs: From 8a296e6ca2e55f9f1f3ce25d311291a20ee1c9e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Jan 2013 13:53:15 +0200 Subject: [PATCH 379/439] 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 380/439] 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 381/439] 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 382/439] 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 383/439] 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 384/439] 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 385/439] 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 386/439] 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 387/439] 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 388/439] 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 389/439] 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 390/439] 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 391/439] 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 392/439] 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 393/439] 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 394/439] 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 395/439] 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 2b0f4bdf44904c5211f879edd477f0b3b80df0ef Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jan 2013 10:06:03 +0100 Subject: [PATCH 396/439] Fix uninitialised variable in binlog group commit (probably not reachable code). Fix test failure when $vardir does not allow executing programs. --- mysql-test/include/have_dbi_dbd-mysql.inc | 4 +--- sql/log.cc | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/include/have_dbi_dbd-mysql.inc b/mysql-test/include/have_dbi_dbd-mysql.inc index 212e36ac353..7c2113a8109 100644 --- a/mysql-test/include/have_dbi_dbd-mysql.inc +++ b/mysql-test/include/have_dbi_dbd-mysql.inc @@ -58,9 +58,7 @@ --let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl --let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt -# Make the script executable and execute it. ---chmod 0755 $perlChecker ---exec $perlChecker +--exec perl $perlChecker # Source the resulting temporary file and look for a variable being set. --source $resultFile diff --git a/sql/log.cc b/sql/log.cc index a96dfbbf461..1ffceaf05a3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -6379,8 +6379,6 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) DBUG_ENTER("MYSQL_BIN_LOG::trx_group_commit_leader"); LINT_INIT(binlog_id); - DBUG_ASSERT(is_open()); - if (likely(is_open())) // Should always be true { /* Lock the LOCK_log(), and once we get it, collect any additional writes @@ -6407,7 +6405,11 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) DBUG_ASSERT(leader == queue /* the leader should be first in queue */); /* Now we have in queue the list of transactions to be committed in order. */ + } + DBUG_ASSERT(is_open()); + if (likely(is_open())) // Should always be true + { /* Commit every transaction in the queue. From 43c6953fa1ba3aad4f065bfbd63cca6b5d0c5ce7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 21 Jan 2013 10:52:39 +0100 Subject: [PATCH 397/439] 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 398/439] 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 399/439] 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 400/439] 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 401/439] 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 402/439] 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 09665bfd0e83efbc6c67f14852800fb4a0fe1e13 Mon Sep 17 00:00:00 2001 From: Jani Tolonen Date: Wed, 23 Jan 2013 15:52:59 +0100 Subject: [PATCH 403/439] MDEV-3931 Cassandra SE packaging Added autodetection for thrift library and includes Added Cassandra Storage Engine rpm --- cmake/cpack_rpm.cmake | 4 +- storage/cassandra/CMakeLists.txt | 67 ++++++++++++++++++++------------ storage/cassandra/cassandra.cnf | 2 + 3 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 storage/cassandra/cassandra.cnf diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index f5017d6c984..94cac6526d9 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -20,12 +20,13 @@ SET(CPACK_COMPONENT_CLIENT_GROUP "client") SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client") SET(CPACK_COMPONENT_README_GROUP "server") SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared") +SET(CPACK_COMPONENT_CASSANDRASELIBRARIES_GROUP "CassandraSE") SET(CPACK_COMPONENT_COMMON_GROUP "common") SET(CPACK_COMPONENT_COMPAT_GROUP "compat") SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts SupportFiles Development ManPagesDevelopment ManPagesTest Readme ManPagesClient Test - Common Client SharedLibraries) + Common Client SharedLibraries CassandraSE) SET(CPACK_RPM_PACKAGE_NAME "MariaDB") SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") @@ -63,6 +64,7 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE} ") SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common") +SET(CPACK_RPM_CassandraSE_PACKAGE_REQUIRES "MariaDB-server") 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") diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index 98644b7798b..2fca1803d3c 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -1,32 +1,49 @@ +# use the first path that has Thrift.h included, if found +FIND_PATH(Thrift_INCLUDE_DIRS Thrift.h PATHS +$ENV{THRIFT_INCLUDE} # environment variable to be used optionally +${Thrift_INCLUDE_DIR} # this may be set +/usr/local/include/thrift # list of additional directories to look from +/opt/local/include/thrift +/usr/include/thrift +/opt/include/thrift +) -IF(NOT WITH_CASSANDRA_STORAGE_ENGINE) - SET(WITHOUT_CASSANDRA 1) -ENDIF(NOT WITH_CASSANDRA_STORAGE_ENGINE) +# Verify that thrift linking library is found +FIND_LIBRARY(Thrift_LIBS NAMES thrift PATHS ${Thrift_LIB_PATHS} ${Thrift_LIB}) +IF(EXISTS ${Thrift_LIBS}) + GET_FILENAME_COMPONENT(LINK_DIR ${Thrift_LIBS} PATH ABSOLUTE) +ELSE() + RETURN() +ENDIF() +INCLUDE_DIRECTORIES(AFTER ${Thrift_INCLUDE_DIRS}) +SET(CMAKE_REQUIRED_INCLUDES ${Thrift_INCLUDE_DIRS}) -SET(cassandra_sources - ha_cassandra.cc - ha_cassandra.h - cassandra_se.h - cassandra_se.cc - gen-cpp/Cassandra.cpp - gen-cpp/cassandra_types.h - gen-cpp/cassandra_types.cpp - gen-cpp/cassandra_constants.h - gen-cpp/cassandra_constants.cpp - gen-cpp/Cassandra.h) +CHECK_CXX_SOURCE_COMPILES( +" +#include +int main() { return 0; } +" CASSANDRASE_OK) -#INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) +IF(CASSANDRASE_OK) + SET(cassandra_sources + ha_cassandra.cc + ha_cassandra.h + cassandra_se.h + cassandra_se.cc + gen-cpp/Cassandra.cpp + gen-cpp/cassandra_types.h + gen-cpp/cassandra_types.cpp + gen-cpp/cassandra_constants.h + gen-cpp/cassandra_constants.cpp + gen-cpp/Cassandra.h) -#INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) -INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) -#INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) + STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + LINK_DIRECTORIES(${LINK_DIR}) -# -STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -#LINK_DIRECTORIES(/home/psergey/cassandra/thrift/lib) - -MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES thrift) -# was: STORAGE_ENGINE MANDATORY + MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES thrift COMPONENT CassandraSE) + INSTALL(FILES cassandra.cnf DESTINATION ${INSTALL_SYSCONFDIR}/my.cnf.d + COMPONENT CassandraSE) +ENDIF(CASSANDRASE_OK) diff --git a/storage/cassandra/cassandra.cnf b/storage/cassandra/cassandra.cnf new file mode 100644 index 00000000000..8f4b3d6f91e --- /dev/null +++ b/storage/cassandra/cassandra.cnf @@ -0,0 +1,2 @@ +[mariadb] +plugin-load-add=ha_cassandra.so From a260b155542179bec75a6bbe1e430bea57b70ad6 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 23 Jan 2013 16:16:14 +0100 Subject: [PATCH 404/439] MDEV-4011 Added per thread memory counting and usage Base code and idea from a patch from by plinux at Taobao. The idea is that we mark all memory that are thread specific with MY_THREAD_SPECIFIC. Memory counting is done per thread in the my_malloc_size_cb_func callback function from my_malloc(). There are plenty of new asserts to ensure that for a debug server the counting is correct. Information_schema.processlist gets two new columns: MEMORY_USED and EXAMINED_ROWS. - The later is there mainly to show how query is progressing. The following changes in interfaces was needed to get this to work: - init_alloc_root() amd init_sql_alloc() has extra option so that one can mark memory with MY_THREAD_SPECIFIC - One now have to use alloc_root_set_min_malloc() to set min memory to be allocated by alloc_root() - my_init_dynamic_array() has extra option so that one can mark memory with MY_THREAD_SPECIFIC - my_net_init() has extra option so that one can mark memory with MY_THREAD_SPECIFIC - Added flag for hash_init() so that one can mark hash table to be thread specific. - Added flags to init_tree() so that one can mark tree to be thread specific. - Removed with_delete option to init_tree(). Now one should instead use MY_TREE_WITH_DELETE_FLAG. - Added flag to Warning_info::Warning_info() if the structure should be fully initialized. - String elements can now be marked as thread specific. - Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC. - Changed type of myf from int to ulong, as this is always a set of bit flags. Other things: - Removed calls to net_end() and thd->cleanup() as these are now done in ~THD() - We now also show EXAMINED_ROWS in SHOW PROCESSLIST - Added new variable 'memory_used' - Fixed bug where kill_threads_for_user() was using the wrong mem_root to allocate memory. - Removed calls to the obsoleted function init_dynamic_array() - Use set_current_thd() instead of my_pthread_setspecific_ptr(THR_THD,...) client/completion_hash.cc: Updated call to init_alloc_root() client/mysql.cc: Updated call to init_alloc_root() client/mysqlbinlog.cc: init_dynamic_array() -> my_init_dynamic_array() Updated call to init_alloc_root() client/mysqlcheck.c: Updated call to my_init_dynamic_array() client/mysqldump.c: Updated call to init_alloc_root() client/mysqltest.cc: Updated call to init_alloc_root() Updated call to my_init_dynamic_array() Fixed compiler warnings extra/comp_err.c: Updated call to my_init_dynamic_array() extra/resolve_stack_dump.c: Updated call to my_init_dynamic_array() include/hash.h: Added HASH_THREAD_SPECIFIC include/heap.h: Added flag is internal temporary table. include/my_dir.h: Safety fix: Ensure that MY_DONT_SORT and MY_WANT_STAT don't interfer with other mysys flags include/my_global.h: Changed type of myf from int to ulong, as this is always a set of bit flags. include/my_sys.h: Added MY_THREAD_SPECIFIC and MY_THREAD_MOVE Added malloc_flags to DYNAMIC_ARRAY Added extra mysys flag argument to my_init_dynamic_array() Removed deprecated functions init_dynamic_array() and my_init_dynamic_array.._ci Updated paramaters for init_alloc_root() include/my_tree.h: Added my_flags to allow one to use MY_THREAD_SPECIFIC with hash tables. Removed with_delete. One should now instead use MY_TREE_WITH_DELETE_FLAG Updated parameters to init_tree() include/myisamchk.h: Added malloc_flags to allow one to use MY_THREAD_SPECIFIC for checks. include/mysql.h: Added MYSQL_THREAD_SPECIFIC_MALLOC Used 'unused1' to mark memory as thread specific. include/mysql.h.pp: Updated file include/mysql_com.h: Used 'unused1' to mark memory as thread specific. Updated parameters for my_net_init() libmysql/libmysql.c: Updated call to init_alloc_root() to mark memory thread specific. libmysqld/emb_qcache.cc: Updated call to init_alloc_root() libmysqld/lib_sql.cc: Updated call to init_alloc_root() mysql-test/r/create.result: Updated results mysql-test/r/user_var.result: Updated results mysql-test/suite/funcs_1/datadict/processlist_priv.inc: Update to handle new format of SHOW PROCESSLIST mysql-test/suite/funcs_1/datadict/processlist_val.inc: Update to handle new format of SHOW PROCESSLIST mysql-test/suite/funcs_1/r/is_columns_is.result: Update to handle new format of SHOW PROCESSLIST mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result: Updated results mysql-test/suite/funcs_1/r/processlist_val_no_prot.result: Updated results mysql-test/t/show_explain.test: Fixed usage of debug variable so that one can run test with --debug mysql-test/t/user_var.test: Added test of memory_usage variable. mysys/array.c: Added extra my_flags option to init_dynamic_array() and init_dynamic_array2() so that one can mark memory with MY_THREAD_SPECIFIC All allocated memory is marked with the given my_flags. Removed obsolete function init_dynamic_array() mysys/default.c: Updated call to init_alloc_root() Updated call to my_init_dynamic_array() mysys/hash.c: Updated call to my_init_dynamic_array_ci(). Allocated memory is marked with MY_THREAD_SPECIFIC if HASH_THREAD_SPECIFIC is used. mysys/ma_dyncol.c: init_dynamic_array() -> my_init_dynamic_array() Added #if to get rid of compiler warnings mysys/mf_tempdir.c: Updated call to my_init_dynamic_array() mysys/my_alloc.c: Added extra parameter to init_alloc_root() so that one can mark memory with MY_THREAD_SPECIFIC Extend MEM_ROOT with a flag if memory is thread specific. This is stored in block_size, to keep the size of the MEM_ROOT object identical as before. Allocated memory is marked with MY_THREAD_SPECIFIC if used with init_alloc_root() mysys/my_chmod.c: Updated DBUG_PRINT because of change of myf type mysys/my_chsize.c: Updated DBUG_PRINT because of change of myf type mysys/my_copy.c: Updated DBUG_PRINT because of change of myf type mysys/my_create.c: Updated DBUG_PRINT because of change of myf type mysys/my_delete.c: Updated DBUG_PRINT because of change of myf type mysys/my_error.c: Updated DBUG_PRINT because of change of myf type mysys/my_fopen.c: Updated DBUG_PRINT because of change of myf type mysys/my_fstream.c: Updated DBUG_PRINT because of change of myf type mysys/my_getwd.c: Updated DBUG_PRINT because of change of myf type mysys/my_lib.c: Updated call to init_alloc_root() Updated call to my_init_dynamic_array() Updated DBUG_PRINT because of change of myf type mysys/my_lock.c: Updated DBUG_PRINT because of change of myf type mysys/my_malloc.c: Store at start of each allocated memory block the size of the block and if the block is thread specific. Call malloc_size_cb_func, if set, with the memory allocated/freed. Updated DBUG_PRINT because of change of myf type mysys/my_open.c: Updated DBUG_PRINT because of change of myf type mysys/my_pread.c: Updated DBUG_PRINT because of change of myf type mysys/my_read.c: Updated DBUG_PRINT because of change of myf type mysys/my_redel.c: Updated DBUG_PRINT because of change of myf type mysys/my_rename.c: Updated DBUG_PRINT because of change of myf type mysys/my_seek.c: Updated DBUG_PRINT because of change of myf type mysys/my_sync.c: Updated DBUG_PRINT because of change of myf type mysys/my_thr_init.c: Ensure that one can call my_thread_dbug_id() even if thread is not properly initialized. mysys/my_write.c: Updated DBUG_PRINT because of change of myf type mysys/mysys_priv.h: Updated parameters to sf_malloc and sf_realloc() mysys/safemalloc.c: Added checking that for memory marked with MY_THREAD_SPECIFIC that it's the same thread that is allocation and freeing the memory. Added sf_malloc_dbug_id() to allow MariaDB to specify which THD is handling the memory. Added my_flags arguments to sf_malloc() and sf_realloc() to be able to mark memory with MY_THREAD_SPECIFIC. Added sf_report_leaked_memory() to get list of memory not freed by a thread. mysys/tree.c: Added flags to init_tree() so that one can mark tree to be thread specific. Removed with_delete option to init_tree(). Now one should instead use MY_TREE_WITH_DELETE_FLAG. Updated call to init_alloc_root() All allocated memory is marked with the given malloc flags mysys/waiting_threads.c: Updated call to my_init_dynamic_array() sql-common/client.c: Updated call to init_alloc_root() and my_net_init() to mark memory thread specific. Updated call to my_init_dynamic_array(). Added MYSQL_THREAD_SPECIFIC_MALLOC so that client can mark memory as MY_THREAD_SPECIFIC. sql-common/client_plugin.c: Updated call to init_alloc_root() sql/debug_sync.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/event_scheduler.cc: Removed calls to net_end() as this is now done in ~THD() Call set_current_thd() to ensure that memory is assigned to right thread. sql/events.cc: my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/filesort.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/filesort_utils.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/ha_ndbcluster.cc: Updated call to init_alloc_root() Updated call to my_net_init() Removed calls to net_end() and thd->cleanup() as these are now done in ~THD() sql/ha_ndbcluster_binlog.cc: Updated call to my_net_init() Updated call to init_sql_alloc() Removed calls to net_end() and thd->cleanup() as these are now done in ~THD() sql/ha_partition.cc: Updated call to init_alloc_root() sql/handler.cc: Added MY_THREAD_SPECIFIC to allocated memory. Added missing call to my_dir_end() sql/item_func.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/item_subselect.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/item_sum.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/log.cc: More DBUG Updated call to init_alloc_root() sql/mdl.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/mysqld.cc: Added total_memory_used Updated call to init_alloc_root() Move mysql_cond_broadcast() before my_thread_end() Added mariadb_dbug_id() to count memory per THD instead of per thread. Added my_malloc_size_cb_func() callback function for my_malloc() to count memory. Move initialization of mysqld_server_started and mysqld_server_initialized earlier. Updated call to my_init_dynamic_array(). Updated call to my_net_init(). Call my_pthread_setspecific_ptr(THR_THD,...) to ensure that memory is assigned to right thread. Added status variable 'memory_used'. Updated call to init_alloc_root() my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/mysqld.h: Added set_current_thd() sql/net_serv.cc: Added new parameter to my_net_init() so that one can mark memory with MY_THREAD_SPECIFIC. Store in net->thread_specific_malloc if memory is thread specific. Mark memory to be thread specific if requested. sql/opt_range.cc: Updated call to my_init_dynamic_array() Updated call to init_sql_alloc() Added MY_THREAD_SPECIFIC to allocated memory. sql/opt_subselect.cc: Updated call to init_sql_alloc() to mark memory thread specific. sql/protocol.cc: Fixed compiler warning sql/records.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/rpl_filter.cc: Updated call to my_init_dynamic_array() sql/rpl_handler.cc: Updated call to my_init_dynamic_array2() sql/rpl_handler.h: Updated call to init_sql_alloc() sql/rpl_mi.cc: Updated call to my_init_dynamic_array() sql/rpl_tblmap.cc: Updated call to init_alloc_root() sql/rpl_utility.cc: Updated call to my_init_dynamic_array() sql/slave.cc: Initialize things properly before calling functions that allocate memory. Removed calls to net_end() as this is now done in ~THD() sql/sp_head.cc: Updated call to init_sql_alloc() Updated call to my_init_dynamic_array() Added parameter to warning_info() that it should be fully initialized. sql/sp_pcontext.cc: Updated call to my_init_dynamic_array() sql/sql_acl.cc: Updated call to init_sql_alloc() Updated call to my_init_dynamic_array() my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/sql_admin.cc: Added parameter to warning_info() that it should be fully initialized. sql/sql_analyse.h: Updated call to init_tree() to mark memory thread specific. sql/sql_array.h: Updated call to my_init_dynamic_array() to mark memory thread specific. sql/sql_audit.cc: Updated call to my_init_dynamic_array() sql/sql_base.cc: Updated call to init_sql_alloc() my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/sql_cache.cc: Updated comment sql/sql_class.cc: Added parameter to warning_info() that not initialize it until THD is fully created. Updated call to init_sql_alloc() Mark THD::user_vars has to be thread specific. Updated call to my_init_dynamic_array() Ensure that memory allocated by THD is assigned to the THD. More DBUG Always acll net_end() in ~THD() Assert that all memory signed to this THD is really deleted at ~THD. Fixed set_status_var_init() to not reset memory_used. my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/sql_class.h: Added MY_THREAD_SPECIFIC to allocated memory. Added malloc_size to THD to record allocated memory per THD. sql/sql_delete.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/sql_error.cc: Added 'initialize' parameter to Warning_info() to say if should allocate memory for it's structures. This is used by THD::THD() to not allocate memory until THD is ready. Added Warning_info::free_memory() sql/sql_error.h: Updated Warning_info() class. sql/sql_handler.cc: Updated call to init_alloc_root() to mark memory thread specific. sql/sql_insert.cc: More DBUG sql/sql_join_cache.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/sql_lex.cc: Updated call to my_init_dynamic_array() sql/sql_lex.h: Updated call to my_init_dynamic_array() sql/sql_load.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/sql_parse.cc: Removed calls to net_end() and thd->cleanup() as these are now done in ~THD() Ensure that examined_row_count() is reset before query. Fixed bug where kill_threads_for_user() was using the wrong mem_root to allocate memory. my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() Don't restore thd->status_var.memory_used when restoring thd->status_var sql/sql_plugin.cc: Updated call to init_alloc_root() Updated call to my_init_dynamic_array() Don't allocate THD on the stack, as this causes problems with valgrind when doing thd memory counting. my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/sql_prepare.cc: Added parameter to warning_info() that it should be fully initialized. Updated call to init_sql_alloc() to mark memory thread specific. sql/sql_reload.cc: my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/sql_select.cc: Updated call to my_init_dynamic_array() and init_sql_alloc() to mark memory thread specific. Added MY_THREAD_SPECIFIC to allocated memory. More DBUG sql/sql_servers.cc: Updated call to init_sql_alloc() to mark memory some memory thread specific. my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/sql_show.cc: Updated call to my_init_dynamic_array() Mark my_dir() memory thread specific. Use my_pthread_setspecific_ptr(THR_THD,...) to mark that allocated memory should be allocated to calling thread. More DBUG. Added malloc_size and examined_row_count to SHOW PROCESSLIST. Added MY_THREAD_SPECIFIC to allocated memory. Updated call to init_sql_alloc() Added parameter to warning_info() that it should be fully initialized. sql/sql_statistics.cc: Fixed compiler warning sql/sql_string.cc: String elements can now be marked as thread specific. sql/sql_string.h: String elements can now be marked as thread specific. sql/sql_table.cc: Updated call to init_sql_alloc() and my_malloc() to mark memory thread specific my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() Fixed compiler warning sql/sql_test.cc: Updated call to my_init_dynamic_array() to mark memory thread specific. sql/sql_trigger.cc: Updated call to init_sql_alloc() sql/sql_udf.cc: Updated call to init_sql_alloc() my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/sql_update.cc: Added MY_THREAD_SPECIFIC to allocated memory. sql/table.cc: Updated call to init_sql_alloc(). Mark memory used by temporary tables, that are not for slave threads, as MY_THREAD_SPECIFIC Updated call to init_sql_alloc() sql/thr_malloc.cc: Added my_flags argument to init_sql_alloc() to be able to mark memory as MY_THREAD_SPECIFIC. sql/thr_malloc.h: Updated prototype for init_sql_alloc() sql/tztime.cc: Updated call to init_sql_alloc() Updated call to init_alloc_root() to mark memory thread specific. my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd() sql/uniques.cc: Updated calls to init_tree(), my_init_dynamic_array() and my_malloc() to mark memory thread specific. sql/unireg.cc: Added MY_THREAD_SPECIFIC to allocated memory. storage/csv/ha_tina.cc: Updated call to init_alloc_root() storage/federated/ha_federated.cc: Updated call to init_alloc_root() Updated call to my_init_dynamic_array() Ensure that memory allocated by fedarated is registered for the system, not for the thread. storage/federatedx/federatedx_io_mysql.cc: Updated call to my_init_dynamic_array() storage/federatedx/ha_federatedx.cc: Updated call to init_alloc_root() Updated call to my_init_dynamic_array() storage/heap/ha_heap.cc: Added MY_THREAD_SPECIFIC to allocated memory. storage/heap/heapdef.h: Added parameter to hp_get_new_block() to be able to do thread specific memory tagging. storage/heap/hp_block.c: Added parameter to hp_get_new_block() to be able to do thread specific memory tagging. storage/heap/hp_create.c: - Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC. - Use MY_TREE_WITH_DELETE instead of removed option 'with_delete'. storage/heap/hp_open.c: Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC. storage/heap/hp_write.c: Added new parameter to hp_get_new_block() storage/maria/ma_bitmap.c: Updated call to my_init_dynamic_array() storage/maria/ma_blockrec.c: Updated call to my_init_dynamic_array() storage/maria/ma_check.c: Updated call to init_alloc_root() storage/maria/ma_ft_boolean_search.c: Updated calls to init_tree() and init_alloc_root() storage/maria/ma_ft_nlq_search.c: Updated call to init_tree() storage/maria/ma_ft_parser.c: Updated call to init_tree() Updated call to init_alloc_root() storage/maria/ma_loghandler.c: Updated call to my_init_dynamic_array() storage/maria/ma_open.c: Updated call to my_init_dynamic_array() storage/maria/ma_sort.c: Updated call to my_init_dynamic_array() storage/maria/ma_write.c: Updated calls to my_init_dynamic_array() and init_tree() storage/maria/maria_pack.c: Updated call to init_tree() storage/maria/unittest/sequence_storage.c: Updated call to my_init_dynamic_array() storage/myisam/ft_boolean_search.c: Updated call to init_tree() Updated call to init_alloc_root() storage/myisam/ft_nlq_search.c: Updated call to init_tree() storage/myisam/ft_parser.c: Updated call to init_tree() Updated call to init_alloc_root() storage/myisam/ft_stopwords.c: Updated call to init_tree() storage/myisam/mi_check.c: Updated call to init_alloc_root() storage/myisam/mi_write.c: Updated call to my_init_dynamic_array() Updated call to init_tree() storage/myisam/myisamlog.c: Updated call to init_tree() storage/myisam/myisampack.c: Updated call to init_tree() storage/myisam/sort.c: Updated call to my_init_dynamic_array() storage/myisammrg/ha_myisammrg.cc: Updated call to init_sql_alloc() storage/perfschema/pfs_check.cc: Rest current_thd storage/perfschema/pfs_instr.cc: Removed DBUG_ENTER/DBUG_VOID_RETURN as at this point my_thread_var is not allocated anymore, which can cause problems. support-files/compiler_warnings.supp: Disable compiler warning from offsetof macro. --- client/completion_hash.cc | 2 +- client/mysql.cc | 2 +- client/mysqlbinlog.cc | 6 +- client/mysqlcheck.c | 6 +- client/mysqldump.c | 2 +- client/mysqltest.cc | 12 +- extra/comp_err.c | 4 +- extra/replace.c | 4 +- extra/resolve_stack_dump.c | 2 +- include/hash.h | 1 + include/heap.h | 1 + include/my_dir.h | 5 +- include/my_global.h | 2 +- include/my_sys.h | 30 +++- include/my_tree.h | 6 +- include/myisamchk.h | 1 + include/mysql.h | 4 +- include/mysql.h.pp | 8 +- include/mysql_com.h | 6 +- libmysql/libmysql.c | 7 +- libmysqld/emb_qcache.cc | 2 +- libmysqld/lib_sql.cc | 7 +- mysql-test/mysql-test-run.pl | 3 +- mysql-test/r/create.result | 8 +- mysql-test/r/show_explain.result | 156 +++++++++------- mysql-test/r/user_var.result | 5 + .../funcs_1/datadict/processlist_priv.inc | 32 ++-- .../funcs_1/datadict/processlist_val.inc | 16 +- .../suite/funcs_1/r/is_columns_is.result | 4 + .../funcs_1/r/processlist_priv_no_prot.result | 166 +++++++++--------- .../funcs_1/r/processlist_val_no_prot.result | 48 ++--- .../t/transaction_prealloc_size_bug27322.test | 2 +- mysql-test/t/file_contents.test | 4 +- mysql-test/t/show_explain.test | 163 +++++++++-------- mysql-test/t/user_var.test | 15 ++ mysys/array.c | 26 ++- mysys/default.c | 6 +- mysys/hash.c | 6 +- mysys/ma_dyncol.c | 9 +- mysys/mf_tempdir.c | 2 +- mysys/my_alloc.c | 37 +++- mysys/my_chmod.c | 2 +- mysys/my_chsize.c | 2 +- mysys/my_copy.c | 2 +- mysys/my_create.c | 2 +- mysys/my_delete.c | 2 +- mysys/my_error.c | 6 +- mysys/my_fopen.c | 6 +- mysys/my_fstream.c | 8 +- mysys/my_getwd.c | 4 +- mysys/my_lib.c | 17 +- mysys/my_lock.c | 2 +- mysys/my_malloc.c | 126 +++++++++++-- mysys/my_open.c | 4 +- mysys/my_pread.c | 4 +- mysys/my_read.c | 2 +- mysys/my_redel.c | 2 +- mysys/my_rename.c | 2 +- mysys/my_seek.c | 4 +- mysys/my_sync.c | 7 +- mysys/my_thr_init.c | 7 +- mysys/my_write.c | 2 +- mysys/mysys_priv.h | 9 +- mysys/safemalloc.c | 72 ++++++-- mysys/tree.c | 16 +- mysys/waiting_threads.c | 4 +- sql-common/client.c | 15 +- sql-common/client_plugin.c | 2 +- sql/debug_sync.cc | 3 +- sql/event_data_objects.cc | 2 +- sql/event_scheduler.cc | 15 +- sql/events.cc | 2 +- sql/filesort.cc | 15 +- sql/filesort_utils.cc | 6 +- sql/ha_ndbcluster.cc | 6 +- sql/ha_ndbcluster_binlog.cc | 6 +- sql/ha_partition.cc | 6 +- sql/handler.cc | 5 +- sql/item_func.cc | 7 +- sql/item_subselect.cc | 4 +- sql/item_sum.cc | 3 +- sql/log.cc | 7 +- sql/mdl.cc | 3 +- sql/mysqld.cc | 119 ++++++++++--- sql/mysqld.h | 1 + sql/net_serv.cc | 15 +- sql/opt_range.cc | 29 +-- sql/opt_subselect.cc | 2 +- sql/protocol.cc | 2 +- sql/records.cc | 2 +- sql/rpl_filter.cc | 2 +- sql/rpl_handler.cc | 2 +- sql/rpl_handler.h | 2 +- sql/rpl_mi.cc | 2 +- sql/rpl_tblmap.cc | 2 +- sql/rpl_utility.cc | 2 +- sql/slave.cc | 31 ++-- sql/sp_head.cc | 12 +- sql/sp_pcontext.cc | 40 ++--- sql/sql_acl.cc | 18 +- sql/sql_admin.cc | 2 +- sql/sql_analyse.h | 14 +- sql/sql_array.h | 3 +- sql/sql_audit.cc | 2 +- sql/sql_base.cc | 4 +- sql/sql_cache.cc | 4 +- sql/sql_class.cc | 54 ++++-- sql/sql_class.h | 9 +- sql/sql_delete.cc | 3 +- sql/sql_error.cc | 25 ++- sql/sql_error.h | 8 +- sql/sql_handler.cc | 2 +- sql/sql_insert.cc | 38 ++-- sql/sql_join_cache.cc | 6 +- sql/sql_lex.cc | 2 +- sql/sql_lex.h | 2 +- sql/sql_load.cc | 6 +- sql/sql_parse.cc | 12 +- sql/sql_plugin.cc | 18 +- sql/sql_prepare.cc | 8 +- sql/sql_reload.cc | 2 +- sql/sql_select.cc | 17 +- sql/sql_servers.cc | 6 +- sql/sql_show.cc | 49 ++++-- sql/sql_statistics.cc | 3 +- sql/sql_string.cc | 14 +- sql/sql_string.h | 27 ++- sql/sql_table.cc | 9 +- sql/sql_test.cc | 4 +- sql/sql_trigger.cc | 4 +- sql/sql_udf.cc | 4 +- sql/sql_update.cc | 3 +- sql/table.cc | 15 +- sql/thr_malloc.cc | 5 +- sql/thr_malloc.h | 3 +- sql/tztime.cc | 8 +- sql/uniques.cc | 17 +- sql/unireg.cc | 8 +- storage/csv/ha_tina.cc | 4 +- storage/federated/ha_federated.cc | 10 +- storage/federatedx/federatedx_io_mysql.cc | 2 +- storage/federatedx/ha_federatedx.cc | 6 +- storage/heap/ha_heap.cc | 2 +- storage/heap/heapdef.h | 3 +- storage/heap/hp_block.c | 8 +- storage/heap/hp_create.c | 9 +- storage/heap/hp_open.c | 4 +- storage/heap/hp_write.c | 4 +- storage/maria/ma_bitmap.c | 2 +- storage/maria/ma_blockrec.c | 2 +- storage/maria/ma_check.c | 6 +- storage/maria/ma_ft_boolean_search.c | 4 +- storage/maria/ma_ft_nlq_search.c | 4 +- storage/maria/ma_ft_parser.c | 6 +- storage/maria/ma_loghandler.c | 6 +- storage/maria/ma_open.c | 2 +- storage/maria/ma_sort.c | 4 +- storage/maria/ma_write.c | 6 +- storage/maria/maria_pack.c | 4 +- storage/maria/unittest/sequence_storage.c | 2 +- storage/myisam/ft_boolean_search.c | 4 +- storage/myisam/ft_nlq_search.c | 4 +- storage/myisam/ft_parser.c | 5 +- storage/myisam/ft_stopwords.c | 3 +- storage/myisam/mi_check.c | 6 +- storage/myisam/mi_write.c | 6 +- storage/myisam/myisamlog.c | 5 +- storage/myisam/myisampack.c | 4 +- storage/myisam/sort.c | 4 +- storage/myisammrg/ha_myisammrg.cc | 2 +- storage/perfschema/pfs_check.cc | 2 + storage/perfschema/pfs_instr.cc | 3 - support-files/compiler_warnings.supp | 4 +- 173 files changed, 1331 insertions(+), 773 deletions(-) diff --git a/client/completion_hash.cc b/client/completion_hash.cc index 9ffb2082c06..1a8bc4d5035 100644 --- a/client/completion_hash.cc +++ b/client/completion_hash.cc @@ -49,7 +49,7 @@ int completion_hash_init(HashTable *ht, uint nSize) ht->initialized = 0; return FAILURE; } - init_alloc_root(&ht->mem_root, 8192, 0); + init_alloc_root(&ht->mem_root, 8192, 0, 0); ht->pHashFunction = hashpjw; ht->nTableSize = nSize; ht->initialized = 1; diff --git a/client/mysql.cc b/client/mysql.cc index 67878b36227..c4cfcc4f1ff 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1157,7 +1157,7 @@ int main(int argc,char *argv[]) } glob_buffer.realloc(512); completion_hash_init(&ht, 128); - init_alloc_root(&hash_mem_root, 16384, 0); + init_alloc_root(&hash_mem_root, 16384, 0, 0); bzero((char*) &mysql, sizeof(mysql)); if (sql_connect(current_host,current_db,current_user,opt_password, opt_silent)) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 8f6baea4b9f..95e2066cf41 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -278,8 +278,8 @@ public: int init() { - return init_dynamic_array(&file_names, sizeof(File_name_record), - 100, 100); + return my_init_dynamic_array(&file_names, sizeof(File_name_record), + 100, 100, 0); } void init_by_dir_name(const char *dir) @@ -2393,7 +2393,7 @@ int main(int argc, char** argv) my_init_time(); // for time functions - init_alloc_root(&s_mem_root, 16384, 0); + init_alloc_root(&s_mem_root, 16384, 0, 0); if (load_defaults("my", load_groups, &argc, &argv)) exit(1); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 4218f2da62c..eb2bed9d13f 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -994,8 +994,10 @@ int main(int argc, char **argv) } if (opt_auto_repair && - (my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64) || - my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,64))) + (my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16, + 64, 0) || + my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16, + 64, 0))) goto end; if (opt_alldbs) diff --git a/client/mysqldump.c b/client/mysqldump.c index e054cc57839..583524a43d8 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -4583,7 +4583,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) if (init_dumping(db, init_dumping_tables)) DBUG_RETURN(1); - init_alloc_root(&root, 8192, 0); + init_alloc_root(&root, 8192, 0, 0); if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *)))) die(EX_EOM, "alloc_root failure."); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index d61a48fe964..a60c8da93bf 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5174,7 +5174,7 @@ typedef struct static st_error global_error_names[] = { - { "", -1U, "" }, + { "", ~0U, "" }, #include { 0, 0, 0 } }; @@ -7286,7 +7286,7 @@ void init_win_path_patterns() DBUG_ENTER("init_win_path_patterns"); - my_init_dynamic_array(&patterns, sizeof(const char*), 16, 16); + my_init_dynamic_array(&patterns, sizeof(const char*), 16, 16, MYF(0)); /* Loop through all paths in the array */ for (i= 0; i < num_paths; i++) @@ -8899,7 +8899,7 @@ int main(int argc, char **argv) cur_block->ok= TRUE; /* Outer block should always be executed */ cur_block->cmd= cmd_none; - my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024); + my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024, 0); if (my_hash_init2(&var_hash, 64, charset_info, 128, 0, 0, get_var_key, var_free, MYF(0))) @@ -8929,7 +8929,7 @@ int main(int argc, char **argv) #endif init_dynamic_string(&ds_res, "", 2048, 2048); - init_alloc_root(&require_file_root, 1024, 1024); + init_alloc_root(&require_file_root, 1024, 1024, 0); parse_args(argc, argv); @@ -9873,7 +9873,7 @@ struct st_replace_regex* init_replace_regex(char* expr) /* my_malloc() will die on fail with MY_FAE */ res=(struct st_replace_regex*)my_malloc( sizeof(*res)+expr_len ,MYF(MY_FAE+MY_WME)); - my_init_dynamic_array(&res->regex_arr,sizeof(struct st_regex),128,128); + my_init_dynamic_array(&res->regex_arr,sizeof(struct st_regex), 128, 128, 0); buf= (char*)res + sizeof(*res); expr_end= expr + expr_len; @@ -10928,7 +10928,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input, if (!*start) DBUG_VOID_RETURN; /* No input */ - my_init_dynamic_array(&lines, sizeof(const char*), 32, 32); + my_init_dynamic_array(&lines, sizeof(const char*), 32, 32, 0); if (keep_header) { diff --git a/extra/comp_err.c b/extra/comp_err.c index bde7d705c75..7476578204a 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -894,7 +894,7 @@ static struct errors *generate_empty_message(uint d_code) if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME)))) return(0); - if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1)) + if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1, 0)) return(0); /* OOM: Fatal error */ new_error->er_name= NULL; @@ -928,7 +928,7 @@ static struct errors *parse_error_string(char *str, int er_count) MYF(MY_WME)))) DBUG_RETURN(0); - if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0)) + if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0, 0)) DBUG_RETURN(0); /* OOM: Fatal error */ /* getting the error name */ diff --git a/extra/replace.c b/extra/replace.c index 8aef9f9a0a0..c2dcc9f50b5 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -265,7 +265,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD), MYF(MY_WME)))) { - my_free(pa->typelib.type_names); + my_free((char*) pa->typelib.type_names); DBUG_RETURN (-1); } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ @@ -327,7 +327,7 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa) if (pa->typelib.count) { pa->typelib.count=0; - my_free(pa->typelib.type_names); + my_free((char*) pa->typelib.type_names); pa->typelib.type_names=0; my_free(pa->str); } diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index dd77e1785d0..c7f33d2723b 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -223,7 +223,7 @@ static void init_sym_table() { char buf[512]; if (my_init_dynamic_array(&sym_table, sizeof(SYM_ENTRY), INIT_SYM_TABLE, - INC_SYM_TABLE)) + INC_SYM_TABLE, 0)) die("Failed in my_init_dynamic_array() -- looks like out of memory problem"); while (fgets(buf, sizeof(buf), fp_sym)) diff --git a/include/hash.h b/include/hash.h index 98bcf911db2..2ecfe0891d7 100644 --- a/include/hash.h +++ b/include/hash.h @@ -39,6 +39,7 @@ extern "C" { /* flags for hash_init */ #define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */ +#define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */ typedef uint my_hash_value_type; typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool); diff --git a/include/heap.h b/include/heap.h index 10b165d89c6..149f9ed5f56 100644 --- a/include/heap.h +++ b/include/heap.h @@ -153,6 +153,7 @@ typedef struct st_heap_share THR_LOCK lock; mysql_mutex_t intern_lock; /* Locking for use with _locking */ my_bool delete_on_close; + my_bool internal; /* Internal temporary table */ LIST open_list; uint auto_key; uint auto_key_type; /* real type of the auto key segment */ diff --git a/include/my_dir.h b/include/my_dir.h index 1ee002cc380..6a941b37d79 100644 --- a/include/my_dir.h +++ b/include/my_dir.h @@ -45,8 +45,9 @@ extern "C" { #define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG) #define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO) -#define MY_DONT_SORT 512 /* my_lib; Don't sort files */ -#define MY_WANT_STAT 1024 /* my_lib; stat files */ +/* Ensure these dosn't clash with anything in my_sys.h */ +#define MY_DONT_SORT 8192 /* my_lib; Don't sort files */ +#define MY_WANT_STAT 16384 /* my_lib; stat files */ /* typedefs for my_dir & my_stat */ diff --git a/include/my_global.h b/include/my_global.h index 09a3a0a6efd..a99823b94d8 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1003,7 +1003,7 @@ typedef struct st_mysql_lex_string LEX_STRING; #define SOCKET_EMFILE EMFILE #endif -typedef int myf; /* Type of MyFlags in my_funcs */ +typedef ulong myf; /* Type of MyFlags in my_funcs */ typedef char my_bool; /* Small bool */ /* Macros for converting *constants* to the right type */ diff --git a/include/my_sys.h b/include/my_sys.h index 2b0ae41a9b0..8f19293deb0 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -86,6 +86,10 @@ typedef struct my_aio_result { #define MY_SYNC 4096 /* my_copy(): sync dst file */ #define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */ #define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */ +#define MY_THREAD_SPECIFIC 0x10000 /* my_malloc(): thread specific */ +#define MY_THREAD_MOVE 0x20000 /* realloc(); Memory can move */ +/* Tree that should delete things automaticly */ +#define MY_TREE_WITH_DELETE 0x40000 #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ @@ -148,6 +152,18 @@ typedef struct my_aio_result { /* Extra length needed for filename if one calls my_create_backup_name */ #define MY_BACKUP_NAME_EXTRA_LENGTH 17 +/* If we have our own safemalloc (for debugging) */ +#if defined(SAFEMALLOC) +void sf_report_leaked_memory(my_thread_id id); +extern my_thread_id (*sf_malloc_dbug_id)(void); +#define SAFEMALLOC_REPORT_MEMORY(X) sf_report_leaked_memory(X) +#else +#define SAFEMALLOC_REPORT_MEMORY(X) do {} while(0) +#endif + +typedef void (*MALLOC_SIZE_CB) (long long size, myf my_flags); +extern void set_malloc_size_cb(MALLOC_SIZE_CB func); + /* defines when allocating data */ extern void *my_malloc(size_t Size,myf MyFlags); extern void *my_multi_malloc(myf MyFlags, ...); @@ -323,6 +339,7 @@ typedef struct st_dynamic_array uint elements,max_element; uint alloc_increment; uint size_of_element; + myf malloc_flags; } DYNAMIC_ARRAY; typedef struct st_my_tmpdir @@ -768,16 +785,11 @@ extern my_bool real_open_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache); File create_temp_file(char *to, const char *dir, const char *pfx, int mode, myf MyFlags); -#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D) -#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D) -#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E) -#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E) +#define my_init_dynamic_array(A,B,C,D,E) init_dynamic_array2(A,B,NULL,C,D,E) +#define my_init_dynamic_array2(A,B,C,D,E,F) init_dynamic_array2(A,B,C,D,E,F) extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, void *init_buffer, uint init_alloc, - uint alloc_increment); -/* init_dynamic_array() function is deprecated */ -extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, - uint init_alloc, uint alloc_increment); + uint alloc_increment, myf my_flags); extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const uchar * element); extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array); extern uchar *pop_dynamic(DYNAMIC_ARRAY*); @@ -829,7 +841,7 @@ extern void my_free_lock(void *ptr); #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, - size_t pre_alloc_size); + size_t pre_alloc_size, myf my_flags); extern void *alloc_root(MEM_ROOT *mem_root, size_t Size); extern void *multi_alloc_root(MEM_ROOT *mem_root, ...); extern void free_root(MEM_ROOT *root, myf MyFLAGS); diff --git a/include/my_tree.h b/include/my_tree.h index 3dd92712af2..f8be55f84b2 100644 --- a/include/my_tree.h +++ b/include/my_tree.h @@ -68,13 +68,15 @@ typedef struct st_tree { MEM_ROOT mem_root; my_bool with_delete; tree_element_free free; + myf my_flags; uint flag; } TREE; /* Functions on whole tree */ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, - int size, qsort_cmp2 compare, my_bool with_delete, - tree_element_free free_element, void *custom_arg); + int size, qsort_cmp2 compare, + tree_element_free free_element, void *custom_arg, + myf my_flags); void delete_tree(TREE*); void reset_tree(TREE*); diff --git a/include/myisamchk.h b/include/myisamchk.h index 789e95572b3..7e7b685a88a 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -164,6 +164,7 @@ typedef struct st_handler_check_param mysql_mutex_t print_msg_mutex; my_bool need_print_msg_lock; + myf malloc_flags; } HA_CHECK; diff --git a/include/mysql.h b/include/mysql.h index fa62026b44a..1268280395e 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -167,7 +167,7 @@ enum mysql_option MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, - MYSQL_PROGRESS_CALLBACK, + MYSQL_PROGRESS_CALLBACK, MYSQL_THREAD_SPECIFIC_MALLOC, /* MariaDB options */ MYSQL_OPT_NONBLOCK=6000 }; @@ -194,7 +194,7 @@ struct st_mysql_options { unsigned long max_allowed_packet; my_bool use_ssl; /* if to use SSL or not */ my_bool compress,named_pipe; - my_bool unused1; + my_bool thread_specific_malloc; my_bool unused2; my_bool unused3; my_bool unused4; diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 48ce79046ff..84510a69edb 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -28,7 +28,7 @@ typedef struct st_net { unsigned char reading_or_writing; char save_char; char net_skip_rest_factor; - my_bool unused1; + my_bool thread_specific_malloc; my_bool compress; my_bool unused3; unsigned char *unused; @@ -80,7 +80,7 @@ enum enum_mysql_set_option MYSQL_OPTION_MULTI_STATEMENTS_ON, MYSQL_OPTION_MULTI_STATEMENTS_OFF }; -my_bool my_net_init(NET *net, Vio* vio); +my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags); void my_net_local_init(NET *net); void net_end(NET *net); void net_clear(NET *net, my_bool clear_buffer); @@ -262,7 +262,7 @@ enum mysql_option MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, - MYSQL_PROGRESS_CALLBACK, + MYSQL_PROGRESS_CALLBACK, MYSQL_THREAD_SPECIFIC_MALLOC, MYSQL_OPT_NONBLOCK=6000 }; struct st_mysql_options_extention; @@ -282,7 +282,7 @@ struct st_mysql_options { unsigned long max_allowed_packet; my_bool use_ssl; my_bool compress,named_pipe; - my_bool unused1; + my_bool thread_specific_malloc; my_bool unused2; my_bool unused3; my_bool unused4; diff --git a/include/mysql_com.h b/include/mysql_com.h index 46a55e42e50..dbcc7125302 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -330,7 +330,7 @@ typedef struct st_net { unsigned char reading_or_writing; char save_char; char net_skip_rest_factor; - my_bool unused1; /* Please remove with the next incompatible ABI change */ + my_bool thread_specific_malloc; my_bool compress; my_bool unused3; /* Please remove with the next incompatible ABI change. */ /* @@ -465,10 +465,10 @@ enum enum_mysql_set_option extern "C" { #endif -my_bool my_net_init(NET *net, Vio* vio); +my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags); void my_net_local_init(NET *net); void net_end(NET *net); - void net_clear(NET *net, my_bool clear_buffer); +void net_clear(NET *net, my_bool clear_buffer); my_bool net_realloc(NET *net, size_t length); my_bool net_flush(NET *net); my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index f90cc96a90f..5ca4e1085ee 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1520,8 +1520,8 @@ mysql_stmt_init(MYSQL *mysql) DBUG_RETURN(NULL); } - init_alloc_root(&stmt->mem_root, 2048, 2048); - init_alloc_root(&stmt->result.alloc, 4096, 4096); + init_alloc_root(&stmt->mem_root, 2048, 2048, MY_THREAD_SPECIFIC); + init_alloc_root(&stmt->result.alloc, 4096, 4096, MY_THREAD_SPECIFIC); stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS); mysql->stmts= list_add(mysql->stmts, &stmt->list); stmt->list.data= stmt; @@ -1532,7 +1532,8 @@ mysql_stmt_init(MYSQL *mysql) strmov(stmt->sqlstate, not_error_sqlstate); /* The rest of statement members was bzeroed inside malloc */ - init_alloc_root(&stmt->extension->fields_mem_root, 2048, 0); + init_alloc_root(&stmt->extension->fields_mem_root, 2048, 0, + MYF(MY_THREAD_SPECIFIC)); DBUG_RETURN(stmt); } diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc index d263e5d5fe8..7f73c6c4aeb 100644 --- a/libmysqld/emb_qcache.cc +++ b/libmysqld/emb_qcache.cc @@ -415,7 +415,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src) if (!data) goto err; - init_alloc_root(&data->alloc, 8192,0); + init_alloc_root(&data->alloc, 8192,0,0); f_alloc= &data->alloc; data->fields= src->load_int(); diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 955cc3c0dd1..8ffeaebb17b 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -634,7 +634,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag) mysql->server_version= server_version; mysql->client_flag= client_flag; //mysql->server_capabilities= client_flag; - init_alloc_root(&mysql->field_alloc, 8192, 0); + init_alloc_root(&mysql->field_alloc, 8192, 0, 0); } /** @@ -906,8 +906,9 @@ int Protocol::begin_dataset() if (!data) return 1; alloc= &data->alloc; - init_alloc_root(alloc,8192,0); /* Assume rowlength < 8192 */ - alloc->min_malloc=sizeof(MYSQL_ROWS); + /* Assume rowlength < 8192 */ + init_alloc_root(alloc, 8192, 0, MYF(MY_THREAD_SPECIFIC)); + alloc->min_malloc= sizeof(MYSQL_ROWS); return 0; } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 768016d94aa..067d10e13ff 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3591,9 +3591,10 @@ sub mysql_install_db { verbose => $opt_verbose, ) != 0) { + my $data= mtr_grab_file($path_bootstrap_log); mtr_error("Error executing mysqld --bootstrap\n" . "Could not install system database from $bootstrap_sql_file\n" . - "see $path_bootstrap_log for errors"); + "The $path_bootstrap_log file contains:\n$data\n"); } } diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 86050a3c792..7c556354d2e 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1762,7 +1762,9 @@ t1 CREATE TABLE `t1` ( `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000', `STAGE` tinyint(2) NOT NULL DEFAULT '0', `MAX_STAGE` tinyint(2) NOT NULL DEFAULT '0', - `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000' + `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000', + `MEMORY_USED` int(7) NOT NULL DEFAULT '0', + `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0' ) DEFAULT CHARSET=utf8 drop table t1; create temporary table t1 like information_schema.processlist; @@ -1780,7 +1782,9 @@ t1 CREATE TEMPORARY TABLE `t1` ( `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000', `STAGE` tinyint(2) NOT NULL DEFAULT '0', `MAX_STAGE` tinyint(2) NOT NULL DEFAULT '0', - `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000' + `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000', + `MEMORY_USED` int(7) NOT NULL DEFAULT '0', + `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0' ) DEFAULT CHARSET=utf8 drop table t1; create table t1 like information_schema.character_sets; diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result index 176f82ad9e3..da132a102e2 100644 --- a/mysql-test/r/show_explain.result +++ b/mysql-test/r/show_explain.result @@ -1,5 +1,6 @@ drop table if exists t0, t1, t2, t3, t4; drop view if exists v1; +SET @old_debug= @@session.debug; set debug_sync='RESET'; create table t0 (a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -12,12 +13,13 @@ show explain for 2000000000; ERROR HY000: Unknown thread id: 2000000000 show explain for (select max(a) from t0); ERROR HY000: You may only use constant expressions in this statement +SET @old_debug= @@session.debug; show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command show explain for $thr1; ERROR HY000: Target is not running an EXPLAINable command set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select count(*) from t1 where a < 100000; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -46,9 +48,10 @@ Note 1003 explain select max(c) from t1 where a < 10 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan set optimizer_switch= @show_expl_tmp; +set debug_dbug=@old_debug; # UNION, first branch set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -61,9 +64,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 2 UNION B ALL NULL NULL NULL NULL 10 NULL UNION RESULT ALL NULL NULL NULL NULL NULL +set debug_dbug=@old_debug; # UNION, second branch set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -76,9 +80,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 2 UNION B ALL NULL NULL NULL NULL 10 NULL UNION RESULT ALL NULL NULL NULL NULL NULL +set debug_dbug=@old_debug; # Uncorrelated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 B) from t0 A where a<1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -88,9 +93,10 @@ Warnings: Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1 a (select max(a) from t0 B) 0 9 +set debug_dbug=@old_debug; # Uncorrelated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a, (select max(a) from t0 B) from t0 A where a<1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -101,9 +107,10 @@ Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1 id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where 2 SUBQUERY B ALL NULL NULL NULL NULL 10 +set debug_dbug=@old_debug; # correlated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -113,9 +120,10 @@ Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 a (select max(a) from t0 b where b.a+a.a<10) 0 9 +set debug_dbug=@old_debug; # correlated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -125,9 +133,10 @@ Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 a (select max(a) from t0 b where b.a+a.a<10) 0 9 +set debug_dbug=@old_debug; # correlated subquery, select, while inside the subquery set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -137,9 +146,10 @@ Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 a (select max(a) from t0 b where b.a+a.a<10) 0 9 +set debug_dbug=@old_debug; # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -149,52 +159,57 @@ Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 a (select max(a) from t0 b where b.a+a.a<10) 0 9 +set debug_dbug=@old_debug; # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command a (select max(a) from t0 b where b.a+a.a<10) 0 9 +set debug_dbug=@old_debug; # Try to do SHOW EXPLAIN for a query that runs a SET command: # I've found experimentally that select_id==2 here... # set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; set @foo= (select max(a) from t0 where sin(a) >0); show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command +set debug_dbug=@old_debug; # # Attempt SHOW EXPLAIN for an UPDATE # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command drop table t2; +set debug_dbug=@old_debug; # # Attempt SHOW EXPLAIN for a DELETE # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command drop table t2; +set debug_dbug=@old_debug; # # Multiple SHOW EXPLAIN calls for one select # create table t2 as select a as a, a as dummy from t0 limit 3; set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -219,13 +234,14 @@ a SUBQ 1 0 2 0 drop table t2; +set debug_dbug=@old_debug; # # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort" # explain select * from t0 order by a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select * from t0 order by a; show explain for $thr2; @@ -244,13 +260,14 @@ a 7 8 9 +set debug_dbug=@old_debug; # # SHOW EXPLAIN for SELECT ... with "Using temporary" # explain select distinct a from t0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select distinct a from t0; show explain for $thr2; @@ -269,13 +286,14 @@ a 7 8 9 +set debug_dbug=@old_debug; # # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort" # explain select distinct a from t0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select distinct a from t0; show explain for $thr2; @@ -294,7 +312,7 @@ a 7 8 9 -set debug_dbug=''; +set debug_dbug=@old_debug; # # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY # @@ -304,7 +322,7 @@ explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -set debug_dbug='d,show_explain_in_find_all_keys'; +set debug_dbug='+d,show_explain_in_find_all_keys'; SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; # FIXED by "conservative assumptions about when QEP is available" fix: # NOTE: current code will not show "Using join buffer": @@ -314,7 +332,7 @@ a 1 2 4 -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t2; # # MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with @@ -329,7 +347,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a` set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -342,7 +360,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a` -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t2; # # MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in @@ -359,7 +377,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 6 2 DERIVED t3 system NULL NULL NULL NULL 1 set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; SELECT * FROM v1, t2; show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command @@ -370,14 +388,14 @@ a b 8 7 8 8 8 9 -set debug_dbug=''; +set debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t2, t3; # # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries # set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; select sleep(1); show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -386,29 +404,29 @@ Warnings: Note 1003 select sleep(1) sleep(1) 0 -set debug_dbug=''; +set debug_dbug=@old_debug; # # Same as above, but try another reason for JOIN to be degenerate # set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; select * from t0 where 1>10; show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command a -set debug_dbug=''; +set debug_dbug=@old_debug; # # Same as above, but try another reason for JOIN to be degenerate (2) # create table t3(a int primary key); insert into t3 select a from t0; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; select * from t0,t3 where t3.a=112233; show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command a a -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t3; # # MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with @@ -427,7 +445,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 Using where 3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @show_explain_probe_select_id=2; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; SELECT * FROM t2 WHERE a = (SELECT MAX(a) FROM t2 WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) @@ -447,7 +465,7 @@ pk a 6 7 7 7 9 7 -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t2; # # MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE @@ -479,7 +497,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join) 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; SELECT count(*) FROM t2, t3 WHERE a1 < ALL ( SELECT a1 FROM t2 @@ -498,7 +516,7 @@ WHERE a1 IN ( SELECT a1 FROM t2, t4 ) ) count(*) 1740 -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t2, t3, t4; # # MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function @@ -508,12 +526,12 @@ INSERT INTO t2 VALUES (1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43), (11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_end'; +set debug_dbug='+d,show_explain_probe_join_exec_end'; SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`); show explain for $thr2; ERROR HY000: Target is not running an EXPLAINable command pk a1 -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t2; DROP TABLE t1; # @@ -522,7 +540,7 @@ DROP TABLE t1; CREATE TABLE t1(a INT, KEY(a)); INSERT INTO t1 VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT 'test' FROM t1 WHERE a=1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -532,7 +550,7 @@ Note 1003 SELECT 'test' FROM t1 WHERE a=1 test test test -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1; # # MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution @@ -550,7 +568,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where 1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_test_if_quick_select'; +set debug_dbug='+d,show_explain_probe_test_if_quick_select'; select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -578,7 +596,7 @@ Warnings: Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100 count(*) 212 -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1; # # MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while @@ -587,7 +605,7 @@ drop table t1; CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)); INSERT INTO t1 (a) VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; SHOW INDEX FROM t1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -598,7 +616,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t1 1 a 1 a A NULL NULL NULL YES BTREE t1 1 b 1 b A NULL NULL NULL YES BTREE t1 1 c 1 c A NULL NULL NULL YES BTREE -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1; # # MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view @@ -611,7 +629,7 @@ EXPLAIN SELECT a + 1 FROM v1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 2 2 DERIVED t1 ALL NULL NULL NULL NULL 2 -set debug_dbug='d,show_explain_probe_join_tab_preread'; +set debug_dbug='+d,show_explain_probe_join_tab_preread'; set @show_explain_probe_select_id=1; SELECT a + 1 FROM v1; show explain for $thr2; @@ -623,7 +641,7 @@ Note 1003 SELECT a + 1 FROM v1 a + 1 2 3 -set debug_dbug=''; +set debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t1; # @@ -639,7 +657,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL -set debug_dbug='d,show_explain_probe_union_read'; +set debug_dbug='+d,show_explain_probe_union_read'; SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -658,7 +676,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL Warnings: Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ) a -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1; # # MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN @@ -681,7 +699,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 SUBQUERY t1 ALL NULL NULL NULL NULL 20 3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); show explain for $thr2; @@ -694,7 +712,7 @@ Warnings: Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ) a b -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1, t2; # # Test that SHOW EXPLAIN will print 'Distinct'. @@ -716,7 +734,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary 1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select distinct t1.a from t1,t3 where t1.a=t3.a; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -727,7 +745,7 @@ Note 1003 select distinct t1.a from t1,t3 where t1.a=t3.a a 1 2 -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1,t3,t4; # # ---------- SHOW EXPLAIN and permissions ----------------- @@ -738,7 +756,7 @@ grant super on *.* to test2@localhost; # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us # set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where a < 3; show explain for $thr2; ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation @@ -751,12 +769,12 @@ a 0 1 2 -set debug_dbug=''; +set debug_dbug=@old_debug; # # Check that user test2 can do SHOW EXPLAIN on its own queries # set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where a < 3; show explain for $thr_con2; id select_type table type possible_keys key key_len ref rows Extra @@ -771,8 +789,9 @@ a # Now, grant test2 a PROCESSLIST permission, and see that he's able to observe us # grant process on *.* to test2@localhost; +set debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where a < 3; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -783,7 +802,7 @@ a 0 1 2 -set debug_dbug=''; +set debug_dbug=@old_debug; revoke all privileges on test.* from test2@localhost; drop user test2@localhost; # @@ -848,7 +867,7 @@ ORDER BY b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; @@ -867,8 +886,9 @@ a+SLEEP(0.01) 0 0 0 +set debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; @@ -887,7 +907,7 @@ a+SLEEP(0.01) 0 0 0 -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1; # # MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains @@ -901,7 +921,7 @@ EXPLAIN SELECT a FROM t1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT a FROM t1 GROUP BY a; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -925,7 +945,7 @@ a 14 15 16 -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1; # # MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output @@ -939,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -949,7 +969,7 @@ Warnings: Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's' SUM(a + SLEEP(0.1)) 7862 -set debug_dbug=''; +set debug_dbug=@old_debug; drop table t1, t2; # # MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice @@ -987,7 +1007,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index 1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_do_select'; +set debug_dbug='+d,show_explain_probe_do_select'; SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra @@ -997,7 +1017,7 @@ id select_type table type possible_keys key key_len ref rows Extra Warnings: Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2 field1 field2 -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1,t2,t3; # # MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output @@ -1018,7 +1038,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 20 3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10; show explain for $thr2; @@ -1031,7 +1051,7 @@ Note 1003 SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10 max(a+b+c) 279 -set debug_dbug=''; +set debug_dbug=@old_debug; DROP TABLE t1,t2,t3; # # MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree) @@ -1057,7 +1077,7 @@ select hex(' hex('ãû') E3FB set @show_explain_probe_select_id=1; -set debug_dbug='d,show_explain_probe_join_exec_start'; +set debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where length('ãû') = a; set names utf8; show explain for $thr2; @@ -1068,7 +1088,7 @@ Note 1003 select * from t0 where length('гы') = a set names default; a 2 -set debug_dbug=''; +set debug_dbug=@old_debug; set names default; # # MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 9c4fd02fcdd..6cbbe934bde 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -530,4 +530,9 @@ SELECT @a; @a 1 DROP TABLE t1; +# +# Check that used memory extends if we set a variable +# +set @var= repeat('a',20000); +1 End of 5.5 tests diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index b863b98d98a..474171d175d 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -66,7 +66,7 @@ let $table= processlist; # # columns of the information_schema table e.g. to use in a select. -let $columns= ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS; +let $columns= ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS; # # Where clause for an update. let $update_where= WHERE id=1 ; @@ -159,9 +159,9 @@ WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1 eval SHOW CREATE TABLE $table; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS eval SHOW $table; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS eval SELECT * FROM $table $select_where ORDER BY id; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS eval SELECT $columns FROM $table $select_where ORDER BY id; --source suite/funcs_1/datadict/datadict_priv.inc --real_sleep 0.3 @@ -179,9 +179,9 @@ connection con100; eval SHOW CREATE TABLE $table; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS eval SHOW $table; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS eval SELECT * FROM $table $select_where ORDER BY id; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS eval SELECT $columns FROM $table $select_where ORDER BY id; --source suite/funcs_1/datadict/datadict_priv.inc --real_sleep 0.3 @@ -205,7 +205,7 @@ connection con100; SHOW GRANTS; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -217,7 +217,7 @@ connect (con101,localhost,ddicttestuser1,ddictpass,information_schema); SHOW GRANTS; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -239,7 +239,7 @@ connect (anonymous1,localhost,"''",,information_schema); SHOW GRANTS; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -261,7 +261,7 @@ connect (con102,localhost,ddicttestuser1,ddictpass,information_schema); SHOW GRANTS; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -287,7 +287,7 @@ if ($fixed_bug_30395) --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; } ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -308,7 +308,7 @@ connect (con103,localhost,ddicttestuser1,ddictpass,information_schema); SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -330,7 +330,7 @@ connect (con104,localhost,ddicttestuser1,ddictpass,information_schema); SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -377,7 +377,7 @@ connect (con200,localhost,ddicttestuser2,ddictpass,information_schema); SHOW GRANTS FOR 'ddicttestuser2'@'localhost'; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -398,7 +398,7 @@ connect (con201,localhost,ddicttestuser2,ddictpass,information_schema); SHOW GRANTS; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -421,7 +421,7 @@ SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -445,7 +445,7 @@ connect (con108,localhost,ddicttestuser1,ddictpass,information_schema); SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS SHOW processlist; ---replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS +--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS SELECT * FROM information_schema.processlist; --real_sleep 0.3 diff --git a/mysql-test/suite/funcs_1/datadict/processlist_val.inc b/mysql-test/suite/funcs_1/datadict/processlist_val.inc index bb6c13a6f4b..d0d2e606152 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_val.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_val.inc @@ -93,9 +93,9 @@ echo # - INFO must contain the corresponding SHOW/SELECT PROCESSLIST # # 1. Just dump what we get ---replace_column 1 3 6