Skip to content

Commit

Permalink
Added a new grammar file only for XAP queries
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadb-SusilBehera committed Nov 20, 2024
1 parent 7e0a116 commit 2cc3bb3
Showing 1 changed file with 322 additions and 0 deletions.
322 changes: 322 additions & 0 deletions conf/replication/xa_prepare_only.yy
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
# Copyright (C) 2008 Sun Microsystems, Inc. All rights reserved.
# 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

query:
| {$rand_xid= "'xid_no_commit_xa_".$prng->uint16(1,50).time().rand()."'"; ''} no_commit_xa
;

no_commit_xa:
xa_2phase_upto_prepare | xa_2phase_upto_prepare | xa_2phase_upto_prepare | xa_2phase_upto_prepare | xa_1phase_upto_end
;

xa_2phase_upto_prepare:
XA START { $rand_xid }
; normal_query_list
; XA END { $rand_xid }
; XA PREPARE { $rand_xid }
;

xa_1phase_upto_end:
XA START { $rand_xid }
; normal_query_list
; XA END { $rand_xid }
;

normal_query_list:
normal_query |
normal_query ; normal_query_list
;

normal_query:
selects | inserts | updates | deletes ;

inserts:
insert1 | insert2 | insert3 | insert4 ;

insert1:
INSERT INTO _table
(col_int_unsigned_unique,
col_int_unsigned_not_null_unique,
col_char_255_utf8_unique,
col_char_255_utf8_not_null,
col_int_unsigned_key,
col_int_unsigned_not_null_key,
col_char_255_utf8,
col_int_unsigned_unique_default_null,
col_char_255_utf8_key_default_null,
col_int_unsigned,
col_char_255_utf8_not_null_key,
col_char_255_utf8_default_null,
col_char_255_utf8_key,
col_int_unsigned_not_null,
col_char_255_utf8_not_null_unique,
col_int_unsigned_default_null,
col_char_255_utf8_unique_default_null,
col_int_unsigned_key_default_null)
VALUES
(rand_number,
rand_number,
rand_string,
rand_string,
rand_number,
rand_number,
rand_string,
rand_number,
rand_string,
rand_number,
rand_string,
rand_string,
rand_string,
rand_number,
rand_string,
rand_number,
rand_string,
rand_number);

insert2:
INSERT INTO _table
(col_int_unsigned_unique,
col_int_unsigned_not_null_unique,
col_char_255_utf8_unique,
col_char_255_utf8_not_null,
col_int_unsigned_key,
col_int_unsigned_not_null_key,
col_char_255_utf8,
col_int_unsigned_unique_default_null,
col_char_255_utf8_key_default_null,
col_int_unsigned,
col_char_255_utf8_not_null_key,
col_char_255_utf8_default_null,
col_char_255_utf8_key,
col_int_unsigned_not_null,
col_char_255_utf8_not_null_unique,
col_int_unsigned_default_null,
col_char_255_utf8_unique_default_null,
col_int_unsigned_key_default_null)
VALUES
(NULL,
rand_number,
rand_string,
_char(1),
NULL,
_digit,
NULL,
rand_number,
_char(1),
NULL,
_char(1),
_char(1),
NULL,
_digit,
rand_string,
_digit,
rand_string,
_digit);


insert3:
INSERT INTO _table
(col_int_unsigned_unique,
col_int_unsigned_not_null_unique,
col_char_255_utf8_unique,
col_char_255_utf8_not_null,
col_int_unsigned_key,
col_int_unsigned_not_null_key,
col_char_255_utf8,
col_int_unsigned,
col_char_255_utf8_not_null_key,
col_char_255_utf8_key,
col_int_unsigned_not_null,
col_char_255_utf8_not_null_unique)
VALUES
(rand_number,
rand_number,
rand_string,
rand_string,
rand_number,
rand_number,
rand_string,
rand_number,
rand_string,
rand_string,
rand_number,
rand_string);

