~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/transaction_log/tests/r/transaction_log_schema.result

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Simple CREATE / DROP test
 
2
Testing simple CREATE SCHEMA 
 
3
CREATE SCHEMA my_test_schema;
 
4
# check transaction_log
 
5
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG;
 
6
FILE_NAME       FILE_LENGTH     NUM_LOG_ENTRIES NUM_TRANSACTIONS        MIN_TRANSACTION_ID      MAX_TRANSACTION_ID      MIN_END_TIMESTAMP       MAX_END_TIMESTAMP       INDEX_SIZE_IN_BYTES
 
7
transaction.log 121     1       1       1       1       START_TIMESTAMP END_TIMESTAMP   INDEX_SIZE
 
8
 
 
9
Check transaction_log_entries
 
10
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
 
11
ENTRY_OFFSET    ENTRY_TYPE      ENTRY_LENGTH
 
12
0       TRANSACTION     121
 
13
 
 
14
Check transaction_log_transactions
 
15
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
 
16
ENTRY_OFFSET    TRANSACTION_ID  SERVER_ID       START_TIMESTAMP END_TIMESTAMP   NUM_STATEMENTS  CHECKSUM
 
17
0       1       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
18
Check transaction log contents
 
19
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
 
20
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
 
21
transaction_context {
 
22
  server_id: 1
 
23
  transaction_id: 1
 
24
  START_TIMESTAMP
 
25
  END_TIMESTAMP
 
26
}
 
27
statement {
 
28
  type: CREATE_SCHEMA
 
29
  START_TIMESTAMP
 
30
  END_TIMESTAMP
 
31
  create_schema_statement {
 
32
    schema {
 
33
      name: "my_test_schema"
 
34
      collation: "utf8_general_ci"
 
35
      engine {
 
36
        name: "filesystem"
 
37
      }
 
38
      CREATE_TIMESTAMP
 
39
      UPDATE_TIMESTAMP
 
40
    }
 
41
  }
 
42
}
 
43
 
 
44
 
 
45
 
 
46
Testing simple DROP SCHEMA
 
47
DROP SCHEMA my_test_schema;
 
48
# check transaction_log
 
49
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG;
 
50
FILE_NAME       FILE_LENGTH     NUM_LOG_ENTRIES NUM_TRANSACTIONS        MIN_TRANSACTION_ID      MAX_TRANSACTION_ID      MIN_END_TIMESTAMP       MAX_END_TIMESTAMP       INDEX_SIZE_IN_BYTES
 
51
transaction.log 197     2       2       1       2       START_TIMESTAMP END_TIMESTAMP   INDEX_SIZE
 
52
 
 
53
Check transaction_log_entries
 
54
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
 
55
ENTRY_OFFSET    ENTRY_TYPE      ENTRY_LENGTH
 
56
0       TRANSACTION     121
 
57
121     TRANSACTION     76
 
58
 
 
59
Check transaction_log_transactions
 
60
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
 
61
ENTRY_OFFSET    TRANSACTION_ID  SERVER_ID       START_TIMESTAMP END_TIMESTAMP   NUM_STATEMENTS  CHECKSUM
 
62
0       1       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
63
121     2       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
64
Check transaction log contents
 
65
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
 
66
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
 
67
transaction_context {
 
68
  server_id: 1
 
69
  transaction_id: 2
 
70
  START_TIMESTAMP
 
71
  END_TIMESTAMP
 
72
}
 
73
statement {
 
74
  type: DROP_SCHEMA
 
75
  START_TIMESTAMP
 
76
  END_TIMESTAMP
 
77
  drop_schema_statement {
 
78
    schema_name: "my_test_schema"
 
79
  }
 
80
}
 
81
 
 
82
 
 
83
 
 
84
SET GLOBAL transaction_log_truncate_debug= true;
 
85
 
 
86
Testing DROP SCHEMA on non-empty schema
 
87
CREATE SCHEMA my_test_schema;
 
88
CREATE TABLE my_test_schema.t1 (a int not null, primary key(a));
 
89
CREATE TABLE my_test_schema.t2 LIKE my_test_schema.t1;
 
90
CREATE TABLE my_test_schema.t3 LIKE my_test_schema.t2;
 
91
We truncate the log to simplify test validation
 
92
we are mainly concerned that we see 4 new entries 
 
93
once we have issued the DROP SCHEMA statement
 
