| 1 |
INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; |
| 2 |
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB); |
| 3 |
CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) |
| 4 |
PARTITION BY KEY(col1) PARTITIONS 5; |
| 5 |
CREATE PROCEDURE execute_dml( |
| 6 |
p_dml_type INT, |
| 7 |
p_key_min INT, |
| 8 |
p_key_range INT, |
| 9 |
p_loop_count INT, |
| 10 |
p_frequency INT, |
| 11 |
p_is_rand INT) |
| 12 |
BEGIN |
| 13 |
DECLARE v_idx INT DEFAULT 0; |
| 14 |
DECLARE v_commit INT DEFAULT 0; |
| 15 |
DECLARE v_key INT DEFAULT 0; |
| 16 |
/* Loop and INSERT data at random position */ |
| 17 |
WHILE(v_idx < p_loop_count) DO |
| 18 |
/* Generate key between 1 to p_loop_count */ |
| 19 |
IF p_is_rand = 1 THEN |
| 20 |
SET v_key = p_key_min + FLOOR(RAND() * p_key_range); |
| 21 |
ELSE |
| 22 |
SET v_key = p_key_min + (v_idx % p_key_range); |
| 23 |
END IF; |
| 24 |
CASE p_dml_type |
| 25 |
WHEN 0 THEN |
| 26 |
SET @clol3_text = CONCAT('Clone Test Row - ', v_key); |
| 27 |
INSERT INTO t1 (col1, col2, col3, col4) VALUES ( |
| 28 |
v_key, v_key * 10, |
| 29 |
@clol3_text, REPEAT('Large Column Data ', 2048)) |
| 30 |
ON DUPLICATE KEY UPDATE col2 = col2 + 1; |
| 31 |
INSERT INTO t2 (col1, col2, col3, col4) VALUES ( |
| 32 |
v_key, v_key * 10, |
| 33 |
@clol3_text, REPEAT('Large Column Data ', 2048)) |
| 34 |
ON DUPLICATE KEY UPDATE col2 = col2 + 1; |
| 35 |
WHEN 1 THEN |
| 36 |
UPDATE t1 SET col2 = v_idx + 1 WHERE col1 = v_key; |
| 37 |
UPDATE t2 SET col2 = v_idx + 1 WHERE col1 = v_key; |
| 38 |
WHEN 2 THEN |
| 39 |
DELETE FROM t1 WHERE col1 = v_key; |
| 40 |
DELETE FROM t2 WHERE col1 = v_key; |
| 41 |
ELSE |
| 42 |
DELETE FROM t1; |
| 43 |
DELETE FROM t2; |
| 44 |
END CASE; |
| 45 |
SET v_idx = v_idx + 1; |
| 46 |
/* Commit or rollback work at specified frequency. */ |
| 47 |
IF v_idx % p_frequency = 0 THEN |
| 48 |
SET v_commit = FLOOR(RAND() * 2); |
| 49 |
IF v_commit = 0 AND p_is_rand = 1 THEN |
| 50 |
ROLLBACK; |
| 51 |
START TRANSACTION; |
| 52 |
ELSE |
| 53 |
COMMIT; |
| 54 |
START TRANSACTION; |
| 55 |
END IF; |
| 56 |
END IF; |
| 57 |
END WHILE; |
| 58 |
COMMIT; |
| 59 |
END| |
| 60 |
call execute_dml(0, 0, 1, 2, 1, 0); |
| 61 |
select count(*) from t1; |
| 62 |
count(*) |
| 63 |
1 |
| 64 |
select count(*) from t2; |
| 65 |
count(*) |
| 66 |
1 |
| 67 |
INSTALL COMPONENT 'file://component_test_server_telemetry_traces'; |
| 68 |
# In connection default - Cloning database |
| 69 |
SET GLOBAL clone_autotune_concurrency = OFF; |
| 70 |
SET GLOBAL clone_max_concurrency = 8; |
| 71 |
CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR'; |
| 72 |
UNINSTALL COMPONENT 'file://component_test_server_telemetry_traces'; |
| 73 |
DROP TABLE t1; |
| 74 |
DROP TABLE t2; |
| 75 |
DROP PROCEDURE execute_dml; |
| 76 |
UNINSTALL PLUGIN clone; |
| 77 |
Component logs: |
| 78 |
test_server_telemetry_traces_component_init init: |
| 79 |
- System variables registered. |
| 80 |
- Status variables registered. |
| 81 |
- Telemetry per-session data slot registered. |
| 82 |
- Telemetry session callbacks registered. |
| 83 |
- Telemetry statement callbacks registered. |
| 84 |
End of init |
| 85 |
tm_session_create: telemetry session started, increase refcount by user=root to 1 |
| 86 |
> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='') |
| 87 |
> tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET GLOBAL clone_autotune_concurrency = OFF') |
| 88 |
> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='') |
| 89 |
> tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET GLOBAL clone_max_concurrency = 8') |
| 90 |
> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='') |
| 91 |
> tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CLONE LOCAL DATA DIRECTORY = CLONE_DATADIR') |
| 92 |
> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='') |
| 93 |
> tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='UNINSTALL COMPONENT 'file://component_test_server_telemetry_traces'') |
| 94 |
test_server_telemetry_traces_component_deinit: |
| 95 |
- Telemetry statement callbacks unregistered. |
| 96 |
tm_session_destroy: telemetry session ended, decrease refcount to 0 |
| 97 |
- Current session aborted. |
| 98 |
- Done waiting for telemetry sessions to finish (refcount = 0). |
| 99 |
- Telemetry session callbacks unregistered. |
| 100 |
- Telemetry per-session data slot unregistered. |
| 101 |
- Status variables unregistered. |
| 102 |
- System variables unregistered. |
| 103 |
End of deinit |