[MDEV-2450] LP:597742 - status_user.test fails in 5.3-based branches when ran with --ps-protocol Created: 2010-06-23  Updated: 2012-10-04  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Not a Bug Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug597742.xml    

 Description   

status_user.test fails in 5.3-based branches when one runs the test with --ps-protocol.



 Comments   
Comment by Sergei Petrunia [ 2010-06-23 ]

Re: status_user.test fails in 5.3-based branches when ran with --ps-protocol
The failure looks like this: http://buildbot.askmonty.org/buildbot/builders/debian5-i386-fulltest/builds/387/steps/test_4/logs/stdio:

main.status_user w2 [ fail ]
Test ended at 2010-06-11 20:34:32

CURRENT_TEST: main.status_user
— /var/lib/buildbot/maria-slave/debian5-i386-fulltest/build/mysql-test/r/status_user.result 2010-06-11 18:27:08.000000000 -0400
+++ /var/lib/buildbot/maria-slave/debian5-i386-fulltest/build/mysql-test/r/status_user.reject 2010-06-11 20:34:32.000000000 -0400
@@ -133,14 +133,14 @@
ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS,
ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;
TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS ROWS_READ ROWS_SENT ROWS_DELETED ROWS_INSERTED ROWS_UPDATED SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES
-1 0 6 2 1 8 5 3 11 9 10 2 0 0 0 1
+1 0 11 2 1 12 10 1 2 9 10 2 0 0 0 1
select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT,
ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS,
UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS,
ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS,
ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;
TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS ROWS_READ ROWS_SENT ROWS_DELETED ROWS_INSERTED ROWS_UPDATED SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES
-1 0 6 2 1 8 5 3 11 9 10 2 0 0 0 1
+1 0 11 2 1 12 10 1 2 9 10 2 0 0 0 1
flush table_statistics;
flush index_statistics;
select * from information_schema.index_statistics;

mysqltest: Result length mismatch

Comment by Sergei Petrunia [ 2010-06-23 ]

Re: status_user.test fails in 5.3-based branches when ran with --ps-protocol
The problem doesn't occur on 5.2

Comment by Sergei Petrunia [ 2010-06-24 ]

Re: status_user.test fails in 5.3-based branches when ran with --ps-protocol
I've narrowed it down to a smaller testcase:

cat > t/_a.test << EOF
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

  1. Disable logging to get right number of writes into the tables.
    set @save_general_log=@@global.general_log;
    set @@global.general_log=0;
    set @@global.userstat=1;
    flush status;

create table t1 (a int, primary key (a), b int default 0) engine=myisam;
insert into t1 (a) values (1),(2),(3),(4);
update t1 set b=1;
#update t1 set b=5 where a=2;
#delete from t1 where a=3;

/* Empty query */
select * from t1 where a=999;

drop table t1;

select sleep(1);

  1. Ensure that the following commands doesn't change statistics

set @@global.userstat=0;

#

  1. Check that we got right statistics
    #
    select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT,
    ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS,
    UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS,
    ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS,
    ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;

EOF

The last query will produce different results depending on whether the testcase was run with --ps-protocol or not.

Comment by Sergei Petrunia [ 2010-06-24 ]

Re: status_user.test fails in 5.3-based branches when ran with --ps-protocol
In particular, we'll get ROWS_INSERTED=4 without --ps-protocol (correct), and ROWS_INSERTED=8 with --ps-protocol (incorrect).

Investigation reveals that ROWS_INSERTED gets incremented twice:

  • first time on COM_STMT_EXECUTE
  • second time on COM_STMT_CLOSE:

Breakpoint 12, dispatch_command (command=COM_STMT_EXECUTE, thd=0xb8a7300, packet=0xb9598d9 "\002", packet_length=9) at sql_parse.cc:991

    1. ^^ This is the INSERT statement.
      ...

Breakpoint 10, update_global_user_stats_with_user (thd=0xb8a7300, user_stats=0xb93f768, now=1277408205) at sql_connect.cc:948
$204 = 0

Breakpoint 11, update_global_user_stats_with_user (thd=0xb8a7300, user_stats=0xb93f768, now=1277408205) at sql_connect.cc:954
$205 = 4

...

Breakpoint 12, dispatch_command (command=COM_STMT_CLOSE, thd=0xb8a7300, packet=0xb9598d9 "\002", packet_length=4) at sql_parse.cc:991

Breakpoint 10, update_global_user_stats_with_user (thd=0xb8a7300, user_stats=0xb93f768, now=1277408262) at sql_connect.cc:948
$208 = 4

(gdb) next
(gdb) next
(gdb) next

Breakpoint 11, update_global_user_stats_with_user (thd=0xb8a7300, user_stats=0xb93f768, now=1277408262) at sql_connect.cc:954
$209 = 8

Comment by Sergei Petrunia [ 2010-06-24 ]

Re: status_user.test fails in 5.3-based branches when ran with --ps-protocol
5.2's userstat code is different, it seems this particular failure was in 5.2 and was fixed by this change:

Revision Id: sergii@pisem.net-20100316123835-rqwdtntbiaj70ui8
Committer: Sergei Golubchik <sergii@pisem.net>
Branch nick: 5.2
Timestamp: Tue 2010-03-16 13:38:35 +0100
fixes for the status_user.test in ps protocol

We need to merge from 5.2 to get this fix.

Comment by Sergei Petrunia [ 2010-06-27 ]

Re: status_user.test fails in 5.3-based branches when ran with --ps-protocol
Doesn't fail any more after 5.2 -> 5.3 merge

Comment by Rasmus Johansson (Inactive) [ 2010-06-27 ]

Launchpad bug id: 597742

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