~drizzle-developers/drizzle/drizzle-7.1-packaging

« back to all changes in this revision

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

  • Committer: Henrik Ingo
  • Date: 2012-03-10 20:39:59 UTC
  • mfrom: (2483.20.13 workspace)
  • Revision ID: henrik.ingo@avoinelama.fi-20120310203959-60hq9fe2jkrv9ili
Merge latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Testing simple CREATE
2
 
DROP TABLE IF EXISTS t1;
3
 
CREATE TABLE t1(a INT NOT NULL, PRIMARY KEY(a));
4
 
Check transaction_log_entries
5
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
6
 
COUNT(*)
7
 
1
8
 
 
9
 
Check transaction_log_transactions
10
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
11
 
COUNT(*)
12
 
1
13
 
Check transaction log contents
14
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
15
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
16
 
transaction_context {
17
 
  server_id: 1
18
 
  TRANSACTION_ID
19
 
  START_TIMESTAMP
20
 
  END_TIMESTAMP
21
 
}
22
 
statement {
23
 
  type: CREATE_TABLE
24
 
  START_TIMESTAMP
25
 
  END_TIMESTAMP
26
 
  create_table_statement {
27
 
    table {
28
 
      name: "t1"
29
 
      engine {
30
 
        name: "InnoDB"
31
 
      }
32
 
      field {
33
 
        name: "a"
34
 
        type: INTEGER
35
 
        constraints {
36
 
          is_notnull: true
37
 
        }
38
 
      }
39
 
      indexes {
40
 
        name: "PRIMARY"
41
 
        is_primary: true
42
 
        is_unique: true
43
 
        type: BTREE
44
 
        key_length: 4
45
 
        index_part {
46
 
          fieldnr: 0
47
 
          compare_length: 4
48
 
        }
49
 
        options {
50
 
        }
51
 
      }
52
 
      type: STANDARD
53
 
      schema: "test"
54
 
      options {
55
 
        has_user_set_auto_increment_value: false
56
 
        collation: "utf8_general_ci"
57
 
        collation_id: 45
58
 
      }
59
 
      CREATE_TIMESTAMP
60
 
      UPDATE_TIMESTAMP
61
 
      catalog: "LOCAL"
62
 
      UUID
63
 
      version: 1
64
 
    }
65
 
  }
66
 
}
67
 
segment_id: 1
68
 
end_segment: true
69
 
 
70
 
 
71
 
COMMIT;
72
 
 
73
 
DROP TABLE t1;
74
 
SET GLOBAL transaction_log_truncate_debug= true;
75
 
 
76
 
Testing multi-column CREATE
77
 
DROP TABLE IF EXISTS t1;
78
 
CREATE TABLE t1(a INT NOT NULL, b CHAR, c BLOB, d TEXT, e DATE NOT NULL, f BLOB NOT NULL, PRIMARY KEY(a));
79
 
Check transaction_log_entries
80
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
81
 
COUNT(*)
82
 
1
83
 
 
84
 
Check transaction_log_transactions
85
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
86
 
COUNT(*)
87
 
1
88
 
Check transaction log contents
89
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
90
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
91
 
transaction_context {
92
 
  server_id: 1
93
 
  TRANSACTION_ID
94
 
  START_TIMESTAMP
95
 
  END_TIMESTAMP
96
 
}
97
 
statement {
98
 
  type: CREATE_TABLE
99
 
  START_TIMESTAMP
100
 
  END_TIMESTAMP
101
 
  create_table_statement {
102
 
    table {
103
 
      name: "t1"
104
 
      engine {
105
 
        name: "InnoDB"
106
 
      }
107
 
      field {
108
 
        name: "a"
109
 
        type: INTEGER
110
 
        constraints {
111
 
          is_notnull: true
112
 
        }
113
 
      }
114
 
      field {
115
 
        name: "b"
116
 
        type: VARCHAR
117
 
        options {
118
 
          default_null: true
119
 
        }
120
 
        string_options {
121
 
          length: 1
122
 
          collation_id: 45
123
 
          collation: "utf8_general_ci"
124
 
        }
125
 
      }
126
 
      field {
127
 
        name: "c"
128
 
        type: BLOB
129
 
        options {
130
 
          default_null: true
131
 
        }
132
 
        string_options {
133
 
          collation_id: 63
134
 
          collation: "binary"
135
 
        }
136
 
      }
137
 
      field {
138
 
        name: "d"
139
 
        type: BLOB
140
 
        options {
141
 
          default_null: true
142
 
        }
143
 
        string_options {
144
 
          collation_id: 45
145
 
          collation: "utf8_general_ci"
146
 
        }
147
 
      }
148
 
      field {
149
 
        name: "e"
150
 
        type: DATE
151
 
        constraints {
152
 
          is_notnull: true
153
 
        }
154
 
      }
155
 
      field {
156
 
        name: "f"
157
 
        type: BLOB
158
 
        constraints {
159
 
          is_notnull: true
160
 
        }
161
 
        string_options {
162
 
          collation_id: 63
163
 
          collation: "binary"
164
 
        }
165
 
      }
166
 
      indexes {
167
 
        name: "PRIMARY"
168
 
        is_primary: true
169
 
        is_unique: true
170
 
        type: BTREE
171
 
        key_length: 4
172
 
        index_part {
173
 
          fieldnr: 0
174
 
          compare_length: 4
175
 
        }
176
 
        options {
177
 
        }
178
 
      }
179
 
      type: STANDARD
180
 
      schema: "test"
181
 
      options {
182
 
        has_user_set_auto_increment_value: false
183
 
        collation: "utf8_general_ci"
184
 
        collation_id: 45
185
 
      }
186
 
      CREATE_TIMESTAMP
187
 
      UPDATE_TIMESTAMP
188
 
      catalog: "LOCAL"
189
 
      UUID
190
 
      version: 1
191
 
    }
192
 
  }
193
 
}
194
 
segment_id: 1
195
 
end_segment: true
196
 
 
197
 
 
198
 
COMMIT;
199
 
 
200
 
DROP TABLE t1;
201
 
SET GLOBAL transaction_log_truncate_debug= true;
202
 
 
203
 
Testing CREATE with DEFAULT VALUES
204
 
DROP TABLE IF EXISTS t1;
205
 
CREATE TABLE t1(a INT NOT NULL, b CHAR(25) NOT NULL DEFAULT 'this_is_a_default_value', PRIMARY KEY(a));
206
 
Check transaction_log_entries
207
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
208
 
COUNT(*)
209
 
1
210
 
 
211
 
Check transaction_log_transactions
212
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
213
 
COUNT(*)
214
 
1
215
 
Check transaction log contents
216
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
217
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
218
 
transaction_context {
219
 
  server_id: 1
220
 
  TRANSACTION_ID
221
 
  START_TIMESTAMP
222
 
  END_TIMESTAMP
223
 
}
224
 
statement {
225
 
  type: CREATE_TABLE
226
 
  START_TIMESTAMP
227
 
  END_TIMESTAMP
228
 
  create_table_statement {
229
 
    table {
230
 
      name: "t1"
231
 
      engine {
232
 
        name: "InnoDB"
233
 
      }
234
 
      field {
235
 
        name: "a"
236
 
        type: INTEGER
237
 
        constraints {
238
 
          is_notnull: true
239
 
        }
240
 
      }
241
 
      field {
242
 
        name: "b"
243
 
        type: VARCHAR
244
 
        options {
245
 
          default_value: "this_is_a_default_value"
246
 
        }
247
 
        constraints {
248
 
          is_notnull: true
249
 
        }
250
 
        string_options {
251
 
          length: 25
252
 
          collation_id: 45
253
 
          collation: "utf8_general_ci"
254
 
        }
255
 
      }
256
 
      indexes {
257
 
        name: "PRIMARY"
258
 
        is_primary: true
259
 
        is_unique: true
260
 
        type: BTREE
261
 
        key_length: 4
262
 
        index_part {
263
 
          fieldnr: 0
264
 
          compare_length: 4
265
 
        }
266
 
        options {
267
 
        }
268
 
      }
269
 
      type: STANDARD
270
 
      schema: "test"
271
 
      options {
272
 
        has_user_set_auto_increment_value: false
273
 
        collation: "utf8_general_ci"
274
 
        collation_id: 45
275
 
      }
276
 
      CREATE_TIMESTAMP
277
 
      UPDATE_TIMESTAMP
278
 
      catalog: "LOCAL"
279
 
      UUID
280
 
      version: 1
281
 
    }
282
 
  }
283
 
}
284
 