insert4:
INSERT INTO _table
(col_int_unsigned_unique,
col_int_unsigned_not_null_unique,
col_char_255_utf8_unique,
col_char_255_utf8_not_null,
col_int_unsigned_key,
col_int_unsigned_not_null_key,
col_char_255_utf8,
col_int_unsigned,
col_char_255_utf8_not_null_key,
col_char_255_utf8_key,
col_int_unsigned_not_null,
col_char_255_utf8_not_null_unique)
VALUES
(NULL,
rand_number,
NULL,
rand_string,
NULL,
rand_number,
NULL,
NULL,
_char(1),
NULL,
rand_number,
rand_string);

selects:
point_select_key_not_null | simple_range_key_not_null | sum_range_key_not_null | order_range_key_not_null | distinct_range_key_not_null
| point_select_unique_key_not_null | simple_range_unique_key_not_null | sum_range_unique_key_not_null | order_range_unique_key_not_null | distinct_range_unique_key_not_null
| point_select_unique_key_null | simple_range_unique_key_null | sum_range_unique_key_null | order_range_unique_key_null | distinct_range_unique_key_null
| point_select_no_key_null | simple_range_no_key_null | sum_range_no_key_null | order_range_no_key_null | distinct_range_no_key_null
| point_select_no_key_not_null | simple_range_no_key_not_null | sum_range_no_key_not_null | order_range_no_key_not_null | distinct_range_no_key_not_null
;

point_select_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null_key = _smallint_unsigned ; SELECT _field FROM _table WHERE col_int_unsigned_not_null_key IS NULL ;

simple_range_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null_key BETWEEN _digit AND _smallint_unsigned ;

sum_range_key_not_null:
SELECT SUM(col_int_unsigned_not_null_key) FROM _table WHERE col_int_unsigned_not_null_key BETWEEN _digit AND _smallint_unsigned ;

order_range_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null_key BETWEEN _digit AND _smallint_unsigned ORDER BY _field ;

distinct_range_key_not_null:
SELECT DISTINCT _field FROM _table WHERE col_int_unsigned_not_null_key BETWEEN _smallint_unsigned AND _smallint_unsigned ORDER BY _field ;

point_select_key_null:
SELECT _field FROM _table WHERE col_int_unsigned_key = _smallint_unsigned ; SELECT _field FROM _table WHERE col_int_unsigned_key IS NULL ;

simple_range_key_null:
SELECT _field FROM _table WHERE col_int_unsigned_key BETWEEN _digit AND _smallint_unsigned ;

sum_range_key_null:
SELECT SUM(col_int_unsigned_key) FROM _table WHERE col_int_unsigned_key BETWEEN _digit AND _smallint_unsigned ;

order_range_key_null:
SELECT _field FROM _table WHERE col_int_unsigned_key BETWEEN _digit AND _smallint_unsigned ORDER BY _field ;

distinct_range_key_null:
SELECT DISTINCT _field FROM _table WHERE col_int_unsigned_key BETWEEN _smallint_unsigned AND _smallint_unsigned ORDER BY _field ;

point_select_unique_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null_unique = _smallint_unsigned ; SELECT _field FROM _table WHERE col_int_unsigned_not_null_unique IS NULL ;

simple_range_unique_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null_unique BETWEEN _digit AND _smallint_unsigned ;

sum_range_unique_key_not_null:
SELECT SUM(col_int_unsigned_not_null_unique) FROM _table WHERE col_int_unsigned_not_null_unique BETWEEN _digit AND _smallint_unsigned ;

order_range_unique_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null_unique BETWEEN _digit AND _smallint_unsigned ORDER BY _field ;

distinct_range_unique_key_not_null:
SELECT DISTINCT _field FROM _table WHERE col_int_unsigned_not_null_unique BETWEEN _smallint_unsigned AND _smallint_unsigned ORDER BY _field ;

point_select_unique_key_null:
SELECT _field FROM _table WHERE col_int_unsigned_unique = _smallint_unsigned ; SELECT _field FROM _table WHERE col_int_unsigned_unique IS NULL ;

simple_range_unique_key_null:
SELECT _field FROM _table WHERE col_int_unsigned_unique BETWEEN _digit AND _smallint_unsigned ;

sum_range_unique_key_null:
SELECT SUM(col_int_unsigned_unique) FROM _table WHERE col_int_unsigned_unique BETWEEN _digit AND _smallint_unsigned ;

