[MDEV-5231] Per query variables from Percona Server [patch] Created: 2013-11-03  Updated: 2022-03-29  Resolved: 2014-11-11

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.1.2

Type: Task Priority: Critical
Reporter: Patryk Pomykalski Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 3
Labels: None

Issue Links:
Blocks
blocks MDEV-4427 query timeouts Closed
Duplicate
duplicates MDEV-5251 SET STATEMENT feature Closed
Relates
relates to MDEV-6940 SET STATEMENT executed after SET GLOB... Closed
relates to MDEV-6941 SET STATEMENT affects the value of th... Closed
relates to MDEV-6942 SET SESSION statement combined with S... Closed
relates to MDEV-6944 SQL_MODEs related to parsing are not ... Closed
relates to MDEV-6945 SET STATEMENT autocommit=... has no e... Closed
relates to MDEV-6946 Assertion `0' failed in mysql_execute... Closed
relates to MDEV-6948 SET STATEMENT gtid_domain_id = ... FO... Closed
relates to MDEV-6949 MySQL client does not recognize SET S... Closed
relates to MDEV-6951 Erroneous SET STATEMENT produces two ... Closed
relates to MDEV-6953 SET STATEMENT profiling = .. FOR does... Closed
relates to MDEV-6954 SET STATEMENT rand_seedX = ...FOR ...... Closed
relates to MDEV-6955 SET STATEMENT tx_isolation = FOR ...... Closed
relates to MDEV-6956 SET STATEMENT default_master_connecti... Closed
relates to MDEV-6957 SET STATEMENT skip_replication = .. m... Closed
relates to MDEV-6976 Assertion `! is_set() || m_can_overwr... Closed
relates to MDEV-6977 SET STATEMENT query_cache_type appare... Closed
relates to MDEV-6996 SET STATEMENT default_week_format = .... Closed
relates to MDEV-6997 SET STATEMENT last_insert_id FOR ... ... Closed
relates to MDEV-7002 SET STATEMENT sql_log_off has no effect Closed
relates to MDEV-7006 SET STATEMENT does not work with slow... Closed
relates to MDEV-7007 SET STATEMENT slow_query_log has no e... Closed
relates to MDEV-7009 SET STATEMENT min_examined_row_limit ... Closed
relates to MDEV-7012 SET STATEMENT character_set_client, c... Closed
relates to MDEV-7013 SET STATEMENT wait_timeout or interac... Closed
relates to MDEV-7015 SET STATEMENT old_passwords has no ef... Closed
relates to MDEV-7018 SET STATEMENT query_response_time_exe... Closed
relates to MDEV-27462 SET STATEMENT allows variables that c... Stalled

 Description   

Port of per query variables feature from Percona Server. Allows changing variables for duration of the query.
docs: http://www.percona.com/doc/percona-server/5.6/flexibility/per_query_variable_statement.html
commit in PS: http://bazaar.launchpad.net/~percona-core/percona-server/5.6/revision/477

patch for mariadb 10.0: http://bazaar.launchpad.net/~pomyks/maria/10.0-per-query-variables/revision/3880



 Comments   
Comment by Oleksandr Byelkin [ 2014-02-20 ]

10.0 patch applied with no problem on 10.1.
2 issue to check so far:
1) if saving/restoring variables values could be optimized
2) increasing conflicts in the parser

Comment by Oleksandr Byelkin [ 2014-02-20 ]

mem_root memory should be used for allocation instead of my_malloc. Time of live of variables backup is statement and mem_root should be faster.

Comment by Oleksandr Byelkin [ 2014-02-20 ]

Result of any alloc should be checked before assigning something by this address.

Comment by Oleksandr Byelkin [ 2014-02-20 ]

What if a variable with some side-effect changed? (are there such variables among session one).

Comment by Oleksandr Byelkin [ 2014-02-20 ]

update called on restoring which is OK

Comment by Oleksandr Byelkin [ 2014-02-21 ]

As far as all variables copied in one chunk (two if there is dynamic). There is no gain in copy of only changed.

But first call of malloc (backup of THD variables) changed with sql_alloc because it should not live over statement execution.

Both memory allocation results checked and error returned in case of EOM.

Comment by Oleksandr Byelkin [ 2014-02-21 ]

Deallocation items before mysql_sql_stmt_execute() call looks suspicious.

Comment by Oleksandr Byelkin [ 2014-02-21 ]

Yes. It was unclean items from setting variables. So it should be done in other place.

Comment by Oleksandr Byelkin [ 2014-02-21 ]

Above rise question which memory execution of setting variables run on.

Comment by Oleksandr Byelkin [ 2014-02-21 ]

The place of item list is correct (only EXECUTION prepared statement need it) but comment changed on more correct.

Arena checked and it is correct (DBUG_ASSERT put there).

Comment by Oleksandr Byelkin [ 2014-02-21 ]

Is everything ok with SP?..

Comment by Oleksandr Byelkin [ 2014-02-24 ]

Subqueries in the variables expressions?

Comment by Oleksandr Byelkin [ 2014-02-24 ]

CREATE TABLE t1 (v1 INT, v2 INT);
INSERT INTO t1 VALUES (1,2);
INSERT INTO t1 VALUES (3,4);

PREPARE stmt2
FROM 'SELECT * FROM t1';
SET STATEMENT myisam_sort_buffer_size=400000,
myisam_repair_threads=(select max(v1) from t1),
sort_buffer_size=200000,
binlog_format=row,
keep_files_on_create=OFF,
max_join_size=4444440000000 FOR
EXECUTE stmt2;

crash in the original patch.

Comment by Patryk Pomykalski [ 2014-04-17 ]

Percona Server 5.6.16 also crashes.

Comment by Oleksandr Byelkin [ 2014-05-22 ]

The patch sent for review.

Comment by Oleksandr Byelkin [ 2014-06-24 ]

https://bugs.launchpad.net/percona-server/+bug/1333650

Comment by Oleksandr Byelkin [ 2014-07-10 ]

Above fixed

Comment by Oleksandr Byelkin [ 2014-07-14 ]

https://bugs.launchpad.net/percona-server/+bug/1341438

Comment by Oleksandr Byelkin [ 2014-07-14 ]

https://bugs.launchpad.net/percona-server/+bug/1341606

Comment by Oleksandr Byelkin [ 2014-10-13 ]

Diff sent by e-mail, commit e-mail will be soon also.

Comment by roberto spadim [ 2014-10-13 ]

does the query cache (and query cache strip comments) work with it?

Comment by Oleksandr Byelkin [ 2014-10-21 ]

postreview fixes sent to review

Comment by Sergei Golubchik [ 2014-10-21 ]

ok to push with changes as in the last review

Comment by Sergei Golubchik [ 2014-10-22 ]

ok to push

Generated at Thu Feb 08 07:02:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.