segment_id: 1
285
 
end_segment: true
286
 
 
287
 
 
288
 
COMMIT;
289
 
 
290
 
DROP TABLE t1;
291
 
SET GLOBAL transaction_log_truncate_debug= true;
292
 
 
293
 
Testing CREATE with multi-part key 
294
 
DROP TABLE IF EXISTS t1;
295
 
CREATE TABLE t1(a INT NOT NULL, b CHAR(25) NOT NULL DEFAULT 'this_is_a_default_value', c DATE, d TIMESTAMP, PRIMARY KEY(a,b,d));
296
 
Check transaction_log_entries
297
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
298
 
COUNT(*)
299
 
1
300
 
 
301
 
Check transaction_log_transactions
302
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
303
 
COUNT(*)
304
 
1
305
 
Check transaction log contents
306
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
307
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
308
 
transaction_context {
309
 
  server_id: 1
310
 
  TRANSACTION_ID
311
 
  START_TIMESTAMP
312
 
  END_TIMESTAMP
313
 
}
314
 
statement {
315
 
  type: CREATE_TABLE
316
 
  START_TIMESTAMP
317
 
  END_TIMESTAMP
318
 
  create_table_statement {
319
 
    table {
320
 
      name: "t1"
321
 
      engine {
322
 
        name: "InnoDB"
323
 
      }
324
 
      field {
325
 
        name: "a"
326
 
        type: INTEGER
327
 
        constraints {
328
 
          is_notnull: true
329
 
        }
330
 
      }
331
 
      field {
332
 
        name: "b"
333
 
        type: VARCHAR
334
 
        options {
335
 
          default_value: "this_is_a_default_value"
336
 
        }
337
 
        constraints {
338
 
          is_notnull: true
339
 
        }
340
 
        string_options {
341
 
          length: 25
342
 
          collation_id: 45
343
 
          collation: "utf8_general_ci"
344
 
        }
345
 
      }
346
 
      field {
347
 
        name: "c"
348
 
        type: DATE
349
 
        options {
350
 
          default_null: true
351
 
        }
352
 
      }
353
 
      field {
354
 
        name: "d"
355
 
        type: EPOCH
356
 
        constraints {
357
 
          is_notnull: true
358
 
        }
359
 
      }
360
 
      indexes {
361
 
        name: "PRIMARY"
362
 
        is_primary: true
363
 
        is_unique: true
364
 
        type: BTREE
365
 
        key_length: 112
366
 
        index_part {
367
 
          fieldnr: 0
368
 
          compare_length: 4
369
 
        }
370
 
        index_part {
371
 
          fieldnr: 1
372
 
          compare_length: 25
373
 
        }
374
 
        index_part {
375
 
          fieldnr: 3
376
 
          compare_length: 8
377
 
        }
378
 
        options {
379
 
          binary_pack_key: true
380
 
          var_length_key: true
381
 
        }
382
 
      }
383
 
      type: STANDARD
384
 
      schema: "test"
385
 
      options {
386
 
        has_user_set_auto_increment_value: false
387
 
        collation: "utf8_general_ci"
388
 
        collation_id: 45
389
 
      }
390
 
      CREATE_TIMESTAMP
391
 
      UPDATE_TIMESTAMP
392
 
      catalog: "LOCAL"
393
 
      UUID
394
 
      version: 1
395
 
    }
396
 
  }
397
 
}
398
 
segment_id: 1
399
 
end_segment: true
400
 
 
401
 
 
402
 
COMMIT;
403
 
 
404
 
DROP TABLE t1;
405
 
SET GLOBAL transaction_log_truncate_debug= true;
406
 
 
407
 
Testing CREATE with partial key
408
 
DROP TABLE IF EXISTS t1;
409
 
CREATE TABLE t1(a INT NOT NULL, b CHAR(25) NOT NULL DEFAULT 'this_is_a_default_value', c DATE, d TIMESTAMP, PRIMARY KEY(b(5)));
410
 
Check transaction_log_entries
411
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
412
 
COUNT(*)
413
 
1
414
 
 
415
 
Check transaction_log_transactions
416
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
417
 
COUNT(*)
418
 
1
419
 
Check transaction log contents
420
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
421
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
422
 
transaction_context {
423
 
  server_id: 1
424
 
  TRANSACTION_ID
425
 
  START_TIMESTAMP
426
 
  END_TIMESTAMP
427
 
}
428
 
statement {
429
 
  type: CREATE_TABLE
430
 
  START_TIMESTAMP
431
 
  END_TIMESTAMP
432
 
  create_table_statement {
433
 
    table {
434
 
      name: "t1"
435
 
      engine {
436
 
        name: "InnoDB"
437
 
      }
438
 
      field {
439
 
        name: "a"
440
 
        type: INTEGER
441
 
        constraints {
442
 
          is_notnull: true
443
 
        }
444
 
      }
445
 
      field {
446
 
        name: "b"
447
 
        type: VARCHAR
448
 
        options {
449
 
          default_value: "this_is_a_default_value"
450
 
        }
451
 
        constraints {
452
 
          is_notnull: true
453
 
        }
454
 
        string_options {
455
 
          length: 25
456
 
          collation_id: 45
457
 
          collation: "utf8_general_ci"
458
 
        }
459
 
      }
460
 
      field {
461
 
        name: "c"
462
 
        type: DATE
463
 
        options {
464
 
          default_null: true
465
 
        }
466
 
      }
467
 
      field {
468
 
        name: "d"
469
 
        type: EPOCH
470
 
        options {
471
 
          default_null: true
472
 
        }
473
 
      }
474
 
      indexes {
475
 
        name: "PRIMARY"
476
 
        is_primary: true
477
 
        is_unique: true
478
 
        type: BTREE
479
 
        key_length: 20
480
 
        index_part {
481
 
          fieldnr: 1
482
 
          compare_length: 5
483
 
        }
484
 
        options {
485
 
          binary_pack_key: true
486
 
          var_length_key: true
487
 
          has_partial_segments: true
488
 
        }
489
 
      }
490
 
      type: STANDARD
491
 
      schema: "test"
492
 
      options {
493
 
        has_user_set_auto_increment_value: false
494
 
        collation: "utf8_general_ci"
495
 
        collation_id: 45
496
 
      }
497
 
      CREATE_TIMESTAMP
498
 
      UPDATE_TIMESTAMP
499
 
      catalog: "LOCAL"
500
 
      UUID
501
 
      version: 1
502
 
    }
503
 
  }
504
 
}
505
 
segment_id: 1
506
 
end_segment: true
507
 
 
508
 
 
509
 
COMMIT;
510
 
 
511
 
DROP TABLE t1;
512
 
SET GLOBAL transaction_log_truncate_debug= true;
513
 
 
514
 
Testing CREATE with multiple keys
515
 
DROP TABLE IF EXISTS t1;
516
 
CREATE TABLE t1(a INT NOT NULL, b CHAR(25) NOT NULL DEFAULT 'this_is_a_default_value', c DATE, d TIMESTAMP, PRIMARY KEY(b(5)), KEY composite_key(a,b(10),c));
517
 
Check transaction_log_entries
518
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
519
 
COUNT(*)
520
 
1
521
 
 
522
 
Check transaction_log_transactions
523
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
524
 
COUNT(*)
525
 
1
526
 
Check transaction log contents
527
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
528
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
529
 
