config root man

Current Path : /home/usr.opt/mysql57/mysql-test/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/t/packet.test

# Embedded server doesn't support external clients
--source include/not_embedded.inc
# Windows fails because it disconnects on too-large packets instead of just
# swallowing them and returning an error
--source include/not_windows.inc

# Save the initial number of concurrent sessions
--source include/count_sessions.inc


#
# Check protocol handling
#

set @max_allowed_packet=@@global.max_allowed_packet;
set @net_buffer_length=@@global.net_buffer_length;


# setting values below minimum threshold of 1024 will cause truncating
set global max_allowed_packet=100;
set global net_buffer_length=100;

# is not yet in effect
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select repeat('a',2000);

#
# Connection 1 should get error for too big packets
#
connect (con1,localhost,root,,);
connection con1;
select @@net_buffer_length, @@max_allowed_packet;
--error ER_NET_PACKET_TOO_LARGE
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
connection default;
disconnect con1;

#
# Reset to default values and reconnect
#
set global max_allowed_packet=default;
set global net_buffer_length=default;
connect (con2,localhost,root,,);
connection con2;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000));
connection default;
disconnect con2;

set global max_allowed_packet=@max_allowed_packet;
set global net_buffer_length=@net_buffer_length;

# End of 4.1 tests

--echo #
--echo # Bug #20376498: MAX_ALLOWED_PACKET ERROR DESTROYS
--echo #                ORIGINAL DATA


CREATE TABLE t1 (c11 INT NOT NULL, c12 LONGTEXT,
                 PRIMARY KEY (c11));
CREATE TABLE t2 (c21 INT NOT NULL, c22 LONGTEXT,
                 PRIMARY KEY (c21));
CREATE TABLE t3 (c31 INT NOT NULL, c32 LONGTEXT,
                 PRIMARY KEY (c31)) ENGINE=MYISAM;
CREATE TABLE t4 (c41 INT NOT NULL, c42 LONGTEXT,
                 PRIMARY KEY (c41)) ENGINE=MYISAM;
INSERT INTO t1 VALUES(100,'abcd');
INSERT INTO t2 VALUES(100,'xyz');
INSERT INTO t3 VALUES(100,'a');
INSERT INTO t3 VALUES(111,'abcd');
INSERT INTO t3 VALUES(122,'b');

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
UPDATE t1
SET c12= REPEAT('ab', @max_allowed_packet);

UPDATE IGNORE t1
SET c12= REPEAT('ab', @max_allowed_packet);

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
UPDATE t1, t2
SET c12= REPEAT('ab', @max_allowed_packet),
    c22= 'ab';

UPDATE IGNORE t1, t2
SET c12= REPEAT('ab', @max_allowed_packet),
    c22= 'ab';

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
INSERT INTO t1
VALUES (101, REPEAT('ab', @max_allowed_packet));

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
INSERT INTO t1
SELECT 101, REPEAT('ab', @max_allowed_packet);

INSERT IGNORE INTO t1
SELECT 101, REPEAT('ab', @max_allowed_packet);

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
REPLACE INTO t1
VALUES (102, REPEAT('ab', @max_allowed_packet));

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
REPLACE INTO t1
SET c11= 102,
    c12= REPEAT('ab', @max_allowed_packet);

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
REPLACE INTO t1
SELECT 102, REPEAT('ab', @max_allowed_packet);

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
DELETE FROM t1
WHERE c12 <=> REPEAT('ab', @max_allowed_packet);

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
DELETE FROM t1, t2
USING t1 INNER JOIN t2
WHERE t1.c11 = t2.c21 AND
      t2.c22 <=> REPEAT('ab', @max_allowed_packet);

DELETE IGNORE FROM t1, t2
USING t1 INNER JOIN t2
WHERE t1.c11 = t2.c21 AND
      t2.c22 <=> REPEAT('ab', @max_allowed_packet);

INSERT INTO t4
SELECT c31, CONCAT(c32,
                   REPEAT('a', @max_allowed_packet-1))
FROM t3;

SELECT c41, LENGTH(c42) FROM t4;

--error ER_WARN_ALLOWED_PACKET_OVERFLOWED
UPDATE t3
SET c32= CONCAT(c32,
                REPEAT('a', @max_allowed_packet-1));

SELECT c31, LENGTH(c32) FROM t3;

DELETE FROM t1;
DELETE FROM t2;
INSERT INTO t1 VALUES(100,'abcd');
INSERT INTO t2 VALUES(100,'xyz');

SET @@sql_mode= '';
SELECT @@sql_mode;

UPDATE t1
SET c12= REPEAT('ab', @max_allowed_packet);

SELECT c11, LENGTH(c12) FROM t1;

INSERT INTO t1
VALUES (101, REPEAT('ab', @max_allowed_packet));

SELECT c11, LENGTH(c12) FROM t1;

INSERT INTO t1
SELECT 102, REPEAT('ab', @max_allowed_packet);

SELECT c11, LENGTH(c12) FROM t1;

DELETE FROM t1
WHERE c12 <=> REPEAT('ab', @max_allowed_packet);

SELECT c11, LENGTH(c12) FROM t1;

SET @@sql_mode= default;
DROP TABLE t1, t2, t3, t4;

# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

Man Man