order_range_unique_key_null:
SELECT _field FROM _table WHERE col_int_unsigned_unique BETWEEN _digit AND _smallint_unsigned ORDER BY _field ;

distinct_range_unique_key_null:
SELECT DISTINCT _field FROM _table WHERE col_int_unsigned_unique BETWEEN _smallint_unsigned AND _smallint_unsigned ORDER BY _field ;

point_select_no_key_null:
SELECT _field FROM _table WHERE col_int_unsigned = _smallint_unsigned ; SELECT _field FROM _table WHERE col_int_unsigned IS NULL ;

simple_range_no_key_null:
SELECT _field FROM _table WHERE col_int_unsigned BETWEEN _digit AND _smallint_unsigned ;

sum_range_no_key_null:
SELECT SUM(col_int_unsigned) FROM _table WHERE col_int_unsigned BETWEEN _digit AND _smallint_unsigned ;

order_range_no_key_null:
SELECT _field FROM _table WHERE col_int_unsigned BETWEEN _digit AND _smallint_unsigned ORDER BY _field ;

distinct_range_no_key_null:
SELECT DISTINCT _field FROM _table WHERE col_int_unsigned BETWEEN _smallint_unsigned AND _smallint_unsigned ORDER BY _field ;

point_select_no_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null = _smallint_unsigned ; SELECT _field FROM _table WHERE col_int_unsigned_not_null IS NULL ;

simple_range_no_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null BETWEEN _digit AND _smallint_unsigned ;

sum_range_no_key_not_null:
SELECT SUM(col_int_unsigned_not_null) FROM _table WHERE col_int_unsigned_not_null BETWEEN _digit AND _smallint_unsigned ;

order_range_no_key_not_null:
SELECT _field FROM _table WHERE col_int_unsigned_not_null BETWEEN _digit AND _smallint_unsigned ORDER BY _field ;

distinct_range_no_key_not_null:
SELECT DISTINCT _field FROM _table WHERE col_int_unsigned_not_null BETWEEN _smallint_unsigned AND _smallint_unsigned ORDER BY _field ;

deletes:
delete1 | delete2 | delete3 | delete4 | delete5 | delete6 ;

delete1:
DELETE FROM _table WHERE col_int_unsigned = _tinyint_unsigned ;
delete2:
DELETE FROM _table WHERE col_int_unsigned_not_null = _smallint_unsigned ;
delete3:
DELETE FROM _table WHERE col_int_unsigned_key = _tinyint_unsigned ;
delete4:
DELETE FROM _table WHERE col_int_unsigned_not_null_key = _smallint_unsigned ;
delete5:
DELETE FROM _table WHERE col_int_unsigned_unique = _tinyint_unsigned ;
delete6:
DELETE FROM _table WHERE col_int_unsigned_not_null_unique = _smallint_unsigned ;


updates:
update1 | update2 | update3 | update4 | update5 | update6 ;

update1:
UPDATE _table SET col_int_unsigned = col_int_unsigned + 1 WHERE (col_int_unsigned % 9) = 0;
update2:
UPDATE _table SET col_int_unsigned_not_null = col_int_unsigned_not_null + 1 WHERE (col_int_unsigned % 9) = 0 ;
update3:
UPDATE _table SET col_int_unsigned_key = col_int_unsigned_key + 1 WHERE (col_int_unsigned % 9) = 0 ;
update4:
UPDATE _table SET col_int_unsigned_not_null_key = col_int_unsigned_not_null_key + 1 WHERE (col_int_unsigned % 9) = 0 ;
update5:
UPDATE _table SET col_int_unsigned_unique = col_int_unsigned_unique + 1 WHERE (col_int_unsigned % 9) = 0 ;
update6:
UPDATE _table SET col_int_unsigned_not_null_unique = col_int_unsigned_not_null_unique + 1 WHERE (col_int_unsigned % 9) = 0 ;

rand_number:
RAND()*(_int_unsigned-1)+1;

rand_string:
_string(32);

0 comments on commit 2cc3bb3

Please sign in to comment.