transaction_context {
530
 
  server_id: 1
531
 
  TRANSACTION_ID
532
 
  START_TIMESTAMP
533
 
  END_TIMESTAMP
534
 
}
535
 
statement {
536
 
  type: CREATE_TABLE
537
 
  START_TIMESTAMP
538
 
  END_TIMESTAMP
539
 
  create_table_statement {
540
 
    table {
541
 
      name: "t1"
542
 
      engine {
543
 
        name: "InnoDB"
544
 
      }
545
 
      field {
546
 
        name: "a"
547
 
        type: INTEGER
548
 
        constraints {
549
 
          is_notnull: true
550
 
        }
551
 
      }
552
 
      field {
553
 
        name: "b"
554
 
        type: VARCHAR
555
 
        options {
556
 
          default_value: "this_is_a_default_value"
557
 
        }
558
 
        constraints {
559
 
          is_notnull: true
560
 
        }
561
 
        string_options {
562
 
          length: 25
563
 
          collation_id: 45
564
 
          collation: "utf8_general_ci"
565
 
        }
566
 
      }
567
 
      field {
568
 
        name: "c"
569
 
        type: DATE
570
 
        options {
571
 
          default_null: true
572
 
        }
573
 
      }
574
 
      field {
575
 
        name: "d"
576
 
        type: EPOCH
577
 
        options {
578
 
          default_null: true
579
 
        }
580
 
      }
581
 
      indexes {
582
 
        name: "PRIMARY"
583
 
        is_primary: true
584
 
        is_unique: true
585
 
        type: BTREE
586
 
        key_length: 20
587
 
        index_part {
588
 
          fieldnr: 1
589
 
          compare_length: 5
590
 
        }
591
 
        options {
592
 
          binary_pack_key: true
593
 
          var_length_key: true
594
 
          has_partial_segments: true
595
 
        }
596
 
      }
597
 
      indexes {
598
 
        name: "composite_key"
599
 
        is_primary: false
600
 
        is_unique: false
601
 
        type: BTREE
602
 
        key_length: 48
603
 
        index_part {
604
 
          fieldnr: 0
605
 
          compare_length: 4
606
 
        }
607
 
        index_part {
608
 
          fieldnr: 1
609
 
          compare_length: 10
610
 
        }
611
 
        index_part {
612
 
          fieldnr: 2
613
 
          compare_length: 4
614
 
        }
615
 
        options {
616
 
          binary_pack_key: true
617
 
          var_length_key: true
618
 
          null_part_key: true
619
 
          has_partial_segments: true
620
 
        }
621
 
      }
622
 
      type: STANDARD
623
 
      schema: "test"
624
 
      options {
625
 
        has_user_set_auto_increment_value: false
626
 
        collation: "utf8_general_ci"
627
 
        collation_id: 45
628
 
      }
629
 
      CREATE_TIMESTAMP
630
 
      UPDATE_TIMESTAMP
631
 
      catalog: "LOCAL"
632
 
      UUID
633
 
      version: 1
634
 
    }
635
 
  }
636
 
}
637
 
segment_id: 1
638
 
end_segment: true
639
 
 
640
 
 
641
 
COMMIT;
642
 
 
643
 
DROP TABLE t1;
644
 
SET GLOBAL transaction_log_truncate_debug= true;
645
 
 
646
 
Testing CREATE with UNIQUE key
647
 
DROP TABLE IF EXISTS t1;
648
 
CREATE TABLE t1(a INT NOT NULL, b CHAR(25) NOT NULL DEFAULT 'this_is_a_default_value', c DATE, d TIMESTAMP, PRIMARY KEY(a), UNIQUE KEY unique_key(a,b(20),c));
649
 
Check transaction_log_entries
650
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
651
 
COUNT(*)
652
 
1
653
 
 
654
 
Check transaction_log_transactions
655
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
656
 
COUNT(*)
657
 
1
658
 
Check transaction log contents
659
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
660
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
661
 
transaction_context {
662
 
  server_id: 1
663
 
  TRANSACTION_ID
664
 
  START_TIMESTAMP
665
 
  END_TIMESTAMP
666
 
}
667
 
statement {
668
 
  type: CREATE_TABLE
669
 
  START_TIMESTAMP
670
 
  END_TIMESTAMP
671
 
  create_table_statement {
672
 
    table {
673
 
      name: "t1"
674
 
      engine {
675
 
        name: "InnoDB"
676
 
      }
677
 
      field {
678
 
        name: "a"
679
 
        type: INTEGER
680
 
        constraints {
681
 
          is_notnull: true
682
 
        }
683
 
      }
684
 
      field {
685
 
        name: "b"
686
 
        type: VARCHAR
687
 
        options {
688
 
          default_value: "this_is_a_default_value"
689
 
        }
690
 
        constraints {
691
 
          is_notnull: true
692
 
        }
693
 
        string_options {
694
 
          length: 25
695
 
          collation_id: 45
696
 
          collation: "utf8_general_ci"
697
 
        }
698
 
      }
699
 
      field {
700
 
        name: "c"
701
 
        type: DATE
702
 
        options {
703
 
          default_null: true
704
 
        }
705
 
      }
706
 
      field {
707
 
        name: "d"
708
 
        type: EPOCH
709
 
        options {
710
 
          default_null: true
711
 
        }
712
 
      }
713
 
      indexes {
714
 
        name: "PRIMARY"
715
 
        is_primary: true
716
 
        is_unique: true
717
 
        type: BTREE
718
 
        key_length: 4
719
 
        index_part {
720
 
          fieldnr: 0
721
 
          compare_length: 4
722
 
        }
723
 
        options {
724
 
        }
725
 
      }
726
 
      indexes {
727
 
        name: "unique_key"
728
 
        is_primary: false
729
 
        is_unique: true
730
 
        type: BTREE
731
 
        key_length: 88
732
 
        index_part {
733
 
          fieldnr: 0
734
 
          compare_length: 4
735
 
        }
736
 
        index_part {
737
 
          fieldnr: 1
738
 
          compare_length: 20
739
 
        }
740
 
        index_part {
741
 
          fieldnr: 2
742
 
          compare_length: 4
743
 
        }
744
 
        options {
745
 
          binary_pack_key: true
746
 
          var_length_key: true
747
 
          null_part_key: true
748
 
          has_partial_segments: true
749
 
        }
750
 
      }
751
 
      type: STANDARD
752
 
      schema: "test"
753
 
      options {
754
 
        has_user_set_auto_increment_value: false
755
 
        collation: "utf8_general_ci"
756
 
        collation_id: 45
757
 
      }
758
 
      CREATE_TIMESTAMP
759
 
      UPDATE_TIMESTAMP
760
 
      catalog: "LOCAL"
761
 
      UUID
762
 
      version: 1
763
 
    }
764
 
  }
765
 
}
766
 
segment_id: 1
767
 
end_segment: true
768
 
 
769
 
 
770
 
COMMIT;
771
 
 
772
 
DROP TABLE t1;
773
 
SET GLOBAL transaction_log_truncate_debug= true;
774
 
 
775
 
Testing CREATE IF NOT EXISTS 
776
 
DROP TABLE IF EXISTS t1;
777
 
positive test (should pass)
778
 
CREATE TABLE IF NOT EXISTS t1(a INT NOT NULL, PRIMARY KEY(a));
779
 
Check transaction_log_entries
780
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
781
 
COUNT(*)
782
 
1
783
 
 
784
 
Check transaction_log_transactions
785
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
786
 
COUNT(*)
787
 
1
788
 
Check transaction log contents
789
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
790
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
791
 
transaction_context {
792
 
  server_id: 1
793
 
  TRANSACTION_ID
794
 
  START_TIMESTAMP
795
 
  END_TIMESTAMP
796
 
}
797
 