94
SET GLOBAL transaction_log_truncate_debug= true;
 
95
 
 
96
DROP SCHEMA my_test_schema;
 
97
The implied DROP TABLE statements for t1->t3
 
98
do not come in any deterministic order t1 may or may not be first
 
99
,therefore we have to satisfy ourselves that we have 4 items in the log
 
100
after issuing the DROP SCHEMA
 
101
We do check the first entry (OFFSET=0) as this should be the first of 3 DROP TABLE messages
 
102
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',0);
 
103
PRINT_TRANSACTION_MESSAGE('transaction.log',0)
 
104
transaction_context {
 
105
  server_id: 1
 
106
  transaction_id: 1
 
107
  START_TIMESTAMP
 
108
  END_TIMESTAMP
 
109
}
 
110
statement {
 
111
  type: DROP_TABLE
 
112
  START_TIMESTAMP
 
113
  END_TIMESTAMP
 
114
  drop_table_statement {
 
115
    table_metadata {
 
116
      schema_name: "my_test_schema"
 
117
      table_name:  TABLE_NAME
 
118
    }
 
119
    if_exists_clause: true
 
120
  }
 
121
}
 
122
 
 
123
# check transaction_log
 
124
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG;
 
125
FILE_NAME       FILE_LENGTH     NUM_LOG_ENTRIES NUM_TRANSACTIONS        MIN_TRANSACTION_ID      MAX_TRANSACTION_ID      MIN_END_TIMESTAMP       MAX_END_TIMESTAMP       INDEX_SIZE_IN_BYTES
 
126
transaction.log 331     4       4       1       4       START_TIMESTAMP END_TIMESTAMP   INDEX_SIZE
 
127
 
 
128
Check transaction_log_entries
 
129
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
 
130
ENTRY_OFFSET    ENTRY_TYPE      ENTRY_LENGTH
 
131
0       TRANSACTION     85
 
132
85      TRANSACTION     85
 
133
170     TRANSACTION     85
 
134
255     TRANSACTION     76
 
135
 
 
136
Check transaction_log_transactions
 
137
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
 
138
ENTRY_OFFSET    TRANSACTION_ID  SERVER_ID       START_TIMESTAMP END_TIMESTAMP   NUM_STATEMENTS  CHECKSUM
 
139
0       1       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
140
85      2       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
141
170     3       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
142
255     4       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
143
Check transaction log contents
 
144
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
 
145
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
 
146
transaction_context {
 
147
  server_id: 1
 
148
  transaction_id: 4
 
149
  START_TIMESTAMP
 
150
  END_TIMESTAMP
 
151
}
 
152
statement {
 
153
  type: DROP_SCHEMA
 
154
  START_TIMESTAMP
 
155
  END_TIMESTAMP
 
156
  drop_schema_statement {
 
157
    schema_name: "my_test_schema"
 
158
  }
 
159
}
 
160
 
 
161
 
 
162
 
 
163
SET GLOBAL transaction_log_truncate_debug= true;
 
164
 
 
165
Testing simple CREATE SCHEMA
 
166
CREATE SCHEMA my_test_schema;
 
167
USE my_test_schema;
 
168
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b CHAR(50), PRIMARY KEY(a));
 
169
ALTER SCHEMA my_test_schema COLLATE utf8_turkish_ci;
 
170
SHOW CREATE TABLE t1;
 
171
Table   Create Table
 
