From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id E46F428FA3 for ; Tue, 21 Aug 2018 06:26:47 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id okLEvKDyHb1m for ; Tue, 21 Aug 2018 06:26:47 -0400 (EDT) Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 99F0028F91 for ; Tue, 21 Aug 2018 06:26:47 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH 2/2] sql: take sql field in index_opts_cmp From: "n.pettik" In-Reply-To: <2fc838acfd7806a467bbe416ab0edeedf2efd71d.1534783275.git.kyukhin@tarantool.org> Date: Tue, 21 Aug 2018 13:26:44 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <07122CA6-A039-4D71-B535-718AD11B7171@tarantool.org> References: <2fc838acfd7806a467bbe416ab0edeedf2efd71d.1534783275.git.kyukhin@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Kirill Yukhin > diff --git a/src/box/index_def.h b/src/box/index_def.h > index 48a7820..8960e3d 100644 > --- a/src/box/index_def.h > +++ b/src/box/index_def.h > @@ -212,6 +212,14 @@ index_opts_cmp(const struct index_opts *o1, const = struct index_opts *o2) > return o1->run_size_ratio < o2->run_size_ratio ? -1 : 1; > if (o1->bloom_fpr !=3D o2->bloom_fpr) > return o1->bloom_fpr < o2->bloom_fpr ? -1 : 1; > + Nitpicking: don=E2=80=99t put extra new line: it breaks whole function = look. > + if ((o1->sql =3D=3D NULL) !=3D (o2->sql =3D=3D NULL)) > + return 1; > + if ((o1->sql !=3D NULL) && (o2->sql !=3D NULL)) { Nitpicking: after previous check o1->sql and o2->sql are both NULL or = not. So I guess only one check is enough: if (o1->sql !=3D NULL). > + int rc =3D strcmp(o1->sql, o2->sql); > + if (rc !=3D 0) > + return rc; Why not simply return strcmp()? > + } > return 0; > } >=20 > diff --git a/test/sql/gh-3613-idx-alter-update-2.test.lua = b/test/sql/gh-3613-idx-alter-update-2.test.lua > new file mode 100644 > index 0000000..e2beb7a > --- /dev/null > +++ b/test/sql/gh-3613-idx-alter-update-2.test.lua Can you merge this test file with previous one? I strongly dislike the fact that such simple tests are put in separate files. Even though we already have sql-tap/alter.test.lua. > @@ -0,0 +1,16 @@ > +test_run =3D require('test_run').new() > +engine =3D test_run:get_cfg('engine') > +box.sql.execute('pragma sql_default_engine=3D\''..engine..'\'') > + > +box.sql.execute('CREATE TABLE t (s1 INT PRIMARY KEY)') > +box.sql.execute('CREATE INDEX i ON t (s1)') > +box.sql.execute('ALTER TABLE t RENAME TO j3') > + > +-- After gh-3613 fix, bug in cmp_def was discovered. > +-- Comparison didn't take .opts.sql into account. > +test_run:cmd('restart server default') > + > +box.sql.execute('DROP INDEX i ON j3') > + > +-- Cleanup > +box.sql.execute('DROP TABLE j3') > --=20 > 2.16.2 >=20 >=20