statement {
798
 
  type: CREATE_TABLE
799
 
  START_TIMESTAMP
800
 
  END_TIMESTAMP
801
 
  create_table_statement {
802
 
    table {
803
 
      name: "t1"
804
 
      engine {
805
 
        name: "InnoDB"
806
 
      }
807
 
      field {
808
 
        name: "a"
809
 
        type: INTEGER
810
 
        constraints {
811
 
          is_notnull: true
812
 
        }
813
 
      }
814
 
      indexes {
815
 
        name: "PRIMARY"
816
 
        is_primary: true
817
 
        is_unique: true
818
 
        type: BTREE
819
 
        key_length: 4
820
 
        index_part {
821
 
          fieldnr: 0
822
 
          compare_length: 4
823
 
        }
824
 
        options {
825
 
        }
826
 
      }
827
 
      type: STANDARD
828
 
      schema: "test"
829
 
      options {
830
 
        has_user_set_auto_increment_value: false
831
 
        collation: "utf8_general_ci"
832
 
        collation_id: 45
833
 
      }
834
 
      CREATE_TIMESTAMP
835
 
      UPDATE_TIMESTAMP
836
 
      catalog: "LOCAL"
837
 
      UUID
838
 
      version: 1
839
 
    }
840
 
  }
841
 
}
842
 
segment_id: 1
843
 
end_segment: true
844
 
 
845
 
 
846
 
COMMIT;
847
 
 
848
 
negative test (should not be created / logged)
849
 
CREATE TABLE IF NOT EXISTS t1(b CHAR(100) NOT NULL, PRIMARY KEY(b));
850
 
Warnings:
851
 
Note    1050    Table 't1' already exists
852
 
Check transaction_log_entries
853
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
854
 
COUNT(*)
855
 
1
856
 
 
857
 
Check transaction_log_transactions
858
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
859
 
COUNT(*)
860
 
1
861
 
Check transaction log contents
862
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
863
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
864
 
transaction_context {
865
 
  server_id: 1
866
 
  TRANSACTION_ID
867
 
  START_TIMESTAMP
868
 
  END_TIMESTAMP
869
 
}
870
 
statement {
871
 
  type: CREATE_TABLE
872
 
  START_TIMESTAMP
873
 
  END_TIMESTAMP
874
 
  create_table_statement {
875
 
    table {
876
 
      name: "t1"
877
 
      engine {
878
 
        name: "InnoDB"
879
 
      }
880
 
      field {
881
 
        name: "a"
882
 
        type: INTEGER
883
 
        constraints {
884
 
          is_notnull: true
885
 
        }
886
 
      }
887
 
      indexes {
888
 
        name: "PRIMARY"
889
 
        is_primary: true
890
 
        is_unique: true
891
 
        type: BTREE
892
 
        key_length: 4
893
 
        index_part {
894
 
          fieldnr: 0
895
 
          compare_length: 4
896
 
        }
897
 
        options {
898
 
        }
899
 
      }
900
 
      type: STANDARD
901
 
      schema: "test"
902
 
      options {
903
 
        has_user_set_auto_increment_value: false
904
 
        collation: "utf8_general_ci"
905
 
        collation_id: 45
906
 
      }
907
 
      CREATE_TIMESTAMP
908
 
      UPDATE_TIMESTAMP
909
 
      catalog: "LOCAL"
910
 
      UUID
911
 
      version: 1
912
 
    }
913
 
  }
914
 
}
915
 
segment_id: 1
916
 
end_segment: true
917
 
 
918
 
 
919
 
COMMIT;
920
 
 
921
 
DROP TABLE t1;
922
 
SET GLOBAL transaction_log_truncate_debug= true;
923
 
 
924
 
Testing Foreign Key constraints 
925
 
DROP TABLE IF EXISTS t1, t2;
926
 
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, PRIMARY KEY(a), KEY b_key1 (b));
927
 
Check transaction_log_entries
928
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
929
 
COUNT(*)
930
 
1
931
 
 
932
 
Check transaction_log_transactions
933
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
934
 
COUNT(*)
935
 
1
936
 
Check transaction log contents
937
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
938
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
939
 
transaction_context {
940
 
  server_id: 1
941
 
  TRANSACTION_ID
942
 
  START_TIMESTAMP
943
 
  END_TIMESTAMP
944
 
}
945
 
statement {
946
 
  type: CREATE_TABLE
947
 
  START_TIMESTAMP
948
 
  END_TIMESTAMP
949
 
  create_table_statement {
950
 
    table {
951
 
      name: "t1"
952
 
      engine {
953
 
        name: "InnoDB"
954
 
      }
955
 
      field {
956
 
        name: "a"
957
 
        type: INTEGER
958
 
        constraints {
959
 
          is_notnull: true
960
 
        }
961
 
      }
962
 
      field {
963
 
        name: "b"
964
 
        type: INTEGER
965
 
        constraints {
966
 
          is_notnull: true
967
 
        }
968
 
      }
969
 
      indexes {
970
 
        name: "PRIMARY"
971
 
        is_primary: true
972
 
        is_unique: true
973
 
        type: BTREE
974
 
        key_length: 4
975
 
        index_part {
976
 
          fieldnr: 0
977
 
          compare_length: 4
978
 
        }
979
 
        options {
980
 
        }
981
 
      }
982
 
      indexes {
983
 
        name: "b_key1"
984
 
        is_primary: false
985
 
        is_unique: false
986
 
        type: BTREE
987
 
        key_length: 4
988
 
        index_part {
989
 
          fieldnr: 1
990
 
          compare_length: 4
991
 
        }
992
 
        options {
993
 
        }
994
 
      }
995
 
      type: STANDARD
996
 
      schema: "test"
997
 
      options {
998
 
        has_user_set_auto_increment_value: false
999
 
        collation: "utf8_general_ci"
1000
 
        collation_id: 45
1001
 
      }
1002
 
      CREATE_TIMESTAMP
1003
 
      UPDATE_TIMESTAMP
1004
 
      catalog: "LOCAL"
1005
 
      UUID
1006
 
      version: 1
1007
 
    }
1008
 
  }
1009
 
}
1010
 
segment_id: 1
1011
 
end_segment: true
1012
 
 
1013
 
 
1014
 
COMMIT;
1015
 
 
1016
 
CREATE TABLE t2(a INT NOT NULL, b INT , PRIMARY KEY(a), KEY b_key (b), 
1017
 
CONSTRAINT fk_constraint_t2 FOREIGN KEY (b) REFERENCES t1(b) ON DELETE SET NULL ON UPDATE CASCADE);
1018
 
Check transaction_log_entries
1019
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1020
 
COUNT(*)
1021
 
2
1022
 
 
1023
 
Check transaction_log_transactions
1024
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1025
 
COUNT(*)
1026
 
2
1027
 
Check transaction log contents
1028
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1029
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1030
 
transaction_context {
1031
 
  server_id: 1
1032
 
  TRANSACTION_ID
1033
 
  START_TIMESTAMP
1034
 
  END_TIMESTAMP
1035
 
}
1036
 
