From 5b4af80b15c12b8527b6b220352ae521e23bf603 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Thu, 26 Sep 2019 11:08:23 +0300 Subject: [PATCH 1/5] Clean up temparary directories after creation of binary repo During the build first binary packages are generated and copied into 'pre-repo' direcotory. Then binary repository is created and next step is to copy repository into final directory according agreed binary repo sirectories structure. After it temparal direcotries are not needed. --- BUILD/mdbci/copy_repos.sh | 3 +++ BUILD/mdbci/create_remote_repo.sh | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/BUILD/mdbci/copy_repos.sh b/BUILD/mdbci/copy_repos.sh index 517ef82dd..fd9503c92 100755 --- a/BUILD/mdbci/copy_repos.sh +++ b/BUILD/mdbci/copy_repos.sh @@ -70,4 +70,7 @@ $(<${script_dir}/templates/repository-config/deb.json.template) fi cd $dir +echo "cleaning ${unsorted_repo_dir}/$target/$box" +rm -rf ${unsorted_repo_dir}/$target/$box + ${mdbci_dir}/mdbci generate-product-repositories --product maxscale_ci --product-version $target diff --git a/BUILD/mdbci/create_remote_repo.sh b/BUILD/mdbci/create_remote_repo.sh index 335197d13..16f1e7b3b 100755 --- a/BUILD/mdbci/create_remote_repo.sh +++ b/BUILD/mdbci/create_remote_repo.sh @@ -34,8 +34,10 @@ if [ $? != 0 ] ; then exit 1 fi -echo "cleaning ${unsorted_repo_dir}/$target/$box/" -rm -rf ${unsorted_repo_dir}/$target/$box/* +echo "cleaning ${unsorted_repo_dir}/$target/$box" +rm -rf ${unsorted_repo_dir}/$target/$box +echo "cleaning ${pre_repo_dir}/$target/$box" +rm -rf ${pre_repo_dir}/$target/$box echo "copying repo from $box" mkdir -p ${unsorted_repo_dir}/$target/$box From 0c2a84c3a5998153c348ed3d8b6f17067f2ab361 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 26 Sep 2019 14:50:23 +0300 Subject: [PATCH 2/5] MXS-2699 Add test that reveals problem --- query_classifier/test/maxscale.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/query_classifier/test/maxscale.test b/query_classifier/test/maxscale.test index f757b164d..8da8a95de 100644 --- a/query_classifier/test/maxscale.test +++ b/query_classifier/test/maxscale.test @@ -132,3 +132,6 @@ XA RECOVER 'xid'; # MXS-2688 SET @saved_cs_client= @@character_set_client; + +# MXS-2699 +SELECT NEXTVAL(id_generator), context FROM t1 WHERE (a,b,c) >= (1,2,3); From 5bbb2e239d1255a155e44583694dd28fb2503948 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 26 Sep 2019 14:54:08 +0300 Subject: [PATCH 3/5] MXS-2699 Add rule for (expr [, expr]*) Sofar at most (expr, expr) was accepted. --- query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y index 7ccf8af9b..f24536295 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y @@ -1873,9 +1873,14 @@ idlist(A) ::= nm(Y). } expr(A) ::= term(X). {A = X;} +%ifndef MAXSCALE expr(A) ::= LP(B) expr(X) RP(E). {A.pExpr = X.pExpr; spanSet(&A,&B,&E);} +%endif %ifdef MAXSCALE -expr(A) ::= LP expr(X) COMMA(OP) expr(Y) RP. {spanBinaryExpr(&A,pParse,@OP,&X,&Y);} +%type exprs {ExprSpan} +exprs(A) ::= expr(X). { A = X; } +exprs(A) ::= exprs(X) COMMA(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);} +expr(A) ::= LP(B) exprs(X) RP(E). {A.pExpr = X.pExpr; spanSet(&A,&B,&E);} term(A) ::= DEFAULT(X). {spanExpr(&A, pParse, @X, &X);} %endif term(A) ::= NULL(X). {spanExpr(&A, pParse, @X, &X);} From c01ecfed05a30b0180b25805b14bc6b8db73c653 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 26 Sep 2019 16:43:12 +0300 Subject: [PATCH 4/5] MXS-2699 Add test that reveals other bug --- query_classifier/test/maxscale.test | 1 + 1 file changed, 1 insertion(+) diff --git a/query_classifier/test/maxscale.test b/query_classifier/test/maxscale.test index 8da8a95de..a94d7ad11 100644 --- a/query_classifier/test/maxscale.test +++ b/query_classifier/test/maxscale.test @@ -135,3 +135,4 @@ SET @saved_cs_client= @@character_set_client; # MXS-2699 SELECT NEXTVAL(id_generator), context FROM t1 WHERE (a,b,c) >= (1,2,3); +select soundex(_utf8mb4 0xD091D092D093) as vx, gray_user_tag from user_extends where user_id > last_insert_id(); From a9f07844b3aba4aa4ea109535df618a0cf598ce5 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 26 Sep 2019 16:51:21 +0300 Subject: [PATCH 5/5] MXS-2699 Accept '_[character_set] hex' as string The purpose is to recognize e.g. /_utf8mb4 0xD091D092D093/ as a valid string. The rule actually accepts /id integer/, but in case the statement is something else but an '_' immediately followed by a character set, followed by a hex number, it will be rejected by the server so no harm done. --- query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y index f24536295..0537d09f7 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y @@ -1926,6 +1926,13 @@ expr(A) ::= VARIABLE(X). { spanSet(&A, &X, &X); } %ifdef MAXSCALE +expr(A) ::= id(X) INTEGER(Y). { + // The sole purpose of this is to interpret something like '_utf8mb4 0xD091D092D093' + // as a string. It does not matter that any identifier followed by an integer will + // be interpreted as a string, as invalid usage will be caught by the server. + A.pExpr = sqlite3PExpr(pParse, TK_STRING, 0, 0, &Y); + spanSet(&A, &X, &Y); +} expr(A) ::= VARIABLE(X) variable_tail(Y). { // As we won't be executing any queries, we do not need to do // the things that are done above.