~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
--source include/have_ndb.inc
--source include/ndb_master-slave.inc

#
# basic test of blob replication for NDB
#

# easy test

--connection master
create table t1 (
  a int not null primary key,
  b text not null
) engine=ndb;

insert into t1 values(1, repeat('abc',10));
insert into t1 values(2, repeat('def',200));
insert into t1 values(3, repeat('ghi',3000));

select 'M', a, sha1(b) from t1
order by a;

--sync_slave_with_master
--sleep 5
--connection slave
select 'S', a, sha1(b) from t1
order by a;

--connection master
drop table t1;
--sync_slave_with_master

# hard test

--connection master
create table t1 (
  a int not null primary key,
  b text not null,
  c int,
  d longblob,
  e tinyblob
) engine=ndbcluster;

--disable_query_log
# length 61
set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau';
set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz';
set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah';
--enable_query_log

insert into t1 values (
  0, repeat(@s2,454), 100, repeat(@s2,345), NULL);
insert into t1 values (
  1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1));
insert into t1 values (
  2, '', 102, '', repeat(@s2,1));
insert into t1 values (
  3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1));
insert into t1 values (
  4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1));
insert into t1 values (
  5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1));
insert into t1 values (
  6, repeat(@s1,242), 106, NULL, repeat(@s1,1));
insert into t1 values (
  7, repeat(@s1,30), 107, repeat(@s0,161), '');
insert into t1 values (
  8, repeat(@s1,719), 108, repeat(@s2,104), NULL);
insert into t1 values (
  9, repeat(@s2,427), NULL, NULL, NULL);

select 'M', a, sha1(b), c, sha1(d), sha1(e)
from t1 order by a;

--sync_slave_with_master
--sleep 5
--connection slave
select 'S', a, sha1(b), c, sha1(d), sha1(e)
from t1 order by a;

--connection master
drop table t1;
--sync_slave_with_master

# table with varsize key (future cluster/schema)

# sql/ha_ndbcluster_binlog.cc
--connection master
CREATE TABLE IF NOT EXISTS t1 (
  db VARBINARY(63) NOT NULL,
  name VARBINARY(63) NOT NULL,
  slock BINARY(32) NOT NULL,
  query BLOB NOT NULL,
  node_id INT UNSIGNED NOT NULL,
  epoch BIGINT UNSIGNED NOT NULL,
  id INT UNSIGNED NOT NULL,
  version INT UNSIGNED NOT NULL,
  type INT UNSIGNED NOT NULL,
  PRIMARY KEY USING HASH (db,name))
ENGINE=NDB;

insert into t1 values ('test','t1',
  'abc',repeat(@s0,10),  11,12,13,14,15);
insert into t1 values ('test','t2',
  'def',repeat(@s1,100), 21,22,23,24,25);
insert into t1 values ('test','t3',
  'ghi',repeat(@s2,1000),31,32,33,34,35);
insert into t1 values ('testtttttttttt','t1',
  'abc',repeat(@s0,10),  11,12,13,14,15);
insert into t1 values ('testttttttttttt','t1',
  'def',repeat(@s1,100), 21,22,23,24,25);
insert into t1 values ('testtttttttttttt','t1',
  'ghi',repeat(@s2,1000),31,32,33,34,35);
insert into t1 values ('t','t11111111111',
  'abc',repeat(@s0,10),  11,12,13,14,15);
insert into t1 values ('t','t111111111111',
  'def',repeat(@s1,100), 21,22,23,24,25);
insert into t1 values ('t','t1111111111111',
  'ghi',repeat(@s2,1000),31,32,33,34,35);

select 'M', db, name, sha1(query), node_id, epoch, id, version, type
from t1 order by db, name;

--sync_slave_with_master
--sleep 5
--connection slave
select 'S', db, name, sha1(query), node_id, epoch, id, version, type
from t1 order by db, name;

--connection master
drop table t1;
--sync_slave_with_master

#
# view the binlog - not deterministic (mats)
#

#--connection master
#let $VERSION=`select version()`;
#--replace_result $VERSION VERSION
#show binlog events;
--source include/rpl_end.inc