statement {
1037
 
  type: CREATE_TABLE
1038
 
  START_TIMESTAMP
1039
 
  END_TIMESTAMP
1040
 
  create_table_statement {
1041
 
    table {
1042
 
      name: "t2"
1043
 
      engine {
1044
 
        name: "InnoDB"
1045
 
      }
1046
 
      field {
1047
 
        name: "a"
1048
 
        type: INTEGER
1049
 
        constraints {
1050
 
          is_notnull: true
1051
 
        }
1052
 
      }
1053
 
      field {
1054
 
        name: "b"
1055
 
        type: INTEGER
1056
 
        options {
1057
 
          default_null: true
1058
 
        }
1059
 
      }
1060
 
      indexes {
1061
 
        name: "PRIMARY"
1062
 
        is_primary: true
1063
 
        is_unique: true
1064
 
        type: BTREE
1065
 
        key_length: 4
1066
 
        index_part {
1067
 
          fieldnr: 0
1068
 
          compare_length: 4
1069
 
        }
1070
 
        options {
1071
 
        }
1072
 
      }
1073
 
      indexes {
1074
 
        name: "b_key"
1075
 
        is_primary: false
1076
 
        is_unique: false
1077
 
        type: BTREE
1078
 
        key_length: 4
1079
 
        index_part {
1080
 
          fieldnr: 1
1081
 
          compare_length: 4
1082
 
        }
1083
 
        options {
1084
 
          null_part_key: true
1085
 
        }
1086
 
      }
1087
 
      type: STANDARD
1088
 
      schema: "test"
1089
 
      fk_constraint {
1090
 
        name: "fk_constraint_t2"
1091
 
        column_names: "b"
1092
 
        references_table_name: "t1"
1093
 
        references_columns: "b"
1094
 
        match: MATCH_UNDEFINED
1095
 
        update_option: OPTION_CASCADE
1096
 
        delete_option: OPTION_SET_NULL
1097
 
      }
1098
 
      options {
1099
 
        has_user_set_auto_increment_value: false
1100
 
        collation: "utf8_general_ci"
1101
 
        collation_id: 45
1102
 
      }
1103
 
      CREATE_TIMESTAMP
1104
 
      UPDATE_TIMESTAMP
1105
 
      catalog: "LOCAL"
1106
 
      UUID
1107
 
      version: 1
1108
 
    }
1109
 
  }
1110
 
}
1111
 
segment_id: 1
1112
 
end_segment: true
1113
 
 
1114
 
 
1115
 
COMMIT;
1116
 
 
1117
 
DROP TABLE t2;
1118
 
DROP TABLE t1;
1119
 
SET GLOBAL transaction_log_truncate_debug= true;
1120
 
 
1121
 
Testing CREATE TABLE...LIKE 
1122
 
DROP TABLE IF EXISTS t1, t2;
1123
 
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, PRIMARY KEY(a), KEY b_key1 (b));
1124
 
Check transaction_log_entries
1125
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1126
 
COUNT(*)
1127
 
1
1128
 
 
1129
 
Check transaction_log_transactions
1130
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1131
 
COUNT(*)
1132
 
1
1133
 
Check transaction log contents
1134
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1135
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1136
 
transaction_context {
1137
 
  server_id: 1
1138
 
  TRANSACTION_ID
1139
 
  START_TIMESTAMP
1140
 
  END_TIMESTAMP
1141
 
}
1142
 
statement {
1143
 
  type: CREATE_TABLE
1144
 
  START_TIMESTAMP
1145
 
  END_TIMESTAMP
1146
 
  create_table_statement {
1147
 
    table {
1148
 
      name: "t1"
1149
 
      engine {
1150
 
        name: "InnoDB"
1151
 
      }
1152
 
      field {
1153
 
        name: "a"
1154
 
        type: INTEGER
1155
 
        constraints {
1156
 
          is_notnull: true
1157
 
        }
1158
 
      }
1159
 
      field {
1160
 
        name: "b"
1161
 
        type: INTEGER
1162
 
        constraints {
1163
 
          is_notnull: true
1164
 
        }
1165
 
      }
1166
 
      indexes {
1167
 
        name: "PRIMARY"
1168
 
        is_primary: true
1169
 
        is_unique: true
1170
 
        type: BTREE
1171
 
        key_length: 4
1172
 
        index_part {
1173
 
          fieldnr: 0
1174
 
          compare_length: 4
1175
 
        }
1176
 
        options {
1177
 
        }
1178
 
      }
1179
 
      indexes {
1180
 
        name: "b_key1"
1181
 
        is_primary: false
1182
 
        is_unique: false
1183
 
        type: BTREE
1184
 
        key_length: 4
1185
 
        index_part {
1186
 
          fieldnr: 1
1187
 
          compare_length: 4
1188
 
        }
1189
 
        options {
1190
 
        }
1191
 
      }
1192
 
      type: STANDARD
1193
 
      schema: "test"
1194
 
      options {
1195
 
        has_user_set_auto_increment_value: false
1196
 
        collation: "utf8_general_ci"
1197
 
        collation_id: 45
1198
 
      }
1199
 
      CREATE_TIMESTAMP
1200
 
      UPDATE_TIMESTAMP
1201
 
      catalog: "LOCAL"
1202
 
      UUID
1203
 
      version: 1
1204
 
    }
1205
 
  }
1206
 
}
1207
 
segment_id: 1
1208
 
end_segment: true
1209
 
 
1210
 
 
1211
 
COMMIT;
1212
 
 
1213
 
CREATE TABLE t2 LIKE t1;
1214
 
Check transaction_log_entries
1215
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1216
 
COUNT(*)
1217
 
2
1218
 
 
1219
 
Check transaction_log_transactions
1220
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1221
 
COUNT(*)
1222
 
2
1223
 
Check transaction log contents
1224
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1225
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1226
 
transaction_context {
1227
 
  server_id: 1
1228
 
  TRANSACTION_ID
1229
 
  START_TIMESTAMP
1230
 
  END_TIMESTAMP
1231
 
}
1232
 
statement {
1233
 
  type: CREATE_TABLE
1234
 
  START_TIMESTAMP
1235
 
  END_TIMESTAMP
1236
 
  create_table_statement {
1237
 
    table {
1238
 
      name: "t2"
1239
 
      engine {
1240
 
        name: "InnoDB"
1241
 
      }
1242
 
      field {
1243
 
        name: "a"
1244
 
        type: INTEGER
1245
 
        constraints {
1246
 
          is_notnull: true
1247
 
        }
1248
 
      }
1249
 
      field {
1250
 
        name: "b"
1251
 
        type: INTEGER
1252
 
        constraints {
1253
 
          is_notnull: true
1254
 
        }
1255
 
      }
1256
 
      indexes {
1257
 
        name: "PRIMARY"
1258
 
        is_primary: true
1259
 
        is_unique: true
1260
 
        type: BTREE
1261
 
        key_length: 4
1262
 
        index_part {
1263
 
          fieldnr: 0
1264
 
          compare_length: 4
1265
 
        }
1266
 
        options {
1267
 
        }
1268
 
      }
1269
 
      indexes {
1270
 
        name: "b_key1"
1271
 
        is_primary: false
1272
 
        is_unique: false
1273
 
        type: BTREE
1274
 
        key_length: 4
1275
 
        index_part {
1276
 
          fieldnr: 1
1277
 
          compare_length: 4
1278
 
        }
1279
 
        options {
1280
 
        }
1281
 
      }
1282
 
      type: STANDARD
1283
 
      schema: "test"
1284
 
      options {
1285
 
        has_user_set_auto_increment_value: false
1286
 
        collation: "utf8_general_ci"
1287
 
        collation_id: 45
1288
 
      }
1289
 
      CREATE_TIMESTAMP
1290
 
      UPDATE_TIMESTAMP
1291
 
      catalog: "LOCAL"
1292
 
      UUID
1293
 
      version: 1
1294
 
    }
1295
 
  }
1296
 
}
1297
 
segment_id: 1
1298
 
end_segment: true
1299
 
 
1300
 
 
1301
 
COMMIT;
1302
 
 
1303
 
DROP TABLE t2;
1304
 
DROP TABLE t1;
1305
 
SET GLOBAL transaction_log_truncate_debug= true;
1306
 
 
1307
 
Testing collations - column 
1308
 
DROP TABLE IF EXISTS t1, t2;
1309
 
CREATE TABLE t1(a INT NOT NULL, b CHAR(1000) NOT NULL COLLATE utf8_turkish_ci, c CHAR(10), PRIMARY KEY(a), KEY b_key1 (b));
1310
 
Warnings:
1311
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
1312
 
Check transaction_log_entries
1313
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1314
 
COUNT(*)
1315
 
1
1316
 
 
1317
 
Check transaction_log_transactions
1318
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1319
 
COUNT(*)
1320
 
1
1321
 
Check transaction log contents
1322
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1323
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1324
 
transaction_context {
1325
 
  server_id: 1
1326
 
  TRANSACTION_ID
1327
 
  START_TIMESTAMP
1328
 
  END_TIMESTAMP
1329
 
}
1330
 