172
t1      CREATE TABLE `t1` (
 
173
  `a` INT NOT NULL AUTO_INCREMENT,
 
174
  `b` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
 
175
  PRIMARY KEY (`a`)
 
176
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
177
# check transaction_log
 
178
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG;
 
179
FILE_NAME       FILE_LENGTH     NUM_LOG_ENTRIES NUM_TRANSACTIONS        MIN_TRANSACTION_ID      MAX_TRANSACTION_ID      MIN_END_TIMESTAMP       MAX_END_TIMESTAMP       INDEX_SIZE_IN_BYTES
 
180
transaction.log 440     3       3       1       3       START_TIMESTAMP END_TIMESTAMP   INDEX_SIZE
 
181
 
 
182
Check transaction_log_entries
 
183
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
 
184
ENTRY_OFFSET    ENTRY_TYPE      ENTRY_LENGTH
 
185
0       TRANSACTION     121
 
186
121     TRANSACTION     208
 
187
329     TRANSACTION     111
 
188
 
 
189
Check transaction_log_transactions
 
190
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
 
191
ENTRY_OFFSET    TRANSACTION_ID  SERVER_ID       START_TIMESTAMP END_TIMESTAMP   NUM_STATEMENTS  CHECKSUM
 
192
0       1       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
193
121     2       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
194
329     3       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
195
Check transaction log contents
 
196
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
 
197
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
 
198
transaction_context {
 
199
  server_id: 1
 
200
  transaction_id: 3
 
201
  START_TIMESTAMP
 
202
  END_TIMESTAMP
 
203
}
 
204
statement {
 
205
  type: RAW_SQL
 
206
  START_TIMESTAMP
 
207
  END_TIMESTAMP
 
208
  sql: "ALTER SCHEMA my_test_schema COLLATE utf8_turkish_ci"
 
209
}
 
210
 
 
211
 
 
212
 
 
213
CREATE TABLE t2 LIKE t1;
 
214
# check transaction_log
 
215
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG;
 
216
FILE_NAME       FILE_LENGTH     NUM_LOG_ENTRIES NUM_TRANSACTIONS        MIN_TRANSACTION_ID      MAX_TRANSACTION_ID      MIN_END_TIMESTAMP       MAX_END_TIMESTAMP       INDEX_SIZE_IN_BYTES
 
217
transaction.log 650     4       4       1       4       START_TIMESTAMP END_TIMESTAMP   INDEX_SIZE
 
218
 
 
219
Check transaction_log_entries
 
220
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
 
221
ENTRY_OFFSET    ENTRY_TYPE      ENTRY_LENGTH
 
222
0       TRANSACTION     121
 
223
121     TRANSACTION     208
 
224
329     TRANSACTION     111
 
225
440     TRANSACTION     210
 
226
 
 
227
Check transaction_log_transactions
 
228
SELECT * FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
 
229
ENTRY_OFFSET    TRANSACTION_ID  SERVER_ID       START_TIMESTAMP END_TIMESTAMP   NUM_STATEMENTS  CHECKSUM
 
230
0       1       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
231
121     2       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
232
329     3       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
233
440     4       1       START_TIMESTAMP END_TIMESTAMP   1       0
 
234
Check transaction log contents
 
235
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
 
236
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
 
237
transaction_context {
 
238
  server_id: 1
 
239
  transaction_id: 4
 
240
  START_TIMESTAMP
 
241
  END_TIMESTAMP
 
242
}
 
243
statement {
 
244
  type: CREATE_TABLE
 
245
  START_TIMESTAMP
 
246
  END_TIMESTAMP
 
247
  create_table_statement {
 
248
    table {
 
249
      name: "t2"
 
250
      engine {
 
251
        name: "InnoDB"
 
252
      }
 
253
      field {
 
254
        name: "a"
 
255
        type: INTEGER
 
256
        constraints {
 
257
          is_nullable: false
 
258
        }
 
259
        numeric_options {
 
260
          is_autoincrement: true
 
261
        }
 
262
      }
 
263
      field {
 
264
        name: "b"
 
265
        type: VARCHAR
 
266
        options {
 
267
          default_null: true
 
268
        }
 
269
        string_options {
 
270
          length: 50
 
271
          collation_id: 45
 
272
          collation: "utf8_general_ci"
 
273
        }
 
274
      }
 
275
      indexes {
 
276
        name: "PRIMARY"
 
277
        is_primary: true
 
278
        is_unique: true
 
279
        type: UNKNOWN_INDEX
 
280
        key_length: 4
 
281
        index_part {
 
282
          fieldnr: 0
 
283
          compare_length: 4
 
284
        }
 
285
        options {
 
286
        }
 
287
      }
 
288
      type: STANDARD
 
289
      schema: "my_test_schema"
 
290
      options {
 
291
        has_user_set_auto_increment_value: false
 
292
        collation: "utf8_general_ci"
 
293
        collation_id: 45
 
294
      }
 
295
      CREATE_TIMESTAMP
 
296
      UPDATE_TIMESTAMP
 
297
      catalog: ""
 
298
    }
 
299
  }
 
300
}
 
301
 
 
302
 
 
303
 
 
304
DROP SCHEMA my_test_schema;
 
305
SET GLOBAL transaction_log_truncate_debug= true;
 
306