statement {
1331
 
  type: CREATE_TABLE
1332
 
  START_TIMESTAMP
1333
 
  END_TIMESTAMP
1334
 
  create_table_statement {
1335
 
    table {
1336
 
      name: "t1"
1337
 
      engine {
1338
 
        name: "InnoDB"
1339
 
      }
1340
 
      field {
1341
 
        name: "a"
1342
 
        type: INTEGER
1343
 
        constraints {
1344
 
          is_notnull: true
1345
 
        }
1346
 
      }
1347
 
      field {
1348
 
        name: "b"
1349
 
        type: VARCHAR
1350
 
        constraints {
1351
 
          is_notnull: true
1352
 
        }
1353
 
        string_options {
1354
 
          length: 1000
1355
 
          collation_id: 233
1356
 
          collation: "utf8_turkish_ci"
1357
 
        }
1358
 
      }
1359
 
      field {
1360
 
        name: "c"
1361
 
        type: VARCHAR
1362
 
        options {
1363
 
          default_null: true
1364
 
        }
1365
 
        string_options {
1366
 
          length: 10
1367
 
          collation_id: 45
1368
 
          collation: "utf8_general_ci"
1369
 
        }
1370
 
      }
1371
 
      indexes {
1372
 
        name: "PRIMARY"
1373
 
        is_primary: true
1374
 
        is_unique: true
1375
 
        type: BTREE
1376
 
        key_length: 4
1377
 
        index_part {
1378
 
          fieldnr: 0
1379
 
          compare_length: 4
1380
 
        }
1381
 
        options {
1382
 
        }
1383
 
      }
1384
 
      indexes {
1385
 
        name: "b_key1"
1386
 
        is_primary: false
1387
 
        is_unique: false
1388
 
        type: BTREE
1389
 
        key_length: 1020
1390
 
        index_part {
1391
 
          fieldnr: 1
1392
 
          compare_length: 255
1393
 
        }
1394
 
        options {
1395
 
          binary_pack_key: true
1396
 
          var_length_key: true
1397
 
          has_partial_segments: true
1398
 
        }
1399
 
      }
1400
 
      type: STANDARD
1401
 
      schema: "test"
1402
 
      options {
1403
 
        has_user_set_auto_increment_value: false
1404
 
        collation: "utf8_general_ci"
1405
 
        collation_id: 45
1406
 
      }
1407
 
      CREATE_TIMESTAMP
1408
 
      UPDATE_TIMESTAMP
1409
 
      catalog: "LOCAL"
1410
 
      UUID
1411
 
      version: 1
1412
 
    }
1413
 
  }
1414
 
}
1415
 
segment_id: 1
1416
 
end_segment: true
1417
 
 
1418
 
 
1419
 
COMMIT;
1420
 
 
1421
 
DROP TABLE t1;
1422
 
SET GLOBAL transaction_log_truncate_debug= true;
1423
 
 
1424
 
Testing collations - table 
1425
 
DROP TABLE IF EXISTS t1, t2;
1426
 
CREATE TABLE t1(a INT NOT NULL, b CHAR(1000) NOT NULL , c CHAR(1) COLLATE utf8_bin, PRIMARY KEY(a)) COLLATE utf8_turkish_ci;
1427
 
Check transaction_log_entries
1428
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1429
 
COUNT(*)
1430
 
1
1431
 
 
1432
 
Check transaction_log_transactions
1433
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1434
 
COUNT(*)
1435
 
1
1436
 
Check transaction log contents
1437
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1438
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1439
 
transaction_context {
1440
 
  server_id: 1
1441
 
  TRANSACTION_ID
1442
 
  START_TIMESTAMP
1443
 
  END_TIMESTAMP
1444
 
}
1445
 
statement {
1446
 
  type: CREATE_TABLE
1447
 
  START_TIMESTAMP
1448
 
  END_TIMESTAMP
1449
 
  create_table_statement {
1450
 
    table {
1451
 
      name: "t1"
1452
 
      engine {
1453
 
        name: "InnoDB"
1454
 
      }
1455
 
      field {
1456
 
        name: "a"
1457
 
        type: INTEGER
1458
 
        constraints {
1459
 
          is_notnull: true
1460
 
        }
1461
 
      }
1462
 
      field {
1463
 
        name: "b"
1464
 
        type: VARCHAR
1465
 
        constraints {
1466
 
          is_notnull: true
1467
 
        }
1468
 
        string_options {
1469
 
          length: 1000
1470
 
          collation_id: 233
1471
 
          collation: "utf8_turkish_ci"
1472
 
        }
1473
 
      }
1474
 
      field {
1475
 
        name: "c"
1476
 
        type: VARCHAR
1477
 
        options {
1478
 
          default_null: true
1479
 
        }
1480
 
        string_options {
1481
 
          length: 1
1482
 
          collation_id: 46
1483
 
          collation: "utf8_bin"
1484
 
        }
1485
 
      }
1486
 
      indexes {
1487
 
        name: "PRIMARY"
1488
 
        is_primary: true
1489
 
        is_unique: true
1490
 
        type: BTREE
1491
 
        key_length: 4
1492
 
        index_part {
1493
 
          fieldnr: 0
1494
 
          compare_length: 4
1495
 
        }
1496
 
        options {
1497
 
        }
1498
 
      }
1499
 
      type: STANDARD
1500
 
      schema: "test"
1501
 
      options {
1502
 
        has_user_set_auto_increment_value: false
1503
 
        collation: "utf8_turkish_ci"
1504
 
        collation_id: 233
1505
 
      }
1506
 
      CREATE_TIMESTAMP
1507
 
      UPDATE_TIMESTAMP
1508
 
      catalog: "LOCAL"
1509
 
      UUID
1510
 
      version: 1
1511
 
    }
1512
 
  }
1513
 
}
1514
 
segment_id: 1
1515
 
end_segment: true
1516
 
 
1517
 
 
1518
 
COMMIT;
1519
 
 
1520
 
DROP TABLE t1;
1521
 
SET GLOBAL transaction_log_truncate_debug= true;
1522
 
 
1523
 
Testing charset - column 
1524
 
DROP TABLE IF EXISTS t1, t2;
1525
 
CREATE TABLE t1(a INT NOT NULL, b BLOB NOT NULL, c CHAR(1) DEFAULT '0', PRIMARY KEY(a));
1526
 
Check transaction_log_entries
1527
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1528
 
COUNT(*)
1529
 
1
1530
 
 
1531
 
Check transaction_log_transactions
1532
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1533
 
COUNT(*)
1534
 
1
1535
 
Check transaction log contents
1536
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1537
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1538
 
transaction_context {
1539
 
  server_id: 1
1540
 
  TRANSACTION_ID
1541
 
  START_TIMESTAMP
1542
 
  END_TIMESTAMP
1543
 
}
1544
 
statement {
1545
 
  type: CREATE_TABLE
1546
 
  START_TIMESTAMP
1547
 
  END_TIMESTAMP
1548
 
  create_table_statement {
1549
 
    table {
1550
 
      name: "t1"
1551
 
      engine {
1552
 
        name: "InnoDB"
1553
 
      }
1554
 
      field {
1555
 
        name: "a"
1556
 
        type: INTEGER
1557
 
        constraints {
1558
 
          is_notnull: true
1559
 
        }
1560
 
      }
1561
 
      field {
1562
 
        name: "b"
1563
 
        type: BLOB
1564
 
        constraints {
1565
 
          is_notnull: true
1566
 
        }
1567
 
        string_options {
1568
 
          collation_id: 63
1569
 
          collation: "binary"
1570
 
        }
1571
 
      }
1572
 
      field {
1573
 
        name: "c"
1574
 
        type: VARCHAR
1575
 
        options {
1576
 
          default_value: "0"
1577
 
        }
1578
 
        string_options {
1579
 
          length: 1
1580
 
          collation_id: 45
1581
 
          collation: "utf8_general_ci"
1582
 
        }
1583
 
      }
1584
 
      indexes {
1585
 
        name: "PRIMARY"
1586
 
        is_primary: true
1587
 
        is_unique: true
1588
 
        type: BTREE
1589
 
        key_length: 4
1590
 
        index_part {
1591
 
          fieldnr: 0
1592
 
          compare_length: 4
1593
 
        }
1594
 
        options {
1595
 
        }
1596
 
      }
1597
 
      type: STANDARD
1598
 
      schema: "test"
1599
 
      options {
1600
 
        has_user_set_auto_increment_value: false
1601
 
        collation: "utf8_general_ci"
1602
 
        collation_id: 45
1603
 
      }
1604
 
      CREATE_TIMESTAMP
1605
 
      UPDATE_TIMESTAMP
1606
 
      catalog: "LOCAL"
1607
 
      UUID
1608
 
      version: 1
1609
 
    }
1610
 
  }
1611
 
}
1612
 
segment_id: 1
1613
 
end_segment: true
1614
 
 
1615
 
 
1616
 
COMMIT;
1617
 
 
1618
 
DROP TABLE t1;
1619
 
SET GLOBAL transaction_log_truncate_debug= true;
1620
 
 
1621
 
Testing CREATE data-type / fields
1622
 
DROP TABLE IF EXISTS t1;
1623
 
CREATE TABLE t1 (
1624
 
autoinc_int_field INT NOT NULL AUTO_INCREMENT
1625
 
, null_int_field INT NULL
1626
 
, not_null_bigint_field BIGINT NOT NULL
1627
 
, null_bigint_field BIGINT NULL
1628
 
, not_null_int_field INT NOT NULL
1629
 
, null_varchar_field VARCHAR(100) NULL
1630
 
, not_null_varchar_field VARCHAR(100) NOT NULL
1631
 
, null_enum_field ENUM ('val1', 'val2') NULL
1632
 
, not_null_enum_field ENUM ('val1', 'val2') NOT NULL
1633
 
, null_date_field DATE NULL
1634
 
, not_null_date_field DATE NOT NULL
1635
 
, null_datetime_field DATETIME NULL
1636
 
, not_null_datetime_field DATETIME NOT NULL
1637
 
, null_blob_field BLOB NULL
1638
 
, not_null_blob_field BLOB NOT NULL
1639
 
, null_text_field TEXT NULL
1640
 
, not_null_text_field TEXT NOT NULL
1641
 
, null_timestamp_field TIMESTAMP NULL
1642
 
, not_null_timestamp_field TIMESTAMP NOT NULL
1643
 
, null_double_field DOUBLE NULL
1644
 
, not_null_double_field DOUBLE NOT NULL
1645
 
, null_decimal_field DECIMAL(10,2) NULL
1646
 
, not_null_decimal_field DECIMAL(10,2) NOT NULL
1647
 
, PRIMARY KEY (autoinc_int_field)
1648
 
);
1649
 
Check transaction_log_entries
1650
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1651
 
COUNT(*)
1652
 
1
1653
 
 
1654
 
Check transaction_log_transactions
1655
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1656
 
COUNT(*)
1657
 
1
1658
 
Check transaction log contents
1659
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1660
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1661
 
transaction_context {
1662
 
  server_id: 1
1663
 
  TRANSACTION_ID
1664
 
  START_TIMESTAMP
1665
 
  END_TIMESTAMP
1666
 
}
1667
 
statement {
1668
 
  type: CREATE_TABLE
1669
 
  START_TIMESTAMP
1670
 
  END_TIMESTAMP
1671
 
  create_table_statement {
1672
 
    table {
1673
 
      name: "t1"
1674
 
      engine {
1675
 
        name: "InnoDB"
1676
 
      }
1677
 
      field {
1678
 
        name: "autoinc_int_field"
1679
 
        type: INTEGER
1680
 
        constraints {
1681
 
          is_notnull: true
1682
 
        }
1683
 
        numeric_options {
1684
 
          is_autoincrement: true
1685
 
        }
1686
 
      }
1687
 
      field {
1688
 
        name: "null_int_field"
1689
 
        type: INTEGER
1690
 
        options {
1691
 
          default_null: true
1692
 
        }
1693
 
      }
1694
 
      field {
1695
 
        name: "not_null_bigint_field"
1696
 
        type: BIGINT
1697
 
        constraints {
1698
 
          is_notnull: true
1699
 
        }
1700
 
      }
1701
 
      field {
1702
 
        name: "null_bigint_field"
1703
 
        type: BIGINT
1704
 
        options {
1705
 
          default_null: true
1706
 
        }
1707
 
      }
1708
 
      field {
1709
 
        name: "not_null_int_field"
1710
 
        type: INTEGER
1711
 
        constraints {
1712
 
          is_notnull: true
1713
 
        }
1714
 
      }
1715
 
      field {
1716
 
        name: "null_varchar_field"
1717
 
        type: VARCHAR
1718
 
        options {
1719
 
          default_null: true
1720
 
        }
1721
 
        string_options {
1722
 
          length: 100
1723
 
          collation_id: 45
1724
 
          collation: "utf8_general_ci"
1725
 
        }
1726
 
      }
1727
 
      field {
1728
 
        name: "not_null_varchar_field"
1729
 
        type: VARCHAR
1730
 
        constraints {
1731
 
          is_notnull: true
1732
 
        }
1733
 
        string_options {
1734
 
          length: 100
1735
 
          collation_id: 45
1736
 
          collation: "utf8_general_ci"
1737
 
        }
1738
 
      }
1739
 
      field {
1740
 
        name: "null_enum_field"
1741
 
        type: ENUM
1742
 
        options {
1743
 
          default_null: true
1744
 
        }
1745
 
        enumeration_values {
1746
 
          collation_id: 45
1747
 
          collation: "utf8_general_ci"
1748
 
          field_value: "val1"
1749
 
          field_value: "val2"
1750
 
        }
1751
 
      }
1752
 
      field {
1753
 
        name: "not_null_enum_field"
1754
 
        type: ENUM
1755
 
        constraints {
1756
 
          is_notnull: true
1757
 
        }
1758
 
        enumeration_values {
1759
 
          collation_id: 45
1760
 
          collation: "utf8_general_ci"
1761
 
          field_value: "val1"
1762
 
          field_value: "val2"
1763
 
        }
1764
 
      }
1765
 
      field {
1766
 
        name: "null_date_field"
1767
 
        type: DATE
1768
 
        options {
1769
 
          default_null: true
1770
 
        }
1771
 
      }
1772
 
      field {
1773
 
        name: "not_null_date_field"
1774
 
        type: DATE
1775
 
        constraints {
1776
 
          is_notnull: true
1777
 
        }
1778
 
      }
1779
 
      field {
1780
 
        name: "null_datetime_field"
1781
 
        type: DATETIME
1782
 
        options {
1783
 
          default_null: true
1784
 
        }
1785
 
      }
1786
 
      field {
1787
 
        name: "not_null_datetime_field"
1788
 
        type: DATETIME
1789
 
        constraints {
1790
 
          is_notnull: true
1791
 
        }
1792
 
      }
1793
 
      field {
1794
 
        name: "null_blob_field"
1795
 
        type: BLOB
1796
 
        options {
1797
 
          default_null: true
1798
 
        }
1799
 
        string_options {
1800
 
          collation_id: 63
1801
 
          collation: "binary"
1802
 
        }
1803
 
      }
1804
 
      field {
1805
 
        name: "not_null_blob_field"
1806
 
        type: BLOB
1807
 
        constraints {
1808
 
          is_notnull: true
1809
 
        }
1810
 
        string_options {
1811
 
          collation_id: 63
1812
 
          collation: "binary"
1813
 
        }
1814
 
      }
1815
 
      field {
1816
 
        name: "null_text_field"
1817
 
        type: BLOB
1818
 
        options {
1819
 
          default_null: true
1820
 
        }
1821
 
        string_options {
1822
 
          collation_id: 45
1823
 
          collation: "utf8_general_ci"
1824
 
        }
1825
 
      }
1826
 
      field {
1827
 
        name: "not_null_text_field"
1828
 
        type: BLOB
1829
 
        constraints {
1830
 
          is_notnull: true
1831
 
        }
1832
 
        string_options {
1833
 
          collation_id: 45
1834
 
          collation: "utf8_general_ci"
1835
 
        }
1836
 
      }
1837
 
      field {
1838
 
        name: "null_timestamp_field"
1839
 
        type: EPOCH
1840
 
        options {
1841
 
          default_null: true
1842
 
        }
1843
 
      }
1844
 
      field {
1845
 
        name: "not_null_timestamp_field"
1846
 
        type: EPOCH
1847
 
        constraints {
1848
 
          is_notnull: true
1849
 
        }
1850
 
      }
1851
 
      field {
1852
 
        name: "null_double_field"
1853
 
        type: DOUBLE
1854
 
        options {
1855
 
          default_null: true
1856
 
        }
1857
 
      }
1858
 
      field {
1859
 
        name: "not_null_double_field"
1860
 
        type: DOUBLE
1861
 
        constraints {
1862
 
          is_notnull: true
1863
 
        }
1864
 
      }
1865
 
      field {
1866
 
        name: "null_decimal_field"
1867
 
        type: DECIMAL
1868
 
        options {
1869
 
          default_null: true
1870
 
        }
1871
 
        numeric_options {
1872
 
          scale: 2
1873
 
          precision: 10
1874
 
        }
1875
 
      }
1876
 
      field {
1877
 
        name: "not_null_decimal_field"
1878
 
        type: DECIMAL
1879
 
        constraints {
1880
 
          is_notnull: true
1881
 
        }
1882
 
        numeric_options {
1883
 
          scale: 2
1884
 
          precision: 10
1885
 
        }
1886
 
      }
1887
 
      indexes {
1888
 
        name: "PRIMARY"
1889
 
        is_primary: true
1890
 
        is_unique: true
1891
 
        type: BTREE
1892
 
        key_length: 4
1893
 
        index_part {
1894
 
          fieldnr: 0
1895
 
          compare_length: 4
1896
 
        }
1897
 
        options {
1898
 
        }
1899
 
      }
1900
 
      type: STANDARD
1901
 
      schema: "test"
1902
 
      options {
1903
 
        has_user_set_auto_increment_value: false
1904
 
        collation: "utf8_general_ci"
1905
 
        collation_id: 45
1906
 
      }
1907
 
      CREATE_TIMESTAMP
1908
 
      UPDATE_TIMESTAMP
1909
 
      catalog: "LOCAL"
1910
 
      UUID
1911
 
      version: 1
1912
 
    }
1913
 
  }
1914
 
}
1915
 
segment_id: 1
1916
 
end_segment: true
1917
 
 
1918
 
 
1919
 
COMMIT;
1920
 
 
1921
 
DROP TABLE t1;
1922
 
SET GLOBAL transaction_log_truncate_debug= true;
1923
 
 
1924
 
Testing index generation 
1925
 
DROP TABLE IF EXISTS t1;
1926
 
CREATE TABLE t1 (
1927
 
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
1928
 
, key1 VARCHAR(10) NOT NULL
1929
 
, key2 DOUBLE NOT NULL
1930
 
, key3 BLOB NOT NULL
1931
 
, UNIQUE KEY (key1)
1932
 
, KEY named_key (key2)
1933
 
, KEY partial_key (key3(30))
1934
 
);
1935
 
Check transaction_log_entries
1936
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
1937
 
COUNT(*)
1938
 
1
1939
 
 
1940
 
Check transaction_log_transactions
1941
 
SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS;
1942
 
COUNT(*)
1943
 
1
1944
 
Check transaction log contents
1945
 
SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1946
 
PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
1947
 
transaction_context {
1948
 
  server_id: 1
1949
 
  TRANSACTION_ID
1950
 
  START_TIMESTAMP
1951
 
  END_TIMESTAMP
1952
 
}
1953
 
statement {
1954
 
  type: CREATE_TABLE
1955
 
  START_TIMESTAMP
1956
 
  END_TIMESTAMP
1957
 
  create_table_statement {
1958
 
    table {
1959
 
      name: "t1"
1960
 
      engine {
1961
 
        name: "InnoDB"
1962
 
      }
1963
 
      field {
1964
 
        name: "id"
1965
 
        type: INTEGER
1966
 
        constraints {
1967
 
          is_notnull: true
1968
 
        }
1969
 
        numeric_options {
1970
 
          is_autoincrement: true
1971
 
        }
1972
 
      }
1973
 
      field {
1974
 
        name: "key1"
1975
 
        type: VARCHAR
1976
 
        constraints {
1977
 
          is_notnull: true
1978
 
        }
1979
 
        string_options {
1980
 
          length: 10
1981
 
          collation_id: 45
1982
 
          collation: "utf8_general_ci"
1983
 
        }
1984
 
      }
1985
 
      field {
1986
 
        name: "key2"
1987
 
        type: DOUBLE
1988
 
        constraints {
1989
 
          is_notnull: true
1990
 
        }
1991
 
      }
1992
 
      field {
1993
 
        name: "key3"
1994
 
        type: BLOB
1995
 
        constraints {
1996
 
          is_notnull: true
1997
 
        }
1998
 
        string_options {
1999
 
          collation_id: 63
2000
 
          collation: "binary"
2001
 
        }
2002
 
      }
2003
 
      indexes {
2004
 
        name: "PRIMARY"
2005
 
        is_primary: true
2006
 
        is_unique: true
2007
 
        type: BTREE
2008
 
        key_length: 4
2009
 
        index_part {
2010
 
          fieldnr: 0
2011
 
          compare_length: 4
2012
 
        }
2013
 
        options {
2014
 
        }
2015
 
      }
2016
 
      indexes {
2017
 
        name: "key1"
2018
 
        is_primary: false
2019
 
        is_unique: true
2020
 
        type: BTREE
2021
 
        key_length: 40
2022
 
        index_part {
2023
 
          fieldnr: 1
2024
 
          compare_length: 10
2025
 
        }
2026
 
        options {
2027
 
          binary_pack_key: true
2028
 
          var_length_key: true
2029
 
        }
2030
 
      }
2031
 
      indexes {
2032
 
        name: "named_key"
2033
 
        is_primary: false
2034
 
        is_unique: false
2035
 
        type: BTREE
2036
 
        key_length: 8
2037
 
        index_part {
2038
 
          fieldnr: 2
2039
 
          compare_length: 8
2040
 
        }
2041
 
        options {
2042
 
        }
2043
 
      }
2044
 
      indexes {
2045
 
        name: "partial_key"
2046
 
        is_primary: false
2047
 
        is_unique: false
2048
 
        type: BTREE
2049
 
        key_length: 30
2050
 
        index_part {
2051
 
          fieldnr: 3
2052
 
          compare_length: 30
2053
 
        }
2054
 
        options {
2055
 
          binary_pack_key: true
2056
 
          var_length_key: true
2057
 
          has_partial_segments: true
2058
 
        }
2059
 
      }
2060
 
      type: STANDARD
2061
 
      schema: "test"
2062
 
      options {
2063
 
        has_user_set_auto_increment_value: false
2064
 
        collation: "utf8_general_ci"
2065
 
        collation_id: 45
2066
 
      }
2067
 
      CREATE_TIMESTAMP
2068
 
      UPDATE_TIMESTAMP
2069
 
      catalog: "LOCAL"
2070
 
      UUID
2071
 
      version: 1
2072
 
    }
2073
 
  }
2074
 
}
2075
 
segment_id: 1
2076
 
end_segment: true
2077
 
 
2078
 
 
2079
 
COMMIT;
2080
 
 
2081
 
DROP TABLE t1;
2082
 
SET GLOBAL transaction_log_truncate_debug= true;
2083