From 3f619478f796eddbba6e39502fe941b285dd97b1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:00:34 +0200 Subject: Adding upstream version 1:10.11.6. Signed-off-by: Daniel Baumann --- mysql-test/suite/innodb/r/101_compatibility.result | 50 + mysql-test/suite/innodb/r/add_constraint.result | 13 + .../suite/innodb/r/alter_algorithm,INPLACE.rdiff | 155 + .../suite/innodb/r/alter_algorithm,INSTANT.rdiff | 142 + .../suite/innodb/r/alter_algorithm,NOCOPY.rdiff | 147 + mysql-test/suite/innodb/r/alter_algorithm.result | 124 + mysql-test/suite/innodb/r/alter_algorithm2.result | 81 + .../suite/innodb/r/alter_candidate_key.result | 116 + mysql-test/suite/innodb/r/alter_copy.result | 218 ++ mysql-test/suite/innodb/r/alter_crash.result | 223 ++ .../suite/innodb/r/alter_crash_rebuild.result | 19 + mysql-test/suite/innodb/r/alter_dml_apply.result | 39 + .../suite/innodb/r/alter_foreign_crash.result | 37 + .../suite/innodb/r/alter_inplace_perfschema.result | 21 + .../innodb/r/alter_key_block_size-11757.result | 50 + mysql-test/suite/innodb/r/alter_kill.result | 61 + mysql-test/suite/innodb/r/alter_large_dml.result | 43 + mysql-test/suite/innodb/r/alter_mdl_timeout.result | 23 + .../suite/innodb/r/alter_missing_tablespace.result | 52 + .../innodb/r/alter_not_null,COPY,NON-STRICT.rdiff | 42 + .../innodb/r/alter_not_null,COPY,STRICT.rdiff | 72 + .../innodb/r/alter_not_null,INPLACE,STRICT.rdiff | 66 + mysql-test/suite/innodb/r/alter_not_null.result | 114 + .../innodb/r/alter_not_null_debug,STRICT.rdiff | 16 + .../suite/innodb/r/alter_not_null_debug.result | 102 + mysql-test/suite/innodb/r/alter_partitioned.result | 57 + .../suite/innodb/r/alter_partitioned_debug.result | 27 + .../suite/innodb/r/alter_partitioned_xa.result | 18 + .../suite/innodb/r/alter_persistent_autoinc.result | 42 + mysql-test/suite/innodb/r/alter_primary_key.result | 28 + .../suite/innodb/r/alter_rename_existing.result | 95 + mysql-test/suite/innodb/r/alter_table.result | 138 + .../suite/innodb/r/alter_table_upgrade.result | 36 + .../suite/innodb/r/alter_varchar_change.result | 509 +++ mysql-test/suite/innodb/r/analyze_table.result | 16 + .../suite/innodb/r/auto_increment_dup.result | 167 + mysql-test/suite/innodb/r/autoinc_debug.result | 107 + .../suite/innodb/r/autoinc_persist,desc.rdiff | 769 +++++ mysql-test/suite/innodb/r/autoinc_persist.result | 981 ++++++ mysql-test/suite/innodb/r/binlog_consistent.result | 123 + mysql-test/suite/innodb/r/blob-crash.result | 149 + mysql-test/suite/innodb/r/blob-update-debug.result | 17 + mysql-test/suite/innodb/r/blob_cmp_empty.result | 19 + mysql-test/suite/innodb/r/blob_unique2pk.result | 15 + .../suite/innodb/r/buf_pool_resize_oom.result | 8 + .../suite/innodb/r/change_column_collation.result | 145 + .../suite/innodb/r/check_ibd_filesize,32k.rdiff | 25 + .../suite/innodb/r/check_ibd_filesize,4k.rdiff | 25 + .../suite/innodb/r/check_ibd_filesize,64k.rdiff | 25 + .../suite/innodb/r/check_ibd_filesize,8k.rdiff | 25 + .../suite/innodb/r/check_ibd_filesize.result | 20 + .../r/compression_providers_loaded,lz4.rdiff | 19 + .../r/compression_providers_loaded,lzma.rdiff | 19 + .../r/compression_providers_loaded,lzo.rdiff | 19 + .../r/compression_providers_loaded,snappy.rdiff | 19 + .../innodb/r/compression_providers_loaded.result | 10 + .../r/compression_providers_unloaded,lz4.rdiff | 26 + .../r/compression_providers_unloaded,lzma.rdiff | 26 + .../r/compression_providers_unloaded,lzo.rdiff | 26 + .../r/compression_providers_unloaded,snappy.rdiff | 26 + .../innodb/r/compression_providers_unloaded.result | 14 + .../innodb/r/corrupted_during_recovery.result | 35 + mysql-test/suite/innodb/r/count_distinct.result | 12 + mysql-test/suite/innodb/r/create-index.result | 9 + .../suite/innodb/r/create_isl_with_direct.result | 11 + mysql-test/suite/innodb/r/create_select.result | 10 + .../r/create_table_insert_skip_locked.result | 72 + .../suite/innodb/r/cursor-restore-locking.result | 40 + mysql-test/suite/innodb/r/data_types.result | 183 ++ mysql-test/suite/innodb/r/ddl_purge.result | 27 + mysql-test/suite/innodb/r/deadlock_detect,ON.rdiff | 11 + mysql-test/suite/innodb/r/deadlock_detect.result | 24 + .../innodb/r/deadlock_in_subqueries_join.result | 50 + .../suite/innodb/r/deadlock_on_lock_upgrade.result | 78 + .../suite/innodb/r/deadlock_victim_race.result | 46 + .../suite/innodb/r/deadlock_wait_lock_race.result | 27 + .../suite/innodb/r/deadlock_wait_thr_race.result | 33 + .../r/default_row_format_alter,compact.rdiff | 19 + .../r/default_row_format_alter,redundant.rdiff | 19 + .../suite/innodb/r/default_row_format_alter.result | 153 + .../r/default_row_format_compatibility.result | 105 + .../r/default_row_format_create,dynamic.rdiff | 11 + .../r/default_row_format_create,redundant.rdiff | 31 + .../innodb/r/default_row_format_create.result | 70 + mysql-test/suite/innodb/r/defrag_mdl-9155.result | 18 + mysql-test/suite/innodb/r/dml_purge.result | 48 + mysql-test/suite/innodb/r/doublewrite.result | 266 ++ mysql-test/suite/innodb/r/dropdb.result | 22 + mysql-test/suite/innodb/r/dropdb_cs.result | 16 + .../innodb/r/encryption_threads_shutdown.result | 12 + .../innodb/r/evict_tables_on_commit_debug.result | 9 + .../suite/innodb/r/file_format_defaults.result | 29 + mysql-test/suite/innodb/r/fk_col_alter.result | 118 + mysql-test/suite/innodb/r/flush.result | 16 + mysql-test/suite/innodb/r/foreign-keys.result | 238 ++ mysql-test/suite/innodb/r/foreign_key.result | 1076 +++++++ mysql-test/suite/innodb/r/foreign_key_debug.result | 60 + .../suite/innodb/r/foreign_key_not_windows.result | 31 + mysql-test/suite/innodb/r/full_crc32_import.result | 202 ++ mysql-test/suite/innodb/r/gap_lock_split.result | 29 + mysql-test/suite/innodb/r/gap_locks.result | 35 + mysql-test/suite/innodb/r/group_commit.result | 93 + .../suite/innodb/r/group_commit_binlog_pos.result | 48 + ...oup_commit_binlog_pos_no_optimize_thread.result | 49 + .../suite/innodb/r/group_commit_crash.result | 125 + .../r/group_commit_crash_no_optimize_thread.result | 125 + .../innodb/r/group_commit_force_recovery.result | 5 + .../r/group_commit_no_optimize_thread.result | 93 + mysql-test/suite/innodb/r/help_url.result | 2 + mysql-test/suite/innodb/r/ibuf_delete.result | 53 + mysql-test/suite/innodb/r/ibuf_not_empty.result | 20 + .../innodb/r/implicit_gap_lock_convertion.result | 17 + mysql-test/suite/innodb/r/import_bugs.result | 26 + mysql-test/suite/innodb/r/import_corrupted.result | 31 + .../suite/innodb/r/import_tablespace_race.result | 27 + .../suite/innodb/r/index_merge_threshold.result | 1309 ++++++++ .../suite/innodb/r/index_tree_operation.result | 55 + .../suite/innodb/r/index_vcol_purge_startup.result | 24 + .../innodb/r/information_schema_grants.result | 269 ++ mysql-test/suite/innodb/r/innodb-16k.result | 510 +++ mysql-test/suite/innodb/r/innodb-32k-crash.result | 293 ++ mysql-test/suite/innodb/r/innodb-32k.result | 743 +++++ mysql-test/suite/innodb/r/innodb-64k-crash.result | 288 ++ mysql-test/suite/innodb/r/innodb-64k.result | 1092 +++++++ mysql-test/suite/innodb/r/innodb-agregate.result | 21 + .../suite/innodb/r/innodb-alter-autoinc.result | 174 + .../suite/innodb/r/innodb-alter-debug.result | 142 + .../suite/innodb/r/innodb-alter-nullable.result | 204 ++ .../suite/innodb/r/innodb-alter-table.result | 229 ++ .../suite/innodb/r/innodb-alter-tempfile.result | 65 + .../suite/innodb/r/innodb-alter-timestamp.result | 148 + mysql-test/suite/innodb/r/innodb-alter.result | 1092 +++++++ mysql-test/suite/innodb/r/innodb-analyze.result | 4 + .../suite/innodb/r/innodb-autoinc-18274.result | 26 + .../suite/innodb/r/innodb-autoinc-44030.result | 43 + .../suite/innodb/r/innodb-autoinc-56228.result | 30 + .../suite/innodb/r/innodb-autoinc-61209.result | 22 + .../suite/innodb/r/innodb-autoinc-optimize.result | 9 + .../suite/innodb/r/innodb-autoinc-part.result | 34 + mysql-test/suite/innodb/r/innodb-autoinc.result | 1647 ++++++++++ mysql-test/suite/innodb/r/innodb-bigblob.result | 4 + mysql-test/suite/innodb/r/innodb-blob.result | 164 + .../suite/innodb/r/innodb-bug-14068765.result | 35 + .../suite/innodb/r/innodb-bug-14084530.result | 22 + mysql-test/suite/innodb/r/innodb-consistent.result | 45 + .../suite/innodb/r/innodb-corrupted-table.result | 49 + mysql-test/suite/innodb/r/innodb-dict.result | 44 + .../suite/innodb/r/innodb-enlarge-blob.result | 18 + mysql-test/suite/innodb/r/innodb-fk-virtual.result | 86 + .../suite/innodb/r/innodb-fk-warnings.result | 135 + mysql-test/suite/innodb/r/innodb-fk.result | 223 ++ mysql-test/suite/innodb/r/innodb-fkcheck.result | 97 + mysql-test/suite/innodb/r/innodb-get-fk.result | 78 + .../suite/innodb/r/innodb-index-debug.result | 341 ++ .../suite/innodb/r/innodb-index-online,crypt.rdiff | 20 + .../innodb/r/innodb-index-online-delete.result | 18 + .../suite/innodb/r/innodb-index-online-fk.result | 610 ++++ .../innodb/r/innodb-index-online-norebuild.result | 26 + .../innodb/r/innodb-index-online-purge.result | 48 + .../suite/innodb/r/innodb-index-online.result | 546 ++++ mysql-test/suite/innodb/r/innodb-index.result | 1997 ++++++++++++ mysql-test/suite/innodb/r/innodb-index_ucs2.result | 116 + mysql-test/suite/innodb/r/innodb-isolation.result | 1417 +++++++++ mysql-test/suite/innodb/r/innodb-lock.result | 163 + .../innodb/r/innodb-lru-force-no-free-page.result | 10 + mysql-test/suite/innodb/r/innodb-mdev-7408.result | 13 + mysql-test/suite/innodb/r/innodb-mdev-7513.result | 204 ++ mysql-test/suite/innodb/r/innodb-mdev7046.result | 3 + .../innodb/r/innodb-on-duplicate-update.result | 60 + .../suite/innodb/r/innodb-online-alter-gis.result | 67 + .../innodb/r/innodb-page_compression_none.result | 18 + mysql-test/suite/innodb/r/innodb-read-view.result | 222 ++ .../suite/innodb/r/innodb-replace-debug.result | 14 + mysql-test/suite/innodb/r/innodb-replace.result | 13 + mysql-test/suite/innodb/r/innodb-rollback.result | 10 + .../suite/innodb/r/innodb-semi-consistent.result | 66 + .../r/innodb-stats-initialize-failure.result | 33 + .../innodb/r/innodb-stats-modified-counter.result | 20 + .../suite/innodb/r/innodb-stats-sample.result | 6 + .../suite/innodb/r/innodb-system-table-view.result | 175 + .../suite/innodb/r/innodb-table-online,crypt.rdiff | 20 + .../suite/innodb/r/innodb-table-online.result | 501 +++ mysql-test/suite/innodb/r/innodb-timeout.result | 119 + mysql-test/suite/innodb/r/innodb-trim.result | 20 + mysql-test/suite/innodb/r/innodb-truncate.result | 106 + mysql-test/suite/innodb/r/innodb-ucs2.result | 314 ++ .../suite/innodb/r/innodb-update-insert.result | 44 + .../innodb/r/innodb-virtual-columns-debug.result | 18 + .../suite/innodb/r/innodb-virtual-columns.result | 353 ++ .../suite/innodb/r/innodb-virtual-columns2.result | 89 + .../suite/innodb/r/innodb-wl5522,crc32.rdiff | 5 + .../innodb/r/innodb-wl5522,strict_crc32.rdiff | 5 + mysql-test/suite/innodb/r/innodb-wl5522-1.result | 813 +++++ .../suite/innodb/r/innodb-wl5522-debug.result | 946 ++++++ mysql-test/suite/innodb/r/innodb-wl5522.result | 959 ++++++ .../suite/innodb/r/innodb-wl5980-alter.result | 1592 +++++++++ mysql-test/suite/innodb/r/innodb-xa.result | 44 + mysql-test/suite/innodb/r/innodb.result | 3340 +++++++++++++++++++ mysql-test/suite/innodb/r/innodb_28867993.result | 10 + .../innodb/r/innodb_autoinc_lock_mode_zero.result | 39 + .../innodb/r/innodb_buffer_pool_dump_pct.result | 19 + .../suite/innodb/r/innodb_buffer_pool_fail.result | 8 + .../innodb/r/innodb_buffer_pool_load_now.result | 52 + .../innodb/r/innodb_buffer_pool_resize.result | 32 + .../r/innodb_buffer_pool_resize_bigtest.result | 14 + .../r/innodb_buffer_pool_resize_temporary.result | 13 + .../r/innodb_buffer_pool_resize_with_chunks.result | 26 + .../suite/innodb/r/innodb_bug11754376.result | 5 + .../suite/innodb/r/innodb_bug12400341.result | 18 + .../suite/innodb/r/innodb_bug12661768.result | 2 + .../suite/innodb/r/innodb_bug12902967.result | 6 + .../suite/innodb/r/innodb_bug13510739.result | 10 + .../suite/innodb/r/innodb_bug14007649.result | 64 + .../suite/innodb/r/innodb_bug14147491.result | 20 + .../suite/innodb/r/innodb_bug14676111.result | 79 + mysql-test/suite/innodb/r/innodb_bug21704.result | 89 + .../suite/innodb/r/innodb_bug27216817.result | 24 + .../suite/innodb/r/innodb_bug30113362.result | 122 + mysql-test/suite/innodb/r/innodb_bug30423.result | 106 + mysql-test/suite/innodb/r/innodb_bug30919.result | 1047 ++++++ mysql-test/suite/innodb/r/innodb_bug34300.result | 20 + mysql-test/suite/innodb/r/innodb_bug35220.result | 1 + mysql-test/suite/innodb/r/innodb_bug38231.result | 2 + mysql-test/suite/innodb/r/innodb_bug39438.result | 1 + mysql-test/suite/innodb/r/innodb_bug40360.result | 4 + mysql-test/suite/innodb/r/innodb_bug40565.result | 9 + mysql-test/suite/innodb/r/innodb_bug41904.result | 4 + mysql-test/suite/innodb/r/innodb_bug42419.result | 24 + mysql-test/suite/innodb/r/innodb_bug44032.result | 7 + mysql-test/suite/innodb/r/innodb_bug44369.result | 6 + mysql-test/suite/innodb/r/innodb_bug44571.result | 8 + mysql-test/suite/innodb/r/innodb_bug45357.result | 7 + mysql-test/suite/innodb/r/innodb_bug46000.result | 18 + mysql-test/suite/innodb/r/innodb_bug46676.result | 9 + mysql-test/suite/innodb/r/innodb_bug47621.result | 21 + mysql-test/suite/innodb/r/innodb_bug47622.result | 27 + mysql-test/suite/innodb/r/innodb_bug47777.result | 13 + mysql-test/suite/innodb/r/innodb_bug48024.result | 10 + mysql-test/suite/innodb/r/innodb_bug49164.result | 52 + mysql-test/suite/innodb/r/innodb_bug51378.result | 70 + mysql-test/suite/innodb/r/innodb_bug51920.result | 21 + mysql-test/suite/innodb/r/innodb_bug52199.result | 5 + mysql-test/suite/innodb/r/innodb_bug52663.result | 33 + mysql-test/suite/innodb/r/innodb_bug53046.result | 28 + mysql-test/suite/innodb/r/innodb_bug53290.result | 17 + mysql-test/suite/innodb/r/innodb_bug53592.result | 49 + mysql-test/suite/innodb/r/innodb_bug53674.result | 11 + mysql-test/suite/innodb/r/innodb_bug53756.result | 99 + mysql-test/suite/innodb/r/innodb_bug54044.result | 18 + mysql-test/suite/innodb/r/innodb_bug56143.result | 556 ++++ mysql-test/suite/innodb/r/innodb_bug56716.result | 4 + mysql-test/suite/innodb/r/innodb_bug56947.result | 12 + mysql-test/suite/innodb/r/innodb_bug57252.result | 7 + mysql-test/suite/innodb/r/innodb_bug57255.result | 10 + mysql-test/suite/innodb/r/innodb_bug57904.result | 42 + mysql-test/suite/innodb/r/innodb_bug59307.result | 28 + mysql-test/suite/innodb/r/innodb_bug59410.result | 17 + mysql-test/suite/innodb/r/innodb_bug59641.result | 61 + mysql-test/suite/innodb/r/innodb_bug59733.result | 18 + mysql-test/suite/innodb/r/innodb_bug60049.result | 9 + mysql-test/suite/innodb/r/innodb_bug60196.result | 117 + mysql-test/suite/innodb/r/innodb_bug60229.result | 32 + mysql-test/suite/innodb/r/innodb_bug68148.result | 35 + mysql-test/suite/innodb/r/innodb_bug84958.result | 87 + .../suite/innodb/r/innodb_bulk_create_index.result | 1037 ++++++ .../innodb/r/innodb_bulk_create_index_debug.result | 536 ++++ .../r/innodb_bulk_create_index_replication.result | 222 ++ .../innodb/r/innodb_bulk_create_index_small.result | 139 + .../suite/innodb/r/innodb_corrupt_bit.result | 71 + mysql-test/suite/innodb/r/innodb_ctype_big5.result | 285 ++ .../suite/innodb/r/innodb_ctype_latin1.result | 285 ++ mysql-test/suite/innodb/r/innodb_ctype_ldml.result | 1102 +++++++ .../suite/innodb/r/innodb_ctype_tis620.result | 94 + mysql-test/suite/innodb/r/innodb_ctype_utf8.result | 479 +++ .../suite/innodb/r/innodb_defrag_binlog.result | 31 + .../suite/innodb/r/innodb_defrag_concurrent.result | 102 + .../suite/innodb/r/innodb_defrag_stats.result | 133 + .../r/innodb_defrag_stats_many_tables.result | 38 + mysql-test/suite/innodb/r/innodb_defragment.result | 133 + .../suite/innodb/r/innodb_defragment_small.result | 40 + mysql-test/suite/innodb/r/innodb_force_pk.result | 65 + .../suite/innodb/r/innodb_force_recovery.result | 117 + .../innodb/r/innodb_force_recovery_rollback.result | 18 + mysql-test/suite/innodb/r/innodb_gis.result | 610 ++++ .../innodb/r/innodb_information_schema.result | 52 + .../r/innodb_information_schema_buffer.result | 34 + .../r/innodb_information_schema_tables.result | 2 + .../innodb/r/innodb_lock_wait_timeout_1.result | 361 +++ .../suite/innodb/r/innodb_multi_update.result | 85 + mysql-test/suite/innodb/r/innodb_mysql.result | 3364 ++++++++++++++++++++ mysql-test/suite/innodb/r/innodb_mysql_rbk.result | 30 + .../suite/innodb/r/innodb_notembedded.result | 34 + .../suite/innodb/r/innodb_page_compressed.result | 53 + .../r/innodb_prefix_index_restart_server.result | 92 + .../suite/innodb/r/innodb_query_cache.result | 39 + .../suite/innodb/r/innodb_rename_index.result | 989 ++++++ .../suite/innodb/r/innodb_row_lock_time_ms.result | 40 + mysql-test/suite/innodb/r/innodb_scrub.result | 27 + .../innodb/r/innodb_skip_innodb_is_tables.result | 337 ++ mysql-test/suite/innodb/r/innodb_stats.result | 532 ++++ .../r/innodb_stats_create_on_corrupted.result | 42 + .../innodb/r/innodb_stats_create_table.result | 35 + .../suite/innodb/r/innodb_stats_drop_locked.result | 74 + .../suite/innodb/r/innodb_stats_fetch.result | 152 + .../innodb/r/innodb_stats_fetch_corrupted.result | 49 + .../innodb/r/innodb_stats_fetch_nonexistent.result | 32 + .../suite/innodb/r/innodb_stats_persistent.result | 105 + .../innodb/r/innodb_stats_persistent_debug.result | 24 + .../innodb/r/innodb_stats_rename_table.result | 50 + .../r/innodb_stats_rename_table_if_exists.result | 131 + .../suite/innodb/r/innodb_status_variables.result | 113 + .../suite/innodb/r/innodb_sys_var_valgrind.result | 52 + .../suite/innodb/r/innodb_timeout_rollback.result | 44 + mysql-test/suite/innodb/r/innodb_trx_weight.result | 1 + mysql-test/suite/innodb/r/innodb_uninstall.result | 34 + .../suite/innodb/r/insert-before-delete.result | 35 + mysql-test/suite/innodb/r/insert_debug.result | 31 + .../suite/innodb/r/insert_into_empty,32k.rdiff | 9 + .../suite/innodb/r/insert_into_empty,4k.rdiff | 2 + .../suite/innodb/r/insert_into_empty,64k.rdiff | 9 + mysql-test/suite/innodb/r/insert_into_empty.result | 469 +++ .../suite/innodb/r/insert_into_empty_debug.result | 32 + .../innodb/r/insert_into_empty_notembedded.result | 59 + mysql-test/suite/innodb/r/instant_alter,32k.rdiff | 111 + mysql-test/suite/innodb/r/instant_alter,4k.rdiff | 322 ++ mysql-test/suite/innodb/r/instant_alter,64k.rdiff | 111 + mysql-test/suite/innodb/r/instant_alter,8k.rdiff | 189 ++ mysql-test/suite/innodb/r/instant_alter.result | 2939 +++++++++++++++++ .../suite/innodb/r/instant_alter_bugs.result | 494 +++ .../innodb/r/instant_alter_charset,redundant.rdiff | 58 + .../suite/innodb/r/instant_alter_charset.result | 2078 ++++++++++++ .../suite/innodb/r/instant_alter_crash.result | 228 ++ .../innodb/r/instant_alter_debug,redundant.rdiff | 6 + .../suite/innodb/r/instant_alter_debug.result | 526 +++ .../suite/innodb/r/instant_alter_extend,utf8.rdiff | 38 + .../suite/innodb/r/instant_alter_extend.result | Bin 0 -> 9115 bytes .../suite/innodb/r/instant_alter_import.result | 159 + .../innodb/r/instant_alter_index_rename.result | 248 ++ .../suite/innodb/r/instant_alter_inject.result | 66 + .../suite/innodb/r/instant_alter_limit,16k.rdiff | 13 + .../suite/innodb/r/instant_alter_limit,32k.rdiff | 16 + .../suite/innodb/r/instant_alter_limit,4k.rdiff | 313 ++ .../suite/innodb/r/instant_alter_limit,64k.rdiff | 16 + .../suite/innodb/r/instant_alter_limit,8k.rdiff | 63 + .../suite/innodb/r/instant_alter_limit.result | 47 + .../suite/innodb/r/instant_alter_null.result | 56 + .../innodb/r/instant_alter_purge,release.rdiff | 18 + .../suite/innodb/r/instant_alter_purge.result | 22 + .../suite/innodb/r/instant_alter_rollback.result | 63 + .../suite/innodb/r/instant_alter_upgrade.result | 9 + mysql-test/suite/innodb/r/instant_auto_inc.result | 21 + mysql-test/suite/innodb/r/instant_drop.result | 205 ++ .../r/leaf_page_corrupted_during_recovery.result | 24 + .../suite/innodb/r/lock_delete_updated.result | 22 + mysql-test/suite/innodb/r/lock_deleted.result | 57 + .../suite/innodb/r/lock_insert_into_empty.result | 57 + .../suite/innodb/r/lock_move_wait_lock_race.result | 34 + .../suite/innodb/r/lock_update_split_rc.result | 34 + mysql-test/suite/innodb/r/log_corruption.result | 204 ++ .../suite/innodb/r/log_data_file_size.result | 8 + mysql-test/suite/innodb/r/log_file.result | 304 ++ mysql-test/suite/innodb/r/log_file_name.result | 95 + mysql-test/suite/innodb/r/log_file_size.result | 66 + .../suite/innodb/r/log_file_size_online.result | 47 + mysql-test/suite/innodb/r/log_upgrade.result | 16 + .../r/max_record_size,16k,compact,innodb.rdiff | 80 + .../r/max_record_size,16k,dynamic,innodb.rdiff | 224 ++ .../r/max_record_size,16k,innodb,redundant.rdiff | 80 + .../r/max_record_size,32k,compact,innodb.rdiff | 121 + .../r/max_record_size,32k,dynamic,innodb.rdiff | 366 +++ .../r/max_record_size,32k,innodb,redundant.rdiff | 121 + .../r/max_record_size,4k,compact,innodb.rdiff | 62 + .../r/max_record_size,4k,dynamic,innodb.rdiff | 128 + .../r/max_record_size,4k,innodb,redundant.rdiff | 62 + .../r/max_record_size,64k,compact,innodb.rdiff | 203 ++ .../r/max_record_size,64k,dynamic,innodb.rdiff | 501 +++ .../r/max_record_size,64k,innodb,redundant.rdiff | 121 + .../r/max_record_size,8k,compact,innodb.rdiff | 35 + .../r/max_record_size,8k,dynamic,innodb.rdiff | 134 + mysql-test/suite/innodb/r/max_record_size.result | 47 + mysql-test/suite/innodb/r/mdev-117.result | 18 + mysql-test/suite/innodb/r/mdev-14846.result | 53 + mysql-test/suite/innodb/r/mdev-15707.result | 24 + .../suite/innodb/r/missing_tablespaces.result | 11 + .../innodb/r/mon_lock_wait_current_count.result | 54 + mysql-test/suite/innodb/r/monitor.result | 604 ++++ mysql-test/suite/innodb/r/multi_repair-7404.result | 21 + mysql-test/suite/innodb/r/mvcc.result | 46 + mysql-test/suite/innodb/r/mvcc_secondary.result | 24 + mysql-test/suite/innodb/r/no_pad.result | 7 + .../suite/innodb/r/online_table_rebuild.result | 67 + mysql-test/suite/innodb/r/page_cleaner.result | 14 + .../suite/innodb/r/page_id_innochecksum.result | 8 + mysql-test/suite/innodb/r/page_reorganize.result | 34 + mysql-test/suite/innodb/r/partition_locking.result | 461 +++ mysql-test/suite/innodb/r/purge.result | 118 + mysql-test/suite/innodb/r/purge_secondary.result | 169 + .../suite/innodb/r/purge_thread_shutdown.result | 27 + .../innodb/r/read_only_recover_committed.result | 82 + .../suite/innodb/r/read_only_recovery.result | 44 + mysql-test/suite/innodb/r/readahead.result | 7 + mysql-test/suite/innodb/r/recovery_memory.result | 32 + mysql-test/suite/innodb/r/recovery_shutdown.result | 68 + mysql-test/suite/innodb/r/rename_table.result | 42 + mysql-test/suite/innodb/r/restart,16k,innodb.rdiff | 16 + mysql-test/suite/innodb/r/restart,32k,innodb.rdiff | 16 + mysql-test/suite/innodb/r/restart,4k,innodb.rdiff | 16 + mysql-test/suite/innodb/r/restart,64k,innodb.rdiff | 16 + mysql-test/suite/innodb/r/restart,8k,innodb.rdiff | 16 + mysql-test/suite/innodb/r/restart.result | 52 + .../suite/innodb/r/row_format_redundant.result | 76 + mysql-test/suite/innodb/r/row_lock.result | 23 + .../innodb/r/row_size_error_log_warnings_3.result | 84 + mysql-test/suite/innodb/r/scrub.result | 12 + mysql-test/suite/innodb/r/scrub_debug.result | 19 + .../suite/innodb/r/skip_locked_nowait.result | 205 ++ .../suite/innodb/r/skip_symbolic_links.result | 56 + mysql-test/suite/innodb/r/snapshot.result | 10 + mysql-test/suite/innodb/r/sp_temp_table.result | 253 ++ .../r/sql_mode_pad_char_to_full_length.result | 51 + mysql-test/suite/innodb/r/stat_tables.result | 85 + mysql-test/suite/innodb/r/stats_persistent.result | 19 + mysql-test/suite/innodb/r/stored_fk.result | 75 + mysql-test/suite/innodb/r/strict_mode.result | 413 +++ mysql-test/suite/innodb/r/system_tables.result | 9 + .../innodb/r/table_definition_cache_debug.result | 23 + mysql-test/suite/innodb/r/table_flags,32k.rdiff | 20 + mysql-test/suite/innodb/r/table_flags,64k.rdiff | 20 + mysql-test/suite/innodb/r/table_flags.result | 192 ++ .../suite/innodb/r/table_index_statistics.result | 48 + mysql-test/suite/innodb/r/temp_table.result | 597 ++++ .../suite/innodb/r/temp_table_savepoint.result | 242 ++ mysql-test/suite/innodb/r/temporary_table.result | 804 +++++ .../innodb/r/temporary_table_optimization.result | 257 ++ mysql-test/suite/innodb/r/tmpdir.result | 55 + mysql-test/suite/innodb/r/trigger.result | 28 + mysql-test/suite/innodb/r/trigger_error.result | 28 + mysql-test/suite/innodb/r/truncate.result | 62 + mysql-test/suite/innodb/r/truncate_crash.result | 16 + mysql-test/suite/innodb/r/truncate_foreign.result | 101 + mysql-test/suite/innodb/r/truncate_missing.result | 18 + mysql-test/suite/innodb/r/trx_id_future.result | 13 + .../innodb/r/trx_sys_t_find_lf_hash_error.result | 25 + mysql-test/suite/innodb/r/undo_log.result | 156 + mysql-test/suite/innodb/r/undo_space_dblwr.result | 20 + mysql-test/suite/innodb/r/undo_truncate.result | 40 + .../suite/innodb/r/undo_truncate_recover.result | 16 + mysql-test/suite/innodb/r/undo_upgrade.result | 64 + .../suite/innodb/r/undo_upgrade_debug.result | 43 + mysql-test/suite/innodb/r/update-cascade.result | 290 ++ mysql-test/suite/innodb/r/update_time.result | 38 + .../suite/innodb/r/update_time_wl6658.result | 229 ++ mysql-test/suite/innodb/r/xa_debug.result | 362 +++ .../innodb/r/xa_prepare_reset_supremum_lock.result | 33 + mysql-test/suite/innodb/r/xa_recovery.result | 39 + mysql-test/suite/innodb/r/xa_recovery_debug.result | 27 + .../r/xap_release_locks_on_dict_stats_table.result | 17 + 457 files changed, 70622 insertions(+) create mode 100644 mysql-test/suite/innodb/r/101_compatibility.result create mode 100644 mysql-test/suite/innodb/r/add_constraint.result create mode 100644 mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_algorithm.result create mode 100644 mysql-test/suite/innodb/r/alter_algorithm2.result create mode 100644 mysql-test/suite/innodb/r/alter_candidate_key.result create mode 100644 mysql-test/suite/innodb/r/alter_copy.result create mode 100644 mysql-test/suite/innodb/r/alter_crash.result create mode 100644 mysql-test/suite/innodb/r/alter_crash_rebuild.result create mode 100644 mysql-test/suite/innodb/r/alter_dml_apply.result create mode 100644 mysql-test/suite/innodb/r/alter_foreign_crash.result create mode 100644 mysql-test/suite/innodb/r/alter_inplace_perfschema.result create mode 100644 mysql-test/suite/innodb/r/alter_key_block_size-11757.result create mode 100644 mysql-test/suite/innodb/r/alter_kill.result create mode 100644 mysql-test/suite/innodb/r/alter_large_dml.result create mode 100644 mysql-test/suite/innodb/r/alter_mdl_timeout.result create mode 100644 mysql-test/suite/innodb/r/alter_missing_tablespace.result create mode 100644 mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_not_null.result create mode 100644 mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_not_null_debug.result create mode 100644 mysql-test/suite/innodb/r/alter_partitioned.result create mode 100644 mysql-test/suite/innodb/r/alter_partitioned_debug.result create mode 100644 mysql-test/suite/innodb/r/alter_partitioned_xa.result create mode 100644 mysql-test/suite/innodb/r/alter_persistent_autoinc.result create mode 100644 mysql-test/suite/innodb/r/alter_primary_key.result create mode 100644 mysql-test/suite/innodb/r/alter_rename_existing.result create mode 100644 mysql-test/suite/innodb/r/alter_table.result create mode 100644 mysql-test/suite/innodb/r/alter_table_upgrade.result create mode 100644 mysql-test/suite/innodb/r/alter_varchar_change.result create mode 100644 mysql-test/suite/innodb/r/analyze_table.result create mode 100644 mysql-test/suite/innodb/r/auto_increment_dup.result create mode 100644 mysql-test/suite/innodb/r/autoinc_debug.result create mode 100644 mysql-test/suite/innodb/r/autoinc_persist,desc.rdiff create mode 100644 mysql-test/suite/innodb/r/autoinc_persist.result create mode 100644 mysql-test/suite/innodb/r/binlog_consistent.result create mode 100644 mysql-test/suite/innodb/r/blob-crash.result create mode 100644 mysql-test/suite/innodb/r/blob-update-debug.result create mode 100644 mysql-test/suite/innodb/r/blob_cmp_empty.result create mode 100644 mysql-test/suite/innodb/r/blob_unique2pk.result create mode 100644 mysql-test/suite/innodb/r/buf_pool_resize_oom.result create mode 100644 mysql-test/suite/innodb/r/change_column_collation.result create mode 100644 mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff create mode 100644 mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff create mode 100644 mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff create mode 100644 mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff create mode 100644 mysql-test/suite/innodb/r/check_ibd_filesize.result create mode 100644 mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_loaded.result create mode 100644 mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff create mode 100644 mysql-test/suite/innodb/r/compression_providers_unloaded.result create mode 100644 mysql-test/suite/innodb/r/corrupted_during_recovery.result create mode 100644 mysql-test/suite/innodb/r/count_distinct.result create mode 100644 mysql-test/suite/innodb/r/create-index.result create mode 100644 mysql-test/suite/innodb/r/create_isl_with_direct.result create mode 100644 mysql-test/suite/innodb/r/create_select.result create mode 100644 mysql-test/suite/innodb/r/create_table_insert_skip_locked.result create mode 100644 mysql-test/suite/innodb/r/cursor-restore-locking.result create mode 100644 mysql-test/suite/innodb/r/data_types.result create mode 100644 mysql-test/suite/innodb/r/ddl_purge.result create mode 100644 mysql-test/suite/innodb/r/deadlock_detect,ON.rdiff create mode 100644 mysql-test/suite/innodb/r/deadlock_detect.result create mode 100644 mysql-test/suite/innodb/r/deadlock_in_subqueries_join.result create mode 100644 mysql-test/suite/innodb/r/deadlock_on_lock_upgrade.result create mode 100644 mysql-test/suite/innodb/r/deadlock_victim_race.result create mode 100644 mysql-test/suite/innodb/r/deadlock_wait_lock_race.result create mode 100644 mysql-test/suite/innodb/r/deadlock_wait_thr_race.result create mode 100644 mysql-test/suite/innodb/r/default_row_format_alter,compact.rdiff create mode 100644 mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/default_row_format_alter.result create mode 100644 mysql-test/suite/innodb/r/default_row_format_compatibility.result create mode 100644 mysql-test/suite/innodb/r/default_row_format_create,dynamic.rdiff create mode 100644 mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/default_row_format_create.result create mode 100644 mysql-test/suite/innodb/r/defrag_mdl-9155.result create mode 100644 mysql-test/suite/innodb/r/dml_purge.result create mode 100644 mysql-test/suite/innodb/r/doublewrite.result create mode 100644 mysql-test/suite/innodb/r/dropdb.result create mode 100644 mysql-test/suite/innodb/r/dropdb_cs.result create mode 100644 mysql-test/suite/innodb/r/encryption_threads_shutdown.result create mode 100644 mysql-test/suite/innodb/r/evict_tables_on_commit_debug.result create mode 100644 mysql-test/suite/innodb/r/file_format_defaults.result create mode 100644 mysql-test/suite/innodb/r/fk_col_alter.result create mode 100644 mysql-test/suite/innodb/r/flush.result create mode 100644 mysql-test/suite/innodb/r/foreign-keys.result create mode 100644 mysql-test/suite/innodb/r/foreign_key.result create mode 100644 mysql-test/suite/innodb/r/foreign_key_debug.result create mode 100644 mysql-test/suite/innodb/r/foreign_key_not_windows.result create mode 100644 mysql-test/suite/innodb/r/full_crc32_import.result create mode 100644 mysql-test/suite/innodb/r/gap_lock_split.result create mode 100644 mysql-test/suite/innodb/r/gap_locks.result create mode 100644 mysql-test/suite/innodb/r/group_commit.result create mode 100644 mysql-test/suite/innodb/r/group_commit_binlog_pos.result create mode 100644 mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result create mode 100644 mysql-test/suite/innodb/r/group_commit_crash.result create mode 100644 mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result create mode 100644 mysql-test/suite/innodb/r/group_commit_force_recovery.result create mode 100644 mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result create mode 100644 mysql-test/suite/innodb/r/help_url.result create mode 100644 mysql-test/suite/innodb/r/ibuf_delete.result create mode 100644 mysql-test/suite/innodb/r/ibuf_not_empty.result create mode 100644 mysql-test/suite/innodb/r/implicit_gap_lock_convertion.result create mode 100644 mysql-test/suite/innodb/r/import_bugs.result create mode 100644 mysql-test/suite/innodb/r/import_corrupted.result create mode 100644 mysql-test/suite/innodb/r/import_tablespace_race.result create mode 100644 mysql-test/suite/innodb/r/index_merge_threshold.result create mode 100644 mysql-test/suite/innodb/r/index_tree_operation.result create mode 100644 mysql-test/suite/innodb/r/index_vcol_purge_startup.result create mode 100644 mysql-test/suite/innodb/r/information_schema_grants.result create mode 100644 mysql-test/suite/innodb/r/innodb-16k.result create mode 100644 mysql-test/suite/innodb/r/innodb-32k-crash.result create mode 100644 mysql-test/suite/innodb/r/innodb-32k.result create mode 100644 mysql-test/suite/innodb/r/innodb-64k-crash.result create mode 100644 mysql-test/suite/innodb/r/innodb-64k.result create mode 100644 mysql-test/suite/innodb/r/innodb-agregate.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter-autoinc.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter-debug.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter-nullable.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter-table.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter-tempfile.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter-timestamp.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter.result create mode 100644 mysql-test/suite/innodb/r/innodb-analyze.result create mode 100644 mysql-test/suite/innodb/r/innodb-autoinc-18274.result create mode 100644 mysql-test/suite/innodb/r/innodb-autoinc-44030.result create mode 100644 mysql-test/suite/innodb/r/innodb-autoinc-56228.result create mode 100644 mysql-test/suite/innodb/r/innodb-autoinc-61209.result create mode 100644 mysql-test/suite/innodb/r/innodb-autoinc-optimize.result create mode 100644 mysql-test/suite/innodb/r/innodb-autoinc-part.result create mode 100644 mysql-test/suite/innodb/r/innodb-autoinc.result create mode 100644 mysql-test/suite/innodb/r/innodb-bigblob.result create mode 100644 mysql-test/suite/innodb/r/innodb-blob.result create mode 100644 mysql-test/suite/innodb/r/innodb-bug-14068765.result create mode 100644 mysql-test/suite/innodb/r/innodb-bug-14084530.result create mode 100644 mysql-test/suite/innodb/r/innodb-consistent.result create mode 100644 mysql-test/suite/innodb/r/innodb-corrupted-table.result create mode 100644 mysql-test/suite/innodb/r/innodb-dict.result create mode 100644 mysql-test/suite/innodb/r/innodb-enlarge-blob.result create mode 100644 mysql-test/suite/innodb/r/innodb-fk-virtual.result create mode 100644 mysql-test/suite/innodb/r/innodb-fk-warnings.result create mode 100644 mysql-test/suite/innodb/r/innodb-fk.result create mode 100644 mysql-test/suite/innodb/r/innodb-fkcheck.result create mode 100644 mysql-test/suite/innodb/r/innodb-get-fk.result create mode 100644 mysql-test/suite/innodb/r/innodb-index-debug.result create mode 100644 mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff create mode 100644 mysql-test/suite/innodb/r/innodb-index-online-delete.result create mode 100644 mysql-test/suite/innodb/r/innodb-index-online-fk.result create mode 100644 mysql-test/suite/innodb/r/innodb-index-online-norebuild.result create mode 100644 mysql-test/suite/innodb/r/innodb-index-online-purge.result create mode 100644 mysql-test/suite/innodb/r/innodb-index-online.result create mode 100644 mysql-test/suite/innodb/r/innodb-index.result create mode 100644 mysql-test/suite/innodb/r/innodb-index_ucs2.result create mode 100644 mysql-test/suite/innodb/r/innodb-isolation.result create mode 100644 mysql-test/suite/innodb/r/innodb-lock.result create mode 100644 mysql-test/suite/innodb/r/innodb-lru-force-no-free-page.result create mode 100644 mysql-test/suite/innodb/r/innodb-mdev-7408.result create mode 100644 mysql-test/suite/innodb/r/innodb-mdev-7513.result create mode 100644 mysql-test/suite/innodb/r/innodb-mdev7046.result create mode 100644 mysql-test/suite/innodb/r/innodb-on-duplicate-update.result create mode 100644 mysql-test/suite/innodb/r/innodb-online-alter-gis.result create mode 100644 mysql-test/suite/innodb/r/innodb-page_compression_none.result create mode 100644 mysql-test/suite/innodb/r/innodb-read-view.result create mode 100644 mysql-test/suite/innodb/r/innodb-replace-debug.result create mode 100644 mysql-test/suite/innodb/r/innodb-replace.result create mode 100644 mysql-test/suite/innodb/r/innodb-rollback.result create mode 100644 mysql-test/suite/innodb/r/innodb-semi-consistent.result create mode 100644 mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result create mode 100644 mysql-test/suite/innodb/r/innodb-stats-modified-counter.result create mode 100644 mysql-test/suite/innodb/r/innodb-stats-sample.result create mode 100644 mysql-test/suite/innodb/r/innodb-system-table-view.result create mode 100644 mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff create mode 100644 mysql-test/suite/innodb/r/innodb-table-online.result create mode 100644 mysql-test/suite/innodb/r/innodb-timeout.result create mode 100644 mysql-test/suite/innodb/r/innodb-trim.result create mode 100644 mysql-test/suite/innodb/r/innodb-truncate.result create mode 100644 mysql-test/suite/innodb/r/innodb-ucs2.result create mode 100644 mysql-test/suite/innodb/r/innodb-update-insert.result create mode 100644 mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result create mode 100644 mysql-test/suite/innodb/r/innodb-virtual-columns.result create mode 100644 mysql-test/suite/innodb/r/innodb-virtual-columns2.result create mode 100644 mysql-test/suite/innodb/r/innodb-wl5522,crc32.rdiff create mode 100644 mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff create mode 100644 mysql-test/suite/innodb/r/innodb-wl5522-1.result create mode 100644 mysql-test/suite/innodb/r/innodb-wl5522-debug.result create mode 100644 mysql-test/suite/innodb/r/innodb-wl5522.result create mode 100644 mysql-test/suite/innodb/r/innodb-wl5980-alter.result create mode 100644 mysql-test/suite/innodb/r/innodb-xa.result create mode 100644 mysql-test/suite/innodb/r/innodb.result create mode 100644 mysql-test/suite/innodb/r/innodb_28867993.result create mode 100644 mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug11754376.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug12400341.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug12661768.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug12902967.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug13510739.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug14007649.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug14147491.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug14676111.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug21704.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug27216817.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug30113362.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug30423.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug30919.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug34300.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug35220.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug38231.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug39438.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug40360.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug40565.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug41904.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug42419.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug44032.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug44369.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug44571.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug45357.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug46000.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug46676.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug47621.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug47622.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug47777.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug48024.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug49164.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug51378.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug51920.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug52199.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug52663.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug53046.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug53290.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug53592.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug53674.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug53756.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug56143.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug56716.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug56947.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug57252.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug57255.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug57904.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug59307.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug59410.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug59641.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug59733.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug60049.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug60196.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug60229.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug68148.result create mode 100644 mysql-test/suite/innodb/r/innodb_bug84958.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result create mode 100644 mysql-test/suite/innodb/r/innodb_corrupt_bit.result create mode 100644 mysql-test/suite/innodb/r/innodb_ctype_big5.result create mode 100644 mysql-test/suite/innodb/r/innodb_ctype_latin1.result create mode 100644 mysql-test/suite/innodb/r/innodb_ctype_ldml.result create mode 100644 mysql-test/suite/innodb/r/innodb_ctype_tis620.result create mode 100644 mysql-test/suite/innodb/r/innodb_ctype_utf8.result create mode 100644 mysql-test/suite/innodb/r/innodb_defrag_binlog.result create mode 100644 mysql-test/suite/innodb/r/innodb_defrag_concurrent.result create mode 100644 mysql-test/suite/innodb/r/innodb_defrag_stats.result create mode 100644 mysql-test/suite/innodb/r/innodb_defrag_stats_many_tables.result create mode 100644 mysql-test/suite/innodb/r/innodb_defragment.result create mode 100644 mysql-test/suite/innodb/r/innodb_defragment_small.result create mode 100644 mysql-test/suite/innodb/r/innodb_force_pk.result create mode 100644 mysql-test/suite/innodb/r/innodb_force_recovery.result create mode 100644 mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result create mode 100644 mysql-test/suite/innodb/r/innodb_gis.result create mode 100644 mysql-test/suite/innodb/r/innodb_information_schema.result create mode 100644 mysql-test/suite/innodb/r/innodb_information_schema_buffer.result create mode 100644 mysql-test/suite/innodb/r/innodb_information_schema_tables.result create mode 100644 mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result create mode 100644 mysql-test/suite/innodb/r/innodb_multi_update.result create mode 100644 mysql-test/suite/innodb/r/innodb_mysql.result create mode 100644 mysql-test/suite/innodb/r/innodb_mysql_rbk.result create mode 100644 mysql-test/suite/innodb/r/innodb_notembedded.result create mode 100644 mysql-test/suite/innodb/r/innodb_page_compressed.result create mode 100644 mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result create mode 100644 mysql-test/suite/innodb/r/innodb_query_cache.result create mode 100644 mysql-test/suite/innodb/r/innodb_rename_index.result create mode 100644 mysql-test/suite/innodb/r/innodb_row_lock_time_ms.result create mode 100644 mysql-test/suite/innodb/r/innodb_scrub.result create mode 100644 mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_create_on_corrupted.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_create_table.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_drop_locked.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_fetch.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_persistent.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_rename_table.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_rename_table_if_exists.result create mode 100644 mysql-test/suite/innodb/r/innodb_status_variables.result create mode 100644 mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result create mode 100644 mysql-test/suite/innodb/r/innodb_timeout_rollback.result create mode 100644 mysql-test/suite/innodb/r/innodb_trx_weight.result create mode 100644 mysql-test/suite/innodb/r/innodb_uninstall.result create mode 100644 mysql-test/suite/innodb/r/insert-before-delete.result create mode 100644 mysql-test/suite/innodb/r/insert_debug.result create mode 100644 mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff create mode 100644 mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff create mode 100644 mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff create mode 100644 mysql-test/suite/innodb/r/insert_into_empty.result create mode 100644 mysql-test/suite/innodb/r/insert_into_empty_debug.result create mode 100644 mysql-test/suite/innodb/r/insert_into_empty_notembedded.result create mode 100644 mysql-test/suite/innodb/r/instant_alter,32k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter,4k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter,64k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter,8k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_bugs.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_charset.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_crash.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_debug.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_extend,utf8.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_extend.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_import.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_index_rename.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_inject.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_limit.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_null.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff create mode 100644 mysql-test/suite/innodb/r/instant_alter_purge.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_rollback.result create mode 100644 mysql-test/suite/innodb/r/instant_alter_upgrade.result create mode 100644 mysql-test/suite/innodb/r/instant_auto_inc.result create mode 100644 mysql-test/suite/innodb/r/instant_drop.result create mode 100644 mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result create mode 100644 mysql-test/suite/innodb/r/lock_delete_updated.result create mode 100644 mysql-test/suite/innodb/r/lock_deleted.result create mode 100644 mysql-test/suite/innodb/r/lock_insert_into_empty.result create mode 100644 mysql-test/suite/innodb/r/lock_move_wait_lock_race.result create mode 100644 mysql-test/suite/innodb/r/lock_update_split_rc.result create mode 100644 mysql-test/suite/innodb/r/log_corruption.result create mode 100644 mysql-test/suite/innodb/r/log_data_file_size.result create mode 100644 mysql-test/suite/innodb/r/log_file.result create mode 100644 mysql-test/suite/innodb/r/log_file_name.result create mode 100644 mysql-test/suite/innodb/r/log_file_size.result create mode 100644 mysql-test/suite/innodb/r/log_file_size_online.result create mode 100644 mysql-test/suite/innodb/r/log_upgrade.result create mode 100644 mysql-test/suite/innodb/r/max_record_size,16k,compact,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,16k,dynamic,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,16k,innodb,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,32k,compact,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,32k,dynamic,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,32k,innodb,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,4k,compact,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,4k,dynamic,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,4k,innodb,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,64k,compact,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,64k,dynamic,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,64k,innodb,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,8k,compact,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size,8k,dynamic,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/max_record_size.result create mode 100644 mysql-test/suite/innodb/r/mdev-117.result create mode 100644 mysql-test/suite/innodb/r/mdev-14846.result create mode 100644 mysql-test/suite/innodb/r/mdev-15707.result create mode 100644 mysql-test/suite/innodb/r/missing_tablespaces.result create mode 100644 mysql-test/suite/innodb/r/mon_lock_wait_current_count.result create mode 100644 mysql-test/suite/innodb/r/monitor.result create mode 100644 mysql-test/suite/innodb/r/multi_repair-7404.result create mode 100644 mysql-test/suite/innodb/r/mvcc.result create mode 100644 mysql-test/suite/innodb/r/mvcc_secondary.result create mode 100644 mysql-test/suite/innodb/r/no_pad.result create mode 100644 mysql-test/suite/innodb/r/online_table_rebuild.result create mode 100644 mysql-test/suite/innodb/r/page_cleaner.result create mode 100644 mysql-test/suite/innodb/r/page_id_innochecksum.result create mode 100644 mysql-test/suite/innodb/r/page_reorganize.result create mode 100644 mysql-test/suite/innodb/r/partition_locking.result create mode 100644 mysql-test/suite/innodb/r/purge.result create mode 100644 mysql-test/suite/innodb/r/purge_secondary.result create mode 100644 mysql-test/suite/innodb/r/purge_thread_shutdown.result create mode 100644 mysql-test/suite/innodb/r/read_only_recover_committed.result create mode 100644 mysql-test/suite/innodb/r/read_only_recovery.result create mode 100644 mysql-test/suite/innodb/r/readahead.result create mode 100644 mysql-test/suite/innodb/r/recovery_memory.result create mode 100644 mysql-test/suite/innodb/r/recovery_shutdown.result create mode 100644 mysql-test/suite/innodb/r/rename_table.result create mode 100644 mysql-test/suite/innodb/r/restart,16k,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/restart,32k,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/restart,4k,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/restart,64k,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/restart,8k,innodb.rdiff create mode 100644 mysql-test/suite/innodb/r/restart.result create mode 100644 mysql-test/suite/innodb/r/row_format_redundant.result create mode 100644 mysql-test/suite/innodb/r/row_lock.result create mode 100644 mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result create mode 100644 mysql-test/suite/innodb/r/scrub.result create mode 100644 mysql-test/suite/innodb/r/scrub_debug.result create mode 100644 mysql-test/suite/innodb/r/skip_locked_nowait.result create mode 100644 mysql-test/suite/innodb/r/skip_symbolic_links.result create mode 100644 mysql-test/suite/innodb/r/snapshot.result create mode 100644 mysql-test/suite/innodb/r/sp_temp_table.result create mode 100644 mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result create mode 100644 mysql-test/suite/innodb/r/stat_tables.result create mode 100644 mysql-test/suite/innodb/r/stats_persistent.result create mode 100644 mysql-test/suite/innodb/r/stored_fk.result create mode 100644 mysql-test/suite/innodb/r/strict_mode.result create mode 100644 mysql-test/suite/innodb/r/system_tables.result create mode 100644 mysql-test/suite/innodb/r/table_definition_cache_debug.result create mode 100644 mysql-test/suite/innodb/r/table_flags,32k.rdiff create mode 100644 mysql-test/suite/innodb/r/table_flags,64k.rdiff create mode 100644 mysql-test/suite/innodb/r/table_flags.result create mode 100644 mysql-test/suite/innodb/r/table_index_statistics.result create mode 100644 mysql-test/suite/innodb/r/temp_table.result create mode 100644 mysql-test/suite/innodb/r/temp_table_savepoint.result create mode 100644 mysql-test/suite/innodb/r/temporary_table.result create mode 100644 mysql-test/suite/innodb/r/temporary_table_optimization.result create mode 100644 mysql-test/suite/innodb/r/tmpdir.result create mode 100644 mysql-test/suite/innodb/r/trigger.result create mode 100644 mysql-test/suite/innodb/r/trigger_error.result create mode 100644 mysql-test/suite/innodb/r/truncate.result create mode 100644 mysql-test/suite/innodb/r/truncate_crash.result create mode 100644 mysql-test/suite/innodb/r/truncate_foreign.result create mode 100644 mysql-test/suite/innodb/r/truncate_missing.result create mode 100644 mysql-test/suite/innodb/r/trx_id_future.result create mode 100644 mysql-test/suite/innodb/r/trx_sys_t_find_lf_hash_error.result create mode 100644 mysql-test/suite/innodb/r/undo_log.result create mode 100644 mysql-test/suite/innodb/r/undo_space_dblwr.result create mode 100644 mysql-test/suite/innodb/r/undo_truncate.result create mode 100644 mysql-test/suite/innodb/r/undo_truncate_recover.result create mode 100644 mysql-test/suite/innodb/r/undo_upgrade.result create mode 100644 mysql-test/suite/innodb/r/undo_upgrade_debug.result create mode 100644 mysql-test/suite/innodb/r/update-cascade.result create mode 100644 mysql-test/suite/innodb/r/update_time.result create mode 100644 mysql-test/suite/innodb/r/update_time_wl6658.result create mode 100644 mysql-test/suite/innodb/r/xa_debug.result create mode 100644 mysql-test/suite/innodb/r/xa_prepare_reset_supremum_lock.result create mode 100644 mysql-test/suite/innodb/r/xa_recovery.result create mode 100644 mysql-test/suite/innodb/r/xa_recovery_debug.result create mode 100644 mysql-test/suite/innodb/r/xap_release_locks_on_dict_stats_table.result (limited to 'mysql-test/suite/innodb/r') diff --git a/mysql-test/suite/innodb/r/101_compatibility.result b/mysql-test/suite/innodb/r/101_compatibility.result new file mode 100644 index 00000000..3782ea83 --- /dev/null +++ b/mysql-test/suite/innodb/r/101_compatibility.result @@ -0,0 +1,50 @@ +# +# MDEV-11623 MariaDB 10.1 fails to start datadir created with +# MariaDB 10.0/MySQL 5.6 using innodb-page-size!=16K +# +CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT; +CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SET INNODB_STRICT_MODE=OFF; +CREATE TABLE tz(a INT)ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +SET INNODB_STRICT_MODE=ON; +CREATE TABLE tdd(a INT) ENGINE=InnoDB, DATA DIRECTORY='MYSQL_TMP_DIR'; +CREATE TABLE tp(a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC PAGE_COMPRESSED=1; +CREATE TABLE ti(a INT) ENGINE=InnoDB; +FLUSH TABLES ti FOR EXPORT; +backup: ti +UNLOCK TABLES; +ALTER TABLE ti DISCARD TABLESPACE; +restore: ti .ibd and .cfg files +ALTER TABLE ti IMPORT TABLESPACE; +BEGIN; +INSERT INTO tr VALUES(1); +INSERT INTO tc VALUES(1); +INSERT INTO td VALUES(1); +INSERT INTO tz VALUES(1); +INSERT INTO tdd VALUES(1); +INSERT INTO tp VALUES(1); +INSERT INTO ti VALUES(1); +# Kill the server +# restart +CHECK TABLE tr,tc,td,tz,tdd,tp,ti; +Table Op Msg_type Msg_text +test.tr check status OK +test.tc check status OK +test.td check status OK +test.tz check status OK +test.tdd check status OK +test.tp check status OK +test.ti check status OK +# restart: --innodb-read-only +CHECK TABLE tr,tc,td,tz,tdd,tp,ti; +Table Op Msg_type Msg_text +test.tr check status OK +test.tc check status OK +test.td check status OK +test.tz check status OK +test.tdd check status OK +test.tp check status OK +test.ti check status OK +# restart +DROP TABLE tr,tc,td,tz,tdd,tp,ti; diff --git a/mysql-test/suite/innodb/r/add_constraint.result b/mysql-test/suite/innodb/r/add_constraint.result new file mode 100644 index 00000000..9d894e53 --- /dev/null +++ b/mysql-test/suite/innodb/r/add_constraint.result @@ -0,0 +1,13 @@ +# +# Bug #20762798 FK DDL: CRASH IN DICT_FOREIGN_REMOVE_FROM_CACHE +# +create table t1(a int, b int, key(a),key(b))engine=innodb; +create table t2(a int, b int, key(a),key(b))engine=innodb; +alter table t2 add constraint b foreign key (b) references t1(a); +alter table t1 add constraint b1 foreign key (b) references t2(a); +alter table t2 add constraint b1 foreign key (b) references t1(a); +ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") +alter table t2 drop foreign key b; +alter table t1 drop foreign key b1; +drop table t2; +drop table t1; diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff new file mode 100644 index 00000000..a176a9af --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff @@ -0,0 +1,155 @@ +--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 ++++ alter_algorithm.reject 2020-04-30 21:45:04.131642093 +0530 +@@ -7,43 +7,43 @@ + INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); + SELECT @@alter_algorithm; + @@alter_algorithm +-COPY ++INPLACE + # All the following cases needs table rebuild + # Add and Drop primary key + ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Make existing column NULLABLE + ALTER TABLE t1 MODIFY f2 INT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Drop Stored Column + ALTER TABLE t1 DROP COLUMN f5; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Add base non-generated column as a last column in the compressed table + ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Add base non-generated column but not in the last position + ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Force the table to rebuild + ALTER TABLE t1 FORCE; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Row format changes + ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Engine table + ALTER TABLE t1 ENGINE=INNODB; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t1; + affected rows: 0 + CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, +@@ -56,22 +56,22 @@ + FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; + INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); + ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + SET foreign_key_checks = 0; + affected rows: 0 + ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t2, t1; + affected rows: 0 + CREATE TABLE t1(f1 INT NOT NULL, +@@ -84,28 +84,27 @@ + INSERT INTO t1(f1, f2) VALUES(1, 1); + # Add column at the end of the table + ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Change virtual column expression + ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Add virtual column + ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Rename Column + ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Rename table + ALTER TABLE t1 RENAME t3; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 + # Drop Virtual Column + ALTER TABLE t3 DROP COLUMN vcol; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Column length varies + ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); + affected rows: 0 +@@ -113,12 +112,12 @@ + SET foreign_key_checks = 0; + affected rows: 0 + ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + SET foreign_key_checks = 1; + affected rows: 0 + ALTER TABLE t3 DROP FOREIGN KEY fidx; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t3, t2; + affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff new file mode 100644 index 00000000..414b7dc8 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff @@ -0,0 +1,142 @@ +--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 ++++ alter_algorithm.reject 2020-04-30 21:47:08.245465018 +0530 +@@ -7,43 +7,35 @@ + INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); + SELECT @@alter_algorithm; + @@alter_algorithm +-COPY ++INSTANT + # All the following cases needs table rebuild + # Add and Drop primary key + ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Make existing column NULLABLE + ALTER TABLE t1 MODIFY f2 INT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Drop Stored Column + ALTER TABLE t1 DROP COLUMN f5; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Add base non-generated column as a last column in the compressed table + ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Add base non-generated column but not in the last position + ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Force the table to rebuild + ALTER TABLE t1 FORCE; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Row format changes + ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Engine table + ALTER TABLE t1 ENGINE=INNODB; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t1; + affected rows: 0 + CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, +@@ -56,22 +48,17 @@ + FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; + INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); + ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY + ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY + ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY + ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY + SET foreign_key_checks = 0; + affected rows: 0 + ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY + DROP TABLE t2, t1; + affected rows: 0 + CREATE TABLE t1(f1 INT NOT NULL, +@@ -84,28 +71,27 @@ + INSERT INTO t1(f1, f2) VALUES(1, 1); + # Add column at the end of the table + ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Change virtual column expression + ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Add virtual column + ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Rename Column + ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Rename table + ALTER TABLE t1 RENAME t3; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 + # Drop Virtual Column + ALTER TABLE t3 DROP COLUMN vcol; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Column length varies + ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); + affected rows: 0 +@@ -113,12 +99,12 @@ + SET foreign_key_checks = 0; + affected rows: 0 + ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + SET foreign_key_checks = 1; + affected rows: 0 + ALTER TABLE t3 DROP FOREIGN KEY fidx; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t3, t2; + affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff new file mode 100644 index 00000000..2aa8c722 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff @@ -0,0 +1,147 @@ +--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 ++++ alter_algorithm.reject 2020-04-30 21:52:10.785967739 +0530 +@@ -7,43 +7,35 @@ + INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); + SELECT @@alter_algorithm; + @@alter_algorithm +-COPY ++NOCOPY + # All the following cases needs table rebuild + # Add and Drop primary key + ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Make existing column NULLABLE + ALTER TABLE t1 MODIFY f2 INT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Drop Stored Column + ALTER TABLE t1 DROP COLUMN f5; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Add base non-generated column as a last column in the compressed table + ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Add base non-generated column but not in the last position + ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Force the table to rebuild + ALTER TABLE t1 FORCE; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Row format changes + ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + # Engine table + ALTER TABLE t1 ENGINE=INNODB; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++Got one of the listed errors + ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t1; + affected rows: 0 + CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, +@@ -56,22 +48,22 @@ + FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; + INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); + ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + SET foreign_key_checks = 0; + affected rows: 0 + ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t2, t1; + affected rows: 0 + CREATE TABLE t1(f1 INT NOT NULL, +@@ -84,28 +76,27 @@ + INSERT INTO t1(f1, f2) VALUES(1, 1); + # Add column at the end of the table + ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Change virtual column expression + ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Add virtual column + ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Rename Column + ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Rename table + ALTER TABLE t1 RENAME t3; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 + # Drop Virtual Column + ALTER TABLE t3 DROP COLUMN vcol; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + # Column length varies + ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); + affected rows: 0 +@@ -113,12 +104,12 @@ + SET foreign_key_checks = 0; + affected rows: 0 + ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + SET foreign_key_checks = 1; + affected rows: 0 + ALTER TABLE t3 DROP FOREIGN KEY fidx; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 + DROP TABLE t3, t2; + affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result new file mode 100644 index 00000000..717d31de --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_algorithm.result @@ -0,0 +1,124 @@ +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT NULL, +f4 INT as (f2) STORED, +f5 INT as (f3) STORED, +PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); +SELECT @@alter_algorithm; +@@alter_algorithm +COPY +# All the following cases needs table rebuild +# Add and Drop primary key +ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Make existing column NULLABLE +ALTER TABLE t1 MODIFY f2 INT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Drop Stored Column +ALTER TABLE t1 DROP COLUMN f5; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Add base non-generated column as a last column in the compressed table +ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Add base non-generated column but not in the last position +ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Force the table to rebuild +ALTER TABLE t1 FORCE; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Row format changes +ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Engine table +ALTER TABLE t1 ENGINE=INNODB; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +affected rows: 0 +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +f4 INT NOT NULL UNIQUE, +f5 INT NOT NULL, +INDEX idx(f2))ENGINE=INNODB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1), +FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); +ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t2, t1; +affected rows: 0 +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +INDEX idx (f2))engine=innodb; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +f3 VARCHAR(10), +INDEX(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2) VALUES(1, 1); +# Add column at the end of the table +ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Change virtual column expression +ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Add virtual column +ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Rename Column +ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Rename table +ALTER TABLE t1 RENAME t3; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Drop Virtual Column +ALTER TABLE t3 DROP COLUMN vcol; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Column length varies +ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 1; +affected rows: 0 +ALTER TABLE t3 DROP FOREIGN KEY fidx; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t3, t2; +affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm2.result b/mysql-test/suite/innodb/r/alter_algorithm2.result new file mode 100644 index 00000000..f4443c80 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_algorithm2.result @@ -0,0 +1,81 @@ +CREATE TABLE t1 (a INT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +SET alter_algorithm='INPLACE'; +affected rows: 0 +PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)'; +affected rows: 0 +info: Statement prepared +PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx'; +affected rows: 0 +info: Statement prepared +CREATE OR REPLACE PROCEDURE p1() +BEGIN +ALTER TABLE t1 ADD KEY idx2(a); +END| +affected rows: 0 +CREATE OR REPLACE PROCEDURE p2() +BEGIN +ALTER TABLE t1 DROP KEY idx2; +END| +affected rows: 0 +SET alter_algorithm='COPY'; +affected rows: 0 +EXECUTE stmt; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +EXECUTE stmt1; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +call p1(); +affected rows: 1 +call p2(); +affected rows: 1 +SET alter_algorithm='NOCOPY'; +affected rows: 0 +EXECUTE stmt; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +EXECUTE stmt1; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +call p1(); +affected rows: 0 +call p2(); +affected rows: 0 +SET alter_algorithm='INSTANT'; +affected rows: 0 +EXECUTE stmt; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +call p1(); +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +DROP TABLE t1; +affected rows: 0 +DROP PROCEDURE p1; +affected rows: 0 +DROP PROCEDURE p2; +affected rows: 0 +SET @save_allowed= @@GLOBAL.innodb_instant_alter_column_allowed; +affected rows: 0 +SET GLOBAL innodb_instant_alter_column_allowed=never; +affected rows: 0 +CREATE TABLE t1(id INT PRIMARY KEY, +col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB; +affected rows: 0 +INSERT INTO t1 VALUES(1,1),(2,2),(3,3); +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +SET ALTER_ALGORITHM=INSTANT; +affected rows: 0 +ALTER TABLE t1 DROP COLUMN col1; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY; +ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +affected rows: 0 +SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed; diff --git a/mysql-test/suite/innodb/r/alter_candidate_key.result b/mysql-test/suite/innodb/r/alter_candidate_key.result new file mode 100644 index 00000000..a3f5d004 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_candidate_key.result @@ -0,0 +1,116 @@ +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL, +UNIQUE KEY uidx2(f1,f2), +UNIQUE KEY uidx1(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx2` (`f1`,`f2`), + UNIQUE KEY `uidx1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +DELETE FROM t1; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f11` int(11) DEFAULT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx1` (`f2`), + UNIQUE KEY `uidx2` (`f11`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1(f1 INT, f2 INT, +PRIMARY KEY(f1, f2), +UNIQUE INDEX uidx2 (f1, f2), +UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(2, 2); +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx2` (`f1`,`f2`), + UNIQUE KEY `uidx1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +INSERT INTO t1 VALUES(1, 1), (1, 1); +ERROR 23000: Duplicate entry '1-1' for key 'uidx2' +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f11` int(11) DEFAULT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx1` (`f2`), + UNIQUE KEY `uidx2` (`f11`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET SQL_MODE= strict_trans_tables; +CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done'; +ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL; +connection con1; +SET DEBUG_SYNC='now WAIT_FOR dml'; +BEGIN; +INSERT INTO t1 SET a=NULL; +COMMIT; +set DEBUG_SYNC='now SIGNAL dml_done'; +connection default; +ERROR 22004: Invalid use of NULL value +DROP TABLE t1; +disconnect con1; +SET DEBUG_SYNC="RESET"; +SET SQL_MODE=DEFAULT; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2), +UNIQUE KEY(f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB; +Warnings: +Note 1831 Duplicate index `f2_2`. This is deprecated and will be disallowed in a future release +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2` (`f2`), + UNIQUE KEY `f2_2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2_2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_copy.result b/mysql-test/suite/innodb/r/alter_copy.result new file mode 100644 index 00000000..8c9e5966 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_copy.result @@ -0,0 +1,218 @@ +# +# MDEV-11415 AVOID INTERMEDIATE COMMIT WHILE DOING +# ALTER TABLE...ALGORITHM=COPY +# +CREATE TABLE t(a SERIAL, b INT, c INT, d INT) ENGINE=InnoDB; +CREATE TABLE t1(a INT, b TEXT, c TEXT, +FULLTEXT(b), FULLTEXT(c(3)), FULLTEXT(b,c)) ENGINE=InnoDB; +BEGIN; +COMMIT; +SELECT COUNT(*) FROM t; +COUNT(*) +999 +UPDATE t SET b=a%7, c=a%11, d=a%13; +INSERT INTO t1 VALUES(1, 'This is a first b column', 'This is a first c column'); +INSERT INTO t1 VALUES(2, 'This is a second b column', 'This is a second c column'); +INSERT INTO t1(a) VALUES(3); +INSERT INTO t1 VALUES(4, 'This is a third b column', 'This is a third c column'); +DELETE FROM t1 WHERE a = 2; +SELECT * FROM t1 WHERE MATCH(b) AGAINST ('first'); +a b c +1 This is a first b column This is a first c column +SELECT * FROM t1 WHERE MATCH(c) AGAINST ('first'); +a b c +1 This is a first b column This is a first c column +SELECT * FROM t1 WHERE MATCH(b,c) AGAINST ('column'); +a b c +1 This is a first b column This is a first c column +4 This is a third b column This is a third c column +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` text DEFAULT NULL, + `c` text DEFAULT NULL, + FULLTEXT KEY `b` (`b`), + FULLTEXT KEY `c` (`c`), + FULLTEXT KEY `b_2` (`b`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_copy_trans_commit SIGNAL hung WAIT_FOR ever'; +# create 32 secondary indexes +ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX(b,a,d,c), +ADD INDEX(b,d,a,c),ADD INDEX(b,d,c,a),ADD INDEX(a,b,c,d),ADD INDEX(a,b,d,c), +ADD INDEX(a,c,b,d),ADD INDEX(a,c,d,b),ADD INDEX(a,d,b,c),ADD INDEX(a,d,c,b), +ADD INDEX(c,a,b,d),ADD INDEX(c,a,d,b),ADD INDEX(c,b,a,d),ADD INDEX(c,b,d,a), +ADD INDEX(c,d,a,b),ADD INDEX(c,d,b,a),ADD INDEX(d,a,b,c),ADD INDEX(d,a,c,b), +ADD INDEX(d,b,a,c),ADD INDEX(d,b,c,a),ADD INDEX(d,c,a,b),ADD INDEX(d,c,b,a), +ADD INDEX(a,b,c), ADD INDEX(a,c,b), ADD INDEX(a,c,d), ADD INDEX(a,d,c), +ADD INDEX(a,b,d), ADD INDEX(a,d,b), ADD INDEX(b,c,d), ADD INDEX(b,d,c), +ALGORITHM=COPY; +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +# restart: --innodb-force-recovery=3 --debug_dbug=+d,recv_ran_out_of_buffer +disconnect hang; +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTSBEING_DELETED.ibd +FTSBEING_DELETED_CACHE.ibd +FTSCONFIG.ibd +FTSDELETED.ibd +FTSDELETED_CACHE.ibd +db.opt +t.frm +t.ibd +t1.frm +t1.ibd +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT COUNT(*) FROM t; +COUNT(*) +999 +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +SELECT * FROM t1 WHERE MATCH(b) AGAINST ('first'); +a b c +1 This is a first b column This is a first c column +SELECT * FROM t1 WHERE MATCH(c) AGAINST ('first'); +a b c +1 This is a first b column This is a first c column +SELECT * FROM t1 WHERE MATCH(b,c) AGAINST ('column'); +a b c +1 This is a first b column This is a first c column +4 This is a third b column This is a third c column +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` text DEFAULT NULL, + `c` text DEFAULT NULL, + FULLTEXT KEY `b` (`b`), + FULLTEXT KEY `c` (`c`), + FULLTEXT KEY `b_2` (`b`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +# restart: --innodb-read-only +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTSBEING_DELETED.ibd +FTSBEING_DELETED_CACHE.ibd +FTSCONFIG.ibd +FTSDELETED.ibd +FTSDELETED_CACHE.ibd +db.opt +t.frm +t.ibd +t1.frm +t1.ibd +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT COUNT(*) FROM t; +COUNT(*) +999 +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +SELECT * FROM t1 WHERE MATCH(b) AGAINST ('first'); +a b c +1 This is a first b column This is a first c column +SELECT * FROM t1 WHERE MATCH(c) AGAINST ('first'); +a b c +1 This is a first b column This is a first c column +SELECT * FROM t1 WHERE MATCH(b,c) AGAINST ('column'); +a b c +1 This is a first b column This is a first c column +4 This is a third b column This is a third c column +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` text DEFAULT NULL, + `c` text DEFAULT NULL, + FULLTEXT KEY `b` (`b`), + FULLTEXT KEY `c` (`c`), + FULLTEXT KEY `b_2` (`b`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +# restart +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTS_INDEX_1.ibd +FTS_INDEX_2.ibd +FTS_INDEX_3.ibd +FTS_INDEX_4.ibd +FTS_INDEX_5.ibd +FTS_INDEX_6.ibd +FTSBEING_DELETED.ibd +FTSBEING_DELETED_CACHE.ibd +FTSCONFIG.ibd +FTSDELETED.ibd +FTSDELETED_CACHE.ibd +db.opt +t.frm +t.ibd +t1.frm +t1.ibd +DROP TABLE t1,t; diff --git a/mysql-test/suite/innodb/r/alter_crash.result b/mysql-test/suite/innodb/r/alter_crash.result new file mode 100644 index 00000000..11065310 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_crash.result @@ -0,0 +1,223 @@ +# +# Bug#20015132 ALTER TABLE FAILS TO CHECK IF TABLE IS CORRUPTED +# +CREATE TABLE t1(c1 INT PRIMARY KEY, c2 CHAR(1), c3 INT UNSIGNED) ENGINE=InnoDB; +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG='+d,create_index_metadata_fail'; +ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3); +ERROR HY000: The table 't1' is full +SET DEBUG_DBUG='+d,ib_create_table_fail_too_many_trx'; +ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3); +ERROR HY000: Too many active concurrent transactions +SET DEBUG_DBUG=@saved_debug_dbug; +ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3); +SET DEBUG_DBUG='+d,dict_set_index_corrupted'; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Warning InnoDB: Index c2 is marked as corrupted +test.t1 check Warning InnoDB: Index c3 is marked as corrupted +test.t1 check error Corrupt +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Warning InnoDB: Index c2 is marked as corrupted +test.t1 check Warning InnoDB: Index c3 is marked as corrupted +test.t1 check error Corrupt +ALTER TABLE t1 DROP INDEX c2; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Warning InnoDB: Index c3 is marked as corrupted +test.t1 check error Corrupt +ALTER TABLE t1 ADD INDEX (c2,c3); +ERROR HY000: Index c3 is corrupted +ALTER TABLE t1 CHANGE c3 c3 INT NOT NULL; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD INDEX (c2,c3); +DROP TABLE t1; +# +# Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE +# +# -- Scenario 1: +# Crash the server in ha_innobase::commit_inplace_alter_table() +# just after committing the dictionary changes. +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb; +INSERT INTO t1 VALUES (1,2),(3,4); +SET DEBUG_DBUG='+d,innodb_alter_commit_crash_after_commit'; +ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); +ERROR HY000: Lost connection to server during query +# Restart mysqld after the crash and reconnect. +# restart +SELECT * FROM information_schema.innodb_sys_tables +WHERE table_id = ID; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +# Files in datadir after manual recovery. +db.opt +t1.frm +t1.ibd +SHOW TABLES; +Tables_in_test +t1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f2`,`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (5,6),(7,8); +SELECT * FROM t1; +f1 f2 +1 2 +3 4 +5 6 +7 8 +DROP TABLE t1; +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); +DROP TABLE t1; +# -- Scenario 2: +# Crash the server in ha_innobase::commit_inplace_alter_table() +# just before committing the dictionary changes, but after +# writing the MLOG_FILE_RENAME records. As the mini-transaction +# is not committed, the renames will not be replayed. +CREATE TABLE t2 (f1 int not null, f2 int not null) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,2),(3,4); +SET DEBUG_DBUG='+d,innodb_alter_commit_crash_before_commit'; +ALTER TABLE t2 ADD PRIMARY KEY (f2, f1); +ERROR HY000: Lost connection to server during query +# Startup the server after the crash +# restart +SELECT * FROM information_schema.innodb_sys_tables +WHERE name LIKE 'test/#sql-%'; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +SHOW TABLES; +Tables_in_test +t2 +INSERT INTO t2 VALUES (5,6),(7,8); +SELECT * from t2; +f1 f2 +1 2 +3 4 +5 6 +7 8 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB; +ALTER TABLE t2 ADD PRIMARY KEY (f2, f1); +DROP TABLE t2; +db.opt +# ------------------------- +# End of Testing Scenario 2 +# ------------------------- +# +# Bug#19330255 WL#7142 - CRASH DURING ALTER TABLE LEADS TO +# DATA DICTIONARY INCONSISTENCY +# +CREATE TABLE t1(a int PRIMARY KEY, b varchar(255), c int NOT NULL) +ENGINE=InnoDB; +INSERT INTO t1 SET a=1,c=2; +SET DEBUG_DBUG='+d,innodb_alter_commit_crash_after_commit'; +ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE; +ERROR HY000: Lost connection to server during query +# Restart mysqld after the crash and reconnect. +# restart +SELECT * FROM information_schema.innodb_sys_tables +WHERE table_id = ID; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +db.opt +t1.frm +t1.ibd +SHOW TABLES; +Tables_in_test +t1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(255) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +UPDATE t1 SET d=NULL; +SELECT * FROM t1; +a b d +1 NULL NULL +DROP TABLE t1; +# +# MDEV-22637 Rollback of insert fails when column reorder happens +# +SET @@SQL_MODE = REPLACE(@@SQL_MODE, 'STRICT_TRANS_TABLES', ''); +SET @@SQL_MODE = REPLACE(@@SQL_MODE, 'STRICT_ALL_TABLES', ''); +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), +f3 CHAR(100), f4 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, "This is column2", "This is column3", +"This is column4"); +set DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL scanned WAIT_FOR insert_done'; +ALTER TABLE t1 ADD COLUMN f6 int after f3, add primary key(f6, f4(3), f3(3)); +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +BEGIN; +INSERT INTO t1(f1, f2) VALUES(2, "This is column2 value"); +ROLLBACK; +set DEBUG_SYNC = 'now SIGNAL insert_done'; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` char(100) DEFAULT NULL, + `f3` char(100) NOT NULL, + `f6` int(11) NOT NULL, + `f4` char(100) NOT NULL, + PRIMARY KEY (`f6`,`f4`(3),`f3`(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +disconnect con1; +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; +SET SQL_MODE=DEFAULT; +# +# MDEV-26936 Recovery crash on rolling back DELETE FROM SYS_INDEXES +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +connect ddl, localhost, root; +SET DEBUG_SYNC = 'row_merge_after_scan SIGNAL scanned WAIT_FOR commit'; +SET DEBUG_SYNC = 'before_commit_rollback_inplace SIGNAL c WAIT_FOR ever'; +ALTER TABLE t1 ADD UNIQUE INDEX(b), ALGORITHM=INPLACE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +BEGIN; +INSERT INTO t1 VALUES(2,1); +COMMIT; +SET DEBUG_SYNC = 'now SIGNAL commit'; +SET DEBUG_SYNC = 'now WAIT_FOR c'; +SET GLOBAL innodb_fil_make_page_dirty_debug=0; +# Kill the server +disconnect ddl; +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +a b +1 1 +2 1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_crash_rebuild.result b/mysql-test/suite/innodb/r/alter_crash_rebuild.result new file mode 100644 index 00000000..159e8e49 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_crash_rebuild.result @@ -0,0 +1,19 @@ +CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB STATS_PERSISTENT=0; +connect ddl,localhost,root; +SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL stuck WAIT_FOR ever'; +ALTER TABLE t1 ADD PRIMARY KEY(a); +connection default; +SET DEBUG_SYNC='now WAIT_FOR stuck'; +SET GLOBAL innodb_log_checkpoint_now=ON; +# restart +disconnect ddl; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +SELECT * FROM t1; +a +DROP TABLE t1; +InnoDB 0 transactions not purged diff --git a/mysql-test/suite/innodb/r/alter_dml_apply.result b/mysql-test/suite/innodb/r/alter_dml_apply.result new file mode 100644 index 00000000..c9def9d6 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_dml_apply.result @@ -0,0 +1,39 @@ +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +f3 CHAR(200), f4 CHAR(200), +PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD UNIQUE INDEX(f4(10)); +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1 WHERE f1= 6000; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +ROLLBACK; +BEGIN; +DELETE FROM t1 WHERE f1= 6000; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB"); +INSERT INTO t1 SELECT seq, seq, repeat('a', 200), repeat('b', 200) FROM seq_1_to_4000; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD INDEX(f3(10)); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1; +INSERT INTO t1 SELECT seq, seq, repeat('d', 200), repeat('e', 200) FROM +seq_1_to_4000; +UPDATE t1 SET f3=repeat('c', 200), f4= repeat('d', 200), f2=3; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +disconnect con1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET DEBUG_SYNC=reset; diff --git a/mysql-test/suite/innodb/r/alter_foreign_crash.result b/mysql-test/suite/innodb/r/alter_foreign_crash.result new file mode 100644 index 00000000..7b7cc494 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_foreign_crash.result @@ -0,0 +1,37 @@ +# +# Bug #20476395 DICT_LOAD_FOREIGNS() FAILED IN +# COMMIT_INPLACE_ALTER_TABLE +# +call mtr.add_suppression("InnoDB: Failed to load table"); +CREATE DATABASE Bug; +CREATE TABLE Bug.parent(a SERIAL) ENGINE=INNODB; +CREATE TABLE Bug.child(a SERIAL, FOREIGN KEY f(a) REFERENCES Bug.parent(a)) +ENGINE=INNODB; +create database bug; +use bug; +create table parent(a serial) engine=innodb; +create table child(a serial, foreign key fk (a) references parent(a))engine=innodb; +insert into parent values(1); +insert into child values(1); +drop database Bug; +connect con1,localhost,root,,bug; +SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL s1 WAIT_FOR s2 EXECUTE 2'; +ALTER TABLE child ROW_FORMAT=DYNAMIC, ALGORITHM=COPY; +connection default; +SET DEBUG_SYNC='now WAIT_FOR s1'; +SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1'; +# restart +disconnect con1; +show tables; +Tables_in_bug +child +parent +alter table parent row_format=dynamic; +select * from child; +a +1 +drop table parent; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +drop table child; +drop table parent; +drop database bug; diff --git a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result new file mode 100644 index 00000000..4b5a2176 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result @@ -0,0 +1,21 @@ +select count_star into @init_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +connect ddl, localhost, root,,; +update performance_schema.setup_instruments set enabled='yes'; +update performance_schema.setup_consumers set enabled='yes'; +CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB; +BEGIN; +COMMIT; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone'; +ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR go'; +select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +SELECT @final_count - @init_count; +@final_count - @init_count +10 +SET DEBUG_SYNC = 'now SIGNAL gone'; +connection ddl; +disconnect ddl; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_key_block_size-11757.result b/mysql-test/suite/innodb/r/alter_key_block_size-11757.result new file mode 100644 index 00000000..0368bb3f --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_key_block_size-11757.result @@ -0,0 +1,50 @@ +create table t1 ( +id1 bigint(20) not null, +id2 bigint(20) not null, +primary key (id1), +unique key id2 (id2) +) engine=innodb row_format=compressed key_block_size=8; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id1` bigint(20) NOT NULL, + `id2` bigint(20) NOT NULL, + PRIMARY KEY (`id1`), + UNIQUE KEY `id2` (`id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +SET innodb_strict_mode=ON; +alter table t1 row_format=dynamic; +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE' +SET innodb_strict_mode=OFF; +alter table t1 row_format=dynamic; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8 unless ROW_FORMAT=COMPRESSED. +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id1` bigint(20) NOT NULL, + `id2` bigint(20) NOT NULL, + PRIMARY KEY (`id1`), + UNIQUE KEY `id2` (`id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 +SET innodb_strict_mode=ON; +alter table t1 key_block_size=0; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id1` bigint(20) NOT NULL, + `id2` bigint(20) NOT NULL, + PRIMARY KEY (`id1`) KEY_BLOCK_SIZE=8, + UNIQUE KEY `id2` (`id2`) KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +alter table t1 drop primary key, add primary key (id1), +drop key id2, add unique (id2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id1` bigint(20) NOT NULL, + `id2` bigint(20) NOT NULL, + PRIMARY KEY (`id1`), + UNIQUE KEY `id2` (`id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +drop table t1; diff --git a/mysql-test/suite/innodb/r/alter_kill.result b/mysql-test/suite/innodb/r/alter_kill.result new file mode 100644 index 00000000..86e53343 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_kill.result @@ -0,0 +1,61 @@ +# +# Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP +# +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB; +connect con1,localhost,root; +CREATE TABLE bug16720368 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO bug16720368 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8); +InnoDB 0 transactions not purged +connection default; +# Cleanly shutdown mysqld +disconnect con1; +# Corrupt FIL_PAGE_TYPE in bug16720368.ibd, +# and recompute innodb_checksum_algorithm=crc32 +# restart +SELECT COUNT(*) FROM bug16720368; +ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine +INSERT INTO bug16720368 VALUES(1); +ERROR HY000: Table test/bug16720368 is corrupted. Please drop the table and recreate. +INSERT INTO bug16720368_1 VALUES(1); +# Shut down the server to uncorrupt the data. +# restart +INSERT INTO bug16720368 VALUES(9,1); +SELECT COUNT(*) FROM bug16720368; +COUNT(*) +9 +DROP TABLE bug16720368, bug16720368_1; +# +# Bug#16735660 ASSERT TABLE2 == NULL, ROLLBACK OF RESURRECTED TXNS, +# DICT_TABLE_ADD_TO_CACHE +# +SET GLOBAL innodb_file_per_table=1; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(42); +connect con1,localhost,root; +CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB; +XA START 'x'; +INSERT INTO bug16735660 VALUES(1),(2),(3); +XA END 'x'; +XA PREPARE 'x'; +connection default; +# Kill the server +disconnect con1; +# Attempt to start without an *.ibd file. +# restart +FOUND 1 /\[ERROR\] InnoDB: Tablespace [0-9]+ was not found at .*test.bug16735660.ibd/ in mysqld.1.err +# restart +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM bug16735660; +a +1 +2 +3 +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +XA ROLLBACK 'x'; +SELECT * FROM bug16735660; +a +DROP TABLE bug16735660; diff --git a/mysql-test/suite/innodb/r/alter_large_dml.result b/mysql-test/suite/innodb/r/alter_large_dml.result new file mode 100644 index 00000000..e73377e6 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_large_dml.result @@ -0,0 +1,43 @@ +CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200), +f4 char(200), f5 char(200), f6 char(200), +f7 char(200), f8 char(200))ENGINE=InnoDB; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; +SET DEBUG_SYNC = 'inplace_after_index_build SIGNAL rebuilt WAIT_FOR dml_pause'; +SET DEBUG_SYNC = 'alter_table_inplace_before_lock_upgrade SIGNAL dml_restart WAIT_FOR dml_done'; +SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL ddl_start'; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +connect con1,localhost,root,,test; +SET DEBUG_SYNC = 'now WAIT_FOR rebuilt'; +BEGIN; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; +SET DEBUG_SYNC = 'now SIGNAL dml_pause'; +SET DEBUG_SYNC = 'now WAIT_FOR dml_restart'; +ROLLBACK; +BEGIN; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920; +ROLLBACK; +BEGIN; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688; +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL dml_done'; +connect con2, localhost,root,,test; +SET DEBUG_SYNC = 'now WAIT_FOR ddl_start'; +CREATE TABLE t2(f1 INT NOT NULL)ENGINE=InnoDB; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` char(200) DEFAULT NULL, + `f2` char(200) DEFAULT NULL, + `f3` char(200) DEFAULT NULL, + `f4` char(200) DEFAULT NULL, + `f5` char(200) DEFAULT NULL, + `f6` char(200) DEFAULT NULL, + `f7` char(200) DEFAULT NULL, + `f8` char(200) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT COUNT(*) FROM t1; +COUNT(*) +16384 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/r/alter_mdl_timeout.result b/mysql-test/suite/innodb/r/alter_mdl_timeout.result new file mode 100644 index 00000000..e4fba8e2 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_mdl_timeout.result @@ -0,0 +1,23 @@ +create table t1(f1 char(10), f2 char(10) not null, f3 int not null, +f4 int not null, primary key(f3))engine=innodb; +insert into t1 values('a','a', 1, 1), ('b','b', 2, 2), ('c', 'c', 3, 3), ('d', 'd', 4, 4); +SET DEBUG_SYNC="row_merge_after_scan SIGNAL con1_start WAIT_FOR con1_insert"; +SET DEBUG_SYNC="innodb_commit_inplace_alter_table_wait SIGNAL con1_wait WAIT_FOR con1_update"; +ALTER TABLE t1 ADD UNIQUE INDEX(f1(3), f4), ADD UNIQUE INDEX(f2), ALGORITHM=INPLACE; +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR con1_start"; +begin; +INSERT INTO t1 VALUES('e','e',5, 5); +SET DEBUG_SYNC="now SIGNAL con1_insert"; +SET DEBUG_SYNC="now WAIT_FOR con1_wait"; +SET DEBUG_SYNC="after_row_upd_clust SIGNAL con1_update WAIT_FOR alter_rollback"; +UPDATE t1 set f4 = 10 order by f1 desc limit 2; +connection default; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC="now SIGNAL alter_rollback"; +connection con1; +commit; +connection default; +disconnect con1; +DROP TABLE t1; +SET DEBUG_SYNC="RESET"; diff --git a/mysql-test/suite/innodb/r/alter_missing_tablespace.result b/mysql-test/suite/innodb/r/alter_missing_tablespace.result new file mode 100644 index 00000000..3d071584 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_missing_tablespace.result @@ -0,0 +1,52 @@ +# +# Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING +# OR DISCARDED TABLESPACES +# +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t(a SERIAL)ENGINE=InnoDB; +CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +CREATE TABLE t1(a SERIAL)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1),(2),(3); +# restart +SELECT * FROM t; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +SHOW WARNINGS; +Level Code Message +Warning 1812 Tablespace is missing for table 'test/t' +Error 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +SHOW WARNINGS; +Level Code Message +Warning 1812 Tablespace is missing for table 'test/t' +Error 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +ALTER TABLE t ALGORITHM=INPLACE, DISCARD TABLESPACE; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1 +ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1 +ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1 +ALTER TABLE t DISCARD TABLESPACE; +Warnings: +Warning 1812 Tablespace is missing for table 'test/t' +Warning 1812 Tablespace is missing for table 'test/t' +RENAME TABLE t TO u; +RENAME TABLE u TO v; +DROP TABLE v; +SELECT * FROM `x..d`; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +DROP TABLE `x..d`; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=INPLACE; +ERROR HY000: Tablespace has been discarded for table `t1` +ALTER TABLE t1 AUTO_INCREMENT=1, FORCE, ALGORITHM=INPLACE; +ERROR HY000: Tablespace has been discarded for table `t1` +ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=COPY; +ERROR HY000: Tablespace has been discarded for table `t1` +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff new file mode 100644 index 00000000..01db97e5 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff @@ -0,0 +1,42 @@ +7,8c7,8 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 +21,22c21,22 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 +35,36c35,36 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 +49,50c49,50 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 +63,64c63,64 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 +77,78c77,78 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 +98,99c98,99 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 diff --git a/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff new file mode 100644 index 00000000..e02d235c --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff @@ -0,0 +1,72 @@ +7,10c7 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +13c10 +< 0 +--- +> NULL +21,24c18 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +27c21 +< +--- +> NULL +35,38c29 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +41c32 +< +--- +> NULL +49,52c40 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +55c43 +< +--- +> NULL +63,66c51 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f3' at row 1 +--- +> ERROR 01000: Data truncated for column 'f3' at row 1 +69c54 +< 2 2 0 +--- +> 2 2 NULL +77,80c62 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'b' at row 1 +--- +> ERROR 01000: Data truncated for column 'b' at row 1 +83c65 +< 10 0 +--- +> 10 NULL +98,99c80,81 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +--- +> affected rows: 1 +> info: Records: 1 Duplicates: 0 Warnings: 1 diff --git a/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff new file mode 100644 index 00000000..ec97b174 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff @@ -0,0 +1,66 @@ +7,10c7 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +13c10 +< 0 +--- +> NULL +21,24c18 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +27c21 +< +--- +> NULL +35,38c29 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +41c32 +< +--- +> NULL +49,52c40 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f1' at row 1 +--- +> ERROR 01000: Data truncated for column 'f1' at row 1 +55c43 +< +--- +> NULL +63,66c51 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'f3' at row 1 +--- +> ERROR 01000: Data truncated for column 'f3' at row 1 +69c54 +< 2 2 0 +--- +> 2 2 NULL +77,80c62 +< affected rows: 0 +< info: Records: 0 Duplicates: 0 Warnings: 1 +< Warnings: +< Warning 1265 Data truncated for column 'b' at row 1 +--- +> ERROR 01000: Data truncated for column 'b' at row 1 +83c65 +< 10 0 +--- +> 10 NULL diff --git a/mysql-test/suite/innodb/r/alter_not_null.result b/mysql-test/suite/innodb/r/alter_not_null.result new file mode 100644 index 00000000..68849335 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_not_null.result @@ -0,0 +1,114 @@ +CREATE TABLE t1(f1 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +0 +DROP TABLE t1; +CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 + +DROP TABLE t1; +CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 + +DROP TABLE t1; +CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 + +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(2, 2, NULL); +SELECT * FROM t1; +f1 f2 f3 +2 2 NULL +ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f3' at row 1 +SELECT * FROM t1; +f1 f2 f3 +2 2 0 +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(10, NULL); +SELECT * FROM t1; +f1 b +10 NULL +ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +SELECT * FROM t1; +f1 b +10 0 +DROP TABLE t1; +CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 FORCE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, NULL); +ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c2' at row 1 +SELECT * FROM t1; +c1 c2 +1 0 +DROP TABLE t1; +# +# MDEV-16126 Crash or ASAN heap-buffer-overflow in +# mach_read_from_n_little_endian upon ALTER TABLE with blob +# +CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY(b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff new file mode 100644 index 00000000..81466d79 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_not_null_debug,STRICT.rdiff @@ -0,0 +1,16 @@ +@@ -15,13 +15,10 @@ + SET DEBUG_SYNC= 'now SIGNAL flushed'; + affected rows: 0 + connection default; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'c2' at row 3 ++ERROR 22004: Invalid use of NULL value + SELECT * FROM t1; + c1 c2 +-2 0 ++2 NULL + 3 1 + DROP TABLE t1; + CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; diff --git a/mysql-test/suite/innodb/r/alter_not_null_debug.result b/mysql-test/suite/innodb/r/alter_not_null_debug.result new file mode 100644 index 00000000..ff77eaf5 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_not_null_debug.result @@ -0,0 +1,102 @@ +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, 1); +SET DEBUG_SYNC= 'row_merge_after_scan +SIGNAL opened WAIT_FOR flushed'; +affected rows: 0 +ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +connect con1,localhost,root; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +affected rows: 0 +INSERT INTO t1 VALUES(2, NULL); +affected rows: 1 +UPDATE t1 SET c1 = 3 WHERE c2 = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SET DEBUG_SYNC= 'now SIGNAL flushed'; +affected rows: 0 +connection default; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c2' at row 3 +SELECT * FROM t1; +c1 c2 +2 0 +3 1 +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, 1); +SET DEBUG_SYNC= 'row_merge_after_scan +SIGNAL opened WAIT_FOR flushed'; +affected rows: 0 +ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +affected rows: 0 +INSERT INTO t1 VALUES(2, 3); +affected rows: 1 +UPDATE t1 SET c1 = 3 WHERE c2 = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SET DEBUG_SYNC= 'now SIGNAL flushed'; +affected rows: 0 +connection default; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +c1 c2 +2 3 +3 1 +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, c3 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, 2, 3); +SET DEBUG_SYNC= 'row_merge_after_scan +SIGNAL opened WAIT_FOR flushed'; +affected rows: 0 +ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +affected rows: 0 +UPDATE t1 SET c2= 2 WHERE c1 = 1; +affected rows: 0 +info: Rows matched: 1 Changed: 0 Warnings: 0 +INSERT INTO t1 VALUES (2, NULL, 4); +affected rows: 1 +SET DEBUG_SYNC= 'now SIGNAL flushed'; +affected rows: 0 +connection default; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c2' at row 3 +SELECT * FROM t1; +c1 c2 c3 +1 2 3 +2 0 4 +DROP TABLE t1; +SET DEBUG_SYNC='RESET'; +# +# MDEV-21539 Assertion ...prtype... in row_log_table_apply_convert_mrec +# +CREATE TABLE t1 (f VARCHAR(8) CHARACTER SET latin1 COLLATE latin1_swedish_ci) +ENGINE=InnoDB; +INSERT INTO t1 VALUES('ZERO'); +connection con1; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL scanned WAIT_FOR insert_done'; +ALTER TABLE t1 MODIFY f VARCHAR(256) COLLATE latin1_german2_ci NOT NULL; +# session default +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +INSERT INTO t1 VALUES('one'); +SET DEBUG_SYNC = 'now SIGNAL insert_done'; +connection con1; +disconnect con1; +connection default; +SET DEBUG_SYNC=RESET; +ALTER TABLE t1 CHANGE f eins VARCHAR(257) COLLATE latin1_german1_ci NOT NULL, +ALGORITHM=INSTANT; +SELECT * FROM t1; +eins +ZERO +one +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_partitioned.result b/mysql-test/suite/innodb/r/alter_partitioned.result new file mode 100644 index 00000000..feb8cd94 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_partitioned.result @@ -0,0 +1,57 @@ +# +# MDEV-26077 Assertion failure err != DB_DUPLICATE_KEY +# or unexpected ER_TABLE_EXISTS_ERROR +# +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB; +connect con1,localhost,root,,test; +START TRANSACTION; +INSERT INTO t2 (pk) VALUES (1); +SAVEPOINT sp; +INSERT INTO t1 (pk) VALUES (1); +ROLLBACK TO SAVEPOINT sp; +connection default; +SET @save_timeout=@@lock_wait_timeout; +SET @save_innodb_timeout=@@innodb_lock_wait_timeout; +SET lock_wait_timeout=0; +SET innodb_lock_wait_timeout=0; +ALTER TABLE t1 PARTITION BY HASH(pk); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET lock_wait_timeout=@save_timeout; +SET innodb_lock_wait_timeout=@save_innodb_timeout; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + PRIMARY KEY (`pk`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection con1; +COMMIT; +connection default; +SET lock_wait_timeout=@save_timeout; +SET innodb_lock_wait_timeout=@save_innodb_timeout; +ALTER TABLE t2 PARTITION BY HASH(pk); +disconnect con1; +connection default; +DROP TABLE t1, t2; +# End of 10.2 tests +CREATE TABLE t1(a INT, b VARCHAR(10), INDEX(a))ENGINE=InnoDB +PARTITION BY RANGE(a) +(PARTITION pa VALUES LESS THAN (3), +PARTITION pb VALUES LESS THAN (5)); +CREATE TABLE t2(a INT, FOREIGN KEY(a) REFERENCES t1(a))ENGINE=INNODB +PARTITION BY RANGE(a) +(PARTITION pa VALUES LESS THAN (2), +PARTITION pb VALUES LESS THAN (4)); +ERROR HY000: Partitioned tables do not support FOREIGN KEY +DROP TABLE t1; +# End of 10.3 tests +# +# MDEV-24754 Server crash in +# ha_partition_inplace_ctx::~ha_partition_inplace_ctx +# +CREATE TABLE t1 (id INT PRIMARY KEY, a INT, va INT AS (a) VIRTUAL) +ENGINE=InnoDB PARTITION BY HASH(id) PARTITIONS 2; +ALTER TABLE t1 ADD b INT, ALGORITHM=INSTANT; +DROP TABLE t1; +# End of 10.5 tests diff --git a/mysql-test/suite/innodb/r/alter_partitioned_debug.result b/mysql-test/suite/innodb/r/alter_partitioned_debug.result new file mode 100644 index 00000000..d2ec602c --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_partitioned_debug.result @@ -0,0 +1,27 @@ +CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB +PARTITION BY RANGE(a) +(PARTITION pa VALUES LESS THAN (3), +PARTITION pb VALUES LESS THAN (5)); +INSERT INTO t1 VALUES(2,'two'),(2,'two'),(4,'four'); +connect ddl,localhost,root,,test; +SET DEBUG_SYNC = 'inplace_after_index_build SIGNAL go WAIT_FOR done'; +ALTER TABLE t1 ADD UNIQUE KEY (a,b(3)); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR go'; +BEGIN; +SELECT * FROM t1 FOR UPDATE; +a b +2 two +2 two +4 four +SET DEBUG_SYNC = 'now SIGNAL done'; +connection ddl; +ERROR 23000: Duplicate entry '2-two' for key 'a' +connection default; +DELETE FROM t1; +disconnect ddl; +SET DEBUG_SYNC = 'RESET'; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_partitioned_xa.result b/mysql-test/suite/innodb/r/alter_partitioned_xa.result new file mode 100644 index 00000000..2d3add06 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_partitioned_xa.result @@ -0,0 +1,18 @@ +# +# MDEV-14693 XA: Assertion `!clust_index->online_log' failed +# in rollback_inplace_alter_table +# +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2; +XA START 'xid'; +INSERT INTO t1 VALUES (1,10); +CREATE DATABASE IF NOT EXISTS db; +ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state +connect con1,localhost,root,,test; +SET innodb_lock_wait_timeout= 1, lock_wait_timeout= 2; +ALTER TABLE t1 FORCE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +XA END 'xid'; +XA ROLLBACK 'xid'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_persistent_autoinc.result b/mysql-test/suite/innodb/r/alter_persistent_autoinc.result new file mode 100644 index 00000000..52ac4d83 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_persistent_autoinc.result @@ -0,0 +1,42 @@ +CREATE TABLE t1 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 MODIFY c INT NULL, ALGORITHM=INSTANT; +INSERT INTO t1 SET c=1; +CREATE TABLE t2 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t2 MODIFY c INT NULL, FORCE, ALGORITHM=INPLACE; +INSERT INTO t2 SET c=1; +CREATE TABLE t3 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t3 MODIFY c INT NULL, ALGORITHM=INPLACE; +INSERT INTO t3 SET c=1; +CREATE TABLE t4 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT) ENGINE=InnoDB; +ALTER TABLE t4 MODIFY c1 INT NULL, CHANGE COLUMN c2 c3 INT, ALGORITHM=INPLACE; +INSERT INTO t4 SET c1=1; +CREATE TABLE t5 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT, c3 INTEGER GENERATED ALWAYS AS (c2)) ENGINE=InnoDB; +ALTER TABLE t5 MODIFY c1 INT NULL, MODIFY COLUMN c2 INT FIRST, ALGORITHM=INPLACE; +INSERT INTO t5 SET c1=1; +CREATE TABLE t6 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB +PARTITION BY LIST(c) ( +PARTITION p1 VALUES IN (1), +PARTITION p2 VALUES IN (2) +); +ALTER TABLE t6 MODIFY c INT NULL, ALGORITHM=INSTANT; +INSERT INTO t6 SET c=1; +INSERT INTO t6 SET c=2; +CREATE TABLE t7 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB +PARTITION BY LIST(c) ( +PARTITION p1 VALUES IN (1), +PARTITION p2 VALUES IN (2) +); +ALTER TABLE t7 MODIFY c INT NULL, ALGORITHM=INPLACE; +INSERT INTO t7 SET c=1; +INSERT INTO t7 SET c=2; +CREATE TABLE t8 (c1 INT AUTO_INCREMENT NULL UNIQUE, c2 INT) ENGINE=InnoDB +PARTITION BY LIST(c1) ( +PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t8 MODIFY c1 INT NULL, CHANGE COLUMN c2 c3 INT, ALGORITHM=INPLACE; +INSERT INTO t8 SET c1=1; +INSERT INTO t8 SET c1=2; +FLUSH TABLES t1, t2, t3, t4, t5, t6, t7, t8 FOR EXPORT; +AUTO_INCREMENT not partitioned: 0 0 0 0 0 +AUTO_INCREMENT partitioned: (0, 0) (0, 0) (0, 0) +UNLOCK TABLES; +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8; diff --git a/mysql-test/suite/innodb/r/alter_primary_key.result b/mysql-test/suite/innodb/r/alter_primary_key.result new file mode 100644 index 00000000..b478691a --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_primary_key.result @@ -0,0 +1,28 @@ +# +# MDEV-23244 ALTER TABLE…ADD PRIMARY KEY fails to flag +# duplicate key error from concurrent DML +# +CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (c CHAR(2) NOT NULL) ENGINE=InnoDB; +INSERT INTO t1 VALUES('cd'); +connect con1,localhost,root,,; +BEGIN; +INSERT INTO t0 VALUES(1); +connection default; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done'; +ALTER TABLE t1 ADD PRIMARY KEY(c(1)); +connection con1; +SET DEBUG_SYNC='now WAIT_FOR dml'; +INSERT INTO t1 VALUES ('ab'),('ac'); +COMMIT; +SET DEBUG_SYNC='now SIGNAL dml_done'; +disconnect con1; +connection default; +ERROR 23000: Duplicate entry 'a' for key 'PRIMARY' +SET DEBUG_SYNC='RESET'; +SELECT * FROM t1; +c +cd +ab +ac +DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/r/alter_rename_existing.result b/mysql-test/suite/innodb/r/alter_rename_existing.result new file mode 100644 index 00000000..1fdc2011 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_rename_existing.result @@ -0,0 +1,95 @@ +# +# Show what happens during ALTER TABLE when an existing file +# exists in the target location. +# +# Bug #19218794: IF TABLESPACE EXISTS, CAN'T CREATE TABLE, +# BUT CAN ALTER ENGINE=INNODB +# +CREATE TABLE t1 (a SERIAL, b CHAR(10)) ENGINE=Memory; +INSERT INTO t1(b) VALUES('one'), ('two'), ('three'); +# +# Create a file called MYSQLD_DATADIR/test/t1.ibd +# Directory listing of test/*.ibd +# +t1.ibd +ALTER TABLE t1 ENGINE = InnoDB; +ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists") +# +# Move the file to InnoDB as t2 +# +ALTER TABLE t1 RENAME TO t2, ENGINE = INNODB; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` char(10) DEFAULT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * from t2; +a b +1 one +2 two +3 three +ALTER TABLE t2 RENAME TO t1; +ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists") +# +# Create another t1, but in the system tablespace. +# +SET GLOBAL innodb_file_per_table=OFF; +CREATE TABLE t1 (a SERIAL, b CHAR(20)) ENGINE=InnoDB; +INSERT INTO t1(b) VALUES('one'), ('two'), ('three'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` char(20) DEFAULT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1'; +name space=0 +test/t1 1 +# +# ALTER TABLE from system tablespace to system tablespace +# +ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=INPLACE; +ALTER TABLE t1 ADD COLUMN d INT, ALGORITHM=COPY; +# +# Try to move t1 from the system tablespace to a file-per-table +# while a blocking t1.ibd file exists. +# +SET GLOBAL innodb_file_per_table=ON; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +ERROR HY000: Tablespace for table 'test/#sql-ib' exists. Please DISCARD the tablespace before IMPORT +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists") +# +# Delete the blocking file called MYSQLD_DATADIR/test/t1.ibd +# Move t1 to file-per-table using ALGORITHM=INPLACE with no blocking t1.ibd. +# +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` char(20) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1'; +name space=0 +test/t1 0 +DROP TABLE t1; +# +# Rename t2.ibd to t1.ibd. +# +ALTER TABLE t2 RENAME TO t1; +SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1'; +name space=0 +test/t1 0 +SELECT * from t1; +a b +1 one +2 two +3 three +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result new file mode 100644 index 00000000..d39edd3c --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -0,0 +1,138 @@ +set @@sql_mode=strict_trans_tables; +create table t1(a text not null) row_format=dynamic engine=innodb; +create index idx1 on t1(a(3073)); +Warnings: +Note 1071 Specified key was too long; max key length is 3072 bytes +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + KEY `idx1` (`a`(3072)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +drop table t1; +set @@sql_mode=default; +create table t1 ( +id1 int(11) not null auto_increment, +id2 varchar(30) not null, +id3 datetime not null default current_timestamp, +primary key (id1), +unique key unique_id2 (id2) +) engine=innodb; +alter table t1 change column id2 id4 varchar(100) not null; +select * from t1 where id4 like 'a'; +id1 id4 id3 +drop table t1; +# +# MDEV-17725 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status upon ALTER failing due to error from engine +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 ORDER BY a; +Warnings: +Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1' +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 ORDER BY a; +Warnings: +Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1' +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-18775 Server crashes in dict_table_t::instant_column +# upon ADD COLUMN +# +CREATE TABLE tx (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a), FOREIGN KEY (a) REFERENCES tx (pk)) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=OFF; +ALTER TABLE t1 DROP a; +ERROR HY000: Cannot drop column 'a': needed in a foreign key constraint 'test/t1_ibfk_1' +SET FOREIGN_KEY_CHECKS=ON; +ALTER TABLE t1 ADD b INT; +ALTER TABLE t1 DROP a; +ERROR HY000: Cannot drop index 'a': needed in a foreign key constraint +ALTER TABLE t1 ADD c INT; +DROP TABLE t1, tx; +# +# MDEV-14119 Assertion cmp_rec_rec() on ALTER TABLE +# +CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM seq_1_to_128; +ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a; +DROP TABLE t1; +# +# MDEV-22939 Server crashes in row_make_new_pathname() +# +CREATE TABLE t (a INT) ENGINE=INNODB; +ALTER TABLE t DISCARD TABLESPACE; +ALTER TABLE t ENGINE INNODB; +ERROR HY000: Tablespace has been discarded for table `t` +ALTER TABLE t FORCE; +ERROR HY000: Tablespace has been discarded for table `t` +DROP TABLE t; +# +# MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS +# +CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a)) +ENGINE=InnoDB; +ALTER TABLE t1 CHANGE COLUMN a u INT; +SELECT sf.* FROM information_schema.innodb_sys_fields sf +INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id +INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id +WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos; +INDEX_ID NAME POS +ID b 0 +ID c 0 +ID u 1 +DROP TABLE t1; +# +# End of 10.2 tests +# +# +# Check that innodb supports transactional=1 +# +create table t1 (a int) transactional=1 engine=aria; +create table t2 (a int) transactional=1 engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci TRANSACTIONAL=1 +alter table t1 engine=innodb; +alter table t1 add column b int; +drop table t1,t2; +# +# MDEV-19272 Assertion unireg_check...Field::NEXT_NUMBER failed +# +CREATE TABLE t1 (c INT AUTO_INCREMENT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 MODIFY c INT NOT NULL, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (c TIMESTAMP AUTO_INCREMENT UNIQUE) ENGINE=InnoDB; +ERROR 42000: Incorrect column specifier for column 'c' +CREATE TABLE t1 (c DATETIME AUTO_INCREMENT UNIQUE) ENGINE=InnoDB; +ERROR 42000: Incorrect column specifier for column 'c' +# +# End of 10.4 tests +# +# +# MDEV-21748 ASAN use-after-poison in PageBulk::insertPage() +# +CREATE TABLE t1 (pk TIMESTAMP PRIMARY KEY, a TIMESTAMP NULL UNIQUE) +ENGINE=InnoDB; +INSERT INTO t1 VALUES +('2020-03-10 10:21:00', NULL), +('0000-00-00 00:00:00', '0000-00-00 00:00:00'); +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +DROP TABLE t1; +# +# MDEV-21850 ASAN use-after-poison in page_cur_insert_rec_low() +# +CREATE TABLE t1 (id INT PRIMARY KEY, a YEAR, INDEX(id,a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,NULL),(2,NULL); +UPDATE t1 SET a=0; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_table_upgrade.result b/mysql-test/suite/innodb/r/alter_table_upgrade.result new file mode 100644 index 00000000..5438f5ea --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_table_upgrade.result @@ -0,0 +1,36 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +CREATE TABLE pet4 ( +build_time double(18,7) DEFAULT NULL, +KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +SHOW CREATE TABLE pet4; +Table Create Table +pet4 CREATE TABLE `pet4` ( + `build_time` double(18,7) DEFAULT NULL, + KEY `idx1` (`build_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +CHECK TABLE pet4 FOR UPGRADE; +Table Op Msg_type Msg_text +test.pet4 check status OK +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE pet4; +CREATE TABLE pet4 ( +build_time double(18,7) DEFAULT NULL, +KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +SHOW CREATE TABLE pet4; +Table Create Table +pet4 CREATE TABLE `pet4` ( + `build_time` double(18,7) DEFAULT NULL, + KEY `idx1` (`build_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY; +DROP TABLE pet4; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/alter_varchar_change.result b/mysql-test/suite/innodb/r/alter_varchar_change.result new file mode 100644 index 00000000..8b9608b9 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_varchar_change.result @@ -0,0 +1,509 @@ +CREATE PROCEDURE get_index_id(IN tbl_id INT, IN idx_name char(100), OUT idx_id INT) +BEGIN +SELECT index_id into idx_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE +NAME=idx_name and TABLE_ID=tbl_id; +END| +CREATE PROCEDURE get_table_id(IN tbl_name char(100), OUT tbl_id INT) +BEGIN +SELECT table_id into tbl_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE +NAME = tbl_name; +END| +SET @tbl_id = 0; +SET @tbl1_id = 0; +SET @idx_id = 0; +SET @idx1_id = 0; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) NOT NULL, + PRIMARY KEY (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100), +INDEX idx(f2, f3), index idx1(f3, f2))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150), ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + `f3` varchar(150) DEFAULT NULL, + KEY `idx` (`f2`,`f3`), + KEY `idx1` (`f3`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), +INDEX idx(f2(40)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + KEY `idx` (`f2`(40)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + FULLTEXT KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +f3 VARCHAR(50) as (f2) VIRTUAL, +INDEX idx(f3))ENGINE=InnoDB; +INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40)); +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(100), ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(100) DEFAULT NULL, + `f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL, + KEY `idx` (`f3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(10)), +INDEX idx1(f1))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx1; +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + KEY `idx` (`f2`(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(10)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10)), ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + KEY `idx` (`f2`(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(10)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(50)); +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + KEY `idx` (`f2`(50)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(100)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD INDEX idx1(f1); +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + KEY `idx` (`f2`), + KEY `idx1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(10)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(6)); +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + KEY `idx` (`f2`(6)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + `f3` int(11) DEFAULT NULL, + KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT; +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) NOT NULL, + `f3` int(11) DEFAULT NULL, + PRIMARY KEY (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100))ENGINE=INNODB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD FULLTEXT idx(f2); +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) DEFAULT NULL, + FULLTEXT KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 CHAR(100) PRIMARY KEY)ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 CHAR(200); +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` char(200) NOT NULL, + PRIMARY KEY (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(10)), +INDEX idx1(f1))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(50); +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(50) DEFAULT NULL, + KEY `idx` (`f2`(10)), + KEY `idx1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(10)), +INDEX idx1(f1))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(5), DROP INDEX idx1; +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(5) DEFAULT NULL, + KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +CALL get_index_id(@tbl_id, "idx", @idx_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(50); +CALL get_table_id("test/t1", @tbl1_id); +CALL get_index_id(@tbl1_id, "idx", @idx1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SELECT @idx1_id = @idx_id; +@idx1_id = @idx_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(50) DEFAULT NULL, + FULLTEXT KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 CHAR(200); +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` char(200) DEFAULT NULL, + KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(40)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 TEXT; +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` text DEFAULT NULL, + KEY `idx` (`f2`(40)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(40)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(300); +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(300) DEFAULT NULL, + KEY `idx` (`f2`(40)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(128), +INDEX idx(f2(40)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(300); +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(300) DEFAULT NULL, + KEY `idx` (`f2`(40)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(128), +INDEX idx(f2(40)))ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(300); +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(300) DEFAULT NULL, + KEY `idx` (`f2`(40)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +INDEX idx(f2(40)))ENGINE=InnoDB; +CALL get_table_id("test/t1", @tbl_id); +ALTER TABLE t1 MODIFY f2 VARCHAR(200) CHARACTER SET UTF16; +CALL get_table_id("test/t1", @tbl1_id); +SELECT @tbl1_id = @tbl_id; +@tbl1_id = @tbl_id +0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(200) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL, + KEY `idx` (`f2`(40)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, +f2 VARCHAR(100), +f3 VARCHAR(50) as (f2) VIRTUAL, +INDEX idx(f3))ENGINE=InnoDB; +# If varchar virtual column extension is allowed in the future then +# InnoDB must rebuild the index +ALTER TABLE t1 MODIFY f3 VARCHAR(100); +ERROR HY000: This is not yet supported for generated columns +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` varchar(100) DEFAULT NULL, + `f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL, + KEY `idx` (`f3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +DROP PROCEDURE get_index_id; +DROP PROCEDURE get_table_id; +create table t (a varchar(100)) engine=innodb; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; +name pos mtype prtype len +a 0 1 524303 100 +alter table t modify a varchar(110), algorithm=inplace; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; +name pos mtype prtype len +a 0 1 524303 110 +drop table t; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/analyze_table.result b/mysql-test/suite/innodb/r/analyze_table.result new file mode 100644 index 00000000..83013082 --- /dev/null +++ b/mysql-test/suite/innodb/r/analyze_table.result @@ -0,0 +1,16 @@ +set use_stat_tables='preferably'; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB; +insert into t1 select seq, seq, concat('a', seq) from seq_1_to_500; +SELECT COUNT(*) FROM t1; +COUNT(*) +500 +set @@max_heap_table_size=16384; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/auto_increment_dup.result b/mysql-test/suite/innodb/r/auto_increment_dup.result new file mode 100644 index 00000000..13454570 --- /dev/null +++ b/mysql-test/suite/innodb/r/auto_increment_dup.result @@ -0,0 +1,167 @@ +set global transaction isolation level repeatable read; +CREATE TABLE t1( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +k INT, +c CHAR(1), +UNIQUE KEY(k)) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `k` int(11) DEFAULT NULL, + `c` char(1) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `k` (`k`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# +# Sequential execution +# +INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +# +# 1 duplicate +# +INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2'; +affected rows: 4 +info: Records: 3 Duplicates: 1 Warnings: 0 +# +# 5 rows, consecutive auto_inc values +# +SELECT * FROM t1 order by k; +id k c +1 1 NULL +2 2 2 +3 3 NULL +4 4 NULL +5 5 NULL +affected rows: 5 +DROP TABLE t1; +affected rows: 0 +CREATE TABLE t1( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +k INT, +c CHAR(1), +UNIQUE KEY(k)) ENGINE=InnoDB; +affected rows: 0 +# +# Sequential execution 2 +# +INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2'; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +# +# 1 duplicate +# +INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'; +affected rows: 4 +info: Records: 3 Duplicates: 1 Warnings: 0 +# +# 5 rows, consecutive auto_inc values +# +SELECT * FROM t1 order by k; +id k c +4 1 NULL +1 2 1 +5 3 NULL +2 4 NULL +3 5 NULL +affected rows: 5 +DROP TABLE t1; +affected rows: 0 +CREATE TABLE t1( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +k INT, +c CHAR(1), +UNIQUE KEY(k)) ENGINE=InnoDB; +affected rows: 0 +# +# Parallel execution +# +connect con2, localhost, root; +SET DEBUG_SYNC='now WAIT_FOR write_row_done'; +connect con1, localhost, root; +SET DEBUG_SYNC='ha_write_row_end SIGNAL write_row_done WAIT_FOR continue'; +affected rows: 0 +INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'; +connection con2; +affected rows: 0 +SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue'; +affected rows: 0 +INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2'; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +connection con1; +# +# 2 duplicates +# +affected rows: 4 +info: Records: 3 Duplicates: 1 Warnings: 0 +connection default; +# +# 3 rows +# +SELECT * FROM t1 order by k; +id k c +1 1 NULL +4 2 1 +2 3 NULL +5 4 NULL +6 5 NULL +affected rows: 5 +INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2'; +affected rows: 6 +info: Records: 3 Duplicates: 3 Warnings: 0 +SELECT * FROM t1 order by k; +id k c +1 1 NULL +4 2 2 +2 3 NULL +5 4 2 +6 5 2 +affected rows: 5 +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; +# +# Parallel test with read_committed +# +set global transaction isolation level read committed; +drop table if exists t1; +CREATE TABLE t1( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +k INT, +c CHAR(1), +UNIQUE KEY(k)) ENGINE=InnoDB; +connect con1, localhost, root; +SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1'; +affected rows: 0 +INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'; +connect con2, localhost, root; +SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2'; +affected rows: 0 +SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1'; +affected rows: 0 +INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2'; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +disconnect con2; +connection con1; +affected rows: 4 +info: Records: 3 Duplicates: 1 Warnings: 0 +SET DEBUG_SYNC='RESET'; +# +# 5 rows, gap in autoinc values +# +SELECT * FROM t1 ORDER BY k; +id k c +1 1 NULL +4 2 1 +2 3 NULL +5 4 NULL +6 5 NULL +disconnect con1; +connection default; +DROP TABLE t1; +set global transaction isolation level repeatable read; diff --git a/mysql-test/suite/innodb/r/autoinc_debug.result b/mysql-test/suite/innodb/r/autoinc_debug.result new file mode 100644 index 00000000..b3b7a469 --- /dev/null +++ b/mysql-test/suite/innodb/r/autoinc_debug.result @@ -0,0 +1,107 @@ +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB; +# SETTING auto_increment_increment IN CONNECTION DEFAULT +SET AUTO_INCREMENT_INCREMENT = 1; +# MDEV-24348 InnoDB shutdown hang with innodb_flush_sync=0 +SET GLOBAL innodb_flush_sync=OFF; +# For the server to hang, we must have pages for temporary tables +# (and the bug depended on MDEV-12227 not being fixed). +CREATE TEMPORARY TABLE t (id SERIAL) ENGINE=InnoDB; +SET debug_dbug= '+d,ib_log_flush_ahead'; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# restart +# SETTING auto_increment_increment IN CONNECTION1 +SET AUTO_INCREMENT_INCREMENT = 2; +SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL opened WAIT_FOR flushed1'; +INSERT INTO t1 VALUES(NULL); +connect con1, localhost, root,,; +SET AUTO_INCREMENT_INCREMENT = 2; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +SET DEBUG_SYNC= 'ib_after_row_insert_step SIGNAL flushed1 WAIT_FOR opened1'; +insert into t1 values(NULL); +connection default; +SELECT * FROM t1; +id +1 +3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET DEBUG_SYNC= 'now SIGNAL opened1'; +connection con1; +SELECT * FROM t1; +id +1 +3 +5 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection default; +disconnect con1; +DROP TABLE t1; +CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB; +# SETTING auto_increment_increment IN CONNECTION DEFAULT +SET AUTO_INCREMENT_INCREMENT = 1; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +id +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET DEBUG_SYNC = 'now SIGNAL flushed'; +connect con1, localhost, root,,; +# SETTING auto_increment_increment in connection1 +SET AUTO_INCREMENT_INCREMENT = 2; +SET DEBUG_SYNC= 'now WAIT_FOR flushed'; +SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL opened WAIT_FOR flushed1'; +INSERT INTO t1 values(NULL); +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +SET DEBUG_SYNC= 'ib_after_row_insert_step SIGNAL flushed1 WAIT_FOR opened1'; +INSERT INTO t1 VALUES(NULL); +connection con1; +SELECT * FROM t1; +id +1 +3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET DEBUG_SYNC= 'now SIGNAL opened1'; +disconnect con1; +connection default; +SELECT * FROM t1; +id +1 +3 +5 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET DEBUG_SYNC='RESET'; diff --git a/mysql-test/suite/innodb/r/autoinc_persist,desc.rdiff b/mysql-test/suite/innodb/r/autoinc_persist,desc.rdiff new file mode 100644 index 00000000..639a6064 --- /dev/null +++ b/mysql-test/suite/innodb/r/autoinc_persist,desc.rdiff @@ -0,0 +1,769 @@ +@@ -13,212 +13,212 @@ + # + # Pre-create several tables + SET SQL_MODE='STRICT_ALL_TABLES'; +-CREATE TABLE t1(a TINYINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++CREATE TABLE t1(a TINYINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t1 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31); + SELECT * FROM t1; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 + 31 +-CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t2 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t2 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31); + SELECT * FROM t2; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 + 31 +-CREATE TABLE t3(a SMALLINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t3(a SMALLINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t3 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (1024), (4096); + SELECT * FROM t3; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-1024 + 4096 +-CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1024 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t4 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t4 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (1024), (4096); + SELECT * FROM t4; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-1024 + 4096 +-CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1024 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t5 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (1000000), (1000005); + SELECT * FROM t5; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-1000000 + 1000005 +-CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1000000 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t6 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t6 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (1000000), (1000005); + SELECT * FROM t6; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-1000000 + 1000005 +-CREATE TABLE t7(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++1000000 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t7(a INT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t7 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (100000000), (100000008); + SELECT * FROM t7; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-100000000 + 100000008 +-CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t8 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t8 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (100000000), (100000008); + SELECT * FROM t8; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-100000000 + 100000008 +-CREATE TABLE t9(a BIGINT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t9(a BIGINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t9 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31), (100000000000), (100000000006); + SELECT * FROM t9; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 +-31 +-100000000000 + 100000000006 +-CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000000 ++31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t10 VALUES(-5); + ERROR 22003: Out of range value for column 'a' at row 1 + INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0), + (20), (30), (31), (100000000000), (100000000006); + SELECT * FROM t10; + a +-1 +-2 +-3 +-4 +-8 +-10 +-11 +-20 +-30 +-31 +-100000000000 + 100000000006 +-CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB; ++100000000000 ++31 ++30 ++20 ++11 ++10 ++8 ++4 ++3 ++2 ++1 ++CREATE TABLE t11(a FLOAT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31); + SELECT * FROM t11; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 + 31 +-CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 ++CREATE TABLE t12(a DOUBLE AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; + INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), + (20), (30), (31); + SELECT * FROM t12; + a +--10 +--1 +-1 +-2 +-3 +-4 +-5 +-20 +-30 + 31 ++30 ++20 ++5 ++4 ++3 ++2 ++1 ++-1 ++-10 + # Scenario 1: Normal restart, to test if the counters are persisted + # Scenario 2: Delete some values, to test the counters should not be the + # one which is the largest in current table +@@ -242,14 +242,14 @@ + SELECT MAX(a) AS `Expect 100000000000` FROM t9; + Expect 100000000000 + 100000000000 +-CREATE TABLE t13(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB, ++CREATE TABLE t13(a INT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB, + AUTO_INCREMENT = 1234; + # restart + SHOW CREATE TABLE t13; + Table Create Table + t13 CREATE TABLE `t13` ( + `a` int(11) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t13 VALUES(0); + SELECT a AS `Expect 1234` FROM t13; +@@ -464,28 +464,28 @@ + INSERT INTO t1 VALUES(0), (0); + SELECT * FROM t1; + a +-1 + 2 ++1 + INSERT INTO t3 VALUES(0), (0); + SELECT * FROM t3; + a +-1 + 2 ++1 + INSERT INTO t5 VALUES(0), (0); + SELECT * FROM t5; + a +-1 + 2 ++1 + INSERT INTO t7 VALUES(0), (0); + SELECT * FROM t7; + a +-1 + 2 ++1 + INSERT INTO t9 VALUES(0), (0); + SELECT * FROM t9; + a +-1 + 2 ++1 + # Ensure that all changes before the server is killed are persisted. + set global innodb_flush_log_at_trx_commit=1; + TRUNCATE TABLE t1; +@@ -498,63 +498,63 @@ + INSERT INTO t19 VALUES(0), (0); + SELECT * FROM t19; + a +-1 + 2 ++1 + # restart + INSERT INTO t1 VALUES(0), (0); + SELECT * FROM t1; + a +-1 + 2 ++1 + INSERT INTO t3 VALUES(0), (0); + SELECT * FROM t3; + a +-1 + 2 ++1 + INSERT INTO t5 VALUES(0), (0); + SELECT * FROM t5; + a +-1 + 2 ++1 + INSERT INTO t7 VALUES(0), (0); + SELECT * FROM t7; + a +-1 + 2 ++1 + INSERT INTO t19 VALUES(0), (0); + SELECT * FROM t19; + a +-1 +-2 +-3 + 4 ++3 ++2 ++1 + DELETE FROM t19 WHERE a = 4; + RENAME TABLE t19 to t9; + INSERT INTO t9 VALUES(0), (0); + SELECT * FROM t9; + a +-1 +-2 +-3 +-5 + 6 ++5 ++3 ++2 ++1 + TRUNCATE TABLE t9; + INSERT INTO t9 VALUES(0), (0); + SELECT * FROM t9; + a +-1 + 2 ++1 + # Scenario 8: Test ALTER TABLE operations + INSERT INTO t3 VALUES(0), (0), (100), (200), (1000); + SELECT * FROM t3; + a +-1 +-2 +-3 +-4 +-100 +-200 + 1000 ++200 ++100 ++4 ++3 ++2 ++1 + DELETE FROM t3 WHERE a > 300; + SELECT MAX(a) AS `Expect 200` FROM t3; + Expect 200 +@@ -566,7 +566,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0); + SELECT MAX(a) AS `Expect 201` FROM t3; +@@ -579,7 +579,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0); + SELECT MAX(a) AS `Expect 500` FROM t3; +@@ -591,13 +591,13 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0), (0); + SELECT * FROM t3; + a +-100 + 101 ++100 + INSERT INTO t3 VALUES(150), (180); + UPDATE t3 SET a = 200 WHERE a = 150; + INSERT INTO t3 VALUES(220); +@@ -607,7 +607,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t3 VALUES(0); + SELECT MAX(a) AS `Expect 221` FROM t3; +@@ -619,7 +619,7 @@ + Table Create Table + t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # MDEV-6076: Test adding an AUTO_INCREMENT COLUMN + CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; +@@ -669,18 +669,18 @@ + INSERT INTO t_inplace SELECT * FROM t3; + SELECT * FROM t_inplace; + a +-100 +-101 +-120 +-121 +-122 +-200 + 210 ++200 ++122 ++121 ++120 ++101 ++100 + SHOW CREATE TABLE t_inplace; + Table Create Table + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This will keep the autoinc counter + ALTER TABLE t_inplace AUTO_INCREMENT = 250, ALGORITHM = INPLACE; +@@ -689,7 +689,7 @@ + Table Create Table + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should keep the autoinc counter as well + ALTER TABLE t_inplace ADD COLUMN b INT, ALGORITHM = INPLACE; +@@ -699,16 +699,16 @@ + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + DELETE FROM t_inplace WHERE a > 150; + SELECT * FROM t_inplace; + a b +-100 NULL +-101 NULL +-120 NULL +-121 NULL + 122 NULL ++121 NULL ++120 NULL ++101 NULL ++100 NULL + # This should reset the autoinc counter to the one specified + # Since it's smaller than current one but bigger than existing + # biggest counter in the table +@@ -719,7 +719,7 @@ + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should reset the autoinc counter to the next value of + # current max counter in the table, since the specified value +@@ -730,7 +730,7 @@ + Table Create Table + t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t_inplace VALUES(0), (0); + SELECT MAX(a) AS `Expect 124` FROM t_inplace; +@@ -757,18 +757,18 @@ + INSERT INTO t_copy SELECT * FROM t3; + SELECT * FROM t_copy; + a +-100 +-101 +-120 +-121 +-122 +-200 + 210 ++200 ++122 ++121 ++120 ++101 ++100 + SHOW CREATE TABLE t_copy; + Table Create Table + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This will keep the autoinc counter + ALTER TABLE t_copy AUTO_INCREMENT = 250, ALGORITHM = COPY; +@@ -777,7 +777,7 @@ + Table Create Table + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should keep the autoinc counter as well + ALTER TABLE t_copy ADD COLUMN b INT, ALGORITHM = COPY; +@@ -787,16 +787,16 @@ + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + DELETE FROM t_copy WHERE a > 150; + SELECT * FROM t_copy; + a b +-100 NULL +-101 NULL +-120 NULL +-121 NULL + 122 NULL ++121 NULL ++120 NULL ++101 NULL ++100 NULL + # This should reset the autoinc counter to the one specified + # Since it's smaller than current one but bigger than existing + # biggest counter in the table +@@ -807,7 +807,7 @@ + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + # This should reset the autoinc counter to the next value of + # current max counter in the table, since the specified value +@@ -818,7 +818,7 @@ + Table Create Table + t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, +- PRIMARY KEY (`a`) ++ PRIMARY KEY (`a` DESC) + ) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + INSERT INTO t_copy VALUES(0), (0); + SELECT MAX(a) AS `Expect 124` FROM t_copy; +@@ -842,7 +842,7 @@ + 126 + DROP TABLE t_copy, it_copy; + # Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO +-CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, key(b)) ENGINE = InnoDB; ++CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(a DESC), b INT, key(b)) ENGINE = InnoDB; + set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; + INSERT INTO t30 VALUES(NULL, 1), (200, 2), (0, 3); + INSERT INTO t30(b) VALUES(4), (5), (6), (7); +@@ -869,20 +869,20 @@ + set global innodb_flush_log_at_trx_commit=1; + CREATE TABLE t31 (a INT) ENGINE = InnoDB; + INSERT INTO t31 VALUES(1), (2); +-ALTER TABLE t31 ADD b INT AUTO_INCREMENT PRIMARY KEY; ++ALTER TABLE t31 ADD b INT AUTO_INCREMENT, ADD PRIMARY KEY(b DESC); + INSERT INTO t31 VALUES(3, 0), (4, NULL), (5, NULL); + INSERT INTO t31 VALUES(6, 0); + ERROR 23000: Duplicate entry '0' for key 'PRIMARY' + SELECT * FROM t31; + a b +-3 0 +-1 1 +-2 2 +-4 3 + 5 4 ++4 3 ++2 2 ++1 1 ++3 0 + SET SQL_MODE = 0; + # Scenario 10: Rollback would not rollback the counter +-CREATE TABLE t32 (a BIGINT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t32 (a BIGINT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE=InnoDB; + INSERT INTO t32 VALUES(0), (0); + # Ensure that all changes before the server is killed are persisted. + set global innodb_flush_log_at_trx_commit=1; +@@ -897,7 +897,7 @@ + # increasing the counter + CREATE TABLE t33 ( + a BIGINT NOT NULL PRIMARY KEY, +-b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; ++b BIGINT NOT NULL AUTO_INCREMENT, INDEX(b DESC)) ENGINE = InnoDB; + INSERT INTO t33 VALUES(1, NULL); + INSERT INTO t33 VALUES(2, NULL); + INSERT INTO t33 VALUES(2, NULL); +@@ -920,13 +920,13 @@ + INSERT INTO t31(a) VALUES(6), (0); + SELECT * FROM t31; + a b +-3 0 +-1 1 +-2 2 +-4 3 +-5 4 +-6 5 + 0 6 ++6 5 ++5 4 ++4 3 ++2 2 ++1 1 ++3 0 + DROP TABLE t31; + set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; + DELETE FROM t30 WHERE a = 0; +@@ -965,7 +965,7 @@ + DROP TABLE t33; + CREATE TABLE t33 ( + a BIGINT NOT NULL PRIMARY KEY, +-b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; ++b BIGINT NOT NULL AUTO_INCREMENT, INDEX(b DESC)) ENGINE = InnoDB; + ALTER TABLE t33 DISCARD TABLESPACE; + restore: t33 .ibd and .cfg files + ALTER TABLE t33 IMPORT TABLESPACE; +@@ -975,7 +975,7 @@ + 4 + SELECT * FROM t33; + a b +-10 1 +-2 2 + 3 4 ++2 2 ++10 1 + DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; diff --git a/mysql-test/suite/innodb/r/autoinc_persist.result b/mysql-test/suite/innodb/r/autoinc_persist.result new file mode 100644 index 00000000..9e5cd4ad --- /dev/null +++ b/mysql-test/suite/innodb/r/autoinc_persist.result @@ -0,0 +1,981 @@ +# +# MDEV-6076 Persistent AUTO_INCREMENT for InnoDB +# +# WL#6204 InnoDB persistent max value for autoinc columns +# +# Most of this test case is copied from the test innodb.autoinc_persist +# that was introduced in MySQL 8.0.0. The observable behaviour +# of MDEV-6076 is equivalent to WL#6204, with the exception that +# there is less buffering taking place and redo log checkpoints +# are not being treated specially. +# Due to less buffering, there is no debug instrumentation testing +# for MDEV-6076. +# +# Pre-create several tables +SET SQL_MODE='STRICT_ALL_TABLES'; +CREATE TABLE t1(a TINYINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t1 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t1; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +CREATE TABLE t2(a TINYINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t2 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t2 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31); +SELECT * FROM t2; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +CREATE TABLE t3(a SMALLINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t3 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (1024), (4096); +SELECT * FROM t3; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +1024 +4096 +CREATE TABLE t4(a SMALLINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t4 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t4 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (1024), (4096); +SELECT * FROM t4; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +1024 +4096 +CREATE TABLE t5(a MEDIUMINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t5 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (1000000), (1000005); +SELECT * FROM t5; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +1000000 +1000005 +CREATE TABLE t6(a MEDIUMINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t6 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t6 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (1000000), (1000005); +SELECT * FROM t6; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +1000000 +1000005 +CREATE TABLE t7(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t7 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (100000000), (100000008); +SELECT * FROM t7; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +100000000 +100000008 +CREATE TABLE t8(a INT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t8 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t8 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (100000000), (100000008); +SELECT * FROM t8; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +100000000 +100000008 +CREATE TABLE t9(a BIGINT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t9 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31), (100000000000), (100000000006); +SELECT * FROM t9; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +100000000000 +100000000006 +CREATE TABLE t10(a BIGINT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t10 VALUES(-5); +ERROR 22003: Out of range value for column 'a' at row 1 +INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0), +(20), (30), (31), (100000000000), (100000000006); +SELECT * FROM t10; +a +1 +2 +3 +4 +8 +10 +11 +20 +30 +31 +100000000000 +100000000006 +CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t11; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; +INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), +(20), (30), (31); +SELECT * FROM t12; +a +-10 +-1 +1 +2 +3 +4 +5 +20 +30 +31 +# Scenario 1: Normal restart, to test if the counters are persisted +# Scenario 2: Delete some values, to test the counters should not be the +# one which is the largest in current table +DELETE FROM t1 WHERE a > 30; +SELECT MAX(a) AS `Expect 30` FROM t1; +Expect 30 +30 +DELETE FROM t3 WHERE a > 2000; +SELECT MAX(a) AS `Expect 2000` FROM t3; +Expect 2000 +1024 +DELETE FROM t5 WHERE a > 1000000; +SELECT MAX(a) AS `Expect 1000000` FROM t5; +Expect 1000000 +1000000 +DELETE FROM t7 WHERE a > 100000000; +SELECT MAX(a) AS `Expect 100000000` FROM t7; +Expect 100000000 +100000000 +DELETE FROM t9 WHERE a > 100000000000; +SELECT MAX(a) AS `Expect 100000000000` FROM t9; +Expect 100000000000 +100000000000 +CREATE TABLE t13(a INT AUTO_INCREMENT KEY) ENGINE = InnoDB, +AUTO_INCREMENT = 1234; +# restart +SHOW CREATE TABLE t13; +Table Create Table +t13 CREATE TABLE `t13` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t13 VALUES(0); +SELECT a AS `Expect 1234` FROM t13; +Expect 1234 +1234 +DROP TABLE t13; +INSERT INTO t1 VALUES(0), (0); +SELECT MAX(a) AS `Expect 33` FROM t1; +Expect 33 +33 +INSERT INTO t3 VALUES(0), (0); +SELECT MAX(a) AS `Expect 4098` FROM t3; +Expect 4098 +4098 +INSERT INTO t5 VALUES(0), (0); +SELECT MAX(a) AS `Expect 1000007` FROM t5; +Expect 1000007 +1000007 +INSERT INTO t7 VALUES(0), (0); +SELECT MAX(a) AS `Expect 100000010` FROM t7; +Expect 100000010 +100000010 +INSERT INTO t9 VALUES(0), (0); +SELECT MAX(a) AS `Expect 100000000008` FROM t9; +Expect 100000000008 +100000000008 +# Scenario 3: Insert some bigger counters, the next counter should start +# from there +INSERT INTO t1 VALUES(40), (0); +INSERT INTO t1 VALUES(42), (0); +SELECT a AS `Expect 43, 42` FROM t1 ORDER BY a DESC LIMIT 4; +Expect 43, 42 +43 +42 +41 +40 +INSERT INTO t3 VALUES(5000), (0); +INSERT INTO t3 VALUES(5010), (0); +SELECT a AS `Expect 5011, 5010` FROM t3 ORDER BY a DESC LIMIT 4; +Expect 5011, 5010 +5011 +5010 +5001 +5000 +INSERT INTO t5 VALUES(1000010), (0); +INSERT INTO t5 VALUES(1000020), (0); +SELECT a AS `Expect 1000021, 1000020` FROM t5 ORDER BY a DESC LIMIT 4; +Expect 1000021, 1000020 +1000021 +1000020 +1000011 +1000010 +INSERT INTO t7 VALUES(100000020), (0); +INSERT INTO t7 VALUES(100000030), (0); +SELECT a AS `Expect 100000031, 100000030` FROM t7 ORDER BY a DESC LIMIT 4; +Expect 100000031, 100000030 +100000031 +100000030 +100000021 +100000020 +INSERT INTO t9 VALUES(100000000010), (0); +INSERT INTO t9 VALUES(100000000020), (0); +SELECT a AS `Expect 100000000021, 100000000020` FROM t9 ORDER BY a DESC LIMIT 4; +Expect 100000000021, 100000000020 +100000000021 +100000000020 +100000000011 +100000000010 +# Scenario 4: Update some values, to test the counters should be updated +# to the bigger value, but not smaller value. +INSERT INTO t1 VALUES(50), (55); +UPDATE t1 SET a = 105 WHERE a = 5; +UPDATE t1 SET a = 100 WHERE a = 55; +# This should insert 102, 106, 107, and make next counter 109. +INSERT INTO t1 VALUES(102), (0), (0); +SELECT a AS `Expect 107, 106` FROM t1 ORDER BY a DESC LIMIT 2; +Expect 107, 106 +107 +106 +DELETE FROM t1 WHERE a > 105; +INSERT INTO t1 VALUES(0); +SELECT MAX(a) AS `Expect 109` FROM t1; +Expect 109 +109 +# Test the same things on t3, t5, t7, t9, to test if DDTableBuffer would +# be updated accordingly +INSERT INTO t3 VALUES(60), (65); +UPDATE t3 SET a = 6005 WHERE a = 5; +UPDATE t3 SET a = 6000 WHERE a = 60; +# This should insert 6002, 6006, 6007, and make next counter 6009. +INSERT INTO t3 VALUES(6002), (0), (0); +SELECT a AS `Expect 6007, 6006` FROM t3 ORDER BY a DESC LIMIT 2; +Expect 6007, 6006 +6007 +6006 +DELETE FROM t3 WHERE a > 6005; +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 6009` FROM t3; +Expect 6009 +6009 +INSERT INTO t5 VALUES(100), (200); +UPDATE t5 SET a = 1000105 WHERE a = 5; +UPDATE t5 SET a = 1000100 WHERE a = 100; +# This should insert 1000102, 1000106, 1000107, and make next counter +# 1000109. +INSERT INTO t5 VALUES(1000102), (0), (0); +SELECT a AS `Expect 1000107, 1000106` FROM t5 ORDER BY a DESC LIMIT 2; +Expect 1000107, 1000106 +1000107 +1000106 +DELETE FROM t5 WHERE a > 1000105; +INSERT INTO t5 VALUES(0); +SELECT MAX(a) AS `Expect 1000109` FROM t5; +Expect 1000109 +1000109 +INSERT INTO t7 VALUES(100), (200); +UPDATE t7 SET a = 100000105 WHERE a = 5; +UPDATE t7 SET a = 100000100 WHERE a = 100; +# This should insert 100000102, 1100000106, 100000107, and make next +# counter 100000109. +INSERT INTO t7 VALUES(100000102), (0), (0); +SELECT a AS `Expect 100000107, 100000106` FROM t7 ORDER BY a DESC LIMIT 2; +Expect 100000107, 100000106 +100000107 +100000106 +DELETE FROM t7 WHERE a > 100000105; +INSERT INTO t7 VALUES(0); +SELECT MAX(a) AS `Expect 100000109` FROM t7; +Expect 100000109 +100000109 +INSERT INTO t9 VALUES(100), (200); +UPDATE t9 SET a = 100000000105 WHERE a = 5; +UPDATE t9 SET a = 100000000100 WHERE a = 100; +# This should insert 100000000102, 100000000106, 100000000107, and make +# next counter 100000000109. +INSERT INTO t9 VALUES(100000000102), (0), (0); +SELECT a AS `Expect 100000000107, 100000000106` FROM t9 ORDER BY a DESC LIMIT 2; +Expect 100000000107, 100000000106 +100000000107 +100000000106 +DELETE FROM t9 WHERE a > 100000000105; +INSERT INTO t9 VALUES(0); +SELECT MAX(a) AS `Expect 100000000109` FROM t9; +Expect 100000000109 +100000000109 +# restart +INSERT INTO t1 VALUES(0), (0); +SELECT a AS `Expect 110, 111` FROM t1 ORDER BY a DESC LIMIT 2; +Expect 110, 111 +111 +110 +INSERT INTO t3 VALUES(0), (0); +SELECT a AS `Expect 6010, 6011` FROM t3 ORDER BY a DESC LIMIT 2; +Expect 6010, 6011 +6011 +6010 +INSERT INTO t5 VALUES(0), (0); +SELECT a AS `Expect 1100111, 1100110` FROM t5 ORDER BY a DESC LIMIT 2; +Expect 1100111, 1100110 +1000111 +1000110 +INSERT INTO t7 VALUES(0), (0); +SELECT a AS `Expect 100000111, 100000110` FROM t7 ORDER BY a DESC LIMIT 2; +Expect 100000111, 100000110 +100000111 +100000110 +INSERT INTO t9 VALUES(0), (0); +SELECT a AS `Expect 100000000111, 100000000110` FROM t9 ORDER BY a DESC LIMIT 2; +Expect 100000000111, 100000000110 +100000000111 +100000000110 +# Scenario 5: Test kill the server +INSERT INTO t1 VALUES(125); +DELETE FROM t1 WHERE a = 125; +INSERT INTO t3 VALUES(6100); +DELETE FROM t3 WHERE a = 6100; +INSERT INTO t5 VALUES(1100200); +DELETE FROM t5 WHERE a = 1100200; +INSERT INTO t7 VALUES(100000200); +DELETE FROM t7 WHERE a = 100000200; +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +INSERT INTO t9 VALUES(100000000200); +DELETE FROM t9 WHERE a = 100000000200; +# restart +INSERT INTO t1 VALUES(0); +SELECT a AS `Expect 126` FROM t1 ORDER BY a DESC LIMIT 1; +Expect 126 +126 +INSERT INTO t3 VALUES(0); +SELECT a AS `Expect 6101` FROM t3 ORDER BY a DESC LIMIT 1; +Expect 6101 +6101 +INSERT INTO t5 VALUES(0); +SELECT a AS `Expect 1100201` FROM t5 ORDER BY a DESC LIMIT 1; +Expect 1100201 +1100201 +INSERT INTO t7 VALUES(0); +SELECT a AS `Expect 100000201` FROM t7 ORDER BY a DESC LIMIT 1; +Expect 100000201 +100000201 +INSERT INTO t9 VALUES(0); +SELECT a AS `Expect 100000000201` FROM t9 ORDER BY a DESC LIMIT 1; +Expect 100000000201 +100000000201 +# Scenario 6: Test truncate will reset the counters to 0 +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +TRUNCATE TABLE t5; +TRUNCATE TABLE t7; +TRUNCATE TABLE t9; +INSERT INTO t1 VALUES(0), (0); +SELECT * FROM t1; +a +1 +2 +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; +a +1 +2 +INSERT INTO t5 VALUES(0), (0); +SELECT * FROM t5; +a +1 +2 +INSERT INTO t7 VALUES(0), (0); +SELECT * FROM t7; +a +1 +2 +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; +a +1 +2 +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +TRUNCATE TABLE t1; +TRUNCATE TABLE t3; +TRUNCATE TABLE t5; +TRUNCATE TABLE t7; +TRUNCATE TABLE t9; +# Scenario 7: Test explicit rename table won't change the counter +RENAME TABLE t9 to t19; +INSERT INTO t19 VALUES(0), (0); +SELECT * FROM t19; +a +1 +2 +# restart +INSERT INTO t1 VALUES(0), (0); +SELECT * FROM t1; +a +1 +2 +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; +a +1 +2 +INSERT INTO t5 VALUES(0), (0); +SELECT * FROM t5; +a +1 +2 +INSERT INTO t7 VALUES(0), (0); +SELECT * FROM t7; +a +1 +2 +INSERT INTO t19 VALUES(0), (0); +SELECT * FROM t19; +a +1 +2 +3 +4 +DELETE FROM t19 WHERE a = 4; +RENAME TABLE t19 to t9; +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; +a +1 +2 +3 +5 +6 +TRUNCATE TABLE t9; +INSERT INTO t9 VALUES(0), (0); +SELECT * FROM t9; +a +1 +2 +# Scenario 8: Test ALTER TABLE operations +INSERT INTO t3 VALUES(0), (0), (100), (200), (1000); +SELECT * FROM t3; +a +1 +2 +3 +4 +100 +200 +1000 +DELETE FROM t3 WHERE a > 300; +SELECT MAX(a) AS `Expect 200` FROM t3; +Expect 200 +200 +# This will not change the counter to 150, but to 201, which is the next +# of current max counter in the table +ALTER TABLE t3 AUTO_INCREMENT = 150; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 201` FROM t3; +Expect 201 +201 +# This will change the counter to 500, which is bigger than any counter +# in the table +ALTER TABLE t3 AUTO_INCREMENT = 500; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 500` FROM t3; +Expect 500 +500 +TRUNCATE TABLE t3; +ALTER TABLE t3 AUTO_INCREMENT = 100; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t3 VALUES(0), (0); +SELECT * FROM t3; +a +100 +101 +INSERT INTO t3 VALUES(150), (180); +UPDATE t3 SET a = 200 WHERE a = 150; +INSERT INTO t3 VALUES(220); +# This still fails to set to 120, but just 221 +ALTER TABLE t3 AUTO_INCREMENT = 120; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 221` FROM t3; +Expect 221 +221 +DELETE FROM t3 WHERE a > 120; +ALTER TABLE t3 AUTO_INCREMENT = 120; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# MDEV-6076: Test adding an AUTO_INCREMENT COLUMN +CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; +INSERT INTO mdev6076a VALUES(2),(1); +CREATE TABLE mdev6076b (b INT) ENGINE=InnoDB; +INSERT INTO mdev6076b VALUES(2),(1); +ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED +ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE; +ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100, +ALGORITHM=INPLACE; +# MDEV-6076: Test root page split and page_create_empty() +CREATE TABLE mdev6076empty (b SERIAL, pad CHAR(255) NOT NULL DEFAULT '') +ENGINE=InnoDB; +BEGIN; +# Insert records in descending order of AUTO_INCREMENT, +# causing a page split on the very last insert. +# Without the fix in btr_page_empty() this would lose the counter value. +# Without the fix in page_create_empty() the counter value would be lost +# when ROLLBACK deletes the last row. +ROLLBACK; +# restart +INSERT INTO t3 VALUES(0); +SELECT MAX(a) AS `Expect 120` FROM t3; +Expect 120 +120 +INSERT INTO mdev6076a SET b=NULL; +SELECT * FROM mdev6076a; +a b +1 2 +2 1 +3 NULL +INSERT INTO mdev6076b SET b=NULL; +SELECT * FROM mdev6076b; +a b +100 2 +101 1 +102 NULL +INSERT INTO mdev6076empty SET b=NULL; +SELECT * FROM mdev6076empty; +b pad +56 +DROP TABLE mdev6076a, mdev6076b, mdev6076empty; +INSERT INTO t3 VALUES(0), (0), (200), (210); +# Test the different algorithms in ALTER TABLE +CREATE TABLE t_inplace LIKE t3; +INSERT INTO t_inplace SELECT * FROM t3; +SELECT * FROM t_inplace; +a +100 +101 +120 +121 +122 +200 +210 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# This will keep the autoinc counter +ALTER TABLE t_inplace AUTO_INCREMENT = 250, ALGORITHM = INPLACE; +# We expect the counter to be 250 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# This should keep the autoinc counter as well +ALTER TABLE t_inplace ADD COLUMN b INT, ALGORITHM = INPLACE; +# We expect the counter to be 250 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DELETE FROM t_inplace WHERE a > 150; +SELECT * FROM t_inplace; +a b +100 NULL +101 NULL +120 NULL +121 NULL +122 NULL +# This should reset the autoinc counter to the one specified +# Since it's smaller than current one but bigger than existing +# biggest counter in the table +ALTER TABLE t_inplace AUTO_INCREMENT = 180, ALGORITHM = INPLACE; +# We expect the counter to be 180 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# This should reset the autoinc counter to the next value of +# current max counter in the table, since the specified value +# is smaller than the existing biggest value(50 < 123) +ALTER TABLE t_inplace DROP COLUMN b, AUTO_INCREMENT = 50, ALGORITHM = INPLACE; +# We expect the counter to be 123 +SHOW CREATE TABLE t_inplace; +Table Create Table +t_inplace CREATE TABLE `t_inplace` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t_inplace VALUES(0), (0); +SELECT MAX(a) AS `Expect 124` FROM t_inplace; +Expect 124 +124 +OPTIMIZE TABLE t_inplace; +Table Op Msg_type Msg_text +test.t_inplace optimize note Table does not support optimize, doing recreate + analyze instead +test.t_inplace optimize status OK +DELETE FROM t_inplace WHERE a >= 123; +CREATE TABLE it_inplace(a INT AUTO_INCREMENT, INDEX(a)) AUTO_INCREMENT=125 ENGINE=InnoDB; +CREATE UNIQUE INDEX idx_aa ON it_inplace(a); +# restart +INSERT INTO t_inplace VALUES(0), (0); +INSERT INTO it_inplace VALUES(0), (0); +SELECT MAX(a) AS `Expect 126` FROM t_inplace; +Expect 126 +126 +SELECT MAX(a) AS `Expect 126` FROM it_inplace; +Expect 126 +126 +DROP TABLE t_inplace, it_inplace; +CREATE TABLE t_copy LIKE t3; +INSERT INTO t_copy SELECT * FROM t3; +SELECT * FROM t_copy; +a +100 +101 +120 +121 +122 +200 +210 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# This will keep the autoinc counter +ALTER TABLE t_copy AUTO_INCREMENT = 250, ALGORITHM = COPY; +# We expect the counter to be 250 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# This should keep the autoinc counter as well +ALTER TABLE t_copy ADD COLUMN b INT, ALGORITHM = COPY; +# We expect the counter to be 250 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DELETE FROM t_copy WHERE a > 150; +SELECT * FROM t_copy; +a b +100 NULL +101 NULL +120 NULL +121 NULL +122 NULL +# This should reset the autoinc counter to the one specified +# Since it's smaller than current one but bigger than existing +# biggest counter in the table +ALTER TABLE t_copy AUTO_INCREMENT = 180, ALGORITHM = COPY; +# We expect the counter to be 180 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# This should reset the autoinc counter to the next value of +# current max counter in the table, since the specified value +# is smaller than the existing biggest value(50 < 123) +ALTER TABLE t_copy DROP COLUMN b, AUTO_INCREMENT = 50, ALGORITHM = COPY; +# We expect the counter to be 123 +SHOW CREATE TABLE t_copy; +Table Create Table +t_copy CREATE TABLE `t_copy` ( + `a` smallint(6) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t_copy VALUES(0), (0); +SELECT MAX(a) AS `Expect 124` FROM t_copy; +Expect 124 +124 +OPTIMIZE TABLE t_copy; +Table Op Msg_type Msg_text +test.t_copy optimize note Table does not support optimize, doing recreate + analyze instead +test.t_copy optimize status OK +DELETE FROM t_copy WHERE a >= 123; +CREATE TABLE it_copy(a INT AUTO_INCREMENT, INDEX(a)) AUTO_INCREMENT=125 ENGINE=InnoDB; +CREATE UNIQUE INDEX idx_aa ON it_copy(a); +# restart +INSERT INTO t_copy VALUES(0), (0); +INSERT INTO it_copy VALUES(0), (0); +SELECT MAX(a) AS `Expect 126` FROM t_copy; +Expect 126 +126 +SELECT MAX(a) AS `Expect 126` FROM it_copy; +Expect 126 +126 +DROP TABLE t_copy, it_copy; +# Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO +CREATE TABLE t30 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, key(b)) ENGINE = InnoDB; +set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; +INSERT INTO t30 VALUES(NULL, 1), (200, 2), (0, 3); +INSERT INTO t30(b) VALUES(4), (5), (6), (7); +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +0 3 +201 4 +202 5 +203 6 +204 7 +ALTER TABLE t30 MODIFY b MEDIUMINT; +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +0 3 +201 4 +202 5 +203 6 +204 7 +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +CREATE TABLE t31 (a INT) ENGINE = InnoDB; +INSERT INTO t31 VALUES(1), (2); +ALTER TABLE t31 ADD b INT AUTO_INCREMENT PRIMARY KEY; +INSERT INTO t31 VALUES(3, 0), (4, NULL), (5, NULL); +INSERT INTO t31 VALUES(6, 0); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SELECT * FROM t31; +a b +3 0 +1 1 +2 2 +4 3 +5 4 +SET SQL_MODE = 0; +# Scenario 10: Rollback would not rollback the counter +CREATE TABLE t32 (a BIGINT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t32 VALUES(0), (0); +# Ensure that all changes before the server is killed are persisted. +set global innodb_flush_log_at_trx_commit=1; +START TRANSACTION; +INSERT INTO t32 VALUES(0), (0); +SELECT MAX(a) AS `Expect 4` FROM t32; +Expect 4 +4 +DELETE FROM t32 WHERE a >= 2; +ROLLBACK; +# Scenario 11: Test duplicate primary key/secondary key will not stop +# increasing the counter +CREATE TABLE t33 ( +a BIGINT NOT NULL PRIMARY KEY, +b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; +INSERT INTO t33 VALUES(1, NULL); +INSERT INTO t33 VALUES(2, NULL); +INSERT INTO t33 VALUES(2, NULL); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +INSERT INTO t33 VALUES(3, NULL); +SELECT MAX(b) AS `Expect 4` FROM t33; +Expect 4 +4 +TRUNCATE TABLE t33; +INSERT INTO t33 VALUES(1, NULL); +INSERT INTO t33 VALUES(2, NULL); +set global innodb_flush_log_at_trx_commit=1; +START TRANSACTION; +UPDATE t33 SET a = 10 WHERE a = 1; +INSERT INTO t33 VALUES(2, NULL); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +COMMIT; +# restart +# This will not insert 0 +INSERT INTO t31(a) VALUES(6), (0); +SELECT * FROM t31; +a b +3 0 +1 1 +2 2 +4 3 +5 4 +6 5 +0 6 +DROP TABLE t31; +set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; +DELETE FROM t30 WHERE a = 0; +UPDATE t30 set a = 0 where b = 5; +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +201 4 +0 5 +203 6 +204 7 +DELETE FROM t30 WHERE a = 0; +UPDATE t30 SET a = NULL WHERE b = 6; +Warnings: +Warning 1048 Column 'a' cannot be null +UPDATE t30 SET a = 300 WHERE b = 7; +SELECT * FROM t30 ORDER BY b; +a b +1 1 +200 2 +201 4 +0 6 +300 7 +SET SQL_MODE = 0; +SELECT MAX(a) AS `Expect 2` FROM t32; +Expect 2 +2 +INSERT INTO t32 VALUES(0), (0); +SELECT MAX(a) AS `Expect 6` FROM t32; +Expect 6 +6 +FLUSH TABLES t33 FOR EXPORT; +backup: t33 +UNLOCK TABLES; +DROP TABLE t33; +CREATE TABLE t33 ( +a BIGINT NOT NULL PRIMARY KEY, +b BIGINT NOT NULL AUTO_INCREMENT, KEY(b)) ENGINE = InnoDB; +ALTER TABLE t33 DISCARD TABLESPACE; +restore: t33 .ibd and .cfg files +ALTER TABLE t33 IMPORT TABLESPACE; +INSERT INTO t33 VALUES(3, NULL); +SELECT MAX(b) AS `Expect 4` FROM t33; +Expect 4 +4 +SELECT * FROM t33; +a b +10 1 +2 2 +3 4 +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; diff --git a/mysql-test/suite/innodb/r/binlog_consistent.result b/mysql-test/suite/innodb/r/binlog_consistent.result new file mode 100644 index 00000000..cceca394 --- /dev/null +++ b/mysql-test/suite/innodb/r/binlog_consistent.result @@ -0,0 +1,123 @@ +RESET MASTER; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connect con4,localhost,root,,; +connection default; +CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb; +INSERT INTO t1 VALUES(9, ""); +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 +SHOW STATUS LIKE 'binlog_snapshot_%'; +Variable_name Value +Binlog_snapshot_file master-bin.000001 +Binlog_snapshot_position +BEGIN; +INSERT INTO t1 VALUES (0, ""); +connection con1; +BEGIN; +INSERT INTO t1 VALUES (1, ""); +connection con2; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam; +BEGIN; +INSERT INTO t1 VALUES (2, "first"); +INSERT INTO t2 VALUES (2); +INSERT INTO t1 VALUES (2, "second"); +connection default; +COMMIT; +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection con3; +BEGIN; +INSERT INTO t1 VALUES (3, ""); +INSERT INTO t2 VALUES (3); +connection con4; +BEGIN; +INSERT INTO t1 VALUES (4, ""); +COMMIT; +connection default; +SELECT * FROM t1 ORDER BY a,b; +a b +0 +9 +SHOW STATUS LIKE 'binlog_snapshot_%'; +Variable_name Value +Binlog_snapshot_file master-bin.000001 +Binlog_snapshot_position +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 +SELECT * FROM t2 ORDER BY a; +a +2 +3 +connection con1; +COMMIT; +connection con2; +COMMIT; +connection con3; +COMMIT; +FLUSH LOGS; +connection default; +SELECT * FROM t1 ORDER BY a,b; +a b +0 +9 +SHOW STATUS LIKE 'binlog_snapshot_%'; +Variable_name Value +Binlog_snapshot_file master-bin.000001 +Binlog_snapshot_position +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000002 +COMMIT; +SHOW STATUS LIKE 'binlog_snapshot_%'; +Variable_name Value +Binlog_snapshot_file master-bin.000002 +Binlog_snapshot_position +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000002 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(9, "") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (0, "") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (3) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4, "") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1, "") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2, "first") +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2, "second") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3, "") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Rotate # # master-bin.000002;pos=POS +*** MDEV-7310: last_commit_pos_offset set to wrong value after binlog rotate in group commit *** +SET @old_size= @@GLOBAL.max_binlog_size; +SET GLOBAL max_binlog_size=4096; +CREATE TABLE t3 (a INT PRIMARY KEY, b VARBINARY(8192)) ENGINE=MyISAM; +INSERT INTO t3 VALUES (10, ''); +INSERT INTO t3 VALUES (11, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +test_result +OK +SET GLOBAL max_binlog_size=@old_size; +DROP TABLE t1,t2, t3; diff --git a/mysql-test/suite/innodb/r/blob-crash.result b/mysql-test/suite/innodb/r/blob-crash.result new file mode 100644 index 00000000..85d12ff4 --- /dev/null +++ b/mysql-test/suite/innodb/r/blob-crash.result @@ -0,0 +1,149 @@ +# +# Bug #16963396 INNODB: USE OF LARGE EXTERNALLY-STORED FIELDS MAKES +# CRASH RECOVERY LOSE DATA +# +# +# Uncompressed Table - Insert Operation - Crash Test +# Fresh insert with blobs +# +CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; +INSERT INTO t1 (a, b) VALUES (1, repeat('^', 40000)); +INSERT INTO t1 (a, b) VALUES (2, '2'); +INSERT INTO t1 (a, b) VALUES (3, '3'); +INSERT INTO t1 (a, b) VALUES (4, '4'); +INSERT INTO t1 (a, b) VALUES (5, '5'); +begin; +INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 4*1024*1024)); +SELECT a, right(b, 50) FROM t1; +a right(b, 50) +1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 2 +3 3 +4 4 +5 5 +# +# Uncompressed Table - UPDATE Operation - Crash Test +# Update of non-blob column so that blob is needed. +# +begin; +UPDATE t1 set b = REPEAT('a', 4*1024*1024) where a = 5 ; +SELECT a, right(b, 50) FROM t1; +a right(b, 50) +1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 2 +3 3 +4 4 +5 5 +# +# Uncompressed Table - UPDATE Operation - Crash Test +# Update of blob column to blob. +# +connect con1,localhost,root,,; +begin; +UPDATE t1 set b = REPEAT('$', 50000) where a = 1; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +UPDATE t1 SET b='five' WHERE a=5; +disconnect con1; +SELECT a, right(b, 50) FROM t1; +a right(b, 50) +1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 2 +3 3 +4 4 +5 five +# +# Uncompressed Table - Rollback of UPDATE operation +# Update moves offpage data to inline data. +# +create table t2 (f1 bigint primary key, f2 longblob, f3 longblob, +index(f2(10), f3(10))) engine=innodb; +insert into t2 values (10, repeat('.', 40000), repeat('?', 40000)); +connect con1,localhost,root,,; +begin; +update t2 set f2 = '='; +select f1, right(f2, 20), right(f3, 20) from t2; +f1 right(f2, 20) right(f3, 20) +10 = ???????????????????? +update t2 set f3 = '&'; +select f1, right(f2, 20), right(f3, 20) from t2; +f1 right(f2, 20) right(f3, 20) +10 = & +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE a=1; +disconnect con1; +select f1, right(f2, 20), right(f3, 20) from t2; +f1 right(f2, 20) right(f3, 20) +10 .................... ???????????????????? +check table t2; +Table Op Msg_type Msg_text +test.t2 check status OK +drop table t2; +# +# Compressed Table - Insert Operation - Crash Test +# fresh insert with BLOBs +# +set global innodb_compression_level = 0; +create table t3 (f1 bigint primary key, f2 longblob, f3 longblob, +index(f2(10), f3(10))) engine=innodb row_format=compressed; +connect con1,localhost,root,,; +begin; +INSERT INTO t3 (f1, f2, f3) VALUES (6, repeat('/', 40000), repeat('<', 40000)); +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE a=2; +disconnect con1; +select f1, length(f2), length(f3) from t3; +f1 length(f2) length(f3) +select f1, right(f2, 30), right(f3, 20) from t3; +f1 right(f2, 30) right(f3, 20) +check table t3; +Table Op Msg_type Msg_text +test.t3 check status OK +# +# Compressed Table - Update Operation - Crash Test +# update of a non-BLOB column so that BLOB is needed +# +set global innodb_compression_level = 0; +insert into t3 values (2, repeat('!', 30), repeat('+', 30)); +connect con1,localhost,root,,; +begin; +UPDATE t3 set f2 = repeat('>', 40000) where f1 = 2; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE a=3; +disconnect con1; +select f1, length(f2), length(f3) from t3; +f1 length(f2) length(f3) +2 30 30 +select f1, right(f2, 30), right(f3, 20) from t3; +f1 right(f2, 30) right(f3, 20) +2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++ +check table t3; +Table Op Msg_type Msg_text +test.t3 check status OK +# +# Compressed Table - Update Operation - Crash Test +# update blob to blob +# +set global innodb_compression_level = 0; +insert into t3 values (3, repeat('%', 40000), repeat('~', 40000)); +connect con1,localhost,root,,; +begin; +UPDATE t3 set f2 = concat(f2, repeat(',', 10)) where f1 = 3; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE a=4; +select f1, length(f2), length(f3) from t3; +f1 length(f2) length(f3) +2 30 30 +3 40000 40000 +select f1, right(f2, 30), right(f3, 20) from t3; +f1 right(f2, 30) right(f3, 20) +2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++ +3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ~~~~~~~~~~~~~~~~~~~~ +check table t3; +Table Op Msg_type Msg_text +test.t3 check status OK +DROP TABLE t1,t3; diff --git a/mysql-test/suite/innodb/r/blob-update-debug.result b/mysql-test/suite/innodb/r/blob-update-debug.result new file mode 100644 index 00000000..813a469d --- /dev/null +++ b/mysql-test/suite/innodb/r/blob-update-debug.result @@ -0,0 +1,17 @@ +# +# Bug#18185930 UPD_NODE_INSERT_BLOB CAUSES BTR_EXTERN_OWNER_FLAG +# ASSERTION +# +create table t1 (f1 int primary key, f2 blob) engine = innodb; +insert into t1 values (1, repeat('*', 50000)); +select f1, substring(f2, 1, 40) from t1; +f1 substring(f2, 1, 40) +1 **************************************** +set @saved_debug = @@session.debug_dbug; +SET debug_dbug = 'd,row_ins_index_entry_timeout'; +update t1 set f1 = 3; +select f1, substring(f2, 1, 40) from t1; +f1 substring(f2, 1, 40) +3 **************************************** +drop table t1; +SET debug_dbug= @saved_debug; diff --git a/mysql-test/suite/innodb/r/blob_cmp_empty.result b/mysql-test/suite/innodb/r/blob_cmp_empty.result new file mode 100644 index 00000000..24ae8e1c --- /dev/null +++ b/mysql-test/suite/innodb/r/blob_cmp_empty.result @@ -0,0 +1,19 @@ +connect prevent_purge,localhost,root,,; +start transaction with consistent snapshot; +connection default; +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; +CREATE TABLE t1 (col_text TEXT NOT NULL, KEY (col_text(9))) ENGINE=InnoDB; +INSERT INTO t1 (col_text) VALUES (REPEAT('x', @fill_amount)); +UPDATE t1 SET col_text=''; +UPDATE t1 SET col_text=REPEAT('y', @fill_amount); +connect con1,localhost,root,,; +SET @fill_amount = (@@innodb_page_size / 2 ) + 1; +BEGIN; +INSERT INTO t1 (col_text) VALUES (REPEAT('z', @fill_amount)); +connection default; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +disconnect con1; +disconnect prevent_purge; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/blob_unique2pk.result b/mysql-test/suite/innodb/r/blob_unique2pk.result new file mode 100644 index 00000000..c2c32413 --- /dev/null +++ b/mysql-test/suite/innodb/r/blob_unique2pk.result @@ -0,0 +1,15 @@ +create table t1 (f1 tinyblob not null) engine=innodb; +alter table t1 add unique index (f1(255)); +drop table t1; +create table t1 (f1 tinyblob not null) engine=innodb; +alter table t1 add unique index (f1(356)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` tinyblob NOT NULL, + UNIQUE KEY `f1` (`f1`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1 (f1 point not null) engine=innodb; +alter table t1 add unique index (f1); +drop table t1; diff --git a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result new file mode 100644 index 00000000..0bff7570 --- /dev/null +++ b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result @@ -0,0 +1,8 @@ +# +# Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL +# ONLINE WITH MEMORY FULL CONDITION +# +call mtr.add_suppression("InnoDB: failed to allocate the chunk array"); +SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; +# restart diff --git a/mysql-test/suite/innodb/r/change_column_collation.result b/mysql-test/suite/innodb/r/change_column_collation.result new file mode 100644 index 00000000..48d3cc16 --- /dev/null +++ b/mysql-test/suite/innodb/r/change_column_collation.result @@ -0,0 +1,145 @@ +# +# MDEV-26294 Duplicate entries in unique index not detected when +# changing collation with INPLACE algorithm +# +SET NAMES utf8; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_swedish_ci UNIQUE +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'aaa'); +INSERT INTO t1 VALUES (2, 'ååå'); +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=inplace; +ERROR 23000: Duplicate entry 'NULL' for key 'msg' +DROP TABLE t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +id_2 INT not null, +unique index(msg, id_2) +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'aaa', 2); +INSERT INTO t1 VALUES (2, 'AAA', 3); +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=inplace; +DROP TABLE t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +unique index(msg) +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'aaa'); +INSERT INTO t1 VALUES (2, 'bbb'); +INSERT INTO t1 VALUES (3, 'ccc'); +SET DEBUG_SYNC = 'RESET'; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL before_apply WAIT_FOR go_ahead'; +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=NOCOPY; +connect con1,localhost,root,,; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR before_apply'; +INSERT INTO t1 VALUES (4, 'AAA'); +UPDATE t1 set msg = "ddd" where id = 2; +DELETE FROM t1 WHERE id= 3; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +ERROR 23000: Duplicate entry 'NULL' for key 'msg' +SET DEBUG_SYNC = 'RESET'; +SELECT * FROM t1; +id msg +4 AAA +1 aaa +2 ddd +DROP TABLE t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY, +f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT NOT NULL, +msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +msg_1 VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin, +unique index(f1, msg, f2, msg_1, f3), +unique index(f1, msg_1, f2, msg, f3), +unique index(f1, msg, f3, msg_1, f2), +unique index(f1, msg_1, f3, msg, f2), +unique index(f2, msg_1, f1, msg, f3), +unique index(f2, msg, f3, msg_1, f1), +unique index(f3, f2, msg, msg_1, f1), +unique index(f3, msg, msg_1, f1, f2) +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 1, 1, 1, 'aaa', 'aaa'); +SET DEBUG_DBUG="+d,create_index_fail"; +SET DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL con1_go WAIT_FOR alter_signal"; +ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, MODIFY msg_1 VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=NOCOPY; +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_go"; +BEGIN; +SELECT * FROM t1; +id f1 f2 f3 msg msg_1 +1 1 1 1 aaa aaa +SET DEBUG_SYNC="now SIGNAL alter_signal"; +connection default; +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +connection con1; +rollback; +INSERT INTO t1 VALUES(2, 2, 2, 2, 'bbb', 'bbb'); +disconnect con1; +connection default; +SET DEBUG_SYNC=reset; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + `f3` int(11) NOT NULL, + `msg` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + `msg_1` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `f1` (`f1`,`msg`,`f2`,`msg_1`,`f3`), + UNIQUE KEY `f1_2` (`f1`,`msg_1`,`f2`,`msg`,`f3`), + UNIQUE KEY `f1_3` (`f1`,`msg`,`f3`,`msg_1`,`f2`), + UNIQUE KEY `f1_4` (`f1`,`msg_1`,`f3`,`msg`,`f2`), + UNIQUE KEY `f2` (`f2`,`msg_1`,`f1`,`msg`,`f3`), + UNIQUE KEY `f2_2` (`f2`,`msg`,`f3`,`msg_1`,`f1`), + UNIQUE KEY `f3` (`f3`,`f2`,`msg`,`msg_1`,`f1`), + UNIQUE KEY `f3_2` (`f3`,`msg`,`msg_1`,`f1`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES(3, 3, 3, 3, 'ccc', 'ccc'); +DROP TABLE t1; +CREATE TABLE t1(id INT PRIMARY KEY, msg VARCHAR(100), +msg_1 VARCHAR(100) AS (msg) VIRTUAL, +msg_2 VARCHAR(100) AS (msg) STORED, +UNIQUE(msg), UNIQUE(msg_1), +UNIQUE(msg_2))ENGINE=InnoDB; +ALTER TABLE t1 MODIFY msg_1 VARCHAR(100) CHARACTER SET utf8 +COLLATE utf8_unicode_ci, ALGORITHM=inplace; +ERROR HY000: This is not yet supported for generated columns +ALTER TABLE t1 MODIFY msg_2 VARCHAR(100) CHARACTER SET utf8 +COLLATE utf8_unicode_ci, ALGORITHM=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +DROP TABLE t1; +# +# MDEV-29314 Assertion `n_fields > n_cols' failed +# in dict_index_t::init_change_cols +# +CREATE TABLE t (a VARCHAR(16) COLLATE utf8_bin, +FULLTEXT (a)) ENGINE=InnoDB COLLATE utf8_unicode_520_ci; +ALTER TABLE t MODIFY COLUMN a VARCHAR(512); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` varchar(512) DEFAULT NULL, + FULLTEXT KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_520_ci +DROP TABLE t; +# +# MDEV-31416 ASAN errors in dict_v_col_t::detach upon +# adding key to virtual column +# +CREATE TABLE t (a INT) ENGINE=InnoDB WITH SYSTEM VERSIONING; +SET SYSTEM_VERSIONING_ALTER_HISTORY= KEEP; +ALTER TABLE t ADD COLUMN v VARCHAR(128) GENERATED ALWAYS AS (CRC32('MariaDB')); +ALTER TABLE t ADD INDEX (v); +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff new file mode 100644 index 00000000..44446602 --- /dev/null +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff @@ -0,0 +1,25 @@ +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:29:25.129637040 +0530 +@@ -3,18 +3,12 @@ + # SPACE IN 5.7 THAN IN 5.6 + # + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 131072 + INSERT INTO t1 SELECT * FROM seq_1_to_25000; +-# bytes: 9437184 ++# bytes: 786432 + DROP TABLE t1; + CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 131072 + INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +-# bytes: 4194304 +-DROP TABLE t1; +-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) +-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +-# bytes: 65536 +-INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +-# bytes: 65536 ++# bytes: 786432 + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff new file mode 100644 index 00000000..ef55ad97 --- /dev/null +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff @@ -0,0 +1,25 @@ +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:39.288769153 +0530 +@@ -3,18 +3,18 @@ + # SPACE IN 5.7 THAN IN 5.6 + # + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 16384 + INSERT INTO t1 SELECT * FROM seq_1_to_25000; + # bytes: 9437184 + DROP TABLE t1; + CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 16384 + INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; + # bytes: 4194304 + DROP TABLE t1; + CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) + ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +-# bytes: 65536 ++# bytes: 16384 + INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +-# bytes: 65536 ++# bytes: 25600 + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff new file mode 100644 index 00000000..bcdcea31 --- /dev/null +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff @@ -0,0 +1,25 @@ +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:30:28.957174270 +0530 +@@ -3,18 +3,12 @@ + # SPACE IN 5.7 THAN IN 5.6 + # + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 262144 + INSERT INTO t1 SELECT * FROM seq_1_to_25000; +-# bytes: 9437184 ++# bytes: 983040 + DROP TABLE t1; + CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 262144 + INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +-# bytes: 4194304 +-DROP TABLE t1; +-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) +-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +-# bytes: 65536 +-INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +-# bytes: 65536 ++# bytes: 1572864 + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff new file mode 100644 index 00000000..7b699ef4 --- /dev/null +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff @@ -0,0 +1,25 @@ +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:03.516962339 +0530 +@@ -3,18 +3,18 @@ + # SPACE IN 5.7 THAN IN 5.6 + # + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 32768 + INSERT INTO t1 SELECT * FROM seq_1_to_25000; + # bytes: 9437184 + DROP TABLE t1; + CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; +-# bytes: 65536 ++# bytes: 32768 + INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; + # bytes: 4194304 + DROP TABLE t1; + CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) + ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +-# bytes: 65536 ++# bytes: 32768 + INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +-# bytes: 65536 ++# bytes: 32768 + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize.result b/mysql-test/suite/innodb/r/check_ibd_filesize.result new file mode 100644 index 00000000..0d224d6a --- /dev/null +++ b/mysql-test/suite/innodb/r/check_ibd_filesize.result @@ -0,0 +1,20 @@ +# +# Bug #21950389 SMALL TABLESPACES WITH BLOBS TAKE UP TO 80 TIMES MORE +# SPACE IN 5.7 THAN IN 5.6 +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +# bytes: 65536 +INSERT INTO t1 SELECT * FROM seq_1_to_25000; +# bytes: 9437184 +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; +# bytes: 65536 +INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +# bytes: 4194304 +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +# bytes: 65536 +INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; +# bytes: 65536 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff new file mode 100644 index 00000000..b729890c --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff @@ -0,0 +1,19 @@ +--- suite/innodb/r/compression_providers_loaded.result ++++ suite/innodb/r/compression_providers_loaded.reject +@@ -1,10 +1,10 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: lz4 + # +-# Innodb_have_bzip2 reflects that the provider is loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_lz4 reflects that the provider is loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lz4"; + Variable_name Value +-Innodb_have_bzip2 ON +-# Innodb_compression_algorithm can be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; ++Innodb_have_lz4 ON ++# Innodb_compression_algorithm can be set to lz4 ++SET GLOBAL Innodb_compression_algorithm = lz4; + SET GLOBAL Innodb_compression_algorithm = zlib; diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff new file mode 100644 index 00000000..caba4283 --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff @@ -0,0 +1,19 @@ +--- suite/innodb/r/compression_providers_loaded.result ++++ suite/innodb/r/compression_providers_loaded.reject +@@ -1,10 +1,10 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: lzma + # +-# Innodb_have_bzip2 reflects that the provider is loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_lzma reflects that the provider is loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzma"; + Variable_name Value +-Innodb_have_bzip2 ON +-# Innodb_compression_algorithm can be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; ++Innodb_have_lzma ON ++# Innodb_compression_algorithm can be set to lzma ++SET GLOBAL Innodb_compression_algorithm = lzma; + SET GLOBAL Innodb_compression_algorithm = zlib; diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff new file mode 100644 index 00000000..8a1a5403 --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff @@ -0,0 +1,19 @@ +--- suite/innodb/r/compression_providers_loaded.result ++++ suite/innodb/r/compression_providers_loaded.reject +@@ -1,10 +1,10 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: lzo + # +-# Innodb_have_bzip2 reflects that the provider is loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_lzo reflects that the provider is loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzo"; + Variable_name Value +-Innodb_have_bzip2 ON +-# Innodb_compression_algorithm can be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; ++Innodb_have_lzo ON ++# Innodb_compression_algorithm can be set to lzo ++SET GLOBAL Innodb_compression_algorithm = lzo; + SET GLOBAL Innodb_compression_algorithm = zlib; diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff new file mode 100644 index 00000000..4a1261d4 --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff @@ -0,0 +1,19 @@ +--- suite/innodb/r/compression_providers_loaded.result ++++ suite/innodb/r/compression_providers_loaded.reject +@@ -1,10 +1,10 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: snappy + # +-# Innodb_have_bzip2 reflects that the provider is loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_snappy reflects that the provider is loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_snappy"; + Variable_name Value +-Innodb_have_bzip2 ON +-# Innodb_compression_algorithm can be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; ++Innodb_have_snappy ON ++# Innodb_compression_algorithm can be set to snappy ++SET GLOBAL Innodb_compression_algorithm = snappy; + SET GLOBAL Innodb_compression_algorithm = zlib; diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded.result b/mysql-test/suite/innodb/r/compression_providers_loaded.result new file mode 100644 index 00000000..2d1700c2 --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_loaded.result @@ -0,0 +1,10 @@ +# +# Testing unloaded compression provider: bzip2 +# +# Innodb_have_bzip2 reflects that the provider is loaded +SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; +Variable_name Value +Innodb_have_bzip2 ON +# Innodb_compression_algorithm can be set to bzip2 +SET GLOBAL Innodb_compression_algorithm = bzip2; +SET GLOBAL Innodb_compression_algorithm = zlib; diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff new file mode 100644 index 00000000..e849fb5c --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff @@ -0,0 +1,26 @@ +--- suite/innodb/r/compression_providers_unloaded.result ++++ suite/innodb/r/compression_providers_unloaded.reject +@@ -1,14 +1,14 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: lz4 + # +-# Innodb_have_bzip2 reflects that the provider is not loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_lz4 reflects that the provider is not loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lz4"; + Variable_name Value +-Innodb_have_bzip2 OFF +-# Innodb_compression_algorithm cannot be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; +-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Innodb_have_lz4 OFF ++# Innodb_compression_algorithm cannot be set to lz4 ++SET GLOBAL Innodb_compression_algorithm = lz4; ++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'lz4' + show warnings; + Level Code Message +-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin. +-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Warning 138 InnoDB: compression algorithm lz4 (2) is not available. Please, load the corresponding provider plugin. ++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'lz4' diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff new file mode 100644 index 00000000..466fb37c --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff @@ -0,0 +1,26 @@ +--- suite/innodb/r/compression_providers_unloaded.result ++++ suite/innodb/r/compression_providers_unloaded.reject +@@ -1,14 +1,14 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: lzma + # +-# Innodb_have_bzip2 reflects that the provider is not loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_lzma reflects that the provider is not loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzma"; + Variable_name Value +-Innodb_have_bzip2 OFF +-# Innodb_compression_algorithm cannot be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; +-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Innodb_have_lzma OFF ++# Innodb_compression_algorithm cannot be set to lzma ++SET GLOBAL Innodb_compression_algorithm = lzma; ++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'lzma' + show warnings; + Level Code Message +-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin. +-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Warning 138 InnoDB: compression algorithm lzma (4) is not available. Please, load the corresponding provider plugin. ++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'lzma' diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff new file mode 100644 index 00000000..dec0becf --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff @@ -0,0 +1,26 @@ +--- suite/innodb/r/compression_providers_unloaded.result ++++ suite/innodb/r/compression_providers_unloaded.reject +@@ -1,14 +1,14 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: lzo + # +-# Innodb_have_bzip2 reflects that the provider is not loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_lzo reflects that the provider is not loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzo"; + Variable_name Value +-Innodb_have_bzip2 OFF +-# Innodb_compression_algorithm cannot be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; +-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Innodb_have_lzo OFF ++# Innodb_compression_algorithm cannot be set to lzo ++SET GLOBAL Innodb_compression_algorithm = lzo; ++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'lzo' + show warnings; + Level Code Message +-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin. +-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Warning 138 InnoDB: compression algorithm lzo (3) is not available. Please, load the corresponding provider plugin. ++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'lzo' diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff new file mode 100644 index 00000000..273ff4e2 --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff @@ -0,0 +1,26 @@ +--- suite/innodb/r/compression_providers_unloaded.result ++++ suite/innodb/r/compression_providers_unloaded.reject +@@ -1,14 +1,14 @@ + # +-# Testing unloaded compression provider: bzip2 ++# Testing unloaded compression provider: snappy + # +-# Innodb_have_bzip2 reflects that the provider is not loaded +-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; ++# Innodb_have_snappy reflects that the provider is not loaded ++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_snappy"; + Variable_name Value +-Innodb_have_bzip2 OFF +-# Innodb_compression_algorithm cannot be set to bzip2 +-SET GLOBAL Innodb_compression_algorithm = bzip2; +-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Innodb_have_snappy OFF ++# Innodb_compression_algorithm cannot be set to snappy ++SET GLOBAL Innodb_compression_algorithm = snappy; ++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'snappy' + show warnings; + Level Code Message +-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin. +-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' ++Warning 138 InnoDB: compression algorithm snappy (6) is not available. Please, load the corresponding provider plugin. ++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'snappy' diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded.result b/mysql-test/suite/innodb/r/compression_providers_unloaded.result new file mode 100644 index 00000000..d4ac9cdb --- /dev/null +++ b/mysql-test/suite/innodb/r/compression_providers_unloaded.result @@ -0,0 +1,14 @@ +# +# Testing unloaded compression provider: bzip2 +# +# Innodb_have_bzip2 reflects that the provider is not loaded +SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2"; +Variable_name Value +Innodb_have_bzip2 OFF +# Innodb_compression_algorithm cannot be set to bzip2 +SET GLOBAL Innodb_compression_algorithm = bzip2; +ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' +show warnings; +Level Code Message +Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin. +Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2' diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result new file mode 100644 index 00000000..d67dc8a6 --- /dev/null +++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result @@ -0,0 +1,35 @@ +CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(2); +SET GLOBAL innodb_flush_log_at_trx_commit=1; +INSERT INTO t2 VALUES(1); +# Kill the server +# Corrupt the pages +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +SELECT * FROM t1; +ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. +SELECT * FROM t2; +a +1 +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t1, t2; +CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3); +connect con1,localhost,root,,; +BEGIN; +DELETE FROM t1 WHERE pk=1; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE pk=3; +# Kill the server +disconnect con1; +# Corrupt the pages +SELECT * FROM t1; +pk +1 +2 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/count_distinct.result b/mysql-test/suite/innodb/r/count_distinct.result new file mode 100644 index 00000000..201767b8 --- /dev/null +++ b/mysql-test/suite/innodb/r/count_distinct.result @@ -0,0 +1,12 @@ +CREATE TABLE t1 ( +id int NOT NULL AUTO_INCREMENT, +a int NOT NULL, +b int NOT NULL, +PRIMARY KEY (id), +UNIQUE KEY ba (b, a) +) ENGINE=InnoDB; +INSERT INTO t1 (a, b) VALUES(1,101),(1,102),(1,103),(1,104),(1,105),(1,106),(1,107),(1,108),(1,109),(1,110); +SELECT COUNT(DISTINCT b) FROM t1 WHERE a = 1; +COUNT(DISTINCT b) +10 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/create-index.result b/mysql-test/suite/innodb/r/create-index.result new file mode 100644 index 00000000..ad358a86 --- /dev/null +++ b/mysql-test/suite/innodb/r/create-index.result @@ -0,0 +1,9 @@ +# +# Bug #18010711 UNIQUE PREFIX INDEX ON BINARY COLUMN: FAILING +# ASSERTION: FLEN == LEN +# +create table t1 (f1 binary(5)) engine=innodb; +insert into t1 values ('w'), ('w'); +create unique index index_t1 on t1(f1(4)); +ERROR 23000: Duplicate entry 'w' for key 'index_t1' +drop table t1; diff --git a/mysql-test/suite/innodb/r/create_isl_with_direct.result b/mysql-test/suite/innodb/r/create_isl_with_direct.result new file mode 100644 index 00000000..1b830a7d --- /dev/null +++ b/mysql-test/suite/innodb/r/create_isl_with_direct.result @@ -0,0 +1,11 @@ +SHOW VARIABLES LIKE 'innodb_flush_method'; +Variable_name Value +innodb_flush_method O_DIRECT +CREATE TABLE t1 (x INT) ENGINE=INNODB, DATA DIRECTORY='MYSQL_TMP_DIR'; +# Contents of tmp/test directory containing .ibd file +t1.ibd +# Contents of the 'test' database directory containing .isl and .frm files +db.opt +t1.frm +t1.isl +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/create_select.result b/mysql-test/suite/innodb/r/create_select.result new file mode 100644 index 00000000..f5db8808 --- /dev/null +++ b/mysql-test/suite/innodb/r/create_select.result @@ -0,0 +1,10 @@ +connect con1, localhost, root,,; +connection default; +CREATE TABLE t1 ENGINE=InnoDB SELECT * FROM seq_1_to_100000000; +connection con1; +KILL QUERY @id; +disconnect con1; +connection default; +ERROR 70100: Query execution was interrupted +CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/create_table_insert_skip_locked.result b/mysql-test/suite/innodb/r/create_table_insert_skip_locked.result new file mode 100644 index 00000000..3f1b8e4e --- /dev/null +++ b/mysql-test/suite/innodb/r/create_table_insert_skip_locked.result @@ -0,0 +1,72 @@ +connect con1,localhost,root,,; +SET SESSION innodb_lock_wait_timeout=1; +connection default; +SET SESSION innodb_lock_wait_timeout=1; +# Case 1: Test primary index - CREATE TABLE .. SELECT .. SKIP LOCKED +CREATE TABLE t1( +seat_id INT, +state INT, +PRIMARY KEY(seat_id) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,0), (2,0), (3,0), (4,0); +BEGIN; +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE; +seat_id state +1 0 +2 0 +connection con1; +BEGIN; +CREATE TEMPORARY TABLE s0 AS SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE; +SELECT * FROM s0; +seat_id state +1 0 +2 0 +CREATE TEMPORARY TABLE s1 AS SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE SKIP LOCKED; +SELECT * FROM s1; +seat_id state +3 0 +4 0 +connection default; +CREATE TEMPORARY TABLE s0 AS SELECT * FROM t1 WHERE state = 0 LOCK IN SHARE MODE SKIP LOCKED; +SELECT * FROM s0; +seat_id state +1 0 +2 0 +COMMIT; +DROP TABLE s0; +connection con1; +COMMIT; +DROP TABLE s0, s1; +connection default; +# Case 2: Test primary index - INSERT .. SELECT .. SKIP LOCKED +CREATE TABLE t2 LIKE t1; +BEGIN; +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE; +seat_id state +1 0 +2 0 +connection con1; +BEGIN; +INSERT INTO t2 SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE RETURNING seat_id, state; +seat_id state +1 0 +2 0 +CREATE TEMPORARY TABLE t2s LIKE t1; +INSERT INTO t2s SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE SKIP LOCKED RETURNING seat_id, state; +seat_id state +3 0 +4 0 +connection default; +CREATE TEMPORARY TABLE t2s LIKE t1; +INSERT INTO t2s SELECT * FROM t1 WHERE state = 0 LOCK IN SHARE MODE SKIP LOCKED RETURNING seat_id, state; +seat_id state +1 0 +2 0 +COMMIT; +DROP TABLE t2s; +connection con1; +COMMIT; +DROP TABLE t2s; +DROP TABLE t2; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/cursor-restore-locking.result b/mysql-test/suite/innodb/r/cursor-restore-locking.result new file mode 100644 index 00000000..d834146e --- /dev/null +++ b/mysql-test/suite/innodb/r/cursor-restore-locking.result @@ -0,0 +1,40 @@ +CREATE TABLE t (a int PRIMARY KEY, b int NOT NULL UNIQUE) engine = InnoDB, STATS_PERSISTENT=0; +InnoDB 0 transactions not purged +connect prevent_purge,localhost,root,,; +start transaction with consistent snapshot; +connect con_del_1,localhost,root,,; +INSERT INTO t VALUES (20,20); +SET DEBUG_SYNC = 'innodb_row_search_for_mysql_exit SIGNAL first_del_row_search_mvcc_finished WAIT_FOR first_del_cont'; +DELETE FROM t WHERE b = 20 # trx_1; +connect con_ins_1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR first_del_row_search_mvcc_finished'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL first_ins_locked'; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont'; +INSERT INTO t VALUES(10, 20) # trx_2; +connect con_del_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL second_del_locked'; +DELETE FROM t WHERE b = 20 # trx_3; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR second_del_locked'; +SET @saved_dbug = @@GLOBAL.debug_dbug; +SET @@GLOBAL.debug_dbug="d,enable_row_purge_del_mark_exit_sync_point"; +SET DEBUG_SYNC = 'now SIGNAL first_del_cont'; +SET DEBUG_SYNC = 'now WAIT_FOR first_ins_row_inserted'; +connection con_del_1; +connection default; +disconnect prevent_purge; +SET DEBUG_SYNC = 'now WAIT_FOR row_purge_del_mark_finished'; +SET @@GLOBAL.debug_dbug = @saved_dbug; +SET DEBUG_SYNC = 'now SIGNAL first_ins_cont'; +connection con_del_2; +connection con_ins_1; +connection default; +INSERT INTO t VALUES(30, 20); +disconnect con_ins_1; +disconnect con_del_1; +disconnect con_del_2; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/data_types.result b/mysql-test/suite/innodb/r/data_types.result new file mode 100644 index 00000000..146f9bb0 --- /dev/null +++ b/mysql-test/suite/innodb/r/data_types.result @@ -0,0 +1,183 @@ +CREATE TABLE t1 +( +t1_BIGINT BIGINT, +t1_BIGINT_UNSIGNED BIGINT UNSIGNED, +t1_BINARY_100 BINARY(100), +t1_BIT_2 BIT(2), +t1_BIT_20 BIT(20), +t1_BLOB BLOB, +t1_CHAR_100 CHAR(100), +t1_CHAR_100_BINARY CHAR(100) BINARY, +t1_DATE DATE, +t1_DATETIME DATETIME, +t1_DATETIME_6 DATETIME(6), +t1_DECIMAL_10_3 DECIMAL(10,3), +t1_DECIMAL_10_3_UNSIGNED DECIMAL(10,3) UNSIGNED, +t1_DOUBLE DOUBLE, +t1_DOUBLE_UNSIGNED DOUBLE UNSIGNED, +t1_ENUM ENUM('a', 'b', 'c'), +t1_ENUM_BINARY ENUM('a','b') BINARY, +t1_ENUM_256 ENUM('a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', +'a10', 'a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a17', 'a18', 'a19', +'a20', 'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27', 'a28', 'a29', +'a30', 'a31', 'a32', 'a33', 'a34', 'a35', 'a36', 'a37', 'a38', 'a39', +'a40', 'a41', 'a42', 'a43', 'a44', 'a45', 'a46', 'a47', 'a48', 'a49', +'a50', 'a51', 'a52', 'a53', 'a54', 'a55', 'a56', 'a57', 'a58', 'a59', +'a60', 'a61', 'a62', 'a63', 'a64', 'a65', 'a66', 'a67', 'a68', 'a69', +'a70', 'a71', 'a72', 'a73', 'a74', 'a75', 'a76', 'a77', 'a78', 'a79', +'a80', 'a81', 'a82', 'a83', 'a84', 'a85', 'a86', 'a87', 'a88', 'a89', +'a90', 'a91', 'a92', 'a93', 'a94', 'a95', 'a96', 'a97', 'a98', 'a99', +'a100', 'a101', 'a102', 'a103', 'a104', 'a105', 'a106', 'a107', 'a108', +'a109', 'a110', 'a111', 'a112', 'a113', 'a114', 'a115', 'a116', 'a117', +'a118', 'a119', 'a120', 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', +'a127', 'a128', 'a129', 'a130', 'a131', 'a132', 'a133', 'a134', 'a135', +'a136', 'a137', 'a138', 'a139', 'a140', 'a141', 'a142', 'a143', 'a144', +'a145', 'a146', 'a147', 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', +'a154', 'a155', 'a156', 'a157', 'a158', 'a159', 'a160', 'a161', 'a162', +'a163', 'a164', 'a165', 'a166', 'a167', 'a168', 'a169', 'a170', 'a171', +'a172', 'a173', 'a174', 'a175', 'a176', 'a177', 'a178', 'a179', 'a180', +'a181', 'a182', 'a183', 'a184', 'a185', 'a186', 'a187', 'a188', 'a189', +'a190', 'a191', 'a192', 'a193', 'a194', 'a195', 'a196', 'a197', 'a198', +'a199', 'a200', 'a201', 'a202', 'a203', 'a204', 'a205', 'a206', 'a207', +'a208', 'a209', 'a210', 'a211', 'a212', 'a213', 'a214', 'a215', 'a216', +'a217', 'a218', 'a219', 'a220', 'a221', 'a222', 'a223', 'a224', 'a225', +'a226', 'a227', 'a228', 'a229', 'a230', 'a231', 'a232', 'a233', 'a234', +'a235', 'a236', 'a237', 'a238', 'a239', 'a240', 'a241', 'a242', 'a243', +'a244', 'a245', 'a246', 'a247', 'a248', 'a249', 'a250', 'a251', 'a252', +'a253', 'a254', 'a255', 'a256'), +t1_FLOAT FLOAT, +t1_FLOAT_UNSIGNED FLOAT UNSIGNED, +t1_INT INT, +t1_INT_UNSIGNED INT UNSIGNED, +t1_LONGBLOB LONGBLOB, +t1_LONGTEXT LONGTEXT, +t1_MEDIUMBLOB MEDIUMBLOB, +t1_MEDIUMINT MEDIUMINT, +t1_MEDIUMINT_UNSIGNED MEDIUMINT UNSIGNED, +t1_MEDIUMTEXT MEDIUMTEXT, +t1_SET SET('a', 'b', 'c'), +t1_SET_BINARY SET('a','b') BINARY, +t1_SET_9 SET('a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9'), +t1_SMALLINT SMALLINT, +t1_SMALLINT_UNSIGNED SMALLINT UNSIGNED, +t1_TEXT TEXT, +t1_TIME TIME, +t1_TIME_4 TIME(4), +t1_TIMESTAMP TIMESTAMP, +t1_TIMESTAMP_5 TIMESTAMP(5), +t1_TINYBLOB TINYBLOB, +t1_TINYINT TINYINT, +t1_TINYINT_UNSIGNED TINYINT UNSIGNED, +t1_TINYTEXT TINYTEXT, +t1_VARBINARY_100 VARBINARY(100), +t1_VARCHAR_10 VARCHAR(10), +t1_VARCHAR_10_BINARY VARCHAR(10) BINARY, +t1_VARCHAR_500 VARCHAR(500), +t1_VARCHAR_500_BINARY VARCHAR(500) BINARY, +t1_YEAR_2 YEAR(2), +t1_YEAR_4 YEAR(4), +t1_CHAR_0 CHAR(0), +t1_MYSQL_0 CHAR(0) CHARACTER SET utf8, +t1_VARCHAR_0 VARCHAR(0), +t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8 +) ENGINE=InnoDB; +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +INSERT INTO t1 () VALUES (); +SELECT +name, +CASE mtype +WHEN 1 THEN "DATA_VARCHAR" + WHEN 2 THEN "DATA_CHAR" + WHEN 3 THEN "DATA_FIXBINARY" + WHEN 4 THEN "DATA_BINARY" + WHEN 5 THEN "DATA_BLOB" + WHEN 6 THEN "DATA_INT" + WHEN 7 THEN "DATA_SYS_CHILD" + WHEN 8 THEN "DATA_SYS" + WHEN 9 THEN "DATA_FLOAT" + WHEN 10 THEN "DATA_DOUBLE" + WHEN 11 THEN "DATA_DECIMAL" + WHEN 12 THEN "DATA_VARMYSQL" + WHEN 13 THEN "DATA_MYSQL" + WHEN 63 THEN "DATA_MTYPE_MAX" + ELSE mtype +END AS mtype, +IF((prtype & 512) = 512,"UNSIGNED","") AS is_unsigned +FROM information_schema.INNODB_SYS_COLUMNS +WHERE name LIKE "t1\_%" +ORDER BY name; +name mtype is_unsigned +t1_BIGINT DATA_INT +t1_BIGINT_UNSIGNED DATA_INT UNSIGNED +t1_BINARY_100 DATA_FIXBINARY +t1_BIT_2 DATA_FIXBINARY UNSIGNED +t1_BIT_20 DATA_FIXBINARY UNSIGNED +t1_BLOB DATA_BLOB +t1_CHAR_0 DATA_CHAR +t1_CHAR_100 DATA_CHAR +t1_CHAR_100_BINARY DATA_MYSQL +t1_DATE DATA_INT +t1_DATETIME DATA_FIXBINARY +t1_DATETIME_6 DATA_FIXBINARY +t1_DECIMAL_10_3 DATA_FIXBINARY +t1_DECIMAL_10_3_UNSIGNED DATA_FIXBINARY UNSIGNED +t1_DOUBLE DATA_DOUBLE +t1_DOUBLE_UNSIGNED DATA_DOUBLE UNSIGNED +t1_ENUM DATA_INT UNSIGNED +t1_ENUM_256 DATA_INT UNSIGNED +t1_ENUM_BINARY DATA_INT UNSIGNED +t1_FLOAT DATA_FLOAT +t1_FLOAT_UNSIGNED DATA_FLOAT UNSIGNED +t1_INT DATA_INT +t1_INT_UNSIGNED DATA_INT UNSIGNED +t1_LONGBLOB DATA_BLOB +t1_LONGTEXT DATA_BLOB +t1_MEDIUMBLOB DATA_BLOB +t1_MEDIUMINT DATA_INT +t1_MEDIUMINT_UNSIGNED DATA_INT UNSIGNED +t1_MEDIUMTEXT DATA_BLOB +t1_MYSQL_0 DATA_MYSQL +t1_SET DATA_INT UNSIGNED +t1_SET_9 DATA_INT UNSIGNED +t1_SET_BINARY DATA_INT UNSIGNED +t1_SMALLINT DATA_INT +t1_SMALLINT_UNSIGNED DATA_INT UNSIGNED +t1_TEXT DATA_BLOB +t1_TIME DATA_FIXBINARY +t1_TIMESTAMP DATA_FIXBINARY UNSIGNED +t1_TIMESTAMP_5 DATA_FIXBINARY UNSIGNED +t1_TIME_4 DATA_FIXBINARY +t1_TINYBLOB DATA_BLOB +t1_TINYINT DATA_INT +t1_TINYINT_UNSIGNED DATA_INT UNSIGNED +t1_TINYTEXT DATA_BLOB +t1_VARBINARY_100 DATA_BINARY +t1_VARCHAR_0 DATA_VARCHAR +t1_VARCHAR_10 DATA_VARCHAR +t1_VARCHAR_10_BINARY DATA_VARMYSQL +t1_VARCHAR_500 DATA_VARCHAR +t1_VARCHAR_500_BINARY DATA_VARMYSQL +t1_VARMYSQL_0 DATA_VARMYSQL +t1_YEAR_2 DATA_INT UNSIGNED +t1_YEAR_4 DATA_INT UNSIGNED +DROP TABLE t1; +# +# MDEV-17815 Assertion failed in btr_node_ptr_max_size for CHAR(0) +# +CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +DROP TABLE t1; +# +# MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0) +# +CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +DROP TABLE t1; +# +# MDEV-19216 Assertion ...SYS_FOREIGN failed in btr_node_ptr_max_size +# +CREATE TABLE t1 (b BINARY(0), v VARBINARY(0), KEY(b), KEY(v)) ENGINE=InnoDB; +INSERT INTO t1 SET b='',v=''; +DROP TABLE t1; +# End of 10.4 tests diff --git a/mysql-test/suite/innodb/r/ddl_purge.result b/mysql-test/suite/innodb/r/ddl_purge.result new file mode 100644 index 00000000..724a2a02 --- /dev/null +++ b/mysql-test/suite/innodb/r/ddl_purge.result @@ -0,0 +1,27 @@ +CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t0 VALUES(100); +INSERT INTO t1 VALUES(100, 100); +connect con1,localhost,root,,test; +BEGIN; +INSERT INTO t0 SET pk=1; +connect con2,localhost,root,,test; +BEGIN; +INSERT INTO t0 SET pk=2; +connection default; +SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL prepared WAIT_FOR logged'; +ALTER TABLE t1 FORCE; +connection con1; +SET DEBUG_SYNC='now WAIT_FOR prepared'; +INSERT INTO t1 SET pk=1; +COMMIT; +disconnect con1; +connection con2; +UPDATE t1 SET b=1; +DELETE FROM t1; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL logged'; +disconnect con2; +connection default; +SET DEBUG_SYNC='RESET'; +DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/r/deadlock_detect,ON.rdiff b/mysql-test/suite/innodb/r/deadlock_detect,ON.rdiff new file mode 100644 index 00000000..f3797bac --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_detect,ON.rdiff @@ -0,0 +1,11 @@ +@@ -16,7 +16,10 @@ + connection default; + SELECT * FROM t1 WHERE id = 2 FOR UPDATE; + connection con2; ++connection con1; ++COMMIT; + disconnect con1; ++connection con2; + ROLLBACK; + disconnect con2; + connection default; diff --git a/mysql-test/suite/innodb/r/deadlock_detect.result b/mysql-test/suite/innodb/r/deadlock_detect.result new file mode 100644 index 00000000..8131585a --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_detect.result @@ -0,0 +1,24 @@ +connection default; +CREATE TABLE t1( +id INT, +PRIMARY KEY(id) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1), (2), (3); +BEGIN; +SELECT * FROM t1 WHERE id = 1 LOCK IN SHARE MODE; +connect con1,localhost,root,,; +BEGIN; +SELECT * FROM t1 WHERE id = 2 LOCK IN SHARE MODE; +connect con2,localhost,root,,; +BEGIN; +SELECT * FROM t1 WHERE id = 2 LOCK IN SHARE MODE; +SELECT * FROM t1 WHERE id = 1 FOR UPDATE; +connection default; +SELECT * FROM t1 WHERE id = 2 FOR UPDATE; +connection con2; +disconnect con1; +ROLLBACK; +disconnect con2; +connection default; +ROLLBACK; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/deadlock_in_subqueries_join.result b/mysql-test/suite/innodb/r/deadlock_in_subqueries_join.result new file mode 100644 index 00000000..2e82b066 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_in_subqueries_join.result @@ -0,0 +1,50 @@ +CREATE TABLE t1 ( +pkey int NOT NULL PRIMARY KEY, +c int +) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +CREATE TABLE t2 ( +pkey int NOT NULL PRIMARY KEY, +c int +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (2, NULL); +CREATE TABLE t3 (c int) engine = InnoDB; +INSERT INTO t3 VALUES (10), (20), (30), (40), (50); +connect con1, localhost,root,,; +connection default; +START TRANSACTION; +UPDATE t3 SET c=c+1000; +SELECT * FROM t1 FOR UPDATE; +pkey c +1 1 +connection con1; +START TRANSACTION; +DELETE FROM t2 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey); +connection default; +SELECT * FROM t2 FOR UPDATE; +pkey c +2 NULL +COMMIT; +connection con1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +connection default; +START TRANSACTION; +UPDATE t3 SET c=c+1000; +SELECT * FROM t1 FOR UPDATE; +pkey c +1 1 +connection con1; +START TRANSACTION; +UPDATE t2 SET pkey=pkey+10 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey); +connection default; +SELECT * FROM t2 FOR UPDATE; +pkey c +2 NULL +COMMIT; +connection con1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +disconnect con1; +connection default; +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/innodb/r/deadlock_on_lock_upgrade.result b/mysql-test/suite/innodb/r/deadlock_on_lock_upgrade.result new file mode 100644 index 00000000..4446c925 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_on_lock_upgrade.result @@ -0,0 +1,78 @@ +# +# Bug #23755664 DEADLOCK WITH 3 CONCURRENT DELETES BY UNIQUE KEY +# +connection default; +CREATE TABLE `t`( +`id` INT, +`a` INT DEFAULT NULL, +PRIMARY KEY(`id`), +UNIQUE KEY `u`(`a`) +) ENGINE=InnoDB; +INSERT INTO t (`id`,`a`) VALUES +(1,1), +(2,9999), +(3,10000); +connect deleter,localhost,root,,; +connect holder,localhost,root,,; +connect waiter,localhost,root,,; +connection deleter; +SET DEBUG_SYNC = +'lock_sec_rec_read_check_and_lock_has_locked + SIGNAL deleter_has_locked + WAIT_FOR waiter_has_locked'; +DELETE FROM t WHERE a = 9999; +connection holder; +SET DEBUG_SYNC= +'now WAIT_FOR deleter_has_locked'; +SET DEBUG_SYNC= +'lock_sec_rec_read_check_and_lock_has_locked SIGNAL holder_has_locked'; +DELETE FROM t WHERE a = 9999; +connection waiter; +SET DEBUG_SYNC= +'now WAIT_FOR holder_has_locked'; +SET DEBUG_SYNC= +'lock_sec_rec_read_check_and_lock_has_locked SIGNAL waiter_has_locked'; +DELETE FROM t WHERE a = 9999; +connection deleter; +connection holder; +connection waiter; +connection default; +disconnect deleter; +disconnect holder; +disconnect waiter; +DROP TABLE `t`; +SET DEBUG_SYNC='reset'; +CREATE TABLE `t`( +`id` INT NOT NULL PRIMARY KEY +) ENGINE=InnoDB; +INSERT INTO t (`id`) VALUES (1), (2); +connect holder,localhost,root,,; +connect waiter,localhost,root,,; +connection holder; +BEGIN; +SELECT id FROM t WHERE id=1 FOR UPDATE; +id +1 +SELECT id FROM t WHERE id=2 FOR UPDATE; +id +2 +connection waiter; +SET DEBUG_SYNC= +'lock_wait_before_suspend SIGNAL waiter_will_wait'; +SELECT id FROM t WHERE id = 1 FOR UPDATE; +connection holder; +SET DEBUG_SYNC= +'now WAIT_FOR waiter_will_wait'; +SELECT * FROM t FOR UPDATE; +id +1 +2 +COMMIT; +connection waiter; +id +1 +connection default; +disconnect holder; +disconnect waiter; +DROP TABLE `t`; +SET DEBUG_SYNC='reset'; diff --git a/mysql-test/suite/innodb/r/deadlock_victim_race.result b/mysql-test/suite/innodb/r/deadlock_victim_race.result new file mode 100644 index 00000000..061edc77 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_victim_race.result @@ -0,0 +1,46 @@ +connect cancel_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB; +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); +BEGIN; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +a b +20 20 +connect con_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont EXECUTE 2'; +UPDATE t SET b = 100; +connect con_3,localhost,root,,; +BEGIN; +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 30 FOR UPDATE; +a b +30 30 +SET DEBUG_SYNC='now WAIT_FOR upd_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL sel_locked'; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR sel_locked'; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL upd_cont'; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET SESSION innodb_lock_wait_timeout=1; +SELECT * FROM t WHERE a = 10 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC="now SIGNAL upd_cont"; +connection con_3; +a b +20 20 +connection con_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con_3; +disconnect con_2; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; +disconnect cancel_purge; diff --git a/mysql-test/suite/innodb/r/deadlock_wait_lock_race.result b/mysql-test/suite/innodb/r/deadlock_wait_lock_race.result new file mode 100644 index 00000000..874f5af4 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_wait_lock_race.result @@ -0,0 +1,27 @@ +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0; +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); +BEGIN; +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +a b +20 20 +connect con_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont'; +UPDATE t SET b = 100; +connection default; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont"; +SELECT * FROM t WHERE a = 10 FOR UPDATE; +connection con_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con_2; +connection default; +a b +10 10 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/deadlock_wait_thr_race.result b/mysql-test/suite/innodb/r/deadlock_wait_thr_race.result new file mode 100644 index 00000000..6992a447 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_wait_thr_race.result @@ -0,0 +1,33 @@ +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0; +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); +BEGIN; +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +a b +20 20 +connect con_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont'; +SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2'; +BEGIN; +UPDATE t SET b = 100; +connection default; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont"; +SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend"; +SELECT * FROM t WHERE a = 10 FOR UPDATE;; +connect con_3,localhost,root,,; +SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend"; +SET DEBUG_SYNC="now SIGNAL upd_cont_2"; +disconnect con_3; +connection con_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con_2; +connection default; +a b +10 10 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/default_row_format_alter,compact.rdiff b/mysql-test/suite/innodb/r/default_row_format_alter,compact.rdiff new file mode 100644 index 00000000..c6c582fa --- /dev/null +++ b/mysql-test/suite/innodb/r/default_row_format_alter,compact.rdiff @@ -0,0 +1,19 @@ +--- default_row_format_alter.result ++++ default_row_format_alter,compact.reject +@@ -91,7 +91,7 @@ + ALTER TABLE t1 ADD b INT; + SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; + ROW_FORMAT +-Dynamic ++Compact + DROP TABLE t1; + # + # MDEV-23345 Assertion not_redundant() == old.not_redundant() failed +@@ -102,6 +102,6 @@ + ALTER TABLE t1 DROP b; + SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; + ROW_FORMAT +-Dynamic ++Compact + DROP TABLE t1; + SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff b/mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff new file mode 100644 index 00000000..a05a9914 --- /dev/null +++ b/mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff @@ -0,0 +1,19 @@ +--- default_row_format_alter.result ++++ default_row_format_alter,redundant.reject +@@ -91,7 +91,7 @@ + ALTER TABLE t1 ADD b INT; + SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; + ROW_FORMAT +-Dynamic ++Redundant + DROP TABLE t1; + # + # MDEV-23345 Assertion not_redundant() == old.not_redundant() failed +@@ -102,6 +102,6 @@ + ALTER TABLE t1 DROP b; + SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; + ROW_FORMAT +-Dynamic ++Redundant + DROP TABLE t1; + SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/default_row_format_alter.result b/mysql-test/suite/innodb/r/default_row_format_alter.result new file mode 100644 index 00000000..33936b59 --- /dev/null +++ b/mysql-test/suite/innodb/r/default_row_format_alter.result @@ -0,0 +1,153 @@ +SET @row_format = @@GLOBAL.innodb_default_row_format; +#################################### +# Check if table rebuilding alter isn't affect if table is created +# with explicit row_format +CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'abc'); +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # # NULL latin1_swedish_ci NULL row_format=COMPACT 0 N +SET GLOBAL innodb_default_row_format=DYNAMIC; +ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY; +# Here we expect COMPACT because it was explicitly specified at CREATE +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # # NULL latin1_swedish_ci NULL row_format=COMPACT 0 N +DROP TABLE t1; +#################################### +# Check if table rebuilding alter is affected when there is no +# row_format specified at CREATE TABLE. +SET GLOBAL innodb_default_row_format = COMPACT; +CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'abc'); +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # # NULL latin1_swedish_ci NULL 0 N +CREATE TABLE t2 (b VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL) ENGINE=InnoDB; +SET GLOBAL innodb_default_row_format = DYNAMIC; +ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY; +# Here we expect DYNAMIC because there is no explicit ROW_FORMAT and the +# default_row_format is changed to DYNAMIC just before ALTER +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Dynamic # # # # # # NULL # # NULL latin1_swedish_ci NULL 0 N +DROP TABLE t1; +ALTER TABLE t2 ADD INDEX(b); +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +ALTER TABLE t2 FORCE, ADD INDEX(b); +DROP TABLE t2; +#################################### +# Check the row_format effect on ALTER, ALGORITHM=COPY +SET GLOBAL innodb_default_row_format = REDUNDANT; +CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, REPEAT('abc',1000)); +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Redundant # # # # # # NULL # # NULL latin1_swedish_ci NULL 0 N +CREATE TABLE t2 (b VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL) ENGINE=InnoDB; +SET GLOBAL innoDB_default_row_format = COMPACT; +ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY; +# Because of ALGORITHM=COPY, there is TABLE REBUILD and the table isn't +# created with explicit row_format, so we expect ROW_FORMAT=COMPACT +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # # NULL latin1_swedish_ci NULL 0 N +DROP TABLE t1; +ALTER TABLE t2 ADD INDEX(b); +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +ALTER TABLE t2 FORCE, ADD INDEX(b); +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +SET GLOBAL innodb_default_row_format = DYNAMIC; +ALTER TABLE t2 ADD INDEX(b); +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +ALTER TABLE t2 FORCE, ADD INDEX(b); +DROP TABLE t2; + +################################### +# Check the row_format effect on ALTER, ALGORITHM=COPY on +# create table with explicit row_format +CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=INNODB; +INSERT INTO t1 VALUES (1, REPEAT('abc',1000)); +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Redundant # # # # # # NULL # # NULL latin1_swedish_ci NULL row_format=REDUNDANT 0 N +SET GLOBAL innoDB_default_row_format = COMPACT; +ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY; +# Because of ALGORITHM=COPY, there is TABLE REBUILD and the table is +# created with explicit row_format, so we expect original +# ROW_FORMAT=REDUNDANT +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Redundant # # # # # # NULL # # NULL latin1_swedish_ci NULL row_format=REDUNDANT 0 N +DROP TABLE t1; + +################################## +# Check row_format on ALTER ALGORITHM=INPLACE +SET GLOBAL innodb_default_row_format=COMPACT; +CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT, KEY k1(b(10))) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, REPEAT('abc',1000)); +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # # NULL latin1_swedish_ci NULL 0 N +SET GLOBAL innodb_default_row_format=DYNAMIC; +ALTER TABLE t1 DROP INDEX k1; +# Because it is in-place operation, there is no rebuild, so the +# original format has to be retained. +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # # NULL latin1_swedish_ci NULL 0 N +DROP TABLE t1; +# +# MDEV-24758 heap-use-after-poison in innobase_add_instant_try/rec_copy +# +CREATE TABLE t1 (pk INT PRIMARY KEY) CHARACTER SET utf8 ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET GLOBAL innodb_default_row_format = REDUNDANT; +ALTER TABLE t1 ADD a CHAR(8) DEFAULT ''; +DROP TABLE t1; +SET GLOBAL innodb_default_row_format = @row_format; +# End of 10.3 tests +# +# MDEV-23295 Assertion fields[i].same(instant.fields[i]) failed +# +SET GLOBAL innodb_default_row_format = @row_format; +CREATE TABLE t1 (a char(8)) ENGINE=InnoDB DEFAULT CHARSET utf8; +SET GLOBAL innodb_default_row_format= COMPACT; +ALTER TABLE t1 ADD b INT; +SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +ROW_FORMAT +Dynamic +DROP TABLE t1; +# +# MDEV-23345 Assertion not_redundant() == old.not_redundant() failed +# +SET GLOBAL innodb_default_row_format = @row_format; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB; +SET GLOBAL innodb_default_row_format= COMPACT; +ALTER TABLE t1 DROP b; +SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +ROW_FORMAT +Dynamic +DROP TABLE t1; +# +# MDEV-31025 Redundant table alter fails when fixed column +# stored externally +# +set @old_sql_mode = @@sql_mode; +SET @@sql_mode=''; +CREATE TABLE t1(pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255), +c4 char(255), c5 char(255), c6 char(255), +c7 char(255), c8 char(255), primary key(pk) +)Engine=InnoDB character set utf32 ROW_FORMAT=REDUNDANT; +INSERT INTO t1(pk, c) VALUES (1, repeat('a', 255)); +ALTER TABLE t1 FORCE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT LENGTH(c) FROM t1; +LENGTH(c) +1020 +DROP TABLE t1; +set @@sql_mode = @old_sql_mode; +# End of 10.4 tests +SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/default_row_format_compatibility.result b/mysql-test/suite/innodb/r/default_row_format_compatibility.result new file mode 100644 index 00000000..100b9d59 --- /dev/null +++ b/mysql-test/suite/innodb/r/default_row_format_compatibility.result @@ -0,0 +1,105 @@ +call mtr.add_suppression("Index for table 'tab' is corrupt; try to repair it"); +SET @row_format = @@GLOBAL.innodb_default_row_format; +# ########################################################### +# Check with Import/Export tablespace with Default_row_format +SET GLOBAL innodb_default_row_format=Compact; +SELECT @@innodb_default_row_format; +@@innodb_default_row_format +compact +SELECT @@innodb_file_per_table; +@@innodb_file_per_table +1 +CREATE TABLE tab(a INT) ENGINE=InnoDB; +SHOW TABLE STATUS LIKE 'tab'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +INSERT INTO tab VALUES(1); +INSERT INTO tab VALUES(2); +SELECT * FROM tab; +a +1 +2 +FLUSH TABLE tab FOR EXPORT; +UNLOCK TABLES; +DROP TABLE tab; +SET GLOBAL innodb_default_row_format=Dynamic; +CREATE TABLE tab(a INT) ENGINE=InnoDB; +ALTER TABLE tab DISCARD TABLESPACE; +ALTER TABLE tab IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT) +DROP TABLE tab; +SET GLOBAL innodb_default_row_format=Compact; +SELECT @@innodb_default_row_format; +@@innodb_default_row_format +compact +CREATE TABLE tab(a INT) ENGINE=InnoDB; +SHOW TABLE STATUS LIKE 'tab'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +ALTER TABLE tab DISCARD TABLESPACE; +call mtr.add_suppression("InnoDB: Tried to read .* bytes at offset 0"); +ALTER TABLE tab IMPORT TABLESPACE; +ERROR HY000: Index for table 'tab' is corrupt; try to repair it +ALTER TABLE tab IMPORT TABLESPACE; +SELECT * FROM tab; +a +1 +2 +DROP TABLE tab; +# ########################################################### +SET GLOBAL innodb_default_row_format=Dynamic; +SELECT @@innodb_default_row_format; +@@innodb_default_row_format +dynamic +CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(3070))) ENGINE= InnoDB; +SHOW TABLE STATUS LIKE 'tab'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +INSERT INTO tab(a,b) VALUES(1,'Check with max column size'); +SELECT * FROM tab; +a b +1 Check with max column size +SET GLOBAL innodb_default_row_format=COMPACT; +ALTER TABLE tab ROW_FORMAT=COMPACT; +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +DROP TABLE tab; +SET GLOBAL innodb_default_row_format=Default; +SELECT @@innodb_default_row_format; +@@innodb_default_row_format +dynamic +SET GLOBAL innodb_default_row_format=Dynamic; +SELECT @@innodb_default_row_format; +@@innodb_default_row_format +dynamic +CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(767))) ENGINE= InnoDB; +SHOW TABLE STATUS LIKE 'tab'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +INSERT INTO tab(a,b) VALUES(1,'Check with max column size'); +SELECT * FROM tab; +a b +1 Check with max column size +ALTER TABLE tab ROW_FORMAT=COMPACT; +SHOW TABLE STATUS LIKE 'tab'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPACT 0 N +SELECT * FROM tab; +a b +1 Check with max column size +SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; +SET GLOBAL innodb_read_only_compressed=ON; +ALTER TABLE tab ROW_FORMAT=COMPRESSED; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SET GLOBAL innodb_read_only_compressed=OFF; +ALTER TABLE tab ROW_FORMAT=COMPRESSED; +SET GLOBAL innodb_read_only_compressed=ON; +SELECT * FROM tab; +a b +1 Check with max column size +ALTER TABLE tab ROW_FORMAT=Dynamic; +SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; +SHOW TABLE STATUS LIKE 'tab'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC 0 N +DROP TABLE tab; +SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/default_row_format_create,dynamic.rdiff b/mysql-test/suite/innodb/r/default_row_format_create,dynamic.rdiff new file mode 100644 index 00000000..fd4a1c8b --- /dev/null +++ b/mysql-test/suite/innodb/r/default_row_format_create,dynamic.rdiff @@ -0,0 +1,11 @@ +--- default_row_format_create.result ++++ default_row_format_create,dynamic.result +@@ -1,7 +1,7 @@ + CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB; + SHOW TABLE STATUS LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N ++t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N + DROP TABLE t1; + CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + SHOW TABLE STATUS LIKE 't1'; diff --git a/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff new file mode 100644 index 00000000..2597d014 --- /dev/null +++ b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff @@ -0,0 +1,31 @@ +--- default_row_format_create.result ++++ default_row_format_create,redundant.result +@@ -1,7 +1,7 @@ + CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB; + SHOW TABLE STATUS LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N ++t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N + DROP TABLE t1; + CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + SHOW TABLE STATUS LIKE 't1'; +@@ -31,8 +31,9 @@ + CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1; + SHOW TABLE STATUS LIKE 't1'; + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 0 N + DROP TABLE IF EXISTS t1; ++Warnings: ++Note 1051 Unknown table 'test.t1' + SET @save_format = @@GLOBAL.innodb_default_row_format; + SET GLOBAL innodb_default_row_format = redundant; + CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +@@ -49,7 +49,7 @@ + ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options") + SHOW WARNINGS; + Level Code Message +-Warning 1478 InnoDB: PAGE_COMPRESSED requires PAGE_COMPRESSION_LEVEL or innodb_compression_level > 0 ++Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT + Error 1005 Can't create table `test`.`t` (errno: 140 "Wrong create options") + Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB + CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1 page_compression_level=1; diff --git a/mysql-test/suite/innodb/r/default_row_format_create.result b/mysql-test/suite/innodb/r/default_row_format_create.result new file mode 100644 index 00000000..a1334101 --- /dev/null +++ b/mysql-test/suite/innodb/r/default_row_format_create.result @@ -0,0 +1,70 @@ +CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +DROP TABLE t1; +CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC 0 N +DROP TABLE t1; +CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPACT 0 N +DROP TABLE t1; +CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=REDUNDANT 0 N +DROP TABLE t1; +CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB +ROW_FORMAT=COMPRESSED; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED 0 N +TRUNCATE TABLE t1; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED 0 N +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 0 N +DROP TABLE IF EXISTS t1; +SET @save_format = @@GLOBAL.innodb_default_row_format; +SET GLOBAL innodb_default_row_format = redundant; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +SET GLOBAL innodb_default_row_format = @save_format; +TRUNCATE TABLE t1; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +DROP TABLE t1; +SET @save_level=@@GLOBAL.innodb_compression_level; +SET GLOBAL innodb_compression_level=0; +CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1; +ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options") +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: PAGE_COMPRESSED requires PAGE_COMPRESSION_LEVEL or innodb_compression_level > 0 +Error 1005 Can't create table `test`.`t` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1 page_compression_level=1; +DROP TABLE IF EXISTS t; +SET GLOBAL innodb_compression_level=1; +CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1; +DROP TABLE IF EXISTS t; +SET GLOBAL innodb_compression_level=1; +CREATE TABLE t(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC page_compressed=1; +CREATE TEMPORARY TABLE tt(a INT PRIMARY KEY) +ROW_FORMAT=DYNAMIC page_compressed=1 ENGINE=InnoDB; +SET GLOBAL innodb_compression_level=0; +ALTER TABLE t FORCE, ROW_FORMAT=DEFAULT, ALGORITHM=INPLACE; +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED' +ALTER TABLE t FORCE, ROW_FORMAT=DEFAULT, ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options") +DROP TABLE t; +TRUNCATE tt; +SET GLOBAL innodb_compression_level=@save_level; diff --git a/mysql-test/suite/innodb/r/defrag_mdl-9155.result b/mysql-test/suite/innodb/r/defrag_mdl-9155.result new file mode 100644 index 00000000..18b71f42 --- /dev/null +++ b/mysql-test/suite/innodb/r/defrag_mdl-9155.result @@ -0,0 +1,18 @@ +set global innodb_defragment=1; +create table t1 (a int not null primary key auto_increment, b varchar(256), key second(a, b)) engine=innodb; +insert t1 select null, repeat('a', 256) from seq_1_to_100; +select count(*) from t1; +count(*) +100 +connect con1,localhost,root; +start transaction; +select count(*) from t1; +count(*) +100 +connection default; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +connection con1; +drop table t1; +set global innodb_defragment=default; diff --git a/mysql-test/suite/innodb/r/dml_purge.result b/mysql-test/suite/innodb/r/dml_purge.result new file mode 100644 index 00000000..2b345089 --- /dev/null +++ b/mysql-test/suite/innodb/r/dml_purge.result @@ -0,0 +1,48 @@ +# +# MDEV-12288 Reset DB_TRX_ID when the history is removed, +# to speed up MVCC +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT NOT NULL) +ROW_FORMAT=REDUNDANT ENGINE=InnoDB; +InnoDB 0 transactions not purged +connect prevent_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +INSERT INTO t1 VALUES(1,2),(3,4); +ALTER TABLE t1 ADD COLUMN c INT; +UPDATE t1 SET b=-3 WHERE a=3; +connect con1,localhost,root; +BEGIN; +UPDATE t1 SET b=4 WHERE a=3; +disconnect prevent_purge; +connection default; +SET GLOBAL innodb_max_purge_lag_wait=1; +connection con1; +ROLLBACK; +disconnect con1; +connection default; +InnoDB 0 transactions not purged +FLUSH TABLE t1 FOR EXPORT; +Clustered index root page contents: +N_RECS=3; LEVEL=0 +header=0x0100000300c6 (a=0x696e66696d756d00) +header=0x1000200b0087 (a=0x80000000, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + b=0x80000000, + c=NULL(4 bytes)) +header=0x0000100900a6 (a=0x80000001, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + b=0x80000002) +header=0x000018090074 (a=0x80000003, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + b=0x7ffffffd) +header=0x040008030000 (a=0x73757072656d756d00) +UNLOCK TABLES; +SELECT * FROM t1; +a b c +1 2 NULL +3 -3 NULL +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/doublewrite.result b/mysql-test/suite/innodb/r/doublewrite.result new file mode 100644 index 00000000..ba1965ed --- /dev/null +++ b/mysql-test/suite/innodb/r/doublewrite.result @@ -0,0 +1,266 @@ +# +# Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY +# Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST +# PAGE OF SYSTEM TABLESPACE +# +SET GLOBAL innodb_fast_shutdown = 0; +# restart +show variables like 'innodb_doublewrite'; +Variable_name Value +innodb_doublewrite ON +show variables like 'innodb_fil_make_page_dirty_debug'; +Variable_name Value +innodb_fil_make_page_dirty_debug 0 +show variables like 'innodb_saved_page_number_debug'; +Variable_name Value +innodb_saved_page_number_debug 0 +connect stop_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0; +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +insert into t1 values(3, repeat('/',12)); +insert into t1 values(4, repeat('-',12)); +insert into t1 values(5, repeat('.',12)); +commit work; +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of user +# tablespace is full of zeroes. +select space into @space_id from information_schema.innodb_sys_tables +where name = 'test/t1'; +begin; +insert into t1 values (6, repeat('%', 12)); +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +disconnect stop_purge; +# Make the first page (page_no=0) of the user tablespace +# full of zeroes. +# +# MDEV-11623: Use old FSP_SPACE_FLAGS in the doublewrite buffer. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of user +# tablespace is corrupted. +select space into @space_id from information_schema.innodb_sys_tables +where name = 'test/t1'; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +set global innodb_log_checkpoint_now=1; +begin; +insert into t1 values (6, repeat('%', 12)); +# Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the first page (page_no=0) of the user tablespace. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of user +# tablespace is full of zeroes. +select space into @space_id from information_schema.innodb_sys_tables +where name = 'test/t1'; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 400)); +# Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the tablespace all zeroes. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of user +# tablespace is corrupted. +select space into @space_id from information_schema.innodb_sys_tables +where name = 'test/t1'; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 400)); +# Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that the dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the 2nd page (page_no=1) of the user tablespace. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of +# system tablespace is full of zeroes. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the first page (page_no=0) of the system tablespace +# all zeroes. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of +# system tablespace is corrupted. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the first page (page_no=0) of the system tablespace. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of +# system tablespace is full of zeroes. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the system tablespace +# all zeroes. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of +# system tablespace is corrupted. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the system tablespace +# all zeroes. +# restart +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +FOUND 1 /InnoDB: .*test.t1\.ibd/ in mysqld.1.err +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +drop table t1; +# +# MDEV-12600 crash during install_db with innodb_page_size=32K +# and ibdata1=3M +# +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /\[ERROR\] InnoDB: Cannot create doublewrite buffer/ in mysqld.1.err +# restart diff --git a/mysql-test/suite/innodb/r/dropdb.result b/mysql-test/suite/innodb/r/dropdb.result new file mode 100644 index 00000000..e1ff475b --- /dev/null +++ b/mysql-test/suite/innodb/r/dropdb.result @@ -0,0 +1,22 @@ +SET NAMES utf8; +call mtr.add_suppression("Invalid .old.. table or database name"); +# +# Bug #19929435 DROP DATABASE HANGS WITH MALFORMED TABLE +# +set session default_storage_engine=innodb; +create database `b`; +use `b`; +create table `#mysql50#q.q` select 1; +ERROR 42000: Incorrect table name '#mysql50#q.q' +create table `#mysql50#q·q` select 1; +drop database `b`; +# +# MDEV-27336 Crash on DROP DATABASE due to out-of-bounds result +# from InnoDB SUBSTR() function +# +USE test; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2(a INT PRIMARY KEY REFERENCES t1(a)) ENGINE=InnoDB; +CREATE DATABASE somewhat_longer_name_to_cause_trouble; +DROP DATABASE somewhat_longer_name_to_cause_trouble; +DROP TABLE t2,t1; diff --git a/mysql-test/suite/innodb/r/dropdb_cs.result b/mysql-test/suite/innodb/r/dropdb_cs.result new file mode 100644 index 00000000..59f02c74 --- /dev/null +++ b/mysql-test/suite/innodb/r/dropdb_cs.result @@ -0,0 +1,16 @@ +# +# MDEV-28802 DROP DATABASE in InnoDB still is case-insensitive +# +SET @save_fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +CREATE DATABASE Db; +CREATE TABLE Db.t1 (c1 INT KEY) ENGINE=InnoDB; +CREATE DATABASE DB; +DROP DATABASE DB; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'D%'; +NAME +Db/t1 +DROP DATABASE Db; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'D%'; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +SET GLOBAL innodb_file_per_table=@save_fpt; diff --git a/mysql-test/suite/innodb/r/encryption_threads_shutdown.result b/mysql-test/suite/innodb/r/encryption_threads_shutdown.result new file mode 100644 index 00000000..3f0dcd90 --- /dev/null +++ b/mysql-test/suite/innodb/r/encryption_threads_shutdown.result @@ -0,0 +1,12 @@ +call mtr.add_suppression("Creating system tablespace with existing redo log file is not recommended."); +call mtr.add_suppression("InnoDB: Database creation was aborted"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +CREATE TABLE t(a INT) ENGINE=InnoDB; +# Kill the server +# restart +SELECT * FROM t; +ERROR 42000: Unknown storage engine 'InnoDB' +# Kill the server +# restart +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/evict_tables_on_commit_debug.result b/mysql-test/suite/innodb/r/evict_tables_on_commit_debug.result new file mode 100644 index 00000000..d403b1e1 --- /dev/null +++ b/mysql-test/suite/innodb/r/evict_tables_on_commit_debug.result @@ -0,0 +1,9 @@ +SET @save_debug= @@GLOBAL.innodb_evict_tables_on_commit_debug; +SET GLOBAL innodb_evict_tables_on_commit_debug=on; +CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(2); +DROP TABLE t2; +SET GLOBAL innodb_evict_tables_on_commit_debug=@save_debug; +DROP TEMPORARY TABLE t1; diff --git a/mysql-test/suite/innodb/r/file_format_defaults.result b/mysql-test/suite/innodb/r/file_format_defaults.result new file mode 100644 index 00000000..ee30b09d --- /dev/null +++ b/mysql-test/suite/innodb/r/file_format_defaults.result @@ -0,0 +1,29 @@ +call mtr.add_suppression("InnoDB: Cannot add field `c1` in table `test`\\.`tab0`"); +SELECT @@innodb_strict_mode; +@@innodb_strict_mode +1 +SELECT @@innodb_file_per_table; +@@innodb_file_per_table +1 +SET SQL_MODE=strict_all_tables; +CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +Warnings: +Note 1071 Specified key was too long; max key length is 3072 bytes +SHOW CREATE TABLE tab0; +Table Create Table +tab0 CREATE TABLE `tab0` ( + `c1` varchar(65530) DEFAULT NULL, + KEY `c1` (`c1`(3072)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +DROP TABLE tab0; +CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB KEY_BLOCK_SIZE=2; +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +CREATE TABLE tab0(c1 INT,c2 LONGBLOB ) ENGINE=InnoDB ROW_FORMAT=Dynamic; +DROP TABLE tab0; +SET GLOBAL innodb_strict_mode=OFF; +SET GLOBAL innodb_strict_mode=Default; +SELECT @@innodb_strict_mode; +@@innodb_strict_mode +1 +CREATE TABLE tab1(c1 int ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +DROP TABLE tab1; diff --git a/mysql-test/suite/innodb/r/fk_col_alter.result b/mysql-test/suite/innodb/r/fk_col_alter.result new file mode 100644 index 00000000..403bef6a --- /dev/null +++ b/mysql-test/suite/innodb/r/fk_col_alter.result @@ -0,0 +1,118 @@ +# +# MDEV-31086 MODIFY COLUMN can break FK constraints, and +# lead to unrestorable dumps +# +CREATE TABLE t1( +id SERIAL, +msg VARCHAR(100) CHARACTER SET utf8mb3, +KEY(msg))ENGINE=InnoDB; +CREATE TABLE t2( +id SERIAL, +msg varchar(100) CHARACTER SET utf8mb4, +CONSTRAINT fk_t1 FOREIGN KEY (msg) REFERENCES t1 (msg))ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +CREATE TABLE t2( +id SERIAL, +msg varchar(100) CHARACTER SET utf8mb3, +msg_1 varchar(100) CHARACTER SET utf8mb3, +INDEX (msg_1), +INDEX (msg), +CONSTRAINT fk_t1 FOREIGN KEY (msg) REFERENCES t1 (msg) +ON DELETE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(200) character set utf8mb3, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(200) character set utf8mb3, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(200) character set utf8mb3, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(400) character set utf8mb3, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(100) CHARACTER SET utf8mb4, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(100) CHARACTER SET utf8mb4, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(100) CHARACTER SET utf8mb4,ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' +ALTER TABLE t2 MODIFY COLUMN msg VARCHAR(100) CHARACTER SET utf8mb4,ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(msg_1) REFERENCES t1(msg),MODIFY COLUMN msg_1 VARCHAR(100) CHARACTER SET utf8mb4, ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(msg_1) REFERENCES t1(msg),MODIFY COLUMN msg_1 VARCHAR(100) CHARACTER SET utf8mb4, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(msg_1) REFERENCES t1(msg),MODIFY COLUMN msg_1 VARCHAR(100) CHARACTER SET utf8mb4, ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(msg_1) REFERENCES t1(msg),MODIFY COLUMN msg_1 VARCHAR(100) CHARACTER SET utf8mb4, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg_1': used in a foreign key constraint 'test/t2_ibfk_0' +ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(msg_1) REFERENCES t1(msg),MODIFY COLUMN msg_1 VARCHAR(200) CHARACTER SET utf8mb3, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg_1': used in a foreign key constraint 'test/t2_ibfk_0' +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb3, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' of table 'test.t2' +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb3, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' of table 'test/t2' +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' of table 'test.t2' +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' of table 'test/t2' +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb3, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' of table 'test.t2' +ALTER TABLE t1 MODIFY msg VARCHAR(400) CHARSET utf8mb3, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' of table 'test/t2' +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'fk_t1' of table 'test.t2' +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=INPLACE; +ERROR HY000: Cannot change column 'msg': used in a foreign key constraint 'test/fk_t1' of table 'test/t2' +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 DROP FOREIGN KEY fk_t1, MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=COPY; +ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=COPY; +ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY (msg) REFERENCES t1(msg), aLGORITHM=INPLACE; +SET FOREIGN_KEY_CHECKS=1; +DROP TABLE t2, t1; +# +# MDEV-31869 Server aborts when table does drop column +# +CREATE TABLE t (a VARCHAR(40), b INT, C INT) ENGINE=InnoDB; +ALTER TABLE t MODIFY a VARCHAR(50), DROP b; +DROP TABLE t; +# +# MDEV-32060 Server aborts when table doesn't +# have referenced index +# +SET SESSION FOREIGN_KEY_CHECKS = OFF; +CREATE TABLE t1 (a VARCHAR(16) KEY, FOREIGN KEY(a) REFERENCES t2(b)) ENGINE=InnoDB; +CREATE TABLE t2 (b VARCHAR(8)) ENGINE=InnoDB; +SET SESSION FOREIGN_KEY_CHECKS = ON; +ALTER TABLE t2 MODIFY b VARCHAR(16), ADD KEY(b); +DROP TABLE t1, t2; +# +# MDEV-32337 Assertion `pos < table->n_def' failed +# in dict_table_get_nth_col +# +CREATE TABLE t (a INT, va INT AS (a), b INT, vb INT AS (b), +c INT, vc INT AS (c), vf VARCHAR(16) AS (f), +f VARCHAR(4)) ENGINE=InnoDB; +ALTER TABLE t MODIFY f VARCHAR(8); +ALTER TABLE t MODIFY vf VARCHAR(18); +ERROR HY000: This is not yet supported for generated columns +DROP TABLE t; +# +# MDEV-32527 Server aborts during alter operation +# when table doesn't have foreign index +# +CREATE TABLE t1 (f1 INT NOT NULL, INDEX(f1)) ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, f2 VARCHAR(100) DEFAULT NULL, +INDEX idx(f1, f2), +FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=INNODB; +SET SESSION FOREIGN_KEY_CHECKS = OFF; +ALTER TABLE t2 DROP INDEX idx; +ALTER TABLE t2 MODIFY f2 VARCHAR(1023); +SET SESSION FOREIGN_KEY_CHECKS = ON; +DROP TABLE t2, t1; +# End of 10.4 tests diff --git a/mysql-test/suite/innodb/r/flush.result b/mysql-test/suite/innodb/r/flush.result new file mode 100644 index 00000000..cd6bec48 --- /dev/null +++ b/mysql-test/suite/innodb/r/flush.result @@ -0,0 +1,16 @@ +SELECT @@GLOBAL.innodb_open_files; +@@GLOBAL.innodb_open_files +10 +CREATE TABLE t0 (a INT) ENGINE=InnoDB; +FLUSH TABLE t0 WITH READ LOCK; +UNLOCK TABLES; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +CREATE TABLE t3 (a INT) ENGINE=InnoDB; +CREATE TABLE t4 (a INT) ENGINE=InnoDB; +CREATE TABLE t5 (a INT) ENGINE=InnoDB; +CREATE TABLE t6 (a INT) ENGINE=InnoDB; +CREATE TABLE t7 (a INT) ENGINE=InnoDB; +FLUSH TABLE t0 WITH READ LOCK; +UNLOCK TABLES; +DROP TABLE t0, t1, t2, t3, t4, t5, t6, t7; diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result new file mode 100644 index 00000000..503825db --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign-keys.result @@ -0,0 +1,238 @@ +# +# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE +# ADD FOREIGN KEY +# +CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT, +PRIMARY KEY (`department_id`)) engine=innodb; +CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT, +`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb; +CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb; +ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES +`people` (`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people` +(`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` +(`people_id`); +drop table title, department, people; +create table t1 (a int primary key, b int) engine=innodb; +create table t2 (c int primary key, d int, +foreign key (d) references t1 (a) on update cascade) engine=innodb; +insert t1 values (1,1),(2,2),(3,3); +insert t2 values (4,1),(5,2),(6,3); +flush table t2 with read lock; +connect con1,localhost,root; +delete from t1 where a=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +update t1 set a=10 where a=1; +connection default; +unlock tables; +connection con1; +connection default; +lock table t2 write; +connection con1; +delete from t1 where a=2; +connection default; +unlock tables; +connection con1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +connection default; +unlock tables; +disconnect con1; +create user foo; +grant select,update on test.t1 to foo; +connect foo,localhost,foo; +update t1 set a=30 where a=3; +disconnect foo; +connection default; +select * from t2; +c d +5 2 +4 10 +6 30 +drop table t2, t1; +drop user foo; +create table t1 (f1 int primary key) engine=innodb; +create table t2 (f2 int primary key) engine=innodb; +create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb; +insert into t1 values (1),(2),(3),(4),(5); +insert into t2 values (1),(2),(3),(4),(5); +insert into t3 values (1),(2),(3),(4),(5); +connect con1,localhost,root; +set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2'; +alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade; +connection default; +set debug_sync='before_execute_sql_command wait_for g1'; +update t1 set f1 = f1 + 100000 limit 2; +connect con2,localhost,root; +kill query UPDATE; +disconnect con2; +connection default; +ERROR 70100: Query execution was interrupted +set debug_sync='now signal g2'; +connection con1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f2` int(11) NOT NULL, + PRIMARY KEY (`f2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +disconnect con1; +connection default; +select * from t2 where f2 not in (select f1 from t1); +f2 +select * from t3 where f3 not in (select f2 from t2); +f3 +drop table t3; +drop table t2; +drop table t1; +set debug_sync='reset'; +# +# MDEV-17595 - Server crashes in copy_data_between_tables or +# Assertion `thd->transaction.stmt.is_empty() || +# (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' +# fails in close_tables_for_reopen upon concurrent +# ALTER TABLE and FLUSH +# +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1),(2); +CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t2 VALUES(2); +ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE; +DROP TABLE t2, t1; +# +# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name) +# +CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +FLUSH TABLES; +SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go'; +ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE; +connect con1, localhost, root; +SET debug_sync='now WAIT_FOR ready'; +SET lock_wait_timeout=0; +UPDATE t2 SET pk=10 WHERE pk=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1'; +DEALLOCATE PREPARE stmt; +SET debug_sync='now SIGNAL go'; +connection default; +disconnect con1; +connection default; +SET debug_sync='reset'; +SHOW OPEN TABLES FROM test; +Database Table In_use Name_locked +test t2 0 0 +DROP TABLE t1, t2; +create table t1 (a int primary key, b int) engine=innodb; +create table t2 (c int primary key, d int, +foreign key (d) references t1 (a) on update cascade) engine=innodb; +insert t1 values (1,1),(2,2),(3,3); +insert t2 values (4,1),(5,2),(6,3); +flush table t2 with read lock; +connect con1,localhost,root; +delete from t1 where a=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +update t1 set a=10 where a=1; +connection default; +unlock tables; +connection con1; +connection default; +lock table t2 write; +connection con1; +delete from t1 where a=2; +connection default; +unlock tables; +connection con1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +connection default; +unlock tables; +disconnect con1; +create user foo; +grant select,update on test.t1 to foo; +connect foo,localhost,foo; +update t1 set a=30 where a=3; +disconnect foo; +connection default; +select * from t2; +c d +5 2 +4 10 +6 30 +drop table t2, t1; +drop user foo; +# +# MDEV-17187 table doesn't exist in engine after ALTER other tables +# with CONSTRAINTs +# +set foreign_key_checks=on; +create table t1 (id int not null primary key) engine=innodb; +create table t2 (id int not null primary key, fid int not null, +CONSTRAINT fk_fid FOREIGN KEY (fid) REFERENCES t1 (id))engine=innodb; +insert into t1 values (1), (2), (3); +insert into t2 values (1, 1), (2, 1), (3, 2); +set foreign_key_checks=off; +alter table t2 drop index fk_fid; +set foreign_key_checks=on; +delete from t1 where id=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`)) +insert into t2 values(4, 99); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`)) +select * from t1; +id +1 +2 +3 +select * from t2; +id fid +1 1 +2 1 +3 2 +set foreign_key_checks=off; +delete from t1 where id=2; +insert into t2 values(4, 99); +set foreign_key_checks=on; +select * from t1; +id +1 +3 +select * from t2; +id fid +1 1 +2 1 +3 2 +4 99 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `fid` int(11) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1,t2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +drop table t1,t2; +ERROR 42S02: Unknown table 'test.t2' +# +# MDEV-23470 InnoDB: Failing assertion: cmp < 0 in +# row_ins_check_foreign_constraint +# +CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL)ENGINE=InnoDB; +CREATE TABLE t2(f1 VARCHAR(100), f2 INT NOT NULL, +INDEX(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(99, 2); +ALTER TABLE t2 ADD FOREIGN KEY(f2) REFERENCES t1(f1); +SET FOREIGN_KEY_CHECKS=0; +DROP INDEX f2 ON t2; +SET FOREIGN_KEY_CHECKS=1; +INSERT INTO t2 VALUES('G', 3); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)) +DROP TABLE t2, t1; +SET FOREIGN_KEY_CHECKS=DEFAULT; diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result new file mode 100644 index 00000000..bfed09d4 --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -0,0 +1,1076 @@ +# +# Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW +# DICT_CREATE_FOREIGN_CONSTR +# +create table t1 (f1 int primary key) engine=InnoDB; +create table t2 (f1 int primary key, +constraint c1 foreign key (f1) references t1(f1), +constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +create table t2 (f1 int primary key, +constraint c1 foreign key (f1) references t1(f1)) engine=innodb; +alter table t2 add constraint c1 foreign key (f1) references t1(f1); +ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") +set foreign_key_checks = 0; +alter table t2 add constraint c1 foreign key (f1) references t1(f1); +ERROR HY000: Duplicate FOREIGN KEY constraint name 'test/c1' +drop table t2, t1; +# +# Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN +# NULL/NOT NULL MISMATCH +# +set foreign_key_checks = 1; +show variables like 'foreign_key_checks'; +Variable_name Value +foreign_key_checks ON +CREATE TABLE t1 +(a INT NOT NULL, +b INT NOT NULL, +INDEX idx(a)) ENGINE=InnoDB; +CREATE TABLE t2 +(a INT KEY, +b INT, +INDEX ind(b), +FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE) +ENGINE=InnoDB; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) NOT NULL, + KEY `idx` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `ind` (`b`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (1, 80); +INSERT INTO t1 VALUES (2, 81); +INSERT INTO t1 VALUES (3, 82); +INSERT INTO t1 VALUES (4, 83); +INSERT INTO t1 VALUES (5, 84); +INSERT INTO t2 VALUES (51, 1); +INSERT INTO t2 VALUES (52, 2); +INSERT INTO t2 VALUES (53, 3); +INSERT INTO t2 VALUES (54, 4); +INSERT INTO t2 VALUES (55, 5); +SELECT a, b FROM t1 ORDER BY a; +a b +1 80 +2 81 +3 82 +4 83 +5 84 +SELECT a, b FROM t2 ORDER BY a; +a b +51 1 +52 2 +53 3 +54 4 +55 5 +INSERT INTO t2 VALUES (56, 6); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE) +ALTER TABLE t1 CHANGE a id INT; +SELECT id, b FROM t1 ORDER BY id; +id b +1 80 +2 81 +3 82 +4 83 +5 84 +SELECT a, b FROM t2 ORDER BY a; +a b +51 1 +52 2 +53 3 +54 4 +55 5 +# Operations on child table +INSERT INTO t2 VALUES (56, 6); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) +UPDATE t2 SET b = 99 WHERE a = 51; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) +DELETE FROM t2 WHERE a = 53; +SELECT id, b FROM t1 ORDER BY id; +id b +1 80 +2 81 +3 82 +4 83 +5 84 +SELECT a, b FROM t2 ORDER BY a; +a b +51 1 +52 2 +54 4 +55 5 +# Operations on parent table +DELETE FROM t1 WHERE id = 1; +UPDATE t1 SET id = 50 WHERE id = 5; +SELECT id, b FROM t1 ORDER BY id; +id b +2 81 +3 82 +4 83 +50 84 +SELECT a, b FROM t2 ORDER BY a; +a b +52 2 +54 4 +55 50 +DROP TABLE t2, t1; +# +# bug#25126722 FOREIGN KEY CONSTRAINT NAME IS NULL AFTER RESTART +# base bug#24818604 [GR] +# +CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (c1 INT PRIMARY KEY, FOREIGN KEY (c1) REFERENCES t1(c1)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +SELECT unique_constraint_name FROM information_schema.referential_constraints +WHERE table_name = 't2'; +unique_constraint_name +PRIMARY +# +# MDEV-28317 Assertion failure on rollback of FOREIGN KEY operation +# +SET foreign_key_checks=0; +CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE child(a INT,FOREIGN KEY(a) REFERENCES parent(a) ON DELETE CASCADE) +ENGINE=InnoDB; +INSERT INTO child VALUES(1); +ALTER TABLE child DROP INDEX a; +connect incomplete, localhost, root,,; +BEGIN; +DELETE FROM child; +connection default; +INSERT INTO parent SET a=0; +FLUSH TABLES; +# restart +disconnect incomplete; +INSERT INTO child SET a=0; +INSERT INTO child SET a=1; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE) +DELETE FROM parent; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE) +ALTER TABLE child ADD INDEX(a); +DELETE FROM parent; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE) +ALTER TABLE child FORCE; +DELETE FROM parent; +DROP TABLE child,parent; +SELECT unique_constraint_name FROM information_schema.referential_constraints +WHERE table_name = 't2'; +unique_constraint_name +PRIMARY +SELECT * FROM t1; +c1 +1 +SELECT unique_constraint_name FROM information_schema.referential_constraints +WHERE table_name = 't2'; +unique_constraint_name +PRIMARY +DROP TABLE t2; +DROP TABLE t1; +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE staff ( +staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, +store_id TINYINT UNSIGNED NOT NULL, +PRIMARY KEY (staff_id), +KEY idx_fk_store_id (store_id), +CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; +CREATE TABLE store ( +store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, +manager_staff_id TINYINT UNSIGNED NOT NULL, +PRIMARY KEY (store_id), +UNIQUE KEY idx_unique_manager (manager_staff_id), +CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; +LOCK TABLE staff WRITE; +UNLOCK TABLES; +DROP TABLES staff, store; +SET FOREIGN_KEY_CHECKS=1; +# +# MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE DATABASE best default character set latin1; +CREATE TABLE t3 (a INT PRIMARY KEY, +CONSTRAINT t2_ibfk_1 FOREIGN KEY (a) REFERENCES t1(a)) ENGINE=InnoDB; +CREATE TABLE best.t2 (a INT PRIMARY KEY, b TEXT, FULLTEXT INDEX(b), +FOREIGN KEY (a) REFERENCES test.t1(a)) ENGINE=InnoDB; +RENAME TABLE best.t2 TO test.t2; +ERROR 42S01: Table 't2' already exists +SHOW CREATE TABLE best.t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL, + `b` text DEFAULT NULL, + PRIMARY KEY (`a`), + FULLTEXT KEY `b` (`b`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP DATABASE best; +# +# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs +# +connect con1, localhost, root,,; +INSERT INTO t1 SET a=1; +BEGIN; +DELETE FROM t1; +connection default; +INSERT INTO t3 SET a=1; +connection con1; +kill query @id; +connection default; +ERROR 70100: Query execution was interrupted +connection con1; +ROLLBACK; +connection default; +disconnect con1; +DROP TABLE t3,t1; +# +# MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N +# or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN +# +CREATE TABLE t1 (a INT, UNIQUE(a), KEY(a)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a); +SET SESSION FOREIGN_KEY_CHECKS = OFF; +ALTER TABLE t1 CHANGE COLUMN a a TIME NOT NULL; +ERROR HY000: Cannot change column 'a': used in a foreign key constraint 't1_ibfk_1' of table 'test.t1' +ALTER TABLE t1 ADD pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY; +ALTER TABLE t1 CHANGE COLUMN a b TIME; +ERROR 0A000: ALGORITHM=COPY is not supported. Reason: Columns participating in a foreign key are renamed. Try ALGORITHM=INPLACE +ALTER TABLE t1 CHANGE COLUMN a b TIME, DROP FOREIGN KEY t1_ibfk_1; +SET SESSION FOREIGN_KEY_CHECKS = ON; +DROP TABLE t1; +# +# MDEV-18256 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N +# upon DROP FOREIGN KEY +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY fk1 (b) REFERENCES t1 (a)) +ENGINE=InnoDB; +ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1; +DROP TABLE t2, t1; +CREATE TABLE t1 (f VARCHAR(256)) ENGINE=InnoDB; +SET SESSION FOREIGN_KEY_CHECKS = OFF; +ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x); +SET SESSION FOREIGN_KEY_CHECKS = ON; +ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f); +ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f); +DROP TABLE t1; +CREATE TABLE t1 (f VARCHAR(256), FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY) +ENGINE=InnoDB; +SET SESSION FOREIGN_KEY_CHECKS = OFF; +ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x); +SET SESSION FOREIGN_KEY_CHECKS = ON; +ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f); +Warnings: +Warning 1088 failed to load FOREIGN KEY constraints +ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f); +DROP TABLE t1; +# +# MDEV-18630 Conditional jump or move depends on uninitialised value +# in ib_push_warning / dict_create_foreign_constraints_low +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +ALTER IGNORE TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (b); +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +SHOW WARNINGS; +Level Code Message +Warning 150 Alter table `test`.`t1` with foreign key (a) constraint failed. Referenced table `test`.`t2` not found in the data dictionary. +Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t1` +DROP TABLE t1; +# +# MDEV-18139 ALTER IGNORE ... ADD FOREIGN KEY causes bogus error +# +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY(f1)) ENGINE=InnoDB; +CREATE TABLE t2 (f INT, KEY(f)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t2 (f); +ALTER IGNORE TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f1); +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT, b INT, KEY idx(a)) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS= OFF; +ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES tx(x); +ALTER TABLE t1 DROP KEY idx; +ALTER TABLE t1 CHANGE a c INT; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1); +ALTER TABLE t1 ADD COLUMN f INT; +SET FOREIGN_KEY_CHECKS= OFF; +ALTER TABLE t1 DROP KEY idx; +ALTER TABLE t1 ADD KEY idx (f1); +SET FOREIGN_KEY_CHECKS= ON; +ALTER TABLE t1 DROP f3; +ALTER TABLE t1 CHANGE f f3 INT; +DROP TABLE t1; +SET FOREIGN_KEY_CHECKS=1; +# +# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE +# ADD FOREIGN KEY +# +CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT, +PRIMARY KEY (`department_id`)) engine=innodb; +CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT, +`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb; +CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb; +ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES +`people` (`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people` +(`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` +(`people_id`); +drop table title, department, people; +create table t1 (a int primary key, b int) engine=innodb; +create table t2 (c int primary key, d int, +foreign key (d) references t1 (a) on update cascade) engine=innodb; +insert t1 values (1,1),(2,2),(3,3); +insert t2 values (4,1),(5,2),(6,3); +flush table t2 with read lock; +connect con1,localhost,root; +delete from t1 where a=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +update t1 set a=10 where a=1; +connection default; +unlock tables; +connection con1; +connection default; +lock table t2 write; +connection con1; +delete from t1 where a=2; +connection default; +unlock tables; +connection con1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE) +connection default; +unlock tables; +disconnect con1; +create user foo; +grant select,update on test.t1 to foo; +connect foo,localhost,foo; +update t1 set a=30 where a=3; +disconnect foo; +connection default; +select * from t2; +c d +5 2 +4 10 +6 30 +drop table t2, t1; +drop user foo; +# +# MDEV-17595 - Server crashes in copy_data_between_tables or +# Assertion `thd->transaction.stmt.is_empty() || +# (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' +# fails in close_tables_for_reopen upon concurrent +# ALTER TABLE and FLUSH +# +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1),(2); +CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t2 VALUES(2); +ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE; +DROP TABLE t2, t1; +create table t1 (pk int primary key, data int) engine=innodb; +insert t1 values (1,1),(2,2),(3,3); +create table t2 (t1_pk int, foreign key (t1_pk) references t1 (pk)) engine=innodb; +insert t2 values (1),(2); +insert t2 values (10); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_pk`) REFERENCES `t1` (`pk`)) +flush tables; +flush status; +update t1 set data=10 where pk+1>10; +show status like '%opened_tab%'; +Variable_name Value +Opened_table_definitions 4 +Opened_tables 4 +flush tables; +flush status; +update t2 set t1_pk=11 where t1_pk+1>10; +show status like '%opened_tab%'; +Variable_name Value +Opened_table_definitions 4 +Opened_tables 4 +flush tables; +flush status; +lock tables t1 write; +show status like '%opened_tab%'; +Variable_name Value +Opened_table_definitions 2 +Opened_tables 2 +insert t1 values (4,4); +show status like '%opened_tab%'; +Variable_name Value +Opened_table_definitions 5 +Opened_tables 5 +unlock tables; +create function foo() returns int +begin +insert t1 values (5,5); +return 5; +end| +flush tables; +flush status; +select foo(); +foo() +5 +show status like '%opened_tab%'; +Variable_name Value +Opened_table_definitions 5 +Opened_tables 5 +drop function foo; +drop table t2, t1; +CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk)) ENGINE=InnoDB; +XA START 'xid'; +INSERT INTO t1 VALUES (1,2); +CREATE TABLE x AS SELECT * FROM t1; +ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state +connect con1,localhost,root,,test; +SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 0; +SET lock_wait_timeout=2; +ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +XA END 'xid'; +XA ROLLBACK 'xid'; +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY, +f1 VARCHAR(10), f2 VARCHAR(10), +f3 VARCHAR(10), f4 VARCHAR(10), +f5 VARCHAR(10), f6 VARCHAR(10), +f7 VARCHAR(10), f8 VARCHAR(10), +INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4), +INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb', +'mariadb', 'mariadb', 'mariadb', 'mariadb'), +(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb', +'mariadb', 'mariadb', 'mariadb', 'mariadb'), +(3, 'innodb', 'innodb', 'innodb', 'innodb', +'innodb', 'innodb', 'innodb', 'innodb'); +ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL; +START TRANSACTION; +DELETE FROM t1 where f1='mariadb'; +SELECT * FROM t1; +pk f1 f2 f3 f4 f5 f6 f7 f8 +2 NULL mariadb mariadb mariadb mariadb mariadb mariadb mariadb +3 innodb innodb innodb innodb innodb innodb innodb innodb +ROLLBACK; +ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE; +START TRANSACTION; +DELETE FROM t1 where f3='mariadb'; +SELECT * FROM t1; +pk f1 f2 f3 f4 f5 f6 f7 f8 +3 innodb innodb innodb innodb innodb innodb innodb innodb +ROLLBACK; +ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL; +UPDATE t1 SET f6='update'; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL) +ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE; +UPDATE t1 SET f6='cascade'; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL) +DROP TABLE t1; +# Start of 10.2 tests +# +# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint +# +CREATE TABLE users ( +id int unsigned AUTO_INCREMENT PRIMARY KEY, +name varchar(32) NOT NULL DEFAULT '' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE matchmaking_groups ( +id bigint unsigned AUTO_INCREMENT PRIMARY KEY, +host_user_id int unsigned NOT NULL UNIQUE, +CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE matchmaking_group_users ( +matchmaking_group_id bigint unsigned NOT NULL, +user_id int unsigned NOT NULL, +PRIMARY KEY (matchmaking_group_id,user_id), +UNIQUE KEY user_id (user_id), +CONSTRAINT FOREIGN KEY (matchmaking_group_id) +REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE, +CONSTRAINT FOREIGN KEY (user_id) +REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE matchmaking_group_maps ( +matchmaking_group_id bigint unsigned NOT NULL, +map_id tinyint unsigned NOT NULL, +PRIMARY KEY (matchmaking_group_id,map_id), +CONSTRAINT FOREIGN KEY (matchmaking_group_id) +REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar'); +INSERT INTO matchmaking_groups VALUES (10,1),(11,2); +INSERT INTO matchmaking_group_users VALUES (10,1),(11,2); +INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66); +BEGIN; +UPDATE users SET name = 'qux' WHERE id = 1; +connect con1,localhost,root; +connection con1; +SET innodb_lock_wait_timeout= 0; +DELETE FROM matchmaking_groups WHERE id = 10; +connection default; +COMMIT; +SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups); +matchmaking_group_id user_id +SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups); +matchmaking_group_id map_id +SELECT * FROM users; +id name +1 qux +2 bar +DROP TABLE +matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users; +# +# MDEV-13331 FK DELETE CASCADE does not honor innodb_lock_wait_timeout +# +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 ( +id INT NOT NULL PRIMARY KEY, +ref_id INT NOT NULL DEFAULT 0, +f INT NULL, +FOREIGN KEY (ref_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1,1,10),(2,2,20); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `ref_id` int(11) NOT NULL DEFAULT 0, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `ref_id` (`ref_id`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`ref_id`) REFERENCES `t1` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection con1; +BEGIN; +UPDATE t2 SET f = 11 WHERE id = 1; +connection default; +SET innodb_lock_wait_timeout= 0; +DELETE FROM t1 WHERE id = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET innodb_lock_wait_timeout= 1; +connection con1; +COMMIT; +connection default; +SELECT * FROM t2; +id ref_id f +1 1 11 +2 2 20 +DELETE FROM t1 WHERE id = 1; +SELECT * FROM t2; +id ref_id f +2 2 20 +DROP TABLE t2, t1; +# +# MDEV-15199 Referential integrity broken in ON DELETE CASCADE +# +CREATE TABLE member (id int AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO member VALUES (1); +CREATE TABLE address ( +id int AUTO_INCREMENT PRIMARY KEY, +member_id int NOT NULL, +KEY address_FI_1 (member_id), +CONSTRAINT address_FK_1 FOREIGN KEY (member_id) REFERENCES member (id) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO address VALUES (2,1); +CREATE TABLE payment_method ( +id int AUTO_INCREMENT PRIMARY KEY, +member_id int NOT NULL, +cardholder_address_id int DEFAULT NULL, +KEY payment_method_FI_1 (member_id), +KEY payment_method_FI_2 (cardholder_address_id), +CONSTRAINT payment_method_FK_1 FOREIGN KEY (member_id) REFERENCES member (id) ON DELETE CASCADE ON UPDATE CASCADE, +CONSTRAINT payment_method_FK_2 FOREIGN KEY (cardholder_address_id) REFERENCES address (id) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO payment_method VALUES (3,1,2); +BEGIN; +UPDATE member SET id=42; +SELECT * FROM member; +id +42 +SELECT * FROM address; +id member_id +2 42 +SELECT * FROM payment_method; +id member_id cardholder_address_id +3 42 2 +DELETE FROM member; +COMMIT; +SELECT * FROM member; +id +SELECT * FROM address; +id member_id +SELECT * FROM payment_method; +id member_id cardholder_address_id +DROP TABLE payment_method,address,member; +# +# Bug #26958695 INNODB NESTED STORED FIELD WITH CONSTRAINT KEY +# PRODUCE BROKEN TABLE (no bug in MariaDB) +# +create table t1(f1 int,f2 int, primary key(f1), key(f2, f1))engine=innodb; +create table t2(f1 int, f2 int as (2) stored, f3 int as (f2) stored, +foreign key(f1) references t1(f2) on update set NULL) +engine=innodb; +insert into t1 values(1, 1); +insert into t2(f1) values(1); +drop table t2, t1; +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE staff ( +staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, +store_id TINYINT UNSIGNED NOT NULL, +PRIMARY KEY (staff_id), +KEY idx_fk_store_id (store_id), +CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; +CREATE TABLE store ( +store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, +manager_staff_id TINYINT UNSIGNED NOT NULL, +PRIMARY KEY (store_id), +UNIQUE KEY idx_unique_manager (manager_staff_id), +CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; +LOCK TABLE staff WRITE; +UNLOCK TABLES; +DROP TABLES staff, store; +SET FOREIGN_KEY_CHECKS=1; +# +# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES t1(a)) +ENGINE=InnoDB; +connection con1; +INSERT INTO t1 SET a=1; +BEGIN; +DELETE FROM t1; +connection default; +INSERT INTO t2 SET a=1; +connection con1; +kill query @id; +connection default; +ERROR 70100: Query execution was interrupted +connection con1; +ROLLBACK; +connection default; +DROP TABLE t2,t1; +# +# MDEV-18272 InnoDB index corruption after failed DELETE CASCADE +# +CREATE TABLE t1 ( +pk TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +a TINYINT UNSIGNED NOT NULL, b TINYINT UNSIGNED NOT NULL, KEY(b), +CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE CASCADE +) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES +(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0), +(0,1),(0,1),(1,0); +connection con1; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE IGNORE FROM t1 WHERE b = 1; +Warnings: +Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15. Please drop extra constraints and try again +Warning 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB +Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15. Please drop extra constraints and try again +Warning 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB +SELECT a FROM t1 FORCE INDEX(a); +a +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1 +SELECT * FROM t1; +pk a b +1 0 0 +2 0 0 +3 0 0 +4 0 0 +5 0 0 +6 0 0 +7 0 0 +8 0 0 +9 0 0 +10 0 0 +11 0 0 +12 0 0 +13 0 1 +14 0 1 +15 1 0 +disconnect con1; +InnoDB 0 transactions not purged +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +# +# MDEV-17187 table doesn't exist in engine after ALTER other tables +# with CONSTRAINTs +# +call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition."); +set foreign_key_checks=on; +create table t1 (id int not null primary key) engine=innodb; +create table t2 (id int not null primary key, fid int not null, +CONSTRAINT fk_fid FOREIGN KEY (fid) REFERENCES t1 (id))engine=innodb; +insert into t1 values (1), (2), (3); +insert into t2 values (1, 1), (2, 1), (3, 2); +set foreign_key_checks=off; +alter table t2 drop index fk_fid; +set foreign_key_checks=on; +delete from t1 where id=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`)) +insert into t2 values(4, 99); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`)) +select * from t1; +id +1 +2 +3 +select * from t2; +id fid +1 1 +2 1 +3 2 +set foreign_key_checks=off; +delete from t1 where id=2; +insert into t2 values(4, 99); +set foreign_key_checks=on; +select * from t1; +id +1 +3 +select * from t2; +id fid +1 1 +2 1 +3 2 +4 99 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `fid` int(11) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1,t2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +drop table t1,t2; +ERROR 42S02: Unknown table 'test.t2' +# +# MDEV-22934 Table disappear after two alter table command +# +CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT, +f2 INT NOT NULL, +PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, +f2 INT NOT NULL, f3 INT NOT NULL, +PRIMARY KEY(f1, f2), UNIQUE KEY(f2), +CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE, +CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE +) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE; +ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + `f3` int(11) NOT NULL, + PRIMARY KEY (`f3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB; +ERROR 42S01: Table 't2' already exists +DROP TABLE t2, t1; +# +# MDEV-23685 SIGSEGV on ADD FOREIGN KEY after failed attempt +# to create unique key on virtual column +# +CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b INT AS (a)) ENGINE=InnODB; +INSERT INTO t1 (pk,a) VALUES (1,10),(2,10); +ALTER TABLE t1 ADD UNIQUE INDEX ind9 (b), LOCK=SHARED; +ERROR 23000: Duplicate entry '10' for key 'ind9' +SET FOREIGN_KEY_CHECKS= 0; +ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (pk); +DROP TABLE t1; +SET FOREIGN_KEY_CHECKS= 1; +# +# MDEV-23455 Hangs + Sig11 in unknown location(s) due to single complex FK query +# +Parsing foreign keys 1... +ERROR HY000: Can't create table `test`.`t0` (errno: 150 "Foreign key constraint is incorrectly formed") +Parsing foreign keys 2... +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +Parsing foreign keys 3... +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +Parsing foreign keys 4... +# +# MDEV-27583 InnoDB uses different constants for FK cascade +# error message in SQL vs error log +# +CREATE TABLE t1 +(a INT, b INT, KEY(b), +CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE CASCADE) +ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES +(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0), +(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,1),(1,0); +DELETE FROM t1 WHERE b = 1; +ERROR HY000: Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB +SHOW WARNINGS; +Level Code Message +Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15. Please drop extra constraints and try again +Error 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB +DROP TABLE t1; +FOUND 1 /InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15.*/ in mysqld.1.err +# End of 10.2 tests +# +# MDEV-28980 InnoDB: Failing assertion: len <= MAX_TABLE_NAME_LEN +# +SET NAMES utf8; +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE DATABASE `db`; +CREATE TABLE `db`.u ( +a INT PRIMARY KEY, +CONSTRAINT `††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††` + FOREIGN KEY (a) REFERENCES test.t (a)) ENGINE=InnoDB; +DROP TABLE `db`.u; +DROP DATABASE `db`; +DROP TABLE t; +# End of 10.3 tests +CREATE TABLE t1 (a GEOMETRY, INDEX(a(8)), +FOREIGN KEY (a) REFERENCES x (xx)) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +# +# MDEV-23675 Assertion `pos < table->n_def' in dict_table_get_nth_col +# +CREATE TABLE t1 (pk int PRIMARY KEY, a INT, b INT, c INT, KEY(c), +FOREIGN KEY fx (b) REFERENCES t1 (c)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,0,10,10); +ALTER TABLE t1 DROP a, ALGORITHM=INSTANT; +SET FOREIGN_KEY_CHECKS= 0; +DROP INDEX fx ON t1; +INSERT INTO t1 VALUES (2,11,11); +DROP TABLE t1; +SET FOREIGN_KEY_CHECKS=DEFAULT; +# +# MDEV-32018 Allow the setting of Auto_increment on FK referenced columns +# +CREATE TABLE t1 ( +id int unsigned NOT NULL PRIMARY KEY +); +CREATE TABLE t2 ( +id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, +t1_id int unsigned DEFAULT NULL, +CONSTRAINT FK_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) +); +ALTER TABLE t1 MODIFY id INT unsigned AUTO_INCREMENT; +DROP TABLE t1,t2; +# +# End of 10.4 tests +# +# +# MDEV-20729 Fix REFERENCES constraint in column definition +# +set default_storage_engine= innodb; +create table t1 (x int primary key, y int unique); +create table t2 (x int references t1(x), y int constraint fk references t1(y)); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `x` int(11) DEFAULT NULL, + `y` int(11) DEFAULT NULL, + KEY `x` (`x`), + KEY `fk` (`y`), + CONSTRAINT `fk` FOREIGN KEY (`y`) REFERENCES `t1` (`y`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`x`) REFERENCES `t1` (`x`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +create table t3 (z int); +alter table t3 add x int references t1(x), add y int constraint fk2 references t1(y); +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `z` int(11) DEFAULT NULL, + `x` int(11) DEFAULT NULL, + `y` int(11) DEFAULT NULL, + KEY `x` (`x`), + KEY `fk2` (`y`), + CONSTRAINT `fk2` FOREIGN KEY (`y`) REFERENCES `t1` (`y`), + CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`x`) REFERENCES `t1` (`x`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop tables t3, t2, t1; +create table t1 (id int primary key); +create table t2 (id2 int references t1); +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +create table t2 (id int references t1); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) DEFAULT NULL, + KEY `id` (`id`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop tables t2, t1; +set default_storage_engine= default; +# +# MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func +# +SET FOREIGN_KEY_CHECKS=1; +CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b); +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +SET FOREIGN_KEY_CHECKS=DEFAULT; +DROP TABLE t1; +# +# MDEV-22602 Disable UPDATE CASCADE for SQL constraints +# +# TODO: enable them after MDEV-16417 is finished +create or replace table t1 (a int primary key) engine=innodb; +create or replace table t2 (a int, constraint foo check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; +ERROR HY000: Function or expression 'a' cannot be used in the CHECK clause of `foo` +create or replace table t2 (a int, check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; +ERROR HY000: Function or expression 'a' cannot be used in the CHECK clause of `CONSTRAINT_1` +create or replace table t1 (f1 int, f2 date, f3 date, key(f1,f3,f2)) engine=innodb; +create or replace table t2 ( +a int, s date, e date, +period for p (s, e), +primary key (a, p without overlaps), +foreign key (a, e, s) references t1 (f1, f3, f2) on delete cascade on update cascade) engine=innodb; +ERROR HY000: Key `PRIMARY` cannot have WITHOUT OVERLAPS +create or replace table t1 (a varchar(4096) unique) engine=innodb; +create or replace table t2 (pk int primary key, a varchar(4096) unique, foreign key(a) references t1(a) on update cascade) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +drop table t1; +# +# MDEV-26824 Can't add foreign key with empty referenced columns list +# +create table t2(a int primary key) engine=innodb; +create table t1(a int primary key, b int) engine=innodb; +alter table t2 add foreign key(a) references t1(a, b); +ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match +create or replace table t1(a tinyint primary key) engine innodb; +alter table t2 add foreign key(a) references t1; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +create or replace table t1(b int primary key) engine innodb; +alter table t2 add foreign key(a) references t1; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +create or replace table t1(a int primary key, b int) engine innodb; +alter table t2 add foreign key(a) references t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop tables t2, t1; +# End of 10.5 tests +# +# MDEV-26554 Table-rebuilding DDL on parent table causes crash +# for INSERT into child table +# +CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE child(a INT PRIMARY KEY REFERENCES parent(a)) ENGINE=InnoDB; +connect con1, localhost, root,,; +BEGIN; +INSERT INTO child SET a=1; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`)) +connection default; +SET innodb_lock_wait_timeout=0, foreign_key_checks=0; +TRUNCATE TABLE parent; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ALTER TABLE parent FORCE, ALGORITHM=COPY; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ALTER TABLE parent FORCE, ALGORITHM=INPLACE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ALTER TABLE parent ADD COLUMN b INT, ALGORITHM=INSTANT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +COMMIT; +connection default; +SET innodb_lock_wait_timeout=DEFAULT; +TRUNCATE TABLE parent; +ALTER TABLE parent FORCE, ALGORITHM=COPY; +ALTER TABLE parent FORCE, ALGORITHM=INPLACE; +ALTER TABLE parent ADD COLUMN b INT, ALGORITHM=INSTANT; +DROP TABLE child, parent; +# +# MDEV-26217 Failing assertion: list.count > 0 in ut_list_remove +# or Assertion `lock->trx == this' failed in dberr_t trx_t::drop_table +# +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (pk INT PRIMARY KEY, FOREIGN KEY(pk) REFERENCES t1(pk)) +ENGINE=InnoDB; +connection con1; +SET FOREIGN_KEY_CHECKS=OFF; +CREATE OR REPLACE TABLE t1 (b INT) ENGINE=InnoDB; +connection default; +INSERT INTO t2 VALUES (1); +connection con1; +connection default; +DROP TABLE IF EXISTS t2, t1; +# +# MDEV-30531 Corrupt index(es) on busy table when using FOREIGN KEY +# +CREATE TABLE collections ( +id int(11) unsigned NOT NULL AUTO_INCREMENT, +collectionhash varchar(255) NOT NULL DEFAULT '0', +PRIMARY KEY (id), +UNIQUE KEY ix_collection_collectionhash (collectionhash) +) ENGINE=InnoDB; +CREATE TABLE binaries ( +id bigint(20) unsigned NOT NULL AUTO_INCREMENT, +collections_id int(11) unsigned NOT NULL DEFAULT 0, +binaryhash binary(16) NOT NULL DEFAULT '0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +PRIMARY KEY (id), +UNIQUE KEY ix_binary_binaryhash (binaryhash), +CONSTRAINT FK_collections FOREIGN KEY (collections_id) REFERENCES collections (id) ON DELETE CASCADE +) ENGINE=InnoDB; +INSERT INTO collections (id) VALUES (NULL); +connection con1; +INSERT INTO binaries (id,collections_id) VALUES (NULL,1); +REPLACE INTO collections (id) VALUES (NULL); +connection default; +REPLACE INTO binaries (id) VALUES (NULL); +SET GLOBAL innodb_max_purge_lag_wait=0; +CHECK TABLE binaries, collections EXTENDED; +Table Op Msg_type Msg_text +test.binaries check status OK +test.collections check status OK +disconnect con1; +DROP TABLE binaries, collections; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/foreign_key_debug.result b/mysql-test/suite/innodb/r/foreign_key_debug.result new file mode 100644 index 00000000..a2b06736 --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_key_debug.result @@ -0,0 +1,60 @@ +create table t1 (f1 int primary key) engine=innodb; +create table t2 (f2 int primary key) engine=innodb; +create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb; +insert into t1 values (1),(2),(3),(4),(5); +insert into t2 values (1),(2),(3),(4),(5); +insert into t3 values (1),(2),(3),(4),(5); +connect con1,localhost,root; +set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2'; +alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade; +connection default; +set debug_sync='before_execute_sql_command wait_for g1'; +update t1 set f1 = f1 + 100000 limit 2; +connect con2,localhost,root; +kill query UPDATE; +disconnect con2; +connection default; +ERROR 70100: Query execution was interrupted +set debug_sync='now signal g2'; +connection con1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f2` int(11) NOT NULL, + PRIMARY KEY (`f2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +disconnect con1; +connection default; +select * from t2 where f2 not in (select f1 from t1); +f2 +select * from t3 where f3 not in (select f2 from t2); +f3 +drop table t3; +drop table t2; +drop table t1; +set debug_sync='reset'; +# +# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name) +# +CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +FLUSH TABLES; +SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go'; +ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE; +connect con1, localhost, root; +SET debug_sync='now WAIT_FOR ready'; +SET lock_wait_timeout=0; +UPDATE t2 SET pk=10 WHERE pk=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1'; +DEALLOCATE PREPARE stmt; +SET debug_sync='now SIGNAL go'; +connection default; +disconnect con1; +connection default; +SET debug_sync='reset'; +SHOW OPEN TABLES FROM test; +Database Table In_use Name_locked +test t2 0 0 +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/r/foreign_key_not_windows.result b/mysql-test/suite/innodb/r/foreign_key_not_windows.result new file mode 100644 index 00000000..aaff06f8 --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_key_not_windows.result @@ -0,0 +1,31 @@ +# +# MDEV-28980 InnoDB: Failing assertion: len <= MAX_TABLE_NAME_LEN +# +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE DATABASE `d255`; +CREATE TABLE `d255`.`d255` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@ +CREATE TABLE `d255`.`_##################################################` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/_@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023 +CREATE TABLE `d255`.`##################################################` +(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +# +# MDEV-29258 Failing assertion for name length on RENAME TABLE +# +CREATE TABLE `d255`.`d245` (x INT) ENGINE=InnoDB; +DROP TABLE `d255`.`d250`; +RENAME TABLE `d250#`.`d245` TO `d250#`.`d250`; +RENAME TABLE `d255`.`d250` TO a; +DROP TABLE a,t; +# +# MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE +# +CREATE TABLE `d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB; +CREATE TABLE `d255`.u(a INT PRIMARY KEY, +CONSTRAINT `d320` FOREIGN KEY (a) REFERENCES `d255`.t (a)) ENGINE=InnoDB; +RENAME TABLE `d255`.u TO u; +DROP TABLE u; +DROP DATABASE `d255`; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result new file mode 100644 index 00000000..32964be4 --- /dev/null +++ b/mysql-test/suite/innodb/r/full_crc32_import.result @@ -0,0 +1,202 @@ +FLUSH TABLES; +# Treating compact format as dynamic format after import stmt +CREATE TABLE t1 +(a int AUTO_INCREMENT PRIMARY KEY, +b blob, +c blob, +KEY (b(200))) ENGINE=InnoDB ROW_FORMAT=COMPACT; +BEGIN; +INSERT INTO t1 (b, c) values (repeat("ab", 200), repeat("bc", 200)); +INSERT INTO t1 (b, c) values (repeat("bc", 200), repeat("cd", 200)); +INSERT INTO t1 (b, c) values (repeat("cd", 200), repeat("ef", 200)); +INSERT INTO t1 (b, c) values (repeat("de", 200), repeat("fg", 200)); +INSERT INTO t1 (b, c) values (repeat("ef", 200), repeat("gh", 200)); +INSERT INTO t1 (b, c) values (repeat("fg", 200), repeat("hi", 200)); +INSERT INTO t1 (b, c) values (repeat("gh", 200), repeat("ij", 200)); +INSERT INTO t1 (b, c) values (repeat("hi", 200), repeat("jk", 200)); +INSERT INTO t1 (b, c) values (repeat("ij", 200), repeat("kl", 200)); +INSERT INTO t1 (b, c) values (repeat("jk", 200), repeat("lm", 200)); +INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; +INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; +COMMIT; +SELECT COUNT(*) FROM t1; +COUNT(*) +40 +FLUSH TABLE t1 FOR EXPORT; +# List before copying files +db.opt +t1.cfg +t1.frm +t1.ibd +backup: t1 +UNLOCK TABLES; +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DISCARD TABLESPACE; +db.opt +t1.frm +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Drop all secondary indexes before importing table test/t1 when .cfg file is missing. +ALTER TABLE t1 DROP INDEX b; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +ALTER TABLE t1 IMPORT TABLESPACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +UPDATE t1 set b = repeat("de", 100) where b = repeat("cd", 200); +explain SELECT a FROM t1 where b = repeat("de", 100); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where +SELECT a FROM t1 where b = repeat("de", 100); +a +3 +13 +28 +38 +SELECT COUNT(*) FROM t1; +COUNT(*) +40 +DELETE FROM t1; +InnoDB 0 transactions not purged +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 +(c1 int AUTO_INCREMENT PRIMARY KEY, +c2 POINT NOT NULL, +c3 LINESTRING NOT NULL, +SPATIAL INDEX idx1(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1(c2,c3) VALUES( +ST_GeomFromText('POINT(10 10)'), +ST_GeomFromText('LINESTRING(5 5,20 20,30 30)')); +INSERT INTO t1(c2,c3) VALUES( +ST_GeomFromText('POINT(20 20)'), +ST_GeomFromText('LINESTRING(5 15,20 10,30 20)')); +INSERT INTO t1(c2,c3) VALUES( +ST_GeomFromText('POINT(30 30)'), +ST_GeomFromText('LINESTRING(10 5,20 24,30 32)')); +INSERT INTO t1(c2,c3) VALUES( +ST_GeomFromText('POINT(40 40)'), +ST_GeomFromText('LINESTRING(15 5,25 20,35 30)')); +INSERT INTO t1(c2,c3) VALUES( +ST_GeomFromText('POINT(50 10)'), +ST_GeomFromText('LINESTRING(15 15,24 10,31 20)')); +INSERT INTO t1(c2,c3) VALUES( +ST_GeomFromText('POINT(60 50)'), +ST_GeomFromText('LINESTRING(10 15,20 44,35 32)')); +BEGIN; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +INSERT INTO t1(c2, c3) SELECT c2, c3 FROM t1; +COMMIT; +FLUSH TABLE t1 FOR EXPORT; +# List before copying files +db.opt +t1.cfg +t1.frm +t1.ibd +backup: t1 +UNLOCK TABLES; +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Drop all secondary indexes before importing table test/t1 when .cfg file is missing. +ALTER TABLE t1 DROP INDEX idx1; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +ALTER TABLE t1 IMPORT TABLESPACE; +Warnings: +Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` point NOT NULL, + `c3` linestring NOT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=16372 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +UPDATE t1 SET C2 = ST_GeomFromText('POINT(0 0)'); +SELECT COUNT(*) FROM t1; +COUNT(*) +12288 +DELETE FROM t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +InnoDB 0 transactions not purged +DROP TABLE t1; +SET @save_algo = @@GLOBAL.innodb_compression_algorithm; +SET GLOBAL innodb_compression_algorithm=2; +CREATE TABLE t1(a SERIAL) PAGE_COMPRESSED=1 ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +FLUSH TABLE t1 FOR EXPORT; +# List before copying files +db.opt +t1.cfg +t1.frm +t1.ibd +backup: t1 +UNLOCK TABLES; +SET GLOBAL innodb_compression_algorithm=0; +ALTER TABLE t1 FORCE; +ALTER TABLE t1 DISCARD TABLESPACE; +db.opt +t1.frm +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +INSERT INTO t1 VALUES(2); +SELECT * FROM t1; +a +1 +2 +SET GLOBAL innodb_compression_algorithm=3; +FLUSH TABLE t1 FOR EXPORT; +# List before copying files +db.opt +t1.cfg +t1.frm +t1.ibd +backup: t1 +UNLOCK TABLES; +SET GLOBAL innodb_compression_algorithm=0; +ALTER TABLE t1 FORCE; +ALTER TABLE t1 DISCARD TABLESPACE; +# Display the discarded table name by using SPACE and PAGE_NO +# column in INNODB_SYS_INDEXES and discard doesn't affect the +# SPACE in INNODB_SYS_TABLES +SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t +WHERE t.TABLE_ID IN ( +SELECT i.TABLE_ID FROM +INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE +i.PAGE_NO IS NULL and i.SPACE IS NULL); +NAME SYS_TABLE_SPACE_RANGE +test/t1 1 +db.opt +t1.frm +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +INSERT INTO t1 VALUES(3); +SELECT * FROM t1; +a +1 +2 +3 +DROP TABLE t1; +SET GLOBAL innodb_compression_algorithm=@save_algo; diff --git a/mysql-test/suite/innodb/r/gap_lock_split.result b/mysql-test/suite/innodb/r/gap_lock_split.result new file mode 100644 index 00000000..e607eda3 --- /dev/null +++ b/mysql-test/suite/innodb/r/gap_lock_split.result @@ -0,0 +1,29 @@ +CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) +ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023; +connect con1,localhost,root,,; +InnoDB 0 transactions not purged +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1 WHERE id=1788; +SET @saved_dbug = @@GLOBAL.debug_dbug; +SET @@GLOBAL.debug_dbug="d,enable_row_purge_del_mark_exit_sync_point"; +BEGIN; +SELECT * FROM t1 WHERE id=1788 FOR UPDATE; +id val +connection con1; +COMMIT; +SET DEBUG_SYNC = 'now WAIT_FOR row_purge_del_mark_finished'; +SET @@GLOBAL.debug_dbug = @saved_dbug; +connection default; +INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000)); +connection con1; +SET innodb_lock_wait_timeout=0; +INSERT INTO t1 (id,val) VALUES (1788, 'x'); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE id=1788 FOR UPDATE; +id val +disconnect con1; +connection default; +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/gap_locks.result b/mysql-test/suite/innodb/r/gap_locks.result new file mode 100644 index 00000000..cd60b1fa --- /dev/null +++ b/mysql-test/suite/innodb/r/gap_locks.result @@ -0,0 +1,35 @@ +CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(40), c INT, INDEX(b,c)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'1',1),(2,'2',1); +SET @save_locks= @@GLOBAL.innodb_status_output_locks; +SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = 'ON'; +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; +BEGIN; +DELETE FROM t1 WHERE b='2' AND c=2; +SHOW ENGINE INNODB STATUS; +Type Name Status +InnoDB 2 lock struct(s), 1 row lock(s) +ROLLBACK; +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +DELETE FROM t1 WHERE b='2' AND c=2; +SHOW ENGINE INNODB STATUS; +Type Name Status +InnoDB 2 lock struct(s), 1 row lock(s) +ROLLBACK; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +DELETE FROM t1 WHERE b='2' AND c=2; +SHOW ENGINE INNODB STATUS; +Type Name Status +InnoDB 1 lock struct(s), 0 row lock(s) +ROLLBACK; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +BEGIN; +DELETE FROM t1 WHERE b='2' AND c=2; +SHOW ENGINE INNODB STATUS; +Type Name Status +InnoDB 1 lock struct(s), 0 row lock(s) +ROLLBACK; +SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = @save_locks; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/group_commit.result b/mysql-test/suite/innodb/r/group_commit.result new file mode 100644 index 00000000..5fd7f9c9 --- /dev/null +++ b/mysql-test/suite/innodb/r/group_commit.result @@ -0,0 +1,93 @@ +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES(100); +SELECT variable_value INTO @commits FROM information_schema.global_status +WHERE variable_name = 'binlog_commits'; +SELECT variable_value INTO @group_commits FROM information_schema.global_status +WHERE variable_name = 'binlog_group_commits'; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connect con4,localhost,root,,; +connect con5,localhost,root,,; +connect con6,localhost,root,,; +connection con1; +SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group1_running WAIT_FOR group2_queued"; +INSERT INTO t1 VALUES ("con1"); +connection con2; +set DEBUG_SYNC= "now WAIT_FOR group1_running"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL group2_con2"; +SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group2_running"; +SET DEBUG_SYNC= "commit_after_release_LOCK_log WAIT_FOR group3_committed"; +SET DEBUG_SYNC= "commit_after_group_run_commit_ordered SIGNAL group2_visible WAIT_FOR group2_checked"; +INSERT INTO t1 VALUES ("con2"); +connection con3; +SET DEBUG_SYNC= "now WAIT_FOR group2_con2"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL group2_con3"; +INSERT INTO t1 VALUES ("con3"); +connection con4; +SET DEBUG_SYNC= "now WAIT_FOR group2_con3"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL group2_con4"; +INSERT INTO t1 VALUES ("con4"); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR group2_con4"; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT * FROM t1 ORDER BY a; +a +100 +SET DEBUG_SYNC= "now SIGNAL group2_queued"; +connection con1; +connection default; +SELECT * FROM t1 ORDER BY a; +a +100 +con1 +connection con5; +SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group3_con5"; +SET DEBUG_SYNC= "commit_after_get_LOCK_log SIGNAL con5_leader WAIT_FOR con6_queued"; +set DEBUG_SYNC= "now WAIT_FOR group2_running"; +INSERT INTO t1 VALUES ("con5"); +connection con6; +SET DEBUG_SYNC= "now WAIT_FOR con5_leader"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL con6_queued"; +INSERT INTO t1 VALUES ("con6"); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR group3_con5"; +SELECT * FROM t1 ORDER BY a; +a +100 +con1 +SET DEBUG_SYNC= "now SIGNAL group3_committed"; +SET DEBUG_SYNC= "now WAIT_FOR group2_visible"; +SELECT * FROM t1 ORDER BY a; +a +100 +con1 +con2 +con3 +con4 +SET DEBUG_SYNC= "now SIGNAL group2_checked"; +connection con2; +connection con3; +connection con4; +connection con5; +connection con6; +connection default; +SELECT * FROM t1 ORDER BY a; +a +100 +con1 +con2 +con3 +con4 +con5 +con6 +SELECT variable_value - @commits FROM information_schema.global_status +WHERE variable_name = 'binlog_commits'; +variable_value - @commits +6 +SELECT variable_value - @group_commits FROM information_schema.global_status +WHERE variable_name = 'binlog_group_commits'; +variable_value - @group_commits +3 +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result new file mode 100644 index 00000000..4de7cc8e --- /dev/null +++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result @@ -0,0 +1,48 @@ +SET GLOBAL innodb_flush_log_at_trx_commit=3; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES (0); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connection con1; +SET DEBUG_SYNC= "commit_after_get_LOCK_log SIGNAL con1_waiting WAIT_FOR con3_queued"; +SET DEBUG_SYNC= "commit_loop_entry_commit_ordered SIGNAL con1_loop WAIT_FOR con1_loop_cont EXECUTE 3"; +INSERT INTO t1 VALUES (1); +connection con2; +SET DEBUG_SYNC= "now WAIT_FOR con1_waiting"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL con2_queued"; +INSERT INTO t1 VALUES (2); +connection con3; +SET DEBUG_SYNC= "now WAIT_FOR con2_queued"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL con3_queued"; +INSERT INTO t1 VALUES (3); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con1_loop"; +SET DEBUG_SYNC= "now SIGNAL con1_loop_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_loop"; +SET DEBUG_SYNC= "now SIGNAL con1_loop_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_loop"; +SELECT * FROM t1 ORDER BY a; +a +0 +1 +2 +connection con2; +connection default; +SET SESSION debug_dbug="+d,crash_dispatch_command_before"; +SELECT 1; +Got one of the listed errors +connection con1; +Got one of the listed errors +connection con3; +Got one of the listed errors +connection default; +SELECT * FROM t1 ORDER BY a; +a +0 +1 +2 +3 +InnoDB: Last binlog file './master-bin.000001', position +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result new file mode 100644 index 00000000..faf57de1 --- /dev/null +++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result @@ -0,0 +1,49 @@ +SET GLOBAL innodb_flush_log_at_trx_commit=3; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES (0); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connection con1; +SET DEBUG_SYNC= "commit_after_get_LOCK_log SIGNAL con1_waiting WAIT_FOR con3_queued"; +SET DEBUG_SYNC= "commit_loop_entry_commit_ordered SIGNAL con1_loop WAIT_FOR con1_loop_cont"; +INSERT INTO t1 VALUES (1); +connection con2; +SET DEBUG_SYNC= "now WAIT_FOR con1_waiting"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL con2_queued"; +SET DEBUG_SYNC= "commit_loop_entry_commit_ordered SIGNAL con1_loop WAIT_FOR con1_loop_cont"; +INSERT INTO t1 VALUES (2); +connection con3; +SET DEBUG_SYNC= "now WAIT_FOR con2_queued"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL con3_queued"; +SET DEBUG_SYNC= "commit_loop_entry_commit_ordered SIGNAL con1_loop WAIT_FOR con1_loop_cont"; +INSERT INTO t1 VALUES (3); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con1_loop"; +SET DEBUG_SYNC= "now SIGNAL con1_loop_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_loop"; +SET DEBUG_SYNC= "now SIGNAL con1_loop_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_loop"; +SELECT * FROM t1 ORDER BY a; +a +0 +1 +2 +connection con1; +connection con2; +connection default; +SET SESSION debug_dbug="+d,crash_dispatch_command_before"; +SELECT 1; +Got one of the listed errors +connection con3; +Got one of the listed errors +connection default; +SELECT * FROM t1 ORDER BY a; +a +0 +1 +2 +3 +InnoDB: Last binlog file './master-bin.000001', position +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/group_commit_crash.result b/mysql-test/suite/innodb/r/group_commit_crash.result new file mode 100644 index 00000000..005049df --- /dev/null +++ b/mysql-test/suite/innodb/r/group_commit_crash.result @@ -0,0 +1,125 @@ +CREATE TABLE t1(a CHAR(255), +b CHAR(255), +c CHAR(255), +d CHAR(255), +id INT, +PRIMARY KEY(id)) ENGINE=InnoDB; +create table t2 like t1; +create procedure setcrash(IN i INT) +begin +CASE i +WHEN 1 THEN SET SESSION debug_dbug="d,crash_commit_after_prepare"; +WHEN 2 THEN SET SESSION debug_dbug="d,crash_commit_after_log"; +WHEN 3 THEN SET SESSION debug_dbug="d,crash_commit_before_unlog"; +WHEN 4 THEN SET SESSION debug_dbug="d,crash_commit_after"; +WHEN 5 THEN SET SESSION debug_dbug="d,crash_commit_before"; +ELSE BEGIN END; +END CASE; +end // +FLUSH TABLES; +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 9+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 8+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 7+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 6+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 5+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 4+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 3+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 2+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 0+1); +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(5); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(4); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +a b c d 1 +a b c d 2 +a b c d 3 +a b c d 4 +a b c d 5 +a b c d 6 +a b c d 7 +a b c d 8 +a b c d 9 +a b c d 10 +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2 +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(3); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +a b c d 1 +a b c d 2 +a b c d 3 +a b c d 4 +a b c d 5 +a b c d 6 +a b c d 7 +a b c d 8 +a b c d 9 +a b c d 10 +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2 +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(2); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +a b c d 1 +a b c d 2 +a b c d 3 +a b c d 4 +a b c d 5 +a b c d 6 +a b c d 7 +a b c d 8 +a b c d 9 +a b c d 10 +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2 +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(1); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +delete from t1; +DROP TABLE t1; +DROP TABLE t2; +DROP PROCEDURE setcrash; diff --git a/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result new file mode 100644 index 00000000..846500ad --- /dev/null +++ b/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result @@ -0,0 +1,125 @@ +CREATE TABLE t1(a CHAR(255), +b CHAR(255), +c CHAR(255), +d CHAR(255), +id INT, +PRIMARY KEY(id)) ENGINE=InnoDB; +create table t2 like t1; +create procedure setcrash(IN i INT) +begin +CASE i +WHEN 1 THEN SET SESSION debug_dbug="d,crash_commit_after_prepare"; +WHEN 2 THEN SET SESSION debug_dbug="d,crash_commit_after_log"; +WHEN 3 THEN SET SESSION debug_dbug="d,crash_commit_before_unlog"; +WHEN 4 THEN SET SESSION debug_dbug="d,crash_commit_after"; +WHEN 5 THEN SET SESSION debug_dbug="d,crash_commit_before"; +ELSE BEGIN END; +END CASE; +end // +FLUSH TABLES; +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+9); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+8); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+7); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+6); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+5); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+4); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+3); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+2); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+1); +INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+0); +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(5); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(4); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +a b c d 1 +a b c d 2 +a b c d 3 +a b c d 4 +a b c d 5 +a b c d 6 +a b c d 7 +a b c d 8 +a b c d 9 +a b c d 10 +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2 +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(3); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +a b c d 1 +a b c d 2 +a b c d 3 +a b c d 4 +a b c d 5 +a b c d 6 +a b c d 7 +a b c d 8 +a b c d 9 +a b c d 10 +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2 +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(2); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +a b c d 1 +a b c d 2 +a b c d 3 +a b c d 4 +a b c d 5 +a b c d 6 +a b c d 7 +a b c d 8 +a b c d 9 +a b c d 10 +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2 +delete from t1; +SET binlog_format= mixed; +RESET MASTER; +START TRANSACTION; +insert into t1 select * from t2; +call setcrash(1); +COMMIT; +Got one of the listed errors +SELECT * FROM t1 ORDER BY id; +a b c d id +SHOW BINLOG EVENTS LIMIT 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +delete from t1; +DROP TABLE t1; +DROP TABLE t2; +DROP PROCEDURE setcrash; diff --git a/mysql-test/suite/innodb/r/group_commit_force_recovery.result b/mysql-test/suite/innodb/r/group_commit_force_recovery.result new file mode 100644 index 00000000..f177d96c --- /dev/null +++ b/mysql-test/suite/innodb/r/group_commit_force_recovery.result @@ -0,0 +1,5 @@ +CREATE TABLE t1(a int) ENGINE=InnoDB; +INSERT INTO t1 SET a=1; +RESET MASTER; +DROP TABLE t1; +End of the tests. diff --git a/mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result new file mode 100644 index 00000000..e22589ed --- /dev/null +++ b/mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result @@ -0,0 +1,93 @@ +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES("default"); +SELECT variable_value INTO @commits FROM information_schema.global_status +WHERE variable_name = 'binlog_commits'; +SELECT variable_value INTO @group_commits FROM information_schema.global_status +WHERE variable_name = 'binlog_group_commits'; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connect con4,localhost,root,,; +connect con5,localhost,root,,; +connect con6,localhost,root,,; +connection con1; +SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group1_running WAIT_FOR group2_queued"; +INSERT INTO t1 VALUES ("con1"); +connection con2; +set DEBUG_SYNC= "now WAIT_FOR group1_running"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL group2_con2"; +SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group2_running"; +SET DEBUG_SYNC= "commit_after_release_LOCK_log WAIT_FOR group3_committed"; +INSERT INTO t1 VALUES ("con2"); +connection con3; +SET DEBUG_SYNC= "now WAIT_FOR group2_con2"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL group2_con3"; +INSERT INTO t1 VALUES ("con3"); +connection con4; +SET DEBUG_SYNC= "now WAIT_FOR group2_con3"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL group2_con4"; +SET DEBUG_SYNC= "commit_after_group_run_commit_ordered SIGNAL group2_visible WAIT_FOR group2_checked"; +INSERT INTO t1 VALUES ("con4"); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR group2_con4"; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT * FROM t1 ORDER BY a; +a +default +SET DEBUG_SYNC= "now SIGNAL group2_queued"; +connection con1; +connection default; +SELECT * FROM t1 ORDER BY a; +a +con1 +default +connection con5; +SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group3_con5"; +SET DEBUG_SYNC= "commit_after_get_LOCK_log SIGNAL con5_leader WAIT_FOR con6_queued"; +set DEBUG_SYNC= "now WAIT_FOR group2_running"; +INSERT INTO t1 VALUES ("con5"); +connection con6; +SET DEBUG_SYNC= "now WAIT_FOR con5_leader"; +SET DEBUG_SYNC= "commit_after_prepare_ordered SIGNAL con6_queued"; +INSERT INTO t1 VALUES ("con6"); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR group3_con5"; +SELECT * FROM t1 ORDER BY a; +a +con1 +default +SET DEBUG_SYNC= "now SIGNAL group3_committed"; +SET DEBUG_SYNC= "now WAIT_FOR group2_visible"; +SELECT * FROM t1 ORDER BY a; +a +con1 +con2 +con3 +con4 +default +SET DEBUG_SYNC= "now SIGNAL group2_checked"; +connection con2; +connection con3; +connection con4; +connection con5; +connection con6; +connection default; +SELECT * FROM t1 ORDER BY a; +a +con1 +con2 +con3 +con4 +con5 +con6 +default +SELECT variable_value - @commits FROM information_schema.global_status +WHERE variable_name = 'binlog_commits'; +variable_value - @commits +6 +SELECT variable_value - @group_commits FROM information_schema.global_status +WHERE variable_name = 'binlog_group_commits'; +variable_value - @group_commits +3 +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/help_url.result b/mysql-test/suite/innodb/r/help_url.result new file mode 100644 index 00000000..87530bc2 --- /dev/null +++ b/mysql-test/suite/innodb/r/help_url.result @@ -0,0 +1,2 @@ +create table innodb_table_monitor (a int) engine=InnoDB; +drop table innodb_table_monitor; diff --git a/mysql-test/suite/innodb/r/ibuf_delete.result b/mysql-test/suite/innodb/r/ibuf_delete.result new file mode 100644 index 00000000..7423d3cf --- /dev/null +++ b/mysql-test/suite/innodb/r/ibuf_delete.result @@ -0,0 +1,53 @@ +SET @buffering= @@innodb_change_buffering; +SET GLOBAL innodb_change_buffering= deletes; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release +SET @flush= @@innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit= 0; +CREATE TABLE t1 ( +a varchar(1024), +b varchar(1024), +c varchar(1024), +d varchar(1024), +e varchar(1024), +f varchar(1024), +g varchar(1024), +h varchar(1024), +key (a), +key (b), +key (c), +key (d) +) ENGINE=InnoDB; +INSERT INTO t1 +SELECT REPEAT('x',10), REPEAT('x',13), REPEAT('x',427), REPEAT('x',244), +REPEAT('x',9), REPEAT('x',112), REPEAT('x',814), REPEAT('x',633) +FROM seq_1_to_1024; +CREATE TEMPORARY TABLE t2 ( +a varchar(1024), +b varchar(1024), +c varchar(1024), +d varchar(1024), +e varchar(1024), +f varchar(1024), +g varchar(1024), +h varchar(1024), +i varchar(1024), +j varchar(1024), +k varchar(1024), +l varchar(1024), +m varchar(1024), +key (a), +key (b), +key (c), +key (d), +key (e), +key (f) +) ENGINE=InnoDB; +SET @x=REPEAT('x',512); +INSERT INTO t2 SELECT @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x +FROM seq_1_to_768; +DROP TABLE t1, t2; +SET GLOBAL innodb_change_buffering= @buffering; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release +SET GLOBAL innodb_flush_log_at_trx_commit= @flush; diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result new file mode 100644 index 00000000..1dc7f032 --- /dev/null +++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result @@ -0,0 +1,20 @@ +CREATE TABLE t1( +a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(1), +c INT, +INDEX(b)) +ENGINE=InnoDB STATS_PERSISTENT=0; +SET GLOBAL innodb_change_buffering_debug = 1; +SET GLOBAL innodb_change_buffering=all; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release +INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_1024; +# restart: --innodb-force-recovery=6 --innodb-change-buffer-dump +check table t1; +Table Op Msg_type Msg_text +test.t1 check Warning InnoDB: Index 'b' contains 990 entries, should be 1024. +test.t1 check error Corrupt +# restart: --innodb-force_recovery=0 +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb-force_recovery=0 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/implicit_gap_lock_convertion.result b/mysql-test/suite/innodb/r/implicit_gap_lock_convertion.result new file mode 100644 index 00000000..fd197324 --- /dev/null +++ b/mysql-test/suite/innodb/r/implicit_gap_lock_convertion.result @@ -0,0 +1,17 @@ +CREATE TABLE t(a INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t VALUES (10), (30); +connect con1,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; +BEGIN; +INSERT INTO t VALUES (20); +SELECT * FROM t WHERE a BETWEEN 10 AND 30; +a +10 +20 +30 +connection default; +SET session innodb_lock_wait_timeout=1; +INSERT INTO t VALUES (15); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/import_bugs.result b/mysql-test/suite/innodb/r/import_bugs.result new file mode 100644 index 00000000..98f3e767 --- /dev/null +++ b/mysql-test/suite/innodb/r/import_bugs.result @@ -0,0 +1,26 @@ +call mtr.add_suppression("Index for table 'imp_t1' is corrupt; try to repair it"); +SET @save_innodb_checksum_algorithm=@@GLOBAL.innodb_checksum_algorithm; +SET GLOBAL innodb_checksum_algorithm=full_crc32; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE imp_t1 DISCARD TABLESPACE ; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE imp_t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (ROW_FORMAT mismatch) +CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +ERROR 42S01: Table 'imp_t1' already exists +DROP TABLE imp_t1; +CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +DROP TABLE imp_t1, t1; +SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm; +# +# MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)' +# failed in dberr_t row_discard_tablespace_for_mysql +# (dict_table_t*, trx_t*) +CREATE TABLE t1 (c INT KEY) ENGINE=INNODB; +CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB; +ALTER TABLE t1 DISCARD TABLESPACE; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +DROP TABLE t2, t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/import_corrupted.result b/mysql-test/suite/innodb/r/import_corrupted.result new file mode 100644 index 00000000..bc24a28f --- /dev/null +++ b/mysql-test/suite/innodb/r/import_corrupted.result @@ -0,0 +1,31 @@ +call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes"); +call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); +call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: \\..test.t2\\.ibd"); +call mtr.add_suppression("InnoDB: File '.*test/t2\\.ibd' is corrupted"); +CREATE TABLE t1 ( +id INT AUTO_INCREMENT PRIMARY KEY, +not_id INT, +data CHAR(255), +data2 BLOB +) ENGINE=INNODB; +ALTER TABLE t1 MODIFY not_id INT UNIQUE KEY; +connect purge_control,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1 WHERE id % 2 = 1; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +connection purge_control; +COMMIT; +connection default; +DROP TABLE t1; +CREATE TABLE t2 ( +id INT AUTO_INCREMENT PRIMARY KEY, +not_id INT UNIQUE KEY, +data CHAR(255), +data2 BLOB +) ENGINE=INNODB; +ALTER TABLE t2 DISCARD TABLESPACE; +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/import_tablespace_race.result b/mysql-test/suite/innodb/r/import_tablespace_race.result new file mode 100644 index 00000000..6c8b2e3a --- /dev/null +++ b/mysql-test/suite/innodb/r/import_tablespace_race.result @@ -0,0 +1,27 @@ +# +# MDEV-29144 ER_TABLE_SCHEMA_MISMATCH or crash on DISCARD/IMPORT +# +call mtr.add_suppression("InnoDB: Unknown index id"); +CREATE TABLE t (pk int PRIMARY KEY, c varchar(1024)) +ENGINE=InnoDB CHARSET latin1; +INSERT INTO t SELECT seq, 'x' FROM seq_1_to_100; +connect con1,localhost,root,,test; +BEGIN NOT ATOMIC +DECLARE a INT DEFAULT 0; +REPEAT +SET a= a+1; +UPDATE t SET c = 'xx' WHERE pk = a; +UNTIL a = 100 +END REPEAT; +END +$ +connection default; +ALTER TABLE t NOWAIT ADD INDEX (c); +connection con1; +connection default; +FLUSH TABLE t FOR EXPORT; +UNLOCK TABLES; +DROP TABLE t; +ALTER TABLE t DISCARD TABLESPACE; +ALTER TABLE t IMPORT TABLESPACE; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/index_merge_threshold.result b/mysql-test/suite/innodb/r/index_merge_threshold.result new file mode 100644 index 00000000..41897b80 --- /dev/null +++ b/mysql-test/suite/innodb/r/index_merge_threshold.result @@ -0,0 +1,1309 @@ +CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT, +c4 TINYBLOB,c5 BLOB,c6 MEDIUMBLOB,c7 LONGBLOB) ENGINE=InnoDB; +CREATE INDEX index1 ON tab(c1(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +CREATE INDEX index2 ON tab(c2(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=-1'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +CREATE INDEX index3 ON tab(c3(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=20'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +CREATE INDEX index4 ON tab(c4(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=25'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +CREATE INDEX index5 ON tab(c5(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +CREATE INDEX index6 ON tab(c6(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +CREATE INDEX index7 ON tab(c7(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `a` bigint(20) NOT NULL, + `c1` tinytext DEFAULT NULL, + `c2` text DEFAULT NULL, + `c3` mediumtext DEFAULT NULL, + `c4` tinyblob DEFAULT NULL, + `c5` blob DEFAULT NULL, + `c6` mediumblob DEFAULT NULL, + `c7` longblob DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `index1` (`c1`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51', + KEY `index2` (`c2`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=-1', + KEY `index3` (`c3`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=20', + KEY `index4` (`c4`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=25', + KEY `index5` (`c5`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30', + KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', + KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab PRIMARY 50 +test/tab index1 50 +test/tab index2 50 +test/tab index3 20 +test/tab index4 25 +test/tab index5 30 +test/tab index6 35 +test/tab index7 40 +ALTER TABLE tab comment='MERGE_THRESHOLD=49'; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `a` bigint(20) NOT NULL, + `c1` tinytext DEFAULT NULL, + `c2` text DEFAULT NULL, + `c3` mediumtext DEFAULT NULL, + `c4` tinyblob DEFAULT NULL, + `c5` blob DEFAULT NULL, + `c6` mediumblob DEFAULT NULL, + `c7` longblob DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `index1` (`c1`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51', + KEY `index2` (`c2`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=-1', + KEY `index3` (`c3`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=20', + KEY `index4` (`c4`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=25', + KEY `index5` (`c5`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30', + KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', + KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='MERGE_THRESHOLD=49' +SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab PRIMARY 49 +test/tab index1 49 +test/tab index2 49 +test/tab index3 20 +test/tab index4 25 +test/tab index5 30 +test/tab index6 35 +test/tab index7 40 +ALTER TABLE tab MODIFY COLUMN c7 VARCHAR(2048) ; +Warnings: +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `a` bigint(20) NOT NULL, + `c1` tinytext DEFAULT NULL, + `c2` text DEFAULT NULL, + `c3` mediumtext DEFAULT NULL, + `c4` tinyblob DEFAULT NULL, + `c5` blob DEFAULT NULL, + `c6` mediumblob DEFAULT NULL, + `c7` varchar(2048) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `index1` (`c1`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51', + KEY `index2` (`c2`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=-1', + KEY `index3` (`c3`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=20', + KEY `index4` (`c4`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=25', + KEY `index5` (`c5`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30', + KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', + KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='MERGE_THRESHOLD=49' +SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab PRIMARY 49 +test/tab index1 49 +test/tab index2 49 +test/tab index3 20 +test/tab index4 25 +test/tab index5 30 +test/tab index6 35 +test/tab index7 40 +ALTER TABLE tab ADD INDEX index8 (c7(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=45'; +Warnings: +Note 1831 Duplicate index `index8`. This is deprecated and will be disallowed in a future release +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +Warning 1478 InnoDB: Invalid value for MERGE_THRESHOLD in the CREATE TABLE statement. The value is ignored. +SHOW CREATE TABLE tab; +Table Create Table +tab CREATE TABLE `tab` ( + `a` bigint(20) NOT NULL, + `c1` tinytext DEFAULT NULL, + `c2` text DEFAULT NULL, + `c3` mediumtext DEFAULT NULL, + `c4` tinyblob DEFAULT NULL, + `c5` blob DEFAULT NULL, + `c6` mediumblob DEFAULT NULL, + `c7` varchar(2048) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `index1` (`c1`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51', + KEY `index2` (`c2`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=-1', + KEY `index3` (`c3`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=20', + KEY `index4` (`c4`(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=25', + KEY `index5` (`c5`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30', + KEY `index6` (`c6`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35', + KEY `index7` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40', + KEY `index8` (`c7`(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=45' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='MERGE_THRESHOLD=49' +SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab PRIMARY 49 +test/tab index1 49 +test/tab index2 49 +test/tab index3 20 +test/tab index4 25 +test/tab index5 30 +test/tab index6 35 +test/tab index7 40 +test/tab index8 45 +DROP TABLE tab; +# +# behavior for deleting records +# +# test to confirm behavior (MERGE_THRESHOLD=50 (default)) +CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 50 +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +begin; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 5; +delete from tab1 where a = 6; +delete from tab1 where a = 7; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 4 +5 4 +delete from tab1 where a = 11; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +delete from tab1 where a = 10; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +delete from tab1 where a = 9; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +DROP TABLE tab1; +# test to confirm behavior (MERGE_THRESHOLD=35) +CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB +COMMENT='MERGE_THRESHOLD=35'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 35 +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +begin; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 5; +delete from tab1 where a = 6; +delete from tab1 where a = 7; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 4 +5 4 +delete from tab1 where a = 11; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 10; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +delete from tab1 where a = 9; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +DROP TABLE tab1; +# test to confirm behavior (MERGE_THRESHOLD=25) +CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB +COMMENT='MERGE_THRESHOLD=25'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 25 +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +begin; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 5; +delete from tab1 where a = 6; +delete from tab1 where a = 7; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 4 +5 4 +delete from tab1 where a = 11; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 10; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 9; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +DROP TABLE tab1; +# test to confirm partitioned table (MERGE_THRESHOLD=35) +CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) +COMMENT='MERGE_THRESHOLD=35' +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (20) ENGINE = InnoDB, +PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB); +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1#p#p0 PRIMARY 35 +test/tab1#p#p1 PRIMARY 35 +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 0 +3 2 +4 7 +5 7 +begin; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 5; +delete from tab1 where a = 6; +delete from tab1 where a = 7; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 0 +3 2 +4 4 +5 4 +delete from tab1 where a = 11; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 10; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +delete from tab1 where a = 9; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +DROP TABLE tab1; +# +# behavior for updating to smaller records +# +# test to confirm behavior (MERGE_THRESHOLD=50 (default)) +CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 50 +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +update tab1 set b='' where a = 12; +update tab1 set b='' where a = 13; +update tab1 set b='' where a = 14; +update tab1 set b='' where a = 5; +update tab1 set b='' where a = 6; +update tab1 set b='' where a = 7; +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +update tab1 set b='' where a = 11; +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +update tab1 set b='' where a = 10; +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +update tab1 set b='' where a = 9; +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +DROP TABLE tab1; +# test to confirm behavior (MERGE_THRESHOLD=35) +CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB +COMMENT='MERGE_THRESHOLD=35'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 35 +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +update tab1 set b='' where a = 12; +update tab1 set b='' where a = 13; +update tab1 set b='' where a = 14; +update tab1 set b='' where a = 5; +update tab1 set b='' where a = 6; +update tab1 set b='' where a = 7; +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +update tab1 set b='' where a = 11; +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +update tab1 set b='' where a = 10; +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +update tab1 set b='' where a = 9; +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +DROP TABLE tab1; +# test to confirm behavior (MERGE_THRESHOLD=25) +CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB +COMMENT='MERGE_THRESHOLD=25'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 25 +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +update tab1 set b='' where a = 12; +update tab1 set b='' where a = 13; +update tab1 set b='' where a = 14; +update tab1 set b='' where a = 5; +update tab1 set b='' where a = 6; +update tab1 set b='' where a = 7; +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 2 +4 7 +5 7 +update tab1 set b='' where a = 11; +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +update tab1 set b='' where a = 10; +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +update tab1 set b='' where a = 9; +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +DROP TABLE tab1; +# test to confirm explicit temporary table (MERGE_THRESHOLD=35) +# (though not registered to SYS_TABLES,SYS_INDEXES, it works correctly) +CREATE TEMPORARY TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB +COMMENT='MERGE_THRESHOLD=35'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +insert into tab1 values (1, repeat('a',2048)); +insert into tab1 values (2, repeat('a',2048)); +insert into tab1 values (3, repeat('a',2048)); +insert into tab1 values (8, repeat('a',2048)); +insert into tab1 values (9, repeat('a',2048)); +insert into tab1 values (10, repeat('a',2048)); +insert into tab1 values (11, repeat('a',2048)); +insert into tab1 values (12, repeat('a',2048)); +insert into tab1 values (4, repeat('a',2048)); +insert into tab1 values (5, repeat('a',2048)); +insert into tab1 values (6, repeat('a',2048)); +insert into tab1 values (7, repeat('a',2048)); +insert into tab1 values (13, repeat('a',2048)); +insert into tab1 values (14, repeat('a',2048)); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +update tab1 set b='' where a = 12; +update tab1 set b='' where a = 13; +update tab1 set b='' where a = 14; +update tab1 set b='' where a = 5; +update tab1 set b='' where a = 6; +update tab1 set b='' where a = 7; +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +update tab1 set b='' where a = 11; +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +update tab1 set b='' where a = 10; +# check page merge happens (MERGE_THRESHOLD=35 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +update tab1 set b='' where a = 9; +# check page merge happens (MERGE_THRESHOLD=25 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +DROP TABLE tab1; +# +# behavior for secondary index with blob +# +# test to confirm behavior (MERGE_THRESHOLD=50 (default)) +CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic; +CREATE INDEX index1 ON tab1(b(750)); +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 50 +test/tab1 index1 50 +INSERT INTO tab1 VALUES (1, concat("01", repeat('a',8190))); +INSERT INTO tab1 VALUES (2, concat("02", repeat('a',8190))); +INSERT INTO tab1 VALUES (3, concat("03", repeat('a',8190))); +INSERT INTO tab1 VALUES (4, concat("04", repeat('a',8190))); +INSERT INTO tab1 VALUES (5, concat("05", repeat('a',8190))); +INSERT INTO tab1 VALUES (6, concat("06", repeat('a',8190))); +INSERT INTO tab1 VALUES (7, concat("07", repeat('a',8190))); +INSERT INTO tab1 VALUES (8, concat("08", repeat('a',8190))); +INSERT INTO tab1 VALUES (9, concat("09", repeat('a',8190))); +INSERT INTO tab1 VALUES (10, concat("10", repeat('a',8190))); +INSERT INTO tab1 VALUES (22, concat("22", repeat('a',8190))); +INSERT INTO tab1 VALUES (23, concat("23", repeat('a',8190))); +INSERT INTO tab1 VALUES (24, concat("24", repeat('a',8190))); +INSERT INTO tab1 VALUES (25, concat("25", repeat('a',8190))); +INSERT INTO tab1 VALUES (26, concat("26", repeat('a',8190))); +INSERT INTO tab1 VALUES (27, concat("27", repeat('a',8190))); +INSERT INTO tab1 VALUES (28, concat("28", repeat('a',8190))); +INSERT INTO tab1 VALUES (29, concat("29", repeat('a',8190))); +INSERT INTO tab1 VALUES (30, concat("30", repeat('a',8190))); +INSERT INTO tab1 VALUES (31, concat("31", repeat('a',8190))); +INSERT INTO tab1 VALUES (32, concat("32", repeat('a',8190))); +INSERT INTO tab1 VALUES (33, concat("33", repeat('a',8190))); +INSERT INTO tab1 VALUES (11, concat("11", repeat('a',8190))); +INSERT INTO tab1 VALUES (12, concat("12", repeat('a',8190))); +INSERT INTO tab1 VALUES (13, concat("13", repeat('a',8190))); +INSERT INTO tab1 VALUES (14, concat("14", repeat('a',8190))); +INSERT INTO tab1 VALUES (15, concat("15", repeat('a',8190))); +INSERT INTO tab1 VALUES (16, concat("16", repeat('a',8190))); +INSERT INTO tab1 VALUES (17, concat("17", repeat('a',8190))); +INSERT INTO tab1 VALUES (18, concat("18", repeat('a',8190))); +INSERT INTO tab1 VALUES (19, concat("19", repeat('a',8190))); +INSERT INTO tab1 VALUES (20, concat("20", repeat('a',8190))); +INSERT INTO tab1 VALUES (21, concat("21", repeat('a',8190))); +INSERT INTO tab1 VALUES (34, concat("34", repeat('a',8190))); +INSERT INTO tab1 VALUES (35, concat("35", repeat('a',8190))); +INSERT INTO tab1 VALUES (36, concat("36", repeat('a',8190))); +INSERT INTO tab1 VALUES (37, concat("37", repeat('a',8190))); +INSERT INTO tab1 VALUES (38, concat("38", repeat('a',8190))); +INSERT INTO tab1 VALUES (39, concat("39", repeat('a',8190))); +INSERT INTO tab1 VALUES (40, concat("40", repeat('a',8190))); +INSERT INTO tab1 VALUES (41, concat("41", repeat('a',8190))); +INSERT INTO tab1 VALUES (42, concat("42", repeat('a',8190))); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 42 +4 2 +27 21 +28 21 +begin; +delete from tab1 where a = 33; +delete from tab1 where a = 34; +delete from tab1 where a = 35; +delete from tab1 where a = 36; +delete from tab1 where a = 37; +delete from tab1 where a = 38; +delete from tab1 where a = 39; +delete from tab1 where a = 40; +delete from tab1 where a = 41; +delete from tab1 where a = 42; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 15; +delete from tab1 where a = 16; +delete from tab1 where a = 17; +delete from tab1 where a = 18; +delete from tab1 where a = 19; +delete from tab1 where a = 20; +delete from tab1 where a = 21; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 22 +4 2 +27 11 +28 11 +delete from tab1 where a = 32; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +delete from tab1 where a = 31; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=45 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +delete from tab1 where a = 30; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=40 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +DROP TABLE tab1; +# test to confirm behavior (MERGE_THRESHOLD=45) +CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic; +CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 50 +test/tab1 index1 45 +INSERT INTO tab1 VALUES (1, concat("01", repeat('a',8190))); +INSERT INTO tab1 VALUES (2, concat("02", repeat('a',8190))); +INSERT INTO tab1 VALUES (3, concat("03", repeat('a',8190))); +INSERT INTO tab1 VALUES (4, concat("04", repeat('a',8190))); +INSERT INTO tab1 VALUES (5, concat("05", repeat('a',8190))); +INSERT INTO tab1 VALUES (6, concat("06", repeat('a',8190))); +INSERT INTO tab1 VALUES (7, concat("07", repeat('a',8190))); +INSERT INTO tab1 VALUES (8, concat("08", repeat('a',8190))); +INSERT INTO tab1 VALUES (9, concat("09", repeat('a',8190))); +INSERT INTO tab1 VALUES (10, concat("10", repeat('a',8190))); +INSERT INTO tab1 VALUES (22, concat("22", repeat('a',8190))); +INSERT INTO tab1 VALUES (23, concat("23", repeat('a',8190))); +INSERT INTO tab1 VALUES (24, concat("24", repeat('a',8190))); +INSERT INTO tab1 VALUES (25, concat("25", repeat('a',8190))); +INSERT INTO tab1 VALUES (26, concat("26", repeat('a',8190))); +INSERT INTO tab1 VALUES (27, concat("27", repeat('a',8190))); +INSERT INTO tab1 VALUES (28, concat("28", repeat('a',8190))); +INSERT INTO tab1 VALUES (29, concat("29", repeat('a',8190))); +INSERT INTO tab1 VALUES (30, concat("30", repeat('a',8190))); +INSERT INTO tab1 VALUES (31, concat("31", repeat('a',8190))); +INSERT INTO tab1 VALUES (32, concat("32", repeat('a',8190))); +INSERT INTO tab1 VALUES (33, concat("33", repeat('a',8190))); +INSERT INTO tab1 VALUES (11, concat("11", repeat('a',8190))); +INSERT INTO tab1 VALUES (12, concat("12", repeat('a',8190))); +INSERT INTO tab1 VALUES (13, concat("13", repeat('a',8190))); +INSERT INTO tab1 VALUES (14, concat("14", repeat('a',8190))); +INSERT INTO tab1 VALUES (15, concat("15", repeat('a',8190))); +INSERT INTO tab1 VALUES (16, concat("16", repeat('a',8190))); +INSERT INTO tab1 VALUES (17, concat("17", repeat('a',8190))); +INSERT INTO tab1 VALUES (18, concat("18", repeat('a',8190))); +INSERT INTO tab1 VALUES (19, concat("19", repeat('a',8190))); +INSERT INTO tab1 VALUES (20, concat("20", repeat('a',8190))); +INSERT INTO tab1 VALUES (21, concat("21", repeat('a',8190))); +INSERT INTO tab1 VALUES (34, concat("34", repeat('a',8190))); +INSERT INTO tab1 VALUES (35, concat("35", repeat('a',8190))); +INSERT INTO tab1 VALUES (36, concat("36", repeat('a',8190))); +INSERT INTO tab1 VALUES (37, concat("37", repeat('a',8190))); +INSERT INTO tab1 VALUES (38, concat("38", repeat('a',8190))); +INSERT INTO tab1 VALUES (39, concat("39", repeat('a',8190))); +INSERT INTO tab1 VALUES (40, concat("40", repeat('a',8190))); +INSERT INTO tab1 VALUES (41, concat("41", repeat('a',8190))); +INSERT INTO tab1 VALUES (42, concat("42", repeat('a',8190))); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 42 +4 2 +27 21 +28 21 +begin; +delete from tab1 where a = 33; +delete from tab1 where a = 34; +delete from tab1 where a = 35; +delete from tab1 where a = 36; +delete from tab1 where a = 37; +delete from tab1 where a = 38; +delete from tab1 where a = 39; +delete from tab1 where a = 40; +delete from tab1 where a = 41; +delete from tab1 where a = 42; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 15; +delete from tab1 where a = 16; +delete from tab1 where a = 17; +delete from tab1 where a = 18; +delete from tab1 where a = 19; +delete from tab1 where a = 20; +delete from tab1 where a = 21; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 22 +4 2 +27 11 +28 11 +delete from tab1 where a = 32; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 31; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=45 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +delete from tab1 where a = 30; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=40 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +DROP TABLE tab1; +# test to confirm behavior (MERGE_THRESHOLD=40) +CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic; +CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=40'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 50 +test/tab1 index1 40 +INSERT INTO tab1 VALUES (1, concat("01", repeat('a',8190))); +INSERT INTO tab1 VALUES (2, concat("02", repeat('a',8190))); +INSERT INTO tab1 VALUES (3, concat("03", repeat('a',8190))); +INSERT INTO tab1 VALUES (4, concat("04", repeat('a',8190))); +INSERT INTO tab1 VALUES (5, concat("05", repeat('a',8190))); +INSERT INTO tab1 VALUES (6, concat("06", repeat('a',8190))); +INSERT INTO tab1 VALUES (7, concat("07", repeat('a',8190))); +INSERT INTO tab1 VALUES (8, concat("08", repeat('a',8190))); +INSERT INTO tab1 VALUES (9, concat("09", repeat('a',8190))); +INSERT INTO tab1 VALUES (10, concat("10", repeat('a',8190))); +INSERT INTO tab1 VALUES (22, concat("22", repeat('a',8190))); +INSERT INTO tab1 VALUES (23, concat("23", repeat('a',8190))); +INSERT INTO tab1 VALUES (24, concat("24", repeat('a',8190))); +INSERT INTO tab1 VALUES (25, concat("25", repeat('a',8190))); +INSERT INTO tab1 VALUES (26, concat("26", repeat('a',8190))); +INSERT INTO tab1 VALUES (27, concat("27", repeat('a',8190))); +INSERT INTO tab1 VALUES (28, concat("28", repeat('a',8190))); +INSERT INTO tab1 VALUES (29, concat("29", repeat('a',8190))); +INSERT INTO tab1 VALUES (30, concat("30", repeat('a',8190))); +INSERT INTO tab1 VALUES (31, concat("31", repeat('a',8190))); +INSERT INTO tab1 VALUES (32, concat("32", repeat('a',8190))); +INSERT INTO tab1 VALUES (33, concat("33", repeat('a',8190))); +INSERT INTO tab1 VALUES (11, concat("11", repeat('a',8190))); +INSERT INTO tab1 VALUES (12, concat("12", repeat('a',8190))); +INSERT INTO tab1 VALUES (13, concat("13", repeat('a',8190))); +INSERT INTO tab1 VALUES (14, concat("14", repeat('a',8190))); +INSERT INTO tab1 VALUES (15, concat("15", repeat('a',8190))); +INSERT INTO tab1 VALUES (16, concat("16", repeat('a',8190))); +INSERT INTO tab1 VALUES (17, concat("17", repeat('a',8190))); +INSERT INTO tab1 VALUES (18, concat("18", repeat('a',8190))); +INSERT INTO tab1 VALUES (19, concat("19", repeat('a',8190))); +INSERT INTO tab1 VALUES (20, concat("20", repeat('a',8190))); +INSERT INTO tab1 VALUES (21, concat("21", repeat('a',8190))); +INSERT INTO tab1 VALUES (34, concat("34", repeat('a',8190))); +INSERT INTO tab1 VALUES (35, concat("35", repeat('a',8190))); +INSERT INTO tab1 VALUES (36, concat("36", repeat('a',8190))); +INSERT INTO tab1 VALUES (37, concat("37", repeat('a',8190))); +INSERT INTO tab1 VALUES (38, concat("38", repeat('a',8190))); +INSERT INTO tab1 VALUES (39, concat("39", repeat('a',8190))); +INSERT INTO tab1 VALUES (40, concat("40", repeat('a',8190))); +INSERT INTO tab1 VALUES (41, concat("41", repeat('a',8190))); +INSERT INTO tab1 VALUES (42, concat("42", repeat('a',8190))); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 42 +4 2 +27 21 +28 21 +begin; +delete from tab1 where a = 33; +delete from tab1 where a = 34; +delete from tab1 where a = 35; +delete from tab1 where a = 36; +delete from tab1 where a = 37; +delete from tab1 where a = 38; +delete from tab1 where a = 39; +delete from tab1 where a = 40; +delete from tab1 where a = 41; +delete from tab1 where a = 42; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 15; +delete from tab1 where a = 16; +delete from tab1 where a = 17; +delete from tab1 where a = 18; +delete from tab1 where a = 19; +delete from tab1 where a = 20; +delete from tab1 where a = 21; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 22 +4 2 +27 11 +28 11 +delete from tab1 where a = 32; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 31; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=45 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 30; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=40 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +DROP TABLE tab1; +# compressed table behaves same (MERGE_THRESHOLD=45) +CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB +ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45'; +# check MERGE_THRESHOLD +select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD +from INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +where t.TABLE_ID = i.TABLE_ID and t.NAME like 'test/tab1%'; +TABLE_NAME INDEX_NAME MERGE_THRESHOLD +test/tab1 PRIMARY 50 +test/tab1 index1 45 +INSERT INTO tab1 VALUES (1, concat("01", repeat('a',8190))); +INSERT INTO tab1 VALUES (2, concat("02", repeat('a',8190))); +INSERT INTO tab1 VALUES (3, concat("03", repeat('a',8190))); +INSERT INTO tab1 VALUES (4, concat("04", repeat('a',8190))); +INSERT INTO tab1 VALUES (5, concat("05", repeat('a',8190))); +INSERT INTO tab1 VALUES (6, concat("06", repeat('a',8190))); +INSERT INTO tab1 VALUES (7, concat("07", repeat('a',8190))); +INSERT INTO tab1 VALUES (8, concat("08", repeat('a',8190))); +INSERT INTO tab1 VALUES (9, concat("09", repeat('a',8190))); +INSERT INTO tab1 VALUES (10, concat("10", repeat('a',8190))); +INSERT INTO tab1 VALUES (22, concat("22", repeat('a',8190))); +INSERT INTO tab1 VALUES (23, concat("23", repeat('a',8190))); +INSERT INTO tab1 VALUES (24, concat("24", repeat('a',8190))); +INSERT INTO tab1 VALUES (25, concat("25", repeat('a',8190))); +INSERT INTO tab1 VALUES (26, concat("26", repeat('a',8190))); +INSERT INTO tab1 VALUES (27, concat("27", repeat('a',8190))); +INSERT INTO tab1 VALUES (28, concat("28", repeat('a',8190))); +INSERT INTO tab1 VALUES (29, concat("29", repeat('a',8190))); +INSERT INTO tab1 VALUES (30, concat("30", repeat('a',8190))); +INSERT INTO tab1 VALUES (31, concat("31", repeat('a',8190))); +INSERT INTO tab1 VALUES (32, concat("32", repeat('a',8190))); +INSERT INTO tab1 VALUES (33, concat("33", repeat('a',8190))); +INSERT INTO tab1 VALUES (11, concat("11", repeat('a',8190))); +INSERT INTO tab1 VALUES (12, concat("12", repeat('a',8190))); +INSERT INTO tab1 VALUES (13, concat("13", repeat('a',8190))); +INSERT INTO tab1 VALUES (14, concat("14", repeat('a',8190))); +INSERT INTO tab1 VALUES (15, concat("15", repeat('a',8190))); +INSERT INTO tab1 VALUES (16, concat("16", repeat('a',8190))); +INSERT INTO tab1 VALUES (17, concat("17", repeat('a',8190))); +INSERT INTO tab1 VALUES (18, concat("18", repeat('a',8190))); +INSERT INTO tab1 VALUES (19, concat("19", repeat('a',8190))); +INSERT INTO tab1 VALUES (20, concat("20", repeat('a',8190))); +INSERT INTO tab1 VALUES (21, concat("21", repeat('a',8190))); +INSERT INTO tab1 VALUES (34, concat("34", repeat('a',8190))); +INSERT INTO tab1 VALUES (35, concat("35", repeat('a',8190))); +INSERT INTO tab1 VALUES (36, concat("36", repeat('a',8190))); +INSERT INTO tab1 VALUES (37, concat("37", repeat('a',8190))); +INSERT INTO tab1 VALUES (38, concat("38", repeat('a',8190))); +INSERT INTO tab1 VALUES (39, concat("39", repeat('a',8190))); +INSERT INTO tab1 VALUES (40, concat("40", repeat('a',8190))); +INSERT INTO tab1 VALUES (41, concat("41", repeat('a',8190))); +INSERT INTO tab1 VALUES (42, concat("42", repeat('a',8190))); +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 42 +4 2 +27 21 +28 21 +begin; +delete from tab1 where a = 33; +delete from tab1 where a = 34; +delete from tab1 where a = 35; +delete from tab1 where a = 36; +delete from tab1 where a = 37; +delete from tab1 where a = 38; +delete from tab1 where a = 39; +delete from tab1 where a = 40; +delete from tab1 where a = 41; +delete from tab1 where a = 42; +delete from tab1 where a = 12; +delete from tab1 where a = 13; +delete from tab1 where a = 14; +delete from tab1 where a = 15; +delete from tab1 where a = 16; +delete from tab1 where a = 17; +delete from tab1 where a = 18; +delete from tab1 where a = 19; +delete from tab1 where a = 20; +delete from tab1 where a = 21; +commit; +InnoDB 0 transactions not purged +# check page merge happens (nothing is expected) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +select PAGE_NUMBER, NUMBER_RECORDS +from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1, +INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 +where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' +and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; +PAGE_NUMBER NUMBER_RECORDS +3 22 +4 2 +27 11 +28 11 +delete from tab1 where a = 32; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=50 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 0 +index_page_merge_successful 0 +delete from tab1 where a = 31; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=45 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 1 +index_page_merge_successful 1 +delete from tab1 where a = 30; +InnoDB 0 transactions not purged +# check page merge happens (MERGE_THRESHOLD=40 causes merge here) +SELECT name,count_reset FROM information_schema.innodb_metrics +WHERE name like 'index_page_merge_%'; +name count_reset +index_page_merge_attempts 2 +index_page_merge_successful 2 +DROP TABLE tab1; diff --git a/mysql-test/suite/innodb/r/index_tree_operation.result b/mysql-test/suite/innodb/r/index_tree_operation.result new file mode 100644 index 00000000..29660962 --- /dev/null +++ b/mysql-test/suite/innodb/r/index_tree_operation.result @@ -0,0 +1,55 @@ +# +# Bug#15923864 (Bug#67718): +# INNODB DRASTICALLY UNDER-FILLS PAGES IN CERTAIN CONDITIONS +# +SET GLOBAL innodb_file_per_table=ON; +CREATE TABLE t1 (a BIGINT PRIMARY KEY, b VARCHAR(4096)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (0, REPEAT('a', 4096)); +INSERT INTO t1 VALUES (1000, REPEAT('a', 4096)); +INSERT INTO t1 VALUES (1001, REPEAT('a', 4096)); +INSERT INTO t1 VALUES (1002, REPEAT('a', 4096)); +INSERT INTO t1 VALUES (1, REPEAT('a', 4096)); +INSERT INTO t1 VALUES (2, REPEAT('a', 4096)); +SELECT page_number, number_records +FROM information_schema.innodb_sys_tablespaces s1, +information_schema.innodb_buffer_page s2 +WHERE s1.space = s2.space AND name = 'test/t1' +AND page_type = "INDEX" ORDER BY page_number; +page_number number_records +3 2 +4 3 +5 3 +INSERT INTO t1 VALUES (999, REPEAT('a', 4096)); +SELECT page_number, number_records +FROM information_schema.innodb_sys_tablespaces s1, +information_schema.innodb_buffer_page s2 +WHERE s1.space = s2.space AND name = 'test/t1' +AND page_type = "INDEX" ORDER BY page_number; +page_number number_records +3 3 +4 3 +5 3 +6 1 +INSERT INTO t1 VALUES (998, REPEAT('a', 4096)); +SELECT page_number, number_records +FROM information_schema.innodb_sys_tablespaces s1, +information_schema.innodb_buffer_page s2 +WHERE s1.space = s2.space AND name = 'test/t1' +AND page_type = "INDEX" ORDER BY page_number; +page_number number_records +3 3 +4 3 +5 3 +6 2 +INSERT INTO t1 VALUES (997, REPEAT('a', 4096)); +SELECT page_number, number_records +FROM information_schema.innodb_sys_tablespaces s1, +information_schema.innodb_buffer_page s2 +WHERE s1.space = s2.space AND name = 'test/t1' +AND page_type = "INDEX" ORDER BY page_number; +page_number number_records +3 3 +4 3 +5 3 +6 3 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/index_vcol_purge_startup.result b/mysql-test/suite/innodb/r/index_vcol_purge_startup.result new file mode 100644 index 00000000..5603c14a --- /dev/null +++ b/mysql-test/suite/innodb/r/index_vcol_purge_startup.result @@ -0,0 +1,24 @@ +call mtr.add_suppression('SQL_ERROR_LOG'); +call mtr.add_suppression('Failed to initialize plugins'); +call mtr.add_suppression('Aborting'); +create table t1(a int primary key, b int as (100-a*a), index(b)) engine=innodb; +insert t1 (a) values(1),(2),(3); +start transaction; +select * from t1 order by a; +a b +1 99 +2 96 +3 91 +connect con1, localhost, root; +delete from t1 where a=2; +flush tables; +connection default; +# Kill the server +# Failed restart +# Start the server +# restart +select * from t1 order by a; +a b +1 99 +3 91 +drop table t1; diff --git a/mysql-test/suite/innodb/r/information_schema_grants.result b/mysql-test/suite/innodb/r/information_schema_grants.result new file mode 100644 index 00000000..a468081d --- /dev/null +++ b/mysql-test/suite/innodb/r/information_schema_grants.result @@ -0,0 +1,269 @@ +select plugin_name,plugin_status as 'Must be ACTIVE' from information_schema.plugins where plugin_name like 'inno%' and plugin_status!='ACTIVE'; +plugin_name Must be ACTIVE +create user select_only@localhost; +grant select on *.* to select_only@localhost; +connect select_only,localhost,select_only; +connection default; +create sql security invoker view i_buffer_page as select * from information_schema.innodb_buffer_page; +create sql security definer view d_buffer_page as select * from information_schema.innodb_buffer_page; +create sql security invoker view i_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru; +create sql security definer view d_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru; +create sql security invoker view i_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats; +create sql security definer view d_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats; +create sql security invoker view i_cmp as select * from information_schema.innodb_cmp; +create sql security definer view d_cmp as select * from information_schema.innodb_cmp; +create sql security invoker view i_cmp_per_index as select * from information_schema.innodb_cmp_per_index; +create sql security definer view d_cmp_per_index as select * from information_schema.innodb_cmp_per_index; +create sql security invoker view i_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset; +create sql security definer view d_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset; +create sql security invoker view i_cmp_reset as select * from information_schema.innodb_cmp_reset; +create sql security definer view d_cmp_reset as select * from information_schema.innodb_cmp_reset; +create sql security invoker view i_cmpmem as select * from information_schema.innodb_cmpmem; +create sql security definer view d_cmpmem as select * from information_schema.innodb_cmpmem; +create sql security invoker view i_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset; +create sql security definer view d_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset; +create sql security invoker view i_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted; +create sql security definer view d_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted; +create sql security invoker view i_ft_config as select * from information_schema.innodb_ft_config; +create sql security definer view d_ft_config as select * from information_schema.innodb_ft_config; +create sql security invoker view i_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword; +create sql security definer view d_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword; +create sql security invoker view i_ft_deleted as select * from information_schema.innodb_ft_deleted; +create sql security definer view d_ft_deleted as select * from information_schema.innodb_ft_deleted; +create sql security invoker view i_ft_index_cache as select * from information_schema.innodb_ft_index_cache; +create sql security definer view d_ft_index_cache as select * from information_schema.innodb_ft_index_cache; +create sql security invoker view i_ft_index_table as select * from information_schema.innodb_ft_index_table; +create sql security definer view d_ft_index_table as select * from information_schema.innodb_ft_index_table; +create sql security invoker view i_lock_waits as select * from information_schema.innodb_lock_waits; +create sql security definer view d_lock_waits as select * from information_schema.innodb_lock_waits; +create sql security invoker view i_locks as select * from information_schema.innodb_locks; +create sql security definer view d_locks as select * from information_schema.innodb_locks; +create sql security invoker view i_metrics as select * from information_schema.innodb_metrics; +create sql security definer view d_metrics as select * from information_schema.innodb_metrics; +create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns; +create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns; +create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields; +create sql security definer view d_sys_fields as select * from information_schema.innodb_sys_fields; +create sql security invoker view i_sys_foreign as select * from information_schema.innodb_sys_foreign; +create sql security definer view d_sys_foreign as select * from information_schema.innodb_sys_foreign; +create sql security invoker view i_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols; +create sql security definer view d_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols; +create sql security invoker view i_sys_indexes as select * from information_schema.innodb_sys_indexes; +create sql security definer view d_sys_indexes as select * from information_schema.innodb_sys_indexes; +create sql security invoker view i_sys_tables as select * from information_schema.innodb_sys_tables; +create sql security definer view d_sys_tables as select * from information_schema.innodb_sys_tables; +create sql security invoker view i_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces; +create sql security definer view d_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces; +create sql security invoker view i_sys_tablestats as select * from information_schema.innodb_sys_tablestats; +create sql security definer view d_sys_tablestats as select * from information_schema.innodb_sys_tablestats; +create sql security invoker view i_sys_virtual as select * from information_schema.innodb_sys_virtual; +create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual; +create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption; +create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption; +create sql security invoker view i_trx as select * from information_schema.innodb_trx; +create sql security definer view d_trx as select * from information_schema.innodb_trx; +connection select_only; +select count(*) > -1 from information_schema.innodb_buffer_page; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_buffer_page; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_buffer_page; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_buffer_page_lru; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_buffer_page_lru; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_buffer_page_lru; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_buffer_pool_stats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_buffer_pool_stats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_buffer_pool_stats; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp_per_index; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp_per_index; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp_per_index; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp_per_index_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp_per_index_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp_per_index_reset; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp_reset; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmpmem; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmpmem; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmpmem; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmpmem_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmpmem_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmpmem_reset; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_being_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_being_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_being_deleted; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_config; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_config; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_config; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_default_stopword; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_deleted; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_index_cache; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_index_cache; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_index_cache; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_index_table; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_index_table; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_index_table; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_lock_waits; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_lock_waits; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_lock_waits; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_locks; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_locks; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_locks; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_metrics; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_metrics; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_metrics; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_columns; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_columns; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_columns; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_fields; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_fields; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_fields; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_foreign; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_foreign; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_foreign; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_foreign_cols; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_foreign_cols; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_foreign_cols; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_indexes; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_indexes; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_indexes; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_tables; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_tables; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_tables; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_tablespaces; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_tablespaces; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_tablespaces; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_tablestats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_tablestats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_tablestats; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_virtual; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_virtual; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_virtual; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_tablespaces_encryption; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_tablespaces_encryption; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_tablespaces_encryption; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_trx; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_trx; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_trx; +count(*) > -1 +1 +connection default; +SET GLOBAL innodb_max_purge_lag_wait=0; +drop database test; +create database test; +drop user select_only@localhost; diff --git a/mysql-test/suite/innodb/r/innodb-16k.result b/mysql-test/suite/innodb/r/innodb-16k.result new file mode 100644 index 00000000..3d62a2f8 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-16k.result @@ -0,0 +1,510 @@ +call mtr.add_suppression("InnoDB: Cannot add field .* in table"); +# Test 1) Show the page size from Information Schema +SELECT variable_value FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_page_size'; +variable_value +16384 +# Test 4) The maximum row size is dependent upon the page size. +# Redundant: 8123, Compact: 8126, Dynamic: 8126. +# Each row format has its own amount of overhead that +# varies depending on number of fields and other overhead. +SET SESSION innodb_strict_mode = ON; +SET @save_level=@@GLOBAL.innodb_compression_level; +SET GLOBAL innodb_compression_level=1; +CREATE TABLE t1 ( +c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), +c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), +c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), +c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), +c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), +c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), +c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), +c36 char(200), c37 char(200), c38 char(196) +) ROW_FORMAT=compressed; +DROP TABLE t1; +CREATE TABLE t1 ( +c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), +c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), +c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), +c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), +c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), +c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), +c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), +c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(160) +) ROW_FORMAT=compressed; +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(4) character set utf8, +PRIMARY KEY (a,b,c,d,e)) +ENGINE=innodb; +DROP TABLE t1; +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(5) character set utf8, +PRIMARY KEY (a,b,c,d,e)) +ENGINE=innodb; +ERROR 42000: Specified key was too long; max key length is 3072 bytes +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(255) character set utf8, +f varchar(4) character set utf8, +PRIMARY KEY (a), KEY (b,c,d,e,f)) +ENGINE=innodb; +DROP TABLE t1; +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(255) character set utf8, +f varchar(5) character set utf8, +PRIMARY KEY (a), KEY (b,c,d,e,f)) +ENGINE=innodb; +ERROR 42000: Specified key was too long; max key length is 3072 bytes +# Test 5) Make sure that KEY_BLOCK_SIZE=16, 8, 4, 2 & 1 +# are all accepted. +SET SESSION innodb_strict_mode = ON; +CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=16 +ALTER TABLE t1 KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=8 +ALTER TABLE t1 KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=4 +ALTER TABLE t1 KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=2 +ALTER TABLE t1 KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=1 +ALTER TABLE t1 KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED +DROP TABLE t1; +SET SESSION innodb_strict_mode = OFF; +CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=16 +ALTER TABLE t1 KEY_BLOCK_SIZE=8; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=8 +ALTER TABLE t1 KEY_BLOCK_SIZE=4; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=4 +ALTER TABLE t1 KEY_BLOCK_SIZE=2; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=2 +ALTER TABLE t1 KEY_BLOCK_SIZE=1; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED key_block_size=1 +ALTER TABLE t1 KEY_BLOCK_SIZE=0; +SHOW WARNINGS; +Level Code Message +SELECT table_name, row_format, create_options +FROM information_schema.tables WHERE table_name = 't1'; +table_name row_format create_options +t1 Compressed row_format=COMPRESSED +DROP TABLE t1; +CREATE TABLE t2(d varchar(17) PRIMARY KEY) ENGINE=innodb DEFAULT CHARSET=utf8; +CREATE TABLE t3(a int PRIMARY KEY) ENGINE=innodb; +INSERT INTO t3 VALUES (22),(44),(33),(55),(66); +INSERT INTO t2 VALUES ('jejdkrun87'),('adfd72nh9k'), +('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik'); +CREATE TABLE t1(a int, b blob, c text, d text NOT NULL) +ENGINE=innodb DEFAULT CHARSET=utf8; +INSERT INTO t1 +SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3 +ORDER BY a,d; +DROP TABLE t2, t3; +SELECT COUNT(*) FROM t1 WHERE a=44; +COUNT(*) +5 +SELECT a, +LENGTH(b),b=LEFT(REPEAT(d,100*a),65535),LENGTH(c),c=REPEAT(d,20*a),d FROM t1 +ORDER BY a,d; +a LENGTH(b) b=LEFT(REPEAT(d,100*a),65535) LENGTH(c) c=REPEAT(d,20*a) d +22 22000 1 4400 1 adfd72nh9k +22 35200 1 7040 1 adfdijn0loKNHJik +22 28600 1 5720 1 adfdijnmnb78k +22 26400 1 5280 1 adfdpplkeock +22 22000 1 4400 1 jejdkrun87 +33 33000 1 6600 1 adfd72nh9k +33 52800 1 10560 1 adfdijn0loKNHJik +33 42900 1 8580 1 adfdijnmnb78k +33 39600 1 7920 1 adfdpplkeock +33 33000 1 6600 1 jejdkrun87 +44 44000 1 8800 1 adfd72nh9k +44 65535 1 14080 1 adfdijn0loKNHJik +44 57200 1 11440 1 adfdijnmnb78k +44 52800 1 10560 1 adfdpplkeock +44 44000 1 8800 1 jejdkrun87 +55 55000 1 11000 1 adfd72nh9k +55 65535 1 17600 1 adfdijn0loKNHJik +55 65535 1 14300 1 adfdijnmnb78k +55 65535 1 13200 1 adfdpplkeock +55 55000 1 11000 1 jejdkrun87 +66 65535 1 13200 1 adfd72nh9k +66 65535 1 21120 1 adfdijn0loKNHJik +66 65535 1 17160 1 adfdijnmnb78k +66 65535 1 15840 1 adfdpplkeock +66 65535 1 13200 1 jejdkrun87 +ALTER TABLE t1 ADD PRIMARY KEY (a), ADD KEY (b(20)); +ERROR 23000: Duplicate entry '22' for key 'PRIMARY' +DELETE FROM t1 WHERE d='null'; +ALTER TABLE t1 ADD PRIMARY KEY (a), ADD KEY (b(20)); +ERROR 23000: Duplicate entry '22' for key 'PRIMARY' +DELETE FROM t1 WHERE a%2; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD PRIMARY KEY (a,b(255),c(255)), ADD KEY (b(767)); +SELECT COUNT(*) FROM t1 WHERE a=44; +COUNT(*) +5 +SELECT a, +LENGTH(b), b=LEFT(REPEAT(d,100*a), 65535),LENGTH(c), c=REPEAT(d,20*a), d FROM t1 +ORDER BY a,d; +a LENGTH(b) b=LEFT(REPEAT(d,100*a), 65535) LENGTH(c) c=REPEAT(d,20*a) d +22 22000 1 4400 1 adfd72nh9k +22 35200 1 7040 1 adfdijn0loKNHJik +22 28600 1 5720 1 adfdijnmnb78k +22 26400 1 5280 1 adfdpplkeock +22 22000 1 4400 1 jejdkrun87 +44 44000 1 8800 1 adfd72nh9k +44 65535 1 14080 1 adfdijn0loKNHJik +44 57200 1 11440 1 adfdijnmnb78k +44 52800 1 10560 1 adfdpplkeock +44 44000 1 8800 1 jejdkrun87 +66 65535 1 13200 1 adfd72nh9k +66 65535 1 21120 1 adfdijn0loKNHJik +66 65535 1 17160 1 adfdijnmnb78k +66 65535 1 15840 1 adfdpplkeock +66 65535 1 13200 1 jejdkrun87 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` blob NOT NULL, + `c` text NOT NULL, + `d` text NOT NULL, + PRIMARY KEY (`a`,`b`(255),`c`(255)), + KEY `b` (`b`(767)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +# Test 8) Test creating a table that could lead to undo log overflow. +CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, +h blob,i blob,j blob,k blob,l blob,m blob,n blob, +o blob,p blob,q blob,r blob,s blob,t blob,u blob) +ENGINE=InnoDB ROW_FORMAT=dynamic; +SET @a = repeat('a', 767); +SET @b = repeat('b', 767); +SET @c = repeat('c', 767); +SET @d = repeat('d', 767); +SET @e = repeat('e', 767); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b, +k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b; +CREATE INDEX t1a ON t1 (a(767)); +CREATE INDEX t1b ON t1 (b(767)); +CREATE INDEX t1c ON t1 (c(767)); +CREATE INDEX t1d ON t1 (d(767)); +CREATE INDEX t1e ON t1 (e(767)); +UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, +k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c; +CREATE INDEX t1f ON t1 (f(767)); +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d, +k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; +ROLLBACK; +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d; +UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d, +n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; +COMMIT; +CREATE INDEX t1g ON t1 (g(767)); +UPDATE t1 SET g=@e; +CREATE INDEX t1h ON t1 (h(767)); +UPDATE t1 SET h=@e; +CREATE INDEX t1i ON t1 (i(767)); +UPDATE t1 SET i=@e; +CREATE INDEX t1j ON t1 (j(767)); +UPDATE t1 SET j=@e; +CREATE INDEX t1k ON t1 (k(767)); +UPDATE t1 SET k=@e; +CREATE INDEX t1l ON t1 (l(767)); +UPDATE t1 SET l=@e; +CREATE INDEX t1m ON t1 (m(767)); +UPDATE t1 SET m=@e; +CREATE INDEX t1n ON t1 (n(767)); +UPDATE t1 SET n=@e; +CREATE INDEX t1o ON t1 (o(767)); +UPDATE t1 SET o=@e; +CREATE INDEX t1p ON t1 (p(767)); +UPDATE t1 SET p=@e; +CREATE INDEX t1q ON t1 (q(767)); +UPDATE t1 SET q=@e; +CREATE INDEX t1r ON t1 (r(767)); +UPDATE t1 SET r=@e; +CREATE INDEX t1s ON t1 (s(767)); +UPDATE t1 SET s=@e; +CREATE INDEX t1t ON t1 (t(767)); +BEGIN; +UPDATE t1 SET t=@e; +ROLLBACK; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + `q` blob DEFAULT NULL, + `r` blob DEFAULT NULL, + `s` blob DEFAULT NULL, + `t` blob DEFAULT NULL, + `u` blob DEFAULT NULL, + KEY `t1a` (`a`(767)), + KEY `t1b` (`b`(767)), + KEY `t1c` (`c`(767)), + KEY `t1d` (`d`(767)), + KEY `t1e` (`e`(767)), + KEY `t1f` (`f`(767)), + KEY `t1g` (`g`(767)), + KEY `t1h` (`h`(767)), + KEY `t1i` (`i`(767)), + KEY `t1j` (`j`(767)), + KEY `t1k` (`k`(767)), + KEY `t1l` (`l`(767)), + KEY `t1m` (`m`(767)), + KEY `t1n` (`n`(767)), + KEY `t1o` (`o`(767)), + KEY `t1p` (`p`(767)), + KEY `t1q` (`q`(767)), + KEY `t1r` (`r`(767)), + KEY `t1s` (`s`(767)), + KEY `t1t` (`t`(767)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +DROP TABLE t1; +Test an assertion failure on purge. +CREATE TABLE t1_purge ( +A int, +B blob, C blob, D blob, E blob, +F blob, G blob, H blob, +PRIMARY KEY (B(767), C(767), D(767), E(767), A), +INDEX (A) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1_purge VALUES (1, +REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766), +REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766)); +CREATE TABLE t2_purge ( +A int PRIMARY KEY, +B blob, C blob, D blob, E blob, +F blob, G blob, H blob, I blob, +J blob, K blob, L blob, +INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t2_purge VALUES (1, +REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766), +REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766), +REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766)); +CREATE TABLE t3_purge ( +A int, +B varchar(800), C varchar(800), D varchar(800), E varchar(800), +F varchar(800), G varchar(800), H varchar(800), +PRIMARY KEY (B(767), C(767), D(767), E(767), A), +INDEX (A) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t3_purge SELECT * FROM t1_purge; +CREATE TABLE t4_purge ( +A int PRIMARY KEY, +B varchar(800), C varchar(800), D varchar(800), E varchar(800), +F varchar(800), G varchar(800), H varchar(800), I varchar(800), +J varchar(800), K varchar(800), L varchar(800), +INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t4_purge SELECT * FROM t2_purge; +DELETE FROM t1_purge; +DELETE FROM t2_purge; +DELETE FROM t3_purge; +DELETE FROM t4_purge; +SET @r=REPEAT('a',500); +CREATE TABLE tlong(a int, +v1 varchar(500), v2 varchar(500), v3 varchar(500), +v4 varchar(500), v5 varchar(500), v6 varchar(500), +v7 varchar(500), v8 varchar(500), v9 varchar(500), +v10 varchar(500), v11 varchar(500), v12 varchar(500), +v13 varchar(500), v14 varchar(500), v15 varchar(500), +v16 varchar(500), v17 varchar(500), v18 varchar(500) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +CREATE INDEX idx1 ON tlong(a,v1); +INSERT INTO tlong VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r); +UPDATE tlong SET a=1000; +DELETE FROM tlong; +CREATE TABLE tlong2(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob, +i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob) +ENGINE=innodb ROW_FORMAT=dynamic; +SET @r = REPEAT('a', 767); +INSERT INTO tlong2 VALUES (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r); +CREATE INDEX ndx_a ON tlong2 (a(500)); +CREATE INDEX ndx_b ON tlong2 (b(500)); +CREATE INDEX ndx_c ON tlong2 (c(500)); +CREATE INDEX ndx_d ON tlong2 (d(500)); +CREATE INDEX ndx_e ON tlong2 (e(500)); +CREATE INDEX ndx_f ON tlong2 (f(500)); +CREATE INDEX ndx_k ON tlong2 (k(500)); +CREATE INDEX ndx_l ON tlong2 (l(500)); +SET @r = REPEAT('b', 500); +UPDATE tlong2 set a=@r,b=@r,c=@r,d=@r; +UPDATE tlong2 set e=@r,f=@r,g=@r,h=@r; +UPDATE tlong2 set i=@r,j=@r,k=@r,l=@r; +UPDATE tlong2 set m=@r,n=@r,o=@r,p=@r; +ALTER TABLE tlong2 DROP INDEX ndx_a; +ALTER TABLE tlong2 DROP INDEX ndx_b; +CREATE INDEX ndx_g ON tlong2 (g(500)); +CREATE INDEX ndx_h ON tlong2 (h(500)); +CREATE INDEX ndx_i ON tlong2 (i(500)); +CREATE INDEX ndx_j ON tlong2 (j(500)); +CREATE INDEX ndx_m ON tlong2 (m(500)); +CREATE INDEX ndx_n ON tlong2 (n(500)); +CREATE INDEX ndx_o ON tlong2 (o(500)); +CREATE INDEX ndx_p ON tlong2 (p(500)); +SHOW CREATE TABLE tlong2; +Table Create Table +tlong2 CREATE TABLE `tlong2` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + KEY `ndx_c` (`c`(500)), + KEY `ndx_d` (`d`(500)), + KEY `ndx_e` (`e`(500)), + KEY `ndx_f` (`f`(500)), + KEY `ndx_k` (`k`(500)), + KEY `ndx_l` (`l`(500)), + KEY `ndx_g` (`g`(500)), + KEY `ndx_h` (`h`(500)), + KEY `ndx_i` (`i`(500)), + KEY `ndx_j` (`j`(500)), + KEY `ndx_m` (`m`(500)), + KEY `ndx_n` (`n`(500)), + KEY `ndx_o` (`o`(500)), + KEY `ndx_p` (`p`(500)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SET SESSION innodb_strict_mode = ON; +CREATE TABLE bug12547647( +a int NOT NULL, b blob NOT NULL, c text, +PRIMARY KEY (b(10), a), INDEX (c(767)), INDEX(b(767)) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO bug12547647 VALUES (5,REPEAT('khdfo5AlOq',1900),REPEAT('g',7751)); +COMMIT; +BEGIN; +UPDATE bug12547647 SET c = REPEAT('b',16928); +SHOW WARNINGS; +Level Code Message +ROLLBACK; +DROP TABLE bug12547647; +SET SESSION innodb_strict_mode = on; +CREATE TABLE t1( +c text NOT NULL, d text NOT NULL, +PRIMARY KEY (c(767),d(767))) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +CREATE TABLE t1( +c text NOT NULL, d text NOT NULL, +PRIMARY KEY (c(767),d(767))) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII; +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +CREATE TABLE t1( +c text NOT NULL, d text NOT NULL, +PRIMARY KEY (c(767),d(767))) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII; +drop table t1; +CREATE TABLE t1(c text, PRIMARY KEY (c(440))) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +CREATE TABLE t1(c text, PRIMARY KEY (c(292))) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; +INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); +DROP TABLE t1; +InnoDB 0 transactions not purged +SET GLOBAL innodb_compression_level=@save_level; +DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; +DROP TABLE tlong; +DROP TABLE tlong2; diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result new file mode 100644 index 00000000..98b4a128 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result @@ -0,0 +1,293 @@ +CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, +h blob,i blob,j blob,k blob,l blob,m blob,n blob, +o blob,p blob,q blob,r blob,s blob,t blob,u blob, +v blob, w blob, x blob, y blob, z blob, +aa blob,ba blob,ca blob,da blob,ea blob,fa blob,ga blob, +ha blob,ia blob,ja blob,ka blob,la blob,ma blob,na blob, +oa blob,pa blob,qa blob,ra blob,sa blob,ta blob,ua blob, +va blob, wa blob, xa blob, ya blob, za blob) +ENGINE=InnoDB ROW_FORMAT=dynamic; +SET innodb_strict_mode=OFF; +CREATE TABLE t2(a blob,b blob,c blob,d blob,e blob,f blob,g blob, +h blob,i blob,j blob,k blob,l blob,m blob,n blob, +o blob,p blob,q blob,r blob,s blob,t blob,u blob, +v blob, w blob, x blob, y blob, z blob, +aa blob,ba blob,ca blob,da blob,ea blob,fa blob,ga blob, +ha blob,ia blob,ja blob,ka blob,la blob,ma blob,na blob, +oa blob,pa blob,qa blob,ra blob,sa blob,ta blob,ua blob, +va blob, wa blob, xa blob, ya blob, za blob) +ENGINE=InnoDB ROW_FORMAT=compact; +Warnings: +Warning 139 Row size too large (> 16318). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +SET innodb_strict_mode=ON; +SET @a = repeat('a', 767); +SET @b = repeat('b', 767); +SET @c = repeat('c', 767); +SET @d = repeat('d', 767); +SET @e = repeat('e', 767); +SET @f = repeat('f', 767); +SET @f = repeat('g', 767); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +SET @f = repeat('h', 500); +SET @f = repeat('i', 500); +SET @f = repeat('j', 500); +SET @f = repeat('k', 500); +SET @f = repeat('l', 500); +SET @f = repeat('m', 500); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h,@h); +UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b, +k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b, +v=@b,w=@b,x=@b,y=@b,z=@b, +aa=@b,ba=@b,ca=@b,da=@b,ea=@b,fa=@b,ga=@b,ha=@b,ia=@b,ja=@b, +ka=@b,la=@b,ma=@b,na=@b,oa=@b,pa=@b,qa=@b,ra=@b,sa=@b,ta=@b,ua=@b, +va=@b,wa=@b,xa=@b,ya=@b,za=@b; +UPDATE t2 SET a=@i,b=@i,c=@i,d=@i,e=@i,f=@i,g=@i,h=@i,i=@i,j=@i, +k=@i,l=@i,m=@i,n=@i,o=@i,p=@i,q=@i,r=@i,s=@i,t=@i,u=@i, +v=@i,w=@i,x=@i,y=@i,z=@i, +aa=@i,ba=@i,ca=@i,da=@i,ea=@i,fa=@i,ga=@i,ha=@i,ia=@i,ja=@i, +ka=@i,la=@i,ma=@i,na=@i,oa=@i,pa=@i,qa=@i,ra=@i,sa=@i,ta=@i,ua=@i, +va=@i,wa=@i,xa=@i,ya=@i,za=@i; +CREATE INDEX t1a ON t1 (a(767)); +CREATE INDEX t1b ON t1 (b(767)); +CREATE INDEX t1c ON t1 (c(767)); +CREATE INDEX t1d ON t1 (d(767)); +CREATE INDEX t1e ON t1 (e(767)); +CREATE INDEX t1f1 ON t1 (f(767)); +CREATE INDEX t1f2 ON t1 (g(767)); +CREATE INDEX t1f3 ON t1 (h(767)); +CREATE INDEX t1f4 ON t1 (i(767)); +CREATE INDEX t1f5 ON t1 (j(767)); +CREATE INDEX t1a ON t2 (a(767)); +CREATE INDEX t1b ON t2 (b(767)); +CREATE INDEX t1c ON t2 (c(767)); +CREATE INDEX t1d ON t2 (d(767)); +CREATE INDEX t1e ON t2 (e(767)); +CREATE INDEX t1f1 ON t2 (f(767)); +CREATE INDEX t1f2 ON t2 (g(767)); +CREATE INDEX t1f3 ON t2 (h(767)); +UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, +k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c, +v=@c,w=@c,x=@b,y=@c,z=@c, +aa=@c,ba=@c,ca=@c,da=@c,ea=@c,fa=@c,ga=@c,ha=@c,ia=@c,ja=@c, +ka=@c,la=@c,ma=@c,na=@c,oa=@c,pa=@c,qa=@c,ra=@c,sa=@c,ta=@b,ua=@c, +va=@c,wa=@c,xa=@c,ya=@c,za=@c; +UPDATE t2 SET a=@k,b=@k,c=@k,d=@k,e=@k,f=@k,g=@k,h=@k,i=@k,j=@k, +k=@k,l=@k,m=@k,n=@k,o=@k,p=@k,q=@k,r=@k,s=@k,t=@k,u=@k, +v=@k,w=@k,x=@b,y=@k,z=@k, +aa=@k,ba=@k,ca=@k,da=@k,ea=@k,fa=@k,ga=@k,ha=@k,ia=@k,ja=@k, +ka=@k,la=@k,ma=@k,na=@k,oa=@k,pa=@k,qa=@k,ra=@k,sa=@k,ta=@b,ua=@k, +va=@k,wa=@k,xa=@k,ya=@k,za=@k; +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d; +UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d; +UPDATE t1 SET k=@d,l=@d,m=@d,n=@d,o=@d; +UPDATE t1 SET p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; +UPDATE t1 SET v=@d,w=@d,x=@d,y=@d,z=@d; +UPDATE t1 SET aa=@d,ba=@d,ca=@d,da=@d; +UPDATE t1 SET ea=@d,fa=@d,ga=@d,ha=@d,ia=@d,ja=@d; +UPDATE t1 SET ka=@d,la=@d,ma=@d,na=@d,oa=@d,pa=@d; +UPDATE t1 SET qa=@d,ra=@d,sa=@d,ta=@d,ua=@d; +UPDATE t1 SET va=@d,wa=@d,xa=@d,ya=@d,za=@d; +COMMIT; +BEGIN; +UPDATE t2 SET a=@l,b=@l,c=@l,d=@l,e=@l; +UPDATE t2 SET f=@l,g=@l,h=@l,i=@l,j=@l; +UPDATE t2 SET k=@l,l=@l,m=@l,n=@l,o=@l; +UPDATE t2 SET p=@l,q=@l,r=@l,s=@l,t=@l,u=@l; +UPDATE t2 SET v=@l,w=@l,x=@l,y=@l,z=@l; +UPDATE t2 SET aa=@l,ba=@l,ca=@l,da=@l; +UPDATE t2 SET ea=@l,fa=@l,ga=@l,ha=@l,ia=@l,ja=@l; +UPDATE t2 SET ka=@l,la=@l,ma=@l,na=@l,oa=@l,pa=@l; +UPDATE t2 SET qa=@l,ra=@l,sa=@l,ta=@l,ua=@l; +UPDATE t2 SET va=@l,wa=@l,xa=@l,ya=@l,za=@l; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT * from t2; +BEGIN; +UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e; +# restart +UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f, +k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f, +v=@f,w=@f,x=@b,y=@f,z=@f, +aa=@f,ba=@f,ca=@f,da=@f,ea=@f,fa=@f,ga=@f,ha=@f,ia=@f,ja=@f, +ka=@f,la=@f,ma=@f,na=@f,oa=@f,pa=@f,qa=@f,ra=@f,sa=@f,ta=@b,ua=@f, +va=@f,wa=@f,xa=@f,ya=@f,za=@f; +UPDATE t2 SET a=@h,b=@h,c=@h,d=@h,e=@h,f=@h,g=@h,h=@h,i=@h,j=@h, +k=@h,l=@h,m=@h,n=@h,o=@h,p=@h,q=@h,r=@h,s=@h,t=@h,u=@h, +v=@h,w=@h,x=@b,y=@h,z=@h, +aa=@h,ba=@h,ca=@h,da=@h,ea=@h,fa=@h,ga=@h,ha=@h,ia=@h,ja=@h, +ka=@h,la=@h,ma=@h,na=@h,oa=@h,pa=@h,qa=@h,ra=@h,sa=@h,ta=@b,ua=@h, +va=@h,wa=@h,xa=@h,ya=@h,za=@h; +BEGIN; +UPDATE t1 SET a=@g,b=@g,c=@g,d=@g,e=@g; +UPDATE t1 SET f=@g,g=@g,h=@g,i=@g,j=@g; +UPDATE t1 SET k=@g,l=@g,m=@g,n=@g,o=@g; +UPDATE t1 SET p=@g,q=@g,r=@g,s=@g,t=@g,u=@g; +UPDATE t1 SET v=@g,w=@g,x=@g,y=@g,z=@g; +UPDATE t1 SET aa=@g,ba=@g,ca=@g,da=@g; +UPDATE t1 SET ea=@g,fa=@g,ga=@g,ha=@g,ia=@g,ja=@g; +UPDATE t1 SET ka=@g,la=@g,ma=@g,na=@g,oa=@g,pa=@g; +UPDATE t1 SET qa=@g,ra=@g,sa=@g,ta=@g,ua=@g; +UPDATE t1 SET va=@g,wa=@g,xa=@g,ya=@g,za=@g; +COMMIT; +BEGIN; +UPDATE t2 SET a=@m,b=@m,c=@m,d=@m,e=@m; +UPDATE t2 SET f=@m,g=@m,h=@m,i=@m,j=@m; +UPDATE t2 SET k=@m,l=@m,m=@m,n=@m,o=@m; +UPDATE t2 SET p=@m,q=@m,r=@m,s=@m,t=@m,u=@m; +UPDATE t2 SET v=@m,w=@m,x=@m,y=@m,z=@m; +UPDATE t2 SET aa=@m,ba=@m,ca=@m,da=@m; +UPDATE t2 SET ea=@m,fa=@m,ga=@m,ha=@m,ia=@m,ja=@m; +UPDATE t2 SET ka=@m,la=@m,ma=@m,na=@m,oa=@m,pa=@m; +UPDATE t2 SET qa=@m,ra=@m,sa=@m,ta=@m,ua=@m; +UPDATE t2 SET va=@m,wa=@m,xa=@m,ya=@m,za=@m; +COMMIT; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + `q` blob DEFAULT NULL, + `r` blob DEFAULT NULL, + `s` blob DEFAULT NULL, + `t` blob DEFAULT NULL, + `u` blob DEFAULT NULL, + `v` blob DEFAULT NULL, + `w` blob DEFAULT NULL, + `x` blob DEFAULT NULL, + `y` blob DEFAULT NULL, + `z` blob DEFAULT NULL, + `aa` blob DEFAULT NULL, + `ba` blob DEFAULT NULL, + `ca` blob DEFAULT NULL, + `da` blob DEFAULT NULL, + `ea` blob DEFAULT NULL, + `fa` blob DEFAULT NULL, + `ga` blob DEFAULT NULL, + `ha` blob DEFAULT NULL, + `ia` blob DEFAULT NULL, + `ja` blob DEFAULT NULL, + `ka` blob DEFAULT NULL, + `la` blob DEFAULT NULL, + `ma` blob DEFAULT NULL, + `na` blob DEFAULT NULL, + `oa` blob DEFAULT NULL, + `pa` blob DEFAULT NULL, + `qa` blob DEFAULT NULL, + `ra` blob DEFAULT NULL, + `sa` blob DEFAULT NULL, + `ta` blob DEFAULT NULL, + `ua` blob DEFAULT NULL, + `va` blob DEFAULT NULL, + `wa` blob DEFAULT NULL, + `xa` blob DEFAULT NULL, + `ya` blob DEFAULT NULL, + `za` blob DEFAULT NULL, + KEY `t1a` (`a`(767)), + KEY `t1b` (`b`(767)), + KEY `t1c` (`c`(767)), + KEY `t1d` (`d`(767)), + KEY `t1e` (`e`(767)), + KEY `t1f1` (`f`(767)), + KEY `t1f2` (`g`(767)), + KEY `t1f3` (`h`(767)), + KEY `t1f4` (`i`(767)), + KEY `t1f5` (`j`(767)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + `q` blob DEFAULT NULL, + `r` blob DEFAULT NULL, + `s` blob DEFAULT NULL, + `t` blob DEFAULT NULL, + `u` blob DEFAULT NULL, + `v` blob DEFAULT NULL, + `w` blob DEFAULT NULL, + `x` blob DEFAULT NULL, + `y` blob DEFAULT NULL, + `z` blob DEFAULT NULL, + `aa` blob DEFAULT NULL, + `ba` blob DEFAULT NULL, + `ca` blob DEFAULT NULL, + `da` blob DEFAULT NULL, + `ea` blob DEFAULT NULL, + `fa` blob DEFAULT NULL, + `ga` blob DEFAULT NULL, + `ha` blob DEFAULT NULL, + `ia` blob DEFAULT NULL, + `ja` blob DEFAULT NULL, + `ka` blob DEFAULT NULL, + `la` blob DEFAULT NULL, + `ma` blob DEFAULT NULL, + `na` blob DEFAULT NULL, + `oa` blob DEFAULT NULL, + `pa` blob DEFAULT NULL, + `qa` blob DEFAULT NULL, + `ra` blob DEFAULT NULL, + `sa` blob DEFAULT NULL, + `ta` blob DEFAULT NULL, + `ua` blob DEFAULT NULL, + `va` blob DEFAULT NULL, + `wa` blob DEFAULT NULL, + `xa` blob DEFAULT NULL, + `ya` blob DEFAULT NULL, + `za` blob DEFAULT NULL, + KEY `t1a` (`a`(767)), + KEY `t1b` (`b`(767)), + KEY `t1c` (`c`(767)), + KEY `t1d` (`d`(767)), + KEY `t1e` (`e`(767)), + KEY `t1f1` (`f`(767)), + KEY `t1f2` (`g`(767)), + KEY `t1f3` (`h`(767)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +drop table t1,t2; diff --git a/mysql-test/suite/innodb/r/innodb-32k.result b/mysql-test/suite/innodb/r/innodb-32k.result new file mode 100644 index 00000000..b64ff332 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-32k.result @@ -0,0 +1,743 @@ +call mtr.add_suppression("Innodb: Cannot add field.*row size is"); +# Test 1) Show the page size from Information Schema +SELECT variable_value FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_page_size'; +variable_value +32768 +# Test 4) The maximum row size is dependent upon the page size. +# Redundant: 16315, Compact: 16318. +# Compressed: 16318, Dynamic: ?. +# Each row format has its own amount of overhead that +# varies depending on number of fields and other overhead. +SET SESSION innodb_strict_mode = ON; +CREATE TABLE t1 ( +c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), +c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), +c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), +c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), +c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), +c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), +c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), +c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(200), +c41 char(200), c42 char(200), c43 char(200), c44 char(200), c45 char(200), +c46 char(200), c47 char(200), c48 char(200), c49 char(200), c50 char(200), +c51 char(200), c52 char(200), c53 char(200), c54 char(200), c55 char(200), +c56 char(200), c57 char(200), c58 char(200), c59 char(200), c60 char(200), +c61 char(200), c62 char(200), c63 char(200), c64 char(200), c65 char(200), +c66 char(200), c67 char(200), c68 char(200), c69 char(200), c70 char(200), +c71 char(200), c72 char(200), c73 char(200), c74 char(200), c75 char(200), +c76 char(200), c77 char(200), c78 char(200), c79 char(200), c80 char(200), +c81 char(63) +) ROW_FORMAT=compressed; +Got one of the listed errors +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(4) character set utf8, +PRIMARY KEY (a,b,c,d,e)) +ENGINE=innodb; +DROP TABLE t1; +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(5) character set utf8, +PRIMARY KEY (a,b,c,d,e)) +ENGINE=innodb; +ERROR 42000: Specified key was too long; max key length is 3072 bytes +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(255) character set utf8, +f varchar(4) character set utf8, +PRIMARY KEY (a), KEY (b,c,d,e,f)) +ENGINE=innodb; +DROP TABLE t1; +CREATE TABLE t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(255) character set utf8, +f varchar(5) character set utf8, +PRIMARY KEY (a), KEY (b,c,d,e,f)) +ENGINE=innodb; +ERROR 42000: Specified key was too long; max key length is 3072 bytes +# Test 8) Test creating a table that could lead to undo log overflow. +CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, +h blob,i blob,j blob,k blob,l blob,m blob,n blob, +o blob,p blob,q blob,r blob,s blob,t blob,u blob, +v blob, w blob, x blob, y blob, z blob, +aa blob,ba blob,ca blob,da blob,ea blob,fa blob,ga blob, +ha blob,ia blob,ja blob,ka blob,la blob,ma blob,na blob, +oa blob,pa blob,qa blob,ra blob,sa blob,ta blob,ua blob, +va blob, wa blob, xa blob, ya blob, za blob) +ENGINE=InnoDB ROW_FORMAT=dynamic; +SET @a = repeat('a', 767); +SET @b = repeat('b', 767); +SET @c = repeat('c', 767); +SET @d = repeat('d', 767); +SET @e = repeat('e', 767); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a,@a); +UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b, +k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b, +v=@b,w=@b,x=@b,y=@b,z=@b, +aa=@b,ba=@b,ca=@b,da=@b,ea=@b,fa=@b,ga=@b,ha=@b,ia=@b,ja=@b, +ka=@b,la=@b,ma=@b,na=@b,oa=@b,pa=@b,qa=@b,ra=@b,sa=@b,ta=@b,ua=@b, +va=@b,wa=@b,xa=@b,ya=@b,za=@b; +CREATE INDEX t1a ON t1 (a(767)); +CREATE INDEX t1b ON t1 (b(767)); +CREATE INDEX t1c ON t1 (c(767)); +CREATE INDEX t1d ON t1 (d(767)); +CREATE INDEX t1e ON t1 (e(767)); +CREATE INDEX t1f1 ON t1 (f(767)); +CREATE INDEX t1f2 ON t1 (g(767)); +CREATE INDEX t1f3 ON t1 (h(767)); +CREATE INDEX t1f4 ON t1 (i(767)); +CREATE INDEX t1f5 ON t1 (j(767)); +UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, +k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c, +v=@c,w=@c,x=@c,y=@c,z=@c, +aa=@c,ba=@c,ca=@c,da=@c,ea=@c,fa=@c,ga=@c,ha=@c,ia=@c,ja=@c, +ka=@c,la=@c,ma=@c,na=@c,oa=@c,pa=@c,qa=@c,ra=@c,sa=@c,ta=@c,ua=@c, +va=@c,wa=@c,xa=@c,ya=@c,za=@c; +CREATE INDEX t1f17 ON t1 (v(767)); +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d, +k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d, +v=@d,w=@d,x=@d,y=@d,z=@d, +aa=@d,ba=@d,ca=@d,da=@d,ea=@d,fa=@d,ga=@d,ha=@d,ia=@d,ja=@d, +ka=@d,la=@d,ma=@d,na=@d,oa=@d,pa=@d,qa=@d,ra=@d,sa=@d,ta=@d,ua=@d, +va=@d,wa=@d,xa=@d,ya=@d,za=@d; +ROLLBACK; +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d; +UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d; +UPDATE t1 SET k=@d,l=@d,m=@d,n=@d,o=@d; +UPDATE t1 SET p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; +UPDATE t1 SET v=@d,w=@d,x=@d,y=@d,z=@d; +UPDATE t1 SET aa=@d,ba=@d,ca=@d,da=@d; +UPDATE t1 SET ea=@d,fa=@d,ga=@d,ha=@d,ia=@d,ja=@d; +UPDATE t1 SET ka=@d,la=@d,ma=@d,na=@d,oa=@d,pa=@d; +UPDATE t1 SET qa=@d,ra=@d,sa=@d,ta=@d,ua=@d; +UPDATE t1 SET va=@d,wa=@d,xa=@d,ya=@d,za=@d; +COMMIT; +CREATE INDEX t1k ON t1 (k(767)); +CREATE INDEX t1f7 ON t1 (m(767)); +CREATE INDEX t1f8 ON t1 (n(767)); +CREATE INDEX t1f9 ON t1 (o(767)); +CREATE INDEX t1f11 ON t1 (p(767)); +CREATE INDEX t1f12 ON t1 (q(767)); +CREATE INDEX t1f13 ON t1 (r(767)); +CREATE INDEX t1f14 ON t1 (s(767)); +CREATE INDEX t1f15 ON t1 (t(767)); +CREATE INDEX t1f16 ON t1 (u(767)); +CREATE INDEX t1f18 ON t1 (w(767)); +CREATE INDEX t1f19 ON t1 (x(767)); +CREATE INDEX t1f20 ON t1 (y(767)); +CREATE INDEX t1f21 ON t1 (z(767)); +CREATE INDEX ta1a ON t1 (aa(767)); +CREATE INDEX tb1b ON t1 (ba(767)); +CREATE INDEX tc1c ON t1 (ca(767)); +CREATE INDEX td1d ON t1 (da(767)); +CREATE INDEX te1e ON t1 (ea(767)); +CREATE INDEX tf1f1 ON t1 (fa(767)); +CREATE INDEX tg1f2 ON t1 (ga(767)); +CREATE INDEX th1f3 ON t1 (ha(767)); +CREATE INDEX ti1f4 ON t1 (ia(767)); +CREATE INDEX tj1f5 ON t1 (ka(767)); +CREATE INDEX tk1f6 ON t1 (la(767)); +CREATE INDEX tl1f7 ON t1 (ma(767)); +CREATE INDEX tm1f8 ON t1 (na(767)); +CREATE INDEX tn1f9 ON t1 (oa(767)); +CREATE INDEX to1f11 ON t1 (pa(767)); +UPDATE t1 SET t=@e; +CREATE INDEX t1f6 ON t1 (l(767)); +drop table t1; +Test an assertion failure on purge. +CREATE TABLE t1_purge ( +A int, +B blob, C blob, D blob, E blob, +F blob, G blob, H blob, +PRIMARY KEY (B(767), C(767), D(767), E(767), A), +INDEX (A) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1_purge VALUES (1, +REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766), +REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766)); +CREATE TABLE t2_purge ( +A int PRIMARY KEY, +B blob, C blob, D blob, E blob, +F blob, G blob, H blob, I blob, +J blob, K blob, L blob, +INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t2_purge VALUES (1, +REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766), +REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766), +REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766)); +CREATE TABLE t3_purge ( +A int, +B varchar(800), C varchar(800), D varchar(800), E varchar(800), +F varchar(800), G varchar(800), H varchar(800), +PRIMARY KEY (B(767), C(767), D(767), E(767), A), +INDEX (A) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t3_purge SELECT * FROM t1_purge; +CREATE TABLE t4_purge ( +A int PRIMARY KEY, +B varchar(800), C varchar(800), D varchar(800), E varchar(800), +F varchar(800), G varchar(800), H varchar(800), I varchar(800), +J varchar(800), K varchar(800), L varchar(800), +INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t4_purge SELECT * FROM t2_purge; +DELETE FROM t1_purge; +DELETE FROM t2_purge; +DELETE FROM t3_purge; +DELETE FROM t4_purge; +SET @r=REPEAT('a',500); +CREATE TABLE tlong(a int, +v1 varchar(500), v2 varchar(500), v3 varchar(500), +v4 varchar(500), v5 varchar(500), v6 varchar(500), +v7 varchar(500), v8 varchar(500), v9 varchar(500), +v10 varchar(500), v11 varchar(500), v12 varchar(500), +v13 varchar(500), v14 varchar(500), v15 varchar(500), +v16 varchar(500), v17 varchar(500), v18 varchar(500) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +CREATE INDEX idx1 ON tlong(a,v1); +INSERT INTO tlong VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r); +UPDATE tlong SET a=1000; +DELETE FROM tlong; +CREATE TABLE tlong2(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob, +i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob) +ENGINE=innodb ROW_FORMAT=dynamic; +SET @r = REPEAT('a', 767); +INSERT INTO tlong2 VALUES (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r); +CREATE INDEX ndx_a ON tlong2 (a(500)); +CREATE INDEX ndx_b ON tlong2 (b(500)); +CREATE INDEX ndx_c ON tlong2 (c(500)); +CREATE INDEX ndx_d ON tlong2 (d(500)); +CREATE INDEX ndx_e ON tlong2 (e(500)); +CREATE INDEX ndx_f ON tlong2 (f(500)); +CREATE INDEX ndx_k ON tlong2 (k(500)); +CREATE INDEX ndx_l ON tlong2 (l(500)); +SET @r = REPEAT('b', 500); +UPDATE tlong2 set a=@r,b=@r,c=@r,d=@r; +UPDATE tlong2 set e=@r,f=@r,g=@r,h=@r; +UPDATE tlong2 set i=@r,j=@r,k=@r,l=@r; +UPDATE tlong2 set m=@r,n=@r,o=@r,p=@r; +ALTER TABLE tlong2 DROP INDEX ndx_a; +ALTER TABLE tlong2 DROP INDEX ndx_b; +CREATE INDEX ndx_g ON tlong2 (g(500)); +CREATE INDEX ndx_h ON tlong2 (h(500)); +CREATE INDEX ndx_i ON tlong2 (i(500)); +CREATE INDEX ndx_j ON tlong2 (j(500)); +CREATE INDEX ndx_m ON tlong2 (m(500)); +CREATE INDEX ndx_n ON tlong2 (n(500)); +CREATE INDEX ndx_o ON tlong2 (o(500)); +CREATE INDEX ndx_p ON tlong2 (p(500)); +SHOW CREATE TABLE tlong2; +Table Create Table +tlong2 CREATE TABLE `tlong2` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + KEY `ndx_c` (`c`(500)), + KEY `ndx_d` (`d`(500)), + KEY `ndx_e` (`e`(500)), + KEY `ndx_f` (`f`(500)), + KEY `ndx_k` (`k`(500)), + KEY `ndx_l` (`l`(500)), + KEY `ndx_g` (`g`(500)), + KEY `ndx_h` (`h`(500)), + KEY `ndx_i` (`i`(500)), + KEY `ndx_j` (`j`(500)), + KEY `ndx_m` (`m`(500)), + KEY `ndx_n` (`n`(500)), + KEY `ndx_o` (`o`(500)), + KEY `ndx_p` (`p`(500)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SET SESSION innodb_strict_mode = ON; +CREATE TABLE t3( +a int NOT NULL, b blob NOT NULL, c text, +PRIMARY KEY (b(10), a), INDEX (c(767)), INDEX(b(767)) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t3 VALUES (5,REPEAT('khdfo5AlOq',1900),REPEAT('g',7751)); +COMMIT; +UPDATE t3 SET c = REPEAT('b',16928); +SHOW WARNINGS; +Level Code Message +UPDATE t3 SET c = REPEAT('b',32800); +SHOW WARNINGS; +Level Code Message +InnoDB 0 transactions not purged +DROP TABLE t3; +DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; +DROP TABLE tlong; +DROP TABLE tlong2; +CREATE TABLE t2(COL1 TEXT, +COL2 TEXT, +COL3 TEXT, +COL4 TEXT, +COL5 TEXT, +COL6 TEXT, +COL7 TEXT, +COL8 TEXT, +COL9 TEXT, +COL10 TEXT, +COL11 TEXT, +COL12 TEXT, +COL13 TEXT, +COL14 TEXT, +COL15 TEXT, +COL16 TEXT, +COL17 TEXT, +COL18 TEXT, +COL19 TEXT, +COL20 TEXT, +COL21 TEXT, +COL22 TEXT, +COL23 TEXT, +COL24 TEXT, +COL25 TEXT, +COL26 TEXT, +COL27 TEXT, +COL28 TEXT, +COL29 TEXT, +COL30 TEXT, +COL31 TEXT, +COL32 TEXT, +COL33 TEXT, +COL34 TEXT, +COL35 TEXT, +COL36 TEXT, +COL37 TEXT, +COL38 TEXT, +COL39 TEXT, +COL40 TEXT, +COL41 TEXT, +COL42 TEXT, +COL43 TEXT, +COL44 TEXT, +COL45 TEXT, +COL46 TEXT, +COL47 TEXT, +COL48 TEXT, +COL49 TEXT, +COL50 TEXT, +COL51 TEXT, +COL52 TEXT, +COL53 TEXT, +COL54 TEXT, +COL55 TEXT, +COL56 TEXT, +COL57 TEXT, +COL58 TEXT, +COL59 TEXT, +COL60 TEXT, +COL61 TEXT, +COL62 TEXT, +COL63 TEXT, +COL64 TEXT, +COL65 TEXT, +COL66 TEXT, +COL67 TEXT, +COL68 TEXT, +COL69 TEXT, +COL70 TEXT, +COL71 TEXT, +COL72 TEXT, +COL73 TEXT, +COL74 TEXT, +COL75 TEXT, +COL76 TEXT, +COL77 TEXT, +COL78 TEXT, +COL79 TEXT, +COL80 TEXT, +COL81 TEXT, +COL82 TEXT, +COL83 TEXT, +COL84 TEXT, +COL85 TEXT, +COL86 TEXT, +COL87 TEXT, +COL88 TEXT, +COL89 TEXT, +COL90 TEXT, +COL91 TEXT, +COL92 TEXT, +COL93 TEXT, +COL94 TEXT, +COL95 TEXT, +COL96 TEXT, +COL97 TEXT, +COL98 TEXT, +COL99 TEXT, +COL100 TEXT, +COL101 TEXT, +COL102 TEXT, +COL103 TEXT, +COL104 TEXT, +COL105 TEXT, +COL106 TEXT, +COL107 TEXT, +COL108 TEXT, +COL109 TEXT, +COL110 TEXT, +COL111 TEXT, +COL112 TEXT, +COL113 TEXT, +COL114 TEXT, +COL115 TEXT, +COL116 TEXT, +COL117 TEXT, +COL118 TEXT, +COL119 TEXT, +COL120 TEXT, +COL121 TEXT, +COL122 TEXT, +COL123 TEXT, +COL124 TEXT, +COL125 TEXT, +COL126 TEXT, +COL127 TEXT, +COL128 TEXT, +COL129 TEXT, +COL130 TEXT, +COL131 TEXT, +COL132 TEXT, +COL133 TEXT, +COL134 TEXT, +COL135 TEXT, +COL136 TEXT, +COL137 TEXT, +COL138 TEXT, +COL139 TEXT, +COL140 TEXT, +COL141 TEXT, +COL142 TEXT, +COL143 TEXT, +COL144 TEXT, +COL145 TEXT, +COL146 TEXT, +COL147 TEXT, +COL148 TEXT, +COL149 TEXT, +COL150 TEXT, +COL151 TEXT, +COL152 TEXT, +COL153 TEXT, +COL154 TEXT, +COL155 TEXT, +COL156 TEXT, +COL157 TEXT, +COL158 TEXT, +COL159 TEXT, +COL160 TEXT, +COL161 TEXT, +COL162 TEXT, +COL163 TEXT, +COL164 TEXT, +COL165 TEXT, +COL166 TEXT, +COL167 TEXT, +COL168 TEXT, +COL169 TEXT, +COL170 TEXT, +COL171 TEXT, +COL172 TEXT, +COL173 TEXT, +COL174 TEXT, +COL175 TEXT, +COL176 TEXT, +COL177 TEXT, +COL178 TEXT, +COL179 TEXT, +COL180 TEXT, +COL181 TEXT, +COL182 TEXT, +COL183 TEXT, +COL184 TEXT, +COL185 TEXT, +COL186 TEXT, +COL187 TEXT, +COL188 TEXT, +COL189 TEXT, +COL190 TEXT, +COL191 TEXT, +COL192 TEXT, +COL193 TEXT, +COL194 TEXT, +COL195 TEXT, +COL196 TEXT, +COL197 TEXT) +row_format=dynamic,ENGINE=INNODB; +set @a = repeat('0123456789', 800); +set @b = repeat('9876543210', 800); +insert into t2 values( +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a); +update t2 set col190=@b; +set @a = repeat('0123456789', 1650); +set @b = repeat('9876543210', 2000); +insert into t2 values( +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a); +update t2 set col190=@b; +# restart +set @a = repeat('abcdefghijklmnopqrstuvwxyz', 1650); +set @b = repeat('zyxwvutsrqponmlkjihgfedcba', 2000); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COL1` text DEFAULT NULL, + `COL2` text DEFAULT NULL, + `COL3` text DEFAULT NULL, + `COL4` text DEFAULT NULL, + `COL5` text DEFAULT NULL, + `COL6` text DEFAULT NULL, + `COL7` text DEFAULT NULL, + `COL8` text DEFAULT NULL, + `COL9` text DEFAULT NULL, + `COL10` text DEFAULT NULL, + `COL11` text DEFAULT NULL, + `COL12` text DEFAULT NULL, + `COL13` text DEFAULT NULL, + `COL14` text DEFAULT NULL, + `COL15` text DEFAULT NULL, + `COL16` text DEFAULT NULL, + `COL17` text DEFAULT NULL, + `COL18` text DEFAULT NULL, + `COL19` text DEFAULT NULL, + `COL20` text DEFAULT NULL, + `COL21` text DEFAULT NULL, + `COL22` text DEFAULT NULL, + `COL23` text DEFAULT NULL, + `COL24` text DEFAULT NULL, + `COL25` text DEFAULT NULL, + `COL26` text DEFAULT NULL, + `COL27` text DEFAULT NULL, + `COL28` text DEFAULT NULL, + `COL29` text DEFAULT NULL, + `COL30` text DEFAULT NULL, + `COL31` text DEFAULT NULL, + `COL32` text DEFAULT NULL, + `COL33` text DEFAULT NULL, + `COL34` text DEFAULT NULL, + `COL35` text DEFAULT NULL, + `COL36` text DEFAULT NULL, + `COL37` text DEFAULT NULL, + `COL38` text DEFAULT NULL, + `COL39` text DEFAULT NULL, + `COL40` text DEFAULT NULL, + `COL41` text DEFAULT NULL, + `COL42` text DEFAULT NULL, + `COL43` text DEFAULT NULL, + `COL44` text DEFAULT NULL, + `COL45` text DEFAULT NULL, + `COL46` text DEFAULT NULL, + `COL47` text DEFAULT NULL, + `COL48` text DEFAULT NULL, + `COL49` text DEFAULT NULL, + `COL50` text DEFAULT NULL, + `COL51` text DEFAULT NULL, + `COL52` text DEFAULT NULL, + `COL53` text DEFAULT NULL, + `COL54` text DEFAULT NULL, + `COL55` text DEFAULT NULL, + `COL56` text DEFAULT NULL, + `COL57` text DEFAULT NULL, + `COL58` text DEFAULT NULL, + `COL59` text DEFAULT NULL, + `COL60` text DEFAULT NULL, + `COL61` text DEFAULT NULL, + `COL62` text DEFAULT NULL, + `COL63` text DEFAULT NULL, + `COL64` text DEFAULT NULL, + `COL65` text DEFAULT NULL, + `COL66` text DEFAULT NULL, + `COL67` text DEFAULT NULL, + `COL68` text DEFAULT NULL, + `COL69` text DEFAULT NULL, + `COL70` text DEFAULT NULL, + `COL71` text DEFAULT NULL, + `COL72` text DEFAULT NULL, + `COL73` text DEFAULT NULL, + `COL74` text DEFAULT NULL, + `COL75` text DEFAULT NULL, + `COL76` text DEFAULT NULL, + `COL77` text DEFAULT NULL, + `COL78` text DEFAULT NULL, + `COL79` text DEFAULT NULL, + `COL80` text DEFAULT NULL, + `COL81` text DEFAULT NULL, + `COL82` text DEFAULT NULL, + `COL83` text DEFAULT NULL, + `COL84` text DEFAULT NULL, + `COL85` text DEFAULT NULL, + `COL86` text DEFAULT NULL, + `COL87` text DEFAULT NULL, + `COL88` text DEFAULT NULL, + `COL89` text DEFAULT NULL, + `COL90` text DEFAULT NULL, + `COL91` text DEFAULT NULL, + `COL92` text DEFAULT NULL, + `COL93` text DEFAULT NULL, + `COL94` text DEFAULT NULL, + `COL95` text DEFAULT NULL, + `COL96` text DEFAULT NULL, + `COL97` text DEFAULT NULL, + `COL98` text DEFAULT NULL, + `COL99` text DEFAULT NULL, + `COL100` text DEFAULT NULL, + `COL101` text DEFAULT NULL, + `COL102` text DEFAULT NULL, + `COL103` text DEFAULT NULL, + `COL104` text DEFAULT NULL, + `COL105` text DEFAULT NULL, + `COL106` text DEFAULT NULL, + `COL107` text DEFAULT NULL, + `COL108` text DEFAULT NULL, + `COL109` text DEFAULT NULL, + `COL110` text DEFAULT NULL, + `COL111` text DEFAULT NULL, + `COL112` text DEFAULT NULL, + `COL113` text DEFAULT NULL, + `COL114` text DEFAULT NULL, + `COL115` text DEFAULT NULL, + `COL116` text DEFAULT NULL, + `COL117` text DEFAULT NULL, + `COL118` text DEFAULT NULL, + `COL119` text DEFAULT NULL, + `COL120` text DEFAULT NULL, + `COL121` text DEFAULT NULL, + `COL122` text DEFAULT NULL, + `COL123` text DEFAULT NULL, + `COL124` text DEFAULT NULL, + `COL125` text DEFAULT NULL, + `COL126` text DEFAULT NULL, + `COL127` text DEFAULT NULL, + `COL128` text DEFAULT NULL, + `COL129` text DEFAULT NULL, + `COL130` text DEFAULT NULL, + `COL131` text DEFAULT NULL, + `COL132` text DEFAULT NULL, + `COL133` text DEFAULT NULL, + `COL134` text DEFAULT NULL, + `COL135` text DEFAULT NULL, + `COL136` text DEFAULT NULL, + `COL137` text DEFAULT NULL, + `COL138` text DEFAULT NULL, + `COL139` text DEFAULT NULL, + `COL140` text DEFAULT NULL, + `COL141` text DEFAULT NULL, + `COL142` text DEFAULT NULL, + `COL143` text DEFAULT NULL, + `COL144` text DEFAULT NULL, + `COL145` text DEFAULT NULL, + `COL146` text DEFAULT NULL, + `COL147` text DEFAULT NULL, + `COL148` text DEFAULT NULL, + `COL149` text DEFAULT NULL, + `COL150` text DEFAULT NULL, + `COL151` text DEFAULT NULL, + `COL152` text DEFAULT NULL, + `COL153` text DEFAULT NULL, + `COL154` text DEFAULT NULL, + `COL155` text DEFAULT NULL, + `COL156` text DEFAULT NULL, + `COL157` text DEFAULT NULL, + `COL158` text DEFAULT NULL, + `COL159` text DEFAULT NULL, + `COL160` text DEFAULT NULL, + `COL161` text DEFAULT NULL, + `COL162` text DEFAULT NULL, + `COL163` text DEFAULT NULL, + `COL164` text DEFAULT NULL, + `COL165` text DEFAULT NULL, + `COL166` text DEFAULT NULL, + `COL167` text DEFAULT NULL, + `COL168` text DEFAULT NULL, + `COL169` text DEFAULT NULL, + `COL170` text DEFAULT NULL, + `COL171` text DEFAULT NULL, + `COL172` text DEFAULT NULL, + `COL173` text DEFAULT NULL, + `COL174` text DEFAULT NULL, + `COL175` text DEFAULT NULL, + `COL176` text DEFAULT NULL, + `COL177` text DEFAULT NULL, + `COL178` text DEFAULT NULL, + `COL179` text DEFAULT NULL, + `COL180` text DEFAULT NULL, + `COL181` text DEFAULT NULL, + `COL182` text DEFAULT NULL, + `COL183` text DEFAULT NULL, + `COL184` text DEFAULT NULL, + `COL185` text DEFAULT NULL, + `COL186` text DEFAULT NULL, + `COL187` text DEFAULT NULL, + `COL188` text DEFAULT NULL, + `COL189` text DEFAULT NULL, + `COL190` text DEFAULT NULL, + `COL191` text DEFAULT NULL, + `COL192` text DEFAULT NULL, + `COL193` text DEFAULT NULL, + `COL194` text DEFAULT NULL, + `COL195` text DEFAULT NULL, + `COL196` text DEFAULT NULL, + `COL197` text DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +update t2 set col150=@a; +update t2 set col145=@b; +drop table t2; diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result new file mode 100644 index 00000000..1f3b41f7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result @@ -0,0 +1,288 @@ +CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, +h blob,i blob,j blob,k blob,l blob,m blob,n blob, +o blob,p blob,q blob,r blob,s blob,t blob,u blob, +v blob, w blob, x blob, y blob, z blob, +aa blob,ba blob,ca blob,da blob,ea blob,fa blob,ga blob, +ha blob,ia blob,ja blob,ka blob,la blob,ma blob,na blob, +oa blob,pa blob,qa blob,ra blob,sa blob,ta blob,ua blob, +va blob, wa blob, xa blob, ya blob, za blob, +ab blob,bb blob,cb blob,db blob,eb blob,fb blob,gb blob, +hb blob,ib blob,jb blob,kb blob,lb blob,mb blob,nb blob, +ob blob,pb blob,qb blob,rb blob,sb blob,tb blob,ub blob, +vb blob, wb blob, xb blob, yb blob, zb blob, +ac blob, bc blob, cc blob, dc blob, ec blob,fc blob,gc blob, +hc blob, ic blob, jc blob, kc blob, lc blob,mc blob,nc blob, +oc blob, pc blob, qc blob, rc blob, sc blob,tc blob,uc blob, +vc blob, wc blob, xc blob, yc blob, zc blob +) ENGINE=InnoDB ROW_FORMAT=dynamic; +SET innodb_strict_mode=OFF; +CREATE TABLE t2(a blob,b blob,c blob,d blob,e blob,f blob,g blob, +h blob,i blob,j blob,k blob,l blob,m blob,n blob, +o blob,p blob,q blob,r blob,s blob,t blob,u blob, +v blob, w blob, x blob, y blob, z blob, +aa blob,ba blob,ca blob,da blob,ea blob,fa blob,ga blob, +ha blob,ia blob,ja blob,ka blob,la blob,ma blob,na blob, +oa blob,pa blob,qa blob,ra blob,sa blob,ta blob,ua blob, +va blob, wa blob, xa blob, ya blob, za blob, +ab blob,bb blob,cb blob,db blob,eb blob,fb blob,gb blob, +hb blob,ib blob,jb blob,kb blob,lb blob,mb blob,nb blob, +ob blob,pb blob,qb blob,rb blob,sb blob,tb blob,ub blob, +vb blob, wb blob, xb blob, yb blob, zb blob, +ac blob, bc blob, cc blob, dc blob, ec blob,fc blob,gc blob, +hc blob, ic blob, jc blob, kc blob, lc blob,mc blob,nc blob, +oc blob, pc blob, qc blob, rc blob, sc blob,tc blob,uc blob, +vc blob, wc blob, xc blob, yc blob, zc blob +) ENGINE=InnoDB ROW_FORMAT=compact; +Warnings: +Warning 139 Row size too large (> 32702). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +SET innodb_strict_mode=ON; +SET @a = repeat('a', 767); +SET @b = repeat('b', 767); +SET @c = repeat('c', 767); +SET @d = repeat('d', 767); +SET @e = repeat('e', 767); +SET @f = repeat('f', 767); +SET @f = repeat('g', 767); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a +); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a +); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a +); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a +); +SET @h = repeat('h', 100); +SET @i = repeat('i', 100); +SET @j = repeat('j', 100); +SET @k = repeat('k', 100); +SET @l = repeat('l', 100); +INSERT INTO t2 VALUES (@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h,@h,@h, +@h,@h,@h,@h,@h +); +UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b, +k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b, +v=@b,w=@b,x=@b,y=@b,z=@b, +aa=@b,ba=@b,ca=@b,da=@b,ea=@b,fa=@b,ga=@b,ha=@b,ia=@b,ja=@b, +ka=@b,la=@b,ma=@b,na=@b,oa=@b,pa=@b,qa=@b,ra=@b,sa=@b,ta=@b,ua=@b, +va=@b,wa=@b,xa=@b,ya=@b,za=@b, +ab=@b,bb=@b,cb=@b,db=@b,eb=@b,fb=@b,gb=@b,hb=@b,ib=@b,jb=@b, +kb=@b,lb=@b,mb=@b,nb=@b,ob=@b,pb=@b,qb=@b,rb=@b,sb=@b,tb=@b,ub=@b, +vb=@b,wb=@b,xb=@b,yb=@b,zb=@b, +ab=@b,bb=@b,cb=@b,db=@b,eb=@b,fb=@b,gb=@b,hb=@b,ib=@b,jb=@b, +kb=@b,lb=@b,mb=@b,nb=@b,ob=@b,pb=@b,qb=@b,rb=@b,sb=@b,tb=@b,ub=@b, +vb=@b,wb=@b,xb=@b,yb=@b,zb=@b, +ac=@b,bc=@b,cc=@b,dc=@b,ec=@b,fc=@b,gc=@b,hc=@b,ic=@b,jc=@b, +kc=@b,lc=@b,mc=@b,nc=@b,oc=@b,pc=@b,qc=@b,rc=@b,sc=@b,tc=@b,uc=@b, +vc=@b,wc=@b,xc=@b,yc=@b,zc=@b; +UPDATE t2 SET a=@i,b=@i,c=@i,d=@i,e=@i,f=@i,g=@i,h=@i,i=@i,j=@i, +k=@i,l=@i,m=@i,n=@i,o=@i,p=@i,q=@i,r=@i,s=@i,t=@i,u=@i, +v=@i,w=@i,x=@i,y=@i,z=@i, +aa=@i,ba=@i,ca=@i,da=@i,ea=@i,fa=@i,ga=@i,ha=@i,ia=@i,ja=@i, +ka=@i,la=@i,ma=@i,na=@i,oa=@i,pa=@i,qa=@i,ra=@i,sa=@i,ta=@i,ua=@i, +va=@i,wa=@i,xa=@i,ya=@i,za=@i, +ab=@i,bb=@i,cb=@i,db=@i,eb=@i,fb=@i,gb=@i,hb=@i,ib=@i,jb=@i, +kb=@i,lb=@i,mb=@i,nb=@i,ob=@i,pb=@i,qb=@i,rb=@i,sb=@i,tb=@i,ub=@i, +vb=@i,wb=@i,xb=@i,yb=@i,zb=@i, +ab=@i,bb=@i,cb=@i,db=@i,eb=@i,fb=@i,gb=@i,hb=@i,ib=@i,jb=@i, +kb=@i,lb=@i,mb=@i,nb=@i,ob=@i,pb=@i,qb=@i,rb=@i,sb=@i,tb=@i,ub=@i, +vb=@i,wb=@i,xb=@i,yb=@i,zb=@i, +ac=@i,bc=@i,cc=@i,dc=@i,ec=@i,fc=@i,gc=@i,hc=@i,ic=@i,jc=@i, +kc=@i,lc=@i,mc=@i,nc=@i,oc=@i,pc=@i,qc=@i,rc=@i,sc=@i,tc=@i,uc=@i, +vc=@i,wc=@i,xc=@i,yc=@i,zc=@i; +CREATE INDEX t1a ON t1 (a(767),b(767)); +CREATE INDEX t1c ON t1 (c(767),d(767)); +CREATE INDEX t1e ON t1 (e(767),f(767)); +CREATE INDEX t1f2 ON t1 (g(767),h(767)); +CREATE INDEX t1f4 ON t1 (i(767),j(767)); +CREATE INDEX t1k ON t1 (k(767),m(767)); +CREATE INDEX t1f8 ON t1 (n(767),o(767)); +CREATE INDEX t1f11 ON t1 (p(767),q(767)); +CREATE INDEX t1f13 ON t1 (r(767),s(767)); +CREATE INDEX t1f15 ON t1 (t(767),u(767)); +CREATE INDEX t1f18 ON t1 (w(767),x(767)); +CREATE INDEX t1f20 ON t1 (y(767),z(767)); +CREATE INDEX ta1a6 ON t1 (aa(767),ba(767)); +CREATE INDEX tc1c6 ON t1 (ca(767),da(767)); +CREATE INDEX te1e6 ON t1 (ea(767),fa(767)); +CREATE INDEX t2a ON t2 (a(767),b(767)); +CREATE INDEX t2c ON t2 (c(767),d(767)); +CREATE INDEX t2e ON t2 (e(767),f(767)); +CREATE INDEX t2f2 ON t2 (g(767),h(767)); +CREATE INDEX t2f4 ON t2 (i(767),j(767)); +CREATE INDEX t2k ON t2 (k(767),m(767)); +CREATE INDEX t2f8 ON t2 (n(767),o(767)); +CREATE INDEX t2f11 ON t2 (p(767),q(767)); +CREATE INDEX t2f13 ON t2 (r(767),s(767)); +CREATE INDEX t2f15 ON t2 (t(767),u(767)); +CREATE INDEX t2f18 ON t2 (w(767),x(767)); +CREATE INDEX t2f20 ON t2 (y(767),z(767)); +CREATE INDEX ta2a6 ON t2 (aa(767),ba(767)); +CREATE INDEX tc2c6 ON t2 (ca(767),da(767)); +CREATE INDEX te2e6 ON t2 (ea(767),fa(767)); +UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, +k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c, +v=@c,w=@c,x=@c,y=@c,z=@c, +aa=@c,ba=@c,ca=@c,da=@c,ea=@c,fa=@c,ga=@c,ha=@c,ia=@c,ja=@c, +ka=@c,la=@c,ma=@c,na=@c,oa=@c,pa=@c,qa=@c,ra=@c,sa=@c,ta=@c,ua=@c, +va=@c,wa=@c,xa=@c,ya=@c,za=@c, +ab=@c,bb=@c,cb=@c,db=@c,eb=@c,fb=@c,gb=@c,hb=@c,ib=@c,jb=@c, +kb=@c,lb=@c,mb=@c,nb=@c,ob=@c,pb=@c,qb=@c,rb=@c,sb=@c,tb=@c,ub=@c, +vb=@c,wb=@c,xb=@c,yb=@c,zb=@c, +ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c, +kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c, +vc=@c,wc=@c,xc=@c,yc=@c,zc=@c; +UPDATE t2 SET a=@k,b=@k,c=@k,d=@k,e=@k,f=@k,g=@k,h=@k,i=@k,j=@k, +k=@k,l=@k,m=@k,n=@k,o=@k,p=@k,q=@k,r=@k,s=@k,t=@k,u=@k, +v=@k,w=@k,x=@k,y=@k,z=@k, +aa=@k,ba=@k,ca=@k,da=@k,ea=@k,fa=@k,ga=@k,ha=@k,ia=@k,ja=@k, +ka=@k,la=@k,ma=@k,na=@k,oa=@k,pa=@k,qa=@k,ra=@k,sa=@k,ta=@k,ua=@k, +va=@k,wa=@k,xa=@k,ya=@k,za=@k, +ab=@k,bb=@k,cb=@k,db=@k,eb=@k,fb=@k,gb=@k,hb=@k,ib=@k,jb=@k, +kb=@k,lb=@k,mb=@k,nb=@k,ob=@k,pb=@k,qb=@k,rb=@k,sb=@k,tb=@k,ub=@k, +vb=@k,wb=@k,xb=@k,yb=@k,zb=@k, +ac=@k,bc=@k,cc=@k,dc=@k,ec=@k,fc=@k,gc=@k,hc=@k,ic=@k,jc=@k, +kc=@k,lc=@k,mc=@k,nc=@k,oc=@k,pc=@k,qc=@k,rc=@k,sc=@k,tc=@k,uc=@k, +vc=@k,wc=@k,xc=@k,yc=@k,zc=@k; +COMMIT; +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d; +UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d; +UPDATE t1 SET k=@d,l=@d,m=@d,n=@d,o=@d; +UPDATE t1 SET p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; +UPDATE t1 SET v=@d,w=@d,x=@d,y=@d,z=@d; +UPDATE t1 SET aa=@d,ba=@d,ca=@d,da=@d; +UPDATE t1 SET ea=@d,fa=@d,ga=@d,ha=@d,ia=@d,ja=@d; +UPDATE t1 SET ka=@d,la=@d,ma=@d,na=@d,oa=@d,pa=@d; +UPDATE t1 SET qa=@d,ra=@d,sa=@d,ta=@d,ua=@d; +UPDATE t1 SET va=@d,wa=@d,xa=@d,ya=@d,za=@d; +UPDATE t1 SET ab=@d,bb=@d,cb=@d,db=@d; +UPDATE t1 SET eb=@d,fb=@d,gb=@d,hb=@d,ib=@d,ja=@d; +UPDATE t1 SET kb=@d,lb=@d,mb=@d,nb=@d,ob=@d,pa=@d; +UPDATE t1 SET qb=@d,rb=@d,sb=@d,tb=@d,ub=@d; +UPDATE t1 SET vb=@d,wb=@d,xb=@d,yb=@d,zb=@d; +UPDATE t1 SET ac=@d,bc=@d,cc=@d,dc=@d; +UPDATE t1 SET ec=@d,fc=@d,gc=@d,hc=@d,ic=@d,jc=@d; +UPDATE t1 SET kc=@d,lc=@d,mc=@d,nc=@d,oc=@d,pc=@d; +UPDATE t1 SET qc=@d,rc=@d,sc=@d,tc=@d,uc=@d; +UPDATE t1 SET vc=@d,wc=@d,xc=@d,yc=@d,zc=@d; +COMMIT; +BEGIN; +UPDATE t2 SET a=@i,b=@i,c=@i,d=@i,e=@i; +UPDATE t2 SET f=@i,g=@i,h=@i,i=@i,j=@i; +UPDATE t2 SET k=@i,l=@i,m=@i,n=@i,o=@i; +UPDATE t2 SET p=@i,q=@i,r=@i,s=@i,t=@i,u=@i; +UPDATE t2 SET v=@i,w=@i,x=@i,y=@i,z=@i; +UPDATE t2 SET aa=@i,ba=@i,ca=@i,da=@i; +UPDATE t2 SET ea=@i,fa=@i,ga=@i,ha=@i,ia=@i,ja=@i; +UPDATE t2 SET ka=@i,la=@i,ma=@i,na=@i,oa=@i,pa=@i; +UPDATE t2 SET qa=@i,ra=@i,sa=@i,ta=@i,ua=@i; +UPDATE t2 SET va=@i,wa=@i,xa=@i,ya=@i,za=@i; +UPDATE t2 SET ab=@i,bb=@i,cb=@i,db=@i; +UPDATE t2 SET eb=@i,fb=@i,gb=@i,hb=@i,ib=@i,ja=@i; +UPDATE t2 SET kb=@i,lb=@i,mb=@i,nb=@i,ob=@i,pa=@i; +UPDATE t2 SET qb=@i,rb=@i,sb=@i,tb=@i,ub=@i; +UPDATE t2 SET vb=@i,wb=@i,xb=@i,yb=@i,zb=@i; +UPDATE t2 SET ac=@i,bc=@i,cc=@i,dc=@i; +UPDATE t2 SET ec=@i,fc=@i,gc=@i,hc=@i,ic=@i,jc=@i; +UPDATE t2 SET kc=@i,lc=@i,mc=@i,nc=@i,oc=@i,pc=@i; +UPDATE t2 SET qc=@i,rc=@i,sc=@i,tc=@i,uc=@i; +UPDATE t2 SET vc=@i,wc=@i,xc=@i,yc=@i,zc=@i; +COMMIT; +BEGIN; +UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, +k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c, +v=@c,w=@c,x=@c,y=@c,z=@c, +aa=@c,ba=@c,ca=@c,da=@c,ea=@c,fa=@c,ga=@c,ha=@c,ia=@c,ja=@c, +ka=@c,la=@c,ma=@c,na=@c,oa=@c,pa=@c,qa=@c,ra=@c,sa=@c,ta=@c,ua=@c, +va=@c,wa=@c,xa=@c,ya=@c,za=@c, +ab=@c,bb=@c,cb=@c,db=@c,eb=@c,fb=@c,gb=@c,hb=@c,ib=@c,jb=@c, +kb=@c,lb=@c,mb=@c,nb=@c,ob=@c,pb=@c,qb=@c,rb=@c,sb=@c,tb=@c,ub=@c, +vb=@c,wb=@c,xb=@c,yb=@c,zb=@c, +ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c, +kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c, +vc=@c,wc=@c,xc=@c,yc=@c,zc=@c; +connect con1,localhost,root,,; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t2 LIMIT 1; +disconnect con1; +connection default; +# restart +check table t1,t2; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +drop table t1,t2; diff --git a/mysql-test/suite/innodb/r/innodb-64k.result b/mysql-test/suite/innodb/r/innodb-64k.result new file mode 100644 index 00000000..75817956 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-64k.result @@ -0,0 +1,1092 @@ +call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); +# Test 1) Show the page size from Information Schema +SELECT variable_value FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_page_size'; +variable_value +65536 +# Test 4) The maximum row size is dependent upon the page size. +SET SESSION innodb_strict_mode = ON; +SELECT @@innodb_strict_mode; +@@innodb_strict_mode +1 +CREATE TABLE tab5(col1 CHAR (255), col2 CHAR (255), col3 CHAR(255),col4 CHAR(255), col5 CHAR(255), +col6 CHAR(255), col7 CHAR(255), col8 CHAR(255), col9 CHAR(255),col10 CHAR(255), col11 CHAR(255), +col12 CHAR(255), col13 CHAR(255),col14 CHAR(255),col15 CHAR(255),col16 CHAR(255), col17 CHAR(255), +col18 CHAR(255),col19 CHAR(255),col20 CHAR(255),col21 CHAR(255),col22 CHAR(255), col23 CHAR(255), +col24 CHAR(255),col25 CHAR(255),col26 CHAR(255),col27 CHAR(255),col28 CHAR(255), col29 CHAR(255), +col30 CHAR(255),col31 CHAR(255),col32 CHAR(255),col33 CHAR(255),col34 CHAR(255), col35 CHAR(255), +col36 CHAR(255),col37 CHAR(255),col38 CHAR(255),col39 CHAR(255),col40 CHAR(255), col41 CHAR(255), +col42 CHAR(255),col43 CHAR(255),col44 CHAR(255),col45 CHAR(255),col46 CHAR(255), col47 CHAR(255), +col48 CHAR(255),col49 CHAR(255),col50 CHAR(255),col51 CHAR(255),col52 CHAR(255), col53 CHAR(255), +col54 CHAR(255),col55 CHAR(255),col56 CHAR(255),col57 CHAR(255),col58 CHAR(255), col59 CHAR(255), +col60 CHAR(255),col61 CHAR(255),col62 CHAR(255),col63 CHAR(255),col64 CHAR(255), col65 CHAR(255)) +ENGINE = innodb ROW_FORMAT=REDUNDANT; +ERROR 42000: Row size too large (> 16382). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +show warnings; +Level Code Message +Error 1118 Row size too large (> 16382). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +Warning 1030 Got error 139 "Too big row" from storage engine InnoDB +CREATE TABLE t1 ( +c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), +c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), +c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), +c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), +c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), +c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), +c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), +c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(200), +c41 char(200), c42 char(200), c43 char(200), c44 char(200), c45 char(200), +c46 char(200), c47 char(200), c48 char(200), c49 char(200), c50 char(200), +c51 char(200), c52 char(200), c53 char(200), c54 char(200), c55 char(200), +c56 char(200), c57 char(200), c58 char(200), c59 char(200), c60 char(200), +c61 char(200), c62 char(200), c63 char(200), c64 char(200), c65 char(200), +c66 char(200), c67 char(200), c68 char(200), c69 char(200), c70 char(200), +c71 char(200), c72 char(200), c73 char(200), c74 char(200), c75 char(200), +c76 char(200), c77 char(200), c78 char(200), c79 char(200), c80 char(200), +c101 char(200), c102 char(200), c103 char(200), c104 char(200), c105 char(200), +c106 char(200), c107 char(200), c108 char(200), c109 char(200), c110 char(200), +c111 char(200), c112 char(200), c113 char(200), c114 char(200), c115 char(200), +c116 char(200), c117 char(200), c118 char(200), c119 char(200), c120 char(200), +c121 char(200), c122 char(200), c123 char(200), c124 char(200), c125 char(200), +c126 char(200), c127 char(200), c128 char(200), c129 char(200), c130 char(200), +c131 char(200), c132 char(200), c133 char(200), c134 char(200), c135 char(200), +c136 char(200), c137 char(200), c138 char(200), c139 char(200), c140 char(200), +c141 char(200), c142 char(200), c143 char(200), c144 char(200), c145 char(200), +c146 char(200), c147 char(200), c148 char(200), c149 char(200), c150 char(200), +c151 char(200), c152 char(200), c153 char(200), c154 char(200), c155 char(200), +c156 char(200), c157 char(200), c158 char(200), c159 char(200), c160 char(200), +c161 char(200), c162 char(200), c163 char(200), c164 char(200), c165 char(200), +c166 char(200), c167 char(200), c168 char(200), c169 char(200), c170 char(200), +c171 char(200), c172 char(200), c173 char(200), c174 char(200), c175 char(200), +c176 char(200), c177 char(200), c178 char(200), c179 char(200), c180 char(200), +c190 char(200), c191 char(200), c192 char(100), +c81 char(156) +) ROW_FORMAT=compact; +DROP TABLE t1; +CREATE TABLE t1 ( +c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), +c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), +c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), +c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), +c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), +c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), +c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), +c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(200), +c41 char(200), c42 char(200), c43 char(200), c44 char(200), c45 char(200), +c46 char(200), c47 char(200), c48 char(200), c49 char(200), c50 char(200), +c51 char(200), c52 char(200), c53 char(200), c54 char(200), c55 char(200), +c56 char(200), c57 char(200), c58 char(200), c59 char(200), c60 char(200), +c61 char(200), c62 char(200), c63 char(200), c64 char(200), c65 char(200), +c66 char(200), c67 char(200), c68 char(200), c69 char(200), c70 char(200), +c71 char(200), c72 char(200), c73 char(200), c74 char(200), c75 char(200), +c76 char(200), c77 char(200), c78 char(200), c79 char(200), c80 char(200), +c101 char(200), c102 char(200), c103 char(200), c104 char(200), c105 char(200), +c106 char(200), c107 char(200), c108 char(200), c109 char(200), c110 char(200), +c111 char(200), c112 char(200), c113 char(200), c114 char(200), c115 char(200), +c116 char(200), c117 char(200), c118 char(200), c119 char(200), c120 char(200), +c121 char(200), c122 char(200), c123 char(200), c124 char(200), c125 char(200), +c126 char(200), c127 char(200), c128 char(200), c129 char(200), c130 char(200), +c131 char(200), c132 char(200), c133 char(200), c134 char(200), c135 char(200), +c136 char(200), c137 char(200), c138 char(200), c139 char(200), c140 char(200), +c141 char(200), c142 char(200), c143 char(200), c144 char(200), c145 char(200), +c146 char(200), c147 char(200), c148 char(200), c149 char(200), c150 char(200), +c151 char(200), c152 char(200), c153 char(200), c154 char(200), c155 char(200), +c156 char(200), c157 char(200), c158 char(200), c159 char(200), c160 char(200), +c161 char(200), c162 char(200), c163 char(200), c164 char(200), c165 char(200), +c166 char(200), c167 char(200), c168 char(200), c169 char(200), c170 char(200), +c171 char(200), c172 char(200), c173 char(200), c174 char(200), c175 char(200), +c176 char(200), c177 char(200), c178 char(200), c179 char(200), c180 char(200), +c190 char(200), c191 char(200), c192 char(100), +c81 char(157) +) ROW_FORMAT=compact; +ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +CREATE TABLE t1 ( +c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), +c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), +c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), +c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), +c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), +c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), +c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), +c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(200), +c41 char(200), c42 char(200), c43 char(200), c44 char(200), c45 char(200), +c46 char(200), c47 char(200), c48 char(200), c49 char(200), c50 char(200), +c51 char(200), c52 char(200), c53 char(200), c54 char(200), c55 char(200), +c56 char(200), c57 char(200), c58 char(200), c59 char(200), c60 char(200), +c61 char(200), c62 char(200), c63 char(200), c64 char(200), c65 char(200), +c66 char(200), c67 char(200), c68 char(200), c69 char(200), c70 char(200), +c71 char(200), c72 char(200), c73 char(200), c74 char(200), c75 char(200), +c76 char(200), c77 char(200), c78 char(200), c79 char(200), c80 char(200), +c101 char(200), c102 char(200), c103 char(200), c104 char(200), c105 char(200), +c106 char(200), c107 char(200), c108 char(200), c109 char(200), c110 char(200), +c111 char(200), c112 char(200), c113 char(200), c114 char(200), c115 char(200), +c116 char(200), c117 char(200), c118 char(200), c119 char(200), c120 char(200), +c121 char(200), c122 char(200), c123 char(200), c124 char(200), c125 char(200), +c126 char(200), c127 char(200), c128 char(200), c129 char(200), c130 char(200), +c131 char(200), c132 char(200), c133 char(200), c134 char(200), c135 char(200), +c136 char(200), c137 char(200), c138 char(200), c139 char(200), c140 char(200), +c141 char(200), c142 char(200), c143 char(200), c144 char(200), c145 char(200), +c146 char(200), c147 char(200), c148 char(200), c149 char(200), c150 char(200), +c151 char(200), c152 char(200), c153 char(200), c154 char(200), c155 char(200), +c156 char(200), c157 char(200), c158 char(200), c159 char(200), c160 char(200), +c161 char(200), c162 char(200), c163 char(200), c164 char(200), c165 char(200), +c166 char(200), c167 char(200), c168 char(200), c169 char(200), c170 char(200), +c171 char(200), c172 char(200), c173 char(200), c174 char(200), c175 char(200), +c176 char(200), c177 char(200), c178 char(200), c179 char(200), c180 char(200), +c190 char(200), c191 char(200), c192 char(100), +c81 char(156) +) ROW_FORMAT=dynamic; +DROP TABLE t1; +CREATE TABLE t1 ( +c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), +c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), +c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), +c16 char(200), c17 char(200), c18 char(200), c19 char(200), c20 char(200), +c21 char(200), c22 char(200), c23 char(200), c24 char(200), c25 char(200), +c26 char(200), c27 char(200), c28 char(200), c29 char(200), c30 char(200), +c31 char(200), c32 char(200), c33 char(200), c34 char(200), c35 char(200), +c36 char(200), c37 char(200), c38 char(200), c39 char(200), c40 char(200), +c41 char(200), c42 char(200), c43 char(200), c44 char(200), c45 char(200), +c46 char(200), c47 char(200), c48 char(200), c49 char(200), c50 char(200), +c51 char(200), c52 char(200), c53 char(200), c54 char(200), c55 char(200), +c56 char(200), c57 char(200), c58 char(200), c59 char(200), c60 char(200), +c61 char(200), c62 char(200), c63 char(200), c64 char(200), c65 char(200), +c66 char(200), c67 char(200), c68 char(200), c69 char(200), c70 char(200), +c71 char(200), c72 char(200), c73 char(200), c74 char(200), c75 char(200), +c76 char(200), c77 char(200), c78 char(200), c79 char(200), c80 char(200), +c101 char(200), c102 char(200), c103 char(200), c104 char(200), c105 char(200), +c106 char(200), c107 char(200), c108 char(200), c109 char(200), c110 char(200), +c111 char(200), c112 char(200), c113 char(200), c114 char(200), c115 char(200), +c116 char(200), c117 char(200), c118 char(200), c119 char(200), c120 char(200), +c121 char(200), c122 char(200), c123 char(200), c124 char(200), c125 char(200), +c126 char(200), c127 char(200), c128 char(200), c129 char(200), c130 char(200), +c131 char(200), c132 char(200), c133 char(200), c134 char(200), c135 char(200), +c136 char(200), c137 char(200), c138 char(200), c139 char(200), c140 char(200), +c141 char(200), c142 char(200), c143 char(200), c144 char(200), c145 char(200), +c146 char(200), c147 char(200), c148 char(200), c149 char(200), c150 char(200), +c151 char(200), c152 char(200), c153 char(200), c154 char(200), c155 char(200), +c156 char(200), c157 char(200), c158 char(200), c159 char(200), c160 char(200), +c161 char(200), c162 char(200), c163 char(200), c164 char(200), c165 char(200), +c166 char(200), c167 char(200), c168 char(200), c169 char(200), c170 char(200), +c171 char(200), c172 char(200), c173 char(200), c174 char(200), c175 char(200), +c176 char(200), c177 char(200), c178 char(200), c179 char(200), c180 char(200), +c190 char(200), c191 char(200), c192 char(100), +c81 char(157) +) ROW_FORMAT=dynamic; +ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +# Test 8) Test creating a table that could lead to undo log overflow. +CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, +h blob,i blob,j blob,k blob,l blob,m blob,n blob, +o blob,p blob,q blob,r blob,s blob,t blob,u blob, +v blob, w blob, x blob, y blob, z blob, +aa blob,ba blob,ca blob,da blob,ea blob,fa blob,ga blob, +ha blob,ia blob,ja blob,ka blob,la blob,ma blob,na blob, +oa blob,pa blob,qa blob,ra blob,sa blob,ta blob,ua blob, +va blob, wa blob, xa blob, ya blob, za blob, +ab blob,bb blob,cb blob,db blob,eb blob,fb blob,gb blob, +hb blob,ib blob,jb blob,kb blob,lb blob,mb blob,nb blob, +ob blob,pb blob,qb blob,rb blob,sb blob,tb blob,ub blob, +vb blob, wb blob, xb blob, yb blob, zb blob, +ac blob, bc blob, cc blob, dc blob, ec blob,fc blob,gc blob, +hc blob, ic blob, jc blob, kc blob, lc blob,mc blob,nc blob, +oc blob, pc blob, qc blob, rc blob, sc blob,tc blob,uc blob, +vc blob, wc blob, xc blob, yc blob, zc blob +) ENGINE=InnoDB ROW_FORMAT=dynamic; +SET @a = repeat('a', 767); +SET @b = repeat('b', 767); +SET @c = repeat('c', 767); +SET @d = repeat('d', 767); +SET @e = repeat('e', 767); +INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a +); +UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b, +k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b, +v=@b,w=@b,x=@b,y=@b,z=@b, +aa=@b,ba=@b,ca=@b,da=@b,ea=@b,fa=@b,ga=@b,ha=@b,ia=@b,ja=@b, +ka=@b,la=@b,ma=@b,na=@b,oa=@b,pa=@b,qa=@b,ra=@b,sa=@b,ta=@b,ua=@b, +va=@b,wa=@b,xa=@b,ya=@b,za=@b, +ab=@b,bb=@b,cb=@b,db=@b,eb=@b,fb=@b,gb=@b,hb=@b,ib=@b,jb=@b, +kb=@b,lb=@b,mb=@b,nb=@b,ob=@b,pb=@b,qb=@b,rb=@b,sb=@b,tb=@b,ub=@b, +vb=@b,wb=@b,xb=@b,yb=@b,zb=@b, +ab=@b,bb=@b,cb=@b,db=@b,eb=@b,fb=@b,gb=@b,hb=@b,ib=@b,jb=@b, +kb=@b,lb=@b,mb=@b,nb=@b,ob=@b,pb=@b,qb=@b,rb=@b,sb=@b,tb=@b,ub=@b, +vb=@b,wb=@b,xb=@b,yb=@b,zb=@b, +ac=@b,bc=@b,cc=@b,dc=@b,ec=@b,fc=@b,gc=@b,hc=@b,ic=@b,jc=@b, +kc=@b,lc=@b,mc=@b,nc=@b,oc=@b,pc=@b,qc=@b,rc=@b,sc=@b,tc=@b,uc=@b, +vc=@b,wc=@b,xc=@b,yc=@b,zc=@b; +CREATE INDEX t1a ON t1 (a(767),b(767)); +CREATE INDEX t1c ON t1 (c(767),d(767)); +CREATE INDEX t1e ON t1 (e(767),f(767)); +CREATE INDEX t1f2 ON t1 (g(767),h(767)); +CREATE INDEX t1f4 ON t1 (i(767),j(767)); +CREATE INDEX t1k ON t1 (k(767),m(767)); +CREATE INDEX t1f8 ON t1 (n(767),o(767)); +CREATE INDEX t1f11 ON t1 (p(767),q(767)); +CREATE INDEX t1f13 ON t1 (r(767),s(767)); +CREATE INDEX t1f15 ON t1 (t(767),u(767)); +CREATE INDEX t1f18 ON t1 (w(767),x(767)); +CREATE INDEX t1f20 ON t1 (y(767),z(767)); +CREATE INDEX ta1a6 ON t1 (aa(767),ba(767)); +CREATE INDEX tc1c6 ON t1 (ca(767),da(767)); +CREATE INDEX te1e6 ON t1 (ea(767),fa(767)); +UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, +k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c, +v=@c,w=@c,x=@c,y=@c,z=@c, +aa=@c,ba=@c,ca=@c,da=@c,ea=@c,fa=@c,ga=@c,ha=@c,ia=@c,ja=@c, +ka=@c,la=@c,ma=@c,na=@c,oa=@c,pa=@c,qa=@c,ra=@c,sa=@c,ta=@c,ua=@c, +va=@c,wa=@c,xa=@c,ya=@c,za=@c, +ab=@c,bb=@c,cb=@c,db=@c,eb=@c,fb=@c,gb=@c,hb=@c,ib=@c,jb=@c, +kb=@c,lb=@c,mb=@c,nb=@c,ob=@c,pb=@c,qb=@c,rb=@c,sb=@c,tb=@c,ub=@c, +vb=@c,wb=@c,xb=@c,yb=@c,zb=@c, +ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c, +kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c, +vc=@c,wc=@c,xc=@c,yc=@c,zc=@c; +COMMIT; +CREATE INDEX tg1f2 ON t1 (ia(767),ja(767)); +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d, +k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d, +v=@d,w=@d,x=@d,y=@d,z=@d, +aa=@d,ba=@d,ca=@d,da=@d,ea=@d,fa=@d,ga=@d,ha=@d,ia=@d,ja=@d, +ka=@d,la=@d,ma=@d,na=@d,oa=@d,pa=@d,qa=@d,ra=@d,sa=@d,ta=@d,ua=@d, +va=@d,wa=@d,xa=@d,ya=@d,za=@d, +ab=@d,bb=@d,cb=@d,db=@d,eb=@d,fb=@d,gb=@d,hb=@d,ib=@d,jb=@d, +kb=@d,lb=@d,mb=@d,nb=@d,ob=@d,pb=@d,qb=@d,rb=@d,sb=@d,tb=@d,ub=@d, +vb=@d,wb=@d,xb=@d,yb=@d,zb=@d, +ac=@d,bc=@d,cc=@d,dc=@d,ec=@d,fc=@d,gc=@d,hc=@d,ic=@d,jc=@d, +kc=@d,lc=@d,mc=@d,nc=@d,oc=@d,pc=@d,qc=@d,rc=@d,sc=@d,tc=@d,uc=@d, +vc=@d,wc=@d,xc=@d,yc=@d,zc=@d; +ROLLBACK; +BEGIN; +UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d; +UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d; +UPDATE t1 SET k=@d,l=@d,m=@d,n=@d,o=@d; +UPDATE t1 SET p=@d,q=@d,r=@d,s=@d,t=@d,u=@d; +UPDATE t1 SET v=@d,w=@d,x=@d,y=@d,z=@d; +UPDATE t1 SET aa=@d,ba=@d,ca=@d,da=@d; +UPDATE t1 SET ea=@d,fa=@d,ga=@d,ha=@d,ia=@d,ja=@d; +UPDATE t1 SET ka=@d,la=@d,ma=@d,na=@d,oa=@d,pa=@d; +UPDATE t1 SET qa=@d,ra=@d,sa=@d,ta=@d,ua=@d; +UPDATE t1 SET va=@d,wa=@d,xa=@d,ya=@d,za=@d; +UPDATE t1 SET ab=@d,bb=@d,cb=@d,db=@d; +UPDATE t1 SET eb=@d,fb=@d,gb=@d,hb=@d,ib=@d,ja=@d; +UPDATE t1 SET kb=@d,lb=@d,mb=@d,nb=@d,ob=@d,pa=@d; +UPDATE t1 SET qb=@d,rb=@d,sb=@d,tb=@d,ub=@d; +UPDATE t1 SET vb=@d,wb=@d,xb=@d,yb=@d,zb=@d; +UPDATE t1 SET ac=@d,bc=@d,cc=@d,dc=@d; +UPDATE t1 SET ec=@d,fc=@d,gc=@d,hc=@d,ic=@d,jc=@d; +UPDATE t1 SET kc=@d,lc=@d,mc=@d,nc=@d,oc=@d,pc=@d; +UPDATE t1 SET qc=@d,rc=@d,sc=@d,tc=@d,uc=@d; +UPDATE t1 SET vc=@d,wc=@d,xc=@d,yc=@d,zc=@d; +COMMIT; +CREATE INDEX ti1f4 ON t1 (ia(767),ka(767)); +CREATE INDEX tk1f6 ON t1 (la(767),ma(767)); +CREATE INDEX tm1f8 ON t1 (na(767),oa(767)); +CREATE INDEX to1f11 ON t1 (pa(767),qa(767)); +CREATE INDEX tq1f13 ON t1 (ra(767),sa(767)); +CREATE INDEX ts1f15 ON t1 (ta(767),ua(767)); +CREATE INDEX tu1f18 ON t1 (wa(767),xa(767)); +CREATE INDEX tx1f20 ON t1 (ya(767),za(767)); +CREATE INDEX ta1a5 ON t1 (ab(767),bb(767)); +CREATE INDEX tc1c5 ON t1 (cb(767),db(767)); +CREATE INDEX te1e5 ON t1 (eb(767),fb(767)); +CREATE INDEX t5g1f2 ON t1 (gb(767),hb(767)); +CREATE INDEX t5i1f4 ON t1 (ib(767),kb(767)); +CREATE INDEX t5k1f6 ON t1 (lb(767),mb(767)); +CREATE INDEX t5m1f8 ON t1 (nb(767),ob(767)); +CREATE INDEX t5o1f11 ON t1 (pb(767),qb(767)); +CREATE INDEX t65q1f13 ON t1 (rb(767),sb(767)); +CREATE INDEX t65s1f15 ON t1 (tb(767),ub(767)); +CREATE INDEX t65u1f18 ON t1 (wb(767),xb(767)); +CREATE INDEX t65x1f20 ON t1 (yb(767),zb(767)); +CREATE INDEX xta1a5 ON t1 (ac(767),bc(767)); +CREATE INDEX xt5g1f2 ON t1 (gc(767),hc(767)); +CREATE INDEX xt5i1f4 ON t1 (ic(767)); +CREATE INDEX xtc1c5 ON t1 (cc(767),dc(767)); +CREATE INDEX xte1e5 ON t1 (ec(767),fc(767)); +UPDATE t1 SET t=@e; +CREATE INDEX xt5k1f6 ON t1 (lc(767),mc(767)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + `q` blob DEFAULT NULL, + `r` blob DEFAULT NULL, + `s` blob DEFAULT NULL, + `t` blob DEFAULT NULL, + `u` blob DEFAULT NULL, + `v` blob DEFAULT NULL, + `w` blob DEFAULT NULL, + `x` blob DEFAULT NULL, + `y` blob DEFAULT NULL, + `z` blob DEFAULT NULL, + `aa` blob DEFAULT NULL, + `ba` blob DEFAULT NULL, + `ca` blob DEFAULT NULL, + `da` blob DEFAULT NULL, + `ea` blob DEFAULT NULL, + `fa` blob DEFAULT NULL, + `ga` blob DEFAULT NULL, + `ha` blob DEFAULT NULL, + `ia` blob DEFAULT NULL, + `ja` blob DEFAULT NULL, + `ka` blob DEFAULT NULL, + `la` blob DEFAULT NULL, + `ma` blob DEFAULT NULL, + `na` blob DEFAULT NULL, + `oa` blob DEFAULT NULL, + `pa` blob DEFAULT NULL, + `qa` blob DEFAULT NULL, + `ra` blob DEFAULT NULL, + `sa` blob DEFAULT NULL, + `ta` blob DEFAULT NULL, + `ua` blob DEFAULT NULL, + `va` blob DEFAULT NULL, + `wa` blob DEFAULT NULL, + `xa` blob DEFAULT NULL, + `ya` blob DEFAULT NULL, + `za` blob DEFAULT NULL, + `ab` blob DEFAULT NULL, + `bb` blob DEFAULT NULL, + `cb` blob DEFAULT NULL, + `db` blob DEFAULT NULL, + `eb` blob DEFAULT NULL, + `fb` blob DEFAULT NULL, + `gb` blob DEFAULT NULL, + `hb` blob DEFAULT NULL, + `ib` blob DEFAULT NULL, + `jb` blob DEFAULT NULL, + `kb` blob DEFAULT NULL, + `lb` blob DEFAULT NULL, + `mb` blob DEFAULT NULL, + `nb` blob DEFAULT NULL, + `ob` blob DEFAULT NULL, + `pb` blob DEFAULT NULL, + `qb` blob DEFAULT NULL, + `rb` blob DEFAULT NULL, + `sb` blob DEFAULT NULL, + `tb` blob DEFAULT NULL, + `ub` blob DEFAULT NULL, + `vb` blob DEFAULT NULL, + `wb` blob DEFAULT NULL, + `xb` blob DEFAULT NULL, + `yb` blob DEFAULT NULL, + `zb` blob DEFAULT NULL, + `ac` blob DEFAULT NULL, + `bc` blob DEFAULT NULL, + `cc` blob DEFAULT NULL, + `dc` blob DEFAULT NULL, + `ec` blob DEFAULT NULL, + `fc` blob DEFAULT NULL, + `gc` blob DEFAULT NULL, + `hc` blob DEFAULT NULL, + `ic` blob DEFAULT NULL, + `jc` blob DEFAULT NULL, + `kc` blob DEFAULT NULL, + `lc` blob DEFAULT NULL, + `mc` blob DEFAULT NULL, + `nc` blob DEFAULT NULL, + `oc` blob DEFAULT NULL, + `pc` blob DEFAULT NULL, + `qc` blob DEFAULT NULL, + `rc` blob DEFAULT NULL, + `sc` blob DEFAULT NULL, + `tc` blob DEFAULT NULL, + `uc` blob DEFAULT NULL, + `vc` blob DEFAULT NULL, + `wc` blob DEFAULT NULL, + `xc` blob DEFAULT NULL, + `yc` blob DEFAULT NULL, + `zc` blob DEFAULT NULL, + KEY `t1a` (`a`(767),`b`(767)), + KEY `t1c` (`c`(767),`d`(767)), + KEY `t1e` (`e`(767),`f`(767)), + KEY `t1f2` (`g`(767),`h`(767)), + KEY `t1f4` (`i`(767),`j`(767)), + KEY `t1k` (`k`(767),`m`(767)), + KEY `t1f8` (`n`(767),`o`(767)), + KEY `t1f11` (`p`(767),`q`(767)), + KEY `t1f13` (`r`(767),`s`(767)), + KEY `t1f15` (`t`(767),`u`(767)), + KEY `t1f18` (`w`(767),`x`(767)), + KEY `t1f20` (`y`(767),`z`(767)), + KEY `ta1a6` (`aa`(767),`ba`(767)), + KEY `tc1c6` (`ca`(767),`da`(767)), + KEY `te1e6` (`ea`(767),`fa`(767)), + KEY `tg1f2` (`ia`(767),`ja`(767)), + KEY `ti1f4` (`ia`(767),`ka`(767)), + KEY `tk1f6` (`la`(767),`ma`(767)), + KEY `tm1f8` (`na`(767),`oa`(767)), + KEY `to1f11` (`pa`(767),`qa`(767)), + KEY `tq1f13` (`ra`(767),`sa`(767)), + KEY `ts1f15` (`ta`(767),`ua`(767)), + KEY `tu1f18` (`wa`(767),`xa`(767)), + KEY `tx1f20` (`ya`(767),`za`(767)), + KEY `ta1a5` (`ab`(767),`bb`(767)), + KEY `tc1c5` (`cb`(767),`db`(767)), + KEY `te1e5` (`eb`(767),`fb`(767)), + KEY `t5g1f2` (`gb`(767),`hb`(767)), + KEY `t5i1f4` (`ib`(767),`kb`(767)), + KEY `t5k1f6` (`lb`(767),`mb`(767)), + KEY `t5m1f8` (`nb`(767),`ob`(767)), + KEY `t5o1f11` (`pb`(767),`qb`(767)), + KEY `t65q1f13` (`rb`(767),`sb`(767)), + KEY `t65s1f15` (`tb`(767),`ub`(767)), + KEY `t65u1f18` (`wb`(767),`xb`(767)), + KEY `t65x1f20` (`yb`(767),`zb`(767)), + KEY `xta1a5` (`ac`(767),`bc`(767)), + KEY `xt5g1f2` (`gc`(767),`hc`(767)), + KEY `xt5i1f4` (`ic`(767)), + KEY `xtc1c5` (`cc`(767),`dc`(767)), + KEY `xte1e5` (`ec`(767),`fc`(767)), + KEY `xt5k1f6` (`lc`(767),`mc`(767)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SHOW WARNINGS; +Level Code Message +CREATE TABLE t2(COL1 TEXT, +COL2 TEXT, +COL3 TEXT, +COL4 TEXT, +COL5 TEXT, +COL6 TEXT, +COL7 TEXT, +COL8 TEXT, +COL9 TEXT, +COL10 TEXT, +COL11 TEXT, +COL12 TEXT, +COL13 TEXT, +COL14 TEXT, +COL15 TEXT, +COL16 TEXT, +COL17 TEXT, +COL18 TEXT, +COL19 TEXT, +COL20 TEXT, +COL21 TEXT, +COL22 TEXT, +COL23 TEXT, +COL24 TEXT, +COL25 TEXT, +COL26 TEXT, +COL27 TEXT, +COL28 TEXT, +COL29 TEXT, +COL30 TEXT, +COL31 TEXT, +COL32 TEXT, +COL33 TEXT, +COL34 TEXT, +COL35 TEXT, +COL36 TEXT, +COL37 TEXT, +COL38 TEXT, +COL39 TEXT, +COL40 TEXT, +COL41 TEXT, +COL42 TEXT, +COL43 TEXT, +COL44 TEXT, +COL45 TEXT, +COL46 TEXT, +COL47 TEXT, +COL48 TEXT, +COL49 TEXT, +COL50 TEXT, +COL51 TEXT, +COL52 TEXT, +COL53 TEXT, +COL54 TEXT, +COL55 TEXT, +COL56 TEXT, +COL57 TEXT, +COL58 TEXT, +COL59 TEXT, +COL60 TEXT, +COL61 TEXT, +COL62 TEXT, +COL63 TEXT, +COL64 TEXT, +COL65 TEXT, +COL66 TEXT, +COL67 TEXT, +COL68 TEXT, +COL69 TEXT, +COL70 TEXT, +COL71 TEXT, +COL72 TEXT, +COL73 TEXT, +COL74 TEXT, +COL75 TEXT, +COL76 TEXT, +COL77 TEXT, +COL78 TEXT, +COL79 TEXT, +COL80 TEXT, +COL81 TEXT, +COL82 TEXT, +COL83 TEXT, +COL84 TEXT, +COL85 TEXT, +COL86 TEXT, +COL87 TEXT, +COL88 TEXT, +COL89 TEXT, +COL90 TEXT, +COL91 TEXT, +COL92 TEXT, +COL93 TEXT, +COL94 TEXT, +COL95 TEXT, +COL96 TEXT, +COL97 TEXT, +COL98 TEXT, +COL99 TEXT, +COL100 TEXT, +COL101 TEXT, +COL102 TEXT, +COL103 TEXT, +COL104 TEXT, +COL105 TEXT, +COL106 TEXT, +COL107 TEXT, +COL108 TEXT, +COL109 TEXT, +COL110 TEXT, +COL111 TEXT, +COL112 TEXT, +COL113 TEXT, +COL114 TEXT, +COL115 TEXT, +COL116 TEXT, +COL117 TEXT, +COL118 TEXT, +COL119 TEXT, +COL120 TEXT, +COL121 TEXT, +COL122 TEXT, +COL123 TEXT, +COL124 TEXT, +COL125 TEXT, +COL126 TEXT, +COL127 TEXT, +COL128 TEXT, +COL129 TEXT, +COL130 TEXT, +COL131 TEXT, +COL132 TEXT, +COL133 TEXT, +COL134 TEXT, +COL135 TEXT, +COL136 TEXT, +COL137 TEXT, +COL138 TEXT, +COL139 TEXT, +COL140 TEXT, +COL141 TEXT, +COL142 TEXT, +COL143 TEXT, +COL144 TEXT, +COL145 TEXT, +COL146 TEXT, +COL147 TEXT, +COL148 TEXT, +COL149 TEXT, +COL150 TEXT, +COL151 TEXT, +COL152 TEXT, +COL153 TEXT, +COL154 TEXT, +COL155 TEXT, +COL156 TEXT, +COL157 TEXT, +COL158 TEXT, +COL159 TEXT, +COL160 TEXT, +COL161 TEXT, +COL162 TEXT, +COL163 TEXT, +COL164 TEXT, +COL165 TEXT, +COL166 TEXT, +COL167 TEXT, +COL168 TEXT, +COL169 TEXT, +COL170 TEXT, +COL171 TEXT, +COL172 TEXT, +COL173 TEXT, +COL174 TEXT, +COL175 TEXT, +COL176 TEXT, +COL177 TEXT, +COL178 TEXT, +COL179 TEXT, +COL180 TEXT, +COL181 TEXT, +COL182 TEXT, +COL183 TEXT, +COL184 TEXT, +COL185 TEXT, +COL186 TEXT, +COL187 TEXT, +COL188 TEXT, +COL189 TEXT, +COL190 TEXT, +COL191 TEXT, +COL192 TEXT, +COL193 TEXT, +COL194 TEXT, +COL195 TEXT, +COL196 TEXT, +COL197 TEXT) +row_format=dynamic,ENGINE=INNODB; +set @a = repeat('0123456789', 800); +set @b = repeat('9876543210', 800); +insert into t2 values( +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a); +update t2 set col190=@b; +set @a = repeat('0123456789', 1650); +set @b = repeat('9876543210', 2000); +insert into t2 values( +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a,@a,@a,@a, +@a,@a,@a,@a,@a,@a,@a); +update t2 set col190=@b; +# restart +set @a = repeat('abcdefghijklmnopqrstuvwxyz', 1650); +set @b = repeat('zyxwvutsrqponmlkjihgfedcba', 2000); +update t2 set col189 = @b; +insert into t2 select * from t2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + `q` blob DEFAULT NULL, + `r` blob DEFAULT NULL, + `s` blob DEFAULT NULL, + `t` blob DEFAULT NULL, + `u` blob DEFAULT NULL, + `v` blob DEFAULT NULL, + `w` blob DEFAULT NULL, + `x` blob DEFAULT NULL, + `y` blob DEFAULT NULL, + `z` blob DEFAULT NULL, + `aa` blob DEFAULT NULL, + `ba` blob DEFAULT NULL, + `ca` blob DEFAULT NULL, + `da` blob DEFAULT NULL, + `ea` blob DEFAULT NULL, + `fa` blob DEFAULT NULL, + `ga` blob DEFAULT NULL, + `ha` blob DEFAULT NULL, + `ia` blob DEFAULT NULL, + `ja` blob DEFAULT NULL, + `ka` blob DEFAULT NULL, + `la` blob DEFAULT NULL, + `ma` blob DEFAULT NULL, + `na` blob DEFAULT NULL, + `oa` blob DEFAULT NULL, + `pa` blob DEFAULT NULL, + `qa` blob DEFAULT NULL, + `ra` blob DEFAULT NULL, + `sa` blob DEFAULT NULL, + `ta` blob DEFAULT NULL, + `ua` blob DEFAULT NULL, + `va` blob DEFAULT NULL, + `wa` blob DEFAULT NULL, + `xa` blob DEFAULT NULL, + `ya` blob DEFAULT NULL, + `za` blob DEFAULT NULL, + `ab` blob DEFAULT NULL, + `bb` blob DEFAULT NULL, + `cb` blob DEFAULT NULL, + `db` blob DEFAULT NULL, + `eb` blob DEFAULT NULL, + `fb` blob DEFAULT NULL, + `gb` blob DEFAULT NULL, + `hb` blob DEFAULT NULL, + `ib` blob DEFAULT NULL, + `jb` blob DEFAULT NULL, + `kb` blob DEFAULT NULL, + `lb` blob DEFAULT NULL, + `mb` blob DEFAULT NULL, + `nb` blob DEFAULT NULL, + `ob` blob DEFAULT NULL, + `pb` blob DEFAULT NULL, + `qb` blob DEFAULT NULL, + `rb` blob DEFAULT NULL, + `sb` blob DEFAULT NULL, + `tb` blob DEFAULT NULL, + `ub` blob DEFAULT NULL, + `vb` blob DEFAULT NULL, + `wb` blob DEFAULT NULL, + `xb` blob DEFAULT NULL, + `yb` blob DEFAULT NULL, + `zb` blob DEFAULT NULL, + `ac` blob DEFAULT NULL, + `bc` blob DEFAULT NULL, + `cc` blob DEFAULT NULL, + `dc` blob DEFAULT NULL, + `ec` blob DEFAULT NULL, + `fc` blob DEFAULT NULL, + `gc` blob DEFAULT NULL, + `hc` blob DEFAULT NULL, + `ic` blob DEFAULT NULL, + `jc` blob DEFAULT NULL, + `kc` blob DEFAULT NULL, + `lc` blob DEFAULT NULL, + `mc` blob DEFAULT NULL, + `nc` blob DEFAULT NULL, + `oc` blob DEFAULT NULL, + `pc` blob DEFAULT NULL, + `qc` blob DEFAULT NULL, + `rc` blob DEFAULT NULL, + `sc` blob DEFAULT NULL, + `tc` blob DEFAULT NULL, + `uc` blob DEFAULT NULL, + `vc` blob DEFAULT NULL, + `wc` blob DEFAULT NULL, + `xc` blob DEFAULT NULL, + `yc` blob DEFAULT NULL, + `zc` blob DEFAULT NULL, + KEY `t1a` (`a`(767),`b`(767)), + KEY `t1c` (`c`(767),`d`(767)), + KEY `t1e` (`e`(767),`f`(767)), + KEY `t1f2` (`g`(767),`h`(767)), + KEY `t1f4` (`i`(767),`j`(767)), + KEY `t1k` (`k`(767),`m`(767)), + KEY `t1f8` (`n`(767),`o`(767)), + KEY `t1f11` (`p`(767),`q`(767)), + KEY `t1f13` (`r`(767),`s`(767)), + KEY `t1f15` (`t`(767),`u`(767)), + KEY `t1f18` (`w`(767),`x`(767)), + KEY `t1f20` (`y`(767),`z`(767)), + KEY `ta1a6` (`aa`(767),`ba`(767)), + KEY `tc1c6` (`ca`(767),`da`(767)), + KEY `te1e6` (`ea`(767),`fa`(767)), + KEY `tg1f2` (`ia`(767),`ja`(767)), + KEY `ti1f4` (`ia`(767),`ka`(767)), + KEY `tk1f6` (`la`(767),`ma`(767)), + KEY `tm1f8` (`na`(767),`oa`(767)), + KEY `to1f11` (`pa`(767),`qa`(767)), + KEY `tq1f13` (`ra`(767),`sa`(767)), + KEY `ts1f15` (`ta`(767),`ua`(767)), + KEY `tu1f18` (`wa`(767),`xa`(767)), + KEY `tx1f20` (`ya`(767),`za`(767)), + KEY `ta1a5` (`ab`(767),`bb`(767)), + KEY `tc1c5` (`cb`(767),`db`(767)), + KEY `te1e5` (`eb`(767),`fb`(767)), + KEY `t5g1f2` (`gb`(767),`hb`(767)), + KEY `t5i1f4` (`ib`(767),`kb`(767)), + KEY `t5k1f6` (`lb`(767),`mb`(767)), + KEY `t5m1f8` (`nb`(767),`ob`(767)), + KEY `t5o1f11` (`pb`(767),`qb`(767)), + KEY `t65q1f13` (`rb`(767),`sb`(767)), + KEY `t65s1f15` (`tb`(767),`ub`(767)), + KEY `t65u1f18` (`wb`(767),`xb`(767)), + KEY `t65x1f20` (`yb`(767),`zb`(767)), + KEY `xta1a5` (`ac`(767),`bc`(767)), + KEY `xt5g1f2` (`gc`(767),`hc`(767)), + KEY `xt5i1f4` (`ic`(767)), + KEY `xtc1c5` (`cc`(767),`dc`(767)), + KEY `xte1e5` (`ec`(767),`fc`(767)), + KEY `xt5k1f6` (`lc`(767),`mc`(767)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COL1` text DEFAULT NULL, + `COL2` text DEFAULT NULL, + `COL3` text DEFAULT NULL, + `COL4` text DEFAULT NULL, + `COL5` text DEFAULT NULL, + `COL6` text DEFAULT NULL, + `COL7` text DEFAULT NULL, + `COL8` text DEFAULT NULL, + `COL9` text DEFAULT NULL, + `COL10` text DEFAULT NULL, + `COL11` text DEFAULT NULL, + `COL12` text DEFAULT NULL, + `COL13` text DEFAULT NULL, + `COL14` text DEFAULT NULL, + `COL15` text DEFAULT NULL, + `COL16` text DEFAULT NULL, + `COL17` text DEFAULT NULL, + `COL18` text DEFAULT NULL, + `COL19` text DEFAULT NULL, + `COL20` text DEFAULT NULL, + `COL21` text DEFAULT NULL, + `COL22` text DEFAULT NULL, + `COL23` text DEFAULT NULL, + `COL24` text DEFAULT NULL, + `COL25` text DEFAULT NULL, + `COL26` text DEFAULT NULL, + `COL27` text DEFAULT NULL, + `COL28` text DEFAULT NULL, + `COL29` text DEFAULT NULL, + `COL30` text DEFAULT NULL, + `COL31` text DEFAULT NULL, + `COL32` text DEFAULT NULL, + `COL33` text DEFAULT NULL, + `COL34` text DEFAULT NULL, + `COL35` text DEFAULT NULL, + `COL36` text DEFAULT NULL, + `COL37` text DEFAULT NULL, + `COL38` text DEFAULT NULL, + `COL39` text DEFAULT NULL, + `COL40` text DEFAULT NULL, + `COL41` text DEFAULT NULL, + `COL42` text DEFAULT NULL, + `COL43` text DEFAULT NULL, + `COL44` text DEFAULT NULL, + `COL45` text DEFAULT NULL, + `COL46` text DEFAULT NULL, + `COL47` text DEFAULT NULL, + `COL48` text DEFAULT NULL, + `COL49` text DEFAULT NULL, + `COL50` text DEFAULT NULL, + `COL51` text DEFAULT NULL, + `COL52` text DEFAULT NULL, + `COL53` text DEFAULT NULL, + `COL54` text DEFAULT NULL, + `COL55` text DEFAULT NULL, + `COL56` text DEFAULT NULL, + `COL57` text DEFAULT NULL, + `COL58` text DEFAULT NULL, + `COL59` text DEFAULT NULL, + `COL60` text DEFAULT NULL, + `COL61` text DEFAULT NULL, + `COL62` text DEFAULT NULL, + `COL63` text DEFAULT NULL, + `COL64` text DEFAULT NULL, + `COL65` text DEFAULT NULL, + `COL66` text DEFAULT NULL, + `COL67` text DEFAULT NULL, + `COL68` text DEFAULT NULL, + `COL69` text DEFAULT NULL, + `COL70` text DEFAULT NULL, + `COL71` text DEFAULT NULL, + `COL72` text DEFAULT NULL, + `COL73` text DEFAULT NULL, + `COL74` text DEFAULT NULL, + `COL75` text DEFAULT NULL, + `COL76` text DEFAULT NULL, + `COL77` text DEFAULT NULL, + `COL78` text DEFAULT NULL, + `COL79` text DEFAULT NULL, + `COL80` text DEFAULT NULL, + `COL81` text DEFAULT NULL, + `COL82` text DEFAULT NULL, + `COL83` text DEFAULT NULL, + `COL84` text DEFAULT NULL, + `COL85` text DEFAULT NULL, + `COL86` text DEFAULT NULL, + `COL87` text DEFAULT NULL, + `COL88` text DEFAULT NULL, + `COL89` text DEFAULT NULL, + `COL90` text DEFAULT NULL, + `COL91` text DEFAULT NULL, + `COL92` text DEFAULT NULL, + `COL93` text DEFAULT NULL, + `COL94` text DEFAULT NULL, + `COL95` text DEFAULT NULL, + `COL96` text DEFAULT NULL, + `COL97` text DEFAULT NULL, + `COL98` text DEFAULT NULL, + `COL99` text DEFAULT NULL, + `COL100` text DEFAULT NULL, + `COL101` text DEFAULT NULL, + `COL102` text DEFAULT NULL, + `COL103` text DEFAULT NULL, + `COL104` text DEFAULT NULL, + `COL105` text DEFAULT NULL, + `COL106` text DEFAULT NULL, + `COL107` text DEFAULT NULL, + `COL108` text DEFAULT NULL, + `COL109` text DEFAULT NULL, + `COL110` text DEFAULT NULL, + `COL111` text DEFAULT NULL, + `COL112` text DEFAULT NULL, + `COL113` text DEFAULT NULL, + `COL114` text DEFAULT NULL, + `COL115` text DEFAULT NULL, + `COL116` text DEFAULT NULL, + `COL117` text DEFAULT NULL, + `COL118` text DEFAULT NULL, + `COL119` text DEFAULT NULL, + `COL120` text DEFAULT NULL, + `COL121` text DEFAULT NULL, + `COL122` text DEFAULT NULL, + `COL123` text DEFAULT NULL, + `COL124` text DEFAULT NULL, + `COL125` text DEFAULT NULL, + `COL126` text DEFAULT NULL, + `COL127` text DEFAULT NULL, + `COL128` text DEFAULT NULL, + `COL129` text DEFAULT NULL, + `COL130` text DEFAULT NULL, + `COL131` text DEFAULT NULL, + `COL132` text DEFAULT NULL, + `COL133` text DEFAULT NULL, + `COL134` text DEFAULT NULL, + `COL135` text DEFAULT NULL, + `COL136` text DEFAULT NULL, + `COL137` text DEFAULT NULL, + `COL138` text DEFAULT NULL, + `COL139` text DEFAULT NULL, + `COL140` text DEFAULT NULL, + `COL141` text DEFAULT NULL, + `COL142` text DEFAULT NULL, + `COL143` text DEFAULT NULL, + `COL144` text DEFAULT NULL, + `COL145` text DEFAULT NULL, + `COL146` text DEFAULT NULL, + `COL147` text DEFAULT NULL, + `COL148` text DEFAULT NULL, + `COL149` text DEFAULT NULL, + `COL150` text DEFAULT NULL, + `COL151` text DEFAULT NULL, + `COL152` text DEFAULT NULL, + `COL153` text DEFAULT NULL, + `COL154` text DEFAULT NULL, + `COL155` text DEFAULT NULL, + `COL156` text DEFAULT NULL, + `COL157` text DEFAULT NULL, + `COL158` text DEFAULT NULL, + `COL159` text DEFAULT NULL, + `COL160` text DEFAULT NULL, + `COL161` text DEFAULT NULL, + `COL162` text DEFAULT NULL, + `COL163` text DEFAULT NULL, + `COL164` text DEFAULT NULL, + `COL165` text DEFAULT NULL, + `COL166` text DEFAULT NULL, + `COL167` text DEFAULT NULL, + `COL168` text DEFAULT NULL, + `COL169` text DEFAULT NULL, + `COL170` text DEFAULT NULL, + `COL171` text DEFAULT NULL, + `COL172` text DEFAULT NULL, + `COL173` text DEFAULT NULL, + `COL174` text DEFAULT NULL, + `COL175` text DEFAULT NULL, + `COL176` text DEFAULT NULL, + `COL177` text DEFAULT NULL, + `COL178` text DEFAULT NULL, + `COL179` text DEFAULT NULL, + `COL180` text DEFAULT NULL, + `COL181` text DEFAULT NULL, + `COL182` text DEFAULT NULL, + `COL183` text DEFAULT NULL, + `COL184` text DEFAULT NULL, + `COL185` text DEFAULT NULL, + `COL186` text DEFAULT NULL, + `COL187` text DEFAULT NULL, + `COL188` text DEFAULT NULL, + `COL189` text DEFAULT NULL, + `COL190` text DEFAULT NULL, + `COL191` text DEFAULT NULL, + `COL192` text DEFAULT NULL, + `COL193` text DEFAULT NULL, + `COL194` text DEFAULT NULL, + `COL195` text DEFAULT NULL, + `COL196` text DEFAULT NULL, + `COL197` text DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +BEGIN; +update t2 set col150=@a; +update t2 set col145=@b; +COMMIT; +drop table t2; +DROP TABLE t1; +# +# MDEV-19526/MDEV-29742 heap number overflow +# +CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a)) +ENGINE=InnoDB; +INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +DROP TABLE t1; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/innodb-agregate.result b/mysql-test/suite/innodb/r/innodb-agregate.result new file mode 100644 index 00000000..d3e096c7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-agregate.result @@ -0,0 +1,21 @@ +create table t2 (a smallint(6) not null, b int(10) not null, name varchar(20), primary key(a,b), key(name)) engine=InnoDB; +insert into t2 values (8355,3,"sanja"),(8355,4,"wlad"),(8366,5, "lawrin"),(8366,6,"markusjm"); +select count(distinct name) from t2 where a=8366 and b>=5 and b<=5; +count(distinct name) +1 +select count(distinct name) from t2 where a=8366 and b=5; +count(distinct name) +1 +select count(distinct name) from t2 where a=8366 and b between 5 and 5.5; +count(distinct name) +1 +select sum(distinct a) from t2 where a=8366 and b>=5 and b<=5; +sum(distinct a) +8366 +select sum(distinct a) from t2 where a=8366 and b=5; +sum(distinct a) +8366 +select sum(distinct a) from t2 where a=8366 and b between 5 and 5.5; +sum(distinct a) +8366 +drop table t2; diff --git a/mysql-test/suite/innodb/r/innodb-alter-autoinc.result b/mysql-test/suite/innodb/r/innodb-alter-autoinc.result new file mode 100644 index 00000000..3186b00a --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-autoinc.result @@ -0,0 +1,174 @@ +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(347),(33101),(123),(45),(6); +SET @old_sql_mode = @@sql_mode; +SET @@sql_mode = 'STRICT_TRANS_TABLES'; +ALTER TABLE t1 ADD PRIMARY KEY(a); +SET @@sql_mode = @old_sql_mode; +ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, +LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED +ALTER TABLE t1 ADD id INT AUTO_INCREMENT; +ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key +ALTER TABLE t1 ADD id INT AUTO_INCREMENT, ADD INDEX(a, id); +ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key +ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a); +SELECT * FROM t1; +a id +6 0 +45 0 +123 0 +347 0 +33101 0 +SET AUTO_INCREMENT_INCREMENT = 5, AUTO_INCREMENT_OFFSET = 30; +ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, +DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +BEGIN; +INSERT INTO t1 VALUES(7,0); +SELECT * FROM t1; +a id +6 45 +45 50 +123 55 +347 60 +33101 65 +7 70 +ROLLBACK; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, +DROP COLUMN id, AUTO_INCREMENT = 42, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED +ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, +DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE; +SELECT * FROM t1; +a id +6 45 +45 50 +123 55 +347 60 +33101 65 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 SET a=123; +INSERT INTO t1 VALUES(-123,-45); +ALTER TABLE t1 AUTO_INCREMENT = 75; +INSERT INTO t1 SET a=123; +SELECT * FROM t1; +a id +-123 -45 +6 45 +45 50 +123 55 +347 60 +33101 65 +123 70 +123 75 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(347),(33101),(123),(45),(6); +ALTER TABLE t1 ADD PRIMARY KEY(a); +ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a); +SELECT * FROM t1; +a id +6 0 +45 0 +123 0 +347 0 +33101 0 +ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, +DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +BEGIN; +INSERT INTO t1 VALUES(7,0); +SELECT * FROM t1; +a id +6 45 +45 50 +123 55 +347 60 +33101 65 +7 70 +ROLLBACK; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, +DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY; +SELECT * FROM t1; +a id +6 45 +45 50 +123 55 +347 60 +33101 65 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 SET a=123; +INSERT INTO t1 VALUES(-123,-45); +ALTER TABLE t1 AUTO_INCREMENT = 75; +INSERT INTO t1 SET a=123; +SELECT * FROM t1; +a id +-123 -45 +6 45 +45 50 +123 55 +347 60 +33101 65 +123 70 +123 75 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `id` (`id`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result new file mode 100644 index 00000000..c55b4a3d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result @@ -0,0 +1,142 @@ +SET NAMES utf8; +CREATE TABLE ① ( +c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) +ENGINE = InnoDB; +CREATE TABLE t1ć (c1 INT PRIMARY KEY, c2 INT, INDEX(c2), +CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES ①(c2)) +ENGINE=InnoDB; +INSERT INTO ① SET c1 = 1; +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG = '+d,ib_drop_foreign_error'; +ALTER TABLE t1ć DROP FOREIGN KEY t1c2, RENAME TO ②; +ERROR HY000: The table 't1ć' is full +SET DEBUG_DBUG = @saved_debug_dbug; +SET DEBUG_DBUG = '+d,ib_rename_column_error'; +ALTER TABLE ① CHANGE c2 š INT; +ERROR HY000: The table '①' is full +SET DEBUG_DBUG = @saved_debug_dbug; +SHOW CREATE TABLE t1ć; +Table Create Table +t1ć CREATE TABLE `t1ć` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `①` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1ć, ①; +# +# Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL +# WITH INCORRECT KEY NAME +create table t1 (id int auto_increment primary key, a int, unique key uk(a)) +engine = innodb; +insert into t1 select 1, 1; +insert into t1 select 2, 2; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; +alter table t1 force, add b int, ALGORITHM=inplace; +/* connection con1 */ +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR s1'; +insert into t1 select NULL, 1; +ERROR 23000: Duplicate entry '1' for key 'uk' +SET DEBUG_SYNC = 'now SIGNAL s2'; +/* connection default */ +connection default; +/* reap */ alter table t1 force, add b int, ALGORITHM=inplace; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; +alter table t1 force, add c int, ALGORITHM=inplace;; +/* connection con1 */ +connection con1; +set DEBUG_SYNC = 'now WAIT_FOR s1'; +update t1 set a=1 where id=2; +ERROR 23000: Duplicate entry '1' for key 'uk' +SET DEBUG_SYNC = 'now SIGNAL s2'; +/* connection default */ +connection default; +/* reap */ alter table t1 force, add b int, ALGORITHM=inplace; +SET DEBUG_SYNC = 'RESET'; +drop table t1; +# +# Bug #27753193 ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM < +# HA_ALTER_INFO->KEY_COUNT' +CREATE TABLE t1 (a INT, UNIQUE KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET DEBUG_SYNC = 'row_log_table_apply1_before signal S1 WAIT_FOR S2'; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR S1'; +INSERT INTO t1 VALUES (1); +ERROR 23000: Duplicate entry '1' for key 'a' +SET DEBUG_SYNC = 'now SIGNAL S2'; +disconnect con1; +connection default; +SET DEBUG_SYNC='RESET'; +DROP TABLE t1; +# +# MDEV-17470 Orphan temporary files after interrupted ALTER +# cause InnoDB: Operating system error number 17 and eventual +# fatal error 71 +# +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8); +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +LOCK TABLE t1 READ; +connect con1,localhost,root,,test; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +connection default; +kill query @id; +connection con1; +ERROR 70100: Query execution was interrupted +disconnect con1; +connection default; +UNLOCK TABLES; +DROP TABLE t1; +# +# MDEV-7318 RENAME INDEX +# +CREATE TABLE t (c1 INT, c2 INT, KEY i2 (c2)) ENGINE=INNODB; +SET DEBUG_DBUG= '+d,ib_rename_index_fail1'; +ALTER TABLE t RENAME INDEX i2 to x, ALGORITHM=INPLACE; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SET DEBUG_DBUG = @saved_debug_dbug; +DROP TABLE t; +# +# MDEV-26772 InnoDB DDL fails with DUPLICATE KEY error +# +create table t1(f1 int not null primary key, +f2 int not null, index idx(f2))engine=innodb; +insert into t1 values(1, 1); +connect con1,localhost,root,,,; +SET DEBUG_SYNC='before_delete_table_stats SIGNAL blocked WAIT_FOR go'; +SET innodb_lock_wait_timeout=0; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +BEGIN; +SELECT * FROM mysql.innodb_table_stats FOR UPDATE; +database_name table_name last_update n_rows clustered_index_size sum_of_other_index_sizes +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +connection default; +COMMIT; +SET DEBUG_SYNC=RESET; +connection con1; +ALTER TABLE t1 RENAME KEY idx TO idx1, ALGORITHM=COPY; +disconnect con1; +connection default; +DROP TABLE t1; +# +# MDEV-26903 Assertion ctx->trx->state == TRX_STATE_ACTIVE on DROP INDEX +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT, INDEX(b)) ENGINE=InnoDB; +SET @save_dbug=@@debug_dbug; +SET debug_dbug='+d,deadlock_table_fail'; +ALTER TABLE t1 DROP INDEX b, ALGORITHM=INPLACE; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SET debug_dbug=@save_dbug; +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/innodb-alter-nullable.result b/mysql-test/suite/innodb/r/innodb-alter-nullable.result new file mode 100644 index 00000000..1d481cf2 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-nullable.result @@ -0,0 +1,204 @@ +CREATE TABLE t (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 INT) ENGINE=InnoDB; +INSERT INTO t VALUES (1,2,3),(4,5,6),(7,8,9); +ALTER TABLE t CHANGE c1 c1 INT NULL FIRST, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t MODIFY c3 INT NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t CHANGE c2 c2 INT, CHANGE c2 c2 INT NOT NULL; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t MODIFY c2 INT, MODIFY c2 INT NOT NULL; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t MODIFY c2 INT UNSIGNED, MODIFY c2 INT; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t MODIFY c2 CHAR(1) NOT NULL, MODIFY c2 INT NOT NULL; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t CHANGE c2 c2 INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t MODIFY c2 INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +connect con1,localhost,root,,; +UPDATE t SET c2=NULL; +ERROR 23000: Column 'c2' cannot be null +SELECT * FROM t; +c1 c2 c3 +1 2 3 +4 5 6 +7 8 9 +connection default; +ALTER TABLE t MODIFY c2 INT, ALGORITHM=INPLACE; +connection con1; +BEGIN; +UPDATE t SET c2=NULL; +SELECT * FROM t; +c1 c2 c3 +1 NULL 3 +4 NULL 6 +7 NULL 9 +ROLLBACK; +SELECT * FROM t; +c1 c2 c3 +1 2 3 +4 5 6 +7 8 9 +disconnect con1; +connection default; +ALTER TABLE t MODIFY c2 INT NULL, ALGORITHM=INPLACE; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE NAME='test/t'; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +# test/t 33 6 # Dynamic 0 Single +DROP TABLE t; +CREATE TABLE t1(c1 INT) ENGINE=InnoDB; +ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1(c1); +ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL,ADD KEY(c1); +DROP TABLE t1; +# +# MDEV-18732 InnoDB: ALTER IGNORE returns error for NULL +# +CREATE TABLE t1(c INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +INSERT INTO t1 VALUES (NULL); +ERROR 23000: Column 'c' cannot be null +SELECT * FROM t1; +c +0 +DROP TABLE t1; +CREATE TABLE t1(c INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(1),(1); +ALTER IGNORE TABLE t1 ADD UNIQUE(c); +affected rows: 3 +info: Records: 3 Duplicates: 1 Warnings: 0 +ALTER IGNORE TABLE t1 ADD PRIMARY KEY(c); +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +SELECT * FROM t1; +c +0 +1 +DROP TABLE t1; +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +SET @old_sql_mode = @@sql_mode; +SET sql_mode = ''; +ALTER TABLE t1 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER TABLE t2 MODIFY c INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER TABLE t3 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +SET sql_mode = @old_sql_mode; +SELECT * FROM t1; +c g +0 0 +SELECT * FROM t2; +c v +0 0 +SELECT * FROM t3; +c v +0 0 +SELECT v FROM t3 FORCE INDEX(v); +v +0 +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +DROP TABLE t1,t2,t3; +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +ALTER IGNORE TABLE t3 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +SELECT * FROM t1; +c g +0 0 +SELECT * FROM t2; +c v +0 0 +SELECT * FROM t3; +c v +0 0 +SELECT v FROM t3 FORCE INDEX(v); +v +0 +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +DROP TABLE t1,t2,t3; +CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB; +CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB; +CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB; +INSERT INTO t1 SET c=NULL; +INSERT INTO t2 SET c=NULL; +INSERT INTO t3 SET c=NULL; +ALTER TABLE t1 MODIFY c INT NOT NULL; +ERROR 01000: Data truncated for column 'c' at row 1 +ALTER TABLE t2 MODIFY c INT NOT NULL; +ERROR 01000: Data truncated for column 'c' at row 1 +ALTER TABLE t3 MODIFY c INT NOT NULL; +ERROR 01000: Data truncated for column 'c' at row 1 +UPDATE t1 SET c=0; +UPDATE t2 SET c=0; +UPDATE t3 SET c=0; +ALTER TABLE t1 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t2 MODIFY c INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t3 MODIFY c INT NOT NULL; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +c g +0 0 +SELECT * FROM t2; +c v +0 0 +SELECT * FROM t3; +c v +0 0 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result new file mode 100644 index 00000000..552944f1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-table.result @@ -0,0 +1,229 @@ +drop database if exists moodle19; +Warnings: +Note 1008 Can't drop database 'moodle19'; database doesn't exist +create database moodle19; +use moodle19; +CREATE TABLE `mdl_course_modules` ( +`id` bigint(10) NOT NULL AUTO_INCREMENT, +`course` bigint(10) NOT NULL DEFAULT '0', +`module` bigint(10) NOT NULL DEFAULT '0', +`instance` bigint(10) NOT NULL DEFAULT '0', +`section` bigint(10) NOT NULL DEFAULT '0', +`idnumber` varchar(100) DEFAULT NULL, +`added` bigint(10) NOT NULL DEFAULT '0', +`delay` varchar(10) NOT NULL DEFAULT '0', +`score` smallint(4) NOT NULL DEFAULT '0', +`indent` mediumint(5) NOT NULL DEFAULT '0', +`visible` tinyint(1) NOT NULL DEFAULT '1', +`checkboxesforprereqs` tinyint(1) NOT NULL DEFAULT '0', +`stylewhencomplete` varchar(200) DEFAULT '', +`checkboxforcomplete` tinyint(1) NOT NULL DEFAULT '0', +`stylewhenlocked` varchar(200) DEFAULT 'locked', +`visiblewhenlocked` tinyint(1) NOT NULL DEFAULT '1', +`visibleold` tinyint(1) NOT NULL DEFAULT '1', +`groupmode` smallint(4) NOT NULL DEFAULT '0', +`groupingid` bigint(10) NOT NULL DEFAULT '0', +`groupmembersonly` smallint(4) NOT NULL DEFAULT '0', +`completion` tinyint(1) NOT NULL DEFAULT '0', +`completiongradeitemnumber` bigint(10) DEFAULT NULL, +`completionview` tinyint(1) NOT NULL DEFAULT '0', +`completionexpected` bigint(10) NOT NULL DEFAULT '0', +`availablefrom` bigint(10) NOT NULL DEFAULT '0', +`availableuntil` bigint(10) NOT NULL DEFAULT '0', +`showavailability` tinyint(1) NOT NULL DEFAULT '0', +`showdescription` tinyint(1) NOT NULL DEFAULT '0', +PRIMARY KEY (`id`), +KEY `mdl_courmodu_vis_ix` (`visible`), +KEY `mdl_courmodu_cou_ix` (`course`), +KEY `mdl_courmodu_mod_ix` (`module`), +KEY `mdl_courmodu_ins_ix` (`instance`), +KEY `mdl_courmodu_idncou_ix` (`idnumber`,`course`), +KEY `mdl_courmodu_gro_ix` (`groupingid`) +) ENGINE=InnoDB AUTO_INCREMENT=447023 DEFAULT CHARSET=utf8 COMMENT='course_modules table retrofitted from MySQL'; +# Inserting 2701 rows into the table... +ALTER TABLE moodle19.mdl_course_modules ADD stefantest LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci AFTER showdescription; +drop database moodle19; +use test; +CREATE TABLE `w_findispmon05u` ( +`atpkey` INT(11) NOT NULL DEFAULT '0', +`atzo05` INT(11) NULL DEFAULT NULL, +`pos` BIGINT(21) NULL DEFAULT NULL, +`f5BnvB` INT(9) NULL DEFAULT NULL, +`f5atbvb` INT(11) NULL DEFAULT NULL, +`f5atbwmg` INT(11) NULL DEFAULT NULL, +`f5pBneu` BIGINT(12) NULL DEFAULT NULL, +`atbwdt` INT(11) NULL DEFAULT NULL, +`atbwzt` INT(11) NULL DEFAULT NULL, +`atbart` VARCHAR(10) NULL DEFAULT NULL +) +COLLATE='utf8_general_ci' +ENGINE=InnoDB; +ALTER TABLE `w_findispmon05u` +CHANGE COLUMN `atpkey` `f5atpkey` INT(11) NOT NULL DEFAULT '0' FIRST, +CHANGE COLUMN `atzo05` `f5atzo05` INT(11) NULL DEFAULT NULL AFTER `f5atpkey`, +CHANGE COLUMN `atbwdt` `f5atbwdt` INT(11) NULL DEFAULT NULL AFTER `f5pBneu`, +CHANGE COLUMN `atbwzt` `f5atbwzt` INT(11) NULL DEFAULT NULL AFTER `f5atbwdt`, +CHANGE COLUMN `atbart` `f5atbart` VARCHAR(10) NULL DEFAULT NULL AFTER `f5atbwzt`, +ADD INDEX `atpkey` (`f5atpkey`), +ADD INDEX `inatkey` (`f5atzo05`, `pos`), +ADD INDEX `pos` (`pos`, `f5atzo05`); +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE `w_findispmon05u`; +Table Create Table +w_findispmon05u CREATE TABLE `w_findispmon05u` ( + `f5atpkey` int(11) NOT NULL DEFAULT 0, + `f5atzo05` int(11) DEFAULT NULL, + `pos` bigint(21) DEFAULT NULL, + `f5BnvB` int(9) DEFAULT NULL, + `f5atbvb` int(11) DEFAULT NULL, + `f5atbwmg` int(11) DEFAULT NULL, + `f5pBneu` bigint(12) DEFAULT NULL, + `f5atbwdt` int(11) DEFAULT NULL, + `f5atbwzt` int(11) DEFAULT NULL, + `f5atbart` varchar(10) DEFAULT NULL, + KEY `atpkey` (`f5atpkey`), + KEY `inatkey` (`f5atzo05`,`pos`), + KEY `pos` (`pos`,`f5atzo05`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +DROP TABLE `w_findispmon05u`; +CREATE TABLE t ( +a INT NOT NULL, +b INT NOT NULL, +PRIMARY KEY (a) +) ENGINE=INNODB; +ALTER TABLE t +CHANGE COLUMN b c INT NOT NULL, +ADD UNIQUE INDEX (c); +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `c` int(11) NOT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `c` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t +CHANGE COLUMN c b INT NOT NULL, +ADD UNIQUE INDEX (c); +ERROR 42000: Key column 'c' doesn't exist in table +DROP TABLE t; +CREATE TABLE parent ( +a INT NOT NULL, +b INT NOT NULL, +PRIMARY KEY (a) +) ENGINE=INNODB; +CREATE TABLE child ( +a INT NOT NULL, +b INT NOT NULL, +PRIMARY KEY (a) +) ENGINE=INNODB; +ALTER TABLE child +CHANGE COLUMN b c INT NOT NULL, +ADD FOREIGN KEY (c) REFERENCES parent(a); +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a` int(11) NOT NULL, + `c` int(11) NOT NULL, + PRIMARY KEY (`a`), + KEY `c` (`c`), + CONSTRAINT `child_ibfk_1` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE child, parent; +CREATE TABLE IF NOT EXISTS ticket ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +mask VARCHAR(16) DEFAULT '' NOT NULL, +subject VARCHAR(255) DEFAULT '' NOT NULL, +is_closed TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, +is_deleted TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, +team_id INT UNSIGNED DEFAULT 0 NOT NULL, +category_id INT UNSIGNED DEFAULT 0 NOT NULL, +first_message_id INT UNSIGNED DEFAULT 0 NOT NULL, +created_date INT UNSIGNED, +updated_date INT UNSIGNED, +due_date INT UNSIGNED, +first_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, +last_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, +spam_score DECIMAL(4,4) NOT NULL DEFAULT 0, +spam_training VARCHAR(1) NOT NULL DEFAULT '', +interesting_words VARCHAR(255) NOT NULL DEFAULT '', +next_action VARCHAR(255) NOT NULL DEFAULT '', +PRIMARY KEY (id) +) ENGINE=InnoDB; +ALTER TABLE ticket +CHANGE COLUMN team_id group_id INT UNSIGNED NOT NULL DEFAULT 0, +CHANGE COLUMN category_id bucket_id INT UNSIGNED NOT NULL DEFAULT 0, +ADD COLUMN org_id INT UNSIGNED NOT NULL DEFAULT 0, +ADD INDEX org_id (org_id); +SHOW CREATE TABLE ticket; +Table Create Table +ticket CREATE TABLE `ticket` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mask` varchar(16) NOT NULL DEFAULT '', + `subject` varchar(255) NOT NULL DEFAULT '', + `is_closed` tinyint(1) unsigned NOT NULL DEFAULT 0, + `is_deleted` tinyint(1) unsigned NOT NULL DEFAULT 0, + `group_id` int(10) unsigned NOT NULL DEFAULT 0, + `bucket_id` int(10) unsigned NOT NULL DEFAULT 0, + `first_message_id` int(10) unsigned NOT NULL DEFAULT 0, + `created_date` int(10) unsigned DEFAULT NULL, + `updated_date` int(10) unsigned DEFAULT NULL, + `due_date` int(10) unsigned DEFAULT NULL, + `first_wrote_address_id` int(10) unsigned NOT NULL DEFAULT 0, + `last_wrote_address_id` int(10) unsigned NOT NULL DEFAULT 0, + `spam_score` decimal(4,4) NOT NULL DEFAULT 0.0000, + `spam_training` varchar(1) NOT NULL DEFAULT '', + `interesting_words` varchar(255) NOT NULL DEFAULT '', + `next_action` varchar(255) NOT NULL DEFAULT '', + `org_id` int(10) unsigned NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `org_id` (`org_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE ticket; +CREATE TABLE t ( +id bigint(20) unsigned NOT NULL auto_increment, +d date NOT NULL, +a bigint(20) unsigned NOT NULL, +b smallint(5) unsigned DEFAULT NULL, +PRIMARY KEY (id,d) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs STATS_SAMPLE_PAGES=2 +PARTITION BY RANGE COLUMNS(d) +( +PARTITION p20170914 VALUES LESS THAN ('2017-09-15') ENGINE = InnoDB, +PARTITION p99991231 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB); +insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10); +insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10); +replace into t(d,a,b) select '2017-09-15',rand()*10000,rand()*10 from t t1, t t2, t t3, t t4; +select count(*) from t where d ='2017-09-15'; +count(*) +18 +ALTER TABLE t CHANGE b c smallint(5) unsigned , ADD KEY idx_d_a (d, a); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `d` date NOT NULL, + `a` bigint(20) unsigned NOT NULL, + `c` smallint(5) unsigned DEFAULT NULL, + PRIMARY KEY (`id`,`d`), + KEY `idx_d_a` (`d`,`a`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs STATS_SAMPLE_PAGES=2 + PARTITION BY RANGE COLUMNS(`d`) +(PARTITION `p20170914` VALUES LESS THAN ('2017-09-15') ENGINE = InnoDB, + PARTITION `p99991231` VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB) +analyze table t; +Table Op Msg_type Msg_text +test.t analyze status Engine-independent statistics collected +test.t analyze status OK +select count(*) from t where d ='2017-09-15'; +count(*) +18 +select count(*) from t force index(primary) where d ='2017-09-15'; +count(*) +18 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result new file mode 100644 index 00000000..4475abab --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result @@ -0,0 +1,65 @@ +call mtr.add_suppression("Cannot find index f2 in InnoDB index dictionary."); +call mtr.add_suppression("InnoDB indexes are inconsistent with what defined in .frm for table"); +call mtr.add_suppression("Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in"); +call mtr.add_suppression("InnoDB could not find key no 1 with name f2 from dict cache for table"); +# +# Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS +# +# Temporary tablename will be unique. This makes sure that future +# in-place ALTERs of the same table will not be blocked due to +# temporary tablename. +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb; +SET debug_dbug='+d,innodb_alter_commit_crash_before_commit'; +ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); +ERROR HY000: Lost connection to server during query +# restart +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# Consecutive Alter table does not create same temporary file name +ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f2`,`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +# +# MDEV-22928 InnoDB fails to fetch index type +# when index mismatch +# +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +index(f1), index(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1), (2, 2); +connect con1,localhost,root,,test; +SET DEBUG_SYNC="alter_table_inplace_after_commit SIGNAL default_signal WAIT_FOR default_done"; +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +connection default; +set DEBUG_SYNC="now WAIT_FOR default_signal"; +# restart +disconnect con1; +SHOW KEYS FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t1 1 f1 1 f1 A # NULL NULL BTREE NO +DROP TABLE t1; +# +# MDEV-25503 InnoDB hangs on startup during recovery +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1; +connect con1,localhost,root,,; +BEGIN; +DELETE FROM mysql.innodb_table_stats; +connect con2,localhost,root,,; +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL blocked WAIT_FOR ever'; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +# restart +SELECT * FROM t1; +a +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-alter-timestamp.result b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result new file mode 100644 index 00000000..1a68c540 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result @@ -0,0 +1,148 @@ +CREATE TABLE t1 (i1 INT UNSIGNED NULL DEFAULT 42) ENGINE=innodb; +INSERT INTO t1 VALUES(NULL); +ALTER TABLE t1 CHANGE i1 i1 INT UNSIGNED NOT NULL DEFAULT rand(), +ALGORITHM=INPLACE; +ERROR 01000: Data truncated for column 'i1' at row 1 +ALTER TABLE t1 CHANGE i1 i1 INT UNSIGNED NOT NULL DEFAULT rand(), +ALGORITHM=COPY; +ERROR 01000: Data truncated for column 'i1' at row 1 +ALTER TABLE t1 CHANGE i1 id INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD PRIMARY KEY(id), ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +ALTER IGNORE TABLE t1 ADD PRIMARY KEY(i1), ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows. Try ALGORITHM=COPY +SET @old_sql_mode = @@sql_mode; +SET sql_mode = ''; +ALTER TABLE t1 ADD PRIMARY KEY(i1), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'i1' at row 1 +SET sql_mode = @old_sql_mode; +ALTER TABLE t1 CHANGE i1 id INT UNSIGNED NOT NULL AUTO_INCREMENT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +id +42 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (i1 INT UNSIGNED NOT NULL, d1 TIMESTAMP NULL) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i1` int(10) unsigned NOT NULL, + `d1` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5); +select * from t1; +i1 d1 +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +set sql_mode = 'STRICT_ALL_TABLES,NO_ZERO_DATE'; +ALTER TABLE t1 CHANGE d1 d1 TIMESTAMP NULL DEFAULT '2017-05-08 16:23:45', +ALGORITHM=INPLACE; +SELECT DISTINCT d1 FROM t1; +d1 +NULL +ALTER TABLE t1 CHANGE d1 d1 TIMESTAMP NULL DEFAULT '2017-05-08 16:32:45', +ALGORITHM=COPY; +SELECT DISTINCT d1 FROM t1; +d1 +NULL +ALTER TABLE t1 CHANGE d1 d1 TIMESTAMP DEFAULT '2017-05-08 16:32:54'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT COUNT(DISTINCT d1),COUNT(d1),COUNT(*) FROM t1; +COUNT(DISTINCT d1) COUNT(d1) COUNT(*) +0 0 5 +drop table t1; +CREATE TABLE t1 ( +`i1` INT(10) UNSIGNED NOT NULL, +`d1` TIMESTAMP NULL DEFAULT NULL +) ENGINE=innodb; +INSERT INTO t1 (i1) VALUES (1), (2), (3), (4), (5); +ALTER TABLE t1 CHANGE d1 d1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN w1 varchar(20) NULL DEFAULT USER(); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 CHANGE w1 u1 varchar(30) NULL DEFAULT substr(USER(),1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT u1, COUNT(DISTINCT d1) FROM t1 GROUP BY u1; +u1 COUNT(DISTINCT d1) +root@localhost 1 +ALTER TABLE t1 ADD COLUMN d2 TIMESTAMP DEFAULT '2017-05-08 16:23:45', +LOCK=NONE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED +ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +SELECT d1-d3, d2 FROM t1; +d1-d3 d2 +0 2017-05-08 16:23:45 +0 2017-05-08 16:23:45 +0 2017-05-08 16:23:45 +0 2017-05-08 16:23:45 +0 2017-05-08 16:23:45 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i1` int(10) unsigned NOT NULL, + `d1` timestamp NOT NULL DEFAULT current_timestamp(), + `u1` varchar(30) DEFAULT substr(user(),1), + `d2` timestamp NULL DEFAULT '2017-05-08 16:23:45', + `d3` timestamp NULL DEFAULT `d1` +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 ADD COLUMN d4 TIMESTAMP DEFAULT CURRENT_TIMESTAMP; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT COUNT(DISTINCT d4),COUNT(d4),COUNT(*) FROM t1; +COUNT(DISTINCT d4) COUNT(d4) COUNT(*) +1 5 5 +SELECT DISTINCT (CURRENT_TIMESTAMP()-d4) <= 60 FROM t1; +(CURRENT_TIMESTAMP()-d4) <= 60 +1 +DROP TABLE t1; +CREATE TABLE t1(f1 int) ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM seq_1_to_4096; +connect purge_control,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1; +SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_DATE'; +ALTER TABLE t1 ADD f2 DATE NOT NULL, ALGORITHM=INPLACE; +INSERT INTO t1 VALUES (1, now()); +Warnings: +Note 1265 Data truncated for column 'f2' at row 1 +ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +DROP TABLE t1; +disconnect purge_control; +# +# MDEV-26458 SIGSEGV in innobase_table_is_empty() on ALTER TABLE +# +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t DISCARD TABLESPACE; +SET sql_mode='NO_ZERO_DATE'; +ALTER TABLE t ADD c DATE NOT NULL; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +SET sql_mode=DEFAULT; +DROP TABLE t; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result new file mode 100644 index 00000000..16c33ee0 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter.result @@ -0,0 +1,1092 @@ +SET NAMES utf8mb4; +CREATE TABLE t1 ( +c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, +INDEX(c2)) +ENGINE=InnoDB; +INSERT INTO t1 SET c1=1; +CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE NAME LIKE 'test/t%'; +CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +CREATE TABLE t1p LIKE t1; +CREATE TABLE t1c (c1 INT PRIMARY KEY, c2 INT, c3 INT, INDEX(c2), INDEX(c3), +CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES t1(c2), +CONSTRAINT t1c3 FOREIGN KEY (c3) REFERENCES t1p(c2)) +ENGINE=InnoDB; +CREATE TABLE sys_foreign SELECT i.* +FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i +WHERE FOR_NAME LIKE 'test/t%'; +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c2 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT 1, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 ALTER c2 DROP DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11), + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c2 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1; +ALTER TABLE t1 CHANGE c1 c1 INT FIRST; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c2 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE C2 c3 INT; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE c3 C INT; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +C 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 C +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 C 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT; +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 Cöŀumň_TWO 0 +test/t1c3 c3 c2 0 +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +Cöŀumň_TWO 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 Cöŀumň_TWO +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 Cöŀumň_TWO 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT; +ERROR 42S22: Unknown column 'cöĿǖmň_two' in 't1' +ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3; +SELECT st.NAME, i.NAME +FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i +ON i.TABLE_ID=st.TABLE_ID; +NAME NAME +test/t1 test/t3 +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `c1` int(11) NOT NULL, + `c3` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + KEY `c3` (`c3`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t3` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t3 CHANGE c3 +`12345678901234567890123456789012345678901234567890123456789012345` INT; +ERROR 42000: Identifier name '12345678901234567890123456789012345678901234567890123456789012345' is too long +ALTER TABLE t3 CHANGE c3 +`1234567890123456789012345678901234567890123456789012345678901234` INT; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `c1` int(11) NOT NULL, + `1234567890123456789012345678901234567890123456789012345678901234` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`1234567890123456789012345678901234567890123456789012345678901234`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t3 CHANGE +`1234567890123456789012345678901234567890123456789012345678901234` +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT; +ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long +ALTER TABLE t3 CHANGE +`1234567890123456789012345678901234567890123456789012345678901234` +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT; +ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long +ALTER TABLE t3 CHANGE +`1234567890123456789012345678901234567890123456789012345678901234` +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT; +ALTER TABLE t3 CHANGE +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä` +c3 INT; +ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT; +ERROR HY000: Invalid utf8mb4 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\...' +ALTER TABLE t3 CHANGE c3 😲 INT; +ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2' +ALTER TABLE t3 RENAME TO t2; +SELECT st.NAME, i.NAME +FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i +ON i.TABLE_ID=st.TABLE_ID; +NAME NAME +test/t1 test/t2 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` int(11) NOT NULL, + `c3` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +RENAME TABLE t2 TO t1; +SELECT st.NAME, i.NAME +FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i +ON i.TABLE_ID=st.TABLE_ID; +NAME NAME +test/t1 test/t1 +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 DROP INDEX c2; +ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint +ALTER TABLE t1 DROP INDEX c4; +ERROR 42000: Can't DROP INDEX `c4`; check that it exists +ALTER TABLE t1c DROP FOREIGN KEY c2; +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it exists +ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2; +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it exists +ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2, DROP INDEX c2; +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it exists +ALTER TABLE t1c DROP INDEX c2; +ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint +ALTER TABLE t1c DROP FOREIGN KEY ẗ1C2; +ERROR 42000: Can't DROP FOREIGN KEY `ẗ1C2`; check that it exists +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + KEY `c3` (`c3`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET foreign_key_checks=0; +DROP TABLE t1p; +SET foreign_key_checks=1; +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + KEY `c3` (`c3`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +CREATE TABLE t1p (c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB; +ALTER TABLE t1c DROP INDEX C2, DROP INDEX C3; +ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint +ALTER TABLE t1c DROP INDEX C3; +ERROR HY000: Cannot drop index 'c3': needed in a foreign key constraint +SET foreign_key_checks=0; +ALTER TABLE t1c DROP INDEX C3; +SET foreign_key_checks=1; +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1c DROP FOREIGN KEY t1C3; +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2; +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +CREATE TABLE t1o LIKE t1; +ALTER TABLE t1 ADD FULLTEXT INDEX (ct), +CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt, +ALGORITHM=INPLACE, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +ALTER TABLE t1 ADD FULLTEXT INDEX (ct), +CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt, +ALGORITHM=INPLACE, LOCK=SHARED; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +SHOW CREATE TABLE tt; +Table Create Table +tt CREATE TABLE `tt` ( + `pk` int(11) NOT NULL, + `c2` int(11) DEFAULT 42, + `ct` text DEFAULT NULL, + PRIMARY KEY (`pk`), + FULLTEXT KEY `ct` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +CREATE TABLE tu ( +pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT, +FULLTEXT INDEX(t) +) ENGINE=InnoDB; +ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +DROP TABLE tu; +CREATE TABLE tv ( +pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT, +UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID), +FULLTEXT INDEX(t) +) ENGINE=InnoDB; +ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +DROP TABLE tv; +ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'dB_row_Id' +ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'DB_ROW_ID' +ALTER TABLE t1o CHANGE c1 DB_TRX_ID INT; +ERROR 42000: Incorrect column name 'DB_TRX_ID' +ALTER TABLE t1o CHANGE c1 db_roll_ptr INT; +ERROR 42000: Incorrect column name 'DB_ROLL_PTR' +ALTER TABLE t1o ADD COLUMN DB_TRX_ID INT; +ERROR 42000: Incorrect column name 'DB_TRX_ID' +ALTER TABLE t1o ADD COLUMN db_roll_ptr INT; +ERROR 42000: Incorrect column name 'db_roll_ptr' +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT; +ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED; +ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), +ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL; +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID INT; +ERROR 42S21: Duplicate column name 'FTS_DOC_ID' +ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY +ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, DROP INDEX ct, ALGORITHM=INPLACE; +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN cu TEXT; +ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT, +ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY +ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED, +ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY +ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1o ADD FULLTEXT INDEX(cu), +ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY +ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ALGORITHM=INPLACE; +ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY +ALTER TABLE t1o DROP COLUMN FTS_DOC_ID; +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT, +ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT, +ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_Doc_ID INT, +ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), +CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +CREATE TABLE t1n LIKE t1o; +ALTER TABLE t1n ADD FULLTEXT INDEX(ct); +ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'Fts_DOC_ID' +ALTER TABLE t1n CHANGE FTS_DOC_ID c11 INT, ALGORITHM=INPLACE; +ERROR 42S22: Unknown column 'FTS_DOC_ID' in 't1n' +ALTER TABLE t1n CHANGE c1 FTS_DOC_ïD INT, ALGORITHM=INPLACE; +ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE; +ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT, +ALGORITHM=INPLACE; +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c2` int(11) NOT NULL, + `ct` int(11) DEFAULT NULL, + `c1` text DEFAULT NULL, + `cu` text DEFAULT NULL, + PRIMARY KEY (`c2`), + FULLTEXT KEY `ct` (`c1`), + FULLTEXT KEY `ct_2` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT, +ALGORITHM=COPY; +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + `cu` text DEFAULT NULL, + PRIMARY KEY (`c1`), + FULLTEXT KEY `ct` (`ct`), + FULLTEXT KEY `ct_2` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE; +ERROR 42000: Key column 'c2' doesn't exist in table +ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY; +ERROR 42000: Key column 'c2' doesn't exist in table +ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c1` int(11) NOT NULL, + `c4` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + `cu` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c4` (`c4`), + FULLTEXT KEY `ct` (`ct`), + FULLTEXT KEY `ct_2` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1n DROP INDEX c4; +ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE; +ERROR 42S21: Duplicate column name 'c1' +ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE; +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c1` int(11) NOT NULL, + `c11` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + `cu` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c11` (`c11`), + FULLTEXT KEY `ct` (`ct`), + FULLTEXT KEY `ct_2` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1n; +ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct, +ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct; +ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ALGORITHM=INPLACE; +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE; +ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, +ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY +SELECT sc.pos FROM information_schema.innodb_sys_columns sc +INNER JOIN information_schema.innodb_sys_tables st +ON sc.TABLE_ID=st.TABLE_ID +WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID'; +pos +0 +SHOW CREATE TABLE t1o; +Table Create Table +t1o CREATE TABLE `t1o` ( + `FTS_DOC_ID` bigint(20) unsigned NOT NULL, + `c2` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + `cu` text DEFAULT NULL, + PRIMARY KEY (`FTS_DOC_ID`), + FULLTEXT KEY `ct` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, +DROP INDEX ct, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1o; +Table Create Table +t1o CREATE TABLE `t1o` ( + `foo_id` bigint(20) unsigned NOT NULL, + `c2` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + `cu` text DEFAULT NULL, + PRIMARY KEY (`foo_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign; +CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE NAME='test/t1o'; +CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +CREATE TABLE sys_foreign SELECT i.* +FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i WHERE FOR_NAME='test/t1o'; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +foo_id 0 6 1800 8 +c2 1 6 1027 4 +ct 2 5 524540 10 +cu 3 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 foo_id +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID), +ADD FULLTEXT INDEX(ct), +CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL; +ALTER TABLE t1o DROP INDEX ct, DROP INDEX FTS_DOC_ID_INDEX, +CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL; +ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id); +ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ADD FULLTEXT INDEX(ct); +DROP TABLE sys_indexes; +CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +FTS_DOC_ID 0 6 1800 8 +c2 1 6 1027 4 +ct 2 5 524540 10 +cu 3 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 FTS_DOC_ID +FTS_DOC_ID_INDEX 0 FTS_DOC_ID +ct 0 ct +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign; +CREATE TABLE t (t TEXT, FULLTEXT(t)) ENGINE=InnoDB; +DROP INDEX t ON t; +SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE '%FTS_%' ORDER BY 1, 2; +prefix name +FTS_0 test/FTS_AUX_BEING_DELETED +FTS_0 test/FTS_AUX_BEING_DELETED_CACHE +FTS_0 test/FTS_AUX_CONFIG +FTS_0 test/FTS_AUX_DELETED +FTS_0 test/FTS_AUX_DELETED_CACHE +SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc +INNER JOIN information_schema.innodb_sys_tables st +ON sc.TABLE_ID=st.TABLE_ID +WHERE st.NAME='test/t'; +pos NAME +0 t +1 FTS_DOC_ID +ALTER TABLE t ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE; +SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE '%FTS_%' ORDER BY 1, 2; +prefix name +ALTER TABLE t ADD FULLTEXT INDEX(t); +SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc +INNER JOIN information_schema.innodb_sys_tables st +ON sc.TABLE_ID=st.TABLE_ID +WHERE st.NAME='test/t'; +pos NAME +0 t +1 FTS_DOC_ID +DROP TABLE t; +# +# Bug #19465984 INNODB DATA DICTIONARY IS NOT UPDATED WHILE +# RENAMING THE COLUMN +# +CREATE TABLE t1(c1 INT NOT NULL, PRIMARY KEY(c1))ENGINE=INNODB; +CREATE TABLE t2(c2 INT NOT NULL, FOREIGN KEY(c2) REFERENCES t1(c1))ENGINE=INNODB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c2` int(11) NOT NULL, + KEY `c2` (`c2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 CHANGE COLUMN c1 C1 INT; +ALTER TABLE t2 CHANGE COLUMN c2 C2 INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `C1` int(11) NOT NULL, + PRIMARY KEY (`C1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `C2` int(11) DEFAULT NULL, + KEY `c2` (`C2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`C2`) REFERENCES `t1` (`C1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 CHANGE COLUMN C1 c5 INT; +ALTER TABLE t2 CHANGE COLUMN C2 c6 INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c5` int(11) NOT NULL, + PRIMARY KEY (`c5`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c6` int(11) DEFAULT NULL, + KEY `c2` (`c6`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c6`) REFERENCES `t1` (`c5`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN +INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID +WHERE T.NAME='test/t1'; +NAME +c5 +SELECT F.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS F INNER JOIN +INFORMATION_SCHEMA.INNODB_SYS_INDEXES I ON F.INDEX_ID=I.INDEX_ID INNER JOIN +INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON I.TABLE_ID=T.TABLE_ID +WHERE T.NAME='test/t1' AND I.NAME='PRIMARY'; +NAME +c5 +SELECT C.REF_COL_NAME, C.FOR_COL_NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS C INNER JOIN +INFORMATION_SCHEMA.INNODB_SYS_FOREIGN F ON C.ID=F.ID +WHERE F.FOR_NAME='test/t2'; +REF_COL_NAME FOR_COL_NAME +c5 c6 +DROP TABLE t2, t1; +# virtual columns case too +CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB; +ALTER TABLE t1 CHANGE COLUMN a A INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `A` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN +INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID +WHERE T.NAME='test/t1'; +NAME +A +b +DROP TABLE t1; +# different FOREIGN KEY cases +CREATE TABLE t1 ( +a INT UNIQUE KEY, +b INT UNIQUE KEY, +c INT UNIQUE KEY, +d INT UNIQUE KEY +) ENGINE=INNODB; +CREATE TABLE t2 ( +aa INT, +bb INT, +cc INT, +dd INT +) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 1, 1, 1); +INSERT INTO t2 VALUES (1, 1, 1, 1); +ALTER TABLE t1 CHANGE a A INT, ALGORITHM=INPLACE; +ALTER TABLE t1 CHANGE c C INT, ALGORITHM=INPLACE; +ALTER TABLE t2 CHANGE cc CC INT, ALGORITHM=INPLACE; +ALTER TABLE t2 CHANGE dd DD INT, ALGORITHM=INPLACE; +SET foreign_key_checks=0; +ALTER TABLE t2 +ADD FOREIGN KEY(aa) REFERENCES t1(a), +ADD FOREIGN KEY(bb) REFERENCES t1(b), +ADD FOREIGN KEY(cc) REFERENCES t1(c), +ADD FOREIGN KEY(dd) REFERENCES t1(d), +ALGORITHM=INPLACE; +ALTER TABLE t1 CHANGE b B INT, ALGORITHM=INPLACE; +ALTER TABLE t2 CHANGE aa AA INT, ALGORITHM=INPLACE; +# restart +ALTER TABLE t1 CHANGE d D INT, ALGORITHM=INPLACE; +ALTER TABLE t2 CHANGE bb BB INT, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `A` int(11) DEFAULT NULL, + `B` int(11) DEFAULT NULL, + `C` int(11) DEFAULT NULL, + `D` int(11) DEFAULT NULL, + UNIQUE KEY `a` (`A`), + UNIQUE KEY `b` (`B`), + UNIQUE KEY `c` (`C`), + UNIQUE KEY `d` (`D`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `AA` int(11) DEFAULT NULL, + `BB` int(11) DEFAULT NULL, + `CC` int(11) DEFAULT NULL, + `DD` int(11) DEFAULT NULL, + KEY `aa` (`AA`), + KEY `bb` (`BB`), + KEY `CC` (`CC`), + KEY `DD` (`DD`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`), + CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`BB`) REFERENCES `t1` (`B`), + CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`CC`) REFERENCES `t1` (`C`), + CONSTRAINT `t2_ibfk_4` FOREIGN KEY (`DD`) REFERENCES `t1` (`D`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DELETE FROM t1 WHERE a=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DELETE FROM t1 WHERE A=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DELETE FROM t1 WHERE b=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DELETE FROM t1 WHERE B=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DELETE FROM t1 WHERE c=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DELETE FROM t1 WHERE C=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DELETE FROM t1 WHERE d=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DELETE FROM t1 WHERE D=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`AA`) REFERENCES `t1` (`A`)) +DROP TABLE t2, t1; +# virtual columns case too +CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB; +ALTER TABLE t1 CHANGE COLUMN a A INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `A` int(11) DEFAULT NULL, + `b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN +INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID +WHERE T.NAME='test/t1'; +NAME +A +b +DROP TABLE t1; +# and an MDEV-18041 regression related to indexes prefixes +create table `test` ( +`test_old` varchar(255) NOT NULL, +`other` varchar(255) NOT NULL, +PRIMARY KEY (`test_old`,`other`), +UNIQUE KEY uk (`test_old`(100), `other`) +) ENGINE=InnoDB; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +name pos +test_old 0 +other 1 +test_old 0 +other 1 +alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +name pos +test_new 0 +other 1 +test_new 0 +other 1 +drop table `test`; +# +# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN +# DICT_MEM_TABLE_COL_RENAME_LOW +# +CREATE TABLE parent(a INT, b INT, KEY(a, b)) ENGINE = InnoDB; +CREATE TABLE t1(a1 INT, a2 INT) ENGINE = InnoDB; +set foreign_key_checks=0; +ALTER TABLE t1 ADD CONSTRAINT fk_a FOREIGN KEY(a1, a2) REFERENCES parent(a, b) ON DELETE SET NULL ON UPDATE CASCADE; +ALTER TABLE t1 CHANGE a2 a3 INT,ADD CONSTRAINT fk_1 FOREIGN KEY(a1, a3) REFERENCES parent(a, b) ON DELETE SET NULL ON UPDATE CASCADE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a1` int(11) DEFAULT NULL, + `a3` int(11) DEFAULT NULL, + KEY `fk_1` (`a1`,`a3`), + CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a3`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a3`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 CHANGE a3 a4 INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a1` int(11) DEFAULT NULL, + `a4` int(11) DEFAULT NULL, + KEY `fk_1` (`a1`,`a4`), + CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE parent CHANGE b c INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a1` int(11) DEFAULT NULL, + `a4` int(11) DEFAULT NULL, + KEY `fk_1` (`a1`,`a4`), + CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `c`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `c`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1, parent; +# +#BUG#21514135 SCHEMA MISMATCH ERROR WHEN IMPORTING TABLESPACE AFTER +#DROPPING AN INDEX +# +SET NAMES utf8mb4; +CREATE DATABASE source_db; +CREATE DATABASE dest_db; +CREATE TABLE source_db.t1 ( +id int(11) NOT NULL, +age int(11) DEFAULT NULL, +name varchar(20), +PRIMARY KEY (id), +KEY index1 (age) +) ENGINE=InnoDB; +ALTER TABLE source_db.t1 DROP INDEX index1, ADD INDEX index2(name, age), algorithm=inplace; +FLUSH TABLES source_db.t1 FOR EXPORT; +UNLOCK TABLES; +USE dest_db; +CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `age` int(11) DEFAULT NULL, + `name` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `index2` (`name`,`age`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +ALTER TABLE dest_db.t1 DISCARD TABLESPACE; +ALTER TABLE dest_db.t1 IMPORT TABLESPACE; +CHECK TABLE dest_db.t1; +Table Op Msg_type Msg_text +dest_db.t1 check status OK +SHOW CREATE TABLE dest_db.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `age` int(11) DEFAULT NULL, + `name` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `index2` (`name`,`age`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM dest_db.t1; +id age name +DROP TABLE dest_db.t1; +ALTER TABLE source_db.t1 DROP INDEX index2, algorithm=inplace; +FLUSH TABLES source_db.t1 FOR EXPORT; +UNLOCK TABLES; +USE dest_db; +CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `age` int(11) DEFAULT NULL, + `name` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +ALTER TABLE dest_db.t1 DISCARD TABLESPACE; +ALTER TABLE dest_db.t1 IMPORT TABLESPACE; +CHECK TABLE dest_db.t1; +Table Op Msg_type Msg_text +dest_db.t1 check status OK +SHOW CREATE TABLE dest_db.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `age` int(11) DEFAULT NULL, + `name` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM dest_db.t1; +id age name +DROP TABLE dest_db.t1; +DROP TABLE source_db.t1; +DROP DATABASE source_db; +DROP DATABASE dest_db; +# +# BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE +# ORPHANED DUE TO RENAME TABLE +# +CREATE DATABASE db1; +USE db1; +CREATE TABLE notes ( +id int(11) NOT NULL AUTO_INCREMENT, +body text COLLATE utf8_unicode_ci, +PRIMARY KEY (id) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 +COLLATE=utf8_unicode_ci +ROW_FORMAT=COMPRESSED; +ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255)); +DROP INDEX index_ft_body ON notes; +CREATE DATABASE db2; +RENAME TABLE db1.notes TO db2.notes; +DROP DATABASE db1; +DROP DATABASE db2; +USE test; +# +# MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function +# +CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB; +iNSERT INTO t1 VALUES (10); +ALTER TABLE t1 ADD b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); +ERROR 22003: Out of range value for column 'b' at row 1 +SELECT * FROM t1; +a +10 +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB; +INSERT INTO t1 VALUES (10); +ALTER TABLE t1 ADD b DATE NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0), algorithm=copy; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'b' at row 1 +SELECT * FROM t1; +a b +10 2001-01-01 +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB; +iNSERT INTO t1 VALUES (10); +ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'b' at row 0 +SELECT * FROM t1; +a b +10 10:20:30 +DROP TABLE t1; +# +# MDEV-18042 Server crashes in mysql_alter_table upon adding a non-null +# date column under NO_ZERO_DATE with ALGORITHM=INPLACE +# +SET @OLD_SQL_MODE= @@SQL_MODE; +SET @@SQL_MODE= 'NO_ZERO_DATE'; +CREATE OR REPLACE TABLE t1 (i INT) ENGINE=MyISAM; +ALTER TABLE t1 ADD COLUMN d DATE NOT NULL, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +CREATE OR REPLACE TABLE t1 (i INT) ENGINE=InnoDB; +ALTER TABLE t1 ADD d DATETIME NOT NULL CHECK (f <= 0), ALGORITHM=COPY; +ERROR 42S22: Unknown column 'f' in 'CHECK' +CREATE OR REPLACE TABLE t1 (a int) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE; +# Cleanup +SET @@SQL_MODE= @OLD_SQL_MODE; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-analyze.result b/mysql-test/suite/innodb/r/innodb-analyze.result new file mode 100644 index 00000000..f3285a81 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-analyze.result @@ -0,0 +1,4 @@ +Warnings: +Warning 1292 Truncated incorrect innodb_stats_transient_sample... value: '0' +Variable_name Value +innodb_stats_transient_sample_pages 1 diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-18274.result b/mysql-test/suite/innodb/r/innodb-autoinc-18274.result new file mode 100644 index 00000000..0f030a8c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-18274.result @@ -0,0 +1,26 @@ +drop table if exists t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DELETE FROM t1; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +c1 +2 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result new file mode 100644 index 00000000..8db5952d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result @@ -0,0 +1,43 @@ +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +INSERT INTO t1 VALUES (null); +ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +d1 +1 +2 +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`d1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +d1 +1 +2 +3 +ALTER TABLE t1 AUTO_INCREMENT = 3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`d1`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES(null); +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +d1 +1 +2 +3 +4 +5 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-56228.result b/mysql-test/suite/innodb/r/innodb-autoinc-56228.result new file mode 100644 index 00000000..6a3fd85e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-56228.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS t1_56228; +Warnings: +Note 1051 Unknown table 'test.t1_56228' +DROP TABLE IF EXISTS t2_56228; +Warnings: +Note 1051 Unknown table 'test.t2_56228' +DROP FUNCTION IF EXISTS bug56228; +Warnings: +Note 1305 FUNCTION test.bug56228 does not exist +CREATE TEMPORARY TABLE t1_56228( +c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2_56228( +c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +CREATE FUNCTION bug56228() RETURNS INT DETERMINISTIC +BEGIN +INSERT INTO t1_56228 VALUES(NULL); +INSERT INTO t2_56228 VALUES(NULL); +INSERT INTO t1_56228 VALUES(NULL); +INSERT INTO t2_56228 VALUES(NULL); +DROP TEMPORARY TABLE t1_56228; +RETURN 42; +END // +SELECT bug56228(); +bug56228() +42 +DROP FUNCTION bug56228; +DROP TEMPORARY TABLE t2_56228; +DROP TEMPORARY TABLE IF EXISTS t1_56228; +Warnings: +Note 1051 Unknown table 'test.t1_56228' diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-61209.result b/mysql-test/suite/innodb/r/innodb-autoinc-61209.result new file mode 100644 index 00000000..f01008a8 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-61209.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS bug_61209; +CREATE TABLE bug_61209 (a INT auto_increment, PRIMARY KEY(a)) ENGINE=InnoDB; +INSERT INTO bug_61209 VALUES (), (), (), (); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION auto_increment_increment=3; +SET SESSION auto_increment_offset=2; +SELECT GET_LOCK('a', 9); +GET_LOCK('a', 9) +1 +connection con2; +SET SESSION auto_increment_increment=3; +SET SESSION auto_increment_offset=2; +INSERT INTO bug_61209 (a) VALUES (NULL), (NULL), (NULL + GET_LOCK('a', 10)); +connection con1; +INSERT INTO bug_61209 (a) VALUES (NULL), (NULL), (NULL); +SELECT RELEASE_LOCK('a'); +RELEASE_LOCK('a') +1 +connection con2; +DROP TABLE bug_61209; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-optimize.result b/mysql-test/suite/innodb/r/innodb-autoinc-optimize.result new file mode 100644 index 00000000..c6da4355 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-optimize.result @@ -0,0 +1,9 @@ +drop table if exists t1; +create table t1(a int not null auto_increment primary key) engine=innodb; +insert into t1 set a = -1; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +==== clean up ==== +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-part.result b/mysql-test/suite/innodb/r/innodb-autoinc-part.result new file mode 100644 index 00000000..f7bbc10c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-part.result @@ -0,0 +1,34 @@ +# +# MDEV-28416 Incorrect AUTO_INCREMENT may be issued +# +SET @aii=@@auto_increment_increment; +SET auto_increment_increment=300; +CREATE TABLE t1 (a SERIAL) ENGINE=innodb +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +INSERT INTO t1 VALUES (18446744073709551613); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`a`) +(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +INSERT INTO t1 VALUES (NULL); +ERROR 22003: Out of range value for column 'a' at row 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`a`) +(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +DROP TABLE t1; +SET auto_increment_increment=@aii; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result new file mode 100644 index 00000000..2fb12dcf --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -0,0 +1,1647 @@ +CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (9223372036854775807, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +9223372036854775807 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (127, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +127 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (255, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +255 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (32767, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +32767 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (65535, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +65535 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (8388607, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +8388607 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (16777215, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +16777215 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (2147483647, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +2147483647 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (4294967295, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +4294967295 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (9223372036854775807, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 c2 +9223372036854775807 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (18446744073709551615, null); +INSERT INTO t1 (c2) VALUES ('innodb'); +Got one of the listed errors +SELECT * FROM t1; +c1 c2 +18446744073709551615 NULL +DROP TABLE t1; +CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2), (3); +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SELECT c1 FROM t1; +c1 +1 +2 +3 +4 +5 +6 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +TRUNCATE TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (1), (2), (3); +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SELECT c1 FROM t1; +c1 +1 +2 +3 +4 +5 +6 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2), (3); +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SELECT c1 FROM t1; +c1 +1 +2 +3 +4 +5 +6 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DELETE FROM t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (1), (2), (3); +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SELECT c1 FROM t1; +c1 +1 +2 +3 +7 +8 +9 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (NULL,8); +SELECT * FROM t1; +c1 c2 +2 1 +3 8 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1), (NULL, 8); +INSERT INTO t1 VALUES (NULL,9); +SELECT * FROM t1; +c1 c2 +2 1 +3 8 +5 9 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(5),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +5 +10 +110 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +c1 +5 +10 +110 +250 +310 +400 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +-1 +1 +2 +10 +110 +250 +410 +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +Got one of the listed errors +SELECT * FROM t1; +c1 +-1 +1 +2 +10 +110 +250 +410 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +c1 +-1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +-2 +-1 +1 +2 +10 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +c1 +-2 +-1 +1 +2 +10 +250 +310 +400 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT IGNORE INTO t1 VALUES(-1); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT IGNORE INTO t1 VALUES (-2); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (250); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +310 +400 +1000 +1010 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT IGNORE INTO t1 VALUES(-1); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT IGNORE INTO t1 VALUES (-2),(NULL),(2),(NULL); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +410 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +Got one of the listed errors +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (9223372036854775794); +SELECT * FROM t1; +c1 +1 +9223372036854775794 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 10 +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +c1 +1 +9223372036854775794 +9223372036854775796 +9223372036854775798 +9223372036854775800 +9223372036854775802 +9223372036854775804 +9223372036854775806 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 10 +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +ERROR HY000: Failed to read auto-increment value from storage engine +SELECT * FROM t1; +c1 +1 +18446744073709551603 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 5 +auto_increment_offset 7 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +ERROR HY000: Failed to read auto-increment value from storage engine +SELECT * FROM t1; +c1 +1 +18446744073709551603 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(-9223372036854775806); +INSERT INTO t1 VALUES(-9223372036854775807); +INSERT INTO t1 VALUES(-9223372036854775808); +SELECT * FROM t1; +c1 +-9223372036854775808 +-9223372036854775807 +-9223372036854775806 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 3 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +c1 +-9223372036854775808 +-9223372036854775807 +-9223372036854775806 +1 +3 +6 +9 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551610); +SELECT * FROM t1; +c1 +1 +18446744073709551610 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; +Warnings: +Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976' +Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976' +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 65535 +auto_increment_offset 65535 +INSERT INTO t1 VALUES (NULL),(NULL); +ERROR 22003: Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 +1 +18446744073709551610 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL, 1); +INSERT INTO t1 VALUES(NULL, 2); +SELECT * FROM t1; +c1 c2 +1 1 +2 2 +ALTER TABLE t1 CHANGE c1 c1 SERIAL; +SELECT * FROM t1; +c1 c2 +1 1 +2 2 +INSERT INTO t1 VALUES(NULL, 3); +INSERT INTO t1 VALUES(NULL, 4); +SELECT * FROM t1; +c1 c2 +1 1 +2 2 +3 3 +4 4 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL, 1); +INSERT INTO t1 VALUES(NULL, 2); +SELECT * FROM t1; +c1 c2 +1 1 +2 2 +ALTER TABLE t1 CHANGE c1 c1 SERIAL; +SELECT * FROM t1; +c1 c2 +1 1 +2 2 +INSERT INTO t1 VALUES(NULL, 3); +INSERT INTO t1 VALUES(NULL, 4); +SELECT * FROM t1; +c1 c2 +1 1 +2 2 +3 3 +4 4 +DROP TABLE t1; +# +# Bug#15851528 DUPLICATE KEY ERROR ON AUTO-INC PK WITH MIXED AUTO_INCREMENT_INCREMENT CLIENTS +# +# This test shows that the next record to be inserted is not affected +# by a change in auto_increment_increment. +# In addition, current value of auto_increment_increment by the client +# that uses the existing autoinc value with be used to set next autoinc +# value, which will be used by next client reguardless of its own session +# setting for auto_increment_increment. +# +connection default; +# Client 1: Insert a record with auto_increment_increment=2 +CREATE TABLE t( +a SERIAL PRIMARY KEY, +b VARCHAR(200)) ENGINE=InnoDB; +SET SESSION auto_increment_increment=2; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(b) VALUES('S1'); +SELECT a,b FROM t; +a b +1 S1 +connect con1,localhost,root,,; +connection con1; +# Client 2: Insert records with auto_increment_increment 2,1 +SET SESSION auto_increment_increment=2; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(b) VALUES('S2'); +SELECT a,b FROM t; +a b +1 S1 +3 S2 +SET SESSION auto_increment_increment=1; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(b) VALUES('S2'); +SELECT a,b FROM t; +a b +1 S1 +3 S2 +5 S2 +disconnect con1; +connection default; +# Client 1: Insert a record with auto_increment_increment=1 +SET SESSION auto_increment_increment=1; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(b) VALUES('S1'); +SELECT a,b FROM t; +a b +1 S1 +3 S2 +5 S2 +6 S1 +DROP TABLE t; +# Autoincrement behaviour with mixed insert. +CREATE TABLE t( +a TINYINT AUTO_INCREMENT PRIMARY KEY, +b VARCHAR(200)) ENGINE=InnoDB; +SET SESSION auto_increment_increment=10; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` tinyint(4) NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(b) VALUES('S0'),('S1'); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` tinyint(4) NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(a,b) VALUES(28,'S2'); +SET SESSION auto_increment_increment=1; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` tinyint(4) NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(b) VALUES('S3'); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` tinyint(4) NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t(b) VALUES('S4'); +SELECT * FROM t; +a b +1 S0 +11 S1 +28 S2 +31 S3 +32 S4 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` tinyint(4) NOT NULL AUTO_INCREMENT, + `b` varchar(200) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +DROP TABLE IF EXISTS t2; +Warnings: +Note 1051 Unknown table 'test.t2' +CREATE TABLE t1 ( +a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, +b INT(10) UNSIGNED NOT NULL, +c ENUM('FALSE','TRUE') DEFAULT NULL, +PRIMARY KEY (a)) ENGINE = InnoDB; +CREATE TABLE t2 ( +m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, +n INT(10) UNSIGNED NOT NULL, +o enum('FALSE','TRUE') DEFAULT NULL, +PRIMARY KEY (m)) ENGINE = InnoDB; +INSERT INTO t2 (n,o) VALUES +(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'), +(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false'); +SELECT * FROM t2; +m n o +1 1 TRUE +2 1 FALSE +3 2 TRUE +4 2 FALSE +5 3 TRUE +6 3 FALSE +7 4 TRUE +8 4 FALSE +9 5 TRUE +10 5 FALSE +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `m` int(11) unsigned NOT NULL AUTO_INCREMENT, + `n` int(10) unsigned NOT NULL, + `o` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`m`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) unsigned NOT NULL AUTO_INCREMENT, + `b` int(10) unsigned NOT NULL, + `c` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; +SELECT * FROM t1; +a b c +1 1 TRUE +2 1 FALSE +3 2 TRUE +4 2 FALSE +5 3 TRUE +6 3 FALSE +7 4 TRUE +8 4 FALSE +9 5 TRUE +10 5 FALSE +16 1 TRUE +17 1 FALSE +18 2 TRUE +19 2 FALSE +20 3 TRUE +21 3 FALSE +22 4 TRUE +23 4 FALSE +24 5 TRUE +25 5 FALSE +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) unsigned NOT NULL AUTO_INCREMENT, + `b` int(10) unsigned NOT NULL, + `c` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; +SELECT * FROM t1; +a b c +1 1 TRUE +2 1 FALSE +3 2 TRUE +4 2 FALSE +5 3 TRUE +6 3 FALSE +7 4 TRUE +8 4 FALSE +9 5 TRUE +10 5 FALSE +16 1 TRUE +17 1 FALSE +18 2 TRUE +19 2 FALSE +20 3 TRUE +21 3 FALSE +22 4 TRUE +23 4 FALSE +24 5 TRUE +25 5 FALSE +31 1 FALSE +32 2 FALSE +33 3 FALSE +34 4 FALSE +35 5 FALSE +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) unsigned NOT NULL AUTO_INCREMENT, + `b` int(10) unsigned NOT NULL, + `c` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; +SELECT * FROM t1; +a b c +1 1 TRUE +2 1 FALSE +3 2 TRUE +4 2 FALSE +5 3 TRUE +6 3 FALSE +7 4 TRUE +8 4 FALSE +9 5 TRUE +10 5 FALSE +16 1 TRUE +17 1 FALSE +18 2 TRUE +19 2 FALSE +20 3 TRUE +21 3 FALSE +22 4 TRUE +23 4 FALSE +24 5 TRUE +25 5 FALSE +31 1 FALSE +32 2 FALSE +33 3 FALSE +34 4 FALSE +35 5 FALSE +38 1 FALSE +39 2 FALSE +40 3 FALSE +41 4 FALSE +42 5 FALSE +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) unsigned NOT NULL AUTO_INCREMENT, + `b` int(10) unsigned NOT NULL, + `c` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) unsigned NOT NULL AUTO_INCREMENT, + `b` int(10) unsigned NOT NULL, + `c` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) unsigned NOT NULL AUTO_INCREMENT, + `b` int(10) unsigned NOT NULL, + `c` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; +SELECT * FROM t1; +a b c +1 1 TRUE +2 1 FALSE +3 2 TRUE +4 2 FALSE +5 3 TRUE +6 3 FALSE +7 4 TRUE +8 4 FALSE +9 5 TRUE +10 5 FALSE +16 1 TRUE +17 1 FALSE +18 2 TRUE +19 2 FALSE +20 3 TRUE +21 3 FALSE +22 4 TRUE +23 4 FALSE +24 5 TRUE +25 5 FALSE +31 1 FALSE +32 2 FALSE +33 3 FALSE +34 4 FALSE +35 5 FALSE +38 1 FALSE +39 2 FALSE +40 3 FALSE +41 4 FALSE +42 5 FALSE +45 1 FALSE +46 2 FALSE +47 3 FALSE +48 4 FALSE +49 5 FALSE +52 1 FALSE +53 2 FALSE +54 3 FALSE +55 4 FALSE +56 5 FALSE +59 1 FALSE +60 2 FALSE +61 3 FALSE +62 4 FALSE +63 5 FALSE +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) unsigned NOT NULL AUTO_INCREMENT, + `b` int(10) unsigned NOT NULL, + `c` enum('FALSE','TRUE') DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +DROP TABLE IF EXISTS t2; +Warnings: +Note 1051 Unknown table 'test.t2' +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +CREATE TABLE t1( +c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT +PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +CREATE TABLE t2( +c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT +PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t2 SELECT c1 FROM t1; +Got one of the listed errors +INSERT INTO t2 SELECT NULL FROM t1; +ERROR 22003: Out of range value for column 'c1' at row 1 +DROP TABLE t1; +DROP TABLE t2; +SET sql_mode = DEFAULT; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT INTO t1 VALUES (-1, 'innodb'); +INSERT INTO t1 VALUES (-127, 'innodb'); +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` tinyint(4) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +-127 innodb +-1 innodb +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT IGNORE INTO t1 VALUES (-1, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT IGNORE INTO t1 VALUES (-127, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +1 NULL +2 innodb +3 innodb +4 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT INTO t1 VALUES (-1, 'innodb'); +INSERT INTO t1 VALUES (-32767, 'innodb'); +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` smallint(6) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +-32767 innodb +-1 innodb +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT IGNORE INTO t1 VALUES (-1, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT IGNORE INTO t1 VALUES (-32757, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +1 NULL +2 innodb +3 innodb +4 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT INTO t1 VALUES (-1, 'innodb'); +INSERT INTO t1 VALUES (-8388607, 'innodb'); +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` mediumint(9) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +-8388607 innodb +-1 innodb +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT IGNORE INTO t1 VALUES (-1, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT IGNORE INTO t1 VALUES (-8388607, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +1 NULL +2 innodb +3 innodb +4 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT INTO t1 VALUES (-1, 'innodb'); +INSERT INTO t1 VALUES (-2147483647, 'innodb'); +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +-2147483647 innodb +-1 innodb +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT IGNORE INTO t1 VALUES (-1, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT IGNORE INTO t1 VALUES (-2147483647, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +1 NULL +2 innodb +3 innodb +4 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT INTO t1 VALUES (-1, 'innodb'); +INSERT INTO t1 VALUES (-9223372036854775807, 'innodb'); +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +-9223372036854775807 innodb +-1 innodb +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +INSERT IGNORE INTO t1 VALUES (-1, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT IGNORE INTO t1 VALUES (-9223372036854775807, 'innodb'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +1 NULL +2 innodb +3 innodb +4 NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; +CREATE INDEX i1 on t1(c2); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `i1` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (c2) values (0); +SELECT * FROM t1; +c1 c2 +10 0 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +# restart +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `C1` double NOT NULL AUTO_INCREMENT, + `C2` char(10) DEFAULT NULL, + PRIMARY KEY (`C1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +# restart +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `C1` float NOT NULL AUTO_INCREMENT, + `C2` char(10) DEFAULT NULL, + PRIMARY KEY (`C1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 SET c1 = 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 SET c1 = 2; +INSERT INTO t1 SET c1 = -1; +SELECT * FROM t1; +c1 +-1 +1 +2 +INSERT INTO t1 SET c1 = -1; +Got one of the listed errors +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +REPLACE INTO t1 VALUES (-1); +SELECT * FROM t1; +c1 +-1 +1 +2 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); +SELECT * FROM t1; +c1 +-685113344 +2 +3 +4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); +INSERT INTO t1 VALUES (4), (5), (6), (NULL); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +3 +4 +5 +6 +7 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +5 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1(c1 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (18446744073709551615); +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 256 +CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` tinyint(4) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +1 NULL +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SHOW VARIABLES LIKE "auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (2147483648, 'a'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2147483649 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +2147483648 a +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +ALTER TABLE t1 CHANGE c1 c1 INT default 0; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL DEFAULT 0, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1(c2) VALUES('b'); +SELECT * FROM t1; +c1 c2 +0 b +2147483647 a +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL DEFAULT 0, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT +# AFTER CHANGING AUTO_INCREMENT_INCREMEMENT +# +CREATE TABLE t ( i INT AUTO_INCREMENT, KEY(i) ) ENGINE=InnoDB; +SET auto_increment_increment = 300; +INSERT INTO t VALUES (NULL), (NULL); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `i` int(11) NOT NULL AUTO_INCREMENT, + KEY `i` (`i`) +) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET auto_increment_increment = 50; +INSERT INTO t VALUES (NULL); +SELECT * FROM t; +i +1 +301 +601 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `i` int(11) NOT NULL AUTO_INCREMENT, + KEY `i` (`i`) +) ENGINE=InnoDB AUTO_INCREMENT=651 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t; +SET auto_increment_increment = DEFAULT; +# +# MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op()) +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE TABLE t1 ( +c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT +) ENGINE=InnoDB AUTO_INCREMENT=10000000000000000000; +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +c1 +1e19 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-1); +SELECT * FROM t1; +a +-1 +DROP TABLE t1; +# +# MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number +# +SET @engine='INNODB'; +CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64)) +BEGIN +DECLARE query TEXT DEFAULT 'CREATE TABLE t1 (' + ' id TTT NOT NULL AUTO_INCREMENT,' + ' name CHAR(30) NOT NULL,' + ' PRIMARY KEY (id)) ENGINE=EEE'; +EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine); +SHOW CREATE TABLE t1; +INSERT INTO t1 (name) VALUES ('dog'); +SELECT * FROM t1; +UPDATE t1 SET id=-1 WHERE id=1; +SELECT * FROM t1; +INSERT INTO t1 (name) VALUES ('cat'); +SELECT * FROM t1; +DROP TABLE t1; +END; +$$ +CALL autoinc_mdev15353_one(@engine, 'tinyint'); +Table Create Table +t1 CREATE TABLE `t1` ( + `id` tinyint(4) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +id name +1 dog +id name +-1 dog +id name +-1 dog +2 cat +CALL autoinc_mdev15353_one(@engine, 'smallint'); +Table Create Table +t1 CREATE TABLE `t1` ( + `id` smallint(6) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +id name +1 dog +id name +-1 dog +id name +-1 dog +2 cat +CALL autoinc_mdev15353_one(@engine, 'mediumint'); +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +id name +1 dog +id name +-1 dog +id name +-1 dog +2 cat +CALL autoinc_mdev15353_one(@engine, 'int'); +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +id name +1 dog +id name +-1 dog +id name +-1 dog +2 cat +CALL autoinc_mdev15353_one(@engine, 'bigint'); +Table Create Table +t1 CREATE TABLE `t1` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +id name +1 dog +id name +-1 dog +id name +-1 dog +2 cat +CALL autoinc_mdev15353_one(@engine, 'float'); +Table Create Table +t1 CREATE TABLE `t1` ( + `id` float NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +id name +1 dog +id name +-1 dog +id name +-1 dog +2 cat +CALL autoinc_mdev15353_one(@engine, 'double'); +Table Create Table +t1 CREATE TABLE `t1` ( + `id` double NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +id name +1 dog +id name +-1 dog +id name +-1 dog +2 cat +DROP PROCEDURE autoinc_mdev15353_one; +# +# MDEV-28416 Incorrect AUTO_INCREMENT may be issued +# +SET @aii=@@auto_increment_increment; +SET auto_increment_increment=300; +CREATE TABLE t1 (a SERIAL) ENGINE=innodb; +INSERT INTO t1 VALUES (18446744073709551613); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (NULL); +ERROR 22003: Out of range value for column 'a' at row 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +SET auto_increment_increment=@aii; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/innodb-bigblob.result b/mysql-test/suite/innodb/r/innodb-bigblob.result new file mode 100644 index 00000000..dcde9804 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-bigblob.result @@ -0,0 +1,4 @@ +create table foo (id varchar(37) not null, content longblob) engine=INNODB; +insert into foo (id, content) values('xyz', ''); +update foo set content=repeat('a', 43941888) where id='xyz'; +drop table foo; diff --git a/mysql-test/suite/innodb/r/innodb-blob.result b/mysql-test/suite/innodb/r/innodb-blob.result new file mode 100644 index 00000000..8173d30e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-blob.result @@ -0,0 +1,164 @@ +FLUSH TABLES; +CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b TEXT, c TEXT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,REPEAT('a',30000)),(2,REPEAT('b',40000)); +SET DEBUG_SYNC='before_row_upd_extern SIGNAL have_latch WAIT_FOR go1'; +BEGIN; +UPDATE t1 SET a=a+2; +ROLLBACK; +BEGIN; +UPDATE t1 SET b=CONCAT(b,'foo'); +connect con1,localhost,root,,; +SET DEBUG_SYNC='now WAIT_FOR have_latch'; +SELECT a, RIGHT(b,20) FROM t1; +connect con2,localhost,root,,; +SET DEBUG_SYNC='now SIGNAL go1'; +connection con1; +a RIGHT(b,20) +1 aaaaaaaaaaaaaaaaaaaa +2 bbbbbbbbbbbbbbbbbbbb +connection default; +SET DEBUG='+d,row_ins_extern_checkpoint'; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET DEBUG_SYNC='before_row_ins_extern_latch SIGNAL rec_not_blob WAIT_FOR crash'; +ROLLBACK; +BEGIN; +INSERT INTO t1 VALUES (3,REPEAT('c',50000)); +connection con1; +SET DEBUG_SYNC='now WAIT_FOR rec_not_blob'; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT @@tx_isolation; +@@tx_isolation +READ-UNCOMMITTED +SELECT a, RIGHT(b,20) FROM t1; +a RIGHT(b,20) +1 aaaaaaaaaaaaaaaaaaaa +2 bbbbbbbbbbbbbbbbbbbb +SELECT a FROM t1; +a +1 +2 +3 +BEGIN; +INSERT INTO t2 VALUES (42); +# restart +disconnect con1; +disconnect con2; +connection default; +ERROR HY000: Lost connection to server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t3 VALUES +(1,REPEAT('d',7000),REPEAT('e',100)), +(2,REPEAT('g',7000),REPEAT('h',100)); +SET DEBUG_SYNC='blob_write_middle SIGNAL go_sel WAIT_FOR go_upd'; +UPDATE t3 SET c=REPEAT('f',3000) WHERE a=1; +# Connection con1: +connect con1,localhost,root,,; +SET DEBUG_SYNC='now WAIT_FOR go_sel'; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT @@tx_isolation; +@@tx_isolation +READ-UNCOMMITTED +SELECT a, RIGHT(b,20), RIGHT(c,20) FROM t3; +a RIGHT(b,20) RIGHT(c,20) +2 gggggggggggggggggggg hhhhhhhhhhhhhhhhhhhh +set debug_sync='now SIGNAL go_upd'; +# Connection default: +connection default; +# reap UPDATE t3 SET c=REPEAT('f',3000) WHERE a=1; +# Connection con1: +connection con1; +SELECT a, RIGHT(b,20), RIGHT(c,20) FROM t3; +a RIGHT(b,20) RIGHT(c,20) +1 dddddddddddddddddddd ffffffffffffffffffff +2 gggggggggggggggggggg hhhhhhhhhhhhhhhhhhhh +disconnect con1; +connection default; +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +connect con2,localhost,root,,; +BEGIN; +INSERT INTO t2 VALUES (347); +connection default; +SET DEBUG='+d,row_upd_extern_checkpoint'; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET DEBUG_SYNC='before_row_upd_extern SIGNAL have_latch WAIT_FOR crash'; +UPDATE t3 SET c=REPEAT('i',3000) WHERE a=2; +connection con2; +SET DEBUG_SYNC='now WAIT_FOR have_latch'; +SELECT info FROM information_schema.processlist +WHERE state = 'debug sync point: before_row_upd_extern'; +info +UPDATE t3 SET c=REPEAT('i',3000) WHERE a=2 +connect con3,localhost,root,,; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1; +ROLLBACK; +disconnect con3; +connection con2; +# restart +disconnect con2; +connection default; +ERROR HY000: Lost connection to server during query +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +SELECT a, RIGHT(b,20), RIGHT(c,20) FROM t3; +a RIGHT(b,20) RIGHT(c,20) +1 dddddddddddddddddddd ffffffffffffffffffff +2 gggggggggggggggggggg hhhhhhhhhhhhhhhhhhhh +SELECT a FROM t3; +a +1 +2 +connect con2,localhost,root,,; +BEGIN; +INSERT INTO t2 VALUES (33101); +connection default; +SET DEBUG='+d,row_upd_extern_checkpoint'; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET DEBUG_SYNC='after_row_upd_extern SIGNAL have_latch WAIT_FOR crash'; +UPDATE t3 SET c=REPEAT('j',3000) WHERE a=2; +connection con2; +SET DEBUG_SYNC='now WAIT_FOR have_latch'; +SELECT info FROM information_schema.processlist +WHERE state = 'debug sync point: after_row_upd_extern'; +info +UPDATE t3 SET c=REPEAT('j',3000) WHERE a=2 +# restart +disconnect con2; +connection default; +ERROR HY000: Lost connection to server during query +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +SELECT a, RIGHT(b,20), RIGHT(c,20) FROM t3; +a RIGHT(b,20) RIGHT(c,20) +1 dddddddddddddddddddd ffffffffffffffffffff +2 gggggggggggggggggggg hhhhhhhhhhhhhhhhhhhh +SELECT a FROM t3; +a +1 +2 +SELECT * FROM t2; +a +DROP TABLE t1,t2,t3; +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT)ENGINE=InnoDB +ROW_FORMAT=REDUNDANT; +SET @fill_amount = (@@innodb_page_size / 2 ) + 1 ; +INSERT INTO t1 VALUES(1, REPEAT(2, @fill_amount)); +UPDATE t1 SET f1 = 2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-bug-14068765.result b/mysql-test/suite/innodb/r/innodb-bug-14068765.result new file mode 100644 index 00000000..f7a2644c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-bug-14068765.result @@ -0,0 +1,35 @@ +CREATE DATABASE testdb_wl5522; +CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb; +CREATE INDEX idx1 ON testdb_wl5522.t1(col18); +CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10)); +CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12); +CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8); +INSERT INTO testdb_wl5522.t1 VALUES (1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222,-92233720368.222,'aaa', 'aaaaaaaaaa','b','bbbbb','ccccc',REPEAT('d',40),REPEAT('d',40),REPEAT('d',40), 1,'1000-01-01','3000-12-31 23:59:59.99','1990-01-01 00:00:01.00','01:59:59.00','1901'); +INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL); +INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +ERROR 23000: Column 'col18' cannot be null +INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +FLUSH TABLES testdb_wl5522.t1 WITH READ LOCK; +SELECT COUNT(*) FROM testdb_wl5522.t1; +COUNT(*) +2 +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb; +CREATE INDEX idx1 ON testdb_wl5522.t1(col18); +CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10)); +CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12); +CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8); +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +CHECK TABLE testdb_wl5522.t1; +Table Op Msg_type Msg_text +testdb_wl5522.t1 check status OK +SELECT COUNT(*) FROM testdb_wl5522.t1; +COUNT(*) +2 +DROP TABLE testdb_wl5522.t1; +DROP DATABASE testdb_wl5522; diff --git a/mysql-test/suite/innodb/r/innodb-bug-14084530.result b/mysql-test/suite/innodb/r/innodb-bug-14084530.result new file mode 100644 index 00000000..b8e0e3a5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-bug-14084530.result @@ -0,0 +1,22 @@ +SET AUTOCOMMIT = 0; +CREATE DATABASE testdb_wl5522; +CREATE TABLE testdb_wl5522.t1 (c1 int ) engine = Innodb; +BEGIN; +INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331); +ROLLBACK; +SELECT c1 FROM testdb_wl5522.t1; +c1 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 (c1 int ) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +CHECK TABLE testdb_wl5522.t1; +Table Op Msg_type Msg_text +testdb_wl5522.t1 check status OK +SELECT c1 FROM testdb_wl5522.t1; +c1 +DROP DATABASE testdb_wl5522; diff --git a/mysql-test/suite/innodb/r/innodb-consistent.result b/mysql-test/suite/innodb/r/innodb-consistent.result new file mode 100644 index 00000000..c959dc1a --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-consistent.result @@ -0,0 +1,45 @@ +drop table if exists t1; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +set session transaction isolation level read committed; +create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; +create table t2 like t1; +insert into t2 values (1),(2),(3),(4),(5),(6),(7); +set autocommit=0; +begin; +replace into t1 select * from t2; +connection b; +set session transaction isolation level read committed; +set autocommit=0; +delete from t2 where a=5; +commit; +delete from t2; +commit; +connection a; +commit; +begin; +insert into t1 select * from t2; +connection b; +set session transaction isolation level read committed; +set autocommit=0; +delete from t2 where a=5; +commit; +delete from t2; +commit; +connection a; +commit; +select * from t1; +a +1 +2 +3 +4 +5 +6 +7 +drop table t1; +drop table t2; +connection default; +disconnect a; +disconnect b; diff --git a/mysql-test/suite/innodb/r/innodb-corrupted-table.result b/mysql-test/suite/innodb/r/innodb-corrupted-table.result new file mode 100644 index 00000000..bfe31b01 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-corrupted-table.result @@ -0,0 +1,49 @@ +call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MariaDB"); +call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB"); +create table t1 (pk int, i int, key(i)) engine=InnoDB; +insert into t1 values (1,1),(2,2); +flush tables; +# Save the .frm file without the PK +alter table t1 add primary key (pk); +# Stop the server, replace the frm with the old one and restart the server +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) DEFAULT NULL, + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +Warnings: +Warning 1082 InnoDB: Table test/t1 has a primary key in InnoDB data dictionary, but not in MariaDB! +Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +select * from t1; +pk i +1 1 +2 2 +alter table t1 add j int; +Warnings: +Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +show warnings; +Level Code Message +Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) DEFAULT NULL, + `i` int(11) DEFAULT NULL, + `j` int(11) DEFAULT NULL, + KEY `i` (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 add primary key (pk); +show warnings; +Level Code Message +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + `j` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `i` (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-dict.result b/mysql-test/suite/innodb/r/innodb-dict.result new file mode 100644 index 00000000..5be1cefa --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-dict.result @@ -0,0 +1,44 @@ +CREATE TABLE t1 (D INT) ENGINE=innodb; +INSERT INTO t1 VALUES (10); +ALTER TABLE t1 MODIFY COLUMN d INT; +ALTER TABLE t1 ADD INDEX my_d (d); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` int(11) DEFAULT NULL, + KEY `my_d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +EXPLAIN SELECT d FROM t1 WHERE d = 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref my_d my_d 5 const 128 Using index +EXPLAIN SELECT D FROM t1 WHERE D = 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref my_d my_d 5 const 128 Using index +ALTER TABLE t1 DROP INDEX my_d; +ALTER TABLE t1 MODIFY COLUMN D INT; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +ALTER TABLE t1 ADD INDEX my_d (D); +EXPLAIN SELECT d FROM t1 WHERE d = 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref my_d my_d 5 const 128 Using index +EXPLAIN SELECT D FROM t1 WHERE D = 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref my_d my_d 5 const 128 Using index +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `D` int(11) DEFAULT NULL, + KEY `my_d` (`D`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-enlarge-blob.result b/mysql-test/suite/innodb/r/innodb-enlarge-blob.result new file mode 100644 index 00000000..8c8e9cf5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-enlarge-blob.result @@ -0,0 +1,18 @@ +CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB ROW_FORMAT=REDUNDANT; +SHOW WARNINGS; +Level Code Message +INSERT INTO t1 SET a=CONCAT('A', SPACE(8000), 'B'); +INSERT INTO t1 SELECT a FROM t1; +UPDATE t1 SET a=CONCAT(a, RAND(), a); +UPDATE t1 SET a=CONCAT(a, RAND(), a); +SELECT * from t1; +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB ROW_FORMAT=DYNAMIC; +SHOW WARNINGS; +Level Code Message +INSERT INTO t1 SET a=CONCAT('A', SPACE(8000), 'B'); +INSERT INTO t1 SELECT a FROM t1; +UPDATE t1 SET a=CONCAT(a, RAND(), a); +UPDATE t1 SET a=CONCAT(a, RAND(), a); +SELECT * from t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-fk-virtual.result b/mysql-test/suite/innodb/r/innodb-fk-virtual.result new file mode 100644 index 00000000..b39e770c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-fk-virtual.result @@ -0,0 +1,86 @@ +create or replace table a ( +cola int(10) primary key, +v_cola int(10) as (cola mod 10) virtual, +p_cola int(10) as (cola mod 10) persistent +) engine=innodb; +create index v_cola on a (v_cola); +create index p_cola on a (p_cola); +create or replace table b( +cola int(10), +v_cola int(10), +p_cola int(10), +c_cola int(10) as (cola + 2) virtual +) engine=innodb; +alter table b add constraint `p_cola_fk` +foreign key (p_cola) references a (p_cola) +on delete restrict +on update restrict; +show warnings; +Level Code Message +show create table b; +Table Create Table +b CREATE TABLE `b` ( + `cola` int(10) DEFAULT NULL, + `v_cola` int(10) DEFAULT NULL, + `p_cola` int(10) DEFAULT NULL, + `c_cola` int(10) GENERATED ALWAYS AS (`cola` + 2) VIRTUAL, + KEY `p_cola_fk` (`p_cola`), + CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table b add constraint `v_cola_fk` +foreign key (v_cola) references a (v_cola) +on delete restrict +on update restrict; +show warnings; +Level Code Message +show create table b; +Table Create Table +b CREATE TABLE `b` ( + `cola` int(10) DEFAULT NULL, + `v_cola` int(10) DEFAULT NULL, + `p_cola` int(10) DEFAULT NULL, + `c_cola` int(10) GENERATED ALWAYS AS (`cola` + 2) VIRTUAL, + KEY `p_cola_fk` (`p_cola`), + KEY `v_cola_fk` (`v_cola`), + CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`), + CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table b add constraint `c_cola_fk` +foreign key (c_cola) references a (cola) +on delete restrict +on update restrict; +show warnings; +Level Code Message +show create table b; +Table Create Table +b CREATE TABLE `b` ( + `cola` int(10) DEFAULT NULL, + `v_cola` int(10) DEFAULT NULL, + `p_cola` int(10) DEFAULT NULL, + `c_cola` int(10) GENERATED ALWAYS AS (`cola` + 2) VIRTUAL, + KEY `p_cola_fk` (`p_cola`), + KEY `v_cola_fk` (`v_cola`), + KEY `c_cola_fk` (`c_cola`), + CONSTRAINT `c_cola_fk` FOREIGN KEY (`c_cola`) REFERENCES `a` (`cola`), + CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`), + CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into a(cola) values (12); +select * from a; +cola v_cola p_cola +12 2 2 +insert into b(cola, v_cola, p_cola) values (10,2,2); +select * from b; +cola v_cola p_cola c_cola +10 2 2 12 +insert into b(cola, v_cola, p_cola) values (10,1,1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`b`, CONSTRAINT `p_cola_fk` FOREIGN KEY (`p_cola`) REFERENCES `a` (`p_cola`)) +delete from a; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`b`, CONSTRAINT `c_cola_fk` FOREIGN KEY (`c_cola`) REFERENCES `a` (`cola`)) +select * from a; +cola v_cola p_cola +12 2 2 +select * from b; +cola v_cola p_cola c_cola +10 2 2 12 +drop table b, a; diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result new file mode 100644 index 00000000..c85dcf22 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result @@ -0,0 +1,135 @@ +CREATE TABLE t1 ( +id int(11) NOT NULL PRIMARY KEY, +a int(11) NOT NULL, +b int(11) NOT NULL, +c int not null, +CONSTRAINT test FOREIGN KEY (b) REFERENCES t1 (id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE t2 ( +id int(11) NOT NULL PRIMARY KEY, +a int(11) NOT NULL, +b int(11) NOT NULL, +c int not null, +CONSTRAINT mytest FOREIGN KEY (c) REFERENCES t1(id), +CONSTRAINT test FOREIGN KEY (b) REFERENCES t2 (id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") +show warnings; +Level Code Message +Warning 121 Create or Alter table `test`.`t2` with foreign key constraint failed. Foreign key constraint `test`.`test` already exists on data dictionary. Foreign key constraint names need to be unique in database. Error in foreign key definition: CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `test`.`t2` (`id`). +Error 1005 Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") +Warning 1022 Can't write; duplicate key in table 't2' +drop table t1; +create table t1(a int) engine=innodb; +create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `test`.`t2` with foreign key `a` constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +drop table t1; +create table t1(a int unique, b int) engine=innodb; +create table t2(a int, b int, foreign key (a) references t1(a), foreign key (b) references t1(b)) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `test`.`t2` with foreign key (b) constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +drop table t1; +create table t1(a int not null primary key, b int) engine=innodb; +create table t2(a int, b int, constraint a foreign key a (a) references t1(a), +constraint a foreign key a (a) references t1(b)) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb; +alter table t2 add constraint b foreign key (b) references t2(b); +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Alter table `test`.`t2` with foreign key `b` constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +drop table t2, t1; +create table t1 (f1 integer primary key) engine=innodb; +alter table t1 add constraint c1 foreign key (f1) references t11(f1); +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Alter table `test`.`t1` with foreign key `c1` constraint failed. Referenced table `test`.`t11` not found in the data dictionary. +Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t1` +drop table t1; +create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb; +create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +alter table t1 add foreign key(b) references t1(a); +ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a). +Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `test`.`t2` with foreign key constraint failed. Temporary tables can't have foreign key constraints. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +alter table t1 add foreign key(b) references t1(a); +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Temporary tables can't have foreign key constraints. +Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t1` +drop table t1; +create table t1(a int not null primary key, b int, key(b)) engine=innodb; +alter table t1 add foreign key(a,b) references t1(a); +ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match +show warnings; +Level Code Message +Error 1239 Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match +drop table t1; +create table t1(a int not null primary key, b int, key(b)) engine=innodb; +alter table t1 add foreign key(a) references t1(a,b); +ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match +show warnings; +Level Code Message +Error 1239 Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match +drop table t1; +create table t1 (f1 integer not null primary key) engine=innodb; +alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update set null; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Alter table `test`.`t1` with foreign key `c1` constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL. +Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t1` +create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `test`.`t2` with foreign key (a) constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +drop table t1; +create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb; +create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `test`.`t2` with foreign key (a) constraint failed. Field type or character set for column 'a' does not match referenced column 'f1'. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result new file mode 100644 index 00000000..e06c744f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-fk.result @@ -0,0 +1,223 @@ +# +# Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY +# REFERENCES IS SLOW/CRASHES SEMAPHORE +# +create table t1 (f1 int primary key) engine=innodb; +insert into t1 values (5); +insert into t1 values (2882); +insert into t1 values (10); +# restart +update t1 set f1 = 28 where f1 = 2882; +select * from fk_120; +f1 +5 +10 +28 +select * from fk_1; +f1 +5 +10 +28 +select * from fk_50; +f1 +5 +10 +28 +drop table t1; +# +# Check if restrict is working fine. +# +create table t1 (f1 int primary key) engine=innodb; +# restart +delete from t1 where f1 = 29; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`fk_29`, CONSTRAINT `pc29` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)) +select * from fk_29; +f1 +29 +drop table t1; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +f1 int(11) DEFAULT NULL, +PRIMARY KEY (id), +CONSTRAINT fk1 FOREIGN KEY (f1) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +PRIMARY KEY (`id`), +CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE, +CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `test`.`t2` with foreign key `fk3` constraint failed. Referenced table `test`.`t3` not found in the data dictionary. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +PRIMARY KEY (`id`), +CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE +) ENGINE=InnoDB; +ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Alter table `test`.`t2` with foreign key `fk3` constraint failed. Referenced table `test`.`t3` not found in the data dictionary. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `t2` +drop table t2; +drop table t1; +CREATE DATABASE kg_test1; +CREATE DATABASE kg_test2; +CREATE TABLE `kg_test1`.`group` ( +Id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `kg_test1`.`person` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +show create table `kg_test1`.`person`; +Table Create Table +person CREATE TABLE `person` ( + `Id` int(11) NOT NULL AUTO_INCREMENT, + `Name` varchar(50) NOT NULL, + PRIMARY KEY (`Id`), + CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +CREATE TABLE `kg_test2`.`person2` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +ERROR HY000: Can't create table `kg_test2`.`person2` (errno: 150 "Foreign key constraint is incorrectly formed") +CREATE TABLE `kg_test2`.`person2` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +show create table `kg_test2`.`person2`; +Table Create Table +person2 CREATE TABLE `person2` ( + `Id` int(11) NOT NULL AUTO_INCREMENT, + `Name` varchar(50) NOT NULL, + PRIMARY KEY (`Id`), + CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +SHOW WARNINGS; +Level Code Message +DROP DATABASE kg_test2; +DROP DATABASE kg_test1; +CREATE TABLE `#departaments` ( +`id_depart` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +PRIMARY KEY (`id_depart`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +CREATE TABLE `#departaments_tree` ( +`id_depart` INT(10) UNSIGNED NOT NULL, +`id_depart_in` INT(10) UNSIGNED NOT NULL, +PRIMARY KEY (`id_depart`,`id_depart_in`), +CONSTRAINT `#departaments_tree_ibfk_1` FOREIGN KEY (`id_depart`) REFERENCES `#departaments` (`id_depart`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +ALTER TABLE `#departaments_tree` + ADD FOREIGN KEY (`id_depart_in`) REFERENCES `#departaments`(`id_depart`); +SHOW CREATE TABLE `#departaments_tree`; +Table Create Table +#departaments_tree CREATE TABLE `#departaments_tree` ( + `id_depart` int(10) unsigned NOT NULL, + `id_depart_in` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_depart`,`id_depart_in`), + KEY `id_depart_in` (`id_depart_in`), + CONSTRAINT `#departaments_tree_ibfk_1` FOREIGN KEY (`id_depart`) REFERENCES `#departaments` (`id_depart`), + CONSTRAINT `#departaments_tree_ibfk_2` FOREIGN KEY (`id_depart_in`) REFERENCES `#departaments` (`id_depart`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +DROP TABLE `#departaments_tree`; +DROP TABLE `#departaments`; +CREATE TABLE `boroda` ( +`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +`a` INT(11) UNSIGNED DEFAULT NULL, +`b` INT(11) UNSIGNED DEFAULT NULL, +PRIMARY KEY (`id`), +KEY `a` (`a`), +CONSTRAINT `boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `boroda` (`id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +ALTER TABLE `boroda` + ADD FOREIGN KEY (`b`) REFERENCES `boroda`(`id`); +ALTER TABLE `boroda` DROP FOREIGN KEY `boroda_ibfk_2`; +RENAME TABLE `boroda` TO `#boroda`; +ALTER TABLE `#boroda` +ADD FOREIGN KEY (`b`) REFERENCES `#boroda`(`id`); +SHOW CREATE TABLE `#boroda`; +Table Create Table +#boroda CREATE TABLE `#boroda` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `a` int(11) unsigned DEFAULT NULL, + `b` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `a` (`a`), + KEY `b` (`b`), + CONSTRAINT `#boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `#boroda` (`id`), + CONSTRAINT `#boroda_ibfk_2` FOREIGN KEY (`b`) REFERENCES `#boroda` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +DROP TABLE `#boroda`; +CREATE TABLE `boroda` ( +`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +`a` INT(11) UNSIGNED DEFAULT NULL, +`b` INT(11) UNSIGNED DEFAULT NULL, +PRIMARY KEY (`id`), +KEY `a` (`a`), +CONSTRAINT `boroda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `boroda` (`id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +RENAME TABLE `boroda` TO `bor#oda`; +ALTER TABLE `bor#oda` +ADD FOREIGN KEY (`b`) REFERENCES `bor#oda`(`id`); +SHOW CREATE TABLE `bor#oda`; +Table Create Table +bor#oda CREATE TABLE `bor#oda` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `a` int(11) unsigned DEFAULT NULL, + `b` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `a` (`a`), + KEY `b` (`b`), + CONSTRAINT `bor#oda_ibfk_1` FOREIGN KEY (`a`) REFERENCES `bor#oda` (`id`), + CONSTRAINT `bor#oda_ibfk_2` FOREIGN KEY (`b`) REFERENCES `bor#oda` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +DROP TABLE `bor#oda`; +# +# MDEV-21127 Assertion `(size_t)(ptr - buf) < MAX_TEXT - 4' failed in key_text::key_text +# +CREATE TABLE t1 ( +a012345678901234567890123456789012345678901 char(255), +b char(255), +FOREIGN KEY ( a012345678901234567890123456789012345678901, b ) REFERENCES tx (ax, bx) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +CREATE TABLE t1 ( +a012345678901234567 int, +b int, +c0123456789012345678 int, +FOREIGN KEY (a012345678901234567,c0123456789012345678,b) REFERENCES tx (x1,x2,x3) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +# +# MDEV-25642 InnoDB rename table copy DDL fails +# while dropping the table +# +call mtr.add_suppression("InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition."); +CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1_fk (a VARCHAR(40), KEY a (a), FULLTEXT KEY(a), CONSTRAINT fk FOREIGN KEY(a) REFERENCES t1 (a) ON UPDATE CASCADE) ENGINE=InnoDB; +ALTER TABLE t1 RENAME TO tm1, ALGORITHM=COPY; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk test/t1_fk test/t1 1 4 +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t1 (c1 BIGINT NOT NULL, c2 BIGINT NOT NULL, PRIMARY KEY(c1), UNIQUE KEY(c2)) ENGINE=MEMORY; +ALTER TABLE t1 ENGINE=InnoDB, ALGORITHM=COPY; +DROP TABLE t1, tm1, t1_fk; diff --git a/mysql-test/suite/innodb/r/innodb-fkcheck.result b/mysql-test/suite/innodb/r/innodb-fkcheck.result new file mode 100644 index 00000000..f86ba505 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-fkcheck.result @@ -0,0 +1,97 @@ +set global innodb_file_per_table = 1; +drop table if exists b; +drop database if exists bug_fk; +create database bug_fk; +use bug_fk; +CREATE TABLE b ( +b int unsigned NOT NULL, +d1 datetime NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +CREATE TABLE c ( +b int unsigned NOT NULL, +d1 datetime NOT NULL, +d2 datetime NOT NULL, +PRIMARY KEY (b,d1), +CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; +show warnings; +Level Code Message +set foreign_key_checks = 0; +DROP TABLE IF EXISTS b; +show create table c; +Table Create Table +c CREATE TABLE `c` ( + `b` int(10) unsigned NOT NULL, + `d1` datetime NOT NULL, + `d2` datetime NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +DROP TABLE b; +set foreign_key_checks = 1; +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `b` +set foreign_key_checks = 0; +DROP TABLE IF EXISTS d; +Warnings: +Note 1051 Unknown table 'bug_fk.d' +CREATE TABLE d ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1), +CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; +show warnings; +Level Code Message +set foreign_key_checks = 1; +show create table c; +Table Create Table +c CREATE TABLE `c` ( + `b` int(10) unsigned NOT NULL, + `d1` datetime NOT NULL, + `d2` datetime NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table d; +Table Create Table +d CREATE TABLE `d` ( + `b` bigint(20) unsigned NOT NULL, + `d1` date NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `bd_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint for `b` +set foreign_key_checks=0; +drop table c; +drop table d; +create table b(id int) engine=innodb; +show warnings; +Level Code Message +b.frm +b.ibd +drop table if exists b; +drop database if exists bug_fk; diff --git a/mysql-test/suite/innodb/r/innodb-get-fk.result b/mysql-test/suite/innodb/r/innodb-get-fk.result new file mode 100644 index 00000000..0a460995 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-get-fk.result @@ -0,0 +1,78 @@ +CREATE SCHEMA `repro`; +CREATE TABLE `repro`.`crew` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`code` varchar(50) NOT NULL, +`name` varchar(50) NOT NULL, +`created_at` timestamp NULL DEFAULT NULL, +`updated_at` timestamp NULL DEFAULT NULL, +PRIMARY KEY (`id`), +KEY `code` (`code`) +) ENGINE=InnoDB; +CREATE TABLE `repro`.`pilot` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`code` varchar(50) NOT NULL, +`name` varchar(50) NOT NULL, +`created_at` timestamp NULL DEFAULT NULL, +`updated_at` timestamp NULL DEFAULT NULL, +PRIMARY KEY (`id`), +KEY `code` (`code`) +) ENGINE=InnoDB; +CREATE TABLE `repro`.`crew_role_assigned` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`crew_id` int(11) NOT NULL, +`role_code` varchar(50) NOT NULL, +PRIMARY KEY (`id`), +KEY `fk_crewRoleAssigned_roleCode` (`role_code`), +CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, +CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB COMMENT="This is a comment about tables"; +# restart: --innodb-read-only +ALTER TABLE `repro`.`crew_role_assigned` COMMENT = 'innodb_read_only'; +ERROR HY000: Table 'crew_role_assigned' is read only +SHOW CREATE TABLE `repro`.`crew_role_assigned`; +Table Create Table +crew_role_assigned CREATE TABLE `crew_role_assigned` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `crew_id` int(11) NOT NULL, + `role_code` varchar(50) NOT NULL, + PRIMARY KEY (`id`), + KEY `fk_crewRoleAssigned_roleCode` (`role_code`), + KEY `fk_crewRoleAssigned_pilotId` (`crew_id`), + CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='This is a comment about tables' +SET GLOBAL innodb_buffer_pool_load_now = ON; +SET GLOBAL innodb_buffer_pool_dump_now = ON; +SET GLOBAL innodb_buffer_pool_load_abort = ON; +# restart +ALTER TABLE `repro`.`crew_role_assigned` COMMENT = "This is a new comment about tables"; +SHOW CREATE TABLE `repro`.`crew_role_assigned`; +Table Create Table +crew_role_assigned CREATE TABLE `crew_role_assigned` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `crew_id` int(11) NOT NULL, + `role_code` varchar(50) NOT NULL, + PRIMARY KEY (`id`), + KEY `fk_crewRoleAssigned_roleCode` (`role_code`), + KEY `fk_crewRoleAssigned_pilotId` (`crew_id`), + CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='This is a new comment about tables' +# restart: --innodb-read-only +SHOW CREATE TABLE `repro`.`crew_role_assigned`; +Table Create Table +crew_role_assigned CREATE TABLE `crew_role_assigned` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `crew_id` int(11) NOT NULL, + `role_code` varchar(50) NOT NULL, + PRIMARY KEY (`id`), + KEY `fk_crewRoleAssigned_roleCode` (`role_code`), + KEY `fk_crewRoleAssigned_pilotId` (`crew_id`), + CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='This is a new comment about tables' +# restart +DROP TABLE `repro`.`crew_role_assigned`; +DROP TABLE `repro`.`pilot`; +DROP TABLE `repro`.`crew`; +DROP SCHEMA `repro`; diff --git a/mysql-test/suite/innodb/r/innodb-index-debug.result b/mysql-test/suite/innodb/r/innodb-index-debug.result new file mode 100644 index 00000000..0995b526 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index-debug.result @@ -0,0 +1,341 @@ +SET GLOBAL innodb_max_purge_lag_wait=0; +connect stop_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5); +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs'; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +ERROR HY000: Too many active concurrent transactions +SET DEBUG_DBUG = @saved_debug_dbug; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2)) +ENGINE=InnoDB; +INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0); +SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two'; +CREATE UNIQUE INDEX ui ON bug13861218(c1); +SET DEBUG_DBUG = @saved_debug_dbug; +DROP TABLE bug13861218; +CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB; +INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL); +SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two'; +CREATE UNIQUE INDEX ui ON bug13861218(c1); +SET DEBUG_DBUG = @saved_debug_dbug; +DROP TABLE bug13861218; +# +# Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE +# +create table t480(a serial)engine=innodb; +insert into t480 +values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), +(),(),(),(),(),(),(),(); +insert into t480 select 0 from t480; +insert into t480 select 0 from t480; +insert into t480 select 0 from t480; +insert into t480 select 0 from t480; +create table t1(f1 int auto_increment not null, +f2 char(200) not null, f3 char(200) not null, +primary key(f1,f2,f3), key(f1))engine=innodb; +insert into t1 select NULL,'aaa','bbb' from t480; +insert into t1 select NULL,'aaaa','bbbb' from t480; +insert into t1 select NULL,'aaaaa','bbbbb' from t480; +insert into t1 select NULL,'aaaaaa','bbbbbb' from t480; +SET DEBUG_DBUG = '+d,row_merge_write_failure'; +alter table t1 drop primary key,add primary key(f2,f1); +ERROR HY000: Temporary file write failure +SET DEBUG_DBUG = @saved_debug_dbug; +drop table t1; +connect con1,localhost,root; +create table t1(k1 int auto_increment primary key, +k2 char(200),k3 char(200))engine=innodb; +insert into t1 values(NULL,'a','b'), (NULL,'aa','bb'); +SET DEBUG_SYNC= 'row_merge_after_scan +SIGNAL opened WAIT_FOR flushed'; +optimize table t1; +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +INSERT INTO t1 select NULL,'aaa','bbb' from t480; +SET DEBUG_SYNC= 'now SIGNAL flushed'; +connection con1; +/*con1 reap*/ Optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +affected rows: 2 +SELECT COUNT(k1),k2,k3 FROM t1 GROUP BY k2,k3; +COUNT(k1) k2 k3 +1 a b +1 aa bb +480 aaa bbb +drop table t1; +create table t1(k1 int auto_increment primary key, +k2 char(200),k3 char(200))engine=innodb; +INSERT INTO t1 VALUES(1, "test", "test"); +SET DEBUG_SYNC= 'row_merge_after_scan +SIGNAL opened WAIT_FOR flushed'; +ALTER TABLE t1 FORCE, ADD COLUMN k4 int; +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +SET debug = '+d,row_log_tmpfile_fail'; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +INSERT INTO t1 select NULL,'aaa','bbb' from t480; +INSERT INTO t1 select NULL,'aaaa','bbbb' from t480; +SET DEBUG_SYNC= 'now SIGNAL flushed'; +SET DEBUG_DBUG = @saved_debug_dbug; +connection con1; +/*con1 reap*/ ALTER TABLE t1 ADD COLUMN k4 int; +ERROR HY000: Out of memory. +SELECT COUNT(k1),k2,k3 FROM t1 GROUP BY k2,k3; +COUNT(k1) k2 k3 +480 aaa bbb +480 aaaa bbbb +1 test test +disconnect con1; +connection default; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `k1` int(11) NOT NULL AUTO_INCREMENT, + `k2` char(200) DEFAULT NULL, + `k3` char(200) DEFAULT NULL, + PRIMARY KEY (`k1`) +) ENGINE=InnoDB AUTO_INCREMENT=1024 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +drop table t480; +# +# MDEV-12827 Assertion failure when reporting duplicate key error +# in online table rebuild +# +CREATE TABLE t1 (j INT UNIQUE, i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(2, 2); +connect con1,localhost,root,,test; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log'; +ALTER TABLE t1 DROP j, ADD UNIQUE INDEX(i), FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR built'; +SET DEBUG_DBUG='+d,row_ins_row_level'; +INSERT INTO t1 (i) VALUES (0),(0); +SET DEBUG_SYNC='now SIGNAL log'; +SET DEBUG_DBUG=@saved_debug_dbug; +connection con1; +ERROR 23000: Duplicate entry '0' for key 'i' +DELETE FROM t1; +ALTER TABLE t1 ADD UNIQUE INDEX(i); +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2'; +ALTER TABLE t1 DROP j, FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR built2'; +INSERT INTO t1 (i) VALUES (0),(1); +UPDATE t1 SET i=0; +ERROR 23000: Duplicate entry '0' for key 'i' +SET DEBUG_SYNC='now SIGNAL log2'; +connection con1; +disconnect con1; +disconnect stop_purge; +connection default; +SET DEBUG_SYNC='RESET'; +DROP TABLE t1; +SET DEBUG_SYNC='RESET'; +# +# BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP +# LAST COLUMN OF OLD PK +# +SET DEBUG_DBUG = '+d,innodb_alter_table_pk_assert_no_sort'; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(3), n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 add n1 int not null, drop primary key, add primary key(o1, n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int not null, primary key(o1(2))) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(3), o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int not null, primary key(o1(2))) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1, o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(3))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1)) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(2),n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(2),n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(3),n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2(3))) engine = innodb; +insert into t1 values(1,'abd'), (2,'acd'); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2)) engine = innodb; +insert into t1 values(1,'abd'), (2,'acd'); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2(2))) engine = innodb; +insert into t1 values(1, 'abd'), (2, 'acd'); +alter table t1 drop primary key, add primary key(o1,o2(3)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2(2))) engine = innodb; +insert into t1 values(1, 'abd'), (2, 'acd'); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2(3),o3)) engine = innodb; +insert into t1 values(1, 'abd', 1), (2, 'acd', 2); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1, 'abd', 1), (2, 'acd', 2); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(3))) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2)) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(2))) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2(2))) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1(3),o2,o3(2))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2,o3(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1,o2,o3(2))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1,o2,o3), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1(3),o2,o3(3))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2,o3(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1,o2,o3(3))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1,o2,o3(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(n1,o1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(n1,o1,n2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(n1,n2,o1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(o1,n1,n2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(n1,o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, o3 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1,o2,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, o3 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1,o3,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, o4 int not null, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2,2),(2,2,1,1); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,o3,o4), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1), lock=none; +drop table t1; +create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1),(2,1); +alter table t1 drop primary key, add column a int unique auto_increment, +add primary key(o1,o2,a), algorithm=inplace; +drop table t1; +SET DEBUG_DBUG = @saved_debug_dbug; diff --git a/mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff b/mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff new file mode 100644 index 00000000..166cdf7a --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff @@ -0,0 +1,20 @@ +--- innodb-index-online.result ++++ innodb-index-online,crypt.reject +@@ -301,7 +301,7 @@ + @merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0, + @rowlog_encrypt_1>@rowlog_encrypt_0; + sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0 +-0 0 0 0 ++0 0 0 1 + SET DEBUG_SYNC = 'now SIGNAL dml2_done'; + connection con1; + ERROR HY000: Creating index 'c2e' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again +@@ -423,7 +423,7 @@ + @rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted, + @rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted; + sort_encrypted sort_decrypted log_encrypted log_decrypted +-0 0 0 0 ++0 0 1 1 + connection con1; + SELECT COUNT(c22f) FROM t1; + COUNT(c22f) diff --git a/mysql-test/suite/innodb/r/innodb-index-online-delete.result b/mysql-test/suite/innodb/r/innodb-index-online-delete.result new file mode 100644 index 00000000..1c6e7c26 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index-online-delete.result @@ -0,0 +1,18 @@ +connect con1,localhost,root,,; +connection default; +CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB; +INSERT INTO t VALUES(1,2),(2,3); +SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL do WAIT_FOR m'; +SET DEBUG_SYNC='innodb_after_inplace_alter_table SIGNAL scanned WAIT_FOR done'; +CREATE INDEX tb ON t(b); +connection con1; +SET DEBUG_SYNC='now WAIT_FOR do'; +SET DEBUG_SYNC='row_update_for_mysql_error SIGNAL m WAIT_FOR scanned'; +UPDATE t SET a=2 WHERE a=1; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +call mtr.add_suppression('InnoDB: record in index .*tb was not found on rollback, trying to insert'); +SET DEBUG_SYNC='now SIGNAL done'; +disconnect con1; +connection default; +SET DEBUG_SYNC='RESET'; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/innodb-index-online-fk.result b/mysql-test/suite/innodb/r/innodb-index-online-fk.result new file mode 100644 index 00000000..84e8ea89 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index-online-fk.result @@ -0,0 +1,610 @@ +CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; +INSERT INTO parent VALUES(1,2),(2,3); +CREATE INDEX tb ON parent(b); +INSERT INTO parent VALUES(10,20),(20,30); +CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB; +CREATE INDEX tb ON child(a2); +INSERT INTO child VALUES(10,20); +ALTER TABLE child ADD FOREIGN KEY(a2) REFERENCES parent(b), +ALGORITHM = INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY +SET foreign_key_checks = 0; +ALTER TABLE child ADD CONSTRAINT fk_1 FOREIGN KEY (a2) +REFERENCES parent(b) ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +SELECT * FROM information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +ALTER TABLE child ADD CONSTRAINT fk_1 FOREIGN KEY (a2) +REFERENCES parent(b) ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Duplicate FOREIGN KEY constraint name 'test/fk_1' +SET foreign_key_checks = 1; +INSERT INTO child VALUES(1,2),(2,3); +INSERT INTO child VALUES(4,4); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE) +SELECT * FROM parent; +a b +1 2 +2 3 +10 20 +20 30 +SET foreign_key_checks = 0; +ALTER TABLE child ADD CONSTRAINT fk_20 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent' +SHOW WARNINGS; +Level Code Message +Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent' +SHOW ERRORS; +Level Code Message +Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent' +CREATE INDEX idx1 on parent(a, b); +ALTER TABLE child ADD CONSTRAINT fk_10 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ALTER TABLE child ADD CONSTRAINT fk_2 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, ADD INDEX idx1(a1,a2), +ALGORITHM = INPLACE; +ALTER TABLE child ADD CONSTRAINT fk_3 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE; +SELECT * FROM information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +test/fk_10 test/child test/parent 2 5 +test/fk_2 test/child test/parent 2 5 +test/fk_3 test/child test/parent 2 5 +SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +test/fk_10 a1 a 0 +test/fk_10 a2 b 1 +test/fk_2 a1 a 0 +test/fk_2 a2 b 1 +test/fk_3 a1 a 0 +test/fk_3 a2 b 1 +SET foreign_key_checks = 1; +INSERT INTO child VALUES(5,4); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE) +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1` int(11) NOT NULL, + `a2` int(11) DEFAULT NULL, + PRIMARY KEY (`a1`), + KEY `tb` (`a2`), + KEY `idx1` (`a1`,`a2`), + CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_10` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_2` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_3` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DELETE FROM parent where a = 1; +SELECT * FROM child; +a1 a2 +1 NULL +2 3 +10 20 +SET foreign_key_checks = 0; +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG = '+d,innodb_test_open_ref_fail'; +ALTER TABLE child ADD CONSTRAINT fk_4 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +SET DEBUG_DBUG = @saved_debug_dbug; +SELECT * FROM information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +test/fk_10 test/child test/parent 2 5 +test/fk_2 test/child test/parent 2 5 +test/fk_3 test/child test/parent 2 5 +test/fk_4 test/child test/parent 2 5 +SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +test/fk_10 a1 a 0 +test/fk_10 a2 b 1 +test/fk_2 a1 a 0 +test/fk_2 a2 b 1 +test/fk_3 a1 a 0 +test/fk_3 a2 b 1 +test/fk_4 a1 a 0 +test/fk_4 a2 b 1 +SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name; +name name +test/child a1 +test/child a2 +SELECT NAME FROM information_schema.INNODB_SYS_TABLES; +NAME +SYS_FOREIGN +SYS_FOREIGN_COLS +SYS_VIRTUAL +mysql/innodb_index_stats +mysql/innodb_table_stats +mysql/transaction_registry +test/child +test/parent +INSERT INTO child VALUES(5,4); +SET foreign_key_checks = 1; +INSERT INTO child VALUES(6,5); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE) +SET foreign_key_checks = 0; +CREATE TABLE `#parent` (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; +CREATE INDEX tb ON `#parent`(a, b); +CREATE TABLE `#child` (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB; +CREATE INDEX tb ON `#child`(a1, a2); +SET DEBUG_DBUG = '+d,innodb_test_no_foreign_idx'; +ALTER TABLE `#child` ADD CONSTRAINT fk_40 FOREIGN KEY (a1, a2) +REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_40' in the foreign table '#child' +SET DEBUG_DBUG = @saved_debug_dbug; +SHOW ERRORS; +Level Code Message +Error 1821 Failed to add the foreign key constraint. Missing index for constraint 'fk_40' in the foreign table '#child' +SELECT * FROM information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +test/fk_10 test/child test/parent 2 5 +test/fk_2 test/child test/parent 2 5 +test/fk_3 test/child test/parent 2 5 +test/fk_4 test/child test/parent 2 5 +SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +test/fk_10 a1 a 0 +test/fk_10 a2 b 1 +test/fk_2 a1 a 0 +test/fk_2 a2 b 1 +test/fk_3 a1 a 0 +test/fk_3 a2 b 1 +test/fk_4 a1 a 0 +test/fk_4 a2 b 1 +SET DEBUG_DBUG = '+d,innodb_test_no_reference_idx'; +ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_42' in the referenced table 'parent' +SET DEBUG_DBUG = @saved_debug_dbug; +SHOW ERRORS; +Level Code Message +Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_42' in the referenced table 'parent' +SET DEBUG_DBUG = '+d,innodb_test_wrong_fk_option'; +ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint on table 'child'. Incorrect options in FOREIGN KEY constraint 'test/fk_42' +SET DEBUG_DBUG = @saved_debug_dbug; +SELECT * FROM information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +test/fk_10 test/child test/parent 2 5 +test/fk_2 test/child test/parent 2 5 +test/fk_3 test/child test/parent 2 5 +test/fk_4 test/child test/parent 2 5 +SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +test/fk_10 a1 a 0 +test/fk_10 a2 b 1 +test/fk_2 a1 a 0 +test/fk_2 a2 b 1 +test/fk_3 a1 a 0 +test/fk_3 a2 b 1 +test/fk_4 a1 a 0 +test/fk_4 a2 b 1 +SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system'; +ALTER TABLE `#child` ADD CONSTRAINT fk_43 FOREIGN KEY (a1, a2) +REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint 'test/fk_43' to system tables +SET DEBUG_DBUG = @saved_debug_dbug; +SHOW ERRORS; +Level Code Message +Error 1823 Failed to add the foreign key constraint 'test/fk_43' to system tables +DROP TABLE `#child`; +DROP TABLE `#parent`; +SET foreign_key_checks = 0; +ALTER TABLE child ADD CONSTRAINT fk_5 FOREIGN KEY (a2) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ADD CONSTRAINT fk_6 FOREIGN KEY (a1, a2) +REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +SELECT * FROM information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +test/fk_10 test/child test/parent 2 5 +test/fk_2 test/child test/parent 2 5 +test/fk_3 test/child test/parent 2 5 +test/fk_4 test/child test/parent 2 5 +test/fk_5 test/child test/parent 1 6 +test/fk_6 test/child test/parent 2 5 +SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +test/fk_10 a1 a 0 +test/fk_10 a2 b 1 +test/fk_2 a1 a 0 +test/fk_2 a2 b 1 +test/fk_3 a1 a 0 +test/fk_3 a2 b 1 +test/fk_4 a1 a 0 +test/fk_4 a2 b 1 +test/fk_5 a2 b 0 +test/fk_6 a1 a 0 +test/fk_6 a2 b 1 +DROP TABLE child; +DROP TABLE parent; +CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; +INSERT INTO parent VALUES(1,2),(2,3); +CREATE INDEX tb ON parent(b); +INSERT INTO parent VALUES(10,20),(20,30); +CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB; +CREATE INDEX tb ON child(a2); +INSERT INTO child VALUES(10,20); +SET foreign_key_checks = 0; +ALTER TABLE child DROP INDEX tb, ADD CONSTRAINT fk_4 FOREIGN KEY (a2) +REFERENCES parent(b) ON DELETE CASCADE ON UPDATE CASCADE, +ALGORITHM = INPLACE; +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1` int(11) NOT NULL, + `a2` int(11) DEFAULT NULL, + PRIMARY KEY (`a1`), + KEY `fk_4` (`a2`), + CONSTRAINT `fk_4` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_4 test/child test/parent 1 5 +SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_4 a2 b 0 +SET foreign_key_checks = 1; +DROP TABLE child; +DROP TABLE parent; +CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; +INSERT INTO parent VALUES(1,2),(2,3); +CREATE INDEX tb ON parent(b); +INSERT INTO parent VALUES(10,20),(20,30); +CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB; +CREATE INDEX tb ON child(a2); +SET foreign_key_checks = 0; +ALTER TABLE child CHANGE a2 a3 INT, +ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR 42000: Key column 'a2' doesn't exist in table +ALTER TABLE child CHANGE a2 a3 INT, +ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +DROP TABLE child; +DROP TABLE parent; +CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; +INSERT INTO parent VALUES(1,2),(2,3); +CREATE INDEX tb ON parent(b); +INSERT INTO parent VALUES(10,20),(20,30); +CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB; +CREATE INDEX tb ON child(a2); +SET foreign_key_checks = 0; +SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system'; +ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT, +ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint 'test/fk_1' to system tables +SET DEBUG_DBUG = @saved_debug_dbug; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name; +name name +test/child a1 +test/child a2 +SELECT NAME FROM information_schema.INNODB_SYS_TABLES; +NAME +SYS_FOREIGN +SYS_FOREIGN_COLS +SYS_VIRTUAL +mysql/innodb_index_stats +mysql/innodb_table_stats +mysql/transaction_registry +test/child +test/parent +ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT, +ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +Warnings: +Warning 1280 Name 'idx' ignored for PRIMARY key. +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name; +name name +test/child a2 +test/child a3 +SELECT NAME FROM information_schema.INNODB_SYS_TABLES; +NAME +SYS_FOREIGN +SYS_FOREIGN_COLS +SYS_VIRTUAL +mysql/innodb_index_stats +mysql/innodb_table_stats +mysql/transaction_registry +test/child +test/parent +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a3` int(11) NOT NULL, + `a2` int(11) DEFAULT NULL, + PRIMARY KEY (`a3`), + KEY `tb` (`a2`), + CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE child; +CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB; +ALTER TABLE child ADD PRIMARY KEY idx (a1), +ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +Warnings: +Warning 1280 Name 'idx' ignored for PRIMARY key. +SELECT * from information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a2 b 0 +SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name; +name name +test/child a1 +test/child a2 +SELECT NAME FROM information_schema.INNODB_SYS_TABLES; +NAME +SYS_FOREIGN +SYS_FOREIGN_COLS +SYS_VIRTUAL +mysql/innodb_index_stats +mysql/innodb_table_stats +mysql/transaction_registry +test/child +test/parent +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1` int(11) NOT NULL, + `a2` int(11) DEFAULT NULL, + PRIMARY KEY (`a1`), + KEY `fk_1` (`a2`), + CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE child; +CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB; +ALTER TABLE child CHANGE a1 a3 INT, +ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +SELECT * from information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_1 test/child test/parent 1 6 +SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_1 a3 b 0 +SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name; +name name +test/child a2 +test/child a3 +SELECT NAME FROM information_schema.INNODB_SYS_TABLES; +NAME +SYS_FOREIGN +SYS_FOREIGN_COLS +SYS_VIRTUAL +mysql/innodb_index_stats +mysql/innodb_table_stats +mysql/transaction_registry +test/child +test/parent +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a3` int(11) DEFAULT NULL, + `a2` int(11) DEFAULT NULL, + KEY `fk_1` (`a3`), + CONSTRAINT `fk_1` FOREIGN KEY (`a3`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE child; +CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB; +ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT, +ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint on table 'child'. Incorrect options in FOREIGN KEY constraint 'test/fk_1' +DROP TABLE parent; +DROP TABLE child; +CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL, c INT) ENGINE = InnoDB; +INSERT INTO parent VALUES(1,2,3),(2,3,4); +CREATE INDEX tb ON parent(b); +CREATE TABLE child (a1 INT NOT NULL, a2 INT, a3 INT) ENGINE = InnoDB; +CREATE INDEX tb ON child(a2); +ALTER TABLE child +ADD CONSTRAINT fk_a FOREIGN KEY (a2) REFERENCES parent(b) +ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +ALTER TABLE child +ADD CONSTRAINT fk_b FOREIGN KEY (a1) REFERENCES parent(a), +ALGORITHM = INPLACE; +ALTER TABLE child CHANGE a2 a2_new INT, CHANGE a1 a1_new INT; +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1_new` int(11) DEFAULT NULL, + `a2_new` int(11) DEFAULT NULL, + `a3` int(11) DEFAULT NULL, + KEY `tb` (`a2_new`), + KEY `fk_b` (`a1_new`), + CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * from information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_a test/child test/parent 1 6 +test/fk_b test/child test/parent 1 0 +SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_a a2_new b 0 +test/fk_b a1_new a 0 +ALTER TABLE child +ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b), +ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a), +ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c), +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_new_3' in the referenced table 'parent' +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1_new` int(11) DEFAULT NULL, + `a2_new` int(11) DEFAULT NULL, + `a3` int(11) DEFAULT NULL, + KEY `tb` (`a2_new`), + KEY `fk_b` (`a1_new`), + CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * from information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_a test/child test/parent 1 6 +test/fk_b test/child test/parent 1 0 +SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_a a2_new b 0 +test/fk_b a1_new a 0 +ALTER TABLE child +ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b), +ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a), +ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(a), +ALGORITHM = INPLACE; +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1_new` int(11) DEFAULT NULL, + `a2_new` int(11) DEFAULT NULL, + `a3` int(11) DEFAULT NULL, + KEY `tb` (`a2_new`), + KEY `fk_new_1` (`a1_new`), + KEY `fk_new_3` (`a3`), + CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`), + CONSTRAINT `fk_new_1` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`b`), + CONSTRAINT `fk_new_2` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`a`), + CONSTRAINT `fk_new_3` FOREIGN KEY (`a3`) REFERENCES `parent` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * from information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_a test/child test/parent 1 6 +test/fk_b test/child test/parent 1 0 +test/fk_new_1 test/child test/parent 1 0 +test/fk_new_2 test/child test/parent 1 0 +test/fk_new_3 test/child test/parent 1 0 +SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_a a2_new b 0 +test/fk_b a1_new a 0 +test/fk_new_1 a1_new b 0 +test/fk_new_2 a2_new a 0 +test/fk_new_3 a3 a 0 +DROP TABLE child; +CREATE TABLE child (a1 INT NOT NULL, a2 INT, a3 INT) ENGINE = InnoDB; +CREATE INDEX tb ON child(a2); +ALTER TABLE child ADD PRIMARY KEY idx (a1), +ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b), +ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a), +ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c), +ALGORITHM = INPLACE; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_new_3' in the referenced table 'parent' +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1` int(11) NOT NULL, + `a2` int(11) DEFAULT NULL, + `a3` int(11) DEFAULT NULL, + KEY `tb` (`a2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * from information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +ALTER TABLE child ADD PRIMARY KEY idx (a1), +ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b), +ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a), +ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(a), +ALGORITHM = INPLACE; +Warnings: +Warning 1280 Name 'idx' ignored for PRIMARY key. +SHOW CREATE TABLE child; +Table Create Table +child CREATE TABLE `child` ( + `a1` int(11) NOT NULL, + `a2` int(11) DEFAULT NULL, + `a3` int(11) DEFAULT NULL, + PRIMARY KEY (`a1`), + KEY `tb` (`a2`), + KEY `fk_new_3` (`a3`), + CONSTRAINT `fk_new_1` FOREIGN KEY (`a1`) REFERENCES `parent` (`b`), + CONSTRAINT `fk_new_2` FOREIGN KEY (`a2`) REFERENCES `parent` (`a`), + CONSTRAINT `fk_new_3` FOREIGN KEY (`a3`) REFERENCES `parent` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * from information_schema.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/fk_new_1 test/child test/parent 1 0 +test/fk_new_2 test/child test/parent 1 0 +test/fk_new_3 test/child test/parent 1 0 +SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/fk_new_1 a1 b 0 +test/fk_new_2 a2 a 0 +test/fk_new_3 a3 a 0 +SET foreign_key_checks = 1; +DROP TABLE child; +DROP TABLE parent; +CREATE TABLE Parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; +INSERT INTO Parent VALUES(1,2),(2,3); +CREATE INDEX tb ON Parent(b); +INSERT INTO Parent VALUES(10,20),(20,30); +CREATE TABLE Child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB; +CREATE INDEX tb ON Child(a2); +INSERT INTO Child VALUES(10,20); +SET foreign_key_checks = 0; +ALTER TABLE Child ADD CONSTRAINT fk_1 FOREIGN KEY (a2) +REFERENCES Parent(b) ON DELETE SET NULL ON UPDATE CASCADE, +ALGORITHM = INPLACE; +DROP TABLE Child; +DROP TABLE Parent; +CREATE TABLE `t2`(a int,c int,d int) ENGINE=INNODB; +CREATE TABLE `t3`(a int,c int,d int) ENGINE=INNODB; +CREATE INDEX idx ON t3(a); +ALTER TABLE `t2` ADD CONSTRAINT `fw` FOREIGN KEY (`c`) REFERENCES t3 (a); +ALTER TABLE `t2` ADD CONSTRAINT `e` foreign key (`d`) REFERENCES t3(a); +ALTER TABLE `t3` ADD CONSTRAINT `e` foreign key (`c`) REFERENCES `t2`(`c`) ON UPDATE SET NULL; +ERROR HY000: Failed to add the foreign key constraint 'test/e' to system tables +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/e test/t2 test/t3 1 0 +test/fw test/t2 test/t3 1 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/e d a 0 +test/fw c a 0 +DROP TABLE t2; +DROP TABLE t3; diff --git a/mysql-test/suite/innodb/r/innodb-index-online-norebuild.result b/mysql-test/suite/innodb/r/innodb-index-online-norebuild.result new file mode 100644 index 00000000..b9077643 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index-online-norebuild.result @@ -0,0 +1,26 @@ +# INPLACE ALTER WITH INPLACE_IGNORE FLAG AND CHANGE CREATE OPTION +# CHANGE THE COLUMN DEFAULT (INPLACE_IGNORE) +# AND TABLE CHARSET(CHANGE CREATE) +CREATE TABLE t1( +id INT PRIMARY KEY, +f1 INT NOT NULL DEFAULT 0)ENGINE=INNODB; +INSERT INTO t1 VALUES(1, 2); +SET SQL_MODE='STRICT_ALL_TABLES'; +ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL DEFAULT 0, +DEFAULT CHARSET=latin1, ALGORITHM=INPLACE; +DROP TABLE t1; +# CHANGE THE COMMENT OF COLUMN(INPLACE IGNORE) +# AND TABLE CHARSET(CHANGE CREATE) +CREATE TABLE t1(id INT COMMENT 'independence day')ENGINE=INNODB; +INSERT INTO t1 values(1); +ALTER TABLE t1 MODIFY COLUMN id INT COMMENT 'identifier', +DEFAULT CHARSET=latin1, ALGORITHM=INPLACE; +DROP TABLE t1; +# RENAME THE TABLE(INPLACE IGNORE) +# AND CHANGE TABLE CHARSET(CHANGE CREATE) +CREATE TABLE t1( +f1 INT NOT NULL, +f2 INT NOT NULL)ENGINE=INNODB; +INSERT INTO t1 VALUES(1, 2); +ALTER TABLE t1 RENAME t2, DEFAULT CHARSET=latin1, ALGORITHM=INPLACE; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/innodb-index-online-purge.result b/mysql-test/suite/innodb/r/innodb-index-online-purge.result new file mode 100644 index 00000000..7a6469dd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index-online-purge.result @@ -0,0 +1,48 @@ +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection default; +CREATE TABLE t (a INT PRIMARY KEY, c TEXT) ENGINE=InnoDB; +CREATE TABLE u (a INT PRIMARY KEY, b INT, c INT NOT NULL) ENGINE=InnoDB; +INSERT INTO t VALUES (1,'aa'); +BEGIN; +INSERT INTO u SET a=1, c=1; +INSERT INTO u SELECT a+1,NULL,a+1 FROM u; +INSERT INTO u SELECT a+2,NULL,a+2 FROM u; +INSERT INTO u SELECT a+4,NULL,a+4 FROM u; +INSERT INTO u SELECT a+8,NULL,a+8 FROM u; +INSERT INTO u SELECT a+16,NULL,a+16 FROM u; +INSERT INTO u SELECT a+32,NULL,a+32 FROM u; +INSERT INTO u SELECT a+64,NULL,a+64 FROM u; +INSERT INTO u SELECT a+128,NULL,a+64 FROM u; +INSERT INTO u SELECT a+256,NULL,a+64 FROM u; +COMMIT; +BEGIN; +DELETE FROM u; +connection con2; +SET DEBUG_SYNC='row_log_apply_before SIGNAL created_u WAIT_FOR dml_done_u'; +ALTER TABLE u ADD INDEX (c); +connection default; +COMMIT; +SET DEBUG_SYNC='now WAIT_FOR created_u'; +SELECT state FROM information_schema.processlist +WHERE info='ALTER TABLE u ADD INDEX (c)'; +state +debug sync point: row_log_apply_before +connection con1; +SET DEBUG_SYNC='row_log_apply_before SIGNAL created_t WAIT_FOR dml_done_t'; +CREATE INDEX c1 ON t (c(1)); +connection default; +SET DEBUG_SYNC='now WAIT_FOR created_t'; +UPDATE t SET c='ab'; +SELECT SLEEP(10); +SLEEP(10) +0 +SET DEBUG_SYNC='now SIGNAL dml_done_u'; +connection con2; +SET DEBUG_SYNC='now SIGNAL dml_done_t'; +disconnect con2; +connection con1; +disconnect con1; +connection default; +SET DEBUG_SYNC='RESET'; +DROP TABLE t,u; diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result new file mode 100644 index 00000000..e6b69f8f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index-online.result @@ -0,0 +1,546 @@ +call mtr.add_suppression("InnoDB: Warning: Small buffer pool size"); +SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; +SET GLOBAL innodb_file_per_table = on; +CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 TEXT) +ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,''); +SET GLOBAL innodb_monitor_enable = module_ddl; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +SET DEBUG_SYNC = 'RESET'; +SET DEBUG_SYNC = 'write_row_noreplace SIGNAL have_handle WAIT_FOR go_ahead'; +INSERT INTO t1 VALUES(1,2,3); +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR have_handle'; +SET lock_wait_timeout = 1; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +connection con1; +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter'; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +ERROR HY000: Out of memory. +SET DEBUG_DBUG = @saved_debug_dbug; +SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter'; +CREATE UNIQUE INDEX c2 ON t1(c2); +ERROR HY000: Out of memory. +SET DEBUG_DBUG = @saved_debug_dbug; +SET DEBUG_DBUG = '+d,innodb_OOM_prepare_add_index'; +ALTER TABLE t1 ADD KEY(c2), ADD KEY c3_10(c3(10)), ADD KEY c3_c2(c3(4),c2); +ERROR HY000: Out of memory. +SET DEBUG_DBUG = @saved_debug_dbug; +CREATE UNIQUE INDEX c2 ON t1(c2); +DROP INDEX c2 ON t1; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` text DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +BEGIN; +INSERT INTO t1 VALUES(7,4,2); +connection con1; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR rollback_done'; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +COMMIT; +connection con1; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +ERROR 23000: Duplicate entry '4' for key 'c2' +connection default; +DELETE FROM t1 WHERE c1 = 7; +connection con1; +ALTER TABLE t1 ADD FOREIGN KEY(c2) REFERENCES t1(c2), ALGORITHM = INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY +ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK = EXCLUSIVE, ALGORITHM = INPLACE; +DROP INDEX c2 ON t1; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +BEGIN; +INSERT INTO t1 VALUES(7,4,2); +COMMIT; +DELETE FROM t1 where c1 = 7; +SET DEBUG_SYNC = 'now SIGNAL rollback_done'; +connection con1; +ERROR 23000: Duplicate entry '4' for key 'c2' +SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done'; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +INSERT INTO t1 VALUES(6,3,1); +SET DEBUG_SYNC = 'now SIGNAL dml_done'; +connection con1; +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +DELETE FROM t1 WHERE c1=6; +ALTER TABLE t1 ADD UNIQUE INDEX(c2); +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +connection default; +INSERT INTO t1 VALUES(6,3,1); +ERROR 23000: Duplicate entry '3' for key 'c2' +INSERT INTO t1 VALUES(7,4,2); +ERROR 23000: Duplicate entry '4' for key 'c2' +ALTER TABLE t1 STATS_PERSISTENT=1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'c3' +test.t1 analyze status OK +UPDATE mysql.innodb_index_stats SET stat_value = 5 +WHERE database_name = 'test' AND table_name= 't1' AND index_name = 'PRIMARY' +AND stat_value = 6; +SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1'); +database_name table_name index_name last_update stat_name stat_value sample_size stat_description +test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1 +test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index +test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index +test t1 c2 LAST_UPDATE n_diff_pfx01 5 1 c2 +test t1 c2 LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index +test t1 c2 LAST_UPDATE size 1 NULL Number of pages in the index +CREATE TABLE t1_c2_stats SELECT * FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't1' and index_name = 'c2'; +ALTER TABLE t1_c2_stats ENGINE=INNODB; +DROP INDEX c2 ON t1; +ANALYZE TABLE t1_c2_stats; +Table Op Msg_type Msg_text +test.t1_c2_stats analyze status Engine-independent statistics collected +test.t1_c2_stats analyze status OK +SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1', 't1_c2_stats'); +database_name table_name index_name last_update stat_name stat_value sample_size stat_description +test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1 +test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index +test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index +test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE n_diff_pfx01 3 1 DB_ROW_ID +test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index +test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE size 1 NULL Number of pages in the index +connection con1; +KILL QUERY @id; +ERROR 70100: Query execution was interrupted +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2d_created WAIT_FOR kill_done'; +CREATE INDEX c2d ON t1(c2); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR c2d_created'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +KILL QUERY @id; +SET DEBUG_SYNC = 'now SIGNAL kill_done'; +connection con1; +ERROR 70100: Query execution was interrupted +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +connection default; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 SELECT 5 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1; +EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'c3' +test.t1 analyze status OK +connection con1; +UPDATE t1_c2_stats SET index_name = 'c2d'; +UPDATE t1_c2_stats SET stat_value = 2 WHERE stat_name = 'n_diff_pfx01'; +INSERT INTO t1_c2_stats +SELECT database_name, table_name, index_name, last_update, 'n_diff_pfx02', 80, +sample_size, 'c2,c1' FROM t1_c2_stats +WHERE stat_name = 'n_diff_pfx01' AND stat_description = 'c2'; +INSERT INTO mysql.innodb_index_stats SELECT * FROM t1_c2_stats; +DROP TABLE t1_c2_stats; +CREATE INDEX c2d ON t1(c2); +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t1 0 PRIMARY 1 c1 A 80 NULL NULL BTREE NO +t1 1 c2d 1 c2 A 10 NULL NULL YES BTREE NO +EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range c2d c2d 5 NULL 32 Using where; Using index +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2d` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 +connection default; +SET @merge_encrypt_0= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_0= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_0= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +connection con1; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2e_created WAIT_FOR dml2_done'; +SET lock_wait_timeout = 10; +ALTER TABLE t1 CHANGE c2 c22 INT, DROP INDEX c2d, ADD INDEX c2e(c22, c3(10)), ALGORITHM = NOCOPY; +connection default; +INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1; +SET DEBUG_SYNC = 'now WAIT_FOR c2e_created'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si +INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf +ON si.index_id = sf.index_id WHERE si.name = '?c2e'; +name pos +c2 0 +c3 1 +SET @merge_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +SELECT +(@merge_encrypt_1-@merge_encrypt_0)- +(@merge_decrypt_1-@merge_decrypt_0) as sort_balance, +@merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0, +@rowlog_encrypt_1>@rowlog_encrypt_0; +sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0 +0 0 0 0 +SET DEBUG_SYNC = 'now SIGNAL dml2_done'; +connection con1; +ERROR HY000: Creating index 'c2e' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 1 +ddl_online_create_index 1 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si +INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf +ON si.index_id = sf.index_id WHERE si.name = 'c2e'; +name pos +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 1 +ddl_online_create_index 1 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +connection default; +ALTER TABLE t1 COMMENT 'testing if c2e will be dropped'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +SET @merge_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +SET @rowlog_decrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted'); +connection con1; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done'; +ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR c2f_created'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160; +DELETE FROM t1 WHERE c1 > 320; +COMMIT; +BEGIN; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 2 +SET DEBUG_SYNC = 'now SIGNAL dml3_done'; +connection con1; +Warnings: +Note 1831 Duplicate index `c2f`. This is deprecated and will be disallowed in a future release +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 2 +connection default; +SET @merge_encrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +SET @rowlog_decrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted'); +SELECT +(@merge_encrypt_2-@merge_encrypt_1)- +(@merge_decrypt_2-@merge_decrypt_1) as sort_balance, +(@rowlog_encrypt_2-@rowlog_encrypt_1)- +(@rowlog_decrypt_2-@rowlog_decrypt_1) as log_balance; +sort_balance log_balance +0 0 +SELECT +@merge_encrypt_2-@merge_encrypt_1>0 as sort_encrypted, +@merge_decrypt_2-@merge_decrypt_1>0 as sort_decrypted, +@rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted, +@rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted; +sort_encrypted sort_decrypted log_encrypted log_decrypted +0 0 0 0 +connection con1; +SELECT COUNT(c22f) FROM t1; +COUNT(c22f) +320 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SET GLOBAL innodb_max_purge_lag_wait=0; +ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5)); +ERROR 23000: Duplicate entry 'NULL' for key 'c3p5' +UPDATE t1 SET c3 = NULL WHERE c3 = ''; +SET lock_wait_timeout = 1; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c3p5_created WAIT_FOR ins_done'; +ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5)); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created'; +SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si +INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf +ON si.index_id = sf.index_id WHERE si.name = '?c3p5'; +name pos +c3 0 +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL ins_done WAIT_FOR ddl_timed_out'; +INSERT INTO t1 VALUES(347,33101,NULL); +connection con1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC = 'now SIGNAL ddl_timed_out'; +SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si +INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf +ON si.index_id = sf.index_id WHERE si.name = 'c3p5'; +name pos +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 1 +ddl_online_create_index 1 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 2 +connection default; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 1 +ddl_online_create_index 1 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 2 +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c22f` int(11) DEFAULT NULL, + `c3` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2d` (`c22f`), + KEY `c2f` (`c22f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 COMMENT='testing if c2e will be dropped' +ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 2 +ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = INPLACE; +ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = COPY; +ERROR 42000: Duplicate key name 'c2h' +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL innodb_monitor_disable = module_ddl; +DROP TABLE t1; +# +# MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE +# +CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB; +INSERT INTO t1 VALUES('foo'); +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done'; +ALTER TABLE t1 ADD UNIQUE(c); +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR t1u_created'; +INSERT INTO t1 VALUES('bar'),('bar'); +SET DEBUG_SYNC = 'now SIGNAL dup_done'; +connection default; +ERROR 23000: Duplicate entry 'bar' for key 'c' +SET DEBUG_SYNC = 'RESET'; +disconnect con1; +CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c); +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t2,t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0,0); +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL created WAIT_FOR inserted'; +ALTER TABLE t1 ADD INDEX(b); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +BEGIN; +INSERT INTO t1 VALUES(1,1); +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL inserted'; +connection con1; +disconnect con1; +connection default; +SELECT * FROM t1; +a b +0 0 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; +SET GLOBAL innodb_monitor_enable = default; +SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result new file mode 100644 index 00000000..a76837b9 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -0,0 +1,1997 @@ +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS; +create table t1(a varchar(2) primary key) engine=innodb; +insert into t1 values(''); +create index t1a1 on t1(a(1)); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +drop table t1; +create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb; +insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak'); +commit; +alter table t1 add index b (b), add index b (b); +ERROR 42000: Duplicate key name 'b' +alter table t1 add index (b,b); +ERROR 42S21: Duplicate column name 'b' +alter table t1 add index d2 (d); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + KEY `d2` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +analyze table t1; +explain select * from t1 force index(d2) order by d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL d2 23 NULL 4 +select * from t1 force index (d2) order by d; +a b c d +3 4 ad ad +2 3 ak ak +5 5 oo oo +4 4 tr tr +alter table t1 add unique index (b); +ERROR 23000: Duplicate entry '4' for key 'b' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + KEY `d2` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 add index (b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + KEY `d2` (`d`), + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 add unique index (c), add index (d); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1831 Duplicate index `d`. This is deprecated and will be disallowed in a future release +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + UNIQUE KEY `c` (`c`), + KEY `d2` (`d`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 10 NULL 4 +alter table t1 add primary key (a), drop index c; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `d2` (`d`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +alter table t1 add primary key (c); +ERROR 42000: Multiple primary key defined +alter table t1 drop primary key, add primary key (b); +ERROR 23000: Duplicate entry '4' for key 'PRIMARY' +create unique index c on t1 (c); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `c` (`c`), + KEY `d2` (`d`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 10 NULL 4 +select * from t1 force index(c) order by c; +a b c d +3 4 ad ad +2 3 ak ak +5 5 oo oo +4 4 tr tr +alter table t1 drop index b, add index (b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `c` (`c`), + KEY `d2` (`d`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values(6,1,'ggg','ggg'); +select * from t1; +a b c d +2 3 ak ak +3 4 ad ad +4 4 tr tr +5 5 oo oo +6 1 ggg ggg +select * from t1 force index(b) order by b; +a b c d +6 1 ggg ggg +2 3 ak ak +3 4 ad ad +4 4 tr tr +5 5 oo oo +select * from t1 force index(c) order by c; +a b c d +3 4 ad ad +2 3 ak ak +6 1 ggg ggg +5 5 oo oo +4 4 tr tr +select * from t1 force index(d) order by d; +a b c d +3 4 ad ad +2 3 ak ak +6 1 ggg ggg +5 5 oo oo +4 4 tr tr +analyze table t1; +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 5 +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 10 NULL 5 +explain select * from t1 force index(d) order by d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL d 23 NULL 5 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) NOT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `c` (`c`), + KEY `d2` (`d`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe'); +commit; +alter table t1 add index (c(2)); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `c` (`c`(2)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +alter table t1 add unique index (d(10)); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `d` (`d`(10)), + KEY `c` (`c`(2)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +insert into t1 values(5,1,'ggg','ggg'); +analyze table t1; +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 3 ad ad +4 4 afe afe +5 1 ggg ggg +select * from t1 force index(c) order by c; +a b c d +1 1 ab ab +2 2 ac ac +3 3 ad ad +4 4 afe afe +5 1 ggg ggg +select * from t1 force index(d) order by d; +a b c d +1 1 ab ab +2 2 ac ac +3 3 ad ad +4 4 afe afe +5 1 ggg ggg +explain select * from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort +explain select * from t1 force index(d) order by d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `d` (`d`(10)), + KEY `c` (`c`(2)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 drop index d; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +insert into t1 values(8,9,'fff','fff'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 3 ad ad +4 4 afe afe +5 1 ggg ggg +8 9 fff fff +select * from t1 force index(c) order by c; +a b c d +1 1 ab ab +2 2 ac ac +3 3 ad ad +4 4 afe afe +8 9 fff fff +5 1 ggg ggg +analyze table t1; +explain select * from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +explain select * from t1 order by d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `c` (`c`(2)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); +commit; +alter table t1 add unique index (b,c); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +insert into t1 values(8,9,'fff','fff'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +analyze table t1; +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 16 NULL 5 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b` (`b`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 add index (b,c); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +insert into t1 values(11,11,'kkk','kkk'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +11 11 kkk kkk +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +11 11 kkk kkk +analyze table t1; +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 16 NULL 6 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b` (`b`,`c`), + KEY `b_2` (`b`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 add unique index (c,d); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +insert into t1 values(13,13,'yyy','aaa'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +11 11 kkk kkk +13 13 yyy aaa +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +11 11 kkk kkk +13 13 yyy aaa +select * from t1 force index(c) order by c; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +11 11 kkk kkk +13 13 yyy aaa +analyze table t1; +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 16 NULL 7 +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 34 NULL 7 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b` (`b`,`c`), + UNIQUE KEY `c` (`c`,`d`), + KEY `b_2` (`b`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb; +create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb; +create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb; +create table t2(a int not null, b int, c int, d int, e int, +foreign key (b) references t1(b) on delete set null, +foreign key (c) references t3(c), foreign key (d) references t4(d) on update set null) +engine = innodb; +alter table t1 drop index b; +ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint +alter table t3 drop index c; +ERROR HY000: Cannot drop index 'c': needed in a foreign key constraint +alter table t4 drop index d; +ERROR HY000: Cannot drop index 'd': needed in a foreign key constraint +alter table t2 drop index b; +ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint +alter table t2 drop index b, drop index c, drop index d; +ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint +alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY; +ERROR HY000: Cannot change column 'b': used in a foreign key constraint 't2_ibfk_1' +set @old_sql_mode = @@sql_mode; +set @@sql_mode = 'STRICT_TRANS_TABLES'; +alter table t2 MODIFY b INT NOT NULL, ALGORITHM=INPLACE; +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +set @@sql_mode = @old_sql_mode; +SET FOREIGN_KEY_CHECKS=0; +alter table t2 DROP COLUMN b, ALGORITHM=COPY; +ERROR HY000: Cannot drop column 'b': needed in a foreign key constraint 't2_ibfk_1' +alter table t2 DROP COLUMN b; +ERROR HY000: Cannot drop column 'b': needed in a foreign key constraint 'test/t2_ibfk_1' +alter table t1 DROP COLUMN b, ALGORITHM=COPY; +ERROR HY000: Cannot drop column 'b': needed in a foreign key constraint 't2_ibfk_1' of table `test`.`t2` +alter table t1 DROP COLUMN b; +ERROR HY000: Cannot drop column 'b': needed in a foreign key constraint 'test/t2_ibfk_1' of table `test`.`t2` +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +create unique index dc on t2 (d,c); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +create index dc on t1 (b,c); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +set @@sql_mode = 'STRICT_TRANS_TABLES'; +alter table t2 add primary key (alpha), change a alpha int, +change b beta int not null, change c charlie int not null; +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +alter table t2 add primary key (alpha), change a alpha int, +change c charlie int not null, change d delta int not null; +ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_3' SET NULL +alter table t2 add primary key (alpha), change a alpha int, +change b beta int, modify c int not null; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +set @@sql_mode = @old_sql_mode; +insert into t1 values (1,1,1); +insert into t3 values (1,1,1); +insert into t4 values (1,1,1); +insert into t2 values (1,1,1,1,1); +commit; +alter table t4 add constraint dc foreign key (a) references t1(a); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +show create table t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `a` int(11) NOT NULL, + `d` int(11) NOT NULL, + `e` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `d` (`d`), + CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t3 add constraint dc foreign key (a) references t1(a); +ERROR HY000: Can't create table `test`.`t3` (errno: 121 "Duplicate key on write or update") +SET FOREIGN_KEY_CHECKS=0; +alter table t3 add constraint dc foreign key (a) references t1(a); +ERROR HY000: Failed to add the foreign key constraint 'test/dc' to system tables +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) NOT NULL, + `c` int(11) NOT NULL, + `d` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `c` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t2 drop index b, add index (beta); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `alpha` int(11) NOT NULL, + `beta` int(11) DEFAULT NULL, + `c` int(11) NOT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + PRIMARY KEY (`alpha`), + UNIQUE KEY `dc` (`d`,`c`), + KEY `c` (`c`), + KEY `beta` (`beta`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`beta`) REFERENCES `t1` (`b`) ON DELETE SET NULL, + CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`), + CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`) ON UPDATE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +delete from t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) +drop index dc on t4; +ERROR 42000: Can't DROP INDEX `dc`; check that it exists +alter table t3 drop foreign key dc; +ERROR 42000: Can't DROP FOREIGN KEY `dc`; check that it exists +alter table t4 drop foreign key dc; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +select * from t2; +alpha beta c d e +1 1 1 1 1 +delete from t1; +select * from t2; +alpha beta c d e +1 NULL 1 1 1 +drop table t2,t4,t3,t1; +create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=utf8; +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); +commit; +alter table t1 add unique index (b); +ERROR 23000: Duplicate entry '2' for key 'b' +insert into t1 values(8,9,'fff','fff'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +alter table t1 add index (b); +insert into t1 values(10,10,'kkk','iii'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 6 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +alter table t1 add unique index (c), add index (d); +insert into t1 values(11,11,'aaa','mmm'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +select * from t1 force index(c) order by c; +a b c d +11 11 aaa mmm +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +select * from t1 force index(d) order by d; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 7 +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 31 NULL 7 +explain select * from t1 force index(d) order by d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL d 63 NULL 7 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `c` (`c`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +create table t1(a int not null, b int) engine = innodb; +insert into t1 values (1,1),(1,1),(1,1),(1,1); +alter table t1 add unique index (a); +ERROR 23000: Duplicate entry '1' for key 'a' +alter table t1 add unique index (b); +ERROR 23000: Duplicate entry '1' for key 'b' +alter table t1 add unique index (a), add unique index(b); +ERROR 23000: Duplicate entry '1' for key 'a' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb; +alter table t1 drop index c, drop index b; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `c` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(a int not null, b int, primary key(a)) engine = innodb; +alter table t1 add index (b); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe'); +alter table t1 add unique index (b), add unique index (c), add unique index (d); +ERROR 23000: Duplicate entry '4' for key 'b' +alter table t1 add unique index (c), add unique index (b), add index (d); +ERROR 23000: Duplicate entry 'ac' for key 'c' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb; +insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1); +alter table t1 add unique index (b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) NOT NULL, + `c` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b` (`b`), + KEY `c` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +analyze table t1; +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 5 NULL 9 +explain select * from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 9 +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL 9 +select * from t1 order by a; +a b c +1 5 1 +2 4 2 +3 3 3 +4 2 4 +5 1 5 +10 20 20 +11 19 19 +12 18 18 +13 17 17 +select * from t1 force index(b) order by b; +a b c +5 1 5 +4 2 4 +3 3 3 +2 4 2 +1 5 1 +13 17 17 +12 18 18 +11 19 19 +10 20 20 +select * from t1 force index(c) order by c; +a b c +1 5 1 +2 4 2 +3 3 3 +4 2 4 +5 1 5 +13 17 17 +12 18 18 +11 19 19 +10 20 20 +drop table t1; +create table t1(a int not null, b int not null) engine=innodb; +insert into t1 values (1,1); +alter table t1 add primary key(b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +insert into t1 values (2,2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) NOT NULL, + PRIMARY KEY (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select * from t1; +a b +1 1 +2 2 +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +explain select * from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +explain select * from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using filesort +explain select * from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 +checksum table t1; +Table Checksum +test.t1 582702641 +drop table t1; +create table t1(a int not null) engine=innodb; +insert into t1 values (1); +alter table t1 add primary key(a); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +insert into t1 values (2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +commit; +select * from t1; +a +1 +2 +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +explain select * from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index +explain select * from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index +drop table t1; +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t1( +c1 BIGINT(12) NOT NULL, +PRIMARY KEY (c1) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE t2( +c1 BIGINT(16) NOT NULL, +c2 BIGINT(12) NOT NULL, +c3 BIGINT(12) NOT NULL, +PRIMARY KEY (c1) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3) REFERENCES t1(c1); +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`), + KEY `fk_t2_ca` (`c3`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`), + KEY `i_t2_c3_c2` (`c3`,`c2`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; +INSERT INTO t2 VALUES(0,0,0); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)) +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0,0,0); +DROP TABLE t2; +CREATE TABLE t2( +c1 BIGINT(16) NOT NULL, +c2 BIGINT(12) NOT NULL, +c3 BIGINT(12) NOT NULL, +PRIMARY KEY (c1,c2,c3) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3) REFERENCES t1(c1); +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`,`c2`,`c3`), + KEY `fk_t2_ca` (`c3`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`,`c2`,`c3`), + KEY `i_t2_c3_c2` (`c3`,`c2`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t2 VALUES(0,0,1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)) +INSERT INTO t2 VALUES(0,0,0); +DELETE FROM t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)) +DELETE FROM t2; +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1( +c1 BIGINT(12) NOT NULL, +c2 INT(4) NOT NULL, +PRIMARY KEY (c2,c1) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE t2( +c1 BIGINT(16) NOT NULL, +c2 BIGINT(12) NOT NULL, +c3 BIGINT(12) NOT NULL, +PRIMARY KEY (c1) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1), ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1); +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1), ALGORITHM=INPLACE; +ERROR HY000: Failed to add the foreign key constraint on table 't2'. Incorrect options in FOREIGN KEY constraint 'test/fk_t2_ca' +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1), ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1' +ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca +FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +affected rows: 0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(12) NOT NULL, + `c2` bigint(12) NOT NULL, + PRIMARY KEY (`c2`,`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`), + KEY `fk_t2_ca` (`c3`,`c2`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +CREATE INDEX i_t2_c2_c1 ON t2(c2, c1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`), + KEY `fk_t2_ca` (`c3`,`c2`), + KEY `i_t2_c2_c1` (`c2`,`c1`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`), + KEY `fk_t2_ca` (`c3`,`c2`), + KEY `i_t2_c2_c1` (`c2`,`c1`), + KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` bigint(16) NOT NULL, + `c2` bigint(12) NOT NULL, + `c3` bigint(12) NOT NULL, + PRIMARY KEY (`c1`), + KEY `i_t2_c2_c1` (`c2`,`c1`), + KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`), + KEY `i_t2_c3_c2` (`c3`,`c2`), + CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +affected rows: 1 +DROP TABLE t2; +DROP TABLE t1; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e'); +CREATE TABLE t2 (a INT, b CHAR(1)) ENGINE=InnoDB; +CREATE TABLE t2i (a INT, b CHAR(1) NOT NULL) ENGINE=InnoDB; +CREATE TABLE t2c (a INT, b CHAR(1) NOT NULL) ENGINE=InnoDB; +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t2i SELECT * FROM t1; +INSERT INTO t2c SELECT * FROM t1; +connection b; +BEGIN; +SELECT * FROM t1; +a b +3 a +3 b +1 c +0 d +1 e +connection a; +SET lock_wait_timeout=1; +CREATE INDEX t1a ON t1(a); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +CREATE INDEX t2a ON t2(a); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +set @old_sql_mode = @@sql_mode; +set @@sql_mode = 'STRICT_TRANS_TABLES'; +ALTER TABLE t2i ADD PRIMARY KEY(a,b), ADD INDEX t2a(a), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +set @@sql_mode = @old_sql_mode; +ALTER TABLE t2c ADD PRIMARY KEY(a,b), ADD INDEX t2a(a), ALGORITHM=COPY; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +connection b; +SELECT * FROM t2i; +ERROR HY000: Table definition has changed, please retry transaction +SELECT * FROM t2i FORCE INDEX(t2a) ORDER BY a; +ERROR HY000: Table definition has changed, please retry transaction +SELECT * FROM t2c; +ERROR HY000: Table definition has changed, please retry transaction +SELECT * FROM t2c FORCE INDEX(t2a) ORDER BY a; +ERROR HY000: Table definition has changed, please retry transaction +SELECT * FROM t2; +a b +3 a +3 b +1 c +0 d +1 e +SELECT * FROM t2 FORCE INDEX(t2a) ORDER BY a; +ERROR HY000: Table definition has changed, please retry transaction +SELECT * FROM t2; +a b +3 a +3 b +1 c +0 d +1 e +COMMIT; +SELECT * FROM t2; +a b +3 a +3 b +1 c +0 d +1 e +SELECT * FROM t2 FORCE INDEX(t2a) ORDER BY a; +a b +0 d +1 c +1 e +3 a +3 b +SELECT * FROM t2i; +a b +0 d +1 c +1 e +3 a +3 b +SELECT * FROM t2i FORCE INDEX(t2a) ORDER BY a; +a b +0 d +1 c +1 e +3 a +3 b +SELECT * FROM t2c; +a b +0 d +1 c +1 e +3 a +3 b +SELECT * FROM t2c FORCE INDEX(t2a) ORDER BY a; +a b +0 d +1 c +1 e +3 a +3 b +connection default; +disconnect a; +disconnect b; +alter table t2 add index t2a(b); +ERROR 42000: Duplicate key name 't2a' +alter table t2 drop index t2a, add index t2a(b); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` char(1) DEFAULT NULL, + KEY `t2a` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2i; +Table Create Table +t2i CREATE TABLE `t2i` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`), + KEY `t2a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2c; +Table Create Table +t2c CREATE TABLE `t2c` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`), + KEY `t2a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1,t2,t2c,t2i; +CREATE TABLE t1 (c VARCHAR(1024), +c1 CHAR(255) NOT NULL,c2 CHAR(255) NOT NULL,c3 CHAR(255) NOT NULL, +c4 CHAR(255) NOT NULL,c5 CHAR(255) NOT NULL,c6 CHAR(255) NOT NULL, +c7 CHAR(255) NOT NULL,c8 CHAR(255) NOT NULL,c9 CHAR(255) NOT NULL, +ca CHAR(255) NOT NULL,cb CHAR(255) NOT NULL,cc CHAR(255) NOT NULL, +cd CHAR(255) NOT NULL,ce CHAR(255) NOT NULL,cf CHAR(255) NOT NULL, +d0 CHAR(255) NOT NULL,d1 CHAR(255) NOT NULL,d2 CHAR(255) NOT NULL, +d3 CHAR(255) NOT NULL,d4 CHAR(255) NOT NULL,d5 CHAR(255) NOT NULL, +d6 CHAR(255) NOT NULL,d7 CHAR(255) NOT NULL,d8 CHAR(255) NOT NULL, +d9 CHAR(255) NOT NULL,da CHAR(255) NOT NULL,db CHAR(255) NOT NULL, +dc CHAR(255) NOT NULL,dd CHAR(255) NOT NULL,de CHAR(255) NOT NULL, +UNIQUE KEY(c)) +ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(repeat('a',999),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''), +(CONCAT(repeat('a',999),'b'),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=inplace; +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=copy; +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +# +# Bug#19811005 ALTER TABLE ADD INDEX DOES NOT UPDATE INDEX_LENGTH +# IN I_S TABLES +# +CREATE TABLE t1(a INT, b INT) ENGINE=INNODB, STATS_PERSISTENT=1; +SELECT cast(DATA_LENGTH/@@innodb_page_size as int) D, +cast(INDEX_LENGTH/@@innodb_page_size as int) I +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'; +D I +1 0 +ALTER TABLE t1 ADD INDEX (a); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT cast(DATA_LENGTH/@@innodb_page_size as int) D, +cast(INDEX_LENGTH/@@innodb_page_size as int) I +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'; +D I +1 1 +ALTER TABLE t1 ADD INDEX (b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT cast(DATA_LENGTH/@@innodb_page_size as int) D, +cast(INDEX_LENGTH/@@innodb_page_size as int) I +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'; +D I +1 2 +DROP TABLE t1; +# +# Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE +# +SET GLOBAL innodb_monitor_enable = module_ddl; +create table t1(f1 int not null, f2 blob)engine=innodb; +insert into t1 values(1, repeat('a',20000)); +# Skip sort +# Reusing the same pk +alter table t1 force; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +drop table t1; +create table t1(f1 int not null, f2 int not null, +primary key(f1))engine=innodb; +insert into t1 values(1,2), (3,4); +# Add Secondary index. +# Skip temp file usage due to small table size +alter table t1 add key(f2); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +drop table t1; +create table t480(a serial)engine=innodb; +insert into t480 +values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), +(),(),(),(),(),(),(),(); +insert into t480 select 0 from t480; +insert into t480 select 0 from t480; +insert into t480 select 0 from t480; +insert into t480 select 0 from t480; +create table t1(f1 int auto_increment not null, +f2 char(200) not null, f3 char(200) not null, +f4 char(200) not null,primary key(f1))engine=innodb; +insert into t1 select NULL,'aaa','bbb','ccc' from t480; +insert into t1 select NULL,'aaaa','bbbb','cccc' from t480; +insert into t1 select NULL,'aaaaa','bbbbb','ccccc' from t480; +insert into t1 select NULL,'aaaaaa','bbbbbb','cccccc' from t480; +insert into t1 select NULL,'aaaaaaa','bbbbbbb','ccccccc' from t480; +insert into t1 select NULL,'aaaaaaaa','bbbbbbbb','cccccccc' from t480; +select count(*) from t1; +count(*) +2880 +# Skip sort +# Change PK from (f1) to (f1,f2,f3,f4) +alter table t1 drop primary key, add primary key(f1,f2,f3,f4); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Change PK from (f1,f2,f3,f4) to (f1,f2,added_columns) +alter table t1 drop primary key,add column f5 int not null, +add column f6 int not null,add primary key(f1,f2,f5,f6); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Change PK from (f1,f2,f5,f6) to (f1,f2,f5) +alter table t1 drop column f6; +ERROR 42000: Key column 'f6' doesn't exist in table +alter table t1 drop column f6, drop primary key, add primary key(f1,f2,f5); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Reusing the same PK +alter table t1 add column f6 int; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Reusing the same pk +alter table t1 drop column f6; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Must sort +# Change PK from (f1,f2,f5) to (f1,f5) +alter table t1 drop column f2; +ERROR 42000: Key column 'f2' doesn't exist in table +alter table t1 drop column f2, drop primary key, add primary key(f1,f5); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +ddl_sort_file_alter_table 2 +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Reusing the same pk +alter table t1 add column f2n int after f1, drop primary key, add +primary key (f1,f5,f2n); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Reusing the same pk +alter table t1 change f5 f2n int not null,change f2n f5 int not null, +add column f8 int not null; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Change PK from (f1,f4,f2n) to (f1,f4,added_column,f2n) +alter table t1 add column f7 int, drop primary key, +add primary key (f1,f5,f7,f2n); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +ddl_sort_file_alter_table 2 +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Reusing the same pk +alter table t1 force; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Reusing the same pk +alter table t1 row_format=compact; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Reusing the same pk +alter table t1 engine=innodb; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Optimize table +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +affected rows: 2 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Sort files used for adding secondary index +alter table t1 drop primary key, add primary key(f1,f5,f7), add index +i(f3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# No sort files used for dropping secondary index +alter table t1 drop primary key, add primary key(f1,f5),drop index i; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Change PK(f1,f5) to (f1,added_columns) and drop f5 +alter table t1 drop primary key, add primary key(f1,f12), +drop column f5, add column f12 int not null; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Must sort +# Change PK(f1,f12) to (f1,existing_columns) +alter table t1 drop primary key, add primary key(f1,f3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +ddl_sort_file_alter_table 2 +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort +# Change PK(f1,f3) to (f1,added_column,f3,added_column) +alter table t1 drop primary key, add column f3n int, +add column f4n int, add primary key(f1,f3n,f3,f4n); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Adding Secondary index alone. +alter table t1 add key(f1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Must sort +# Change PK(f1,f3) to (existing_column,f1) +alter table t1 drop primary key, add primary key(f4,f1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +ddl_sort_file_alter_table 3 +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort for PK. +# Change PK(f4,f1) to (added_columns,f4,f1) +# Secondary index rebuild happens +alter table t1 drop primary key, add column f5n int, +add column f6n int, add primary key(f5n,f6n,f4,f1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +# Skip sort for PK. +# Change PK(f5n,f6n,f4,f1) to +# (added_columns,f5n,added_column,f6n,f4,f1) +# Secondary index rebuild happens +alter table t1 drop primary key, add column f7n int, +add column f8n int, add primary key(f7n,f5n,f8n,f6n,f4,f1); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT name, count_reset FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE +subsystem = 'ddl' and count_reset > 0; +name count_reset +SET GLOBAL innodb_monitor_reset = module_ddl; +SET GLOBAL innodb_monitor_disable = module_ddl; +select count(*) from t1; +count(*) +2880 +drop table t1; +SET GLOBAL innodb_monitor_reset = default; +SET GLOBAL innodb_monitor_enable = default; +SET GLOBAL innodb_monitor_disable = default; +# Bug#19163915 INNODB: DUPLICATE RECORDS COULD EXIST +# WHEN SKIPPING SORT FOR CLUSTER INDEX +SELECT @@innodb_sort_buffer_size; +@@innodb_sort_buffer_size +1048576 +create table t1(f1 int auto_increment not null, +f2 char(200) not null, f3 char(200) not null, +f4 char(200) not null,primary key(f1,f2,f3,f4)); +insert into t1 select NULL,'aaa','bbb','ccc' from t480; +insert into t1 values(106, 'aaa','bbb','cccc'); +select count(*) from t1; +count(*) +481 +# Skip sort +# Change PK from (f1,f2,f3,f4) to (f1,f2,f3) +alter table t1 drop primary key, add primary key(f1,f2,f3); +ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '106-aaa-bbb' for key 'PRIMARY' +select count(*) from t1; +count(*) +481 +drop table t1; +create table t1(f1 int auto_increment not null, +f2 char(200) not null, f3 char(200) not null, +f4 char(200) not null,primary key(f1,f2,f3,f4)); +insert into t1 select NULL,'aaa','bbb','ccc' from t480; +insert into t1 values(108,'aaa','bbb','cccc'); +select count(*) from t1; +count(*) +481 +alter table t1 drop primary key, add primary key(f1,f2,f3); +ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '108-aaa-bbb' for key 'PRIMARY' +select count(*) from t1; +count(*) +481 +drop table t1, t480; +# +# Bug #19896922 SORTING SKIPPED WHEN PREFIX LENGTH OF THE PK +# FIELD IS CHANGED +# +create table t1(a int not null, b varchar(30) not null, +primary key (b(10), a)) engine = innodb; +insert into t1 values(0,'khdHps6UxW8Lwaoxa604oK6zkb'),(1,'khdHps6UxW8L'); +select * from t1; +a b +0 khdHps6UxW8Lwaoxa604oK6zkb +1 khdHps6UxW8L +alter table t1 drop primary key, add primary key (b(18),a); +select * from t1; +a b +1 khdHps6UxW8L +0 khdHps6UxW8Lwaoxa604oK6zkb +drop table t1; +create table t1(a int not null, b varchar(30) not null, +primary key (b(10), a)) engine = innodb; +insert into t1 values(0,'khdHps6UxW8Lwaoxa604oK6zkb'),(1,'khdHps6UtW8L'); +select * from t1; +a b +1 khdHps6UtW8L +0 khdHps6UxW8Lwaoxa604oK6zkb +alter table t1 drop primary key, add primary key (b(8),a); +select * from t1; +a b +0 khdHps6UxW8Lwaoxa604oK6zkb +1 khdHps6UtW8L +drop table t1; +# +# Bug #21103101 SORTING SKIPPED WHEN DROPPING THE SINGLE +# COLUMN PRIMARY KEY +# +create table t1(f1 int not null, f2 int not null, +primary key (f1), unique key(f1, f2))engine=innodb; +insert into t1 values(1,3), (2,2); +alter table t1 drop column f1; +ERROR 42000: Key column 'f1' doesn't exist in table +alter table t1 drop column f1, drop primary key; +ERROR 42000: Key column 'f1' doesn't exist in table +alter table t1 drop column f1, drop key f1; +drop table t1; +create table t1(f1 int not null, f2 int not null, +primary key (f1), unique key(f1, f2))engine=innodb; +insert into t1 values(1,3), (2,2); +alter table t1 drop primary key, lock=none; +alter table t1 drop index f1, lock=none; +ERROR 0A000: LOCK=NONE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try LOCK=SHARED +drop table t1; +# +# BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP +# LAST COLUMN OF OLD PK +# +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 drop primary key, add primary key(o1,o3), drop o2, lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 drop o1, drop o2, add primary key(o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 drop primary key, add primary key(o1,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 drop primary key, add primary key(o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 add column n1 int not null, drop primary key, add primary key(n1,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 add column n1 int not null, drop primary key, add primary key(o3,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,2,2),(2,1,1); +alter table t1 drop primary key, add primary key(o2, o1), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,2,2),(2,1,1); +alter table t1 drop primary key, add primary key(o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,2,2),(2,1,1); +alter table t1 drop primary key, add primary key(o2,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o2,o1)) engine = innodb; +insert into t1 values(1,1,2),(2,1,1); +alter table t1 drop primary key, add primary key(o2,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 drop primary key, add primary key(o1,o3,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int not null, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,2,2),(2,1,1); +alter table t1 drop primary key, add primary key(o3,o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 drop primary key, add primary key(o1,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,2,2),(2,1,1); +alter table t1 drop o1, lock=none; +ERROR 42000: Key column 'o1' doesn't exist in table +alter table t1 drop o1, drop primary key, add primary key(o2,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(1,2,1); +alter table t1 drop o2, lock=none; +ERROR 42000: Key column 'o2' doesn't exist in table +alter table t1 drop o2, drop primary key, add primary key(o1,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,2,2),(2,1,1); +alter table t1 drop o1, drop o2, lock=none; +ERROR 42000: Key column 'o2' doesn't exist in table +alter table t1 drop o1, drop o2,drop primary key,add primary key(o3),lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb; +insert into t1 values('abd', 1, 1), ('abc', 2, 2); +alter table t1 drop primary key, add primary key(o1(3), o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb; +insert into t1 values('abd', 1, 1), ('abc', 2, 2); +alter table t1 drop primary key, add primary key(o1, o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb; +insert into t1 values('abd', 1, 1), ('abc', 2, 2); +alter table t1 drop primary key, add primary key(o1(3), o3), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(2), o2)) engine = innodb; +insert into t1 values('abd', 1, 1), ('abc', 2, 2); +alter table t1 drop primary key, add primary key(o1, o3), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abc', 2, 1), ('abd', 1, 2); +alter table t1 drop primary key, add primary key(o1(2), o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1, o2)) engine = innodb; +insert into t1 values('abc', 2, 1), ('abd', 1, 2); +alter table t1 drop primary key, add primary key(o1(2), o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abc', 2, 2), ('abd', 1, 1); +alter table t1 drop primary key, add primary key(o1(2), o3), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 int not null, primary key(o1, o2)) engine = innodb; +insert into t1 values('abc', 2, 2), ('abd', 1, 1); +alter table t1 drop primary key, add primary key(o1(2), o3), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2(2),o3)) engine = innodb; +insert into t1 values(1, 'abd', 1), (1, 'abc', 2); +alter table t1 drop primary key, add primary key(o1,o2(3)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2(2),o3)) engine = innodb; +insert into t1 values(1, 'abd', 1), (1, 'abc', 2); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(3))) engine = innodb; +insert into t1 values('abc', 'acd'), ('abd', 'abd'); +alter table t1 drop primary key, add primary key(o1(2),o2(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2)) engine = innodb; +insert into t1 values('abc', 'acd'), ('abd', 'abd'); +alter table t1 drop primary key, add primary key(o1(2),o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(3))) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o2(3),o1(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2)) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o2,o1), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(3), n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(2))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 add n1 int not null, drop primary key, add primary key(o1, n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int not null, primary key(o1(2))) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(3), o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int not null, primary key(o1(2))) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1, o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1(3))) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), primary key(o1)) engine = innodb; +insert into t1 values('abd'), ('acd'); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 drop primary key, add primary key(o1(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(2),n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(2),n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1(3), o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1(3),n1), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, primary key(o1, o2)) engine = innodb; +insert into t1 values('abd', 1), ('acd', 2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2(3))) engine = innodb; +insert into t1 values(1,'abd'), (2,'acd'); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2)) engine = innodb; +insert into t1 values(1,'abd'), (2,'acd'); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2(2))) engine = innodb; +insert into t1 values(1, 'abd'), (2, 'acd'); +alter table t1 drop primary key, add primary key(o1,o2(3)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), primary key(o1,o2(2))) engine = innodb; +insert into t1 values(1, 'abd'), (2, 'acd'); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2(3),o3)) engine = innodb; +insert into t1 values(1, 'abd', 1), (2, 'acd', 2); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 varchar(10), o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1, 'abd', 1), (2, 'acd', 2); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(3))) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2)) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1,o2(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1(3),o2(2))) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 varchar(10), primary key(o1,o2(2))) engine = innodb; +insert into t1 values('abd', 'acd'), ('acd', 'abd'); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1(3),o2,o3(2))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2,o3(3)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1,o2,o3(2))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1,o2,o3), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1(3),o2,o3(3))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1(3),o2,o3(2)), lock=none; +drop table t1; +create table t1(o1 varchar(10), o2 int, o3 varchar(10), primary key(o1,o2,o3(3))) engine = innodb; +insert into t1 values('abd', 1, 'acd'), ('acd', 2, 'abd'); +alter table t1 drop primary key, add primary key(o1,o2,o3(2)), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(n1,o1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(n1,o1,n2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(n1,n2,o1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, add n2 int not null, drop primary key, add primary key(o1,n1,n2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1),(2,2); +alter table t1 add n1 int not null, drop primary key, add primary key(n1,o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, o3 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1,o2,o3), lock=none; +drop table t1; +create table t1(o1 int, o2 int not null, o3 int not null, primary key(o1)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1,o3,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, o4 int not null, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2,2),(2,2,1,1); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,o3,o4), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,o2,n1), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 add n1 int not null, drop primary key, add primary key(o1,n1,o2), lock=none; +drop table t1; +create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb; +insert into t1 values(1,1,2),(2,2,1); +alter table t1 drop primary key, add primary key(o1), lock=none; +drop table t1; +create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb; +insert into t1 values(1,1),(2,1); +alter table t1 drop primary key, add column a int unique auto_increment, +add primary key(o1,o2,a), algorithm=inplace; +drop table t1; +# +# MDEV-15325 Incomplete validation of missing tablespace during recovery +# +CREATE TABLE t1(f1 INT PRIMARY KEY)ENGINE=InnoDB; +CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB; +# Kill the server +# Wrong space_id in a dirty file and a missing file +# restart +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# Restore t1 and t2 +# restart +SELECT * FROM t1; +f1 +SELECT * FROM t2; +f1 +DROP TABLE t1, t2; +# +# MDEV-18186 assertion failure on missing InnoDB index +# +CREATE TABLE t (a INT, INDEX i1 (a)) ENGINE=INNODB; +DROP TABLE t; +CREATE TABLE t (a INT) ENGINE=INNODB; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + KEY `i1` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +Warnings: +Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +DROP TABLE t; +# +# MDEV-27374 InnoDB table becomes corrupt after renaming DESC-indexed column +# +CREATE TABLE t1 (a VARCHAR(8), PRIMARY KEY(a DESC)) ENGINE=InnoDB; +ALTER TABLE t1 RENAME COLUMN a TO b, ALGORITHM=INPLACE; +SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; +SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; +NAME +b +DROP TABLE t1; +# +# MDEV-27432 ASC/DESC primary and unique keys cause index +# inconsistency between InnoDB and server +# +CREATE TABLE t1 (id INT NOT NULL, UNIQUE(id DESC)) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY (id), ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `id` (`id` DESC) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-27445 Index inconsistency and assertion failure after +# renaming virtual column with DESC key +# +CREATE TABLE t1(a INT, b INT AS (a), KEY(a, b DESC)) ENGINE=InnoDB; +ALTER TABLE t1 RENAME COLUMN IF EXISTS b TO v; +ALTER TABLE t1 FORCE; +DROP TABLE t1; +# +# MDEV-27592 DESC primary index fails to set wide format +# while renaming the column +# +CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), b INT, KEY(a DESC,b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'foo',10); +ALTER TABLE t1 RENAME COLUMN b TO c, ALGORITHM=INPLACE; +SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; +SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id ORDER BY INDEX_ID DESC LIMIT 1; +SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; +NAME +a +c +DROP TABLE t1; +# End of 10.8 tests diff --git a/mysql-test/suite/innodb/r/innodb-index_ucs2.result b/mysql-test/suite/innodb/r/innodb-index_ucs2.result new file mode 100644 index 00000000..a6e38280 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-index_ucs2.result @@ -0,0 +1,116 @@ +create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=ucs2; +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); +commit; +alter table t1 add unique index (b); +ERROR 23000: Duplicate entry '2' for key 'b' +insert into t1 values(8,9,'fff','fff'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci +alter table t1 add index (b); +insert into t1 values(10,10,'kkk','iii'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 6 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci +alter table t1 add unique index (c), add index (d); +insert into t1 values(11,11,'aaa','mmm'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +select * from t1 force index(c) order by c; +a b c d +11 11 aaa mmm +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +select * from t1 force index(d) order by d; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 7 +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 21 NULL 7 +explain select * from t1 force index(d) order by d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL d 43 NULL 7 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `c` (`c`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-isolation.result b/mysql-test/suite/innodb/r/innodb-isolation.result new file mode 100644 index 00000000..b6e512cc --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-isolation.result @@ -0,0 +1,1417 @@ +# +# WL#6742 - Test the interaction of multiple transactions using +# different isolation levels to make sure that the value returned +# by count(*) always reflects the correct view of the table according +# to the transaction's selected isolation level. +# +# +# Traverse various indexes to get the right counts. +# This especially tests count(*) which is pushed down to InnoDB in WL#6742. +# +CREATE TABLE t1 ( +c1 INT AUTO_INCREMENT PRIMARY KEY, +c2 INT, +c3 INT, +c4 INT, +INDEX k2(c2) +) Engine=InnoDB; +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1); +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 (SELECT * FROM t1); +affected rows: 10 +info: Records: 10 Duplicates: 0 Warnings: 0 +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 1 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +7 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +55 +SELECT SUM(c2) FROM t1; +SUM(c2) +10 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.5000 10 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +7 1 +8 1 +9 1 +10 1 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +# +# Do some DML in the default connection and leave the transaction pending. +# +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +UPDATE t1 SET c2 = c2 * 3 WHERE c1 = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +DELETE FROM t1 WHERE c1 = 6; +affected rows: 1 +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 1 +2 1 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +7 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +49 +SELECT SUM(c2) FROM t1; +SUM(c2) +11 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.4444 10 1 1.0000 9 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +7 1 +8 1 +9 1 +10 1 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Start transactions of Repeatable Read, Read Committed, and Read Uncommitted +# +# Connection 1 REPEATABLE READ +# +connect con1,localhost,root,,; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 1 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +7 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +55 +SELECT SUM(c2) FROM t1; +SUM(c2) +10 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.5000 10 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +7 1 +8 1 +9 1 +10 1 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +UPDATE t1 SET c2 = c2 * 5 WHERE c1 = 2; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +DELETE FROM t1 WHERE c1 = 7; +affected rows: 1 +INSERT INTO t1(c2,c3,c4) VALUES (100, 1, 1); +affected rows: 1 +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 5 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +11 100 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +59 +SELECT SUM(c2) FROM t1; +SUM(c2) +113 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.9000 11 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +8 1 +9 1 +10 1 +11 100 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +# +# Test a lock wait timeout during COUNT(*) +# +SET innodb_lock_wait_timeout = 1; +SELECT COUNT(*) FROM t1 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +# +# Connection 2 READ COMMITTED +# +connect con2,localhost,root,,; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 1 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +7 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +55 +SELECT SUM(c2) FROM t1; +SUM(c2) +10 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.5000 10 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +7 1 +8 1 +9 1 +10 1 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +UPDATE t1 SET c2 = c2 * 7 WHERE c1 = 3; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +DELETE FROM t1 WHERE c1 = 8; +affected rows: 1 +INSERT INTO t1(c2,c3,c4) VALUES (1000, 1, 1); +affected rows: 1 +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 1 1 1 +3 7 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +7 1 1 1 +9 1 1 1 +10 1 1 1 +12 1000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +59 +SELECT SUM(c2) FROM t1; +SUM(c2) +1015 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.9000 12 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +7 1 +9 1 +10 1 +12 1000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +# +# Connection 3 READ UNCOMMITTED +# +connect con3,localhost,root,,; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +BEGIN; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 1 +2 5 1 1 +3 7 1 1 +4 1 1 1 +5 1 1 1 +9 1 1 1 +10 1 1 1 +11 100 1 1 +12 1000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +57 +SELECT SUM(c2) FROM t1; +SUM(c2) +1119 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.3333 12 1 1.0000 9 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +9 1 +10 1 +11 100 +12 1000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +UPDATE t1 SET c2 = c2 * 11 WHERE c1 = 4; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +INSERT INTO t1(c2,c3,c4) VALUES (10000, 1, 1); +affected rows: 1 +DELETE FROM t1 WHERE c1 in(9); +affected rows: 1 +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 1 +2 5 1 1 +3 7 1 1 +4 11 1 1 +5 1 1 1 +10 1 1 1 +11 100 1 1 +12 1000 1 1 +13 10000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +61 +SELECT SUM(c2) FROM t1; +SUM(c2) +11128 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.7778 13 1 1.0000 9 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +10 1 +11 100 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Connection default REPEATABLE READ +# +connection default; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 1 +2 1 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +7 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +49 +SELECT SUM(c2) FROM t1; +SUM(c2) +11 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.4444 10 1 1.0000 9 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +7 1 +8 1 +9 1 +10 1 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Commit the 3 extra connections +# +# Connection 1 REPEATABLE READ +# +connection con1; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 5 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +11 100 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +59 +SELECT SUM(c2) FROM t1; +SUM(c2) +113 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.9000 11 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +8 1 +9 1 +10 1 +11 100 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +# +# Connection 2 READ COMMITTED +# +connection con2; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 1 1 1 +3 7 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +7 1 1 1 +9 1 1 1 +10 1 1 1 +12 1000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +59 +SELECT SUM(c2) FROM t1; +SUM(c2) +1015 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.9000 12 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +7 1 +9 1 +10 1 +12 1000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +# +# Connection 3 READ UNCOMMITTED +# +connection con3; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 1 +2 5 1 1 +3 7 1 1 +4 11 1 1 +5 1 1 1 +10 1 1 1 +11 100 1 1 +12 1000 1 1 +13 10000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +61 +SELECT SUM(c2) FROM t1; +SUM(c2) +11128 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.7778 13 1 1.0000 9 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +10 1 +11 100 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +COMMIT; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 1 +2 5 1 1 +3 7 1 1 +4 11 1 1 +5 1 1 1 +10 1 1 1 +11 100 1 1 +12 1000 1 1 +13 10000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +61 +SELECT SUM(c2) FROM t1; +SUM(c2) +11128 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.7778 13 1 1.0000 9 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +10 1 +11 100 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Connection 2 READ COMMITTED +# +connection con2; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 1 1 1 +3 7 1 1 +4 11 1 1 +5 1 1 1 +6 1 1 1 +7 1 1 1 +10 1 1 1 +12 1000 1 1 +13 10000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +63 +SELECT SUM(c2) FROM t1; +SUM(c2) +11024 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.3000 13 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +7 1 +10 1 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +COMMIT; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 1 1 1 +3 7 1 1 +4 11 1 1 +5 1 1 1 +6 1 1 1 +7 1 1 1 +10 1 1 1 +12 1000 1 1 +13 10000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +63 +SELECT SUM(c2) FROM t1; +SUM(c2) +11024 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.3000 13 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +7 1 +10 1 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Connection 1 REPEATABLE READ +# +connection con1; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 5 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +6 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +11 100 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +59 +SELECT SUM(c2) FROM t1; +SUM(c2) +113 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.9000 11 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +8 1 +9 1 +10 1 +11 100 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +5 +############################################### +# +# Select the first 5 records FOR UPDATE using count(*) in a subquery. +# The second record is still pending so we get a lock timeout. +# +SET innodb_lock_wait_timeout = 1; +SELECT c1, c2 FROM t1 WHERE c1 < ((SELECT COUNT(*) FROM t1) / 2) FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT COUNT(*) FROM t1 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +COMMIT; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 1 1 1 +2 5 1 1 +3 7 1 1 +4 11 1 1 +5 1 1 1 +6 1 1 1 +10 1 1 1 +11 100 1 1 +12 1000 1 1 +13 10000 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +10 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +10 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +10 +SELECT SUM(c1) FROM t1; +SUM(c1) +67 +SELECT SUM(c2) FROM t1; +SUM(c2) +11127 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.7000 13 1 1.0000 10 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +6 1 +10 1 +11 100 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Show The EXPLAIN output for these queries; +# +EXPLAIN SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # +EXPLAIN SELECT COUNT(*) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k2 5 NULL # Using index +EXPLAIN SELECT COUNT(c1) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k2 5 NULL # Using index +EXPLAIN SELECT COUNT(c2) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k2 5 NULL # Using index +EXPLAIN SELECT COUNT(c3) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # +EXPLAIN SELECT SUM(c1) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k2 5 NULL # Using index +EXPLAIN SELECT SUM(c2) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k2 5 NULL # Using index +EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # +EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL # Using where +2 SUBQUERY t1 index NULL k2 5 NULL # Using index +EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL # Using where +2 SUBQUERY t1 index NULL k2 5 NULL # Using index +EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL # Using where; Using index +2 SUBQUERY t1 index NULL k2 5 NULL # Using index +# +# Make all indexes in t2 obsolete to the active repeatable read transaction +# in the default connection. +# +ALTER TABLE t2 row_format=redundant; +# +# Connection default REPEATABLE READ +# Do more DML in the default REPEATABLE READ transaction in order to use recently committed records. +# +connection default; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 1 +2 1 1 1 +3 1 1 1 +4 1 1 1 +5 1 1 1 +7 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +49 +SELECT SUM(c2) FROM t1; +SUM(c2) +11 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +5.4444 10 1 1.0000 9 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +7 1 +8 1 +9 1 +10 1 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +UPDATE t1 SET c4 = c2 * 10; +affected rows: 9 +info: Rows matched: 9 Changed: 9 Warnings: 0 +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 30 +2 5 1 50 +3 7 1 70 +4 11 1 110 +5 1 1 10 +7 1 1 1 +8 1 1 1 +9 1 1 1 +10 1 1 10 +11 100 1 1000 +12 1000 1 10000 +13 10000 1 100000 +SELECT COUNT(*) FROM t1; +COUNT(*) +12 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +12 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +12 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +12 +SELECT SUM(c1) FROM t1; +SUM(c1) +85 +SELECT SUM(c2) FROM t1; +SUM(c2) +11131 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +7.0833 13 1 1.0000 111283 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +7 1 +8 1 +9 1 +10 1 +11 100 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +7 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +6 +############################################### +# +# Table t2 has been altered to a new row format. +# The index should not be useable. +# +SELECT COUNT(*) FROM t2; +ERROR HY000: Table definition has changed, please retry transaction +SELECT * FROM t2; +ERROR HY000: Table definition has changed, please retry transaction +COMMIT; +SELECT COUNT(*) FROM t2; +COUNT(*) +10 +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 30 +2 5 1 50 +3 7 1 70 +4 11 1 110 +5 1 1 10 +10 1 1 10 +11 100 1 1000 +12 1000 1 10000 +13 10000 1 100000 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +61 +SELECT SUM(c2) FROM t1; +SUM(c2) +11128 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.7778 13 1 1.0000 111280 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +10 1 +11 100 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Connection 2 +# +connection con2; +########## innodb_isolation_selects.inc ########## +SELECT * FROM t1; +c1 c2 c3 c4 +1 3 1 30 +2 5 1 50 +3 7 1 70 +4 11 1 110 +5 1 1 10 +10 1 1 10 +11 100 1 1000 +12 1000 1 10000 +13 10000 1 100000 +SELECT COUNT(*) FROM t1; +COUNT(*) +9 +SELECT COUNT(c1) FROM t1; +COUNT(c1) +9 +SELECT COUNT(c2) FROM t1; +COUNT(c2) +9 +SELECT COUNT(c3) FROM t1; +COUNT(c3) +9 +SELECT SUM(c1) FROM t1; +SUM(c1) +61 +SELECT SUM(c2) FROM t1; +SUM(c2) +11128 +SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; +AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4) +6.7778 13 1 1.0000 111280 +SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +c1 c2 +5 1 +10 1 +11 100 +12 1000 +13 10000 +SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); +COUNT(c2) +5 +SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); +COUNT(*) +4 +############################################### +# +# Try COUNT(*) on a DISCARDED table. +# +connection default; +CREATE TABLE t4 LIKE t1; +INSERT INTO t4 (SELECT * FROM t1); +SELECT COUNT(*) FROM t4; +COUNT(*) +9 +ALTER TABLE t4 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t4; +ERROR HY000: Tablespace has been discarded for table `t4` +# +# Test the interaction of a repeatable read transaction +# to changes that happen outside its view. +# +CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB; +INSERT INTO t5(b) VALUES ("inserted by client 1"); +INSERT INTO t5(b) VALUES ("inserted by client 1"); +INSERT INTO t5(b) VALUES ("inserted by client 1"); +INSERT INTO t5(b) VALUES ("inserted by client 1"); +UPDATE t5 SET aa=a, bb=b; +CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB; +INSERT INTO t6(b) VALUES ("inserted by client 1"); +INSERT INTO t6(b) VALUES ("inserted by client 1"); +INSERT INTO t6(b) VALUES ("inserted by client 1"); +INSERT INTO t6(b) VALUES ("inserted by client 1"); +UPDATE t6 SET aa=a, bb=b; +CREATE TABLE t7 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB; +INSERT INTO t7(b) VALUES ("inserted by client 1"); +INSERT INTO t7(b) VALUES ("inserted by client 1"); +INSERT INTO t7(b) VALUES ("inserted by client 1"); +INSERT INTO t7(b) VALUES ("inserted by client 1"); +UPDATE t7 SET aa=a, bb=b; +BEGIN; +SELECT * FROM t5; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +2 inserted by client 1 2 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +SELECT COUNT(*) FROM t5; +COUNT(*) +4 +SELECT * FROM t6; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +2 inserted by client 1 2 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +SELECT COUNT(*) FROM t6; +COUNT(*) +4 +SELECT * FROM t7; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +2 inserted by client 1 2 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +SELECT COUNT(*) FROM t7; +COUNT(*) +4 +# +# Connection 1 +# +connection con1; +INSERT INTO t5(b) VALUES ("inserted by client 2"); +UPDATE t5 SET a = 10 where a = 1; +UPDATE t5 SET b = "updated by client 2" where a = 2; +DELETE FROM t5 WHERE a = 3; +SELECT * FROM t5; +a b aa bb +2 updated by client 2 2 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +5 inserted by client 2 NULL NULL +10 inserted by client 1 1 inserted by client 1 +SELECT COUNT(*) FROM t5; +COUNT(*) +4 +INSERT INTO t6(b) VALUES ("inserted by client 2"); +UPDATE t6 SET a = 10 where a = 1; +UPDATE t6 SET b = "updated by client 2" where a = 2; +DELETE FROM t6 WHERE a = 3; +SELECT * FROM t6; +a b aa bb +2 updated by client 2 2 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +5 inserted by client 2 NULL NULL +10 inserted by client 1 1 inserted by client 1 +SELECT COUNT(*) FROM t6; +COUNT(*) +4 +INSERT INTO t7(b) VALUES ("inserted by client 2"); +UPDATE t7 SET a = 10 where a = 1; +UPDATE t7 SET b = "updated by client 2" where a = 2; +DELETE FROM t7 WHERE a = 3; +SELECT * FROM t7; +a b aa bb +2 updated by client 2 2 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +5 inserted by client 2 NULL NULL +10 inserted by client 1 1 inserted by client 1 +SELECT COUNT(*) FROM t7; +COUNT(*) +4 +# +# Connection default +# +connection default; +SELECT * FROM t5; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +2 inserted by client 1 2 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +INSERT INTO t5(b) VALUES ("inserted by client 1"); +SELECT * FROM t5; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +2 inserted by client 1 2 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +4 inserted by client 1 4 inserted by client 1 +11 inserted by client 1 NULL NULL +UPDATE t5 SET a = a + 100; +SELECT * FROM t5; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +102 updated by client 2 2 inserted by client 1 +104 inserted by client 1 4 inserted by client 1 +105 inserted by client 2 NULL NULL +110 inserted by client 1 1 inserted by client 1 +111 inserted by client 1 NULL NULL +SELECT COUNT(*) FROM t5; +COUNT(*) +7 +UPDATE t6 SET b = "updated by client 2"; +SELECT * FROM t6; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +2 inserted by client 1 2 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +4 updated by client 2 4 inserted by client 1 +5 updated by client 2 NULL NULL +10 updated by client 2 1 inserted by client 1 +SELECT * FROM t6 LOCK IN SHARE MODE; +a b aa bb +2 updated by client 2 2 inserted by client 1 +4 updated by client 2 4 inserted by client 1 +5 updated by client 2 NULL NULL +10 updated by client 2 1 inserted by client 1 +SELECT COUNT(*) FROM t6; +COUNT(*) +6 +DELETE FROM t7; +SELECT * FROM t7; +a b aa bb +1 inserted by client 1 1 inserted by client 1 +3 inserted by client 1 3 inserted by client 1 +SELECT COUNT(*) FROM t7; +COUNT(*) +2 +COMMIT; +SELECT * FROM t5; +a b aa bb +102 updated by client 2 2 inserted by client 1 +104 inserted by client 1 4 inserted by client 1 +105 inserted by client 2 NULL NULL +110 inserted by client 1 1 inserted by client 1 +111 inserted by client 1 NULL NULL +SELECT COUNT(*) FROM t5; +COUNT(*) +5 +SELECT * FROM t6; +a b aa bb +2 updated by client 2 2 inserted by client 1 +4 updated by client 2 4 inserted by client 1 +5 updated by client 2 NULL NULL +10 updated by client 2 1 inserted by client 1 +SELECT COUNT(*) FROM t6; +COUNT(*) +4 +SELECT * FROM t7; +a b aa bb +SELECT COUNT(*) FROM t7; +COUNT(*) +0 +# +# Cleanup +# +DROP TABLE t1,t2,t4,t5,t6,t7; +disconnect con1; +disconnect con2; +disconnect con3; +# +# Bug #23596760: FORCE INDEX IS SKIPPED WHILE EXECUTING SELECT COUNT(*) +# +CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY, +c2 INT NOT NULL DEFAULT 1, +c3 char(20) DEFAULT '', +KEY c2_idx (c2)) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1(c1) VALUES (1), (2), (3); +INSERT INTO t1(c1) SELECT c1 + 10 FROM t1; +INSERT INTO t1(c1) SELECT c1 + 100 FROM t1; +CREATE TABLE t2 STATS_PERSISTENT=0 SELECT * FROM t1; +EXPLAIN SELECT COUNT(*) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index +EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index +EXPLAIN SELECT COUNT(*) FROM t1, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index +1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) +EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx), t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index +1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/r/innodb-lock.result b/mysql-test/suite/innodb/r/innodb-lock.result new file mode 100644 index 00000000..83bed139 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-lock.result @@ -0,0 +1,163 @@ +set global innodb_table_locks=1; +select @@innodb_table_locks; +@@innodb_table_locks +1 +set @@innodb_table_locks=1; +connect con1,localhost,root,,; +create table t1 (id integer, x integer) engine=INNODB; +insert into t1 values(0, 0); +set autocommit=0; +SELECT * from t1 where id = 0 FOR UPDATE; +id x +0 0 +connect con2,localhost,root,,; +set autocommit=0; +lock table t1 write; +connection con1; +update t1 set x=1 where id = 0; +select * from t1; +id x +0 1 +commit; +connection con2; +update t1 set x=2 where id = 0; +commit; +unlock tables; +connection con1; +select * from t1; +id x +0 2 +commit; +drop table t1; +# +# Old lock method (where LOCK TABLE was ignored by InnoDB) no longer +# works when LOCK TABLE ... WRITE is used due to fix for bugs #46272 +# "MySQL 5.4.4, new MDL: unnecessary and bug #37346 "innodb does not +# detect deadlock between update and alter table". +# After WL#6671 "Improve scalability by not using thr_lock.c locks +# for InnoDB tables" was implemented it no longer works for LOCK TABLES +# ,,, READ as well. +# LOCK TABLES locks are now completely handled by MDL subsystem. +# +set @@innodb_table_locks=0; +create table t1 (id integer primary key, x integer) engine=INNODB; +insert into t1 values(0, 0),(1,1),(2,2); +commit; +SELECT * from t1 where id = 0 FOR UPDATE; +id x +0 0 +connection con2; +set autocommit=0; +set @@innodb_table_locks=0; +# The following statement should block because SQL-level lock +# is taken on t1 which will wait until concurrent transaction +# is commited. +# Sending: +lock table t1 write;; +connection con1; +# Wait until LOCK TABLE is blocked on SQL-level lock. +# We should be able to do UPDATEs and SELECTs within transaction. +update t1 set x=1 where id = 0; +select * from t1; +id x +0 1 +1 1 +2 2 +# Unblock LOCK TABLE. +commit; +connection con2; +# Reap LOCK TABLE. +unlock tables; +connection con1; +select * from t1 where id = 0 for update; +id x +0 1 +connection con2; +# The following statement should block because SQL-level lock +# is taken on t1 which will wait until concurrent transaction +# is commited. +# Sending: +lock table t1 read;; +connection con1; +# Wait until LOCK TABLE is blocked on SQL-level lock. +# We should be able to do UPDATEs and SELECTs within transaction. +update t1 set x=2 where id = 0; +select * from t1; +id x +0 2 +1 1 +2 2 +# Unblock LOCK TABLE. +commit; +connection con2; +# Reap LOCK TABLE. +unlock tables; +connection default; +drop table t1; +# +#Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE +#fixed by re-fixing Bug#7975 +#aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT... +# +connection default; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB; +INSERT INTO t1 VALUES(3,1); +BEGIN; +INSERT IGNORE INTO t1 VALUES(3,14); +Warnings: +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +connection con1; +BEGIN; +INSERT IGNORE INTO t1 VALUES(3,23); +Warnings: +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +SELECT * FROM t1 FOR UPDATE; +connection con2; +disconnect con2; +connection default; +COMMIT; +connection con1; +a b +3 1 +COMMIT; +connection default; +DROP TABLE t1; +# +# MDEV-11080 InnoDB: Failing assertion: +# table->n_waiting_or_granted_auto_inc_locks > 0 +# +CREATE TABLE t1 (pk INTEGER AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(NULL); +CREATE TABLE t2 LIKE t1; +BEGIN; +connection con1; +BEGIN; +DELETE FROM t2; +connection default; +LOCK TABLE t2 READ;; +connection con1; +SET innodb_lock_wait_timeout= 1, lock_wait_timeout= 2; +INSERT INTO t2 SELECT * FROM t1; +COMMIT; +connection default; +UNLOCK TABLES; +DROP TABLE t1, t2; +# +# MDEV-16709 InnoDB: Error: trx already had an AUTO-INC lock +# +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB +PARTITION BY key (pk) PARTITIONS 2; +INSERT INTO t1 VALUES(100); +INSERT INTO t1 VALUES(101); +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6); +CREATE TABLE t3 (b INT) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9); +connection con1; +INSERT t1 SELECT NULL FROM t2; +connection default; +INSERT t1 SELECT NULL FROM t3; +connection con1; +disconnect con1; +connection default; +DROP TABLE t1, t2, t3; diff --git a/mysql-test/suite/innodb/r/innodb-lru-force-no-free-page.result b/mysql-test/suite/innodb/r/innodb-lru-force-no-free-page.result new file mode 100644 index 00000000..09e53b59 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-lru-force-no-free-page.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool"); +SET @saved_debug = @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,ib_lru_force_no_free_page"; +CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB; +BEGIN; +INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200)); +COMMIT; +SET debug_dbug = @saved_debug; +DROP TABLE t1; +FOUND 1 /InnoDB: Difficult to find free blocks / in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7408.result b/mysql-test/suite/innodb/r/innodb-mdev-7408.result new file mode 100644 index 00000000..80b46d34 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-mdev-7408.result @@ -0,0 +1,13 @@ +call mtr.add_suppression("InnoDB: User stopword table .* does not exist."); +select @@global.innodb_ft_server_stopword_table; +@@global.innodb_ft_server_stopword_table +NULL +CREATE TABLE `stop_it-IT` ENGINE = InnoDB SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD; +SET @@global.innodb_ft_server_stopword_table = 'test/stop_it-IT'; +ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'test/stop_it-IT' +SET @@global.innodb_ft_server_stopword_table = 'test/stop_it@002dIT'; +drop table `stop_it-IT`; +CREATE TABLE stop_it ENGINE = InnoDB SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD; +SET @@global.innodb_ft_server_stopword_table = 'test/stop_it'; +SET @@global.innodb_ft_server_stopword_table = NULL; +drop table stop_it; diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7513.result b/mysql-test/suite/innodb/r/innodb-mdev-7513.result new file mode 100644 index 00000000..24afa594 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-mdev-7513.result @@ -0,0 +1,204 @@ +CREATE TABLE t1 ( text1 TEXT, +text2 TEXT, +text3 TEXT, +text4 TEXT, +text5 TEXT, +text6 TEXT, +text7 TEXT, +text8 TEXT, +text9 TEXT, +text10 TEXT, +text11 TEXT, +text12 TEXT, +text13 TEXT, +text14 TEXT, +text15 TEXT, +text16 TEXT, +text17 TEXT, +text18 TEXT, +text19 TEXT, +text20 TEXT, +text21 TEXT, +text22 TEXT, +text23 TEXT, +text24 TEXT, +text25 TEXT, +text26 TEXT, +text27 TEXT, +text28 TEXT, +text29 TEXT, +text30 TEXT, +text31 TEXT, +text32 TEXT, +text33 TEXT, +text34 TEXT, +text35 TEXT, +text36 TEXT, +text37 TEXT, +text38 TEXT, +text39 TEXT, +text40 TEXT, +text41 TEXT, +text42 TEXT, +text43 TEXT, +text44 TEXT, +text45 TEXT, +text46 TEXT, +text47 TEXT, +text48 TEXT, +text49 TEXT, +text50 TEXT, +text51 TEXT, +text52 TEXT, +text53 TEXT, +text54 TEXT, +text55 TEXT, +text56 TEXT, +text57 TEXT, +text58 TEXT, +text59 TEXT, +text60 TEXT, +text61 TEXT, +text62 TEXT, +text63 TEXT, +text64 TEXT, +text65 TEXT, +text66 TEXT, +text67 TEXT, +text68 TEXT, +text69 TEXT, +text70 TEXT, +text71 TEXT, +text72 TEXT, +text73 TEXT, +text74 TEXT, +text75 TEXT, +text76 TEXT, +text77 TEXT, +text78 TEXT, +text79 TEXT, +text80 TEXT, +text81 TEXT, +text82 TEXT, +text83 TEXT, +text84 TEXT, +text85 TEXT, +text86 TEXT, +text87 TEXT, +text88 TEXT, +text89 TEXT, +text90 TEXT, +text91 TEXT, +text92 TEXT, +text93 TEXT, +text94 TEXT, +text95 TEXT, +text96 TEXT, +text97 TEXT, +text98 TEXT, +text99 TEXT, +text100 TEXT, +text101 TEXT, +text102 TEXT, +text103 TEXT, +text104 TEXT, +text105 TEXT, +text106 TEXT, +text107 TEXT, +text108 TEXT, +text109 TEXT, +text110 TEXT, +text111 TEXT, +text112 TEXT, +text113 TEXT, +text114 TEXT, +text115 TEXT, +text116 TEXT, +text117 TEXT, +text118 TEXT, +text119 TEXT, +text120 TEXT, +text121 TEXT, +text122 TEXT, +text123 TEXT, +text124 TEXT, +text125 TEXT, +text126 TEXT, +text127 TEXT, +text128 TEXT, +text129 TEXT, +text130 TEXT, +text131 TEXT, +text132 TEXT, +text133 TEXT, +text134 TEXT, +text135 TEXT, +text136 TEXT, +text137 TEXT, +text138 TEXT, +text139 TEXT, +text140 TEXT, +text141 TEXT, +text142 TEXT, +text143 TEXT, +text144 TEXT, +text145 TEXT, +text146 TEXT, +text147 TEXT, +text148 TEXT, +text149 TEXT, +text150 TEXT, +text151 TEXT, +text152 TEXT, +text153 TEXT, +text154 TEXT, +text155 TEXT, +text156 TEXT, +text157 TEXT, +text158 TEXT, +text159 TEXT, +text160 TEXT, +text161 TEXT, +text162 TEXT, +text163 TEXT, +text164 TEXT, +text165 TEXT, +text166 TEXT, +text167 TEXT, +text168 TEXT, +text169 TEXT, +text170 TEXT, +text171 TEXT, +text172 TEXT, +text173 TEXT, +text174 TEXT, +text175 TEXT, +text176 TEXT, +text177 TEXT, +text178 TEXT, +text179 TEXT, +text180 TEXT, +text181 TEXT, +text182 TEXT, +text183 TEXT, +text184 TEXT, +text185 TEXT, +text186 TEXT, +text187 TEXT, +text188 TEXT, +text189 TEXT, +text190 TEXT, +text191 TEXT, +text192 TEXT, +text193 TEXT, +text194 TEXT, +text195 TEXT, +text196 TEXT, +text197 TEXT +) ENGINE = InnoDB; +INSERT INTO t1 VALUES ('abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef'); +DELETE FROM t1 WHERE text1 = 'abcdef'; +# restart +SELECT * from t1; +text1 text2 text3 text4 text5 text6 text7 text8 text9 text10 text11 text12 text13 text14 text15 text16 text17 text18 text19 text20 text21 text22 text23 text24 text25 text26 text27 text28 text29 text30 text31 text32 text33 text34 text35 text36 text37 text38 text39 text40 text41 text42 text43 text44 text45 text46 text47 text48 text49 text50 text51 text52 text53 text54 text55 text56 text57 text58 text59 text60 text61 text62 text63 text64 text65 text66 text67 text68 text69 text70 text71 text72 text73 text74 text75 text76 text77 text78 text79 text80 text81 text82 text83 text84 text85 text86 text87 text88 text89 text90 text91 text92 text93 text94 text95 text96 text97 text98 text99 text100 text101 text102 text103 text104 text105 text106 text107 text108 text109 text110 text111 text112 text113 text114 text115 text116 text117 text118 text119 text120 text121 text122 text123 text124 text125 text126 text127 text128 text129 text130 text131 text132 text133 text134 text135 text136 text137 text138 text139 text140 text141 text142 text143 text144 text145 text146 text147 text148 text149 text150 text151 text152 text153 text154 text155 text156 text157 text158 text159 text160 text161 text162 text163 text164 text165 text166 text167 text168 text169 text170 text171 text172 text173 text174 text175 text176 text177 text178 text179 text180 text181 text182 text183 text184 text185 text186 text187 text188 text189 text190 text191 text192 text193 text194 text195 text196 text197 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-mdev7046.result b/mysql-test/suite/innodb/r/innodb-mdev7046.result new file mode 100644 index 00000000..f65c0ff4 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-mdev7046.result @@ -0,0 +1,3 @@ +show create database test; +Database Create Database +test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ diff --git a/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result new file mode 100644 index 00000000..474ebf33 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result @@ -0,0 +1,60 @@ +set sql_mode=''; +set innodb_strict_mode=0; +CREATE TABLE `v` ( +`id` int(11) unsigned NOT NULL AUTO_INCREMENT, +PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT v values (1); +CREATE TABLE `vp` ( +`id` int(11) unsigned NOT NULL AUTO_INCREMENT, +`v_id` int(10) unsigned NOT NULL, +`p_id` int(10) unsigned NOT NULL, +`ppp` varchar(255) NOT NULL, +PRIMARY KEY (`id`), +UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`), +KEY `FK_vp_v` (`v_id`), +CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT vp VALUES (12, 1, 100, 'text12'); +INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`); +Warnings: +Warning 1364 Field 'v_id' doesn't have a default value +Warning 1364 Field 'p_id' doesn't have a default value +SELECT * FROM vp; +id v_id p_id ppp +12 1 100 test12-2 +DROP TABLE vp, v; +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); +CREATE TABLE t2 ( +i int not null primary key, +vi int not null, +m int, +UNIQUE KEY (vi), +CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +Warnings: +Warning 1364 Field 'vi' doesn't have a default value +SELECT * FROM t2; +i vi m +1 1 3 +DROP TABLE t2,t1; +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); +CREATE TABLE t2 ( +i int not null primary key, +vi int not null, +m int, +KEY (vi), +CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +Warnings: +Warning 1364 Field 'vi' doesn't have a default value +SELECT * FROM t2; +i vi m +1 1 3 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result new file mode 100644 index 00000000..6a57be49 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result @@ -0,0 +1,67 @@ +create table t1(a int not null primary key, b geometry not null) engine=innodb; +ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b), ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Do not support online operation on table with GIS index. Try ALGORITHM=NOCOPY +show warnings; +Level Code Message +Error 1846 ALGORITHM=INSTANT is not supported. Reason: Do not support online operation on table with GIS index. Try ALGORITHM=NOCOPY +show errors; +Level Code Message +Error 1846 ALGORITHM=INSTANT is not supported. Reason: Do not support online operation on table with GIS index. Try ALGORITHM=NOCOPY +ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b), LOCK=SHARED, ALGORITHM=NOCOPY; +show warnings; +Level Code Message +show errors; +Level Code Message +drop table t1; +create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` geometry NOT NULL, + `d` int(11) DEFAULT NULL, + SPATIAL KEY `c` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d; +ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +show warnings; +Level Code Message +Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +show errors; +Level Code Message +Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED +ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED; +show warnings; +Level Code Message +show errors; +Level Code Message +drop table t1; +# +# MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1); +ERROR 22007: Incorrect LINESTRING value: 'POINT(1 1)' for column ``.``.`b` at row 0 +DESCRIBE t1; +Field Type Null Key Default Extra +a int(11) YES NULL +DROP TABLE t1; +# +# Bug #19077964 ASSERT PAGE_SIZE.EQUALS_TO SPACE_PAGE_SIZE +# BTR_COPY_BLOB_PREFIX +# +CREATE TABLE t1(f1 INT PRIMARY KEY, f3 LINESTRING NOT NULL, +SPATIAL KEY(f3))ENGINE=InnoDB ROW_FORMAT=COMPRESSED +KEY_BLOCK_SIZE=1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f3` linestring NOT NULL, + PRIMARY KEY (`f1`), + SPATIAL KEY `f3` (`f3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 +INSERT INTO t1 VALUES (1, ST_linefromtext(concat('linestring', '( 0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7, 8 8, 9 9, 10 10, 11 11, 12 12, 13 13, 14 14, 15 15, 16 16, 17 17, 18 18, 19 19, 20 20, 21 21, 22 22, 23 23, 24 24, 25 25, 26 26, 27 27, 28 28, 29 29, 30 30, 31 31, 32 32, 33 33, 34 34, 35 35, 36 36, 37 37, 38 38, 39 39, 40 40, 41 41, 42 42, 43 43, 44 44, 45 45, 46 46, 47 47, 48 48, 49 49, 50 50, 51 51, 52 52, 53 53, 54 54, 55 55, 56 56, 57 57, 58 58, 59 59, 60 60, 61 61, 62 62, 63 63, 64 64, 65 65, 66 66, 67 67, 68 68, 69 69, 70 70, 71 71, 72 72, 73 73, 74 74, 75 75, 76 76, 77 77, 78 78, 79 79, 9999 9999)')));; +ALTER TABLE t1 ROW_FORMAT = DYNAMIC, KEY_BLOCK_SIZE=0, ALGORITHM=INPLACE; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_none.result b/mysql-test/suite/innodb/r/innodb-page_compression_none.result new file mode 100644 index 00000000..58b2119e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-page_compression_none.result @@ -0,0 +1,18 @@ +# +# MDEV-30825 innodb_compression_algorithm=0 (none) increments Innodb_num_pages_page_compression_error +# +SET @save_compression_algorithm=@@GLOBAL.innodb_compression_algorithm; +SET GLOBAL innodb_compression_algorithm=0; +SELECT VARIABLE_VALUE INTO @compress_errors FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_num_pages_page_compression_error'; +CREATE TABLE t (c INT) page_compressed=1 page_compression_level=4 ENGINE=InnoDB; +INSERT INTO t VALUES (1); +FLUSH TABLES t FOR EXPORT; +UNLOCK TABLES; +SELECT VARIABLE_VALUE - @compress_errors AS NUMBER_OF_ERRORS FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_num_pages_page_compression_error'; +NUMBER_OF_ERRORS +0 +DROP TABLE t; +SET GLOBAL innodb_compression_algorithm=@save_compression_algorithm; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/innodb-read-view.result b/mysql-test/suite/innodb/r/innodb-read-view.result new file mode 100644 index 00000000..e01d8a11 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-read-view.result @@ -0,0 +1,222 @@ +CREATE TABLE t1 (c1 INT , c2 CHAR(10), PRIMARY KEY (c1)) ENGINE = InnoDB; +INSERT INTO t1 VALUES(0, "0"); +INSERT INTO t1 VALUES(1, "1"); +INSERT INTO t1 VALUES(2, "2"); +INSERT INTO t1 VALUES(3, "3"); +CREATE TABLE t2 (c1 INT , c2 CHAR(10), PRIMARY KEY (c1)) ENGINE = InnoDB; +INSERT INTO t2 VALUES(0, "a"); +INSERT INTO t2 VALUES(1, "b"); +INSERT INTO t2 VALUES(2, "c"); +INSERT INTO t2 VALUES(3, "d"); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +'T1' +SET AUTOCOMMIT=0; +BEGIN; +SELECT * FROM t2; +c1 c2 +0 a +1 b +2 c +3 d +connection default; +'T2' +SET AUTOCOMMIT=0; +BEGIN; +SELECT * FROM t1; +c1 c2 +0 0 +1 1 +2 2 +3 3 +connection con2; +'T3' +SET AUTOCOMMIT=0; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +SELECT * FROM t1; +c1 c2 +0 0 +1 1 +2 2 +3 3 +SELECT * FROM t2; +c1 c2 +0 a +1 b +2 c +3 d +connection con1; +'T1' +UPDATE t2 SET c1 = c1 + 100; +SELECT * FROM t2; +c1 c2 +100 a +101 b +102 c +103 d +COMMIT; +connection default; +'T2' +UPDATE t1 SET c1 = c1 + 100; +SELECT * FROM t1; +c1 c2 +100 0 +101 1 +102 2 +103 3 +COMMIT; +connection con2; +'T3' +SET DEBUG_SYNC='row_search_for_mysql_before_return WAIT_FOR waiting1'; +SELECT * FROM t1;; +connection default; +'T2' +SET DEBUG_SYNC='now SIGNAL waiting1'; +'Signalled T3' +connection con2; +'T3' +c1 c2 +0 0 +1 1 +2 2 +3 3 +connection con2; +'T3' +SET DEBUG_SYNC='row_search_for_mysql_before_return WAIT_FOR waiting1'; +SELECT * FROM t2;; +connection default; +'T2' +SET DEBUG_SYNC='now SIGNAL waiting1'; +'Signalled T3' +connection con2; +'T3' +c1 c2 +0 a +1 b +2 c +3 d +connection default; +disconnect con1; +disconnect con2; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +'T1' +SET AUTOCOMMIT=0; +BEGIN; +SELECT * FROM t1; +c1 c2 +100 0 +101 1 +102 2 +103 3 +connection default; +'T2' +SET AUTOCOMMIT=0; +BEGIN; +SELECT * FROM t2; +c1 c2 +100 a +101 b +102 c +103 d +UPDATE t2 SET c1 = c1 + 100; +SELECT * FROM t2; +c1 c2 +200 a +201 b +202 c +203 d +COMMIT; +connection con2; +'T3' +SET AUTOCOMMIT=0; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +SELECT * FROM t1; +c1 c2 +100 0 +101 1 +102 2 +103 3 +SELECT * FROM t2; +c1 c2 +200 a +201 b +202 c +203 d +connection con1; +'T1' +UPDATE t1 SET c1 = c1 + 100; +SELECT * FROM t1; +c1 c2 +200 0 +201 1 +202 2 +203 3 +COMMIT; +connection con2; +'T3' +SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1'; +SELECT * FROM t1;; +connection con1; +'T2' +SET DEBUG_SYNC='now SIGNAL waiting1'; +'Signalled T3' +connection con2; +'T3' +c1 c2 +100 0 +101 1 +102 2 +103 3 +connection con2; +'T3' +SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1'; +SELECT * FROM t2;; +connection default; +'T2' +SET DEBUG_SYNC='now SIGNAL waiting1'; +'Signalled T3' +connection con2; +'T3' +c1 c2 +200 a +201 b +202 c +203 d +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t1; +DROP TABLE t2; +# +# Bug 21433768: NON-REPEATABLE READ WITH REPEATABLE READ ISOLATION +# +connect con1,localhost,root,,; +CREATE TABLE t1(col1 INT PRIMARY KEY, col2 INT) ENGINE = InnoDB; +INSERT INTO t1 values (1, 0), (2, 0); +SELECT * FROM t1 ORDER BY col1; +col1 col2 +1 0 +2 0 +START TRANSACTION; +UPDATE t1 SET col2 = 100; +SET DEBUG_SYNC = 'after_trx_committed_in_memory SIGNAL s1 WAIT_FOR s2'; +COMMIT;; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR s1'; +UPDATE t1 SET col2 = col2 + 10 where col1 = 1; +COMMIT; +SELECT * FROM t1 ORDER BY col1; +col1 col2 +1 110 +2 100 +SET DEBUG_SYNC = 'now SIGNAL s2'; +connection con1; +disconnect con1; +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result new file mode 100644 index 00000000..03e22b77 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -0,0 +1,14 @@ +# +# Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX +# +create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), +key k2(f3)) engine=innodb; +insert into t1 values (14, 24, 34); +set @old_dbug= @@session.debug_dbug; +SET debug_dbug = '+d,row_ins_sec_index_entry_timeout'; +replace into t1 values (14, 25, 34); +select * from t1; +f1 f2 f3 +14 25 34 +drop table t1; +SET debug_dbug = @old_dbug; diff --git a/mysql-test/suite/innodb/r/innodb-replace.result b/mysql-test/suite/innodb/r/innodb-replace.result new file mode 100644 index 00000000..c926bb89 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-replace.result @@ -0,0 +1,13 @@ +drop table if exists t1; +create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; +select * from t1; +c1 c2 stamp +replace delayed into t1 (c1, c2) values ( "text1","11"); +ERROR HY000: DELAYED option not supported for table 't1' +select * from t1; +c1 c2 stamp +replace delayed into t1 (c1, c2) values ( "text1","12"); +ERROR HY000: DELAYED option not supported for table 't1' +select * from t1; +c1 c2 stamp +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-rollback.result b/mysql-test/suite/innodb/r/innodb-rollback.result new file mode 100644 index 00000000..5eca7ad6 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-rollback.result @@ -0,0 +1,10 @@ +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +connect con1,localhost,root,,test; +ALTER TABLE t1; +connect con2,localhost,root,,test; +SELECT f() FROM t1; +ERROR 42000: FUNCTION test.f does not exist +disconnect con2; +disconnect con1; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-semi-consistent.result b/mysql-test/suite/innodb/r/innodb-semi-consistent.result new file mode 100644 index 00000000..f4541b58 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-semi-consistent.result @@ -0,0 +1,66 @@ +drop table if exists t1,t2; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +set binlog_format=mixed; +set session transaction isolation level repeatable read; +create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; +insert into t1 values (1),(2),(3),(4),(5),(6),(7); +set autocommit=0; +select * from t1 where a=3 lock in share mode; +a +3 +connection b; +set binlog_format=mixed; +set session transaction isolation level repeatable read; +set autocommit=0; +update t1 set a=10 where a=5; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +connection a; +commit; +connection b; +set session transaction isolation level read committed; +update t1 set a=10 where a=5; +connection a; +select * from t1 where a=2 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1 where a=2 limit 1 for update; +a +2 +connection b; +update t1 set a=11 where a=6; +update t1 set a=12 where a=2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +update t1 set a=13 where a=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection a; +commit; +connection b; +update t1 set a=14 where a=1; +commit; +connection a; +select * from t1; +a +14 +2 +3 +4 +10 +11 +7 +drop table t1; +connection default; +disconnect a; +disconnect b; +create table t1 (a int, b int) engine=myisam; +create table t2 (c int, d int, key (c)) engine=innodb; +insert into t1 values (1,1); +insert into t2 values (1,2); +connect a,localhost,root,,; +connection a; +set session transaction isolation level read committed; +delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1); +connection default; +disconnect a; +drop table t1, t2; diff --git a/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result new file mode 100644 index 00000000..06bb708b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result @@ -0,0 +1,33 @@ +call mtr.add_suppression("InnoDB: Warning: Index.*"); +SET @saved_dbug = @@SESSION.debug_dbug; +set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized'; +create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb; +create procedure innodb_insert_proc (repeat_count int) +begin +declare current_num int; +set current_num = 0; +while current_num < repeat_count do +insert into t1 values(current_num, current_num, current_num); +set current_num = current_num + 1; +end while; +end// +commit; +set autocommit=0; +call innodb_insert_proc(10000); +commit; +set autocommit=1; +select count(1) from t1; +count(1) +10000 +select count(1) from t1 where a between 5 and 100; +count(1) +96 +select count(1) from t1 where b between 5 and 256; +count(1) +252 +select count(1) from t1 where c between 7 and 787; +count(1) +781 +drop procedure innodb_insert_proc; +drop table t1; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb-stats-modified-counter.result b/mysql-test/suite/innodb/r/innodb-stats-modified-counter.result new file mode 100644 index 00000000..fe47912e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-stats-modified-counter.result @@ -0,0 +1,20 @@ +set global innodb_stats_auto_recalc=off; +CREATE TABLE t1 (i int) ENGINE=InnoDB; +SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER +test/t1 1 0 0 +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER +test/t1 1 2 2 +DELETE FROM t1 WHERE i = 1; +SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER +test/t1 1 1 3 +UPDATE t1 SET i = 4 WHERE i = 2; +SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER +test/t1 1 1 4 +DROP TABLE t1; +set global innodb_stats_auto_recalc=default; diff --git a/mysql-test/suite/innodb/r/innodb-stats-sample.result b/mysql-test/suite/innodb/r/innodb-stats-sample.result new file mode 100644 index 00000000..0670903c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-stats-sample.result @@ -0,0 +1,6 @@ +Warnings: +Warning 1292 Truncated incorrect innodb_stats_transient_sample... value: '0' +Variable_name Value +innodb_stats_transient_sample_pages 1 +Variable_name Value +innodb_stats_traditional OFF diff --git a/mysql-test/suite/innodb/r/innodb-system-table-view.result b/mysql-test/suite/innodb/r/innodb-system-table-view.result new file mode 100644 index 00000000..c770d106 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-system-table-view.result @@ -0,0 +1,175 @@ +SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables +WHERE name = 'mysql/innodb_table_stats'; +SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables +WHERE name = 'mysql/innodb_index_stats'; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +11 SYS_FOREIGN 0 7 0 Redundant 0 System +12 SYS_FOREIGN_COLS 0 7 0 Redundant 0 System +13 SYS_VIRTUAL 0 6 0 Redundant 0 System +16 mysql/transaction_registry 33 8 3 Dynamic 0 Single +SELECT table_id,pos,mtype,prtype,len,name +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS +WHERE table_id NOT IN (@table_stats_id, @index_stats_id) +ORDER BY table_id, pos; +table_id pos mtype prtype len name +11 0 1 524292 0 ID +11 1 1 524292 0 FOR_NAME +11 2 1 524292 0 REF_NAME +11 3 6 0 4 N_COLS +12 0 1 524292 0 ID +12 1 6 0 4 POS +12 2 1 524292 0 FOR_COL_NAME +12 3 1 524292 0 REF_COL_NAME +13 0 6 0 8 TABLE_ID +13 1 6 0 4 POS +13 2 6 0 4 BASE_POS +16 0 6 1800 8 transaction_id +16 1 6 1800 8 commit_id +16 2 3 526087 7 begin_timestamp +16 3 3 526087 7 commit_timestamp +16 4 6 1022 1 isolation_level +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES +WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY index_id; +INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD +# ID_IND # 3 1 # # 50 +# FOR_IND # 0 1 # # 50 +# REF_IND # 0 1 # # 50 +# ID_IND # 3 2 # # 50 +# BASE_IDX # 3 3 # # 50 +# PRIMARY # 3 1 # # 50 +# commit_id # 2 1 # # 50 +# begin_timestamp # 0 1 # # 50 +# commit_timestamp # 0 2 # # 50 +SELECT index_id,pos,name FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS +WHERE name NOT IN ('database_name', 'table_name', 'index_name', 'stat_name') +ORDER BY index_id, pos; +index_id pos name +11 0 ID +12 0 FOR_NAME +13 0 REF_NAME +14 0 ID +14 1 POS +15 0 TABLE_ID +15 1 POS +15 2 BASE_POS +18 0 transaction_id +19 0 commit_id +20 0 begin_timestamp +21 0 commit_timestamp +21 1 transaction_id +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +CREATE TABLE t_redundant (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb; +CREATE TABLE t_compact (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb; +CREATE TABLE t_compressed (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb KEY_BLOCK_SIZE=2; +CREATE TABLE t_dynamic (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb; +=== information_schema.innodb_sys_tables and innodb_sys_tablespaces === +Table Name Tablespace Table Flags Columns Row Format Zip Size +test/t_compact test/t_compact 1 5 Compact 0 +test/t_compressed test/t_compressed 37 5 Compressed 2048 +test/t_dynamic test/t_dynamic 33 5 Dynamic 0 +test/t_redundant test/t_redundant 0 5 Redundant 0 +=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === +Space_Name Page_Size Zip_Size Path +test/t_redundant DEFAULT DEFAULT MYSQLD_DATADIR/test/t_redundant.ibd +test/t_compact DEFAULT DEFAULT MYSQLD_DATADIR/test/t_compact.ibd +test/t_compressed DEFAULT 2048 MYSQLD_DATADIR/test/t_compressed.ibd +test/t_dynamic DEFAULT DEFAULT MYSQLD_DATADIR/test/t_dynamic.ibd +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 +DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic; +SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; +count(*) +6 +CREATE TABLE parent (id INT NOT NULL, +PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE child (id INT, parent_id INT, +INDEX par_ind (parent_id), +CONSTRAINT constraint_test +FOREIGN KEY (parent_id) REFERENCES parent(id) +ON DELETE CASCADE) ENGINE=INNODB; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/constraint_test test/child test/parent 1 1 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/constraint_test parent_id id 0 +INSERT INTO parent VALUES(1); +InnoDB 0 transactions not purged +SELECT name, num_rows, ref_count +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name LIKE "%parent"; +name num_rows ref_count +test/parent 1 1 +SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name NOT LIKE 'sys/%'; +NAME FLAG N_COLS +SYS_FOREIGN 0 7 +SYS_FOREIGN_COLS 0 7 +SYS_VIRTUAL 0 6 +mysql/innodb_index_stats 33 11 +mysql/innodb_table_stats 33 9 +mysql/transaction_registry 33 8 +test/child 33 5 +test/parent 33 4 +SELECT name, n_fields +from INFORMATION_SCHEMA.INNODB_SYS_INDEXES +WHERE table_id In (SELECT table_id from +INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE "%parent%"); +name n_fields +PRIMARY 1 +SELECT name, n_fields +from INFORMATION_SCHEMA.INNODB_SYS_INDEXES +WHERE table_id In (SELECT table_id from +INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE "%child%"); +name n_fields +GEN_CLUST_INDEX 0 +par_ind 1 +SELECT name, pos, mtype, len +from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS +WHERE table_id In (SELECT table_id from +INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE "%child%"); +name pos mtype len +id 0 6 4 +parent_id 1 6 4 +DROP TABLE child; +DROP TABLE parent; +CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL, +PRIMARY KEY (id, newid)) ENGINE=INNODB; +CREATE TABLE child (id INT, parent_id INT, +INDEX par_ind (parent_id), +CONSTRAINT constraint_test +FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid) +ON DELETE CASCADE) ENGINE=INNODB; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/constraint_test test/child test/parent 2 1 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/constraint_test id id 0 +test/constraint_test parent_id newid 1 +INSERT INTO parent VALUES(1, 9); +SELECT * FROM parent WHERE id IN (SELECT id FROM parent); +id newid +1 9 +InnoDB 0 transactions not purged +SELECT name, num_rows, ref_count +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name LIKE "%parent"; +name num_rows ref_count +test/parent 1 2 +DROP TABLE child; +DROP TABLE parent; +# +# MDEV-29479 I_S.INNODB_SYS_TABLESPACES doesn't have +# temporary tablespace information +# +SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE name like 'innodb_temporary'; +SPACE +4294967294 diff --git a/mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff b/mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff new file mode 100644 index 00000000..624af214 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff @@ -0,0 +1,20 @@ +--- innodb-table-online.result ++++ innodb-table-online,crypt.reject +@@ -291,7 +291,7 @@ + @merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0, + @rowlog_encrypt_1>@rowlog_encrypt_0; + sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0 +-0 0 0 0 ++0 0 0 1 + SET DEBUG_SYNC = 'now SIGNAL dml2_done'; + # session con1 + connection con1; +@@ -393,7 +393,7 @@ + @rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted, + @rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted; + sort_encrypted sort_decrypted log_encrypted log_decrypted +-0 0 0 0 ++1 1 1 1 + ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)); + ERROR 23000: Duplicate entry '' for key 'PRIMARY' + UPDATE t1 SET c3 = NULL WHERE c3 = ''; diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result new file mode 100644 index 00000000..9296fded --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-table-online.result @@ -0,0 +1,501 @@ +call mtr.add_suppression("InnoDB: Warning: Small buffer pool size"); +call mtr.add_suppression("InnoDB: Error: table 'test/t1'"); +call mtr.add_suppression("MariaDB is trying to open a table handle but the .ibd file for"); +SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; +SET GLOBAL innodb_file_per_table = on; +CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 CHAR(255) NOT NULL) +ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,''); +SET GLOBAL innodb_monitor_enable = module_ddl; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +SET DEBUG_SYNC = 'RESET'; +SET DEBUG_SYNC = 'write_row_noreplace SIGNAL have_handle WAIT_FOR go_ahead'; +INSERT INTO t1 VALUES(1,2,3); +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR have_handle'; +SET lock_wait_timeout = 1; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +connection con1; +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter'; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE; +ERROR HY000: Out of memory. +SET SESSION DEBUG = @saved_debug_dbug; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter'; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE; +ERROR HY000: Out of memory. +SET SESSION DEBUG = @saved_debug_dbug; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` char(255) NOT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +BEGIN; +INSERT INTO t1 VALUES(7,4,2); +connection con1; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL scanned WAIT_FOR insert_done'; +ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +COMMIT; +connection con1; +ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2); +ERROR 23000: Duplicate entry '4' for key 'c2' +connection default; +DELETE FROM t1 WHERE c1 = 7; +connection con1; +ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2), ROW_FORMAT=COMPACT, +LOCK = SHARED, ALGORITHM = INPLACE; +ALTER TABLE t1 ADD UNIQUE INDEX(c2), +LOCK = EXCLUSIVE, ALGORITHM = INPLACE; +Warnings: +Note 1831 Duplicate index `c2_2`. This is deprecated and will be disallowed in a future release +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` char(255) NOT NULL, + UNIQUE KEY `c2` (`c2`), + UNIQUE KEY `c2_2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +INSERT INTO t1 VALUES(4,7,2); +SET DEBUG_SYNC = 'now SIGNAL insert_done'; +connection con1; +ERROR 23000: Duplicate entry '4' for key 'PRIMARY' +DELETE FROM t1 WHERE c1=4 and c2=7; +connection default; +ROLLBACK; +connection con1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` char(255) NOT NULL, + UNIQUE KEY `c2` (`c2`), + UNIQUE KEY `c2_2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2), ALGORITHM = INPLACE; +ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists +ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1), ALGORITHM = INPLACE; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +connection default; +INSERT INTO t1 VALUES(6,3,1); +ERROR 23000: Duplicate entry '3' for key 'c2_2' +INSERT INTO t1 VALUES(7,4,2); +ERROR 23000: Duplicate entry '4' for key 'c2_2' +DROP INDEX c2_2 ON t1; +BEGIN; +INSERT INTO t1 VALUES(7,4,2); +ROLLBACK; +connection con1; +KILL QUERY @id; +ERROR 70100: Query execution was interrupted +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml_done'; +SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL applied WAIT_FOR kill_done'; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR rebuilt'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +BEGIN; +INSERT INTO t1 VALUES(7,4,2); +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL dml_done WAIT_FOR applied'; +KILL QUERY @id; +SET DEBUG_SYNC = 'now SIGNAL kill_done'; +connection con1; +ERROR 70100: Query execution was interrupted +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 0 +connection default; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 SELECT 5 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1; +EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL ROWS Using where +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SET @merge_encrypt_0= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_0= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_0= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +connection con1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` char(255) NOT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done'; +SET lock_wait_timeout = 10; +ALTER TABLE t1 ROW_FORMAT=COMPACT +PAGE_COMPRESSED = YES PAGE_COMPRESSION_LEVEL = 1, ALGORITHM = INPLACE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR rebuilt2'; +INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1; +INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1; +UPDATE t1 SET c2 = c2 + 1; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +UPDATE t1 SET c2 = c2 + 1; +UPDATE t1 SET c2 = c2 + 2; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +SET @merge_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +SELECT +(@merge_encrypt_1-@merge_encrypt_0)- +(@merge_decrypt_1-@merge_decrypt_0) as sort_balance, +@merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0, +@rowlog_encrypt_1>@rowlog_encrypt_0; +sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0 +0 0 0 0 +SET DEBUG_SYNC = 'now SIGNAL dml2_done'; +connection con1; +ERROR HY000: Creating index 'PRIMARY' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 0 +ddl_log_file_alter_table 1 +SET @merge_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +SET @rowlog_decrypt_1= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted'); +SET GLOBAL innodb_max_purge_lag_wait=0; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt3 WAIT_FOR dml3_done'; +ALTER TABLE t1 ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT; +ERROR 42000: Multiple primary key defined +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT; +ERROR 23000: Duplicate entry '26' for key 'PRIMARY' +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f,c1,c4(5)), +CHANGE c2 c22f INT, CHANGE c3 c3 CHAR(255) NULL, CHANGE c1 c1 INT AFTER c22f, +ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online', LOCK=NONE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR rebuilt3'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 2 +ddl_log_file_alter_table 1 +BEGIN; +INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 240; +DELETE FROM t1 WHERE c1 > 320; +UPDATE t1 SET c2 = c2 + 1; +COMMIT; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 1 +ddl_pending_alter_table 1 +ddl_sort_file_alter_table 2 +ddl_log_file_alter_table 2 +SET DEBUG_SYNC = 'now SIGNAL dml3_done'; +connection con1; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 2 +ddl_log_file_alter_table 2 +SELECT COUNT(c22f) FROM t1; +COUNT(c22f) +320 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SET @merge_encrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted'); +SET @merge_decrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted'); +SET @rowlog_encrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted'); +SET @rowlog_decrypt_2= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted'); +SELECT +(@merge_encrypt_2-@merge_encrypt_1)- +(@merge_decrypt_2-@merge_decrypt_1) as sort_balance, +(@rowlog_encrypt_2-@rowlog_encrypt_1)- +(@rowlog_decrypt_2-@rowlog_decrypt_1) as log_balance; +sort_balance log_balance +0 0 +SELECT +@merge_encrypt_2-@merge_encrypt_1>0 as sort_encrypted, +@merge_decrypt_2-@merge_decrypt_1>0 as sort_decrypted, +@rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted, +@rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted; +sort_encrypted sort_decrypted log_encrypted log_decrypted +0 0 0 0 +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)); +ERROR 23000: Duplicate entry '' for key 'PRIMARY' +UPDATE t1 SET c3 = NULL WHERE c3 = ''; +SET lock_wait_timeout = 1; +ALTER TABLE t1 DROP COLUMN c22f, ADD PRIMARY KEY c3p5(c3(5)); +ERROR 42000: Key column 'c22f' doesn't exist in table +ALTER IGNORE TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)), +ALGORITHM = INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows. Try ALGORITHM=COPY +UPDATE t1 SET c3=LEFT(CONCAT(c1,REPEAT('foo',c1)),255) WHERE c3 IS NULL; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created0 WAIT_FOR ins_done0'; +ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL, DROP COLUMN c22f, +DROP PRIMARY KEY, ADD PRIMARY KEY(c1,c4(5)), +ADD COLUMN c5 CHAR(5) DEFAULT 'tired' FIRST; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created0'; +BEGIN; +INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti','YLETV2'); +INSERT INTO t1 VALUES(33101,347,NULL,''); +COMMIT; +SET DEBUG_SYNC = 'now SIGNAL ins_done0'; +connection con1; +ERROR 22004: Invalid use of NULL value +DELETE FROM t1 WHERE c1= 347 and c22f = 33101; +ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created WAIT_FOR ins_done'; +ALTER TABLE t1 DROP PRIMARY KEY, DROP COLUMN c22f, +ADD COLUMN c6 VARCHAR(1000) DEFAULT +'I love tracking down hard-to-reproduce bugs.', +ADD PRIMARY KEY c3p5(c3(5), c6(2)); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created'; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL ins_done WAIT_FOR ddl_timed_out'; +INSERT INTO t1 VALUES(347,33101,NULL,''); +ERROR 23000: Column 'c3' cannot be null +INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti',''); +connection con1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC = 'now SIGNAL ddl_timed_out'; +SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl'; +name count +ddl_background_drop_indexes 0 +ddl_online_create_index 0 +ddl_pending_alter_table 0 +ddl_sort_file_alter_table 6 +ddl_log_file_alter_table 2 +connection default; +SELECT COUNT(*) FROM t1; +COUNT(*) +322 +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +SELECT * FROM t1 LIMIT 10; +c22f c1 c3 c4 +27 1 1foo Online +27 6 6foofoofoofoofoofoo Online +27 11 11foofoofoofoofoofoofoofoofoofoofoo Online +27 16 16foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 21 21foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 26 26foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 31 31foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 36 36foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 41 41foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +27 46 46foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo Online +connection con1; +ALTER TABLE t1 DISCARD TABLESPACE; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c22f` int(11) NOT NULL, + `c1` int(11) NOT NULL, + `c3` char(255) NOT NULL, + `c4` varchar(6) NOT NULL DEFAULT 'Online', + PRIMARY KEY (`c22f`,`c1`,`c4`(5)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SET GLOBAL innodb_monitor_disable = module_ddl; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b blob) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0,NULL); +connection con1; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL created WAIT_FOR ins'; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +BEGIN; +INSERT INTO t1 VALUES(1, repeat('a', 10000)); +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL ins'; +connection con1; +connection default; +SELECT * FROM t1; +a b +0 NULL +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; +# +# MDEV-29600 Memory leak in row_log_table_apply_update() +# +CREATE TABLE t1 (pk INT PRIMARY KEY, f TEXT) ENGINE=InnoDB; +INSERT INTO t1 SET pk=1; +connection con1; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL created WAIT_FOR updated'; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR created'; +UPDATE t1 SET f = REPEAT('a', 20000); +SET DEBUG_SYNC = 'now SIGNAL updated'; +connection con1; +connection default; +DROP TABLE t1; +# +# MDEV-29977 Memory leak in row_log_table_apply_update +# +CREATE TABLE t1(f1 longtext, f2 int, KEY(f1(1024)), KEY(f2, f1(20))) ENGINE=InnoDB; +INSERT INTO t1 VALUES('a', 1); +connection con1; +set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL con_default WAIT_FOR con1_signal"; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC="now WAIT_FOR con_default"; +UPDATE t1 SET f1 = NULL; +UPDATE t1 SET f1 = REPEAT('b', 9000); +SET DEBUG_SYNC="now SIGNAL con1_signal"; +connection con1; +DROP TABLE t1; +connection default; +# +# MDEV-28122 Optimize table crash while applying online log +# +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +f3 CHAR(200), f4 CHAR(200), +f5 VARCHAR(87), PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(6000, 6000, "InnoDB", +"MariaDB", repeat('a', 87)); +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 FORCE; +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 SELECT seq, seq, "IDB", "MDB", repeat('a', 87) FROM seq_1_to_127; +INSERT INTO t1 VALUES(128, 128, "IDB", "MDB", repeat('a', 86)); +INSERT INTO t1 VALUES(129, 129, "idb", "mdb", repeat('a', 2)); +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET DEBUG_SYNC=RESET; +disconnect con1; +SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; +SET GLOBAL innodb_monitor_enable = default; +SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/r/innodb-timeout.result b/mysql-test/suite/innodb/r/innodb-timeout.result new file mode 100644 index 00000000..52ed1a6f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-timeout.result @@ -0,0 +1,119 @@ +set global innodb_lock_wait_timeout=42; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +select @@innodb_lock_wait_timeout; +@@innodb_lock_wait_timeout +42 +set innodb_lock_wait_timeout=1; +select @@innodb_lock_wait_timeout; +@@innodb_lock_wait_timeout +1 +connection b; +select @@innodb_lock_wait_timeout; +@@innodb_lock_wait_timeout +42 +set global innodb_lock_wait_timeout=347; +select @@innodb_lock_wait_timeout; +@@innodb_lock_wait_timeout +42 +set innodb_lock_wait_timeout=10; +select @@innodb_lock_wait_timeout; +@@innodb_lock_wait_timeout +10 +connect c,localhost,root,,; +connection c; +select @@innodb_lock_wait_timeout; +@@innodb_lock_wait_timeout +347 +disconnect c; +connection a; +SET @connection_b_id = ; +create table t1(a int primary key)engine=innodb; +begin; +insert into t1 values(1),(2),(3); +connection b; +select * from t1 for update; +connection a; +commit; +connection b; +a +1 +2 +3 +connection a; +begin; +insert into t1 values(4); +connection b; +set innodb_lock_wait_timeout=3; +select * from t1 for update; +connection a; +commit; +connection b; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect b; +connection a; +disconnect a; +connection default; +drop table t1; +set global innodb_lock_wait_timeout=; +# +# MDEV-11379 - AliSQL: [Feature] Issue#8: SELECT FOR UPDATE WAIT +# +CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=InnoDB; +INSERT INTO t1 (c1,c2) values (1,1),(2,2),(3,3),(4,4); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE c1=4 FOR UPDATE NOWAIT; +ERROR HY000: View's SELECT contains a '[NO]WAIT' clause +CREATE VIEW v1 AS SELECT * FROM t1 WHERE c1=4 FOR UPDATE WAIT 0; +ERROR HY000: View's SELECT contains a '[NO]WAIT' clause +CREATE PROCEDURE p1() SELECT * FROM t1 WHERE c1=4 FOR UPDATE NOWAIT; +ERROR 0A000: [NO]WAIT is not allowed in stored procedures +CREATE PROCEDURE p1() SELECT * FROM t1 WHERE c1=4 FOR UPDATE WAIT 0; +ERROR 0A000: [NO]WAIT is not allowed in stored procedures +connect con1,localhost,root,,; +LOCK TABLE t1 WRITE; +connect con2,localhost,root,,; +SELECT * FROM t1 WHERE c1=4 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE c1=4 FOR UPDATE WAIT 0; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1=4 FOR UPDATE NOWAIT'; +EXECUTE stmt; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT * FROM t1 WHERE c1=4 FOR UPDATE WAIT 0'; +EXECUTE stmt; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DEALLOCATE PREPARE stmt; +connection con1; +INSERT INTO t1 VALUES(5,5); +UNLOCK TABLES; +set AUTOCOMMIT=0; +SELECT * FROM t1 WHERE c1=4 FOR UPDATE; +connection con2; +set AUTOCOMMIT=0; +SET INNODB_LOCK_WAIT_TIMEOUT=1; +SELECT * FROM t1 WHERE c1=4 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE c1=4 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE c1=4 FOR UPDATE WAIT 0; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +UPDATE t1 SET c2=5 WHERE c1=4; +COMMIT; +set AUTOCOMMIT=0; +SELECT * FROM t1 WHERE c1=4 FOR UPDATE; +c1 c2 +4 5 +connection con2; +set AUTOCOMMIT=0; +SET INNODB_LOCK_WAIT_TIMEOUT=1; +SELECT * FROM t1 WHERE c1=4 FOR UPDATE WAIT 10; +connection con1; +COMMIT; +connection con2; +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-trim.result b/mysql-test/suite/innodb/r/innodb-trim.result new file mode 100644 index 00000000..40eac2f8 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-trim.result @@ -0,0 +1,20 @@ +set global innodb_compression_algorithm = 1; +create table innodb_page_compressed (c1 int not null primary key auto_increment, b char(200), c char(200), d char(200)) engine=innodb page_compressed=1 page_compression_level=9; +show warnings; +Level Code Message +create procedure innodb_insert_proc (repeat_count int) +begin +declare current_num int; +set current_num = 0; +while current_num < repeat_count do +insert into innodb_page_compressed values (NULL,repeat('A',150),repeat('AB',75),repeat('B', 175)); +set current_num = current_num + 1; +end while; +end// +commit; +set autocommit=0; +call innodb_insert_proc(16000); +commit; +set autocommit=1; +DROP PROCEDURE innodb_insert_proc; +DROP TABLE innodb_page_compressed; diff --git a/mysql-test/suite/innodb/r/innodb-truncate.result b/mysql-test/suite/innodb/r/innodb-truncate.result new file mode 100644 index 00000000..3bcee0e8 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-truncate.result @@ -0,0 +1,106 @@ +# +# TRUNCATE TABLE +# +# Truncating is disallowed for parent tables unless such table +# participates in self-referencing foreign keys only. +# +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE t2 (fk INT NOT NULL, FOREIGN KEY (fk) REFERENCES t1 (pk)) ENGINE=INNODB; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fk`) REFERENCES `test`.`t1` (`pk`)) +# Truncation of child should succeed. +TRUNCATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY, fk INT, +FOREIGN KEY (fk) REFERENCES t1 (pk)) ENGINE=INNODB; +# Truncation of self-referencing table should succeed. +TRUNCATE TABLE t1; +DROP TABLE t1; +# +# Also, truncating such tables is allowed if foreign key +# checks are disabled. +# +SET @old_foreign_key_checks = @@SESSION.foreign_key_checks; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE t2 (fk INT NOT NULL, FOREIGN KEY (fk) REFERENCES t1 (pk)) ENGINE=INNODB; +CREATE TABLE t3 (pk INT PRIMARY KEY, fk INT, +FOREIGN KEY (fk) REFERENCES t1 (pk)) ENGINE=INNODB; +SET @@SESSION.foreign_key_checks = 0; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +SET @@SESSION.foreign_key_checks = 1; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fk`) REFERENCES `test`.`t1` (`pk`)) +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +LOCK TABLES t1 WRITE; +SET @@SESSION.foreign_key_checks = 0; +TRUNCATE TABLE t1; +SET @@SESSION.foreign_key_checks = 1; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fk`) REFERENCES `test`.`t1` (`pk`)) +UNLOCK TABLES; +DROP TABLE t3,t2,t1; +SET @@SESSION.foreign_key_checks = @old_foreign_key_checks; +# +# Test that TRUNCATE resets auto-increment. +# +CREATE TABLE t1 (a INT PRIMARY KEY NOT NULL AUTO_INCREMENT, +b INT, c INT, d INT, e INT, f INT, g INT, h INT, i INT, j INT, k INT, +l INT, m INT, n INT, o INT, p INT, q INT, r INT, s INT, t INT, u INT, +KEY(b),KEY(c),KEY(d),KEY(e),KEY(f),KEY(g),KEY(h),KEY(i),KEY(j),KEY(k), +KEY(l),KEY(m),KEY(n),KEY(o),KEY(p),KEY(q),KEY(r),KEY(s),KEY(t),KEY(u), +KEY(c,b),KEY(d,b),KEY(e,b),KEY(f,b),KEY(g,b),KEY(h,b),KEY(i,b),KEY(j,b), +KEY(k,b),KEY(l,b),KEY(m,b),KEY(n,b),KEY(o,b),KEY(p,b),KEY(q,b),KEY(r,b), +KEY(s,b),KEY(t,b),KEY(u,b), +KEY(d,c),KEY(e,c),KEY(f,c),KEY(g,c),KEY(h,c),KEY(i,c),KEY(j,c), +KEY(k,c),KEY(l,c),KEY(m,c),KEY(n,c),KEY(o,c),KEY(p,c),KEY(q,c),KEY(r,c), +KEY(s,c),KEY(t,c),KEY(u,c), +KEY(e,d),KEY(f,d),KEY(g,d),KEY(h,d),KEY(i,d),KEY(j,d) +) ENGINE=InnoDB; +INSERT INTO t1 () VALUES (), (); +SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1'; +AUTO_INCREMENT +3 +SELECT a FROM t1 ORDER BY a; +a +1 +2 +TRUNCATE TABLE t1; +SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1'; +AUTO_INCREMENT +1 +INSERT INTO t1 () VALUES (), (); +SELECT a FROM t1 ORDER BY a; +a +1 +2 +DROP TABLE t1; +call mtr.add_suppression('InnoDB: in RENAME TABLE table `test`.`t3`'); +SET FOREIGN_KEY_CHECKS= OFF; +CREATE TABLE t1 (f2 INT, f4 INT, KEY(f2), FOREIGN KEY (f4) REFERENCES t3 (f4)) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS= ON; +CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB; +CREATE TABLE t3 (a INT) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t3` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t1 RENAME TO t3; +ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t1 FORCE; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `test`.`t1` (`f2`)) +DROP TABLE t2, t1; +# +# MDEV-24861 Assertion `trx->rsegs.m_redo.rseg' failed +# in innodb_prepare_commit_versioned +# +CREATE TABLE t1 (id INT PRIMARY KEY, f TEXT UNIQUE, +s BIGINT UNSIGNED AS ROW START, e BIGINT UNSIGNED AS ROW END, +PERIOD FOR SYSTEM_TIME(s,e)) +ENGINE=InnoDB WITH SYSTEM VERSIONING; +CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 FORCE; +TRUNCATE TABLE t2; +DROP TABLE t1, t2; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/innodb-ucs2.result b/mysql-test/suite/innodb/r/innodb-ucs2.result new file mode 100644 index 00000000..b6bff7d5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-ucs2.result @@ -0,0 +1,314 @@ +drop table if exists t1, t2; +create table t1 ( +a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +4 E880BDD0B1E880BD E880BDD0B1E880BD seven +4 E880BDE880BD E880BDE880BD six +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 05630563 05630563 email +4 0563 0563 email +4 05612020 05612020 email +4 01FC 01FC email +4 0120 0120 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 0000E400 0000E400 email +4 0000563001FC0563 0000563001FC0563 email +1 0061006200630064006500660067 0061006200630064006500660067 one +3 0071007200730074007500760077 0071007200730074007500760077 three +2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two +drop table t1; +drop table t2; +create table t1 ( +a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +4 E880BDD0B1E880BD E880BDD0B1E880BD seven +4 E880BDE880BD E880BDE880BD six +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 05630563 05630563 email +4 0563 0563 email +4 05612020 05612020 email +4 01FC 01FC email +4 0120 0120 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 0000E400 0000E400 email +4 0000563001FC0563 0000563001FC0563 email +1 0061006200630064006500660067 0061006200630064006500660067 one +3 0071007200730074007500760077 0071007200730074007500760077 three +2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two +drop table t1; +drop table t2; +create table t1 ( +a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); +insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); +insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +4 E880BDD0B1E880BD E880BDD0B1E880BD seven +4 E880BDE880BD E880BDE880BD six +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 0120 0120 email +4 01FC 01FC email +4 0563 0563 email +4 0000563001FC0563 0000563001FC0563 email +4 0000E400 0000E400 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 05612020 05612020 email +4 05630563 05630563 email +1 0061006200630064006500660067 0061006200630064006500660067 one +3 0071007200730074007500760077 0071007200730074007500760077 three +2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two +drop table t1; +drop table t2; +create table t1 ( +a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) +) character set utf8 engine = innodb; +create table t2 ( +a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) +) character set ucs2 engine = innodb; +insert into t1 values (1,'abcdefg','abcdefg','one'); +insert into t1 values (2,'ijkilmn','ijkilmn','two'); +insert into t1 values (3,'qrstuvw','qrstuvw','three'); +insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); +insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); +insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); +insert into t2 values (1,'abcdefg','abcdefg','one'); +insert into t2 values (2,'ijkilmn','ijkilmn','two'); +insert into t2 values (3,'qrstuvw','qrstuvw','three'); +insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); +insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); +insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); +insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); +insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); +insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); +insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); +update t1 set filler = 'boo' where a = 1; +update t2 set filler ='email' where a = 4; +select a,hex(b),hex(c),filler from t1 order by filler; +a hex(b) hex(c) filler +1 61626364656667 61626364656667 boo +4 D0B1 D0B1 eight +4 5B 5B five +4 E880BD E880BD four +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +select a,hex(b),hex(c),filler from t2 order by filler; +a hex(b) hex(c) filler +4 0000E400 0000E400 email +4 00640065 00640065 email +4 00E400E50068 00E400E50068 email +4 0120 0120 email +4 01FC 01FC email +4 05612020 05612020 email +4 0563 0563 email +1 61626364656667 61626364656667 one +3 71727374757677 71727374757677 three +2 696A6B696C6D6E 696A6B696C6D6E two +drop table t1; +drop table t2; +commit; +CREATE TABLE t1 ( +ind enum('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +ind enum('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; +INSERT INTO t1 VALUES ('1', ''),('2', ''); +INSERT INTO t2 VALUES ('1', ''),('2', ''); +SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; +hex(ind) hex(string1) +31 +32 +SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; +hex(ind) hex(string1) +0031 +0032 +drop table t1,t2; +CREATE TABLE t1 ( +ind set('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +ind set('0','1','2') NOT NULL default '0', +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; +INSERT INTO t1 VALUES ('1', ''),('2', ''); +INSERT INTO t2 VALUES ('1', ''),('2', ''); +SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; +hex(ind) hex(string1) +31 +32 +SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; +hex(ind) hex(string1) +0031 +0032 +drop table t1,t2; +CREATE TABLE t1 ( +ind bit not null, +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +ind bit not null, +string1 varchar(250) NOT NULL, +PRIMARY KEY (ind) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2; +insert into t1 values(0,''),(1,''); +insert into t2 values(0,''),(1,''); +select hex(ind),hex(string1) from t1 order by string1; +hex(ind) hex(string1) +0 +1 +select hex(ind),hex(string1) from t2 order by string1; +hex(ind) hex(string1) +0 +1 +drop table t1,t2; +create table t2 ( +a int, b char(10), filler char(10), primary key(a, b(2)) +) character set utf8 engine = innodb; +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t2 ( +a int, b char(10), filler char(10), primary key(a, b(2)) +) character set ucs2 engine = innodb; +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +a hex(b) +1 61626364656667 +2 6465666768696A6B +6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 +7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 +update t1 set b = 'three' where a = 6; +drop table t1; +create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +a hex(b) +1 61626364656667 +2 6465666768696A6B +6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 +7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 +update t1 set b = 'three' where a = 6; +drop table t1; +End of 5.0 tests diff --git a/mysql-test/suite/innodb/r/innodb-update-insert.result b/mysql-test/suite/innodb/r/innodb-update-insert.result new file mode 100644 index 00000000..28a61245 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-update-insert.result @@ -0,0 +1,44 @@ +# +# Bug#14668683 ASSERT REC_GET_DELETED_FLAG(REC, PAGE_IS_COMP(PAGE)) +# +create table t1(f1 char(1) primary key, f2 int not null, f3 blob) +engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` char(1) NOT NULL, + `f2` int(11) NOT NULL, + `f3` blob DEFAULT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values ('a', 0, repeat('b',8102)); +select f1 from t1; +f1 +a +update t1 set f1='A'; +select f1 from t1; +f1 +A +drop table t1; +# +# Another test case +# +create table t1 (f1 char(1), f2 longblob, f3 blob, primary key(f1)) +charset=utf8 engine=innodb; +set statement sql_mode = '' for +replace into t1 set f1=0xa3; +Warnings: +Warning 1366 Incorrect string value: '\xA3' for column `test`.`t1`.`f1` at row 1 +select f1 from t1; +f1 +? +update t1 set f1=0x6a; +update t1 set f3=repeat(0xb1,8103); +update t1 set f1=0x4a; +update ignore t1 set f1=0x82; +Warnings: +Warning 1366 Incorrect string value: '\x82' for column `test`.`t1`.`f1` at row 1 +select f1 from t1; +f1 +? +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result b/mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result new file mode 100644 index 00000000..df6bf83d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result @@ -0,0 +1,18 @@ +CREATE TABLE t1 (a INT, b INT AS (a), KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 () VALUES (),(); +connect con1,localhost,root,,test; +ALTER TABLE t1 ADD COLUMN x INT as (a), add key(x), ALGORITHM=COPY; +SET debug_sync= "ib_open_after_dict_open SIGNAL delete_open WAIT_FOR another_open"; +DELETE FROM t1; +connection default; +SET debug_sync= "now WAIT_FOR delete_open"; +SELECT a FROM t1; +a +NULL +NULL +SET debug_sync= "now SIGNAL another_open"; +connection con1; +disconnect con1; +connection default; +SET debug_sync= "RESET"; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result new file mode 100644 index 00000000..b97eaac7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result @@ -0,0 +1,353 @@ +CREATE TABLE IF NOT EXISTS gso_grad_supr ( +term char(4) NOT NULL DEFAULT '', +uw_id int(8) UNSIGNED NOT NULL DEFAULT 0, +plan varchar(10) NOT NULL DEFAULT '', +wdraw_rsn varchar(4) NOT NULL DEFAULT '', +admit_term char(4) NOT NULL DEFAULT '', +CONSTRAINT gso_grad_supr_pky PRIMARY KEY (uw_id, term) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +Warnings: +Warning 1280 Name 'gso_grad_supr_pky' ignored for PRIMARY key. +INSERT INTO `gso_grad_supr` VALUES ('1031',2,'CSM','','1009'); +INSERT INTO `gso_grad_supr` VALUES ('1035',2,'CSM','ACAD','1009'); +CREATE TABLE IF NOT EXISTS grad_degree ( +student_id int(8) UNSIGNED NOT NULL, +plan varchar(10) NOT NULL, +admit_term char(4) NOT NULL, +wdraw_rsn varchar(4) NOT NULL DEFAULT '', +ofis_deg_status varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' + ELSE 'Not Completed' + END) VIRTUAL, +deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', +deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term', +CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +Warnings: +Warning 1280 Name 'grad_degree_stu_plan_admit_pky' ignored for PRIMARY key. +SHOW CREATE TABLE grad_degree; +Table Create Table +grad_degree CREATE TABLE `grad_degree` ( + `student_id` int(8) unsigned NOT NULL, + `plan` varchar(10) NOT NULL, + `admit_term` char(4) NOT NULL, + `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL, + `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', + `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', + PRIMARY KEY (`student_id`,`plan`,`admit_term`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn); +CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term); +INSERT IGNORE grad_degree ( +student_id, +plan, +admit_term, +wdraw_rsn, +deg_start_term, +deg_as_of_term +) +SELECT +ggs.uw_id AS c_student_id, +ggs.plan, +ggs.admit_term, +ggs.wdraw_rsn, +IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term, +ggs.term AS c_as_of_term +FROM gso_grad_supr AS ggs +LEFT OUTER JOIN +grad_degree AS gd +ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term ) +WHERE +ggs.term = 1031 AND +gd.student_id IS NULL +; +UPDATE grad_degree AS gd +INNER JOIN +gso_grad_supr AS ggs +ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term ) +SET +gd.wdraw_rsn = ggs.wdraw_rsn, +gd.deg_as_of_term = 1035 +WHERE +gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND +ggs.term = 1035 +; +drop table grad_degree; +CREATE TABLE IF NOT EXISTS grad_degree ( +student_id int(8) UNSIGNED NOT NULL, +plan varchar(10) NOT NULL, +admit_term char(4) NOT NULL, +wdraw_rsn varchar(4) NOT NULL DEFAULT '', +ofis_deg_status varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' + ELSE 'Not Completed' + END) VIRTUAL, +ofis_deg_status2 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress2' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' + ELSE 'Not Completed2' + END) VIRTUAL, +ofis_deg_status3 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress3' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' + ELSE 'Not Completed3' + END) VIRTUAL, +ofis_deg_status4 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress4' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' + ELSE 'Not Completed4' + END) VIRTUAL, +ofis_deg_status5 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress5' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' + ELSE 'Not Completed5' + END) VIRTUAL, +ofis_deg_status6 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress6' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' + ELSE 'Not Completed6' + END) VIRTUAL, +ofis_deg_status7 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress7' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' + ELSE 'Not Completed7' + END) VIRTUAL, +ofis_deg_status8 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress8' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' + ELSE 'Not Completed8' + END) VIRTUAL, +deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', +deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term', +CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +Warnings: +Warning 1280 Name 'grad_degree_stu_plan_admit_pky' ignored for PRIMARY key. +SHOW CREATE TABLE grad_degree; +Table Create Table +grad_degree CREATE TABLE `grad_degree` ( + `student_id` int(8) unsigned NOT NULL, + `plan` varchar(10) NOT NULL, + `admit_term` char(4) NOT NULL, + `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL, + `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL, + `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL, + `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL, + `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL, + `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL, + `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL, + `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL, + `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', + `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', + PRIMARY KEY (`student_id`,`plan`,`admit_term`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn); +CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term); +INSERT IGNORE grad_degree ( +student_id, +plan, +admit_term, +wdraw_rsn, +deg_start_term, +deg_as_of_term +) +SELECT +ggs.uw_id AS c_student_id, +ggs.plan, +ggs.admit_term, +ggs.wdraw_rsn, +IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term, +ggs.term AS c_as_of_term +FROM gso_grad_supr AS ggs +LEFT OUTER JOIN +grad_degree AS gd +ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term ) +WHERE +ggs.term = 1031 AND +gd.student_id IS NULL +; +UPDATE grad_degree AS gd +INNER JOIN +gso_grad_supr AS ggs +ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term ) +SET +gd.wdraw_rsn = ggs.wdraw_rsn, +gd.deg_as_of_term = 1035 +WHERE +gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND +ggs.term = 1035 +; +ALTER TABLE grad_degree DROP INDEX grad_degree_wdraw_rsn_ndx; +ALTER TABLE grad_degree DROP COLUMN deg_start_term; +SHOW CREATE TABLE grad_degree; +Table Create Table +grad_degree CREATE TABLE `grad_degree` ( + `student_id` int(8) unsigned NOT NULL, + `plan` varchar(10) NOT NULL, + `admit_term` char(4) NOT NULL, + `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL, + `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL, + `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL, + `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL, + `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL, + `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL, + `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL, + `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL, + `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', + PRIMARY KEY (`student_id`,`plan`,`admit_term`), + KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +DROP TABLE grad_degree; +CREATE TABLE IF NOT EXISTS grad_degree ( +student_id int(8) UNSIGNED NOT NULL, +plan varchar(10) NOT NULL, +admit_term char(4) NOT NULL, +wdraw_rsn varchar(4) NOT NULL DEFAULT '', +ofis_deg_status varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' + ELSE 'Not Completed' + END) VIRTUAL, +ofis_deg_status2 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress2' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' + ELSE 'Not Completed2' + END) VIRTUAL, +ofis_deg_status3 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress3' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' + ELSE 'Not Completed3' + END) VIRTUAL, +ofis_deg_status4 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress4' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' + ELSE 'Not Completed4' + END) VIRTUAL, +ofis_deg_status5 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress5' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' + ELSE 'Not Completed5' + END) VIRTUAL, +ofis_deg_status6 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress6' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' + ELSE 'Not Completed6' + END) VIRTUAL, +ofis_deg_status7 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress7' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' + ELSE 'Not Completed7' + END) VIRTUAL, +ofis_deg_status8 varchar(15) AS ( +CASE +WHEN wdraw_rsn = '' THEN 'In progress8' + WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' + ELSE 'Not Completed8' + END) VIRTUAL, +deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', +deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term', +CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +Warnings: +Warning 1280 Name 'grad_degree_stu_plan_admit_pky' ignored for PRIMARY key. +SHOW CREATE TABLE grad_degree; +Table Create Table +grad_degree CREATE TABLE `grad_degree` ( + `student_id` int(8) unsigned NOT NULL, + `plan` varchar(10) NOT NULL, + `admit_term` char(4) NOT NULL, + `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', + `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL, + `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL, + `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL, + `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL, + `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL, + `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL, + `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL, + `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL, + `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', + `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', + PRIMARY KEY (`student_id`,`plan`,`admit_term`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +CREATE INDEX grad_degree_wdraw_rsn_ndx ON grad_degree (wdraw_rsn); +ALTER TABLE grad_degree DROP COLUMN ofis_deg_status2, DROP COLUMN ofis_deg_status3, +DROP COLUMN ofis_deg_status4, DROP COLUMN ofis_deg_status5, DROP COLUMN ofis_deg_status6, +DROP COLUMN ofis_deg_status7, DROP COLUMN ofis_deg_status8; +CREATE INDEX grad_degree_as_of_term_ndx ON grad_degree (deg_as_of_term); +INSERT IGNORE grad_degree ( +student_id, +plan, +admit_term, +wdraw_rsn, +deg_start_term, +deg_as_of_term +) +SELECT +ggs.uw_id AS c_student_id, +ggs.plan, +ggs.admit_term, +ggs.wdraw_rsn, +IF( (SELECT COUNT(*) FROM grad_degree AS gd WHERE gd.student_id = ggs.uw_id AND gd.admit_term = ggs.admit_term) > 0, ggs.term, ggs.admit_term ) AS c_deg_start_term, +ggs.term AS c_as_of_term +FROM gso_grad_supr AS ggs +LEFT OUTER JOIN +grad_degree AS gd +ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term ) +WHERE +ggs.term = 1031 AND +gd.student_id IS NULL +; +UPDATE grad_degree AS gd +INNER JOIN +gso_grad_supr AS ggs +ON ( gd.student_id = ggs.uw_id AND gd.plan = ggs.plan AND gd.admit_term = ggs.admit_term ) +SET +gd.wdraw_rsn = ggs.wdraw_rsn, +gd.deg_as_of_term = 1035 +WHERE +gd.wdraw_rsn NOT IN ('DCMP', 'TRDC') AND +ggs.term = 1035 +; +select * from grad_degree; +student_id plan admit_term wdraw_rsn ofis_deg_status deg_start_term deg_as_of_term +2 CSM 1009 ACAD Not Completed 1009 1035 +select * from gso_grad_supr; +term uw_id plan wdraw_rsn admit_term +1031 2 CSM 1009 +1035 2 CSM ACAD 1009 +drop table grad_degree; +drop table gso_grad_supr; +CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1,'foo'); +SELECT * FROM t1; +a b c +1 foo 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1,'foo'); +ALTER TABLE t1 ADD FULLTEXT KEY(b); +SELECT * FROM t1; +a b c +1 foo 1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns2.result b/mysql-test/suite/innodb/r/innodb-virtual-columns2.result new file mode 100644 index 00000000..57a2fe64 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns2.result @@ -0,0 +1,89 @@ +CREATE TABLE t1 ( +y YEAR NULL, +i SMALLINT NULL, +c VARCHAR(8) NOT NULL DEFAULT '', +vi SMALLINT AS (i) VIRTUAL, +INDEX(y) +) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `y` year(4) DEFAULT NULL, + `i` smallint(6) DEFAULT NULL, + `c` varchar(8) NOT NULL DEFAULT '', + `vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL, + KEY `y` (`y`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; +y i c vi +INSERT INTO t1 (i) VALUES (1),(2); +SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; +y i c vi +DROP TABLE t1; +CREATE TABLE t1 ( +y YEAR NULL, +i SMALLINT NULL, +vi SMALLINT AS (i) VIRTUAL, +INDEX(y) +) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `y` year(4) DEFAULT NULL, + `i` smallint(6) DEFAULT NULL, + `vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL, + KEY `y` (`y`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; +y i vi +INSERT INTO t1 (i) VALUES (1),(2); +SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; +y i vi +DROP TABLE t1; +CREATE TABLE t1 ( +y YEAR NULL, +i SMALLINT NULL, +b BLOB NULL, +vi SMALLINT AS (i) VIRTUAL, +INDEX(y) +) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `y` year(4) DEFAULT NULL, + `i` smallint(6) DEFAULT NULL, + `b` blob DEFAULT NULL, + `vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL, + KEY `y` (`y`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; +y i b vi +INSERT INTO t1 (i) VALUES (1),(2); +SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE; +y i b vi +DROP TABLE t1; +# +# MDEV-23632 ALTER TABLE...ADD KEY creates corrupted index on virtual column +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT, g INT GENERATED ALWAYS AS(b)VIRTUAL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,default); +ALTER TABLE t1 ADD COLUMN c INT; +ALTER TABLE t1 ADD KEY(g); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT g FROM t1 FORCE INDEX (g); +g +1 +DROP TABLE t1; +CREATE TABLE t1(a INT, b INT, g INT GENERATED ALWAYS AS(b)VIRTUAL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,default); +ALTER TABLE t1 ADD COLUMN c INT PRIMARY KEY; +ALTER TABLE t1 ADD KEY(g); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT g FROM t1 FORCE INDEX (g); +g +1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522,crc32.rdiff b/mysql-test/suite/innodb/r/innodb-wl5522,crc32.rdiff new file mode 100644 index 00000000..bb902e18 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-wl5522,crc32.rdiff @@ -0,0 +1,5 @@ +120,121c120 +< Warnings: +< Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification +--- +> ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff b/mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff new file mode 100644 index 00000000..bb902e18 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff @@ -0,0 +1,5 @@ +120,121c120 +< Warnings: +< Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification +--- +> ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-1.result b/mysql-test/suite/innodb/r/innodb-wl5522-1.result new file mode 100644 index 00000000..204d6bc8 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-wl5522-1.result @@ -0,0 +1,813 @@ +call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT."); +CREATE DATABASE testdb_wl5522; +CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb; +INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331); +SELECT c1 FROM testdb_wl5522.t1; +c1 +1 +123 +331 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +SELECT * FROM testdb_wl5522.t1 ORDER BY c1; +c1 +1 +123 +331 +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT * FROM testdb_wl5522.t1 ORDER BY c1; +c1 +1 +123 +331 +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col1 BIT(1), +col2 BOOLEAN, +col3 TINYINT, +col4 SMALLINT, +col5 MEDIUMINT, +col6 INT, +col7 BIGINT, +col8 FLOAT (14,3) , +col9 DOUBLE (14,3), +col10 VARCHAR(20), +col11 TEXT , +col12 ENUM('a','b','c'), +col13 TEXT, +col14 CHAR(20), +col15 VARBINARY (400), +col16 BINARY(40), +col17 BLOB (400), +col18 INT NOT NULL PRIMARY KEY, +col19 DATE, +col20 DATETIME, +col21 TIMESTAMP, +col22 TIME, +col23 YEAR ) ENGINE = Innodb; +CREATE INDEX idx1 ON testdb_wl5522.t1(col18); +CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10)); +CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12); +CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8); +INSERT INTO testdb_wl5522.t1 VALUES +(1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222, +-92233720368.222,'aaa', + 'aaaaaaaaaa','b','bbbbb','ccccc', +REPEAT('d',40),REPEAT('d',40),REPEAT('d',40),1,'1000-01-01', +'3000-12-31 23:59:59.99','1990-01-01 00:00:01.00', +'01:59:59.00','1901'); +INSERT INTO testdb_wl5522.t1 VALUES +(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL); +INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +ERROR 23000: Column 'col18' cannot be null +INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +FLUSH TABLES testdb_wl5522.t1 WITH READ LOCK; +SELECT COUNT(*) FROM testdb_wl5522.t1; +COUNT(*) +2 +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col1 BIT(1), +col2 BOOLEAN, +col3 TINYINT, +col4 SMALLINT, +col5 MEDIUMINT, +col6 INT, +col7 BIGINT, +col8 FLOAT (14,3) , +col9 DOUBLE (14,3), +col10 VARCHAR(20), +col11 TEXT, +col12 ENUM('a','b','c'), +col13 TEXT, +col14 CHAR(20) , +col15 VARBINARY (400) , +col16 BINARY(40), +col17 BLOB (400) , +col18 INT NOT NULL PRIMARY KEY, +col19 DATE , +col20 DATETIME , +col21 TIMESTAMP , +col22 TIME, +col23 YEAR ) ENGINE = Innodb; +CREATE INDEX idx1 ON testdb_wl5522.t1(col18); +CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10)); +CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12); +CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8); +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +CHECK TABLE testdb_wl5522.t1; +Table Op Msg_type Msg_text +testdb_wl5522.t1 check status OK +SELECT COUNT(*) FROM testdb_wl5522.t1; +COUNT(*) +2 +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_varbinary VARBINARY (4000) , +col_2_varchar VARCHAR (4000), +col_3_text TEXT (4000), +col_4_blob BLOB (4000), +col_5_text TEXT (4000), +col_6_varchar VARCHAR (4000), +col_7_binary BINARY (255) +) ROW_FORMAT=DYNAMIC ENGINE = Innodb; +INSERT INTO testdb_wl5522.t1 VALUES( +REPEAT('a', 4000),REPEAT('o', 4000),REPEAT('a', 4000), REPEAT('o', 4000), +REPEAT('a', 4000),REPEAT('a', 4000),REPEAT('a', 255)); +SELECT col_1_varbinary = REPEAT("a", 4000), +col_2_varchar = REPEAT("o", 4000) , +col_3_text = REPEAT("a", 4000) , +col_4_blob = REPEAT("o", 4000) , +col_5_text = REPEAT("a", 4000) , +col_6_varchar = REPEAT("a", 4000) , +col_7_binary = REPEAT("a", 255) +FROM testdb_wl5522.t1; +col_1_varbinary = REPEAT("a", 4000) col_2_varchar = REPEAT("o", 4000) col_3_text = REPEAT("a", 4000) col_4_blob = REPEAT("o", 4000) col_5_text = REPEAT("a", 4000) col_6_varchar = REPEAT("a", 4000) col_7_binary = REPEAT("a", 255) +1 1 1 1 1 1 1 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_varbinary VARBINARY (4000) , +col_2_varchar VARCHAR (4000), +col_3_text TEXT (4000), +col_4_blob BLOB (4000), +col_5_text TEXT (4000), +col_6_varchar VARCHAR (4000), +col_7_binary BINARY (255) +) ROW_FORMAT=DYNAMIC ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT col_1_varbinary = REPEAT("a", 4000) , +col_2_varchar = REPEAT("o", 4000) , +col_3_text = REPEAT("a", 4000) , +col_4_blob = REPEAT("o", 4000) , +col_5_text = REPEAT("a", 4000) , +col_6_varchar = REPEAT("a", 4000) , +col_7_binary = REPEAT("a", 255) +FROM testdb_wl5522.t1; +col_1_varbinary = REPEAT("a", 4000) col_2_varchar = REPEAT("o", 4000) col_3_text = REPEAT("a", 4000) col_4_blob = REPEAT("o", 4000) col_5_text = REPEAT("a", 4000) col_6_varchar = REPEAT("a", 4000) col_7_binary = REPEAT("a", 255) +1 1 1 1 1 1 1 +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_int INT AUTO_INCREMENT, +col_2_varchar VARCHAR (20), +PRIMARY KEY (col_1_int)) ENGINE = Innodb; +INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3'); +INSERT INTO testdb_wl5522.t1 (col_2_varchar) VALUES ('a4'),('a5'),('a6'); +SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +4 a4 +5 a5 +6 a6 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_int INT AUTO_INCREMENT, +col_2_varchar VARCHAR (20), +PRIMARY KEY (col_1_int)) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +4 a4 +5 a5 +6 a6 +INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO testdb_wl5522.t1(col_2_varchar) VALUES ('a101'),('a102'),('a103'); +SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +4 a4 +5 a5 +6 a6 +7 a101 +8 a102 +9 a103 +ALTER TABLE testdb_wl5522.t1 MODIFY col_1_int BIGINT; +SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +4 a4 +5 a5 +6 a6 +7 a101 +8 a102 +9 a103 +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_int INT,col_2_varchar VARCHAR (20), +PRIMARY KEY (col_2_varchar)) ENGINE = Innodb; +CREATE TABLE testdb_wl5522.t1_fk ( +col_1_int INT,col_2_varchar VARCHAR (20), +PRIMARY KEY (col_1_int), +FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar) +) ENGINE = Innodb; +INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3'),(4,'a4'),(5,'a5'); +INSERT INTO testdb_wl5522.t1_fk VALUES (1,'a1'),(2,'a2'),(3,'a3'); +SELECT * FROM testdb_wl5522.t1; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +4 a4 +5 a5 +SELECT * FROM testdb_wl5522.t1_fk; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +FLUSH TABLES testdb_wl5522.t1,testdb_wl5522.t1_fk FOR EXPORT; +backup: t1 +backup: t1_fk +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1_fk,testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_int INT,col_2_varchar VARCHAR (20), +PRIMARY KEY (col_2_varchar)) ENGINE = Innodb; +CREATE TABLE testdb_wl5522.t1_fk ( +col_1_int INT,col_2_varchar VARCHAR (20), +PRIMARY KEY (col_1_int), +FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar) +) ENGINE = Innodb; +SET foreign_key_checks = 0; +ALTER TABLE testdb_wl5522.t1_fk DISCARD TABLESPACE; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +SET foreign_key_checks = 1; +restore: t1 .ibd and .cfg files +restore: t1_fk .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE testdb_wl5522.t1_fk IMPORT TABLESPACE; +SELECT * FROM testdb_wl5522.t1; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +4 a4 +5 a5 +SELECT * FROM testdb_wl5522.t1_fk; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +INSERT INTO testdb_wl5522.t1_fk VALUES (100,'a100'); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`testdb_wl5522`.`t1_fk`, CONSTRAINT `t1_fk_ibfk_1` FOREIGN KEY (`col_2_varchar`) REFERENCES `t1` (`col_2_varchar`)) +SET AUTOCOMMIT = 0; +INSERT INTO testdb_wl5522.t1_fk VALUES (4,'a4'),(5,'a5'); +ROLLBACK; +SELECT * FROM testdb_wl5522.t1_fk; +col_1_int col_2_varchar +1 a1 +2 a2 +3 a3 +DROP TABLE testdb_wl5522.t1_fk,testdb_wl5522.t1; +SET AUTOCOMMIT = 1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_int int,col_2_varchar VARCHAR (20), +PRIMARY KEY (col_2_varchar)) ENGINE = Innodb; +SET AUTOCOMMIT = 0; +INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'); +SELECT * FROM testdb_wl5522.t1; +col_1_int col_2_varchar +1 a1 +2 a2 +COMMIT; +INSERT INTO testdb_wl5522.t1 VALUES (3,'a3'),(4,'a4'); +ROLLBACK; +INSERT INTO testdb_wl5522.t1 VALUES (5,'a5'),(6,'a6'); +COMMIT; +SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int; +col_1_int col_2_varchar +1 a1 +2 a2 +5 a5 +6 a6 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( +col_1_int int,col_2_varchar VARCHAR (20), +PRIMARY KEY (col_2_varchar)) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +SET AUTOCOMMIT = 0; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +INSERT INTO testdb_wl5522.t1 VALUES (7,'a7'),(8,'a8'); +COMMIT; +INSERT INTO testdb_wl5522.t1 VALUES (9,'a9'),(10,'a10'); +ROLLBACK; +INSERT INTO testdb_wl5522.t1 VALUES (11,'a11'),(12,'a12'); +COMMIT; +SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int; +col_1_int col_2_varchar +1 a1 +2 a2 +5 a5 +6 a6 +7 a7 +8 a8 +11 a11 +12 a12 +SET AUTOCOMMIT = 1; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb; +INSERT INTO testdb_wl5522.t1 VALUES (100),(200),(300); +SELECT * FROM testdb_wl5522.t1 ORDER BY i; +i +100 +200 +300 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT * FROM testdb_wl5522.t1 ORDER BY i; +i +100 +200 +300 +SET AUTOCOMMIT = 0; +INSERT INTO testdb_wl5522.t1 VALUES (101),(102),(103); +COMMIT; +SELECT * FROM testdb_wl5522.t1 ORDER BY i; +i +100 +101 +102 +103 +200 +300 +SET AUTOCOMMIT = 1; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb; +INSERT INTO testdb_wl5522.t1 VALUES (100),(200),(300); +SELECT * FROM testdb_wl5522.t1 ORDER BY i; +i +100 +200 +300 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( i bigint) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Column i precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +ERROR HY000: Tablespace for table 'testdb_wl5522/t1' exists. Please DISCARD the tablespace before IMPORT +SELECT * FROM testdb_wl5522.t1 ORDER BY i; +i +100 +200 +300 +SET AUTOCOMMIT = 0; +INSERT INTO testdb_wl5522.t1 VALUES (101),(102),(103); +COMMIT; +SELECT * FROM testdb_wl5522.t1 ORDER BY i; +i +100 +101 +102 +103 +200 +300 +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 (i int) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +DROP TABLE testdb_wl5522.t1; +SET AUTOCOMMIT = 1; +CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb; +SET AUTOCOMMIT = 0; +INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331); +SELECT c1 FROM testdb_wl5522.t1; +c1 +1 +123 +331 +ROLLBACK; +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb; +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT * FROM testdb_wl5522.t1 ORDER BY c1; +c1 +DROP TABLE testdb_wl5522.t1; +SET AUTOCOMMIT = 1; +CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) , +col_2 VARCHAR (255), col_3 VARCHAR (255), +col_4 VARCHAR (255),col_5 VARCHAR (255), +col_6 text (255), col_7 text (255), +col_8 text (255),col_9 text (255), +col_10 BLOB (255),col_11 BLOB (255), +col_12 BLOB (255), col_13 BLOB (255), +col_14 BLOB (255) , col_15 int ) ENGINE = innodb; +CREATE INDEX prefix_idx ON testdb_wl5522.t1( +col_1 (50),col_2 (50),col_3 (50), +col_4 (50),col_5 (50),col_6 (50), +col_7 (50),col_8 (50),col_9 (50), +col_10 (50),col_11 (50),col_12 (50), +col_13(50)); +INSERT INTO testdb_wl5522.t1 VALUES ( +REPEAT("col1_00001",10),REPEAT("col2_00001",10),REPEAT("col3_00001",10), +REPEAT("col4_00001",10),REPEAT("col5_00001",10),REPEAT("col6_00001",10), +REPEAT("col7_00001",10),REPEAT("col8_00001",10),REPEAT("col9_00001",10), +REPEAT("col10_00001",10),REPEAT("col11_00001",10),REPEAT("col12_00001",10), +REPEAT("col13_00001",10),REPEAT("col14_00001",10),1); +SELECT +col_1 = REPEAT("col1_00001",10), +col_2 = REPEAT("col2_00001",10), +col_3 = REPEAT("col3_00001",10), +col_4 = REPEAT("col4_00001",10), +col_5 = REPEAT("col5_00001",10), +col_6 = REPEAT("col6_00001",10), +col_7 = REPEAT("col7_00001",10), +col_8 = REPEAT("col8_00001",10), +col_9 = REPEAT("col9_00001",10), +col_10 = REPEAT("col10_00001",10), +col_11 = REPEAT("col11_00001",10), +col_12 = REPEAT("col12_00001",10), +col_13 = REPEAT("col13_00001",10), +col_14 = REPEAT("col14_00001",10), +col_15 +FROM testdb_wl5522.t1; +col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) , +col_2 VARCHAR (255), col_3 VARCHAR (255), +col_4 VARCHAR (255),col_5 VARCHAR (255), +col_6 text (255), col_7 text (255), +col_8 text (255),col_9 text (255), +col_10 BLOB (255),col_11 BLOB (255), +col_12 BLOB (255), col_13 BLOB (255), +col_14 BLOB (255) , col_15 int ) ENGINE = innodb; +CREATE INDEX prefix_idx ON testdb_wl5522.t1( +col_1 (50),col_2 (50),col_3 (50), +col_4 (50),col_5 (50),col_6 (50), +col_7 (50),col_8 (50),col_9 (50), +col_10 (50),col_11 (50),col_12 (50), +col_13(50)); +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT +col_1 = REPEAT("col1_00001",10), +col_2 = REPEAT("col2_00001",10), +col_3 = REPEAT("col3_00001",10), +col_4 = REPEAT("col4_00001",10), +col_5 = REPEAT("col5_00001",10), +col_6 = REPEAT("col6_00001",10), +col_7 = REPEAT("col7_00001",10), +col_8 = REPEAT("col8_00001",10), +col_9 = REPEAT("col9_00001",10), +col_10 = REPEAT("col10_00001",10), +col_11 = REPEAT("col11_00001",10), +col_12 = REPEAT("col12_00001",10), +col_13 = REPEAT("col13_00001",10), +col_14 = REPEAT("col14_00001",10), +col_15 +FROM testdb_wl5522.t1; +col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) , +col_2 VARCHAR (255), col_3 VARCHAR (255), +col_4 VARCHAR (255),col_5 VARCHAR (255), +col_6 text (255), col_7 text (255), +col_8 text (255),col_9 text (255), +col_10 BLOB (255),col_11 BLOB (255), +col_12 BLOB (255), col_13 BLOB (255), +col_14 BLOB (255) , col_15 int ) ENGINE = innodb; +CREATE INDEX idx1 ON testdb_wl5522.t1(col_1); +CREATE INDEX idx2 ON testdb_wl5522.t1(col_2); +CREATE INDEX idx3 ON testdb_wl5522.t1(col_3); +CREATE INDEX idx4 ON testdb_wl5522.t1(col_4); +CREATE INDEX idx5 ON testdb_wl5522.t1(col_5); +CREATE INDEX idx6 ON testdb_wl5522.t1(col_6(255)); +CREATE INDEX idx7 ON testdb_wl5522.t1(col_7(255)); +CREATE INDEX idx8 ON testdb_wl5522.t1(col_8(255)); +CREATE INDEX idx9 ON testdb_wl5522.t1(col_9(255)); +CREATE INDEX idx10 ON testdb_wl5522.t1(col_10(255)); +CREATE INDEX idx11 ON testdb_wl5522.t1(col_11(255)); +CREATE INDEX idx12 ON testdb_wl5522.t1(col_12(255)); +CREATE INDEX idx13 ON testdb_wl5522.t1(col_13(255)); +CREATE INDEX idx14 ON testdb_wl5522.t1(col_14(255)); +INSERT INTO testdb_wl5522.t1 VALUES ( +REPEAT("col1_00001",10),REPEAT("col2_00001",10),REPEAT("col3_00001",10), +REPEAT("col4_00001",10),REPEAT("col5_00001",10),REPEAT("col6_00001",10), +REPEAT("col7_00001",10),REPEAT("col8_00001",10),REPEAT("col9_00001",10), +REPEAT("col10_00001",10),REPEAT("col11_00001",10),REPEAT("col12_00001",10), +REPEAT("col13_00001",10),REPEAT("col14_00001",10),1); +SELECT +col_1 = REPEAT("col1_00001",10), +col_2 = REPEAT("col2_00001",10), +col_3 = REPEAT("col3_00001",10), +col_4 = REPEAT("col4_00001",10), +col_5 = REPEAT("col5_00001",10), +col_6 = REPEAT("col6_00001",10), +col_7 = REPEAT("col7_00001",10), +col_8 = REPEAT("col8_00001",10), +col_9 = REPEAT("col9_00001",10), +col_10 = REPEAT("col10_00001",10), +col_11 = REPEAT("col11_00001",10), +col_12 = REPEAT("col12_00001",10), +col_13 = REPEAT("col13_00001",10), +col_14 = REPEAT("col14_00001",10), +col_15 +FROM testdb_wl5522.t1; +col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) , +col_2 VARCHAR (255), col_3 VARCHAR (255), +col_4 VARCHAR (255),col_5 VARCHAR (255), +col_6 text (255), col_7 text (255), +col_8 text (255),col_9 text (255), +col_10 BLOB (255),col_11 BLOB (255), +col_12 BLOB (255), col_13 BLOB (255), +col_14 BLOB (255) , col_15 int ) ENGINE = innodb; +CREATE INDEX idx1 ON testdb_wl5522.t1(col_1); +CREATE INDEX idx2 ON testdb_wl5522.t1(col_2); +CREATE INDEX idx3 ON testdb_wl5522.t1(col_3); +CREATE INDEX idx4 ON testdb_wl5522.t1(col_4); +CREATE INDEX idx5 ON testdb_wl5522.t1(col_5); +CREATE INDEX idx6 ON testdb_wl5522.t1(col_6(255)); +CREATE INDEX idx7 ON testdb_wl5522.t1(col_7(255)); +CREATE INDEX idx8 ON testdb_wl5522.t1(col_8(255)); +CREATE INDEX idx9 ON testdb_wl5522.t1(col_9(255)); +CREATE INDEX idx10 ON testdb_wl5522.t1(col_10(255)); +CREATE INDEX idx11 ON testdb_wl5522.t1(col_11(255)); +CREATE INDEX idx12 ON testdb_wl5522.t1(col_12(255)); +CREATE INDEX idx13 ON testdb_wl5522.t1(col_13(255)); +CREATE INDEX idx14 ON testdb_wl5522.t1(col_14(255)); +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT +col_1 = REPEAT("col1_00001",10), +col_2 = REPEAT("col2_00001",10), +col_3 = REPEAT("col3_00001",10), +col_4 = REPEAT("col4_00001",10), +col_5 = REPEAT("col5_00001",10), +col_6 = REPEAT("col6_00001",10), +col_7 = REPEAT("col7_00001",10), +col_8 = REPEAT("col8_00001",10), +col_9 = REPEAT("col9_00001",10), +col_10 = REPEAT("col10_00001",10), +col_11 = REPEAT("col11_00001",10), +col_12 = REPEAT("col12_00001",10), +col_13 = REPEAT("col13_00001",10), +col_14 = REPEAT("col14_00001",10), +col_15 +FROM testdb_wl5522.t1; +col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +SET AUTOCOMMIT = 0; +INSERT INTO testdb_wl5522.t1(col_15) VALUES (15000),(16000); +SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000; +col_15 +15000 +16000 +ROLLBACK; +SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000; +col_15 +INSERT INTO testdb_wl5522.t1(col_15) VALUES (15000),(16000); +COMMIT; +SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000; +col_15 +15000 +16000 +ALTER TABLE testdb_wl5522.t1 DROP INDEX idx1; +ALTER TABLE testdb_wl5522.t1 DROP INDEX idx6; +ALTER TABLE testdb_wl5522.t1 DROP INDEX idx10; +SELECT +col_1 = REPEAT("col1_00001",10), +col_2 = REPEAT("col2_00001",10), +col_3 = REPEAT("col3_00001",10), +col_4 = REPEAT("col4_00001",10), +col_5 = REPEAT("col5_00001",10), +col_6 = REPEAT("col6_00001",10), +col_7 = REPEAT("col7_00001",10), +col_8 = REPEAT("col8_00001",10), +col_9 = REPEAT("col9_00001",10), +col_10 = REPEAT("col10_00001",10), +col_11 = REPEAT("col11_00001",10), +col_12 = REPEAT("col12_00001",10), +col_13 = REPEAT("col13_00001",10), +col_14 = REPEAT("col14_00001",10), +col_15 +FROM testdb_wl5522.t1; +col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 15000 +NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 16000 +ALTER TABLE testdb_wl5522.t1 ADD INDEX idx1 (col_1); +ALTER TABLE testdb_wl5522.t1 ADD INDEX idx6 (col_1(255)); +ALTER TABLE testdb_wl5522.t1 ADD INDEX idx10 (col_10(255)); +SELECT +col_1 = REPEAT("col1_00001",10), +col_2 = REPEAT("col2_00001",10), +col_3 = REPEAT("col3_00001",10), +col_4 = REPEAT("col4_00001",10), +col_5 = REPEAT("col5_00001",10), +col_6 = REPEAT("col6_00001",10), +col_7 = REPEAT("col7_00001",10), +col_8 = REPEAT("col8_00001",10), +col_9 = REPEAT("col9_00001",10), +col_10 = REPEAT("col10_00001",10), +col_11 = REPEAT("col11_00001",10), +col_12 = REPEAT("col12_00001",10), +col_13 = REPEAT("col13_00001",10), +col_14 = REPEAT("col14_00001",10), +col_15 +FROM testdb_wl5522.t1; +col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 15000 +NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 16000 +DROP TABLE testdb_wl5522.t1; +SET AUTOCOMMIT = 1; +CREATE TABLE testdb_wl5522.t1(col1 bit(1) , +col2 boolean,col3 tinyint , col4 smallint , +col5 mediumint ,col6 int , col7 bigint , +col8 float (14,3) ,col9 double (14,3), +col10 VARCHAR(20) CHARACTER SET utf8 , +col11 TEXT CHARACTER SET binary , +col12 ENUM('a','b','c') CHARACTER SET binary, +col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs , +col14 CHAR(20) , col15 VARBINARY (400), +col16 BINARY(40), col17 BLOB (400), +col18 int not null primary key, +col19 DATE ,col20 DATETIME , col21 TIMESTAMP , +col22 TIME , col23 YEAR ) ENGINE = Innodb; +CREATE TABLE testdb_wl5522.trigger_table ( i int ) ENGINE = Innodb; +CREATE TRIGGER testdb_wl5522.tri AFTER INSERT ON testdb_wl5522.t1 +FOR EACH ROW INSERT INTO testdb_wl5522.trigger_table VALUES(NEW.col18); +CREATE OR REPLACE VIEW testdb_wl5522.VW1 AS SELECT * FROM testdb_wl5522.t1; +CREATE INDEX idx1 ON testdb_wl5522.t1(col18); +CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10)); +CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12); +CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8); +INSERT INTO testdb_wl5522.t1 VALUES ( +1,1,-128,32767,-8388608,2147483647,-9223372036854775808,92233720368.222, +-92233720368.222,'aaa','aaaaaaaaaa','b','bbbbb','ccccc',REPEAT('d',40), +REPEAT('d',40),REPEAT('d',40),1,'1000-01-01','3000-12-31 23:59:59.99', +'1990-01-01 00:00:01.00','01:59:59.00','1901'); +INSERT INTO testdb_wl5522.t1 VALUES ( +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,3,NULL,NULL,NULL,NULL,NULL); +INSERT INTO testdb_wl5522.t1 VALUES ( +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +ERROR 23000: Column 'col18' cannot be null +INSERT INTO testdb_wl5522.t1 VALUES ( +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,1,NULL,NULL,NULL,NULL,NULL); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT COUNT(*) FROM testdb_wl5522.t1; +COUNT(*) +2 +SELECT * FROM testdb_wl5522.trigger_table; +i +1 +3 +SELECT COUNT(*) FROM testdb_wl5522.VW1; +COUNT(*) +2 +FLUSH TABLES testdb_wl5522.t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE testdb_wl5522.t1; +CREATE TABLE testdb_wl5522.t1(col1 bit(1) , +col2 boolean,col3 tinyint , col4 smallint , +col5 mediumint ,col6 int , col7 bigint , +col8 float (14,3) ,col9 double (14,3), +col10 VARCHAR(20) CHARACTER SET utf8 , +col11 TEXT CHARACTER SET binary , +col12 ENUM('a','b','c') CHARACTER SET binary, +col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs , +col14 CHAR(20) , col15 VARBINARY (400), +col16 BINARY(40), col17 BLOB (400), +col18 int not null primary key, +col19 DATE ,col20 DATETIME , col21 TIMESTAMP , +col22 TIME , col23 YEAR ) ENGINE = Innodb; +CREATE INDEX idx1 ON testdb_wl5522.t1(col18); +CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10)); +CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12); +CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8); +ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; +SELECT COUNT(*) FROM testdb_wl5522.t1; +COUNT(*) +2 +SELECT * FROM testdb_wl5522.trigger_table; +i +1 +3 +SELECT COUNT(*) FROM testdb_wl5522.VW1; +COUNT(*) +2 +INSERT INTO testdb_wl5522.t1(col18) VALUES (5); +SELECT * FROM testdb_wl5522.trigger_table; +i +1 +3 +UPDATE testdb_wl5522.t1 SET col18=10 WHERE col18=1; +SELECT COUNT(*) FROM testdb_wl5522.VW1; +COUNT(*) +3 +SELECT COUNT(*) FROM testdb_wl5522.t1 WHERE col18=10; +COUNT(*) +1 +ALTER TABLE testdb_wl5522.t1 ADD COLUMN col24 varbinary(40) default null; +INSERT INTO testdb_wl5522.t1(col18,col24) VALUES (6,REPEAT('a',10)); +SELECT col24,col18 FROM testdb_wl5522.t1 WHERE col18 in (6,1,10) ORDER BY col18; +col24 col18 +aaaaaaaaaa 6 +NULL 10 +ALTER TABLE testdb_wl5522.t1 DROP INDEX prefix_idx; +SELECT col18,col14 FROM testdb_wl5522.t1 WHERE col14 like '_ccc%'; +col18 col14 +10 ccccc +ALTER TABLE testdb_wl5522.t1 ADD INDEX prefix_idx (col24(10)); +SELECT col18,col24 FROM testdb_wl5522.t1 WHERE col24 like '_a_a%'; +col18 col24 +6 aaaaaaaaaa +DROP TABLE testdb_wl5522.t1; +DROP DATABASE testdb_wl5522; +call mtr.add_suppression("Got error -1 when reading table '.*'"); +call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*"); +call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); +# +# MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +# +# +CREATE TABLE `t1` (`i` int(11) NOT NULL, PRIMARY KEY (`i`) ) ENGINE=InnoDB; +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; +call mtr.add_suppression("InnoDB: unsupported MySQL tablespace"); +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR 42000: Table 't1' uses an extension that doesn't exist in this MariaDB version +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result new file mode 100644 index 00000000..e7af2d94 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -0,0 +1,946 @@ +call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation."); +call mtr.add_suppression("InnoDB: Error number \\d+ means"); +call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: .*"); +call mtr.add_suppression("InnoDB: Ignoring tablespace .* because it could not be opened."); +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); +call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*"); +call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); +call mtr.add_suppression("InnoDB: Page for tablespace "); +call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); +call mtr.add_suppression("InnoDB: Unknown index id .* on page"); +call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page"); +call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted"); +FLUSH TABLES; +SET GLOBAL innodb_file_per_table = 1; +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES(1),(2),(3); +SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; +ALTER TABLE t1 DISCARD TABLESPACE; +ERROR HY000: Lost connection to server during query +DROP TABLE t1; +SET GLOBAL innodb_file_per_table = 1; +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES(1),(2),(3); +SET SESSION debug_dbug="+d,ib_discard_after_commit_crash"; +ALTER TABLE t1 DISCARD TABLESPACE; +ERROR HY000: Lost connection to server during query +DROP TABLE t1; +SET GLOBAL innodb_file_per_table = 1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1), (2), (3), (4); +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Lost connection to server during query +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Lost connection to server during query +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +SET @file_per_table= @@innodb_file_per_table; +SET GLOBAL innodb_file_per_table = 1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +INSERT INTO t1 VALUES(400), (500), (600); +SELECT * FROM t1; +c1 +1 +2 +3 +4 +400 +500 +600 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,ib_export_io_write_failure_1"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_2"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_3"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_4"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_5"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_6"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_7"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_8"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_9"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_10"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_11"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +SET SESSION debug_dbug="+d,ib_export_io_write_failure_12"; +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed +Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +UNLOCK TABLES; +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (100), (200), (300); +SELECT COUNT(*) FROM t1; +COUNT(*) +3 +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_1"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading index fields. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_2"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading index meta-data, expected to read 44 bytes but read only 0 bytes +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_3"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading number of indexes. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_4"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading table column meta-data. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_5"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading meta-data export hostname length. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_6"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading meta-data table name length. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_7"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading autoinc value. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_8"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading meta-data header. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_io_read_error_9"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while reading meta-data version. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +SET SESSION debug_dbug="+d,ib_import_string_read_error"; +restore: t1 .cfg file +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: IO Read error: while parsing export hostname. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_1"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_2"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_4"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_5"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_6"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_7"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_8"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_9"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_OOM_10"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_internal_error"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: While updating the of index GEN_CLUST_INDEX - Generic error +SET SESSION debug_dbug=@saved_debug_dbug; +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Error importing tablespace for table `test`.`t1` : Too many concurrent transactions +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug=@saved_debug_dbug; +SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 42 'Tablespace not found' from ./test/t1.ibd +SET SESSION debug_dbug=@saved_debug_dbug; +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +SET SESSION debug_dbug=@saved_debug_dbug; +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +SET SESSION debug_dbug=@saved_debug_dbug; +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_cluster_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +SET SESSION debug_dbug=@saved_debug_dbug; +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +SET SESSION debug_dbug=@saved_debug_dbug; +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +DROP TABLE t1; +CREATE TABLE t1 ( +c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 BIGINT, +c3 VARCHAR(2048), +c4 VARCHAR(2048), +INDEX idx1(c2), +INDEX idx2(c3(512)), +INDEX idx3(c4(512))) Engine=InnoDB; +connect purge_control,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +INSERT INTO t1 +SELECT 1 + seq, 1 + (seq MOD 4), +REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048), +REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048) +FROM seq_0_to_127; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c3 = REPEAT("c2", 1024); +UPDATE t1 SET c4 = REPEAT("c4", 1024); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL AUTO_INCREMENT, + `c2` bigint(20) DEFAULT NULL, + `c3` varchar(2048) DEFAULT NULL, + `c4` varchar(2048) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx1` (`c2`), + KEY `idx2` (`c3`(512)), + KEY `idx3` (`c4`(512)) +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT c1, c2 FROM t1; +c1 c2 +1 16 +2 32 +3 48 +4 64 +5 76 +6 92 +7 108 +8 124 +9 136 +10 152 +11 168 +12 184 +13 196 +14 212 +15 228 +16 244 +17 256 +18 272 +19 288 +20 304 +21 316 +22 332 +23 348 +24 364 +25 376 +26 392 +27 408 +28 424 +29 436 +30 452 +31 468 +32 484 +33 496 +34 512 +35 528 +36 544 +37 556 +38 572 +39 588 +40 604 +41 616 +42 632 +43 648 +44 664 +45 676 +46 692 +47 708 +48 724 +49 736 +50 752 +51 768 +52 784 +53 796 +54 812 +55 828 +56 844 +57 856 +58 872 +59 888 +60 904 +61 916 +62 932 +63 948 +64 964 +65 976 +66 992 +67 1008 +68 1024 +69 1036 +70 1052 +71 1068 +72 1084 +73 1096 +74 1112 +75 1128 +76 1144 +77 1156 +78 1172 +79 1188 +80 1204 +81 1216 +82 1232 +83 1248 +84 1264 +85 1276 +86 1292 +87 1308 +88 1324 +89 1336 +90 1352 +91 1368 +92 1384 +93 1396 +94 1412 +95 1428 +96 1444 +97 1456 +98 1472 +99 1488 +100 1504 +101 1516 +102 1532 +103 1548 +104 1564 +105 1576 +106 1592 +107 1608 +108 1624 +109 1636 +110 1652 +111 1668 +112 1684 +113 1696 +114 1712 +115 1728 +116 1744 +117 1756 +118 1772 +119 1788 +120 1804 +121 1816 +122 1832 +123 1848 +124 1864 +125 1876 +126 1892 +127 1908 +128 1924 +SELECT COUNT(*) FROM t1; +COUNT(*) +128 +SELECT SUM(c2) FROM t1; +SUM(c2) +124160 +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +connection purge_control; +COMMIT; +disconnect purge_control; +connection default; +DROP TABLE t1; +CREATE TABLE t1 ( +c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 BIGINT, +c3 VARCHAR(2048), +c4 VARCHAR(2048), +INDEX idx1(c2), +INDEX idx2(c3(512)), +INDEX idx3(c4(512))) Engine=InnoDB; +SELECT c1, c2 FROM t1; +c1 c2 +ALTER TABLE t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT c1,c2 FROM t1; +c1 c2 +1 16 +2 32 +3 48 +4 64 +5 76 +6 92 +7 108 +8 124 +9 136 +10 152 +11 168 +12 184 +13 196 +14 212 +15 228 +16 244 +17 256 +18 272 +19 288 +20 304 +21 316 +22 332 +23 348 +24 364 +25 376 +26 392 +27 408 +28 424 +29 436 +30 452 +31 468 +32 484 +33 496 +34 512 +35 528 +36 544 +37 556 +38 572 +39 588 +40 604 +41 616 +42 632 +43 648 +44 664 +45 676 +46 692 +47 708 +48 724 +49 736 +50 752 +51 768 +52 784 +53 796 +54 812 +55 828 +56 844 +57 856 +58 872 +59 888 +60 904 +61 916 +62 932 +63 948 +64 964 +65 976 +66 992 +67 1008 +68 1024 +69 1036 +70 1052 +71 1068 +72 1084 +73 1096 +74 1112 +75 1128 +76 1144 +77 1156 +78 1172 +79 1188 +80 1204 +81 1216 +82 1232 +83 1248 +84 1264 +85 1276 +86 1292 +87 1308 +88 1324 +89 1336 +90 1352 +91 1368 +92 1384 +93 1396 +94 1412 +95 1428 +96 1444 +97 1456 +98 1472 +99 1488 +100 1504 +101 1516 +102 1532 +103 1548 +104 1564 +105 1576 +106 1592 +107 1608 +108 1624 +109 1636 +110 1652 +111 1668 +112 1684 +113 1696 +114 1712 +115 1728 +116 1744 +117 1756 +118 1772 +119 1788 +120 1804 +121 1816 +122 1832 +123 1848 +124 1864 +125 1876 +126 1892 +127 1908 +128 1924 +SELECT COUNT(*) FROM t1; +COUNT(*) +128 +SELECT SUM(c2) FROM t1; +SUM(c2) +124160 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL AUTO_INCREMENT, + `c2` bigint(20) DEFAULT NULL, + `c3` varchar(2048) DEFAULT NULL, + `c4` varchar(2048) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx1` (`c2`), + KEY `idx2` (`c3`(512)), + KEY `idx3` (`c4`(512)) +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +INSERT IGNORE INTO t1 VALUES +(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731)); +Warnings: +Warning 1265 Data truncated for column 'c2' at row 1 +INSERT INTO t1 +SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200) +FROM seq_1_to_256; +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Error importing tablespace for table `test`.`t1` : Data structure corruption +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index GEN_CLUST_INDEX +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; +ALTER TABLE t1 ADD INDEX idx(c1); +ERROR HY000: The table 't1' is full +SET SESSION debug_dbug=@saved_debug_dbug; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +ALTER TABLE t1 ADD INDEX idx(c1); +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,fil_space_create_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 11 'Generic error' from ./test/t1.ibd +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 37 'Data structure corruption' from ./test/t1.ibd +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +unlink: t1.ibd +unlink: t1.cfg +SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result new file mode 100644 index 00000000..6baa5df9 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-wl5522.result @@ -0,0 +1,959 @@ +call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\."); +call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); +call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing"); +FLUSH TABLES; +CREATE TABLE t1 +(a INT AUTO_INCREMENT PRIMARY KEY, +b char(22), +c varchar(255), +KEY (b)) +ENGINE = InnoDB; +CREATE TEMPORARY TABLE t (b char(22),c varchar(255)); +INSERT INTO t VALUES +('Apa', 'Filler........'), +('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'), +('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg'); +INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128; +DROP TEMPORARY TABLE t; +SELECT COUNT(*) FROM t1; +COUNT(*) +640 +SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; +a b c +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ +SELECT * FROM t1 ORDER BY a DESC LIMIT 3; +a b c +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf +CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +db.opt +t1.frm +t1.ibd +t2.frm +t2.ibd +# restart +FLUSH TABLE t1, t2 FOR EXPORT; +# List before copying files +db.opt +t1.cfg +t1.frm +t1.ibd +t2.cfg +t2.frm +t2.ibd +UNLOCK TABLES; +INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; +SELECT COUNT(*) FROM t1; +COUNT(*) +1280 +SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; +a b c +1276 Apa Filler........ +1271 Apa Filler........ +1266 Apa Filler........ +SELECT * FROM t1 ORDER BY a DESC LIMIT 3; +a b c +1280 Evolution lsjndofiabsoibeg +1279 Devotion asdfuihknaskdf +1278 Cavalry ..asdasdfaeraf +# Restarting server +# restart +# Done restarting server +# List before t1 DISCARD +db.opt +t1.cfg.sav +t1.frm +t1.ibd +t1.ibd.sav +t2.cfg.sav +t2.frm +t2.ibd +t2.ibd.sav +ALTER TABLE t1 DISCARD TABLESPACE; +# List after t1 DISCARD +db.opt +t1.cfg.sav +t1.frm +t1.ibd.sav +t2.cfg.sav +t2.frm +t2.ibd +t2.ibd.sav +ALTER TABLE t1 IMPORT TABLESPACE; +ALTER TABLE t1 ENGINE InnoDB; +SELECT COUNT(*) FROM t1; +COUNT(*) +640 +SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; +a b c +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ +SELECT * FROM t1 ORDER BY a DESC LIMIT 3; +a b c +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf +db.opt +t1.cfg +t1.cfg.sav +t1.frm +t1.ibd +t1.ibd.sav +t2.cfg.sav +t2.frm +t2.ibd +t2.ibd.sav +SELECT COUNT(*) FROM t1; +COUNT(*) +640 +SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; +a b c +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ +SELECT * FROM t1 ORDER BY a DESC LIMIT 3; +a b c +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf +DROP TABLE t1; +ALTER TABLE t2 ROW_FORMAT=DYNAMIC; +ALTER TABLE t2 DISCARD TABLESPACE; +# List after t2 DISCARD +db.opt +t2.cfg.sav +t2.frm +t2.ibd.sav +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT) +ALTER TABLE t2 IMPORT TABLESPACE; +Warnings: +Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification +DROP TABLE t2; +SET GLOBAL innodb_file_per_table = 1; +SELECT @@innodb_file_per_table; +@@innodb_file_per_table +1 +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT) ENGINE=InnoDB; +INSERT INTO t1(c2) VALUES(1); +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Tablespace for table 'test/t1' exists. Please DISCARD the tablespace before IMPORT +SELECT * FROM t1; +c1 c2 +1 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT) ENGINE=InnoDB; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +db.opt +t1.frm +t1.ibd +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +db.opt +t1.cfg +t1.frm +t1.ibd +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +db.opt +t1.cfg +t1.frm +t1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +16 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT) ENGINE=InnoDB; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +db.opt +t1.frm +t1.ibd +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +db.opt +t1.cfg +t1.frm +t1.ibd +UNLOCK TABLES; +db.opt +t1.frm +t1.ibd +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +db.opt +t1.cfg +t1.frm +t1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +16 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX(c2)) ENGINE=InnoDB; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +db.opt +t1.cfg +t1.frm +t1.ibd +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX(c2)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT COUNT(*) FROM t1 WHERE c2 = 1; +COUNT(*) +16 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX x(c2)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Index x not found in tablespace meta-data file.) +select count(*) from t1; +ERROR HY000: Tablespace has been discarded for table `t1` +ALTER TABLE t1 DROP INDEX x; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +ALTER TABLE t1 DROP INDEX x, ALGORITHM=copy; +ERROR 42000: Can't DROP INDEX `x`; check that it exists +ALTER TABLE t1 ADD INDEX idx(c2); +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +unlink: t1.cfg +DROP TABLE t1; +SET GLOBAL innodb_file_per_table = 0; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT) ENGINE=InnoDB; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +FLUSH TABLES t1 FOR EXPORT; +Warnings: +Warning 1809 Table `test`.`t1` in system tablespace +UNLOCK TABLES; +DROP TABLE t1; +SET GLOBAL innodb_file_per_table = 1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Number of indexes don't match, table has 1 indexes but the tablespace meta-data file has 2 indexes) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, +c3 INT, INDEX idx(c2)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Column c3 not found in tablespace.) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 BIGINT, INDEX idx(c2)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Column c2 precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x0; .cfg file uses ROW_FORMAT=REDUNDANT) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x0; .cfg file uses ROW_FORMAT=REDUNDANT) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x29 and the meta-data file has 0x0; .cfg file uses ROW_FORMAT=REDUNDANT) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x29 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x21; .cfg file uses ROW_FORMAT=DYNAMIC) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x21; .cfg file uses ROW_FORMAT=DYNAMIC) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x29 and the meta-data file has 0x21; .cfg file uses ROW_FORMAT=DYNAMIC) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB +ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x23 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8) +unlink: t1.ibd +unlink: t1.cfg +DROP TABLE t1; +CREATE TABLE t1( +c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT * FROM t1; +ERROR HY000: Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +unlink: t1.cfg +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +SELECT * FROM t1; +c1 c2 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +DROP TABLE t1; +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Column DB_ROW_ID ordinal value mismatch, it's at 3 in the table and 4 in the tablespace meta-data file) +DROP TABLE t1, t2; +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, i3 INT, PRIMARY KEY (id)) engine=innodb; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Schema mismatch (Column i3 not found in tablespace.) +DROP TABLE t1, t2; +call mtr.add_suppression("Got error -1 when reading table '.*'"); +call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); +call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); diff --git a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result new file mode 100644 index 00000000..4d6ac474 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result @@ -0,0 +1,1592 @@ +# +# This is a copy of innodb-alter.test except using remote tablespaces +# and showing those files. +# +SET @innodb_file_per_table_orig=@@GLOBAL.innodb_file_per_table; +SET default_storage_engine=InnoDB; +SET GLOBAL innodb_file_per_table=ON; +SET NAMES utf8mb4; +CREATE TABLE t1 ( +c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, +INDEX(c2)) +ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; +INSERT INTO t1 SET c1=1; +CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE NAME LIKE 'test/t%'; +CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +CREATE TABLE t1p LIKE t1; +CREATE TABLE t1c (c1 INT PRIMARY KEY, c2 INT, c3 INT, INDEX(c2), INDEX(c3), +CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES t1(c2), +CONSTRAINT t1c3 FOREIGN KEY (c3) REFERENCES t1p(c2)) +ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; +CREATE TABLE sys_foreign SELECT i.* +FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i +WHERE FOR_NAME LIKE 'test/t%'; +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c2 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT 1, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +ALTER TABLE t1 ALTER c2 DROP DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11), + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c2 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1; +ALTER TABLE t1 CHANGE c1 c1 INT FIRST; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c2 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c2 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE C2 c3 INT; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE c3 C INT; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +C 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 C +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 C 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 Cöŀumň_TWO 0 +test/t1c3 c3 c2 0 +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +Cöŀumň_TWO 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 Cöŀumň_TWO +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 Cöŀumň_TWO 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT; +ERROR 42S22: Unknown column 'cöĿǖmň_two' in 't1' +ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +t3.frm +t3.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1c.ibd +t3.ibd +SELECT st.NAME, i.NAME +FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i +ON i.TABLE_ID=st.TABLE_ID; +NAME NAME +test/t1 test/t3 +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `c1` int(11) NOT NULL, + `c3` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + KEY `c3` (`c3`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t3` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +ALTER TABLE t3 CHANGE c3 +`12345678901234567890123456789012345678901234567890123456789012345` INT; +ERROR 42000: Identifier name '12345678901234567890123456789012345678901234567890123456789012345' is too long +ALTER TABLE t3 CHANGE c3 +`1234567890123456789012345678901234567890123456789012345678901234` INT; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +t3.frm +t3.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1c.ibd +t3.ibd +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `c1` int(11) NOT NULL, + `1234567890123456789012345678901234567890123456789012345678901234` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`1234567890123456789012345678901234567890123456789012345678901234`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +ALTER TABLE t3 CHANGE +`1234567890123456789012345678901234567890123456789012345678901234` +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT; +ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long +ALTER TABLE t3 CHANGE +`1234567890123456789012345678901234567890123456789012345678901234` +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT; +ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long +ALTER TABLE t3 CHANGE +`1234567890123456789012345678901234567890123456789012345678901234` +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +t3.frm +t3.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1c.ibd +t3.ibd +ALTER TABLE t3 CHANGE +`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä` +c3 INT; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +t3.frm +t3.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1c.ibd +t3.ibd +ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT; +ERROR HY000: Invalid utf8mb4 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\...' +ALTER TABLE t3 CHANGE c3 😲 INT; +ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2' +ALTER TABLE t3 RENAME TO t2; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +t2.frm +t2.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1c.ibd +t2.ibd +SELECT st.NAME, i.NAME +FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i +ON i.TABLE_ID=st.TABLE_ID; +NAME NAME +test/t1 test/t2 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` int(11) NOT NULL, + `c3` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +RENAME TABLE t2 TO t1; +SELECT st.NAME, i.NAME +FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i +ON i.TABLE_ID=st.TABLE_ID; +NAME NAME +test/t1 test/t1 +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.ibd +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1 DROP INDEX c2; +ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint +ALTER TABLE t1 DROP INDEX c4; +ERROR 42000: Can't DROP INDEX `c4`; check that it exists +ALTER TABLE t1c DROP FOREIGN KEY c2; +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it exists +ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2; +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it exists +ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2, DROP INDEX c2; +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it exists +ALTER TABLE t1c DROP INDEX c2; +ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint +ALTER TABLE t1c DROP FOREIGN KEY ẗ1C2; +ERROR 42000: Can't DROP FOREIGN KEY `ẗ1C2`; check that it exists +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + KEY `c3` (`c3`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +SET foreign_key_checks=0; +DROP TABLE t1p; +SET foreign_key_checks=1; +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + KEY `c3` (`c3`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +CREATE TABLE t1p (c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) +ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; +ALTER TABLE t1c DROP INDEX C2, DROP INDEX C3; +ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint +ALTER TABLE t1c DROP INDEX C3; +ERROR HY000: Cannot drop index 'c3': needed in a foreign key constraint +SET foreign_key_checks=0; +ALTER TABLE t1c DROP INDEX C3; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +t1p.ibd +SET foreign_key_checks=1; +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), + CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +test/t1c3 c3 c2 0 +ALTER TABLE t1c DROP FOREIGN KEY t1C3; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +t1p.ibd +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +test/t1c2 c2 c3 0 +ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +t1p.ibd +SHOW CREATE TABLE t1c; +Table Create Table +t1c CREATE TABLE `t1c` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c3 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +c2 0 c3 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT; +### files in MYSQL_DATA_DIR/test +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1.frm +t1.isl +t1c.frm +t1c.isl +t1p.frm +t1p.isl +### files in MYSQL_TMP_DIR/alt_dir/test +t1.ibd +t1c.ibd +t1p.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +c1 0 6 1283 4 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 c1 +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +CREATE TABLE t1o LIKE t1; +ALTER TABLE t1 ADD FULLTEXT INDEX (ct), +CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt, +ALGORITHM=INPLACE, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +ALTER TABLE t1 ADD FULLTEXT INDEX (ct), +CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt, +ALGORITHM=INPLACE, LOCK=SHARED; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +SHOW CREATE TABLE tt; +Table Create Table +tt CREATE TABLE `tt` ( + `pk` int(11) NOT NULL, + `c2` int(11) DEFAULT 42, + `ct` text DEFAULT NULL, + PRIMARY KEY (`pk`), + FULLTEXT KEY `ct` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' +ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'dB_row_Id' +ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'DB_ROW_ID' +ALTER TABLE t1o CHANGE c1 DB_TRX_ID INT; +ERROR 42000: Incorrect column name 'DB_TRX_ID' +ALTER TABLE t1o CHANGE c1 db_roll_ptr INT; +ERROR 42000: Incorrect column name 'DB_ROLL_PTR' +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT, +ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT, +ALGORITHM=INPLACE; +ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_Doc_ID INT, +ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_Doc_ID' +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), +CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +CREATE TABLE t1n LIKE t1o; +ALTER TABLE t1n ADD FULLTEXT INDEX(ct); +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'Fts_DOC_ID' +ALTER TABLE t1n CHANGE FTS_DOC_ID c11 INT, ALGORITHM=INPLACE; +ERROR 42S22: Unknown column 'FTS_DOC_ID' in 't1n' +ALTER TABLE t1n CHANGE c1 FTS_DOC_ïD INT, ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT, +ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c2` int(11) NOT NULL, + `ct` int(11) DEFAULT NULL, + `c1` text DEFAULT NULL, + PRIMARY KEY (`c2`), + FULLTEXT KEY `ct` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT, +ALGORITHM=COPY; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + FULLTEXT KEY `ct` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE; +ERROR 42000: Key column 'c2' doesn't exist in table +ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY; +ERROR 42000: Key column 'c2' doesn't exist in table +ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c1` int(11) NOT NULL, + `c4` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c4` (`c4`), + FULLTEXT KEY `ct` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1n DROP INDEX c4; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE; +ERROR 42S21: Duplicate column name 'c1' +ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1n.frm +t1n.ibd +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +SHOW CREATE TABLE t1n; +Table Create Table +t1n CREATE TABLE `t1n` ( + `c1` int(11) NOT NULL, + `c11` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c11` (`c11`), + FULLTEXT KEY `ct` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1n; +ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), +CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, +LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try LOCK=SHARED +SELECT sc.pos FROM information_schema.innodb_sys_columns sc +INNER JOIN information_schema.innodb_sys_tables st +ON sc.TABLE_ID=st.TABLE_ID +WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID'; +pos +0 +SHOW CREATE TABLE t1o; +Table Create Table +t1o CREATE TABLE `t1o` ( + `FTS_DOC_ID` bigint(20) unsigned NOT NULL, + `c2` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`FTS_DOC_ID`), + FULLTEXT KEY `ct` (`ct`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, +DROP INDEX ct, LOCK=NONE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1c.frm +t1c.isl +t1o.frm +t1o.ibd +t1p.frm +t1p.isl +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +SHOW CREATE TABLE t1o; +Table Create Table +t1o CREATE TABLE `t1o` ( + `foo_id` bigint(20) unsigned NOT NULL, + `c2` int(11) DEFAULT NULL, + `ct` text DEFAULT NULL, + PRIMARY KEY (`foo_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign; +CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE NAME='test/t1o'; +CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +CREATE TABLE sys_foreign SELECT i.* +FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i WHERE FOR_NAME='test/t1o'; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +foo_id 0 6 1800 8 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 foo_id +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id); +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1o.frm +t1o.ibd +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +tt.ibd +ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ADD FULLTEXT INDEX(ct); +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +db.opt +sys_foreign.frm +sys_foreign.ibd +sys_indexes.frm +sys_indexes.ibd +sys_tables.frm +sys_tables.ibd +t1o.frm +t1o.ibd +tt.frm +tt.isl +### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd +tt.ibd +ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE sys_indexes; +CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN +FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i +INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; +NAME POS MTYPE PRTYPE LEN +FTS_DOC_ID 0 6 1800 8 +c2 1 6 1027 4 +ct 2 5 524540 10 +SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i +INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID; +NAME POS NAME +PRIMARY 0 FTS_DOC_ID +FTS_DOC_ID_INDEX 0 FTS_DOC_ID +ct 0 ct +SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i +INNER JOIN sys_foreign sf ON i.ID = sf.ID; +ID FOR_COL_NAME REF_COL_NAME POS +# +# Cleanup +# +DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign; +### files in MYSQL_DATA_DIR/test +db.opt +### files in MYSQL_TMP_DIR/alt_dir/test +SET GLOBAL innodb_file_per_table = @innodb_file_per_table_orig; diff --git a/mysql-test/suite/innodb/r/innodb-xa.result b/mysql-test/suite/innodb/r/innodb-xa.result new file mode 100644 index 00000000..6651bd50 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-xa.result @@ -0,0 +1,44 @@ +xa rollback 'xid2'; +ERROR XAE04: XAER_NOTA: Unknown XID +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' +create table t1(a int)engine=innodb; +rollback; +xa start 'xid2'; +insert into `t1` values (1); +savepoint `sv1`; +xa end 'xid2'; +start transaction; +ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state +xa prepare 'xid2'; +release savepoint `sv1`; +xa commit 'xid2'; +drop table t1; +# +# MDEV-31928 Assertion xid ... < 128 failed in trx_undo_write_xid() +# +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=INNODB; +XA START 'gtrid_67890123456789012345678901234567890123456789012345678901234','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA START 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_67890123456789012345678901234567890123456789012345678901234',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA START 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +INSERT INTO t VALUES(1); +XA END 'gtrid_67890123456789012345678901234567890123456789012345678901234','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA END 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_67890123456789012345678901234567890123456789012345678901234',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA END 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +XA PREPARE 'gtrid_67890123456789012345678901234567890123456789012345678901234','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA PREPARE 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_67890123456789012345678901234567890123456789012345678901234',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA PREPARE 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +XA COMMIT 'gtrid_67890123456789012345678901234567890123456789012345678901234','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA COMMIT 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_67890123456789012345678901234567890123456789012345678901234',1234567890; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1234567890' at line 1 +XA COMMIT 'gtrid_6789012345678901234567890123456789012345678901234567890123','bqual_6789012345678901234567890123456789012345678901234567890123',1234567890; +DROP TABLE t; +# End of 10.4 tests diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result new file mode 100644 index 00000000..6cd6377f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb.result @@ -0,0 +1,3340 @@ +create temporary table t (a char(1) character set filename) engine=innodb; +drop temporary table t; +set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; +drop table if exists t1,t2,t3,t4; +drop database if exists mysqltest; +CREATE TABLE bug58912 (a BLOB, b TEXT, PRIMARY KEY(a(1))) ENGINE=InnoDB; +INSERT INTO bug58912 VALUES(REPEAT('a',8000),REPEAT('b',8000)); +UPDATE bug58912 SET a=REPEAT('a',7999); +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; +insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +update ignore t1 set id = 8, name = 'Sinisa' where id < 3; +select id, code, name from t1 order by id; +id code name +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +8 1 Sinisa +update ignore t1 set id = id + 10, name = 'Ralph' where id < 4; +select id, code, name from t1 order by id; +id code name +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +8 1 Sinisa +12 1 Ralph +drop table t1; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +parent_id int(11) DEFAULT '0' NOT NULL, +level tinyint(4) DEFAULT '0' NOT NULL, +PRIMARY KEY (id), +KEY parent_id (parent_id), +KEY level (level) +) engine=innodb stats_persistent=0; +INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); +update t1 set parent_id=parent_id+100; +select * from t1 where parent_id=102; +id parent_id level +8 102 2 +9 102 2 +15 102 2 +update t1 set id=id+1000; +update t1 set id=1024 where id=1009; +Got one of the listed errors +select * from t1; +id parent_id level +1001 100 0 +1002 101 1 +1003 101 1 +1004 101 1 +1005 101 1 +1006 101 1 +1007 101 1 +1008 102 2 +1009 102 2 +1015 102 2 +1016 103 2 +1017 103 2 +1018 103 2 +1019 103 2 +1020 103 2 +1021 104 2 +1022 104 2 +1024 104 2 +1025 105 2 +1026 105 2 +1027 105 2 +1028 105 2 +1029 105 2 +1030 105 2 +1031 106 2 +1032 106 2 +1033 106 2 +1034 106 2 +1035 106 2 +1036 107 2 +1037 107 2 +1038 107 2 +1040 107 2 +1157 100 0 +1179 105 2 +1183 104 2 +1193 105 2 +1202 107 2 +1203 107 2 +update ignore t1 set id=id+1; +select * from t1; +id parent_id level +1001 100 0 +1002 101 1 +1003 101 1 +1004 101 1 +1005 101 1 +1006 101 1 +1007 101 1 +1008 102 2 +1010 102 2 +1015 102 2 +1016 103 2 +1017 103 2 +1018 103 2 +1019 103 2 +1020 103 2 +1021 104 2 +1023 104 2 +1024 104 2 +1025 105 2 +1026 105 2 +1027 105 2 +1028 105 2 +1029 105 2 +1030 105 2 +1031 106 2 +1032 106 2 +1033 106 2 +1034 106 2 +1035 106 2 +1036 107 2 +1037 107 2 +1039 107 2 +1041 107 2 +1158 100 0 +1180 105 2 +1184 104 2 +1194 105 2 +1202 107 2 +1204 107 2 +update ignore t1 set id=1023 where id=1010; +select * from t1 where parent_id=102; +id parent_id level +1008 102 2 +1010 102 2 +1015 102 2 +explain select level from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using index +explain select level,id from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using index +explain select level,id,parent_id from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # +select level,id from t1 where level=1; +level id +1 1002 +1 1003 +1 1004 +1 1005 +1 1006 +1 1007 +select level,id,parent_id from t1 where level=1; +level id parent_id +1 1002 101 +1 1003 101 +1 1004 101 +1 1005 101 +1 1006 101 +1 1007 101 +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t1 0 PRIMARY 1 id A # NULL NULL BTREE NO +t1 1 parent_id 1 parent_id A # NULL NULL BTREE NO +t1 1 level 1 level A # NULL NULL BTREE NO +drop table t1; +CREATE TABLE t1 ( +gesuchnr int(11) DEFAULT '0' NOT NULL, +benutzer_id int(11) DEFAULT '0' NOT NULL, +PRIMARY KEY (gesuchnr,benutzer_id) +) engine=innodb; +replace into t1 (gesuchnr,benutzer_id) values (2,1); +replace into t1 (gesuchnr,benutzer_id) values (1,1); +replace into t1 (gesuchnr,benutzer_id) values (1,1); +select * from t1; +gesuchnr benutzer_id +1 1 +2 1 +drop table t1; +create table t1 (a int) engine=innodb; +insert into t1 values (1), (2); +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +delete from t1 where a = 1; +select * from t1; +a +2 +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +create table t1 (a int,b varchar(20)) engine=innodb; +insert into t1 values (1,""), (2,"testing"); +delete from t1 where a = 1; +select * from t1; +a b +2 testing +create index skr on t1 (a); +insert into t1 values (3,""), (4,"testing"); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t1 1 skr 1 a A # NULL NULL YES BTREE NO +drop table t1; +create table t1 (a int,b varchar(20),key(a)) engine=innodb; +insert into t1 values (1,""), (2,"testing"); +select * from t1 where a = 1; +a b +1 +drop table t1; +create table t1 (n int not null primary key) engine=innodb; +set autocommit=0; +insert into t1 values (4); +rollback; +select n, "after rollback" from t1; +n after rollback +insert into t1 values (4); +commit; +select n, "after commit" from t1; +n after commit +4 after commit +commit; +insert into t1 values (5); +insert into t1 values (4); +ERROR 23000: Duplicate entry '4' for key 'PRIMARY' +commit; +select n, "after commit" from t1; +n after commit +4 after commit +5 after commit +set autocommit=1; +insert into t1 values (6); +insert into t1 values (4); +ERROR 23000: Duplicate entry '4' for key 'PRIMARY' +select n from t1; +n +4 +5 +6 +set autocommit=0; +begin; +savepoint `my_savepoint`; +insert into t1 values (7); +savepoint `savept2`; +insert into t1 values (3); +select n from t1; +n +3 +4 +5 +6 +7 +savepoint savept3; +rollback to savepoint savept2; +rollback to savepoint savept3; +ERROR 42000: SAVEPOINT savept3 does not exist +rollback to savepoint savept2; +release savepoint `my_savepoint`; +select n from t1; +n +4 +5 +6 +7 +rollback to savepoint `my_savepoint`; +ERROR 42000: SAVEPOINT my_savepoint does not exist +rollback to savepoint savept2; +ERROR 42000: SAVEPOINT savept2 does not exist +insert into t1 values (8); +savepoint sv; +commit; +savepoint sv; +set autocommit=1; +rollback; +drop table t1; +create table t1 (n int not null primary key) engine=innodb; +start transaction; +insert into t1 values (4); +flush tables with read lock; +commit; +unlock tables; +commit; +select * from t1; +n +4 +drop table t1; +create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb; +begin; +insert into t1 values(1,'hamdouni'); +select id as afterbegin_id,nom as afterbegin_nom from t1; +afterbegin_id afterbegin_nom +1 hamdouni +rollback; +select id as afterrollback_id,nom as afterrollback_nom from t1; +afterrollback_id afterrollback_nom +set autocommit=0; +insert into t1 values(2,'mysql'); +select id as afterautocommit0_id,nom as afterautocommit0_nom from t1; +afterautocommit0_id afterautocommit0_nom +2 mysql +rollback; +select id as afterrollback_id,nom as afterrollback_nom from t1; +afterrollback_id afterrollback_nom +set autocommit=1; +drop table t1; +CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; +insert into t1 values ('pippo', 12); +insert into t1 values ('pippo', 12); +ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY' +delete from t1; +delete from t1 where id = 'pippo'; +select * from t1; +id val +insert into t1 values ('pippo', 12); +set autocommit=0; +delete from t1; +rollback; +select * from t1; +id val +pippo 12 +delete from t1; +commit; +select * from t1; +id val +drop table t1; +create table t1 (a integer) engine=innodb; +start transaction; +rename table t1 to t2; +create table t1 (b integer) engine=innodb; +insert into t1 values (1); +rollback; +drop table t1; +rename table t2 to t1; +drop table t1; +set autocommit=1; +CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 'Jochen'); +select * from t1; +ID NAME +1 Jochen +drop table t1; +CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb; +set autocommit=0; +INSERT INTO t1 SET _userid='marc@anyware.co.uk'; +COMMIT; +SELECT * FROM t1; +_userid +marc@anyware.co.uk +SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk'; +_userid +marc@anyware.co.uk +drop table t1; +set autocommit=1; +CREATE TABLE t1 ( +user_id int(10) DEFAULT '0' NOT NULL, +name varchar(100), +phone varchar(100), +ref_email varchar(100) DEFAULT '' NOT NULL, +detail varchar(200), +PRIMARY KEY (user_id,ref_email) +)engine=innodb; +INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); +select * from t1 where user_id=10292; +user_id name phone ref_email detail +10292 sanjeev 29153373 sansh777@hotmail.com xxx +10292 shirish 2333604 shirish@yahoo.com ddsds +10292 sonali 323232 sonali@bolly.com filmstar +INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds'); +select * from t1 where user_id=10292; +user_id name phone ref_email detail +10292 sanjeev 29153373 sansh777@hotmail.com xxx +10292 shirish 2333604 shirish@yahoo.com ddsds +10292 sonali 323232 sonali@bolly.com filmstar +select * from t1 where user_id>=10292; +user_id name phone ref_email detail +10292 sanjeev 29153373 sansh777@hotmail.com xxx +10292 shirish 2333604 shirish@yahoo.com ddsds +10292 sonali 323232 sonali@bolly.com filmstar +10293 shirish 2333604 shirish@yahoo.com ddsds +select * from t1 where user_id>10292; +user_id name phone ref_email detail +10293 shirish 2333604 shirish@yahoo.com ddsds +select * from t1 where user_id<10292; +user_id name phone ref_email detail +10291 sanjeev 29153373 sansh777@hotmail.com xxx +drop table t1; +CREATE TABLE t1 (a int not null, b int not null,c int not null, +key(a),primary key(a,b), unique(c),key(a),unique(b)); +Warnings: +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t1 0 PRIMARY 1 a A # NULL NULL BTREE NO +t1 0 PRIMARY 2 b A # NULL NULL BTREE NO +t1 0 c 1 c A # NULL NULL BTREE NO +t1 0 b 1 b A # NULL NULL BTREE NO +t1 1 a 1 a A # NULL NULL BTREE NO +t1 1 a_2 1 a A # NULL NULL BTREE NO +drop table t1; +create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); +alter table t1 engine=innodb; +insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); +select * from t1; +col1 col2 +1 1 +2 3 +3 4 +4 4 +5 2 +update t1 set col2='7' where col1='4'; +select * from t1; +col1 col2 +1 1 +2 3 +3 4 +4 7 +5 2 +alter table t1 add co3 int not null; +select * from t1; +col1 col2 co3 +1 1 0 +2 3 0 +3 4 0 +4 7 0 +5 2 0 +update t1 set col2='9' where col1='2'; +select * from t1; +col1 col2 co3 +1 1 0 +2 9 0 +3 4 0 +4 7 0 +5 2 0 +drop table t1; +create table t1 (a int not null , b int, primary key (a)) engine = innodb; +create table t2 (a int not null , b int, primary key (a)) engine = myisam; +insert into t1 VALUES (1,3) , (2,3), (3,3); +select * from t1; +a b +1 3 +2 3 +3 3 +insert into t2 select * from t1; +select * from t2; +a b +1 3 +2 3 +3 3 +delete from t1 where b = 3; +select * from t1; +a b +insert into t1 select * from t2; +select * from t1; +a b +1 3 +2 3 +3 3 +select * from t2; +a b +1 3 +2 3 +3 3 +drop table t1,t2; +CREATE TABLE t1 ( +user_name varchar(12), +password text, +subscribed char(1), +user_id int(11) DEFAULT '0' NOT NULL, +quota bigint(20), +weight double, +access_date date, +access_time time, +approved datetime, +dummy_primary_key int(11) NOT NULL auto_increment, +PRIMARY KEY (dummy_primary_key) +) ENGINE=innodb; +INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); +INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); +INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); +INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4); +INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5); +select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name; +user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key +user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1 +user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2 +user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3 +user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4 +user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5 +drop table t1; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +parent_id int(11) DEFAULT '0' NOT NULL, +level tinyint(4) DEFAULT '0' NOT NULL, +KEY (id), +KEY parent_id (parent_id), +KEY level (level) +) engine=innodb; +INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); +INSERT INTO t1 values (179,5,2); +update t1 set parent_id=parent_id+100; +select * from t1 where parent_id=102; +id parent_id level +8 102 2 +9 102 2 +15 102 2 +update t1 set id=id+1000; +update t1 set id=1024 where id=1009; +select * from t1; +id parent_id level +1001 100 0 +1003 101 1 +1004 101 1 +1008 102 2 +1024 102 2 +1017 103 2 +1022 104 2 +1024 104 2 +1028 105 2 +1029 105 2 +1030 105 2 +1031 106 2 +1032 106 2 +1033 106 2 +1203 107 2 +1202 107 2 +1020 103 2 +1157 100 0 +1193 105 2 +1040 107 2 +1002 101 1 +1015 102 2 +1006 101 1 +1034 106 2 +1035 106 2 +1016 103 2 +1007 101 1 +1036 107 2 +1018 103 2 +1026 105 2 +1027 105 2 +1183 104 2 +1038 107 2 +1025 105 2 +1037 107 2 +1021 104 2 +1019 103 2 +1005 101 1 +1179 105 2 +update ignore t1 set id=id+1; +select * from t1; +id parent_id level +1002 100 0 +1004 101 1 +1005 101 1 +1009 102 2 +1025 102 2 +1018 103 2 +1023 104 2 +1025 104 2 +1029 105 2 +1030 105 2 +1031 105 2 +1032 106 2 +1033 106 2 +1034 106 2 +1204 107 2 +1203 107 2 +1021 103 2 +1158 100 0 +1194 105 2 +1041 107 2 +1003 101 1 +1016 102 2 +1007 101 1 +1035 106 2 +1036 106 2 +1017 103 2 +1008 101 1 +1037 107 2 +1019 103 2 +1027 105 2 +1028 105 2 +1184 104 2 +1039 107 2 +1026 105 2 +1038 107 2 +1022 104 2 +1020 103 2 +1006 101 1 +1180 105 2 +update ignore t1 set id=1023 where id=1010; +select * from t1 where parent_id=102; +id parent_id level +1009 102 2 +1025 102 2 +1016 102 2 +explain select level from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using index +select level,id from t1 where level=1; +level id +1 1004 +1 1005 +1 1003 +1 1007 +1 1008 +1 1006 +select level,id,parent_id from t1 where level=1; +level id parent_id +1 1004 101 +1 1005 101 +1 1003 101 +1 1007 101 +1 1008 101 +1 1006 101 +select level,id from t1 where level=1 order by id; +level id +1 1003 +1 1004 +1 1005 +1 1006 +1 1007 +1 1008 +delete from t1 where level=1; +select * from t1; +id parent_id level +1002 100 0 +1009 102 2 +1025 102 2 +1018 103 2 +1023 104 2 +1025 104 2 +1029 105 2 +1030 105 2 +1031 105 2 +1032 106 2 +1033 106 2 +1034 106 2 +1204 107 2 +1203 107 2 +1021 103 2 +1158 100 0 +1194 105 2 +1041 107 2 +1016 102 2 +1035 106 2 +1036 106 2 +1017 103 2 +1037 107 2 +1019 103 2 +1027 105 2 +1028 105 2 +1184 104 2 +1039 107 2 +1026 105 2 +1038 107 2 +1022 104 2 +1020 103 2 +1180 105 2 +drop table t1; +CREATE TABLE t1 ( +sca_code char(6) NOT NULL, +cat_code char(6) NOT NULL, +sca_desc varchar(50), +lan_code char(2) NOT NULL, +sca_pic varchar(100), +sca_sdesc varchar(50), +sca_sch_desc varchar(16), +PRIMARY KEY (sca_code, cat_code, lan_code), +INDEX sca_pic (sca_pic) +) engine = innodb ; +INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); +select count(*) from t1 where sca_code = 'PD'; +count(*) +1 +select count(*) from t1 where sca_code <= 'PD'; +count(*) +1 +select count(*) from t1 where sca_pic is null; +count(*) +2 +alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); +select count(*) from t1 where sca_code='PD' and sca_pic is null; +count(*) +1 +select count(*) from t1 where cat_code='E'; +count(*) +0 +alter table t1 drop index sca_pic, add index (sca_pic, cat_code); +select count(*) from t1 where sca_code='PD' and sca_pic is null; +count(*) +1 +select count(*) from t1 where sca_pic >= 'n'; +count(*) +1 +select sca_pic from t1 where sca_pic is null; +sca_pic +NULL +NULL +update t1 set sca_pic="test" where sca_pic is null; +delete from t1 where sca_code='pd'; +drop table t1; +set @a:=now(); +CREATE TABLE t1 (a int not null, b timestamp not null default +current_timestamp on update current_timestamp, primary key (a)) engine=innodb; +insert into t1 (a) values(1),(2),(3); +select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; +a +1 +2 +3 +select a from t1 natural join t1 as t2 where b >= @a order by a; +a +1 +2 +3 +update t1 set a=5 where a=1; +select a from t1; +a +2 +3 +5 +drop table t1; +create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb; +insert into t1 values("hello",1),("world",2); +select * from t1 order by b desc; +a b +world 2 +hello 1 +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t1 0 PRIMARY 1 a A # NULL NULL BTREE NO +drop table t1; +create table t1 (i int, j int ) ENGINE=innodb; +insert into t1 values (1,2); +select * from t1 where i=1 and j=2; +i j +1 2 +create index ax1 on t1 (i,j); +select * from t1 where i=1 and j=2; +i j +1 2 +drop table t1; +CREATE TABLE t1 ( +a int3 unsigned NOT NULL, +b int1 unsigned NOT NULL, +UNIQUE (a, b) +) ENGINE = innodb; +INSERT INTO t1 VALUES (1, 1); +SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; +MIN(B) MAX(b) +1 1 +drop table t1; +CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; +a +1 +DROP TABLE t1; +create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb; +insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); +explain select * from t1 where a > 0 and a < 50; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using index condition +drop table t1; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; +insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); +LOCK TABLES t1 WRITE; +insert into t1 values (99,1,2,'D'),(1,1,2,'D'); +ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' +select id from t1; +id +0 +1 +2 +select id from t1; +id +0 +1 +2 +UNLOCK TABLES; +DROP TABLE t1; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; +insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); +LOCK TABLES t1 WRITE; +begin; +insert into t1 values (99,1,2,'D'),(1,1,2,'D'); +ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' +select id from t1; +id +0 +1 +2 +insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); +Warnings: +Warning 1062 Duplicate entry '1-1' for key 'PRIMARY' +commit; +select id,id3 from t1; +id id3 +0 0 +1 1 +2 2 +100 2 +UNLOCK TABLES; +DROP TABLE t1; +create table t1 (a char(20), unique (a(5))) engine=innodb; +drop table t1; +create table t1 (a char(20), index (a(5))) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) DEFAULT NULL, + KEY `a` (`a`(5)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; +insert into t1 values (NULL),(NULL),(NULL); +delete from t1 where a=3; +insert into t1 values (NULL); +select * from t1; +a +1 +2 +4 +alter table t1 add b int; +select * from t1; +a b +1 NULL +2 NULL +4 NULL +drop table t1; +create table t1 +( +id int auto_increment primary key, +name varchar(32) not null, +value text not null, +uid int not null, +unique key(name,uid) +) engine=innodb; +insert into t1 values (1,'one','one value',101), +(2,'two','two value',102),(3,'three','three value',103); +set insert_id=5; +replace into t1 (value,name,uid) values ('other value','two',102); +delete from t1 where uid=102; +set insert_id=5; +replace into t1 (value,name,uid) values ('other value','two',102); +set insert_id=6; +replace into t1 (value,name,uid) values ('other value','two',102); +select * from t1; +id name value uid +1 one one value 101 +3 three three value 103 +6 two other value 102 +drop table t1; +create database mysqltest; +create table mysqltest.t1 (a int not null) engine= innodb; +insert into mysqltest.t1 values(1); +create table mysqltest.t2 (a int not null) engine= myisam; +insert into mysqltest.t2 values(1); +create table mysqltest.t3 (a int not null) engine= heap; +insert into mysqltest.t3 values(1); +commit; +drop database mysqltest; +show tables from mysqltest; +ERROR 42000: Unknown database 'mysqltest' +set autocommit=0; +create table t1 (a int not null) engine= innodb; +insert into t1 values(1),(2); +truncate table t1; +commit; +truncate table t1; +truncate table t1; +select * from t1; +a +insert into t1 values(1),(2); +delete from t1; +select * from t1; +a +commit; +drop table t1; +set autocommit=1; +create table t1 (a int not null) engine= innodb; +insert into t1 values(1),(2); +truncate table t1; +insert into t1 values(1),(2); +select * from t1; +a +1 +2 +truncate table t1; +insert into t1 values(1),(2); +delete from t1; +select * from t1; +a +drop table t1; +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb; +insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); +explain select * from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL # +explain select * from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort +explain select * from t1 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort +explain select a from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index +explain select b from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL # Using index +explain select a,b from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL # Using index +explain select a,b from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL # Using index +explain select a,b,c from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # +drop table t1; +create table t1 (t int not null default 1, key (t)) engine=innodb; +desc t1; +Field Type Null Key Default Extra +t int(11) NO MUL 1 +drop table t1; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +CREATE TABLE t1 ( +number bigint(20) NOT NULL default '0', +cname char(15) NOT NULL default '', +carrier_id smallint(6) NOT NULL default '0', +privacy tinyint(4) NOT NULL default '0', +last_mod_date timestamp NOT NULL, +last_mod_id smallint(6) NOT NULL default '0', +last_app_date timestamp NOT NULL, +last_app_id smallint(6) default '-1', +version smallint(6) NOT NULL default '0', +assigned_scps int(11) default '0', +status tinyint(4) default '0' +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1); +INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0); +INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1); +INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0); +INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0); +INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0); +CREATE TABLE t2 ( +number bigint(20) NOT NULL default '0', +cname char(15) NOT NULL default '', +carrier_id smallint(6) NOT NULL default '0', +privacy tinyint(4) NOT NULL default '0', +last_mod_date timestamp NOT NULL, +last_mod_id smallint(6) NOT NULL default '0', +last_app_date timestamp NOT NULL, +last_app_id smallint(6) default '-1', +version smallint(6) NOT NULL default '0', +assigned_scps int(11) default '0', +status tinyint(4) default '0' +) ENGINE=InnoDB; +INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1); +INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0); +INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1); +INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0); +select * from t1; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1 +9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0 +650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1 +302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0 +6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0 +333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0 +select * from t2; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1 +9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0 +650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1 +333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 +delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null); +select * from t1; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0 +333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0 +select * from t2; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 +select * from t2; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 +drop table t1,t2; +SET sql_mode = default; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; +BEGIN; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +SELECT @@tx_isolation,@@global.tx_isolation; +@@tx_isolation @@global.tx_isolation +SERIALIZABLE REPEATABLE-READ +insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +COMMIT; +BEGIN; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +COMMIT; +SET binlog_format='MIXED'; +BEGIN; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +COMMIT; +DROP TABLE t1; +create table t1 (n int(10), d int(10)) engine=innodb; +create table t2 (n int(10), d int(10)) engine=innodb; +insert into t1 values(1,1),(1,2); +insert into t2 values(1,10),(2,20); +UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; +select * from t1; +n d +1 10 +1 10 +select * from t2; +n d +1 30 +2 20 +drop table t1,t2; +drop table if exists t1, t2; +CREATE TABLE t1 (a int, PRIMARY KEY (a)); +CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; +create trigger trg_del_t2 after delete on t2 for each row +insert into t1 values (1); +insert into t1 values (1); +insert into t2 values (1),(2); +delete t2 from t2; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; +count(*) +2 +drop table t1, t2; +drop table if exists t1, t2; +CREATE TABLE t1 (a int, PRIMARY KEY (a)); +CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; +create trigger trg_del_t2 after delete on t2 for each row +insert into t1 values (1); +insert into t1 values (1); +insert into t2 values (1),(2); +delete t2 from t2; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; +count(*) +2 +drop table t1, t2; +create table t1 (a int, b int) engine=innodb; +insert into t1 values(20,null); +select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on +t2.b=t3.a; +b ifnull(t2.b,"this is null") +NULL this is null +select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on +t2.b=t3.a order by 1; +b ifnull(t2.b,"this is null") +NULL this is null +insert into t1 values(10,null); +select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on +t2.b=t3.a order by 1; +b ifnull(t2.b,"this is null") +NULL this is null +NULL this is null +drop table t1; +create table t1 (a varchar(10) not null) engine=myisam; +create table t2 (b varchar(10) not null unique) engine=innodb; +select t1.a from t1,t2 where t1.a=t2.b; +a +drop table t1,t2; +create table t1 (a int not null, b int, primary key (a)) engine = innodb; +create table t2 (a int not null, b int, primary key (a)) engine = innodb; +insert into t1 values (10, 20); +insert into t2 values (10, 20); +update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10; +drop table t1,t2; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB; +insert into t1 set id=1; +insert into t2 set id=1, t1_id=1; +delete t1,t2 from t1,t2 where t1.id=t2.t1_id; +select * from t1; +id +select * from t2; +id t1_id +drop table t2,t1; +CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, 1); +SELECT * from t1; +id +1 +UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1; +SELECT * from t1; +id +2 +UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id; +SELECT * from t1; +id +3 +DROP TABLE t1,t2; +set autocommit=0; +CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB; +INSERT INTO t3 VALUES("my-test-1", "my-test-2"); +COMMIT; +INSERT INTO t1 VALUES("this-key", "will disappear"); +INSERT INTO t2 VALUES("this-key", "will also disappear"); +DELETE FROM t3 WHERE id1="my-test-1"; +SELECT * FROM t1; +id value +this-key will disappear +SELECT * FROM t2; +id value +this-key will also disappear +SELECT * FROM t3; +id1 id2 +ROLLBACK; +SELECT * FROM t1; +id value +SELECT * FROM t2; +id value +SELECT * FROM t3; +id1 id2 +my-test-1 my-test-2 +SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE; +id1 id2 +my-test-1 my-test-2 +COMMIT; +set autocommit=1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; +SELECT * from t1; +a b +1 1 +102 2 +103 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +drop table t1; +CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +SET AUTOCOMMIT=0; +INSERT INTO t1 ( B_ID ) VALUES ( 1 ); +INSERT INTO t2 ( NEXT_T ) VALUES ( 1 ); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SELECT * FROM t1; +B_ID +drop table t1,t2; +create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb; +insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2); +select distinct parent,child from t1 order by parent; +parent child +0 4 +1 2 +1 3 +2 1 +drop table t1; +create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb; +create table t2 (a int not null auto_increment primary key, b int); +insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null); +insert into t2 (a) select b from t1; +insert into t1 (b) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +select count(*) from t1; +count(*) +623 +explain select * from t1 where c between 1 and 2500; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range c c 5 NULL # # +update t1 set c=a; +explain select * from t1 where c between 1 and 2500; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL c NULL NULL NULL # # +drop table t1,t2; +create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; +insert into t1 (id) values (null),(null),(null),(null),(null); +update t1 set fk=69 where fk is null order by id limit 1; +SELECT * from t1; +id fk +2 NULL +3 NULL +4 NULL +5 NULL +1 69 +drop table t1; +create table t1 (a int not null, b int not null, key (a)); +insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3); +SET @tmp=0; +update t1 set b=(@tmp:=@tmp+1) order by a; +update t1 set b=99 where a=1 order by b asc limit 1; +update t1 set b=100 where a=1 order by b desc limit 2; +update t1 set a=a+10+b where a=1 order by b; +select * from t1 order by a,b; +a b +2 4 +2 5 +2 6 +3 7 +3 8 +3 9 +3 10 +3 11 +3 12 +13 2 +111 100 +111 100 +drop table t1; +create table t1 ( c char(8) not null ) engine=innodb; +insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); +insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); +alter table t1 add b char(8) not null; +alter table t1 add a char(8) not null; +alter table t1 add primary key (a,b,c); +update t1 set a=c, b=c; +create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb; +insert into t2 select * from t1; +delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; +drop table t1,t2; +SET AUTOCOMMIT=1; +create table t1 (a integer auto_increment primary key) engine=innodb; +insert into t1 (a) values (NULL),(NULL); +truncate table t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; +a +1 +2 +drop table t1; +CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB; +drop table t2,t1; +create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb; +insert into `t1`values ( 1 ) ; +create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb; +insert into `t2`values ( 1 ) ; +create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb; +insert into `t3`values ( 1 ) ; +delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)) +update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)) +update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +ERROR 42S22: Unknown column 't1.id' in 'where clause' +drop table t3,t2,t1; +CREATE TABLE t1 ( +c1 VARCHAR(8), c2 VARCHAR(8), +PRIMARY KEY (c1, c2) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +c0 INT PRIMARY KEY, +c1 VARCHAR(8) UNIQUE, +FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue'); +INSERT INTO t2 VALUES (10, 'old'), (20, 'other'); +UPDATE t1 SET c1 = 'other' WHERE c1 = 'old'; +ERROR 23000: Foreign key constraint for table 't1', record 'other-somevalu' would lead to a duplicate entry in table 't2', key 'c1' +DROP TABLE t2,t1; +call mtr.add_suppression("Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15\\. Please drop excessive foreign constraints and try again"); +create table t1( +id int primary key, +pid int, +index(pid), +foreign key(pid) references t1(id) on delete cascade) engine=innodb; +insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6), +(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14); +delete from t1 where id=0; +Got one of the listed errors +delete from t1 where id=15; +delete from t1 where id=0; +drop table t1; +CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB; +CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx +(stamp))ENGINE=InnoDB; +insert into t1 values (1),(2),(3); +insert ignore into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000); +Warnings: +Warning 1265 Data truncated for column 'stamp' at row 3 +SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < +'20020204120000' GROUP BY col1; +col1 +1 +2 +3 +4 +drop table t1,t2; +CREATE TABLE t1 ( +`id` int(10) unsigned NOT NULL auto_increment, +`id_object` int(10) unsigned default '0', +`id_version` int(10) unsigned NOT NULL default '1', +`label` varchar(100) NOT NULL default '', +`description` text, +PRIMARY KEY (`id`), +KEY `id_object` (`id_object`), +KEY `id_version` (`id_version`) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL); +CREATE TABLE t2 ( +`id` int(10) unsigned NOT NULL auto_increment, +`id_version` int(10) unsigned NOT NULL default '1', +PRIMARY KEY (`id`), +KEY `id_version` (`id_version`) +) ENGINE=InnoDB; +INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9"); +SELECT t2.id, t1.`label` FROM t2 INNER JOIN +(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl +ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object); +id label +3382 Test +102 Le Pekin (Test) +1794 Test de resto +1822 Test 3 +3524 Societe Test +3525 Fournisseur Test +drop table t1,t2; +create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam; +create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb; +create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb; +insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); +insert t2 select * from t1; +insert t3 select * from t1; +checksum table t1, t2, t3, t4 quick; +Table Checksum +test.t1 3442722830 +test.t2 NULL +test.t3 NULL +test.t4 NULL +Warnings: +Error 1146 Table 'test.t4' doesn't exist +checksum table t1, t2, t3, t4; +Table Checksum +test.t1 3442722830 +test.t2 3442722830 +test.t3 3442722830 +test.t4 NULL +Warnings: +Error 1146 Table 'test.t4' doesn't exist +checksum table t1, t2, t3, t4 extended; +Table Checksum +test.t1 3442722830 +test.t2 3442722830 +test.t3 3442722830 +test.t4 NULL +Warnings: +Error 1146 Table 'test.t4' doesn't exist +drop table t1,t2,t3; +create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb; +insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt'); +select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1; +trim(name2) +fff +sss +ttt +first +second +third +1 +2 +3 +drop table t1; +create table t1 (a int) engine=innodb; +create table t2 like t1; +drop table t1,t2; +create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb; +create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `id2` int(11) NOT NULL, + UNIQUE KEY `id` (`id`,`id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + KEY `t1_id_fk` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +create index id on t2 (id); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + KEY `id` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +create index id2 on t2 (id); +Warnings: +Note 1831 Duplicate index `id2`. This is deprecated and will be disallowed in a future release +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + KEY `id` (`id`), + KEY `id2` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop index id2 on t2; +drop index id on t2; +ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + KEY `id` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `id2` int(11) NOT NULL, + KEY `t1_id_fk` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +create unique index id on t2 (id,id2); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `id2` int(11) NOT NULL, + UNIQUE KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `id2` int(11) NOT NULL, + UNIQUE KEY `id` (`id`,`id2`), + KEY `t1_id_fk` (`id2`,`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `id2` int(11) NOT NULL, + UNIQUE KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `id2` int(11) NOT NULL, + UNIQUE KEY `id` (`id`,`id2`), + KEY `t1_id_fk` (`id2`,`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `id2` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `id2` int(11) NOT NULL, + KEY `t1_id_fk` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t2 add index id_test (id), add index id_test2 (id,id2); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `id2` int(11) NOT NULL, + KEY `id_test` (`id`), + KEY `id_test2` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; +ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match +create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b_2` (`b`), + KEY `b` (`b`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b` (`b`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`), + CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2, t1; +create table t1 (c char(10), index (c,c)) engine=innodb; +ERROR 42S21: Duplicate column name 'c' +create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; +ERROR 42S21: Duplicate column name 'c1' +create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb; +ERROR 42S21: Duplicate column name 'c1' +create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb; +ERROR 42S21: Duplicate column name 'c1' +create table t1 (c1 char(10), c2 char(10)) engine=innodb; +alter table t1 add key (c1,c1); +ERROR 42S21: Duplicate column name 'c1' +alter table t1 add key (c2,c1,c1); +ERROR 42S21: Duplicate column name 'c1' +alter table t1 add key (c1,c2,c1); +ERROR 42S21: Duplicate column name 'c1' +alter table t1 add key (c1,c1,c2); +ERROR 42S21: Duplicate column name 'c1' +drop table t1; +create table t1(a int(1) , b int(1)) engine=innodb; +insert into t1 values ('1111', '3333'); +select distinct concat(a, b) from t1; +concat(a, b) +11113333 +drop table t1; +CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), +CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); +SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; +a_id b_list +1 1,2,3 +2 4,5 +3 NULL +DROP TABLE t2; +DROP TABLE t1; +create temporary table t1 (a int) engine=innodb; +insert into t1 values (4711); +truncate t1; +insert into t1 values (42); +select * from t1; +a +42 +drop table t1; +create table t1 (a int) engine=innodb; +insert into t1 values (4711); +truncate t1; +insert into t1 values (42); +select * from t1; +a +42 +drop table t1; +create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb; +insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3); +analyze table t1; +select * from t1 order by a,b,c,d; +a b c d e +1 1 a 1 1 +2 2 b 2 2 +3 3 ab 3 3 +explain select * from t1 order by a,b,c,d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +drop table t1; +create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; +insert into t1 values ('8', '6'), ('4', '7'); +select min(a) from t1; +min(a) +4 +select min(b) from t1 where a='8'; +min(b) +6 +drop table t1; +create table t1 (x bigint unsigned not null primary key) engine=innodb; +insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1); +select * from t1; +x +18446744073709551600 +18446744073709551601 +select count(*) from t1 where x>0; +count(*) +2 +select count(*) from t1 where x=0; +count(*) +0 +select count(*) from t1 where x<0; +count(*) +0 +select count(*) from t1 where x < -16; +count(*) +0 +select count(*) from t1 where x = -16; +count(*) +0 +explain select count(*) from t1 where x > -16; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +select count(*) from t1 where x > -16; +count(*) +2 +select * from t1 where x > -16; +x +18446744073709551600 +18446744073709551601 +select count(*) from t1 where x = 18446744073709551601; +count(*) +1 +drop table t1; +SELECT IF(variable_value BETWEEN 488 AND 512, 'OK', variable_value) FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; +IF(variable_value BETWEEN 488 AND 512, 'OK', variable_value) +OK +SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; +variable_value +16384 +SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; +variable_value - @innodb_row_lock_waits_orig +0 +SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits'; +variable_value - @innodb_row_lock_current_waits_orig +0 +SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time'; +variable_value - @innodb_row_lock_time_orig +0 +SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; +variable_value - @innodb_row_lock_time_max_orig +0 +SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; +variable_value - @innodb_row_lock_time_avg_orig +0 +set default_storage_engine=INNODB; +drop table if exists t1,t2,t3; +--- Testing varchar --- +--- Testing varchar --- +create table t1 (v varchar(10), c char(10), t text); +insert into t1 values('+ ', '+ ', '+ '); +set @a=repeat(' ',20); +insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); +Warnings: +Note 1265 Data truncated for column 'v' at row 1 +select concat('*',v,'*',c,'*',t,'*') from t1; +concat('*',v,'*',c,'*',t,'*') +*+ *+*+ * +*+ *+*+ * +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +create table t2 like t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +create table t3 select * from t1; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 modify c varchar(10); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(10) DEFAULT NULL, + `c` varchar(10) DEFAULT NULL, + `t` text DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 modify v char(10); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` char(10) DEFAULT NULL, + `c` varchar(10) DEFAULT NULL, + `t` text DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 modify t varchar(10); +Warnings: +Note 1265 Data truncated for column 't' at row 2 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` char(10) DEFAULT NULL, + `c` varchar(10) DEFAULT NULL, + `t` varchar(10) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select concat('*',v,'*',c,'*',t,'*') from t1; +concat('*',v,'*',c,'*',t,'*') +*+*+*+ * +*+*+*+ * +drop table t1,t2,t3; +create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10))); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL, + KEY `v` (`v`), + KEY `c` (`c`), + KEY `t` (`t`(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select count(*) from t1; +count(*) +270 +insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1))); +select count(*) from t1 where v='a'; +count(*) +10 +select count(*) from t1 where c='a'; +count(*) +10 +select count(*) from t1 where t='a'; +count(*) +10 +select count(*) from t1 where v='a '; +count(*) +10 +select count(*) from t1 where c='a '; +count(*) +10 +select count(*) from t1 where t='a '; +count(*) +10 +select count(*) from t1 where v between 'a' and 'a '; +count(*) +10 +select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +count(*) +10 +select count(*) from t1 where v like 'a%'; +count(*) +11 +select count(*) from t1 where c like 'a%'; +count(*) +11 +select count(*) from t1 where t like 'a%'; +count(*) +11 +select count(*) from t1 where v like 'a %'; +count(*) +9 +explain select count(*) from t1 where v='a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 13 const # Using where; Using index +explain select count(*) from t1 where c='a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref c c 11 const # Using where; Using index +explain select count(*) from t1 where t='a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref t t 13 const # Using where +explain select count(*) from t1 where v like 'a%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range v v 13 NULL # Using where; Using index +explain select count(*) from t1 where v between 'a' and 'a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 13 const # Using where; Using index +explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 13 const # Using where; Using index +alter table t1 add unique(v); +ERROR 23000: Duplicate entry '{ ' for key 'v_2' +show warnings; +Level Code Message +Error 1062 Duplicate entry 'v' for key 'v_2' +alter table t1 add key(v); +Warnings: +Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release +select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; +qq +*a*a*a* +*a *a*a * +*a *a*a * +*a *a*a * +*a *a*a * +*a *a*a * +*a *a*a * +*a *a*a * +*a *a*a * +*a *a*a * +explain select * from t1 where v='a'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v,v_2 # 13 const # # +select v,count(*) from t1 group by v limit 10; +v count(*) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select v,count(c) from t1 group by v limit 10; +v count(c) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select sql_big_result v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select sql_big_result v,count(c) from t1 group by v limit 10; +v count(c) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select c,count(*) from t1 group by c limit 10; +c count(*) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select c,count(t) from t1 group by c limit 10; +c count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select sql_big_result c,count(t) from t1 group by c limit 10; +c count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select t,count(*) from t1 group by t limit 10; +t count(*) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select t,count(t) from t1 group by t limit 10; +t count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select sql_big_result t,count(t) from t1 group by t limit 10; +t count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(300) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL, + KEY `c` (`c`), + KEY `t` (`t`(10)), + KEY `v` (`v`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select count(*) from t1 where v='a'; +count(*) +10 +select count(*) from t1 where v='a '; +count(*) +10 +select count(*) from t1 where v between 'a' and 'a '; +count(*) +10 +select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +count(*) +10 +select count(*) from t1 where v like 'a%'; +count(*) +11 +select count(*) from t1 where v like 'a %'; +count(*) +9 +explain select count(*) from t1 where v='a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 303 const # Using where; Using index +explain select count(*) from t1 where v like 'a%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range v v 303 NULL # Using where; Using index +explain select count(*) from t1 where v between 'a' and 'a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 303 const # Using where; Using index +explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 303 const # Using where; Using index +explain select * from t1 where v='a'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 303 const # # +select v,count(*) from t1 group by v limit 10; +v count(*) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select sql_big_result v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +alter table t1 drop key v, add key v (v(30)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(300) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL, + KEY `c` (`c`), + KEY `t` (`t`(10)), + KEY `v` (`v`(30)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select count(*) from t1 where v='a'; +count(*) +10 +select count(*) from t1 where v='a '; +count(*) +10 +select count(*) from t1 where v between 'a' and 'a '; +count(*) +10 +select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +count(*) +10 +select count(*) from t1 where v like 'a%'; +count(*) +11 +select count(*) from t1 where v like 'a %'; +count(*) +9 +explain select count(*) from t1 where v='a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 33 const # Using where +explain select count(*) from t1 where v like 'a%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range v v 33 NULL # Using where +explain select count(*) from t1 where v between 'a' and 'a '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 33 const # Using where +explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 33 const # Using where +explain select * from t1 where v='a'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref v v 33 const # # +select v,count(*) from t1 group by v limit 10; +v count(*) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select sql_big_result v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +alter table t1 modify v varchar(600), drop key v, add key v (v); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(600) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL, + KEY `c` (`c`), + KEY `t` (`t`(10)), + KEY `v` (`v`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select v,count(*) from t1 group by v limit 10; +v count(*) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +select sql_big_result v,count(t) from t1 group by v limit 10; +v count(t) +a 1 +a 10 +b 10 +c 10 +d 10 +e 10 +f 10 +g 10 +h 10 +i 10 +drop table t1; +create table t1 (a char(10), unique (a)); +insert into t1 values ('a '); +insert into t1 values ('a '); +ERROR 23000: Duplicate entry 'a' for key 'a' +alter table t1 modify a varchar(10); +insert into t1 values ('a '),('a '),('a '),('a '); +ERROR 23000: Duplicate entry 'a ' for key 'a' +insert into t1 values ('a '); +ERROR 23000: Duplicate entry 'a ' for key 'a' +insert into t1 values ('a '); +ERROR 23000: Duplicate entry 'a ' for key 'a' +insert into t1 values ('a '); +ERROR 23000: Duplicate entry 'a ' for key 'a' +update t1 set a='a ' where a like 'a%'; +select concat(a,'.') from t1; +concat(a,'.') +a . +update t1 set a='abc ' where a like 'a '; +select concat(a,'.') from t1; +concat(a,'.') +a . +update t1 set a='a ' where a like 'a %'; +select concat(a,'.') from t1; +concat(a,'.') +a . +update t1 set a='a ' where a like 'a '; +select concat(a,'.') from t1; +concat(a,'.') +a . +drop table t1; +create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5))); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `t` text DEFAULT NULL, + KEY `v` (`v`(5)), + KEY `c` (`c`(5)), + KEY `t` (`t`(5)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1 (v char(10) character set utf8); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1 (v varchar(10), c char(10)) row_format=fixed; +Warnings: +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=FIXED +insert into t1 values('a','a'),('a ','a '); +select concat('*',v,'*',c,'*') from t1; +concat('*',v,'*',c,'*') +*a*a* +*a *a* +drop table t1; +create table t1 (v varchar(65530), key(v(10))); +insert into t1 values(repeat('a',65530)); +select length(v) from t1 where v=repeat('a',65530); +length(v) +65530 +drop table t1; +create table t1(a int, b varchar(12), key ba(b, a)); +insert into t1 values (1, 'A'), (20, NULL); +explain select * from t1 where a=20 and b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index +select * from t1 where a=20 and b is null; +a b +20 NULL +drop table t1; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +create table t1 (v varchar(65530), key(v)); +Warnings: +Note 1071 Specified key was too long; max key length is 3072 bytes +drop table t1; +create table t1 (v varchar(65536)); +Warnings: +Note 1246 Converting column 'v' from VARCHAR to TEXT +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` mediumtext DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1 (v varchar(65530) character set utf8); +Warnings: +Note 1246 Converting column 'v' from VARCHAR to TEXT +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +SET sql_mode = default; +set default_storage_engine=MyISAM; +create table t1 (v varchar(16384)) engine=innodb; +drop table t1; +create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; +insert into t1 values ('8', '6'), ('4', '7'); +select min(a) from t1; +min(a) +4 +select min(b) from t1 where a='8'; +min(b) +6 +drop table t1; +CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; +insert into t1 (b) values (1); +replace into t1 (b) values (2), (1), (3); +select * from t1; +a b +3 1 +2 2 +4 3 +truncate table t1; +insert into t1 (b) values (1); +replace into t1 (b) values (2); +replace into t1 (b) values (1); +replace into t1 (b) values (3); +select * from t1; +a b +3 1 +2 2 +4 3 +drop table t1; +create table t1 (rowid int not null auto_increment, val int not null,primary +key (rowid), unique(val)) engine=innodb; +replace into t1 (val) values ('1'),('2'); +replace into t1 (val) values ('1'),('2'); +insert into t1 (val) values ('1'),('2'); +ERROR 23000: Duplicate entry '1' for key 'val' +select * from t1; +rowid val +3 1 +4 2 +drop table t1; +create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; +insert into t1 (val) values (1); +update t1 set a=2 where a=1; +insert into t1 (val) values (3); +select * from t1; +a val +2 1 +3 3 +insert into t1 values (2, 2); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +select * from t1; +a val +2 1 +3 3 +drop table t1; +CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB; +INSERT INTO t1 (GRADE) VALUES (151),(252),(343); +SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300; +GRADE +252 +SELECT GRADE FROM t1 WHERE GRADE= 151; +GRADE +151 +DROP TABLE t1; +create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb; +create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb; +insert into t2 values ('aa','cc'); +insert into t1 values ('aa','bb'),('aa','cc'); +delete t1 from t1,t2 where f1=f3 and f4='cc'; +select * from t1; +f1 f2 +drop table t1,t2; +CREATE TABLE t1 ( +id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +id INTEGER NOT NULL, +FOREIGN KEY (id) REFERENCES t1 (id) +) ENGINE=InnoDB; +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +id +1 +TRUNCATE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `test`.`t1` (`id`)) +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +id +1 +2 +DELETE FROM t1; +TRUNCATE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `test`.`t1` (`id`)) +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +id +3 +DROP TABLE t2; +TRUNCATE t1; +INSERT INTO t1 (id) VALUES (NULL); +SELECT * FROM t1; +id +1 +DROP TABLE t1; +CREATE TABLE t1 +( +id INT PRIMARY KEY +) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 +( +id INT NOT NULL PRIMARY KEY, +b INT, +FOREIGN KEY (b) REFERENCES test.t1(id) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t1; +create table t1 (col1 varchar(2000), index (col1(767))) +character set = latin1 engine = innodb; +create table t2 (col1 char(255), index (col1)) +character set = latin1 engine = innodb; +create table t3 (col1 binary(255), index (col1)) +character set = latin1 engine = innodb; +create table t4 (col1 varchar(767), index (col1)) +character set = latin1 engine = innodb; +create table t5 (col1 varchar(767) primary key) +character set = latin1 engine = innodb; +create table t6 (col1 varbinary(767) primary key) +character set = latin1 engine = innodb; +create table t7 (col1 text, index(col1(767))) +character set = latin1 engine = innodb; +create table t8 (col1 blob, index(col1(767))) +character set = latin1 engine = innodb; +create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) +character set = latin1 engine = innodb; +show create table t9; +Table Create Table +t9 CREATE TABLE `t9` ( + `col1` varchar(512) DEFAULT NULL, + `col2` varchar(512) DEFAULT NULL, + KEY `col1` (`col1`,`col2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; +CREATE TABLE t1 +( +id INT PRIMARY KEY +) ENGINE=InnoDB; +CREATE TABLE t2 +( +v INT, +CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id) +) ENGINE=InnoDB; +INSERT INTO t2 VALUES(2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1); +DELETE FROM t1 WHERE id = 1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) +DROP TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) +SET FOREIGN_KEY_CHECKS=0; +DROP TABLE t1; +SET FOREIGN_KEY_CHECKS=1; +INSERT INTO t2 VALUES(3); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) +DROP TABLE t2; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; +insert into t1 values (1),(2); +set autocommit=0; +checksum table t1; +Table Checksum +test.t1 1531596814 +connection b; +insert into t1 values(3); +connection a; +checksum table t1; +Table Checksum +test.t1 1531596814 +connection a; +commit; +checksum table t1; +Table Checksum +test.t1 2050879373 +commit; +drop table t1; +connection a; +create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; +insert into t1 values (1),(2); +set autocommit=1; +checksum table t1; +Table Checksum +test.t1 1531596814 +connection b; +set autocommit=1; +insert into t1 values(3); +connection a; +checksum table t1; +Table Checksum +test.t1 2050879373 +drop table t1; +connection default; +disconnect a; +disconnect b; +set foreign_key_checks=0; +create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; +create table t1(a char(10) primary key, b varchar(20)) engine = innodb; +set foreign_key_checks=1; +insert into t2 values (1,1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`)) +set foreign_key_checks=0; +drop table t1; +set foreign_key_checks=1; +insert into t2 values (1,1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`)) +create table t1(a char(10) primary key, b varchar(20)) engine = innodb; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +drop table t2; +create table t1(a char(10) primary key, b varchar(20)) engine = innodb; +drop table t1; +set foreign_key_checks=0; +create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; +create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +set foreign_key_checks=1; +drop table t1; +set foreign_key_checks=0; +create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; +create table t1(a varchar(10) primary key) engine = innodb; +alter table t1 modify column a int; +ERROR HY000: Cannot change column 'a': used in a foreign key constraint 't2_ibfk_1' of table 'test.t2' +set foreign_key_checks=1; +drop table t2,t1; +set foreign_key_checks=0; +create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; +create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; +alter table t1 convert to character set utf8; +ERROR HY000: Cannot change column 'a': used in a foreign key constraint 't2_ibfk_1' of table 'test.t2' +set foreign_key_checks=1; +drop table t2,t1; +call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition."); +set foreign_key_checks=0; +create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; +create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; +rename table t3 to t1; +ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed") +set foreign_key_checks=1; +drop table t2,t3; +create table t1(a int primary key) row_format=redundant engine=innodb; +create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb; +create table t3(a int primary key) row_format=compact engine=innodb; +create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb; +insert into t1 values(1); +insert into t3 values(1); +insert into t2 values(2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) +insert into t4 values(2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`)) +insert into t2 values(1); +insert into t4 values(1); +update t1 set a=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) +update t2 set a=2; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) +update t3 set a=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`)) +update t4 set a=2; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`)) +truncate t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)) +truncate t3; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t3` (`a`)) +truncate t2; +truncate t4; +truncate t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)) +truncate t3; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t3` (`a`)) +drop table t4,t3,t2,t1; +create table t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +key (a,b,c,d)) engine=innodb; +drop table t1; +create table t1 (a varchar(255) character set utf8, +b varchar(255) character set utf8, +c varchar(255) character set utf8, +d varchar(255) character set utf8, +e varchar(255) character set utf8, +key (a,b,c,d,e)) engine=innodb; +ERROR 42000: Specified key was too long; max key length is 3072 bytes +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb; +create table t2 (s1 binary(2),primary key (s1)) engine=innodb; +create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; +create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; +insert into t1 values (0x41),(0x4120),(0x4100); +insert into t2 values (0x41),(0x4120),(0x4100); +ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' +insert into t2 values (0x41),(0x4120); +insert into t3 values (0x41),(0x4120),(0x4100); +ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY' +insert into t3 values (0x41),(0x4100); +insert into t4 values (0x41),(0x4120),(0x4100); +ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' +insert into t4 values (0x41),(0x4100); +select hex(s1) from t1; +hex(s1) +41 +4100 +4120 +select hex(s1) from t2; +hex(s1) +4100 +4120 +select hex(s1) from t3; +hex(s1) +4100 +41 +select hex(s1) from t4; +hex(s1) +4100 +41 +drop table t1,t2,t3,t4; +create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb; +create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; +insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42); +insert into t2 values(0x42); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +insert into t2 values(0x41); +select hex(s1) from t2; +hex(s1) +4100 +update t1 set s1=0x123456 where a=2; +select hex(s1) from t2; +hex(s1) +4100 +update t1 set s1=0x12 where a=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +update t1 set s1=0x12345678 where a=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +update t1 set s1=0x123457 where a=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +update t1 set s1=0x1220 where a=1; +select hex(s1) from t2; +hex(s1) +1220 +update t1 set s1=0x1200 where a=1; +select hex(s1) from t2; +hex(s1) +1200 +update t1 set s1=0x4200 where a=1; +select hex(s1) from t2; +hex(s1) +4200 +delete from t1 where a=1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +delete from t1 where a=2; +update t2 set s1=0x4120; +delete from t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +delete from t1 where a!=3; +select a,hex(s1) from t1; +a hex(s1) +3 4120 +select hex(s1) from t2; +hex(s1) +4120 +drop table t2,t1; +create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb; +create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; +insert into t1 values(1,0x4100),(2,0x41); +insert into t2 values(0x41); +select hex(s1) from t2; +hex(s1) +41 +update t1 set s1=0x1234 where a=1; +select hex(s1) from t2; +hex(s1) +41 +update t1 set s1=0x12 where a=2; +select hex(s1) from t2; +hex(s1) +12 +delete from t1 where a=1; +delete from t1 where a=2; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +select a,hex(s1) from t1; +a hex(s1) +2 12 +select hex(s1) from t2; +hex(s1) +12 +drop table t2,t1; +CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + KEY `t2_ibfk_0` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2,t1; +SET sql_mode = default; +CREATE TABLE t1 ( +field1 varchar(8) NOT NULL DEFAULT '', +field2 varchar(8) NOT NULL DEFAULT '', +PRIMARY KEY (field1, field2) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY, +FOREIGN KEY (field1) REFERENCES t1 (field1) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('old', 'somevalu'); +INSERT INTO t1 VALUES ('other', 'anyvalue'); +INSERT INTO t2 VALUES ('old'); +INSERT INTO t2 VALUES ('other'); +UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu'; +ERROR 23000: Foreign key constraint for table 't1', record 'other-somevalu' would lead to a duplicate entry in table 't2', key 'PRIMARY' +DROP TABLE t2; +DROP TABLE t1; +create table t1 ( +c1 bigint not null, +c2 bigint not null, +primary key (c1), +unique key (c2) +) engine=innodb; +create table t2 ( +c1 bigint not null, +primary key (c1) +) engine=innodb; +alter table t1 add constraint c2_fk foreign key (c2) +references t2(c1) on delete cascade; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL, + `c2` bigint(20) NOT NULL, + PRIMARY KEY (`c1`), + UNIQUE KEY `c2` (`c2`), + CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 drop foreign key c2_fk; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL, + `c2` bigint(20) NOT NULL, + PRIMARY KEY (`c1`), + UNIQUE KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1, t2; +create table t1(a date) engine=innodb; +create table t2(a date, key(a)) engine=innodb; +insert into t1 values('2005-10-01'); +insert into t2 values('2005-10-01'); +select * from t1, t2 +where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; +a a +2005-10-01 2005-10-01 +drop table t1, t2; +create table t1 (id int not null, f_id int not null, f int not null, +primary key(f_id, id)) engine=innodb; +create table t2 (id int not null,s_id int not null,s varchar(200), +primary key(id)) engine=innodb; +INSERT INTO t1 VALUES (8, 1, 3); +INSERT INTO t1 VALUES (1, 2, 1); +INSERT INTO t2 VALUES (1, 0, ''); +INSERT INTO t2 VALUES (8, 1, ''); +commit; +DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) +WHERE mm.id IS NULL; +select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) +where mm.id is null lock in share mode; +id f_id f +drop table t1,t2; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); +commit; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +update t1 set b = 5 where b = 1; +connection b; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +select * from t1 where a = 7 and b = 3 for update; +a b +7 3 +connection a; +commit; +connection b; +commit; +drop table t1; +connection default; +disconnect a; +disconnect b; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); +commit; +set autocommit = 0; +select * from t1 lock in share mode; +a b +1 1 +2 2 +3 1 +4 2 +5 1 +6 2 +update t1 set b = 5 where b = 1; +connection b; +set autocommit = 0; +select * from t1 where a = 2 and b = 2 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection a; +commit; +connection b; +commit; +connection default; +disconnect a; +disconnect b; +drop table t1; +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(d int not null, e int, primary key(d)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +d e +3 1 +8 6 +12 1 +connection b; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +insert into t1 select * from t2; +update t1 set b = (select e from t2 where a = d); +create table t3(d int not null, e int, primary key(d)) engine=innodb +select * from t2; +commit; +connection a; +commit; +connection default; +disconnect a; +disconnect b; +drop table t1, t2, t3; +connect a,localhost,root,,; +connect b,localhost,root,,; +connect c,localhost,root,,; +connect d,localhost,root,,; +connect e,localhost,root,,; +connect f,localhost,root,,; +connect g,localhost,root,,; +connect h,localhost,root,,; +connect i,localhost,root,,; +connect j,localhost,root,,; +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(a int not null, b int, primary key(a)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +create table t3(d int not null, b int, primary key(d)) engine=innodb; +insert into t3 values (8,6),(12,1),(3,1); +create table t5(a int not null, b int, primary key(a)) engine=innodb; +insert into t5 values (1,2),(5,3),(4,2); +create table t6(d int not null, e int, primary key(d)) engine=innodb; +insert into t6 values (8,6),(12,1),(3,1); +create table t8(a int not null, b int, primary key(a)) engine=innodb; +insert into t8 values (1,2),(5,3),(4,2); +create table t9(d int not null, e int, primary key(d)) engine=innodb; +insert into t9 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +a b +3 1 +8 6 +12 1 +connection b; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +insert into t1 select * from t2; +connection c; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +update t3 set b = (select b from t2 where a = d); +connection d; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; +connection e; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +insert into t5 (select * from t2 lock in share mode); +connection f; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +update t6 set e = (select b from t2 where a = d lock in share mode); +connection g; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; +connection h; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +insert into t8 (select * from t2 for update); +connection i; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +update t9 set e = (select b from t2 where a = d for update); +connection j; +SET binlog_format='MIXED'; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; +connection b; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection c; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection d; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection e; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection f; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection g; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection h; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection i; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection j; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection a; +commit; +connection default; +disconnect a; +disconnect b; +disconnect c; +disconnect d; +disconnect e; +disconnect f; +disconnect g; +disconnect h; +disconnect i; +disconnect j; +drop table t1, t2, t3, t5, t6, t8, t9; +CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; +ERROR 42000: Incorrect column name 'DB_ROW_ID' +CREATE TABLE t1 ( +a BIGINT(20) NOT NULL, +PRIMARY KEY (a) +) ENGINE=INNODB DEFAULT CHARSET=UTF8; +CREATE TABLE t2 ( +a BIGINT(20) NOT NULL, +b VARCHAR(128) NOT NULL, +c TEXT NOT NULL, +PRIMARY KEY (a,b), +KEY idx_t2_b_c (b,c(100)), +CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) +ON DELETE CASCADE +) ENGINE=INNODB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1, 'bar', 'vbar'); +INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR'); +INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi'); +INSERT INTO t2 VALUES (1, 'customer_over', '1'); +SELECT * FROM t2 WHERE b = 'customer_over'; +a b c +1 customer_over 1 +SELECT * FROM t2 WHERE BINARY b = 'customer_over'; +a b c +1 customer_over 1 +SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over'; +a +1 +/* Bang: Empty result set, above was expected: */ +SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; +a +1 +SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; +a +1 +drop table t2, t1; +CREATE TABLE t1 ( a int ) ENGINE=innodb; +BEGIN; +INSERT INTO t1 VALUES (1); +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +DROP TABLE t1; +CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB; +CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL, +CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id) +ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON +DELETE CASCADE ON UPDATE CASCADE; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `f` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `f` (`f`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2, t1; +CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB; +CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; +set @old_sql_mode = @@sql_mode; +set @@sql_mode = 'STRICT_TRANS_TABLES'; +ALTER TABLE t2 MODIFY a INT NOT NULL; +ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +set @@sql_mode = @old_sql_mode; +DELETE FROM t1; +DROP TABLE t2,t1; +CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4); +DELETE FROM t1; +INSERT INTO t1 VALUES ('DDD'); +SELECT * FROM t1; +a +DDD +DROP TABLE t1; +CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB +AUTO_INCREMENT=42; +INSERT INTO t1 VALUES (0),(347),(0); +SELECT * FROM t1; +id +42 +347 +348 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t2 VALUES(42),(347),(348); +ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1,t2; +SET innodb_strict_mode=ON; +CREATE TABLE t1 ( +c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), +c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255), +c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), +c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), +c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), +c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), +c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) +) ENGINE = InnoDB; +ERROR 42000: Row size too large (> {checked_valid}). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +SET innodb_strict_mode=OFF; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1( +id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY +) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-10); +SELECT * FROM t1; +id +-10 +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +id +-10 +1 +DROP TABLE t1; +CONNECT c1,localhost,root,,; +CONNECT c2,localhost,root,,; +connection c1; +SET binlog_format='MIXED'; +SET TX_ISOLATION='read-committed'; +SET AUTOCOMMIT=0; +DROP TABLE IF EXISTS t1, t2; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2' +CREATE TABLE t1 ( a int ) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +SELECT * FROM t2; +a +connection c2; +SET binlog_format='MIXED'; +SET TX_ISOLATION='read-committed'; +SET AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +COMMIT; +connection c1; +SELECT * FROM t1 WHERE a=1; +a +1 +disconnect c1; +disconnect c2; +CONNECT c1,localhost,root,,; +CONNECT c2,localhost,root,,; +connection c1; +SET binlog_format='MIXED'; +SET TX_ISOLATION='read-committed'; +SET AUTOCOMMIT=0; +SELECT * FROM t2; +a +connection c2; +SET binlog_format='MIXED'; +SET TX_ISOLATION='read-committed'; +SET AUTOCOMMIT=0; +INSERT INTO t1 VALUES (2); +COMMIT; +connection c1; +SELECT * FROM t1 WHERE a=2; +a +2 +SELECT * FROM t1 WHERE a=2; +a +2 +DROP TABLE t1; +DROP TABLE t2; +disconnect c1; +disconnect c2; +connection default; +create table t1 (i int, j int) engine=innodb; +insert into t1 (i, j) values (1, 1), (2, 2); +update t1 set j = 2; +affected rows: 1 +info: Rows matched: 2 Changed: 1 Warnings: 0 +drop table t1; +create table t1 (id int) comment='this is a comment' engine=innodb; +select table_comment, data_free > 0 as data_free_is_set +from information_schema.tables +where table_schema='test' and table_name = 't1'; +table_comment data_free_is_set +this is a comment 1 +drop table t1; +connection default; +CREATE TABLE t1 ( +c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +c2 VARCHAR(128) NOT NULL, +PRIMARY KEY(c1) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100; +CREATE TABLE t2 ( +c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +c2 INT(10) UNSIGNED DEFAULT NULL, +PRIMARY KEY(c1) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200; +SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; +AUTO_INCREMENT +200 +ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1); +SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; +AUTO_INCREMENT +200 +DROP TABLE t2; +DROP TABLE t1; +connection default; +CREATE TABLE t1 (c1 int default NULL, +c2 int default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +TRUNCATE TABLE t1; +affected rows: 0 +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +TRUNCATE TABLE t1; +affected rows: 0 +DROP TABLE t1; +Variable_name Value +Handler_update 0 +Variable_name Value +Handler_delete 0 +Variable_name Value +Handler_update 1 +Variable_name Value +Handler_delete 1 +DROP TABLE bug58912; +create table t1 (f1 integer primary key) engine=innodb; +flush status; +show status like "handler_read_key"; +Variable_name Value +Handler_read_key 0 +select f1 from t1; +f1 +show status like "handler_read_key"; +Variable_name Value +Handler_read_key 3 +drop table t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB; +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(0); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction +ROLLBACK; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 +START TRANSACTION READ ONLY; +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction +INSERT INTO t2 VALUES(1); +COMMIT; +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction +COMMIT; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 +1 +3 +DROP TABLE t2; +CREATE TEMPORARY TABLE t2 ( +c1 INT AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction +ROLLBACK; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 c2 +START TRANSACTION READ ONLY; +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +COMMIT; +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction +COMMIT; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 c2 +4 1 +7 1 +5 2 +8 2 +6 3 +9 3 +DROP TABLE t1; +DROP TABLE t2; +# +# MDEV-24748 Extern field check missing +# in btr_index_rec_validate() +# +CREATE TABLE t1 (pk INT, c1 char(255), +c2 char(255), c3 char(255), c4 char(255), +c5 char(255), c6 char(255), c7 char(255), +c8 char(255), primary key (pk) +) CHARACTER SET utf32 ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'), +(2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 FORCE; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_28867993.result b/mysql-test/suite/innodb/r/innodb_28867993.result new file mode 100644 index 00000000..493d3ef0 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_28867993.result @@ -0,0 +1,10 @@ +create table t1 (a int) engine=innodb; +insert t1 values (1),(2); +create database ib_logfile2; +# restart +select * from t1; +a +1 +2 +drop table t1; +drop database ib_logfile2; diff --git a/mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result b/mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result new file mode 100644 index 00000000..3d016684 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result @@ -0,0 +1,39 @@ +drop table if exists t1; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +ggid varchar(32) binary DEFAULT '' NOT NULL, +email varchar(64) DEFAULT '' NOT NULL, +passwd varchar(32) binary DEFAULT '' NOT NULL, +PRIMARY KEY (id), +UNIQUE ggid (ggid) +) ENGINE=innodb; +insert into t1 (ggid,passwd) values ('test1','xxx'); +insert into t1 (ggid,passwd) values ('test2','yyy'); +insert into t1 (ggid,passwd) values ('test2','this will fail'); +ERROR 23000: Duplicate entry 'test2' for key 'ggid' +insert into t1 (ggid,id) values ('this will fail',1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t1 where ggid='test1'; +id ggid email passwd +1 test1 xxx +select * from t1 where passwd='xxx'; +id ggid email passwd +1 test1 xxx +select * from t1 where id=2; +id ggid email passwd +2 test2 yyy +replace into t1 (ggid,id) values ('this will work',1); +replace into t1 (ggid,passwd) values ('test2','this will work'); +update t1 set id=100,ggid='test2' where id=1; +ERROR 23000: Duplicate entry 'test2' for key 'ggid' +select * from t1; +id ggid email passwd +1 this will work +3 test2 this will work +select * from t1 where id=1; +id ggid email passwd +1 this will work +select * from t1 where id=999; +id ggid email passwd +drop table t1; +End of tests diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result new file mode 100644 index 00000000..fa17487d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result @@ -0,0 +1,19 @@ +CREATE TABLE tab5 (col1 int auto_increment primary key, +col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB; +CREATE INDEX idx1 ON tab5(col2(10)); +CREATE INDEX idx2 ON tab5(col3(10)); +SET GLOBAL innodb_buffer_pool_dump_pct=100; +SELECT variable_value INTO @IBPDS +FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'; +SET GLOBAL innodb_buffer_pool_dump_now=ON; +SET GLOBAL innodb_buffer_pool_dump_pct=1; +SELECT @@global.innodb_buffer_pool_dump_pct; +@@global.innodb_buffer_pool_dump_pct +1 +SELECT variable_value INTO @IBPDS +FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'; +SET GLOBAL innodb_buffer_pool_dump_now=ON; +SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT; +DROP TABLE tab5; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result new file mode 100644 index 00000000..9879ef20 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result @@ -0,0 +1,8 @@ +call mtr.add_suppression("InnoDB: Cannot allocate memory for the buffer pool"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc.*"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +# +# MDEV-25019 memory allocation failures during startup cause server failure in different, confusing ways +# +# restart: --debug_dbug=+d,ib_buf_chunk_init_fails diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result new file mode 100644 index 00000000..6ecf6035 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result @@ -0,0 +1,52 @@ +SET GLOBAL innodb_buffer_pool_dump_pct=100; +CREATE TABLE ib_bp_test +(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) +ENGINE=INNODB; +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +3 +4 +SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; +INSERT INTO ib_bp_test +SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382; +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +COUNT(*) +596 +SET GLOBAL innodb_buffer_pool_dump_now = ON; +SET GLOBAL innodb_fast_shutdown=0; +# restart +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +select count(*) from ib_bp_test LIMIT 0; +count(*) +SET GLOBAL innodb_buffer_pool_load_now = ON; +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +variable_value +Buffer pool(s) load completed at TIMESTAMP_NOW +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +COUNT(*) +596 +call mtr.add_suppression("InnoDB: Error parsing"); +SET GLOBAL innodb_buffer_pool_load_now = ON; +# Re-write some valid pages to the dump file, make sure the space +# should be valid but all the page no should be out of bound of the file +# restart +SET GLOBAL innodb_buffer_pool_load_now = ON; +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +variable_value +Buffer pool(s) load completed at TIMESTAMP_NOW +DROP TABLE ib_bp_test; +SET GLOBAL innodb_buffer_pool_dump_pct=default; +# +# Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS +# +SET GLOBAL innodb_buffer_pool_load_now = ON; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result new file mode 100644 index 00000000..cafa3f45 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result @@ -0,0 +1,32 @@ +set global innodb_adaptive_hash_index=ON; +select @@innodb_buffer_pool_size; +@@innodb_buffer_pool_size +8388608 +set global innodb_buffer_pool_size = 10485760; +select @@innodb_buffer_pool_size; +@@innodb_buffer_pool_size +10485760 +create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +create or replace view view0 as select 1 union all select 1; +set @`v_id` := 0; +set @`v_val` := 0; +replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; +set global innodb_buffer_pool_size = 64 * 1024 * 1024 + 512 * 1024; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '67633152' +select @@innodb_buffer_pool_size; +@@innodb_buffer_pool_size +68157440 +select count(val) from t1; +count(val) +262144 +set global innodb_adaptive_hash_index=OFF; +set global innodb_buffer_pool_size = 25165824; +select @@innodb_buffer_pool_size; +@@innodb_buffer_pool_size +25165824 +select count(val) from t1; +count(val) +262144 +drop table t1; +drop view view0; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result new file mode 100644 index 00000000..d6b29060 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result @@ -0,0 +1,14 @@ +SET @save_size=@@innodb_buffer_pool_size; +# +# MDEV-27891: Delayed SIGSEGV in InnoDB buffer pool resize +# after or during DROP TABLE +# +select @@innodb_buffer_pool_chunk_size; +@@innodb_buffer_pool_chunk_size +1048576 +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL innodb_buffer_pool_size=256*1024*1024; +DROP TABLE t1; +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + @@innodb_buffer_pool_chunk_size; +# End of 10.6 tests +SET GLOBAL innodb_buffer_pool_size=@save_size; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result new file mode 100644 index 00000000..43d48023 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result @@ -0,0 +1,13 @@ +SET @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; +SET @save_size=@@GLOBAL.innodb_buffer_pool_size; +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +SET GLOBAL innodb_buffer_pool_size=16777216; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 SELECT seq FROM seq_1_to_200; +SET GLOBAL innodb_buffer_pool_size=8388608; +SELECT COUNT(*),MIN(a),MAX(a) FROM t1; +COUNT(*) MIN(a) MAX(a) +200 1 200 +DROP TEMPORARY TABLE t1; +SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; +SET GLOBAL innodb_buffer_pool_size=@save_size; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result new file mode 100644 index 00000000..efb65209 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result @@ -0,0 +1,26 @@ +select @@innodb_buffer_pool_chunk_size; +@@innodb_buffer_pool_chunk_size +4194304 +create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +create or replace view view0 as select 1 union all select 1; +set @`v_id` := 0; +set @`v_val` := 0; +replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; +set global innodb_buffer_pool_size = 7340032; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '7340032' +select count(val) from t1; +count(val) +262144 +set global innodb_buffer_pool_size = 16777216; +select count(val) from t1; +count(val) +262144 +drop table t1; +drop view view0; +set global innodb_buffer_pool_size = 2*1048576; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '2097152' +select @@innodb_buffer_pool_size; +@@innodb_buffer_pool_size +4194304 diff --git a/mysql-test/suite/innodb/r/innodb_bug11754376.result b/mysql-test/suite/innodb/r/innodb_bug11754376.result new file mode 100644 index 00000000..650dfbb3 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result @@ -0,0 +1,5 @@ +CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; +SET @saved_dbug = @@SESSION.debug_dbug; +SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low'; +DROP TABLE bug11754376; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_bug12400341.result b/mysql-test/suite/innodb/r/innodb_bug12400341.result new file mode 100644 index 00000000..f4114595 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug12400341.result @@ -0,0 +1,18 @@ +call mtr.add_suppression("\\[Warning\\] InnoDB: Cannot find a free slot for an undo log. Do you have too"); +drop database if exists mysqltest; +create database mysqltest; +CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB; +select count(*) from information_schema.processlist where command != 'Daemon'; +count(*) +33 +connection default; +CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB; +ERROR HY000: Can't create table `mysqltest`.`testtable` (errno: 177 "Too many active concurrent transactions") +select count(*) from information_schema.processlist where command != 'Daemon'; +count(*) +33 +connection default; +select count(*) from information_schema.processlist where command != 'Daemon'; +count(*) +33 +drop database mysqltest; diff --git a/mysql-test/suite/innodb/r/innodb_bug12661768.result b/mysql-test/suite/innodb/r/innodb_bug12661768.result new file mode 100644 index 00000000..7a545395 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug12661768.result @@ -0,0 +1,2 @@ +SET SESSION foreign_key_checks=0; +ERROR 23000: Foreign key constraint for table 'bug12661768_1', record '3-bbb' would lead to a duplicate entry in table 'bug12661768_2', key 'ab_on_2' diff --git a/mysql-test/suite/innodb/r/innodb_bug12902967.result b/mysql-test/suite/innodb/r/innodb_bug12902967.result new file mode 100644 index 00000000..ddb2e12f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug12902967.result @@ -0,0 +1,6 @@ +call mtr.add_suppression("In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition."); +# restart +create table t1 (f1 integer primary key) engine innodb; +alter table t1 add constraint c1 foreign key (f1) references t1(f1); +ERROR HY000: Error on rename of '#sql-alter' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed") +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug13510739.result b/mysql-test/suite/innodb/r/innodb_bug13510739.result new file mode 100644 index 00000000..e1e6e272 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug13510739.result @@ -0,0 +1,10 @@ +CREATE TABLE bug13510739 (c INTEGER NOT NULL, PRIMARY KEY (c)) ENGINE=INNODB; +INSERT INTO bug13510739 VALUES (1), (2), (3), (4); +DELETE FROM bug13510739 WHERE c=2; +HANDLER bug13510739 OPEN; +HANDLER bug13510739 READ `primary` = (2); +c +HANDLER bug13510739 READ `primary` NEXT; +c +3 +DROP TABLE bug13510739; diff --git a/mysql-test/suite/innodb/r/innodb_bug14007649.result b/mysql-test/suite/innodb/r/innodb_bug14007649.result new file mode 100644 index 00000000..a20dde79 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug14007649.result @@ -0,0 +1,64 @@ +create table t1 ( +rowid int, +f1 int, +f2 int, +key i1 (f1, f2), +key i2 (f2)) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `rowid` int(11) DEFAULT NULL, + `f1` int(11) DEFAULT NULL, + `f2` int(11) DEFAULT NULL, + KEY `i1` (`f1`,`f2`), + KEY `i2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL); +connect a,localhost,root,,; +connect b,localhost,root,,; +connection a; +start transaction with consistent snapshot; +connection b; +start transaction; +update t1 set f2 = 4 where f1 = 1 and f2 is null; +(b) Number of rows updated: +select row_count(); +row_count() +1 +insert into t1 values (3, 1, null); +(b) After update and insert query. +select rowid, f1, f2 from t1; +rowid f1 f2 +1 1 10 +2 1 4 +3 1 NULL +commit; +connection a; +(a) Before the update statement is executed. +select rowid, f1, f2 from t1; +rowid f1 f2 +1 1 10 +2 1 NULL +SET SESSION debug_dbug="+d,bug14007649"; +update t1 set f2 = 6 where f1 = 1 and f2 is null; +(a) Number of rows updated: +select row_count(); +row_count() +1 +(a) After the update statement is executed. +select rowid, f1, f2 from t1; +rowid f1 f2 +1 1 10 +2 1 NULL +3 1 6 +commit; +"The trx with consistent snapshot ended." +select rowid, f1, f2 from t1; +rowid f1 f2 +1 1 10 +2 1 4 +3 1 6 +connection default; +disconnect a; +disconnect b; +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug14147491.result b/mysql-test/suite/innodb/r/innodb_bug14147491.result new file mode 100644 index 00000000..9d2b8e1d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug14147491.result @@ -0,0 +1,20 @@ +# Ensure that purge will not crash on the table after we corrupt it. +SET GLOBAL innodb_fast_shutdown=0; +# Create and populate the table to be corrupted +set global innodb_file_per_table=ON; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; +INSERT INTO t1 (b) VALUES ('corrupt me'); +INSERT INTO t1 (b) VALUES ('corrupt me'); +# Corrupt the table +Munged a string. +Munged a string. +# restart +# Now t1 is corrupted but we should not crash +SELECT * FROM t1; +Got one of the listed errors +INSERT INTO t1(b) VALUES('abcdef'); +Got one of the listed errors +UPDATE t1 set b = 'deadbeef' where a = 1; +Got one of the listed errors +# Cleanup, this must be possible +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result new file mode 100644 index 00000000..738e152b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result @@ -0,0 +1,79 @@ +set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +set global innodb_limit_optimistic_insert_debug = 2; +insert into t1 values (1); +connect con5,localhost,root; +begin; +insert into t1 values (5); +connect con4,localhost,root; +begin; +insert into t1 values (4); +connection default; +insert into t1 values (3); +connect con2,localhost,root; +begin; +insert into t1 values (2); +connection default; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +10 +connection con4; +rollback; +disconnect con4; +connection default; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +8 +connection con5; +rollback; +disconnect con5; +connection default; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +4 +set global innodb_limit_optimistic_insert_debug = 10000; +connection con2; +rollback; +disconnect con2; +connection default; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +2 +begin; +insert into t1 values (2); +rollback; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +1 +begin; +insert into t1 values (2); +rollback; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +1 +drop table t1; +set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; diff --git a/mysql-test/suite/innodb/r/innodb_bug21704.result b/mysql-test/suite/innodb/r/innodb_bug21704.result new file mode 100644 index 00000000..4573a3b3 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug21704.result @@ -0,0 +1,89 @@ +# +# Bug#21704: Renaming column does not update FK definition. +# + +# Test that it's not possible to rename columns participating in a +# foreign key (either in the referencing or referenced table). + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB; +CREATE TABLE t2 (a INT PRIMARY KEY, b INT, +CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a)) +ROW_FORMAT=COMPACT ENGINE=INNODB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT, +CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a)) +ROW_FORMAT=COMPACT ENGINE=INNODB; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +INSERT INTO t2 VALUES (1,1),(2,2),(3,3); +INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3); + +# Test renaming the column in the referenced table. + +ALTER TABLE t1 CHANGE a e INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Ensure that online column rename works. +ALTER TABLE t1 CHANGE b c INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 + +# Test renaming the column in the referencing table + +ALTER TABLE t2 CHANGE a z INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Ensure that online column rename works. +ALTER TABLE t2 CHANGE b c INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 + +# Test with self-referential constraints + +ALTER TABLE t3 CHANGE a f INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t3 CHANGE b g INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Ensure that online column rename works. +ALTER TABLE t3 CHANGE c d INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 + +# Cleanup. + +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `e` int(11) NOT NULL, + `c` int(11) DEFAULT NULL, + PRIMARY KEY (`e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `z` int(11) NOT NULL, + `c` int(11) DEFAULT NULL, + PRIMARY KEY (`z`), + CONSTRAINT `fk1` FOREIGN KEY (`z`) REFERENCES `t1` (`e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `f` int(11) NOT NULL, + `g` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + PRIMARY KEY (`f`), + KEY `b` (`g`), + CONSTRAINT `fk2` FOREIGN KEY (`g`) REFERENCES `t3` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +SELECT f.*, c.* +FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS c +INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FOREIGN f +ON c.ID=f.ID +WHERE FOR_NAME LIKE 'test/t%'; +ID FOR_NAME REF_NAME N_COLS TYPE ID FOR_COL_NAME REF_COL_NAME POS +test/fk1 test/t2 test/t1 1 0 test/fk1 z e 0 +test/fk2 test/t3 test/t3 1 0 test/fk2 g f 0 +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug27216817.result b/mysql-test/suite/innodb/r/innodb_bug27216817.result new file mode 100644 index 00000000..0210ced9 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug27216817.result @@ -0,0 +1,24 @@ +create table t1 (a int not null, b int not null) engine=innodb; +insert t1 values (1,2),(3,4); +lock table t1 write, t1 tr read; +flush status; +alter table t1 add primary key (b); +show status like 'Handler_read_rnd_next'; +Variable_name Value +Handler_read_rnd_next 0 +unlock tables; +alter table t1 drop primary key; +lock table t1 write; +flush status; +alter table t1 add primary key (b); +show status like 'Handler_read_rnd_next'; +Variable_name Value +Handler_read_rnd_next 0 +unlock tables; +alter table t1 drop primary key; +flush status; +alter table t1 add primary key (b); +show status like 'Handler_read_rnd_next'; +Variable_name Value +Handler_read_rnd_next 0 +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug30113362.result b/mysql-test/suite/innodb/r/innodb_bug30113362.result new file mode 100644 index 00000000..cb0f5091 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug30113362.result @@ -0,0 +1,122 @@ +SET GLOBAL innodb_adaptive_hash_index = false; +SET GLOBAL innodb_stats_persistent = false; +connect purge_control,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect con2,localhost,root,,; +CREATE TABLE t1 ( +a00 CHAR(255) NOT NULL DEFAULT 'a', +a01 CHAR(255) NOT NULL DEFAULT 'a', +a02 CHAR(255) NOT NULL DEFAULT 'a', +b INT NOT NULL DEFAULT 0, +PRIMARY KEY(a00, a01, a02) +) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45'; +SET GLOBAL innodb_limit_optimistic_insert_debug = 3; +CREATE PROCEDURE data_load_t1() +BEGIN +DECLARE c1 INT DEFAULT 97; +DECLARE c2 INT DEFAULT 97; +DECLARE c3 INT DEFAULT 97; +WHILE c1 < 102 DO +WHILE c2 < 123 DO +WHILE c3 < 123 DO +INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3)); +SET c3 = c3 + 1; +END WHILE; +SET c3 = 97; +SET c2 = c2 + 1; +END WHILE; +SET c2 = 97; +SET c1 = c1 + 1; +END WHILE; +END | +call data_load_t1(); +DROP PROCEDURE data_load_t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +1856 +connection con2; +DELETE FROM t1 WHERE a00 = 'cnm'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'cnm'; +connection purge_control; +COMMIT; +connection con2; +SET GLOBAL innodb_limit_optimistic_insert_debug = 0; +ROLLBACK; +# Test start +connection purge_control; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection con2; +DELETE FROM t1 WHERE a00 = 'bii'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'bii'; +SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2'; +SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume'; +ROLLBACK; +connection purge_control; +SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait'; +COMMIT; +SET DEBUG_SYNC = 'now SIGNAL roll2'; +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +SELECT a00 FROM t1 WHERE a00 = 'bii'; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +SET DEBUG_SYNC = 'now SIGNAL resume'; +connection con1; +a00 +connection con2; +connection default; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +1856 +DELETE FROM t1 WHERE a00 = 'dpn'; +COMMIT; +INSERT INTO t1 SET a00 = 'dpn'; +ROLLBACK; +ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35'; +connection purge_control; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection con2; +DELETE FROM t1 WHERE a00 = 'cnd'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'cnd'; +SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2'; +SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2'; +ROLLBACK; +connection purge_control; +SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait'; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SET DEBUG_SYNC = 'now SIGNAL roll2'; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +SET DEBUG_SYNC = 'now SIGNAL resume'; +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +disconnect purge_control; +connection default; +SET DEBUG_SYNC = 'now SIGNAL resume'; +disconnect con1; +connection con2; +disconnect con2; +connection default; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +1856 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug30423.result b/mysql-test/suite/innodb/r/innodb_bug30423.result new file mode 100644 index 00000000..78604137 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug30423.result @@ -0,0 +1,106 @@ +set global innodb_stats_method = default; +select @@innodb_stats_method; +@@innodb_stats_method +nulls_equal +select count(*) from bug30243_3 where org_id is not NULL; +count(*) +20 +select count(*) from bug30243_3 where org_id is NULL; +count(*) +16384 +select count(*) from bug30243_2 where org_id is not NULL; +count(*) +224 +select count(*) from bug30243_2 where org_id is NULL; +count(*) +65536 +select @@innodb_stats_method; +@@innodb_stats_method +nulls_equal +analyze table bug30243_1; +Table Op Msg_type Msg_text +test.bug30243_1 analyze status Engine-independent statistics collected +test.bug30243_1 analyze status OK +analyze table bug30243_2; +Table Op Msg_type Msg_text +test.bug30243_2 analyze status Engine-independent statistics collected +test.bug30243_2 analyze status OK +analyze table bug30243_3; +Table Op Msg_type Msg_text +test.bug30243_3 analyze status Engine-independent statistics collected +test.bug30243_3 analyze status OK +set global innodb_stats_method = "NULL"; +ERROR 42000: Variable 'innodb_stats_method' can't be set to the value of 'NULL' +set global innodb_stats_method = "nulls_ignored"; +select @@innodb_stats_method; +@@innodb_stats_method +nulls_ignored +analyze table bug30243_1; +Table Op Msg_type Msg_text +test.bug30243_1 analyze status Engine-independent statistics collected +test.bug30243_1 analyze status OK +analyze table bug30243_2; +Table Op Msg_type Msg_text +test.bug30243_2 analyze status Engine-independent statistics collected +test.bug30243_2 analyze status OK +analyze table bug30243_3; +Table Op Msg_type Msg_text +test.bug30243_3 analyze status Engine-independent statistics collected +test.bug30243_3 analyze status OK +explain SELECT COUNT(*), 0 +FROM bug30243_1 orgs +LEFT JOIN bug30243_3 sa_opportunities +ON orgs.org_id=sa_opportunities.org_id +LEFT JOIN bug30243_2 contacts +ON orgs.org_id=contacts.org_id ; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orgs index NULL org_id 4 NULL ROWS Using index +1 SIMPLE sa_opportunities ref org_id org_id 5 test.orgs.org_id ROWS Using index +1 SIMPLE contacts ref contacts$org_id contacts$org_id 5 test.orgs.org_id ROWS Using index +select @@innodb_stats_method; +@@innodb_stats_method +nulls_ignored +set global innodb_stats_method = "nulls_unequal"; +select @@innodb_stats_method; +@@innodb_stats_method +nulls_unequal +analyze table bug30243_1; +Table Op Msg_type Msg_text +test.bug30243_1 analyze status Engine-independent statistics collected +test.bug30243_1 analyze status OK +analyze table bug30243_2; +Table Op Msg_type Msg_text +test.bug30243_2 analyze status Engine-independent statistics collected +test.bug30243_2 analyze status OK +analyze table bug30243_3; +Table Op Msg_type Msg_text +test.bug30243_3 analyze status Engine-independent statistics collected +test.bug30243_3 analyze status OK +explain SELECT COUNT(*), 0 +FROM bug30243_1 orgs +LEFT JOIN bug30243_3 sa_opportunities +ON orgs.org_id=sa_opportunities.org_id +LEFT JOIN bug30243_2 contacts +ON orgs.org_id=contacts.org_id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orgs index NULL org_id 4 NULL ROWS Using index +1 SIMPLE sa_opportunities ref org_id org_id 5 test.orgs.org_id ROWS Using index +1 SIMPLE contacts ref contacts$org_id contacts$org_id 5 test.orgs.org_id ROWS Using index +SELECT COUNT(*) FROM table_bug30423 WHERE org_id IS NULL; +COUNT(*) +1024 +set global innodb_stats_method = "nulls_unequal"; +analyze table table_bug30423; +Table Op Msg_type Msg_text +test.table_bug30423 analyze status Engine-independent statistics collected +test.table_bug30423 analyze status OK +set global innodb_stats_method = "nulls_ignored"; +analyze table table_bug30423; +Table Op Msg_type Msg_text +test.table_bug30423 analyze status Engine-independent statistics collected +test.table_bug30423 analyze status OK +set global innodb_stats_method = nulls_equal; +drop table bug30243_2; +drop table bug30243_1; +drop table bug30243_3; +drop table table_bug30423; diff --git a/mysql-test/suite/innodb/r/innodb_bug30919.result b/mysql-test/suite/innodb/r/innodb_bug30919.result new file mode 100644 index 00000000..0062df3f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug30919.result @@ -0,0 +1,1047 @@ +use test; +CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, +dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, +fkid MEDIUMINT, filler VARCHAR(255), +PRIMARY KEY(id)) ENGINE='innodb' +PARTITION BY RANGE(id) +SUBPARTITION BY hash(id) subpartitions 2 +(PARTITION pa3 values less than (42), +PARTITION pa6 values less than (60), +PARTITION pa7 values less than (70), +PARTITION pa8 values less than (80), +PARTITION pa9 values less than (90), +PARTITION pa10 values less than (100), +PARTITION pa11 values less than MAXVALUE); +CREATE PROCEDURE test.proc_part() +BEGIN +DECLARE ins_count INT DEFAULT 1000; +DECLARE del_count INT; +DECLARE cur_user VARCHAR(255); +DECLARE local_uuid VARCHAR(255); +DECLARE local_time TIMESTAMP; +SET local_time= NOW(); +SET cur_user= CURRENT_USER(); +SET local_uuid= UUID(); +WHILE ins_count > 0 DO +INSERT INTO test.part_tbl VALUES (NULL, NOW(), USER() , UUID(), +ins_count,'Going to test MBR for MySQL'); +SET ins_count = ins_count - 1; +END WHILE; +SELECT MAX(id) FROM test.part_tbl INTO del_count; +WHILE del_count > 0 DO +DELETE FROM test.part_tbl WHERE id = del_count; +select count(*) as internal_count, del_count -- these two lines are for +FROM test.part_tbl; -- debug to show the problem +SET del_count = del_count - 2; +END WHILE; +END| +Warnings: +Level Warning +Code 1287 +Message ' INTO FROM...' instead +CALL test.proc_part(); +internal_count del_count +999 1000 +internal_count del_count +998 998 +internal_count del_count +997 996 +internal_count del_count +996 994 +internal_count del_count +995 992 +internal_count del_count +994 990 +internal_count del_count +993 988 +internal_count del_count +992 986 +internal_count del_count +991 984 +internal_count del_count +990 982 +internal_count del_count +989 980 +internal_count del_count +988 978 +internal_count del_count +987 976 +internal_count del_count +986 974 +internal_count del_count +985 972 +internal_count del_count +984 970 +internal_count del_count +983 968 +internal_count del_count +982 966 +internal_count del_count +981 964 +internal_count del_count +980 962 +internal_count del_count +979 960 +internal_count del_count +978 958 +internal_count del_count +977 956 +internal_count del_count +976 954 +internal_count del_count +975 952 +internal_count del_count +974 950 +internal_count del_count +973 948 +internal_count del_count +972 946 +internal_count del_count +971 944 +internal_count del_count +970 942 +internal_count del_count +969 940 +internal_count del_count +968 938 +internal_count del_count +967 936 +internal_count del_count +966 934 +internal_count del_count +965 932 +internal_count del_count +964 930 +internal_count del_count +963 928 +internal_count del_count +962 926 +internal_count del_count +961 924 +internal_count del_count +960 922 +internal_count del_count +959 920 +internal_count del_count +958 918 +internal_count del_count +957 916 +internal_count del_count +956 914 +internal_count del_count +955 912 +internal_count del_count +954 910 +internal_count del_count +953 908 +internal_count del_count +952 906 +internal_count del_count +951 904 +internal_count del_count +950 902 +internal_count del_count +949 900 +internal_count del_count +948 898 +internal_count del_count +947 896 +internal_count del_count +946 894 +internal_count del_count +945 892 +internal_count del_count +944 890 +internal_count del_count +943 888 +internal_count del_count +942 886 +internal_count del_count +941 884 +internal_count del_count +940 882 +internal_count del_count +939 880 +internal_count del_count +938 878 +internal_count del_count +937 876 +internal_count del_count +936 874 +internal_count del_count +935 872 +internal_count del_count +934 870 +internal_count del_count +933 868 +internal_count del_count +932 866 +internal_count del_count +931 864 +internal_count del_count +930 862 +internal_count del_count +929 860 +internal_count del_count +928 858 +internal_count del_count +927 856 +internal_count del_count +926 854 +internal_count del_count +925 852 +internal_count del_count +924 850 +internal_count del_count +923 848 +internal_count del_count +922 846 +internal_count del_count +921 844 +internal_count del_count +920 842 +internal_count del_count +919 840 +internal_count del_count +918 838 +internal_count del_count +917 836 +internal_count del_count +916 834 +internal_count del_count +915 832 +internal_count del_count +914 830 +internal_count del_count +913 828 +internal_count del_count +912 826 +internal_count del_count +911 824 +internal_count del_count +910 822 +internal_count del_count +909 820 +internal_count del_count +908 818 +internal_count del_count +907 816 +internal_count del_count +906 814 +internal_count del_count +905 812 +internal_count del_count +904 810 +internal_count del_count +903 808 +internal_count del_count +902 806 +internal_count del_count +901 804 +internal_count del_count +900 802 +internal_count del_count +899 800 +internal_count del_count +898 798 +internal_count del_count +897 796 +internal_count del_count +896 794 +internal_count del_count +895 792 +internal_count del_count +894 790 +internal_count del_count +893 788 +internal_count del_count +892 786 +internal_count del_count +891 784 +internal_count del_count +890 782 +internal_count del_count +889 780 +internal_count del_count +888 778 +internal_count del_count +887 776 +internal_count del_count +886 774 +internal_count del_count +885 772 +internal_count del_count +884 770 +internal_count del_count +883 768 +internal_count del_count +882 766 +internal_count del_count +881 764 +internal_count del_count +880 762 +internal_count del_count +879 760 +internal_count del_count +878 758 +internal_count del_count +877 756 +internal_count del_count +876 754 +internal_count del_count +875 752 +internal_count del_count +874 750 +internal_count del_count +873 748 +internal_count del_count +872 746 +internal_count del_count +871 744 +internal_count del_count +870 742 +internal_count del_count +869 740 +internal_count del_count +868 738 +internal_count del_count +867 736 +internal_count del_count +866 734 +internal_count del_count +865 732 +internal_count del_count +864 730 +internal_count del_count +863 728 +internal_count del_count +862 726 +internal_count del_count +861 724 +internal_count del_count +860 722 +internal_count del_count +859 720 +internal_count del_count +858 718 +internal_count del_count +857 716 +internal_count del_count +856 714 +internal_count del_count +855 712 +internal_count del_count +854 710 +internal_count del_count +853 708 +internal_count del_count +852 706 +internal_count del_count +851 704 +internal_count del_count +850 702 +internal_count del_count +849 700 +internal_count del_count +848 698 +internal_count del_count +847 696 +internal_count del_count +846 694 +internal_count del_count +845 692 +internal_count del_count +844 690 +internal_count del_count +843 688 +internal_count del_count +842 686 +internal_count del_count +841 684 +internal_count del_count +840 682 +internal_count del_count +839 680 +internal_count del_count +838 678 +internal_count del_count +837 676 +internal_count del_count +836 674 +internal_count del_count +835 672 +internal_count del_count +834 670 +internal_count del_count +833 668 +internal_count del_count +832 666 +internal_count del_count +831 664 +internal_count del_count +830 662 +internal_count del_count +829 660 +internal_count del_count +828 658 +internal_count del_count +827 656 +internal_count del_count +826 654 +internal_count del_count +825 652 +internal_count del_count +824 650 +internal_count del_count +823 648 +internal_count del_count +822 646 +internal_count del_count +821 644 +internal_count del_count +820 642 +internal_count del_count +819 640 +internal_count del_count +818 638 +internal_count del_count +817 636 +internal_count del_count +816 634 +internal_count del_count +815 632 +internal_count del_count +814 630 +internal_count del_count +813 628 +internal_count del_count +812 626 +internal_count del_count +811 624 +internal_count del_count +810 622 +internal_count del_count +809 620 +internal_count del_count +808 618 +internal_count del_count +807 616 +internal_count del_count +806 614 +internal_count del_count +805 612 +internal_count del_count +804 610 +internal_count del_count +803 608 +internal_count del_count +802 606 +internal_count del_count +801 604 +internal_count del_count +800 602 +internal_count del_count +799 600 +internal_count del_count +798 598 +internal_count del_count +797 596 +internal_count del_count +796 594 +internal_count del_count +795 592 +internal_count del_count +794 590 +internal_count del_count +793 588 +internal_count del_count +792 586 +internal_count del_count +791 584 +internal_count del_count +790 582 +internal_count del_count +789 580 +internal_count del_count +788 578 +internal_count del_count +787 576 +internal_count del_count +786 574 +internal_count del_count +785 572 +internal_count del_count +784 570 +internal_count del_count +783 568 +internal_count del_count +782 566 +internal_count del_count +781 564 +internal_count del_count +780 562 +internal_count del_count +779 560 +internal_count del_count +778 558 +internal_count del_count +777 556 +internal_count del_count +776 554 +internal_count del_count +775 552 +internal_count del_count +774 550 +internal_count del_count +773 548 +internal_count del_count +772 546 +internal_count del_count +771 544 +internal_count del_count +770 542 +internal_count del_count +769 540 +internal_count del_count +768 538 +internal_count del_count +767 536 +internal_count del_count +766 534 +internal_count del_count +765 532 +internal_count del_count +764 530 +internal_count del_count +763 528 +internal_count del_count +762 526 +internal_count del_count +761 524 +internal_count del_count +760 522 +internal_count del_count +759 520 +internal_count del_count +758 518 +internal_count del_count +757 516 +internal_count del_count +756 514 +internal_count del_count +755 512 +internal_count del_count +754 510 +internal_count del_count +753 508 +internal_count del_count +752 506 +internal_count del_count +751 504 +internal_count del_count +750 502 +internal_count del_count +749 500 +internal_count del_count +748 498 +internal_count del_count +747 496 +internal_count del_count +746 494 +internal_count del_count +745 492 +internal_count del_count +744 490 +internal_count del_count +743 488 +internal_count del_count +742 486 +internal_count del_count +741 484 +internal_count del_count +740 482 +internal_count del_count +739 480 +internal_count del_count +738 478 +internal_count del_count +737 476 +internal_count del_count +736 474 +internal_count del_count +735 472 +internal_count del_count +734 470 +internal_count del_count +733 468 +internal_count del_count +732 466 +internal_count del_count +731 464 +internal_count del_count +730 462 +internal_count del_count +729 460 +internal_count del_count +728 458 +internal_count del_count +727 456 +internal_count del_count +726 454 +internal_count del_count +725 452 +internal_count del_count +724 450 +internal_count del_count +723 448 +internal_count del_count +722 446 +internal_count del_count +721 444 +internal_count del_count +720 442 +internal_count del_count +719 440 +internal_count del_count +718 438 +internal_count del_count +717 436 +internal_count del_count +716 434 +internal_count del_count +715 432 +internal_count del_count +714 430 +internal_count del_count +713 428 +internal_count del_count +712 426 +internal_count del_count +711 424 +internal_count del_count +710 422 +internal_count del_count +709 420 +internal_count del_count +708 418 +internal_count del_count +707 416 +internal_count del_count +706 414 +internal_count del_count +705 412 +internal_count del_count +704 410 +internal_count del_count +703 408 +internal_count del_count +702 406 +internal_count del_count +701 404 +internal_count del_count +700 402 +internal_count del_count +699 400 +internal_count del_count +698 398 +internal_count del_count +697 396 +internal_count del_count +696 394 +internal_count del_count +695 392 +internal_count del_count +694 390 +internal_count del_count +693 388 +internal_count del_count +692 386 +internal_count del_count +691 384 +internal_count del_count +690 382 +internal_count del_count +689 380 +internal_count del_count +688 378 +internal_count del_count +687 376 +internal_count del_count +686 374 +internal_count del_count +685 372 +internal_count del_count +684 370 +internal_count del_count +683 368 +internal_count del_count +682 366 +internal_count del_count +681 364 +internal_count del_count +680 362 +internal_count del_count +679 360 +internal_count del_count +678 358 +internal_count del_count +677 356 +internal_count del_count +676 354 +internal_count del_count +675 352 +internal_count del_count +674 350 +internal_count del_count +673 348 +internal_count del_count +672 346 +internal_count del_count +671 344 +internal_count del_count +670 342 +internal_count del_count +669 340 +internal_count del_count +668 338 +internal_count del_count +667 336 +internal_count del_count +666 334 +internal_count del_count +665 332 +internal_count del_count +664 330 +internal_count del_count +663 328 +internal_count del_count +662 326 +internal_count del_count +661 324 +internal_count del_count +660 322 +internal_count del_count +659 320 +internal_count del_count +658 318 +internal_count del_count +657 316 +internal_count del_count +656 314 +internal_count del_count +655 312 +internal_count del_count +654 310 +internal_count del_count +653 308 +internal_count del_count +652 306 +internal_count del_count +651 304 +internal_count del_count +650 302 +internal_count del_count +649 300 +internal_count del_count +648 298 +internal_count del_count +647 296 +internal_count del_count +646 294 +internal_count del_count +645 292 +internal_count del_count +644 290 +internal_count del_count +643 288 +internal_count del_count +642 286 +internal_count del_count +641 284 +internal_count del_count +640 282 +internal_count del_count +639 280 +internal_count del_count +638 278 +internal_count del_count +637 276 +internal_count del_count +636 274 +internal_count del_count +635 272 +internal_count del_count +634 270 +internal_count del_count +633 268 +internal_count del_count +632 266 +internal_count del_count +631 264 +internal_count del_count +630 262 +internal_count del_count +629 260 +internal_count del_count +628 258 +internal_count del_count +627 256 +internal_count del_count +626 254 +internal_count del_count +625 252 +internal_count del_count +624 250 +internal_count del_count +623 248 +internal_count del_count +622 246 +internal_count del_count +621 244 +internal_count del_count +620 242 +internal_count del_count +619 240 +internal_count del_count +618 238 +internal_count del_count +617 236 +internal_count del_count +616 234 +internal_count del_count +615 232 +internal_count del_count +614 230 +internal_count del_count +613 228 +internal_count del_count +612 226 +internal_count del_count +611 224 +internal_count del_count +610 222 +internal_count del_count +609 220 +internal_count del_count +608 218 +internal_count del_count +607 216 +internal_count del_count +606 214 +internal_count del_count +605 212 +internal_count del_count +604 210 +internal_count del_count +603 208 +internal_count del_count +602 206 +internal_count del_count +601 204 +internal_count del_count +600 202 +internal_count del_count +599 200 +internal_count del_count +598 198 +internal_count del_count +597 196 +internal_count del_count +596 194 +internal_count del_count +595 192 +internal_count del_count +594 190 +internal_count del_count +593 188 +internal_count del_count +592 186 +internal_count del_count +591 184 +internal_count del_count +590 182 +internal_count del_count +589 180 +internal_count del_count +588 178 +internal_count del_count +587 176 +internal_count del_count +586 174 +internal_count del_count +585 172 +internal_count del_count +584 170 +internal_count del_count +583 168 +internal_count del_count +582 166 +internal_count del_count +581 164 +internal_count del_count +580 162 +internal_count del_count +579 160 +internal_count del_count +578 158 +internal_count del_count +577 156 +internal_count del_count +576 154 +internal_count del_count +575 152 +internal_count del_count +574 150 +internal_count del_count +573 148 +internal_count del_count +572 146 +internal_count del_count +571 144 +internal_count del_count +570 142 +internal_count del_count +569 140 +internal_count del_count +568 138 +internal_count del_count +567 136 +internal_count del_count +566 134 +internal_count del_count +565 132 +internal_count del_count +564 130 +internal_count del_count +563 128 +internal_count del_count +562 126 +internal_count del_count +561 124 +internal_count del_count +560 122 +internal_count del_count +559 120 +internal_count del_count +558 118 +internal_count del_count +557 116 +internal_count del_count +556 114 +internal_count del_count +555 112 +internal_count del_count +554 110 +internal_count del_count +553 108 +internal_count del_count +552 106 +internal_count del_count +551 104 +internal_count del_count +550 102 +internal_count del_count +549 100 +internal_count del_count +548 98 +internal_count del_count +547 96 +internal_count del_count +546 94 +internal_count del_count +545 92 +internal_count del_count +544 90 +internal_count del_count +543 88 +internal_count del_count +542 86 +internal_count del_count +541 84 +internal_count del_count +540 82 +internal_count del_count +539 80 +internal_count del_count +538 78 +internal_count del_count +537 76 +internal_count del_count +536 74 +internal_count del_count +535 72 +internal_count del_count +534 70 +internal_count del_count +533 68 +internal_count del_count +532 66 +internal_count del_count +531 64 +internal_count del_count +530 62 +internal_count del_count +529 60 +internal_count del_count +528 58 +internal_count del_count +527 56 +internal_count del_count +526 54 +internal_count del_count +525 52 +internal_count del_count +524 50 +internal_count del_count +523 48 +internal_count del_count +522 46 +internal_count del_count +521 44 +internal_count del_count +520 42 +internal_count del_count +519 40 +internal_count del_count +518 38 +internal_count del_count +517 36 +internal_count del_count +516 34 +internal_count del_count +515 32 +internal_count del_count +514 30 +internal_count del_count +513 28 +internal_count del_count +512 26 +internal_count del_count +511 24 +internal_count del_count +510 22 +internal_count del_count +509 20 +internal_count del_count +508 18 +internal_count del_count +507 16 +internal_count del_count +506 14 +internal_count del_count +505 12 +internal_count del_count +504 10 +internal_count del_count +503 8 +internal_count del_count +502 6 +internal_count del_count +501 4 +internal_count del_count +500 2 +select count(*) as Part from test.part_tbl; +Part +500 +DROP PROCEDURE test.proc_part; +DROP TABLE test.part_tbl; diff --git a/mysql-test/suite/innodb/r/innodb_bug34300.result b/mysql-test/suite/innodb/r/innodb_bug34300.result new file mode 100644 index 00000000..96dd8d0e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug34300.result @@ -0,0 +1,20 @@ +# +# Bug#34300 Tinyblob & tinytext fields corrupted after export/import and alter in 5.1 +# +SET @@global.max_allowed_packet=16777216; +connect newconn, localhost, root,,; +CREATE TABLE bug34300 ( +f4 TINYTEXT, +f6 MEDIUMTEXT, +f8 TINYBLOB +) ENGINE=InnoDB; +INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz'); +SELECT f4, f8 FROM bug34300; +f4 f8 +xxx zzz +ALTER TABLE bug34300 ADD COLUMN (f10 INT); +SELECT f4, f8 FROM bug34300; +f4 f8 +xxx zzz +# Cleanup +DROP TABLE bug34300; diff --git a/mysql-test/suite/innodb/r/innodb_bug35220.result b/mysql-test/suite/innodb/r/innodb_bug35220.result new file mode 100644 index 00000000..23c5b0cc --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug35220.result @@ -0,0 +1 @@ +SET default_storage_engine=InnoDB; diff --git a/mysql-test/suite/innodb/r/innodb_bug38231.result b/mysql-test/suite/innodb/r/innodb_bug38231.result new file mode 100644 index 00000000..3108e32d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug38231.result @@ -0,0 +1,2 @@ +SET default_storage_engine=InnoDB; +connection default; diff --git a/mysql-test/suite/innodb/r/innodb_bug39438.result b/mysql-test/suite/innodb/r/innodb_bug39438.result new file mode 100644 index 00000000..23c5b0cc --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug39438.result @@ -0,0 +1 @@ +SET default_storage_engine=InnoDB; diff --git a/mysql-test/suite/innodb/r/innodb_bug40360.result b/mysql-test/suite/innodb/r/innodb_bug40360.result new file mode 100644 index 00000000..ef4cf463 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug40360.result @@ -0,0 +1,4 @@ +SET TX_ISOLATION='READ-COMMITTED'; +CREATE TABLE bug40360 (a INT) engine=innodb; +INSERT INTO bug40360 VALUES (1); +DROP TABLE bug40360; diff --git a/mysql-test/suite/innodb/r/innodb_bug40565.result b/mysql-test/suite/innodb/r/innodb_bug40565.result new file mode 100644 index 00000000..21e923d9 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug40565.result @@ -0,0 +1,9 @@ +create table bug40565(value decimal(4,2)) engine=innodb; +insert into bug40565 values (1), (null); +update bug40565 set value=NULL; +affected rows: 1 +info: Rows matched: 2 Changed: 1 Warnings: 0 +update bug40565 set value=NULL; +affected rows: 0 +info: Rows matched: 2 Changed: 0 Warnings: 0 +drop table bug40565; diff --git a/mysql-test/suite/innodb/r/innodb_bug41904.result b/mysql-test/suite/innodb/r/innodb_bug41904.result new file mode 100644 index 00000000..6070d32d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug41904.result @@ -0,0 +1,4 @@ +CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB; +INSERT INTO bug41904 VALUES (1,NULL), (2,NULL); +CREATE UNIQUE INDEX ui ON bug41904 (uniquecol); +DROP TABLE bug41904; diff --git a/mysql-test/suite/innodb/r/innodb_bug42419.result b/mysql-test/suite/innodb/r/innodb_bug42419.result new file mode 100644 index 00000000..41c400bc --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug42419.result @@ -0,0 +1,24 @@ +connection default; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +COMMIT; +SET AUTOCOMMIT = 0; +CREATE TEMPORARY TABLE t1_tmp ( b INT ); +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3; +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2; +connect user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK; +SET AUTOCOMMIT = 0; +CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int ); +INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53); +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1; +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2; +connection default; +INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection user2; +Reap the server message for connection user2 UPDATE t1 ... +UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3; +connection default; +disconnect user2; +DROP TABLE t1; +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); diff --git a/mysql-test/suite/innodb/r/innodb_bug44032.result b/mysql-test/suite/innodb/r/innodb_bug44032.result new file mode 100644 index 00000000..da2a000b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug44032.result @@ -0,0 +1,7 @@ +CREATE TABLE bug44032(c CHAR(3) CHARACTER SET UTF8) ROW_FORMAT=REDUNDANT +ENGINE=InnoDB; +INSERT INTO bug44032 VALUES('abc'),(0xEFBCA4EFBCA4EFBCA4); +UPDATE bug44032 SET c='DDD' WHERE c=0xEFBCA4EFBCA4EFBCA4; +UPDATE bug44032 SET c=NULL WHERE c='DDD'; +UPDATE bug44032 SET c='DDD' WHERE c IS NULL; +DROP TABLE bug44032; diff --git a/mysql-test/suite/innodb/r/innodb_bug44369.result b/mysql-test/suite/innodb/r/innodb_bug44369.result new file mode 100644 index 00000000..ff25c774 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug44369.result @@ -0,0 +1,6 @@ +create table bug44369 (DB_ROW_ID int) engine=innodb; +ERROR 42000: Incorrect column name 'DB_ROW_ID' +create table bug44369 (db_row_id int) engine=innodb; +ERROR 42000: Incorrect column name 'db_row_id' +create table bug44369 (db_TRX_Id int) engine=innodb; +ERROR 42000: Incorrect column name 'db_TRX_Id' diff --git a/mysql-test/suite/innodb/r/innodb_bug44571.result b/mysql-test/suite/innodb/r/innodb_bug44571.result new file mode 100644 index 00000000..7ee7820a --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug44571.result @@ -0,0 +1,8 @@ +CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; +ALTER TABLE bug44571 CHANGE foo bar INT; +ALTER TABLE bug44571 ADD INDEX bug44571b (foo); +ERROR 42000: Key column 'foo' doesn't exist in table +ALTER TABLE bug44571 ADD INDEX bug44571c (bar); +DROP INDEX bug44571c ON bug44571; +CREATE INDEX bug44571c ON bug44571 (bar); +DROP TABLE bug44571; diff --git a/mysql-test/suite/innodb/r/innodb_bug45357.result b/mysql-test/suite/innodb/r/innodb_bug45357.result new file mode 100644 index 00000000..7adeff20 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug45357.result @@ -0,0 +1,7 @@ +set session transaction isolation level read committed; +create table bug45357(a int, b int,key(b))engine=innodb; +insert into bug45357 values (25170,6122); +update bug45357 set a=1 where b=30131; +delete from bug45357 where b < 20996; +delete from bug45357 where b < 7001; +drop table bug45357; diff --git a/mysql-test/suite/innodb/r/innodb_bug46000.result b/mysql-test/suite/innodb/r/innodb_bug46000.result new file mode 100644 index 00000000..86e8766f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug46000.result @@ -0,0 +1,18 @@ +create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb; +ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX' +create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb; +ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX' +show warnings; +Level Code Message +Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index. +Error 1280 Incorrect index name 'GEN_CLUST_INDEX' +Warning 1030 Got error 124 "Wrong index given to a function" from storage engine InnoDB +create table bug46000(id int) engine=innodb; +create index GEN_CLUST_INDEX on bug46000(id); +ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX' +show warnings; +Level Code Message +Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index. +Error 1280 Incorrect index name 'GEN_CLUST_INDEX' +create index idx on bug46000(id); +drop table bug46000; diff --git a/mysql-test/suite/innodb/r/innodb_bug46676.result b/mysql-test/suite/innodb/r/innodb_bug46676.result new file mode 100644 index 00000000..996799ce --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug46676.result @@ -0,0 +1,9 @@ +SET foreign_key_checks=0; +CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB; +CREATE TABLE t2 (id int, foreign key (id) references t1(id)) ENGINE=INNODB; +SET foreign_key_checks=1; +SELECT COUNT(*) FROM information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME in ('t1', 't2'); +COUNT(*) +2 +SET foreign_key_checks=0; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/r/innodb_bug47621.result b/mysql-test/suite/innodb/r/innodb_bug47621.result new file mode 100644 index 00000000..c5f56c09 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug47621.result @@ -0,0 +1,21 @@ +CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB; +ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT; +create index orgs on bug47621(sales_acct_id); +ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT; +drop table bug47621; +CREATE TABLE bug47621_sale ( +salesperson INT, +PRIMARY KEY(salesperson)) engine = innodb; +CREATE TABLE bug47621_shirt( +id SMALLINT, +owner INT, +FOREIGN KEY(owner) +references bug47621_sale(salesperson) ON DELETE RESTRICT) +engine = innodb; +insert into bug47621_sale values(9); +insert into bug47621_shirt values(1, 9); +ALTER TABLE bug47621_shirt CHANGE id new_id INT; +drop table bug47621_shirt; +ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; +ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id); +drop table bug47621_sale; diff --git a/mysql-test/suite/innodb/r/innodb_bug47622.result b/mysql-test/suite/innodb/r/innodb_bug47622.result new file mode 100644 index 00000000..e520d149 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug47622.result @@ -0,0 +1,27 @@ +connect a,localhost,root,,; +connect b,localhost,root,,; +CREATE TABLE bug47622( +`rule_key` int(11) NOT NULL DEFAULT '0', +`seq` smallint(6) NOT NULL DEFAULT '0', +`action` smallint(6) NOT NULL DEFAULT '0', +`arg_id` smallint(6) DEFAULT NULL, +`else_ind` TINYINT NOT NULL, +KEY IDX_A (`arg_id`) +) ENGINE=InnoDB; +connection a; +ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id); +drop index IDX_B on bug47622; +connection b; +create index idx on bug47622(seq, arg_id); +ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action); +drop table bug47622; +CREATE TABLE bug47622 ( +`a` int(11) NOT NULL, +`b` int(11) DEFAULT NULL, +`c` char(10) DEFAULT NULL, +`d` varchar(20) DEFAULT NULL, +PRIMARY KEY (`a`), +KEY `b` (`b`) +) ENGINE=InnoDB; +alter table bug47622 add unique index (c), add index (d); +drop table bug47622; diff --git a/mysql-test/suite/innodb/r/innodb_bug47777.result b/mysql-test/suite/innodb/r/innodb_bug47777.result new file mode 100644 index 00000000..6625c400 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug47777.result @@ -0,0 +1,13 @@ +create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb; +insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)')); +select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); +count(*) +1 +update bug47777 set c2=GeomFromText('linestring(1 1)'); +select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'); +count(*) +0 +select count(*) from bug47777 where c2 = GeomFromText('linestring(1 1)'); +count(*) +1 +drop table bug47777; diff --git a/mysql-test/suite/innodb/r/innodb_bug48024.result b/mysql-test/suite/innodb/r/innodb_bug48024.result new file mode 100644 index 00000000..611923d2 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug48024.result @@ -0,0 +1,10 @@ +CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; +CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ +ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b); +DROP TABLE bug48024,bug48024_b; +CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; +CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ +ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)| +DROP TABLE bug48024,bug48024_b; diff --git a/mysql-test/suite/innodb/r/innodb_bug49164.result b/mysql-test/suite/innodb/r/innodb_bug49164.result new file mode 100644 index 00000000..857cd285 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug49164.result @@ -0,0 +1,52 @@ +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET tx_isolation = 'READ-COMMITTED'; +CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b)) +ENGINE=InnoDB; +insert into bug49164 values (1,1,1), (2,2,2), (3,3,3); +begin; +update bug49164 set c=7; +select * from bug49164; +a b c +1 1 7 +2 2 7 +3 3 7 +rollback; +select * from bug49164; +a b c +1 1 1 +2 2 2 +3 3 3 +begin; +update bug49164 set c=7; +connection con2; +SET tx_isolation = 'READ-COMMITTED'; +begin; +select * from bug49164; +a b c +1 1 1 +2 2 2 +3 3 3 +commit; +begin; +update bug49164 set c=6 where a=1 and b=1; +connection con1; +rollback; +select * from bug49164; +a b c +1 1 1 +2 2 2 +3 3 3 +connection con2; +commit; +connection con1; +select * from bug49164; +a b c +1 1 6 +2 2 2 +3 3 3 +connection default; +disconnect con1; +disconnect con2; +drop table bug49164; diff --git a/mysql-test/suite/innodb/r/innodb_bug51378.result b/mysql-test/suite/innodb/r/innodb_bug51378.result new file mode 100644 index 00000000..7d2c869b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug51378.result @@ -0,0 +1,70 @@ +create table bug51378 ( +col1 int not null, +col2 blob not null, +col3 time not null) engine = innodb; +create unique index idx on bug51378(col1, col2(31)); +alter table bug51378 add unique index idx2(col1, col2(31)); +Warnings: +Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release +create unique index idx3 on bug51378(col1, col3); +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + UNIQUE KEY `idx3` (`col1`,`col3`), + UNIQUE KEY `idx` (`col1`,`col2`(31)), + UNIQUE KEY `idx2` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop index idx3 on bug51378; +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + UNIQUE KEY `idx` (`col1`,`col2`(31)), + UNIQUE KEY `idx2` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table bug51378 add primary key idx3(col1, col2(31)); +Warnings: +Warning 1280 Name 'idx3' ignored for PRIMARY key. +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + PRIMARY KEY (`col1`,`col2`(31)), + UNIQUE KEY `idx` (`col1`,`col2`(31)), + UNIQUE KEY `idx2` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table bug51378; +create table bug51378 ( +col1 int not null, +col2 blob not null, +col3 time not null, primary key(col1, col2(31))) engine = innodb; +create unique index idx on bug51378(col1, col2(31)); +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + PRIMARY KEY (`col1`,`col2`(31)), + UNIQUE KEY `idx` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table bug51378; +create table bug51378 ( +col1 int not null, +col2 int ) engine = innodb; +create unique index idx on bug51378(col1, col2); +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` int(11) DEFAULT NULL, + UNIQUE KEY `idx` (`col1`,`col2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table bug51378; diff --git a/mysql-test/suite/innodb/r/innodb_bug51920.result b/mysql-test/suite/innodb/r/innodb_bug51920.result new file mode 100644 index 00000000..9bc35174 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug51920.result @@ -0,0 +1,21 @@ +CREATE TABLE bug51920 (i INT) ENGINE=InnoDB; +INSERT INTO bug51920 VALUES (1); +BEGIN; +SELECT * FROM bug51920 FOR UPDATE; +i +1 +connect con1,localhost,root,,; +connection con1; +UPDATE bug51920 SET i=2; +connection default; +SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE INFO="UPDATE bug51920 SET i=2" +INTO @thread_id; +Warnings: +Warning 1287 ' INTO FROM...' instead +KILL @thread_id; +connection con1; +Got one of the listed errors +connection default; +DROP TABLE bug51920; +disconnect con1; diff --git a/mysql-test/suite/innodb/r/innodb_bug52199.result b/mysql-test/suite/innodb/r/innodb_bug52199.result new file mode 100644 index 00000000..7e8c1ee4 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug52199.result @@ -0,0 +1,5 @@ +CREATE TABLE bug52199 (a INT NOT NULL, +b CHAR(125) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL +)ENGINE=InnoDB; +CREATE UNIQUE INDEX idx ON bug52199(a); +DROP TABLE bug52199; diff --git a/mysql-test/suite/innodb/r/innodb_bug52663.result b/mysql-test/suite/innodb/r/innodb_bug52663.result new file mode 100644 index 00000000..348a7b21 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug52663.result @@ -0,0 +1,33 @@ +set session transaction isolation level read committed; +create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key +(what, id)) engine=innodb; +insert into innodb_bug52663 values ('total', 0, 0); +begin; +connect addconroot, localhost, root,,; +connection addconroot; +set session transaction isolation level read committed; +begin; +connection default; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +select * from innodb_bug52663; +what id count +total 0 1 +connection addconroot; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from innodb_bug52663; +what id count +total 0 0 +connection default; +commit; +connection addconroot; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +commit; +select * from innodb_bug52663; +what id count +total 0 2 +connection default; +select * from innodb_bug52663; +what id count +total 0 2 +drop table innodb_bug52663; diff --git a/mysql-test/suite/innodb/r/innodb_bug53046.result b/mysql-test/suite/innodb/r/innodb_bug53046.result new file mode 100644 index 00000000..0321d5ac --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53046.result @@ -0,0 +1,28 @@ +CREATE TABLE bug53046_1 (c1 INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE bug53046_2 (c2 INT PRIMARY KEY, +FOREIGN KEY (c2) REFERENCES bug53046_1(c1) +ON UPDATE CASCADE ON DELETE CASCADE) ENGINE=INNODB; +INSERT INTO bug53046_1 VALUES (1); +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_1 SELECT c1+(SELECT MAX(c1) FROM bug53046_1) +FROM bug53046_1; +INSERT INTO bug53046_2 VALUES (1), (2); +ANALYZE TABLE bug53046_1; +Table Op Msg_type Msg_text +test.bug53046_1 analyze status Engine-independent statistics collected +test.bug53046_1 analyze status OK +SHOW TABLE STATUS LIKE 'bug53046_1'; +UPDATE bug53046_1 SET c1 = c1 - 1; +DELETE FROM bug53046_1; +INSERT INTO bug53046_1 VALUES (1); +INSERT INTO bug53046_2 VALUES (1); +TRUNCATE TABLE bug53046_2; +DROP TABLE bug53046_2; +DROP TABLE bug53046_1; diff --git a/mysql-test/suite/innodb/r/innodb_bug53290.result b/mysql-test/suite/innodb/r/innodb_bug53290.result new file mode 100644 index 00000000..46cd7248 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53290.result @@ -0,0 +1,17 @@ +create table bug53290 (x bigint) engine=innodb; +insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),(); +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +alter table bug53290 add unique index `idx` (x); +drop table bug53290; diff --git a/mysql-test/suite/innodb/r/innodb_bug53592.result b/mysql-test/suite/innodb/r/innodb_bug53592.result new file mode 100644 index 00000000..9fea3dea --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53592.result @@ -0,0 +1,49 @@ +set old_alter_table=0; +Warnings: +Warning 1287 '@@old_alter_table' is deprecated and will be removed in a future release. Please use '@@alter_algorithm' instead +create table bug53592(a int) engine=innodb row_format=compact; +alter table bug53592 add column b text charset utf8; +alter table bug53592 add column c blob not null; +create index bug53592_b on bug53592(b(81)); +create unique index bug53592_c on bug53592(c(1)); +set statement sql_mode = '' for +replace into bug53592 values (),(); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +check table bug53592; +Table Op Msg_type Msg_text +test.bug53592 check status OK +drop table bug53592; +set old_alter_table=1; +Warnings: +Warning 1287 '@@old_alter_table' is deprecated and will be removed in a future release. Please use '@@alter_algorithm' instead +create table bug53592(a int) engine=innodb row_format=compact; +alter table bug53592 add column b text charset utf8; +alter table bug53592 add column c blob not null; +create index bug53592_b on bug53592(b(81)); +create unique index bug53592_c on bug53592(c(1)); +set statement sql_mode = '' for +replace into bug53592 values (),(); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +check table bug53592; +Table Op Msg_type Msg_text +test.bug53592 check status OK +drop table bug53592; +CREATE TABLE bug53592_1( +col1 int, col2 int, +PRIMARY KEY (col1, col2) +) ENGINE=InnoDB; +CREATE TABLE bug53592_2 ( +col int PRIMARY KEY, +FOREIGN KEY (col) REFERENCES bug53592_1 (col1) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO bug53592_1 VALUES (1, 2); +INSERT INTO bug53592_1 VALUES (3, 4); +INSERT INTO bug53592_2 VALUES (1); +INSERT INTO bug53592_2 VALUES (3); +UPDATE bug53592_1 SET col1 = 3 WHERE col2 = 2; +ERROR 23000: Foreign key constraint for table 'bug53592_1', record '3-2' would lead to a duplicate entry in table 'bug53592_2', key 'PRIMARY' +drop table bug53592_2; +drop table bug53592_1; diff --git a/mysql-test/suite/innodb/r/innodb_bug53674.result b/mysql-test/suite/innodb/r/innodb_bug53674.result new file mode 100644 index 00000000..c4021c2e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53674.result @@ -0,0 +1,11 @@ +create table bug53674(a int)engine=innodb; +insert into bug53674 values (1),(2); +start transaction; +select * from bug53674 for update; +a +1 +2 +select * from bug53674 where a=(select a from bug53674 where a > 1); +a +2 +drop table bug53674; diff --git a/mysql-test/suite/innodb/r/innodb_bug53756.result b/mysql-test/suite/innodb/r/innodb_bug53756.result new file mode 100644 index 00000000..daa6113f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53756.result @@ -0,0 +1,99 @@ +CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB; +ALTER TABLE bug_53756 ADD PRIMARY KEY (pk); +INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44); + +# Select a less restrictive isolation level. +SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +COMMIT; + +# Start a transaction in the default connection for isolation. +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +SELECT * FROM bug_53756; +pk c1 +1 11 +2 22 +3 33 +4 44 +connect con1,localhost,root,,; +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +DELETE FROM bug_53756 WHERE pk=1; +connect con2,localhost,root,,; +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +DELETE FROM bug_53756 WHERE pk=2; +connect con3,localhost,root,,; +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +UPDATE bug_53756 SET c1=77 WHERE pk=3; +connect con4,localhost,root,,; +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +UPDATE bug_53756 SET c1=88 WHERE pk=4; +connect con5,localhost,root,,; +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +INSERT INTO bug_53756 VALUES(5, 55); +connect con6,localhost,root,,; +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +INSERT INTO bug_53756 VALUES(6, 66); +connection con1; +COMMIT; +connection con3; +COMMIT; +connection con4; +ROLLBACK; +connection con6; +ROLLBACK; + +# The connections 2 and 5 stay open. + +# Delete of row 1 was committed. +# Update of row 3 was committed. +# Due to isolation level read committed, these should be included. +# All other changes should not be included. +connection default; +SELECT * FROM bug_53756; +pk c1 +2 22 +3 77 +4 44 +START TRANSACTION; +INSERT INTO bug_53756 VALUES (666,666); +# restart +disconnect con1; +disconnect con2; +disconnect con3; +disconnect con4; +disconnect con5; +disconnect con6; +# +# Select recovered data. +# Delete of row 1 was committed. +# Update of row 3 was committed. +# These should be included. +# All other changes should not be included. +# Delete of row 2 and insert of row 5 should be rolled back +SELECT * FROM bug_53756; +pk c1 +2 22 +3 77 +4 44 +DROP TABLE bug_53756; diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result new file mode 100644 index 00000000..abaf67ea --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -0,0 +1,18 @@ +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB +AS SELECT IF(NULL IS NOT NULL, NULL, NULL); +SHOW CREATE TABLE table_54044; +Table Create Table +table_54044 CREATE TEMPORARY TABLE `table_54044` ( + `IF(NULL IS NOT NULL, NULL, NULL)` binary(0) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE table_54044; +CREATE TABLE tmp ENGINE = INNODB +AS SELECT COALESCE(NULL, NULL, NULL), GREATEST(NULL, NULL), NULL; +SHOW CREATE TABLE tmp; +Table Create Table +tmp CREATE TABLE `tmp` ( + `COALESCE(NULL, NULL, NULL)` binary(0) DEFAULT NULL, + `GREATEST(NULL, NULL)` binary(0) DEFAULT NULL, + `NULL` binary(0) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE tmp; diff --git a/mysql-test/suite/innodb/r/innodb_bug56143.result b/mysql-test/suite/innodb/r/innodb_bug56143.result new file mode 100644 index 00000000..d3c465b3 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug56143.result @@ -0,0 +1,556 @@ +SHOW CREATE TABLE bug56143_2; +Table Create Table +bug56143_2 CREATE TABLE `bug56143_2` ( + `a` int(11) DEFAULT NULL, + KEY `a` (`a`), + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa100` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa101` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa102` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa103` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa104` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa105` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa106` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa107` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa108` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa109` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa110` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa111` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa112` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa113` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa114` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa115` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa116` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa117` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa118` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa119` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa120` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa121` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa122` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa124` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa125` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa126` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa127` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa128` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa129` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa130` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa131` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa132` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa133` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa134` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa135` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa136` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa137` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa138` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa139` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa140` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa141` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa142` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa143` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa144` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa145` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa146` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa147` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa148` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa149` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa150` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa151` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa152` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa153` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa154` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa155` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa156` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa157` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa158` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa159` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa160` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa161` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa162` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa163` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa164` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa165` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa166` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa167` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa168` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa169` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa170` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa171` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa172` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa173` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa174` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa175` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa176` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa177` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa178` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa179` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa180` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa181` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa182` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa183` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa184` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa185` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa186` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa187` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa188` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa189` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa190` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa191` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa192` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa193` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa194` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa195` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa196` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa197` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa198` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa199` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa200` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa201` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa202` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa203` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa204` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa205` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa206` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa207` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa208` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa209` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa210` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa211` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa212` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa213` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa214` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa215` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa216` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa217` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa218` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa219` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa220` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa221` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa222` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa223` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa224` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa225` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa226` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa227` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa228` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa229` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa230` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa231` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa232` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa233` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa234` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa235` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa236` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa237` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa238` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa239` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa240` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa241` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa242` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa243` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa244` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa245` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa246` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa247` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa248` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa249` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa250` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa251` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa252` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa253` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa254` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa255` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa256` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa257` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa258` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa259` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa260` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa261` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa262` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa263` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa264` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa265` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa266` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa267` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa268` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa269` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa270` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa271` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa272` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa273` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa274` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa275` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa276` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa277` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa278` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa279` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa280` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa281` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa282` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa283` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa284` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa285` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa286` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa287` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa288` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa289` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa290` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa291` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa292` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa293` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa294` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa295` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa296` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa297` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa298` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa299` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa300` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa301` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa302` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa303` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa304` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa305` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa306` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa307` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa308` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa309` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa310` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa311` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa312` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa313` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa314` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa315` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa316` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa317` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa318` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa319` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa320` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa321` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa322` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa323` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa324` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa325` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa326` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa327` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa328` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa329` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa330` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa331` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa332` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa333` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa334` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa335` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa336` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa337` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa338` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa339` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa340` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa341` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa342` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa343` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa344` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa345` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa346` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa347` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa348` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa349` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa350` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa351` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa352` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa353` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa354` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa355` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa356` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa357` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa358` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa359` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa360` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa361` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa362` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa363` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa364` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa365` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa366` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa367` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa368` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa369` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa370` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa371` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa372` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa373` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa374` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa375` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa376` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa377` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa378` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa379` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa380` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa381` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa382` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa383` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa384` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa385` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa386` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa387` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa388` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa389` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa390` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa391` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa392` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa393` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa394` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa395` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa396` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa397` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa398` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa399` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa400` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa401` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa402` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa403` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa404` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa405` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa406` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa407` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa408` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa409` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa410` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa411` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa412` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa413` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa414` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa415` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa416` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa417` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa418` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa419` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa420` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa421` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa422` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa423` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa424` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa425` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa426` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa427` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa428` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa429` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa430` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa431` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa432` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa433` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa434` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa435` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa436` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa437` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa438` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa439` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa440` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa441` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa442` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa443` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa444` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa445` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa446` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa447` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa448` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa449` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa450` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa451` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa452` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa453` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa454` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa455` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa456` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa457` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa458` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa459` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa460` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa461` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa462` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa463` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa464` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa465` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa466` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa467` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa468` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa469` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa470` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa471` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa472` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa473` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa474` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa475` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa476` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa477` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa478` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa479` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa480` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa481` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa482` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa483` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa484` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa485` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa486` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa487` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa488` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa489` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa490` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa491` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa492` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa493` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa494` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa495` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa496` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa497` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa498` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa499` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa500` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa501` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa502` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa503` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa504` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa505` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa506` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa507` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa508` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa509` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa510` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa511` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa512` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa513` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa514` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa515` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa516` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa517` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa518` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa519` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa520` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa521` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa522` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa523` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa524` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa525` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa526` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa527` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa528` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa529` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa53` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa530` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa531` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa532` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa533` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa534` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa535` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa536` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa537` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa538` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa539` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa54` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa540` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa541` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa542` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa543` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa544` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa545` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa546` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa547` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa548` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa549` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa55` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa550` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa56` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa57` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa58` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa59` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa6` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa60` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa61` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa62` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa63` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa64` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa65` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa66` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa67` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa68` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa69` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa7` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa70` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa71` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa72` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa73` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa74` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa75` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa76` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa77` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa78` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa79` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa8` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa80` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa81` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa82` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa83` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa84` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa85` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa86` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa87` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa88` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa89` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa90` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa91` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa92` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa93` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa94` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa95` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa96` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa97` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa98` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL, + CONSTRAINT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa99` FOREIGN KEY (`a`) REFERENCES `bug56143_1` (`a`) ON UPDATE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci diff --git a/mysql-test/suite/innodb/r/innodb_bug56716.result b/mysql-test/suite/innodb/r/innodb_bug56716.result new file mode 100644 index 00000000..50d83e8d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug56716.result @@ -0,0 +1,4 @@ +CREATE TABLE bug56716 (a INT PRIMARY KEY,b INT,c INT,INDEX(b)) ENGINE=InnoDB; +SELECT * FROM bug56716 WHERE b<=42 ORDER BY b DESC FOR UPDATE; +a b c +DROP TABLE bug56716; diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result new file mode 100644 index 00000000..aa922776 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug56947.result @@ -0,0 +1,12 @@ +SET GLOBAL innodb_file_per_table=0; +create table bug56947(a int not null) engine = innodb; +SET @saved_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename'; +alter table bug56947 add unique index (a); +ERROR HY000: Got error 11 "xxx" from storage engine InnoDB +check table bug56947; +Table Op Msg_type Msg_text +test.bug56947 check status OK +drop table bug56947; +SET @@global.innodb_file_per_table=DEFAULT; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_bug57252.result b/mysql-test/suite/innodb/r/innodb_bug57252.result new file mode 100644 index 00000000..66183c2c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug57252.result @@ -0,0 +1,7 @@ +cardinality +2 +Table Op Msg_type Msg_text +test.bug57252 analyze status Engine-independent statistics collected +test.bug57252 analyze status OK +cardinality +10 diff --git a/mysql-test/suite/innodb/r/innodb_bug57255.result b/mysql-test/suite/innodb/r/innodb_bug57255.result new file mode 100644 index 00000000..d61a0d42 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug57255.result @@ -0,0 +1,10 @@ +create table A(id int not null primary key) engine=innodb; +create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb; +create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb; +insert into A values(1), (2); +DELETE FROM A where id = 1; +DELETE FROM C where f1 = 2; +DELETE FROM A where id = 1; +DROP TABLE C; +DROP TABLE B; +DROP TABLE A; diff --git a/mysql-test/suite/innodb/r/innodb_bug57904.result b/mysql-test/suite/innodb/r/innodb_bug57904.result new file mode 100644 index 00000000..909f77b2 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug57904.result @@ -0,0 +1,42 @@ +CREATE TABLE product (category INT NOT NULL, id INT NOT NULL, +price DECIMAL, PRIMARY KEY(category, id)) ENGINE=INNODB; +CREATE TABLE customer (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT, +product_category INT NOT NULL, +product_id INT NOT NULL, +customer_id INT NOT NULL, +PRIMARY KEY(no), +INDEX (product_category, product_id), +FOREIGN KEY (product_category, product_id) +REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT, +INDEX (customer_id), +FOREIGN KEY (customer_id) +REFERENCES customer(id) +) ENGINE=INNODB; +SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS +WHERE table_name = 'product_order'; +CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA test +CONSTRAINT_NAME product_order_ibfk_1 +UNIQUE_CONSTRAINT_CATALOG def +UNIQUE_CONSTRAINT_SCHEMA test +UNIQUE_CONSTRAINT_NAME PRIMARY +MATCH_OPTION NONE +UPDATE_RULE CASCADE +DELETE_RULE RESTRICT +TABLE_NAME product_order +REFERENCED_TABLE_NAME product +CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA test +CONSTRAINT_NAME product_order_ibfk_2 +UNIQUE_CONSTRAINT_CATALOG def +UNIQUE_CONSTRAINT_SCHEMA test +UNIQUE_CONSTRAINT_NAME PRIMARY +MATCH_OPTION NONE +UPDATE_RULE RESTRICT +DELETE_RULE RESTRICT +TABLE_NAME product_order +REFERENCED_TABLE_NAME customer +DROP TABLE product_order; +DROP TABLE product; +DROP TABLE customer; diff --git a/mysql-test/suite/innodb/r/innodb_bug59307.result b/mysql-test/suite/innodb/r/innodb_bug59307.result new file mode 100644 index 00000000..e247393b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug59307.result @@ -0,0 +1,28 @@ +CREATE TABLE t1 ( +t1_int INT, +t1_time TIME +) ENGINE=innodb; +CREATE TABLE t2 ( +t2_int int PRIMARY KEY, +t2_int2 INT +) ENGINE=INNODB; +INSERT IGNORE INTO t2 VALUES (); +Warnings: +Warning 1364 Field 't2_int' doesn't have a default value +INSERT INTO t1 VALUES (); +SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +; +t1_int t1_time +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/r/innodb_bug59410.result b/mysql-test/suite/innodb/r/innodb_bug59410.result new file mode 100644 index 00000000..494d601b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug59410.result @@ -0,0 +1,17 @@ +create table `bug59410_1`(`a` int)engine=innodb; +insert into `bug59410_1` values (1),(2),(3); +select 1 from `bug59410_1` where `a` <> any ( +select 1 from `bug59410_1` where `a` <> 1 for update) +for update; +1 +1 +1 +drop table bug59410_1; +create table bug59410_2(`a` char(1),`b` int)engine=innodb; +insert into bug59410_2 values('0',0); +set transaction isolation level read uncommitted; +start transaction; +set @a=(select b from bug59410_2 where +(select 1 from bug59410_2 where a group by @a=b) +group by @a:=b); +drop table bug59410_2; diff --git a/mysql-test/suite/innodb/r/innodb_bug59641.result b/mysql-test/suite/innodb/r/innodb_bug59641.result new file mode 100644 index 00000000..634edec7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug59641.result @@ -0,0 +1,61 @@ +CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB; +INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32); +COMMIT; +XA START '123'; +INSERT INTO t VALUES(1,1); +XA END '123'; +XA PREPARE '123'; +CONNECT con1,localhost,root,,; +XA START '456'; +INSERT INTO t VALUES(3,47),(5,67); +UPDATE t SET b=2*b WHERE a BETWEEN 5 AND 8; +XA END '456'; +XA PREPARE '456'; +CONNECT con2,localhost,root,,; +XA START '789'; +UPDATE t SET b=4*a WHERE a=32; +XA END '789'; +XA PREPARE '789'; +CONNECT con3,localhost,root,,; +# restart +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t; +a b +1 1 +2 2 +3 47 +4 4 +5 134 +8 16 +16 16 +32 128 +COMMIT; +# restart +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t; +a b +1 1 +2 2 +3 47 +4 4 +5 134 +8 16 +16 16 +32 128 +COMMIT; +XA RECOVER; +formatID gtrid_length bqual_length data +1 3 0 123 +1 3 0 456 +1 3 0 789 +XA ROLLBACK '123'; +XA ROLLBACK '456'; +XA COMMIT '789'; +SELECT * FROM t; +a b +2 2 +4 4 +8 8 +16 16 +32 128 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/innodb_bug59733.result b/mysql-test/suite/innodb/r/innodb_bug59733.result new file mode 100644 index 00000000..c962cdfd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug59733.result @@ -0,0 +1,18 @@ +CREATE TABLE bug59733(a INT AUTO_INCREMENT PRIMARY KEY,b CHAR(1))ENGINE=InnoDB; +INSERT INTO bug59733 VALUES(0,'x'); +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +INSERT INTO bug59733 SELECT 0,b FROM bug59733; +CREATE INDEX b ON bug59733 (b); +DELETE FROM bug59733 WHERE (a%100)=0; +DROP INDEX b ON bug59733; +CREATE INDEX b ON bug59733 (b); +DROP TABLE bug59733; diff --git a/mysql-test/suite/innodb/r/innodb_bug60049.result b/mysql-test/suite/innodb/r/innodb_bug60049.result new file mode 100644 index 00000000..47b02ded --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug60049.result @@ -0,0 +1,9 @@ +CREATE TABLE t(a INT)ENGINE=InnoDB STATS_PERSISTENT=0; +RENAME TABLE t TO u; +DROP TABLE u; +SELECT @@innodb_fast_shutdown; +@@innodb_fast_shutdown +0 +Last record of ID_IND root page (9): +18080000180500c0000000000000000c5359535f464f524549474e5f434f4c53 +# restart diff --git a/mysql-test/suite/innodb/r/innodb_bug60196.result b/mysql-test/suite/innodb/r/innodb_bug60196.result new file mode 100644 index 00000000..411950b4 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug60196.result @@ -0,0 +1,117 @@ +CREATE TABLE Bug_60196_FK1 (Primary_Key INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE Bug_60196_FK2 (Primary_Key INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE Bug_60196 ( +FK1_Key INT NOT NULL, +FK2_Key INT NOT NULL, +PRIMARY KEY (FK2_Key, FK1_Key), +KEY FK1_Key (FK1_Key), +KEY FK2_Key (FK2_Key), +CONSTRAINT FK_FK1 FOREIGN KEY (FK1_Key) +REFERENCES Bug_60196_FK1 (Primary_Key) +ON DELETE CASCADE +ON UPDATE CASCADE, +CONSTRAINT FK_FK2 FOREIGN KEY (FK2_Key) +REFERENCES Bug_60196_FK2 (Primary_Key) +ON DELETE CASCADE +ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO Bug_60196_FK1 VALUES (1), (2), (3), (4), (5); +INSERT INTO Bug_60196_FK2 VALUES (1), (2), (3), (4), (5); +INSERT INTO Bug_60196 VALUES (1, 1); +INSERT INTO Bug_60196 VALUES (1, 2); +INSERT INTO Bug_60196 VALUES (1, 3); +INSERT INTO Bug_60196 VALUES (1, 99); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`bug_60196`, CONSTRAINT `FK_FK2` FOREIGN KEY (`FK2_Key`) REFERENCES `Bug_60196_FK2` (`Primary_Key`) ON DELETE CASCADE ON UPDATE CASCADE) +INSERT INTO Bug_60196 VALUES (99, 1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`bug_60196`, CONSTRAINT `FK_FK1` FOREIGN KEY (`FK1_Key`) REFERENCES `Bug_60196_FK1` (`Primary_Key`) ON DELETE CASCADE ON UPDATE CASCADE) +SELECT * FROM bug_60196_FK1; +Primary_Key +1 +2 +3 +4 +5 +SELECT * FROM bug_60196_FK2; +Primary_Key +1 +2 +3 +4 +5 +SELECT * FROM bug_60196; +FK1_Key FK2_Key +1 1 +1 2 +1 3 +# Stop server +# Restart server. +# +# Try to insert more to the example table with foreign keys. +# Bug60196 causes the foreign key file not to be found after +# the resstart above. +# +SELECT * FROM Bug_60196; +FK1_Key FK2_Key +1 1 +1 2 +1 3 +INSERT INTO Bug_60196 VALUES (2, 1); +INSERT INTO Bug_60196 VALUES (2, 2); +INSERT INTO Bug_60196 VALUES (2, 3); +SELECT * FROM Bug_60196; +FK1_Key FK2_Key +1 1 +1 2 +1 3 +2 1 +2 2 +2 3 + +# Clean up. +DROP TABLE Bug_60196; +DROP TABLE Bug_60196_FK1; +DROP TABLE Bug_60196_FK2; +CREATE TABLE Bug_60309_FK ( +ID INT PRIMARY KEY, +ID2 INT, +KEY K2(ID2) +) ENGINE=InnoDB; +CREATE TABLE Bug_60309 ( +ID INT PRIMARY KEY, +FK_ID INT, +KEY (FK_ID), +CONSTRAINT FK FOREIGN KEY (FK_ID) REFERENCES Bug_60309_FK (ID) +) ENGINE=InnoDB; +INSERT INTO Bug_60309_FK (ID, ID2) VALUES (1, 1), (2, 2), (3, 3); +INSERT INTO Bug_60309 VALUES (1, 1); +INSERT INTO Bug_60309 VALUES (2, 99); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`bug_60309`, CONSTRAINT `FK` FOREIGN KEY (`FK_ID`) REFERENCES `Bug_60309_FK` (`ID`)) +SELECT * FROM Bug_60309_FK; +ID ID2 +1 1 +2 2 +3 3 +SELECT * FROM Bug_60309; +ID FK_ID +1 1 +# Stop server +# Restart server. +# +# Try to insert more to the example table with foreign keys. +# Bug60309 causes the foreign key file not to be found after +# the resstart above. +# +SELECT * FROM Bug_60309; +ID FK_ID +1 1 +INSERT INTO Bug_60309 VALUES (2, 2); +INSERT INTO Bug_60309 VALUES (3, 3); +SELECT * FROM Bug_60309; +ID FK_ID +1 1 +2 2 +3 3 + +# Clean up. +DROP TABLE Bug_60309; +DROP TABLE Bug_60309_FK; diff --git a/mysql-test/suite/innodb/r/innodb_bug60229.result b/mysql-test/suite/innodb/r/innodb_bug60229.result new file mode 100644 index 00000000..588f3855 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug60229.result @@ -0,0 +1,32 @@ +CREATE TABLE PERSON ( +PERSON_ID VARCHAR(50) NOT NULL, +DOB VARCHAR(50) NOT NULL, +NAME NVARCHAR(255) NOT NULL, +CONSTRAINT PK_PERSON PRIMARY KEY (PERSON_ID, DOB) +)Engine=InnoDB; +Warnings: +Warning 1280 Name 'PK_PERSON' ignored for PRIMARY key. +CREATE TABLE PHOTO ( +PERSON_ID VARCHAR(50) NOT NULL, +DOB VARCHAR(50) NOT NULL, +PHOTO_DETAILS VARCHAR(50) NULL, +CONSTRAINT PK_PHOTO PRIMARY KEY (PERSON_ID, DOB), +CONSTRAINT FK_PHOTO_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB) +)Engine=InnoDB; +Warnings: +Warning 1280 Name 'PK_PHOTO' ignored for PRIMARY key. +CREATE TABLE ADDRESS ( +PERSON_ID VARCHAR(50) NOT NULL, +DOB VARCHAR(50) NOT NULL, +ADDRESS_ID VARCHAR(50) NOT NULL, +ADDRESS_DETAILS NVARCHAR(250) NULL, +CONSTRAINT PK_ADDRESS PRIMARY KEY (PERSON_ID, DOB, ADDRESS_ID), +CONSTRAINT FK_ADDRESS_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB) ON DELETE CASCADE +)Engine=InnoDB; +Warnings: +Warning 1280 Name 'PK_ADDRESS' ignored for PRIMARY key. +INSERT INTO PERSON VALUES("10", "11011999", "John"); +INSERT INTO PHOTO VALUES("10", "11011999", "new photo"); +DROP TABLE PHOTO; +DROP TABLE ADDRESS; +DROP TABLE PERSON; diff --git a/mysql-test/suite/innodb/r/innodb_bug68148.result b/mysql-test/suite/innodb/r/innodb_bug68148.result new file mode 100644 index 00000000..25bf7f58 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug68148.result @@ -0,0 +1,35 @@ +set global innodb_file_per_table=1; +CREATE TABLE ref_table1 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE ref_table2 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE `main` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`ref_id1` int(11) NOT NULL, +`ref_id2` int(11) NOT NULL, +PRIMARY KEY (`id`), +UNIQUE KEY `idx_1` (`ref_id1`,`ref_id2`), +KEY `FK_set_out_analysis_route_id` (`ref_id2`), +CONSTRAINT `FK_1` FOREIGN KEY (`ref_id1`) REFERENCES `ref_table1` (`id`) , +CONSTRAINT `FK_2` FOREIGN KEY (`ref_id2`) REFERENCES `ref_table2` (`id`) +) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +DROP INDEX `idx_1` ON `main`; +SHOW TABLES; +Tables_in_test +main +ref_table1 +ref_table2 +# restart +ALTER TABLE `main` ADD INDEX `idx_1` (`ref_id1`); +SHOW CREATE TABLE `main`; +Table Create Table +main CREATE TABLE `main` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ref_id1` int(11) NOT NULL, + `ref_id2` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `FK_set_out_analysis_route_id` (`ref_id2`), + KEY `idx_1` (`ref_id1`), + CONSTRAINT `FK_1` FOREIGN KEY (`ref_id1`) REFERENCES `ref_table1` (`id`), + CONSTRAINT `FK_2` FOREIGN KEY (`ref_id2`) REFERENCES `ref_table2` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE main, ref_table1, ref_table2; diff --git a/mysql-test/suite/innodb/r/innodb_bug84958.result b/mysql-test/suite/innodb/r/innodb_bug84958.result new file mode 100644 index 00000000..3375efb9 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug84958.result @@ -0,0 +1,87 @@ +# +# Bug #84958 InnoDB's MVCC has O(N^2) behaviors +# https://bugs.mysql.com/bug.php?id=84958 +# +# Set up the test with a procedure and a function. +# +CREATE PROCEDURE insert_n(start int, end int) +BEGIN +DECLARE i INT DEFAULT start; +WHILE i <= end do +INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i; +SET i = i + 1; +END WHILE; +END~~ +CREATE FUNCTION num_pages_get() +RETURNS INT +BEGIN +DECLARE ret INT; +SELECT variable_value INTO ret +FROM information_schema.global_status +WHERE variable_name = 'innodb_buffer_pool_read_requests'; +RETURN ret; +END~~ +# +# Create a table with one record in it and start an RR transaction +# +CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c)) +ENGINE=InnoDB STATS_PERSISTENT=0; +InnoDB 0 transactions not purged +BEGIN; +SELECT * FROM t1; +a b c +# +# Create 100 newer record versions in con2 and con3 +# +connect con2, localhost, root,,; +connection con2; +BEGIN; +INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = NULL; +CALL insert_n(1, 50);; +connect con3, localhost, root,,; +connection con3; +BEGIN; +CALL insert_n(51, 100);; +connection con2; +COMMIT; +connection con3; +INSERT INTO t1 VALUES (1, 2, 1) ON DUPLICATE KEY UPDATE c = NULL; +COMMIT; +connection default; +# +# Connect to default and record how many pages were accessed +# when selecting the record using the secondary key. +# +InnoDB 2 transactions not purged +SET @num_pages_1 = num_pages_get(); +SELECT * FROM t1 force index (b); +a b c +SET @num_pages_2= num_pages_get(); +SELECT IF(@num_pages_2 - @num_pages_1 < 5000, 'OK', @num_pages_2 - @num_pages_1) num_pages_diff; +num_pages_diff +OK +# +# Commit and show the final record. +# +SELECT * FROM t1; +a b c +SELECT * FROM t1 force index (b); +a b c +COMMIT; +SELECT * FROM t1 force index (b); +a b c +1 2 NULL +SELECT * FROM t1; +a b c +1 2 NULL +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +# +# Cleanup +# +disconnect con2; +disconnect con3; +DROP TABLE t1; +DROP PROCEDURE insert_n; +DROP FUNCTION num_pages_get; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result new file mode 100644 index 00000000..ec7ce044 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result @@ -0,0 +1,1037 @@ +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b BLOB, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=10; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +10 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=50; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +50 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=default; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result new file mode 100644 index 00000000..295a9f1b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result @@ -0,0 +1,536 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +RENAME TABLE t1 TO t0; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c, FORCE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +CHECK TABLE t0,t1; +Table Op Msg_type Msg_text +test.t0 check status OK +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +RENAME TABLE t0 to t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +CREATE INDEX idx_title ON t1(title); +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +ALTER TABLE t1 DROP COLUMN c, FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +RENAME TABLE t1 TO t0; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c, FORCE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +CHECK TABLE t0,t1; +Table Op Msg_type Msg_text +test.t0 check status OK +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +RENAME TABLE t0 to t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +CREATE INDEX idx_title ON t1(title); +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +ALTER TABLE t1 DROP COLUMN c, FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +RENAME TABLE t1 TO t0; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c, FORCE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +CHECK TABLE t0,t1; +Table Op Msg_type Msg_text +test.t0 check status OK +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +RENAME TABLE t0 to t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +CREATE INDEX idx_title ON t1(title); +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +ALTER TABLE t1 DROP COLUMN c, FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +RENAME TABLE t1 TO t0; +# Test Blob +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c, FORCE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +CHECK TABLE t0,t1; +Table Op Msg_type Msg_text +test.t0 check status OK +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +RENAME TABLE t0 to t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +CREATE INDEX idx_title ON t1(title); +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +connect hang,localhost,root; +SET DEBUG_SYNC='alter_table_inplace_trans_commit SIGNAL hung WAIT_FOR ever'; +ALTER TABLE t1 DROP COLUMN c, FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR hung'; +disconnect hang; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result new file mode 100644 index 00000000..3281f879 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result @@ -0,0 +1,222 @@ +include/master-slave.inc +[connection master] +connection master; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 100) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ; +SELECT COUNT(*) FROM t1; +COUNT(*) +50 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 40 AND id > 30; +INSERT INTO t1 VALUES(38, 38, 'b38'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20; +SELECT * FROM t1 WHERE id = 28; +class id title +28 28 b28 +SELECT * FROM t1 WHERE title = 'a28'; +class id title +SELECT * FROM t1 WHERE title = 'b28'; +class id title +28 28 b28 +SELECT * FROM t1 WHERE id = 38; +class id title +38 38 b38 +SELECT * FROM t1 WHERE title = 'a38'; +class id title +SELECT * FROM t1 WHERE title = 'b38'; +class id title +38 38 b38 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +97 +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +CREATE TABLE t_part ( +class INT , +id INT , +title VARCHAR(30) +) ENGINE=InnoDB +PARTITION BY RANGE(id) +SUBPARTITION BY KEY(id) +SUBPARTITIONS 4 +( +PARTITION p0 VALUES LESS THAN (5000), +PARTITION p1 VALUES LESS THAN (MAXVALUE) +); +INSERT INTO t_part SELECT * FROM t1; +ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10)); +SELECT * FROM t_part WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t_part WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t_part WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t_part WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t_part WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t_part WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t_part WHERE id = 101; +class id title +SELECT * FROM t_part WHERE title = 'a101'; +class id title +include/sync_slave_sql_with_master.inc +connection slave; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `class` int(11) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `title` varchar(100) DEFAULT NULL, + KEY `idx_id` (`id`), + KEY `idx_title` (`title`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW CREATE TABLE t_part; +Table Create Table +t_part CREATE TABLE `t_part` ( + `class` int(11) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `title` varchar(30) DEFAULT NULL, + KEY `idx` (`class`,`id`,`title`(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY RANGE (`id`) +SUBPARTITION BY KEY (`id`) +SUBPARTITIONS 4 +(PARTITION `p0` VALUES LESS THAN (5000) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +SELECT COUNT(*) FROM t1; +COUNT(*) +97 +SELECT COUNT(*) FROM t_part; +COUNT(*) +97 +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +SELECT * FROM t_part WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t_part WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t_part WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t_part WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t_part WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t_part WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t_part WHERE id = 101; +class id title +SELECT * FROM t_part WHERE title = 'a101'; +class id title +connection master; +DROP PROCEDURE populate_t1; +DROP TABLE t1; +DROP TABLE t_part; +include/rpl_end.inc diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result new file mode 100644 index 00000000..b48207d4 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result @@ -0,0 +1,139 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 1000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 500; +class id title +500 500 a500 +SELECT * FROM t1 WHERE title = 'a500'; +class id title +500 500 a500 +SELECT * FROM t1 WHERE id = 1000; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE title = 'a1000'; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE id = 1010; +class id title +SELECT * FROM t1 WHERE title = 'a1010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 500; +class id title +500 500 a500 +SELECT * FROM t1 WHERE title = 'a500'; +class id title +500 500 a500 +SELECT * FROM t1 WHERE id = 1000; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE title = 'a1000'; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE id = 1010; +class id title +SELECT * FROM t1 WHERE title = 'a1010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result new file mode 100644 index 00000000..daf0345e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result @@ -0,0 +1,71 @@ +set names utf8; +CREATE TABLE corrupt_bit_test_ā( +a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(100), +c INT, +z INT, +INDEX idx(b)) +ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); +CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b); +CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); +SELECT * FROM corrupt_bit_test_ā; +a b c z +1 x 1 1 +INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; +select count(*) from corrupt_bit_test_ā; +count(*) +2 +SET @save_dbug = @@SESSION.debug_dbug; +SET debug_dbug = '+d,dict_set_index_corrupted'; +check table corrupt_bit_test_ā; +Table Op Msg_type Msg_text +test.corrupt_bit_test_ā check Warning InnoDB: Index idx is marked as corrupted +test.corrupt_bit_test_ā check Warning InnoDB: Index idxā is marked as corrupted +test.corrupt_bit_test_ā check Warning InnoDB: Index idxē is marked as corrupted +test.corrupt_bit_test_ā check error Corrupt +SET @@SESSION.debug_dbug = @save_dbug; +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +ERROR HY000: Index idx is corrupted +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); +ERROR HY000: Index idx is corrupted +select c from corrupt_bit_test_ā; +ERROR HY000: Index corrupt_bit_test_ā is corrupted +select z from corrupt_bit_test_ā; +ERROR HY000: Index corrupt_bit_test_ā is corrupted +show warnings; +Level Code Message +Warning 180 InnoDB: Index idxē for table `test`.`corrupt_bit_test_ā` is marked as corrupted +Error 1712 Index corrupt_bit_test_ā is corrupted +insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); +select * from corrupt_bit_test_ā use index(primary) where a = 10001; +a b c z +10001 a 20001 20001 +begin; +insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002); +delete from corrupt_bit_test_ā where a = 10001; +insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); +rollback; +drop index idxā on corrupt_bit_test_ā; +check table corrupt_bit_test_ā; +Table Op Msg_type Msg_text +test.corrupt_bit_test_ā check Warning InnoDB: Index idx is marked as corrupted +test.corrupt_bit_test_ā check Warning InnoDB: Index idxē is marked as corrupted +test.corrupt_bit_test_ā check error Corrupt +set names utf8; +select z from corrupt_bit_test_ā; +ERROR HY000: Index corrupt_bit_test_ā is corrupted +drop index idxē on corrupt_bit_test_ā; +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +ERROR HY000: Index idx is corrupted +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); +ERROR HY000: Index idx is corrupted +drop index idx on corrupt_bit_test_ā; +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); +select z from corrupt_bit_test_ā limit 10; +z +20001 +1 +2 +drop table corrupt_bit_test_ā; diff --git a/mysql-test/suite/innodb/r/innodb_ctype_big5.result b/mysql-test/suite/innodb/r/innodb_ctype_big5.result new file mode 100644 index 00000000..4c9f7a81 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_big5.result @@ -0,0 +1,285 @@ +SET DEFAULT_STORAGE_ENGINE=InnoDB; +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET NAMES big5; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_ctype_latin1.result b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result new file mode 100644 index 00000000..d576f210 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result @@ -0,0 +1,285 @@ +SET DEFAULT_STORAGE_ENGINE=InnoDB; +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET NAMES latin1; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_ctype_ldml.result b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result new file mode 100644 index 00000000..22841cca --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result @@ -0,0 +1,1102 @@ +drop table if exists t1; +In the following tests we change the order of letter "b" +making it equal to letter "a", and check that it works +with all Unicode character sets +set names utf8; +show variables like 'character_sets_dir%'; +Variable_name Value +character_sets_dir MYSQL_TEST_DIR/std_data/ldml/ +show collation like 'utf8mb3_phone_ci'; +Collation Charset Id Default Compiled Sortlen +utf8mb3_phone_ci utf8mb3 352 8 +CREATE TABLE t1 ( +name VARCHAR(64), +phone VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_phone_ci +); +INSERT INTO t1 VALUES ('Svoj','+7 912 800 80 02'); +INSERT INTO t1 VALUES ('Hf','+7 (912) 800 80 04'); +INSERT INTO t1 VALUES ('Bar','+7-912-800-80-01'); +INSERT INTO t1 VALUES ('Ramil','(7912) 800 80 03'); +INSERT INTO t1 VALUES ('Sanja','+380 (912) 8008005'); +SELECT * FROM t1 ORDER BY phone; +name phone +Sanja +380 (912) 8008005 +Bar +7-912-800-80-01 +Svoj +7 912 800 80 02 +Ramil (7912) 800 80 03 +Hf +7 (912) 800 80 04 +SELECT * FROM t1 WHERE phone='+7(912)800-80-01'; +name phone +Bar +7-912-800-80-01 +SELECT * FROM t1 WHERE phone='79128008001'; +name phone +Bar +7-912-800-80-01 +SELECT * FROM t1 WHERE phone='7 9 1 2 8 0 0 8 0 0 1'; +name phone +Bar +7-912-800-80-01 +DROP TABLE t1; +show collation like 'utf8mb3_test_ci'; +Collation Charset Id Default Compiled Sortlen +utf8mb3_test_ci utf8mb3 353 8 +create table t1 (c1 char(1) character set utf8 collate utf8_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +c1 +a +drop table t1; +show collation like 'ucs2_test_ci'; +Collation Charset Id Default Compiled Sortlen +ucs2_test_ci ucs2 358 8 +create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +c1 +a +drop table t1; +show collation like 'utf8mb4_test_ci'; +Collation Charset Id Default Compiled Sortlen +utf8mb4_test_ci utf8mb4 326 8 +create table t1 (c1 char(1) character set utf8mb4 collate utf8mb4_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +c1 +a +drop table t1; +show collation like 'utf16_test_ci'; +Collation Charset Id Default Compiled Sortlen +utf16_test_ci utf16 327 8 +create table t1 (c1 char(1) character set utf16 collate utf16_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +c1 +a +drop table t1; +show collation like 'utf32_test_ci'; +Collation Charset Id Default Compiled Sortlen +utf32_test_ci utf32 391 8 +create table t1 (c1 char(1) character set utf32 collate utf32_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +c1 +a +drop table t1; +# +# Bug#45645 Mysql server close all connection and restart using lower function +# +CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci; +INSERT INTO t1 (a) VALUES ('hello!'); +SELECT * FROM t1 WHERE LOWER(a)=LOWER('N'); +a +DROP TABLE t1; +# +# Bug#51976 LDML collations issue (cyrillic example) +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci); +INSERT INTO t1 (a) VALUES ('Hello'); +SELECT a, UPPER(a), LOWER(a) FROM t1; +a UPPER(a) LOWER(a) +Hello HELLO hello +DROP TABLE t1; +# +# Bug#43827 Server closes connections and restarts +# +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci); +INSERT IGNORE INTO t1 SELECT REPEAT('a',11); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +DROP TABLE t1; +Vietnamese experimental collation +show collation like 'ucs2_vn_ci'; +Collation Charset Id Default Compiled Sortlen +ucs2_vn_ci ucs2 359 8 +create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci); +insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2), +(0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0); +insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2), +(0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6); +insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8), +(0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC); +insert into t1 values ('b'),('B'),('c'),('C'); +insert into t1 values ('d'),('D'),(0x0111),(0x0110); +insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA), +(0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8); +insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2), +(0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6); +insert into t1 values ('g'),('G'),('h'),('H'); +insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8), +(0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA); +insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M'); +insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE), +(0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC); +insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4), +(0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8); +insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE), +(0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2); +insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T'); +insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6), +(0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4); +insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC), +(0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0); +insert into t1 values ('v'),('V'),('x'),('X'); +insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6), +(0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4); +select hex(c1) as h, c1 from t1 order by c1, h; +h c1 +0041 A +0061 a +00C0 À +00C1 Á +00C3 Ã +00E0 à +00E1 á +00E3 ã +1EA0 Ạ +1EA1 ạ +1EA2 Ả +1EA3 ả +0102 Ă +0103 ă +1EAE Ắ +1EAF ắ +1EB0 Ằ +1EB1 ằ +1EB2 Ẳ +1EB3 ẳ +1EB4 Ẵ +1EB5 ẵ +1EB6 Ặ +1EB7 ặ +00C2 Â +00E2 â +1EA4 Ấ +1EA5 ấ +1EA6 Ầ +1EA7 ầ +1EA8 Ẩ +1EA9 ẩ +1EAA Ẫ +1EAB ẫ +1EAC Ậ +1EAD ậ +0042 B +0062 b +0043 C +0063 c +0044 D +0064 d +0110 Đ +0111 đ +0045 E +0065 e +00C8 È +00C9 É +00E8 è +00E9 é +1EB8 Ẹ +1EB9 ẹ +1EBA Ẻ +1EBB ẻ +1EBC Ẽ +1EBD ẽ +00CA Ê +00EA ê +1EBE Ế +1EBF ế +1EC0 Ề +1EC1 ề +1EC2 Ể +1EC3 ể +1EC4 Ễ +1EC5 ễ +1EC6 Ệ +1EC7 ệ +0047 G +0067 g +0048 H +0068 h +0049 I +0069 i +00CC Ì +00CD Í +00EC ì +00ED í +0128 Ĩ +0129 ĩ +1EC8 Ỉ +1EC9 ỉ +1ECA Ị +1ECB ị +004B K +006B k +004C L +006C l +004D M +006D m +004F O +006F o +00D2 Ò +00D3 Ó +00D5 Õ +00F2 ò +00F3 ó +00F5 õ +1ECC Ọ +1ECD ọ +1ECE Ỏ +1ECF ỏ +00D4 Ô +00F4 ô +1ED0 Ố +1ED1 ố +1ED2 Ồ +1ED3 ồ +1ED4 Ổ +1ED5 ổ +1ED6 Ỗ +1ED7 ỗ +1ED8 Ộ +1ED9 ộ +01A0 Ơ +01A1 ơ +1EDA Ớ +1EDB ớ +1EDC Ờ +1EDD ờ +1EDE Ở +1EDF ở +1EE0 Ỡ +1EE1 ỡ +1EE2 Ợ +1EE3 ợ +0050 P +0070 p +0051 Q +0071 q +0052 R +0072 r +0053 S +0073 s +0054 T +0074 t +0055 U +0075 u +00D9 Ù +00DA Ú +00F9 ù +00FA ú +0168 Ũ +0169 ũ +1EE4 Ụ +1EE5 ụ +1EE6 Ủ +1EE7 ủ +01AF Ư +01B0 ư +1EE8 Ứ +1EE9 ứ +1EEA Ừ +1EEB ừ +1EEC Ử +1EED ử +1EEE Ữ +1EEF ữ +1EF0 Ự +1EF1 ự +0056 V +0076 v +0058 X +0078 x +0059 Y +0079 y +00DD Ý +00FD ý +1EF2 Ỳ +1EF3 ỳ +1EF4 Ỵ +1EF5 ỵ +1EF6 Ỷ +1EF7 ỷ +1EF8 Ỹ +1EF9 ỹ +select group_concat(hex(c1) order by hex(c1)) from t1 group by c1; +group_concat(hex(c1) order by hex(c1)) +0041,0061,00C0,00C1,00C3,00E0,00E1,00E3,1EA0,1EA1,1EA2,1EA3 +0102,0103,1EAE,1EAF,1EB0,1EB1,1EB2,1EB3,1EB4,1EB5,1EB6,1EB7 +00C2,00E2,1EA4,1EA5,1EA6,1EA7,1EA8,1EA9,1EAA,1EAB,1EAC,1EAD +0042,0062 +0043,0063 +0044,0064 +0110,0111 +0045,0065,00C8,00C9,00E8,00E9,1EB8,1EB9,1EBA,1EBB,1EBC,1EBD +00CA,00EA,1EBE,1EBF,1EC0,1EC1,1EC2,1EC3,1EC4,1EC5,1EC6,1EC7 +0047,0067 +0048,0068 +0049,0069,00CC,00CD,00EC,00ED,0128,0129,1EC8,1EC9,1ECA,1ECB +004B,006B +004C,006C +004D,006D +004F,006F,00D2,00D3,00D5,00F2,00F3,00F5,1ECC,1ECD,1ECE,1ECF +00D4,00F4,1ED0,1ED1,1ED2,1ED3,1ED4,1ED5,1ED6,1ED7,1ED8,1ED9 +01A0,01A1,1EDA,1EDB,1EDC,1EDD,1EDE,1EDF,1EE0,1EE1,1EE2,1EE3 +0050,0070 +0051,0071 +0052,0072 +0053,0073 +0054,0074 +0055,0075,00D9,00DA,00F9,00FA,0168,0169,1EE4,1EE5,1EE6,1EE7 +01AF,01B0,1EE8,1EE9,1EEA,1EEB,1EEC,1EED,1EEE,1EEF,1EF0,1EF1 +0056,0076 +0058,0078 +0059,0079,00DD,00FD,1EF2,1EF3,1EF4,1EF5,1EF6,1EF7,1EF8,1EF9 +select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1; +group_concat(c1 order by hex(c1) SEPARATOR '') +AaÀÁÃàáãẠạẢả +ĂăẮắẰằẲẳẴẵẶặ +ÂâẤấẦầẨẩẪẫẬậ +Bb +Cc +Dd +Đđ +EeÈÉèéẸẹẺẻẼẽ +ÊêẾếỀềỂểỄễỆệ +Gg +Hh +IiÌÍìíĨĩỈỉỊị +Kk +Ll +Mm +OoÒÓÕòóõỌọỎỏ +ÔôỐốỒồỔổỖỗỘộ +ƠơỚớỜờỞởỠỡỢợ +Pp +Qq +Rr +Ss +Tt +UuÙÚùúŨũỤụỦủ +ƯưỨứỪừỬửỮữỰự +Vv +Xx +YyÝýỲỳỴỵỶỷỸỹ +drop table t1; +Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20 +set names latin1; +show collation like 'latin1_test'; +Collation Charset Id Default Compiled Sortlen +latin1_test latin1 331 1 +select "foo" = "foo " collate latin1_test; +"foo" = "foo " collate latin1_test +1 +The following tests check that two-byte collation IDs work +select * from information_schema.collations where id>256 and is_compiled<>'Yes' order by id; +COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN +ascii2_general_nopad_ci ascii2 318 1 +ascii2_bin2 ascii2 319 1 +ascii2_general_ci ascii2 320 Yes 1 +ascii2_bin ascii2 321 1 +ascii2_general_inherited_ci ascii2 322 1 +ascii2_general_inherited2_ci ascii2 323 1 +ascii2_badly_inherited_ci ascii2 324 1 +ascii2_nopad_bin ascii2 325 1 +utf8mb4_test_ci utf8mb4 326 8 +utf16_test_ci utf16 327 8 +utf8mb4_test_400_ci utf8mb4 328 8 +utf8mb4_test_520_nopad_ci utf8mb4 329 8 +utf8mb4_uca1400_test01_as_ci utf8mb4 330 4 +latin1_test latin1 331 1 +latin1_test2 latin1 332 1 +latin1_test2_cs latin1 333 1 +latin1_swedish_nopad2_ci latin1 334 1 +utf8mb3_bengali_standard_ci utf8mb3 336 8 +utf8mb3_bengali_traditional_ci utf8mb3 337 8 +utf8mb3_implicit_weights_ci utf8mb3 338 8 +utf8mb3_phone_ci utf8mb3 352 8 +utf8mb3_test_ci utf8mb3 353 8 +utf8mb3_5624_1 utf8mb3 354 8 +utf8mb3_5624_2 utf8mb3 355 8 +utf8mb3_5624_3 utf8mb3 356 8 +utf8mb3_5624_4 utf8mb3 357 8 +ucs2_test_ci ucs2 358 8 +ucs2_vn_ci ucs2 359 8 +ucs2_5624_1 ucs2 360 8 +utf8mb3_5624_5 utf8mb3 368 8 +utf8mb3_5624_5_bad utf8mb3 369 8 +utf8mb3_czech_test_w2 utf8mb3 370 4 +utf8mb3_czech_test_nopad_w2 utf8mb3 371 4 +utf8mb3_czech_test_bad_w2 utf8mb3 372 4 +utf32_test_ci utf32 391 8 +utf8mb3_maxuserid_ci utf8mb3 2047 8 +show collation like '%test%'; +Collation Charset Id Default Compiled Sortlen +latin1_test latin1 331 1 +latin1_test2 latin1 332 1 +latin1_test2_cs latin1 333 1 +utf8mb3_test_ci utf8mb3 353 8 +utf8mb3_czech_test_w2 utf8mb3 370 4 +utf8mb3_czech_test_nopad_w2 utf8mb3 371 4 +utf8mb3_czech_test_bad_w2 utf8mb3 372 4 +ucs2_test_ci ucs2 358 8 +utf8mb4_test_ci utf8mb4 326 8 +utf8mb4_test_400_ci utf8mb4 328 8 +utf8mb4_test_520_nopad_ci utf8mb4 329 8 +utf8mb4_uca1400_test01_as_ci utf8mb4 330 4 +utf16_test_ci utf16 327 8 +utf32_test_ci utf32 391 8 +show collation like 'ucs2_vn_ci'; +Collation Charset Id Default Compiled Sortlen +ucs2_vn_ci ucs2 359 8 +create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(1) CHARACTER SET ucs2 COLLATE ucs2_vn_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values (0x0061); +set @@character_set_results=NULL; +select * from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 c1 c1 254 2 2 Y 0 0 359 +c1 +a +drop table t1; +CREATE TABLE t1 (s1 char(10) character set utf8 collate utf8_maxuserid_ci); +INSERT INTO t1 VALUES ('a'),('b'); +SELECT * FROM t1 WHERE s1='a' ORDER BY BINARY s1; +s1 +a +b +DROP TABLE t1; +SET NAMES utf8 COLLATE utf8_phone_ci; +show collation like 'utf8mb3_phone_ci'; +Collation Charset Id Default Compiled Sortlen +utf8mb3_phone_ci utf8mb3 352 8 +SET NAMES utf8; +SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci)); +hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci)) +0E33 +SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)); +hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)) +FFFD +SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)); +hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci) hex(lower(@a)) +F0909080 F0909080 +SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)); +hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci) hex(upper(@a)) +F09090A8 F09090A8 +SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a)); +hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci) hex(lower(@a)) +E2B080 E2B080 +SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a)); +hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci) hex(upper(@a)) +E2B0B0 E2B0B0 +# +# WL#5624 Collation customization improvements +# +SET NAMES utf8 COLLATE utf8_5624_1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 16) AS a LIMIT 0; +INSERT INTO t1 VALUES ('012345'),('001234'),('000123'),('000012'),('000001'); +INSERT INTO t1 VALUES ('12345'),('01234'),('00123'),('00012'),('00001'); +INSERT INTO t1 VALUES ('1234'),('0123'),('0012'),('0001'); +INSERT INTO t1 VALUES ('123'),('012'),('001'); +INSERT INTO t1 VALUES ('12'),('01'); +INSERT INTO t1 VALUES ('1'),('9'); +INSERT INTO t1 VALUES ('ГАИ'),('ГИБДД'); +INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'); +INSERT INTO t1 VALUES ('cz'),('Ċ'),('ċ'); +INSERT INTO t1 VALUES ('f'),('fz'),('g'),('Ġ'),('ġ'); +INSERT INTO t1 VALUES ('h'),('hz'),('GĦ'),('Għ'),('gĦ'),('għ'); +INSERT INTO t1 VALUES ('i'),('iz'),('Ħ'),('ħ'); +INSERT INTO t1 VALUES ('y'),('yz'),('z'),('Ż'),('ż'); +INSERT INTO t1 VALUES ('ā'),('Ā'),('á'),('Á'),('à'),('À'); +INSERT INTO t1 VALUES ('ē'),('é'),('ě'),('ê'),('Ē'),('É'),('Ě'),('Ê'); +INSERT INTO t1 VALUES ('a'),('~'),('!'),('@'),('#'),('$'),('%'),('^'); +INSERT INTO t1 VALUES ('('),(')'),('-'),('+'),('|'),('='),(':'),(';'); +INSERT INTO t1 VALUES ('"'),('\''),('?'); +INSERT INTO t1 VALUES ('ch'),('k'),('cs'),('ccs'),('cscs'); +INSERT INTO t1 VALUES ('aa-'),('ab-'),('ac-'),('ad-'),('ae-'),('af-'),('az-'); +INSERT INTO t1 VALUES ('lp-fni'),('lp-lni'); +INSERT INTO t1 VALUES ('lp-fpi'),('lp-lpi'); +INSERT INTO t1 VALUES ('lp-fsi'),('lp-lsi'); +INSERT INTO t1 VALUES ('lp-fti'),('lp-lti'); +INSERT INTO t1 VALUES ('lp-ft'),('lp-lt'); +INSERT INTO t1 VALUES ('lp-fv'),('lp-lv'); +INSERT INTO t1 VALUES ('lb-fni'),('lb-lni'); +INSERT INTO t1 VALUES ('lb-fv'),('lb-lv'); +INSERT INTO t1 VALUES (_ucs2 0x3106),(_ucs2 0x3110), (_ucs2 0x3111), (_ucs2 0x3112); +INSERT INTO t1 VALUES (_ucs2 0x32A3), (_ucs2 0x3231); +INSERT INTO t1 VALUES (_ucs2 0x84D9), (_ucs2 0x98F5), (_ucs2 0x7CF3), (_ucs2 0x5497); +SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY a; +a HEX(WEIGHT_STRING(a)) +lp-ft 0001 +lp-lt 0001 +lp-fpi 0001 +lp-fsi 0001 +lp-fti 0001 +lp-lpi 0001 +lp-lsi 0001 +lp-lti 0001 +lb-fv 0200233E +lb-fni 0200233E +lp-fv 0202 +lp-fni 0202 +- 0221 += 042D +| 0430 +lb-lv 0DD9233E +lp-lv 0DDB +1 0E2A +01 0E2A +001 0E2A +0001 0E2A +00001 0E2A +000001 0E2A +12 0E2A0E2B +012 0E2A0E2B +0012 0E2A0E2B +00012 0E2A0E2B +000012 0E2A0E2B +123 0E2A0E2B0E2C +0123 0E2A0E2B0E2C +00123 0E2A0E2B0E2C +000123 0E2A0E2B0E2C +1234 0E2A0E2B0E2C0E2D +01234 0E2A0E2B0E2C0E2D +001234 0E2A0E2B0E2C0E2D +12345 0E2A0E2B0E2C0E2D0E2E +012345 0E2A0E2B0E2C0E2D0E2E +9 0E32 +~ 0E32233E +! 0E32233F +@ 0E322340 +# 0E322341 +$ 0E322342 +% 0E322343 +^ 0E322344 +( 0E322346 +) 0E322347 ++ 0E322348 +: 0E322349 +; 0E32234A +" 0E32234B +' 0E32234C +? 0E32234D +a 0E33 +a 0E33 +aa- 0E330E330221 +ab- 0E330E4A0E34 +ac- 0E330E600E60 +ad- 0E330E6D0E6D +ae- 0E330E8B0E8B +af- 0E330EB90EB9 +az- 0E33106A0221 +b 0E4A +À 0E4A +Á 0E4A +à 0E4A +á 0E4A +Ā 0E4A +ā 0E4A +c 0E60 +k 0E600EE1 +ch 0E600EE1 +cs 0E600FEA +ccs 0E600FEA0E600FEA +cscs 0E600FEA0E600FEA +cz 0E60106A +Ċ 0E6C233E +ċ 0E6C233E +d 0E6D +É 0E6D +Ê 0E6D +é 0E6D +ê 0E6D +Ē 0E6D +ē 0E6D +Ě 0E6D +ě 0E6D +e 0E8B +f 0EB9 +fz 0EB9106A +Ġ 0EC0233E +ġ 0EC0233E +g 0EC1 +GĦ 0EE0233E +Għ 0EE0233E +gĦ 0EE0233E +għ 0EE0233E +h 0EE1 +hz 0EE1106A +Ħ 0EFA233E +ħ 0EFA233E +i 0EFB +iz 0EFB106A +y 105E +yz 105E106A +Ż 1069233E +ż 1069233E +z 106A +ГАИ 11341114117C +ГИБДД 11341114117C +lb-lni 233C233E +lp-lni 233E +ㄆ 233F +ㄐ 2349 +ㄑ 234A +ㄒ 234B +㊣ 7147 +㈱ 72D5 +蓙 753C +飵 753D +糳 753E +咗 753F +# +# WL#5624, the same test with UCS2 +# +ALTER TABLE t1 CONVERT TO CHARACTER SET ucs2 COLLATE ucs2_5624_1; +SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a); +a HEX(WEIGHT_STRING(a)) +lp-ft 0001 +lp-lt 0001 +lp-fpi 0001 +lp-fsi 0001 +lp-fti 0001 +lp-lpi 0001 +lp-lsi 0001 +lp-lti 0001 +lb-fv 0200233E +lb-fni 0200233E +lp-fv 0202 +lp-fni 0202 +- 0221 += 042D +| 0430 +lb-lv 0DD9233E +lp-lv 0DDB +1 0E2A +01 0E2A +001 0E2A +0001 0E2A +00001 0E2A +000001 0E2A +12 0E2A0E2B +012 0E2A0E2B +0012 0E2A0E2B +00012 0E2A0E2B +000012 0E2A0E2B +123 0E2A0E2B0E2C +0123 0E2A0E2B0E2C +00123 0E2A0E2B0E2C +000123 0E2A0E2B0E2C +1234 0E2A0E2B0E2C0E2D +01234 0E2A0E2B0E2C0E2D +001234 0E2A0E2B0E2C0E2D +12345 0E2A0E2B0E2C0E2D0E2E +012345 0E2A0E2B0E2C0E2D0E2E +9 0E32 +~ 0E32233E +! 0E32233F +@ 0E322340 +# 0E322341 +$ 0E322342 +% 0E322343 +^ 0E322344 +( 0E322346 +) 0E322347 ++ 0E322348 +: 0E322349 +; 0E32234A +" 0E32234B +' 0E32234C +? 0E32234D +a 0E33 +a 0E33 +aa- 0E330E330221 +ab- 0E330E4A0E34 +ac- 0E330E600E60 +ad- 0E330E6D0E6D +ae- 0E330E8B0E8B +af- 0E330EB90EB9 +az- 0E33106A0221 +b 0E4A +À 0E4A +Á 0E4A +à 0E4A +á 0E4A +Ā 0E4A +ā 0E4A +c 0E60 +k 0E600EE1 +ch 0E600EE1 +cs 0E600FEA +ccs 0E600FEA0E600FEA +cscs 0E600FEA0E600FEA +cz 0E60106A +Ċ 0E6C233E +ċ 0E6C233E +d 0E6D +É 0E6D +Ê 0E6D +é 0E6D +ê 0E6D +Ē 0E6D +ē 0E6D +Ě 0E6D +ě 0E6D +e 0E8B +f 0EB9 +fz 0EB9106A +Ġ 0EC0233E +ġ 0EC0233E +g 0EC1 +GĦ 0EE0233E +Għ 0EE0233E +gĦ 0EE0233E +għ 0EE0233E +h 0EE1 +hz 0EE1106A +Ħ 0EFA233E +ħ 0EFA233E +i 0EFB +iz 0EFB106A +y 105E +yz 105E106A +Ż 1069233E +ż 1069233E +z 106A +ГАИ 11341114117C +ГИБДД 11341114117C +lb-lni 233C233E +lp-lni 233E +ㄆ 233F +ㄐ 2349 +ㄑ 234A +ㄒ 234B +㊣ 7147 +㈱ 72D5 +蓙 753C +飵 753D +糳 753E +咗 753F +DROP TABLE t1; +# +# WL#5624, unsupported features +# +SET NAMES utf8 COLLATE utf8_5624_2; +ERROR HY000: Unknown collation: 'utf8_5624_2' +SHOW WARNINGS; +Level Code Message +Error 1273 Unknown collation: 'utf8_5624_2' +Warning 1273 Syntax error at '[strength tertiary]' +# +# WL#5624, reset before primary ignorable +# +SET NAMES utf8 COLLATE utf8_5624_3; +ERROR HY000: Unknown collation: 'utf8_5624_3' +SHOW WARNINGS; +Level Code Message +Error 1273 Unknown collation: 'utf8_5624_3' +Warning 1273 Can't reset before a primary ignorable character U+A48C +# +# WL#5624, \u without hex digits is equal to {'\', 'u'} +# +SET NAMES utf8 COLLATE utf8_5624_4; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +INSERT INTO t1 VALUES ('\\'),('u'),('x'),('X'); +SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a); +a HEX(WEIGHT_STRING(a)) +\ 02CE +x 02CE101F +u 101F +X 105A +DROP TABLE t1; +# +# WL#5624, testing Bengali collations +# +SET NAMES utf8, collation_connection=utf8_bengali_standard_ci; +CREATE TABLE t1 AS SELECT REPEAT (' ', 10) AS a LIMIT 0; +INSERT INTO t1 VALUES (_ucs2 0x09FA), (_ucs2 0x09F8), (_ucs2 0x09F9), (_ucs2 0x09F2); +INSERT INTO t1 VALUES (_ucs2 0x09DC), (_ucs2 0x09A109BC); +INSERT INTO t1 VALUES (_ucs2 0x09A2), (_ucs2 0x09DD), (_ucs2 0x09A209BC); +INSERT INTO t1 VALUES (_ucs2 0x09A3); +SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a) +FROM t1 ORDER BY a, BINARY a; +HEX(WEIGHT_STRING(a)) HEX(CONVERT(a USING ucs2)) HEX(a) +0350 09FA E0A7BA +0351 09F8 E0A7B8 +0352 09F9 E0A7B9 +0353 09F2 E0A7B2 +0374 09A109BC E0A6A1E0A6BC +0374 09DC E0A79C +0375 09A2 E0A6A2 +0376 09A209BC E0A6A2E0A6BC +0376 09DD E0A79D +0377 09A3 E0A6A3 +DROP TABLE t1; +SET NAMES utf8, collation_connection=utf8_bengali_traditional_ci; +CREATE TABLE t1 AS SELECT REPEAT (' ', 10) AS a LIMIT 0; +INSERT INTO t1 VALUES +(_ucs2 0x0985),(_ucs2 0x0986),(_ucs2 0x0987),(_ucs2 0x0988), +(_ucs2 0x0989),(_ucs2 0x098A),(_ucs2 0x098B),(_ucs2 0x09E0), +(_ucs2 0x098C),(_ucs2 0x09E1),(_ucs2 0x098F),(_ucs2 0x0990), +(_ucs2 0x0993); +INSERT INTO t1 VALUES +(_ucs2 0x0994),(_ucs2 0x0982),(_ucs2 0x0983),(_ucs2 0x0981), +(_ucs2 0x099509CD), (_ucs2 0x099609CD), (_ucs2 0x099709CD), (_ucs2 0x099809CD), +(_ucs2 0x099909CD), (_ucs2 0x099A09CD), (_ucs2 0x099B09CD), (_ucs2 0x099C09CD), +(_ucs2 0x099D09CD), (_ucs2 0x099E09CD), (_ucs2 0x099F09CD), (_ucs2 0x09A009CD), +(_ucs2 0x09A109CD), (_ucs2 0x09A209CD), (_ucs2 0x09A309CD), +(_ucs2 0x09CE), (_ucs2 0x09A409CD200D), (_ucs2 0x09A409CD), +(_ucs2 0x09A509CD),(_ucs2 0x09A609CD), +(_ucs2 0x09A709CD), (_ucs2 0x09A809CD), (_ucs2 0x09AA09CD), (_ucs2 0x09AB09CD), +(_ucs2 0x09AC09CD), (_ucs2 0x09AD09CD), (_ucs2 0x09AE09CD), (_ucs2 0x09AF09CD), +(_ucs2 0x09B009CD), (_ucs2 0x09F009CD), (_ucs2 0x09B209CD), (_ucs2 0x09F109CD), +(_ucs2 0x09B609CD), (_ucs2 0x09B709CD), (_ucs2 0x09B809CD), (_ucs2 0x09B909CD); +INSERT INTO t1 VALUES +(_ucs2 0x099509CD0985),(_ucs2 0x0995), +(_ucs2 0x099509CD0986),(_ucs2 0x099509BE), +(_ucs2 0x099509CD0987),(_ucs2 0x099509BF), +(_ucs2 0x099509CD0988),(_ucs2 0x099509C0), +(_ucs2 0x099509CD0989),(_ucs2 0x099509C1), +(_ucs2 0x099509CD098A),(_ucs2 0x099509C2), +(_ucs2 0x099509CD098B),(_ucs2 0x099509C3), +(_ucs2 0x099509CD09E0),(_ucs2 0x099509C4), +(_ucs2 0x099509CD098C),(_ucs2 0x099509E2), +(_ucs2 0x099509CD09E1),(_ucs2 0x099509E3), +(_ucs2 0x099509CD098F),(_ucs2 0x099509C7), +(_ucs2 0x099509CD0990),(_ucs2 0x099509C8), +(_ucs2 0x099509CD0993),(_ucs2 0x099509CB), +(_ucs2 0x099509CD0994),(_ucs2 0x099509CC); +SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a) +FROM t1 ORDER BY a, BINARY(a); +HEX(WEIGHT_STRING(a)) HEX(CONVERT(a USING ucs2)) HEX(a) +15A2 0985 E0A685 +15A3 0986 E0A686 +15A4 0987 E0A687 +15A5 0988 E0A688 +15A6 0989 E0A689 +15A7 098A E0A68A +15A8 098B E0A68B +15A9 09E0 E0A7A0 +15AA 098C E0A68C +15AB 09E1 E0A7A1 +15AC 098F E0A68F +15AD 0990 E0A690 +15AE 0993 E0A693 +15AF 0994 E0A694 +15B0 0982 E0A682 +15B1 0983 E0A683 +15B2 0981 E0A681 +15B3 099509CD E0A695E0A78D +15B315A2 0995 E0A695 +15B315A2 099509CD0985 E0A695E0A78DE0A685 +15B315A3 099509BE E0A695E0A6BE +15B315A3 099509CD0986 E0A695E0A78DE0A686 +15B315A4 099509BF E0A695E0A6BF +15B315A4 099509CD0987 E0A695E0A78DE0A687 +15B315A5 099509C0 E0A695E0A780 +15B315A5 099509CD0988 E0A695E0A78DE0A688 +15B315A6 099509C1 E0A695E0A781 +15B315A6 099509CD0989 E0A695E0A78DE0A689 +15B315A7 099509C2 E0A695E0A782 +15B315A7 099509CD098A E0A695E0A78DE0A68A +15B315A8 099509C3 E0A695E0A783 +15B315A8 099509CD098B E0A695E0A78DE0A68B +15B315A9 099509C4 E0A695E0A784 +15B315A9 099509CD09E0 E0A695E0A78DE0A7A0 +15B315AA 099509CD098C E0A695E0A78DE0A68C +15B315AA 099509E2 E0A695E0A7A2 +15B315AB 099509CD09E1 E0A695E0A78DE0A7A1 +15B315AB 099509E3 E0A695E0A7A3 +15B315AC 099509C7 E0A695E0A787 +15B315AC 099509CD098F E0A695E0A78DE0A68F +15B315AD 099509C8 E0A695E0A788 +15B315AD 099509CD0990 E0A695E0A78DE0A690 +15B315AE 099509CB E0A695E0A78B +15B315AE 099509CD0993 E0A695E0A78DE0A693 +15B315AF 099509CC E0A695E0A78C +15B315AF 099509CD0994 E0A695E0A78DE0A694 +15B4 099609CD E0A696E0A78D +15B5 099709CD E0A697E0A78D +15B6 099809CD E0A698E0A78D +15B7 099909CD E0A699E0A78D +15B8 099A09CD E0A69AE0A78D +15B9 099B09CD E0A69BE0A78D +15BA 099C09CD E0A69CE0A78D +15BB 099D09CD E0A69DE0A78D +15BC 099E09CD E0A69EE0A78D +15BD 099F09CD E0A69FE0A78D +15BE 09A009CD E0A6A0E0A78D +15BF 09A109CD E0A6A1E0A78D +15C0 09A209CD E0A6A2E0A78D +15C1 09A309CD E0A6A3E0A78D +15C2 09A409CD E0A6A4E0A78D +15C2 09A409CD200D E0A6A4E0A78DE2808D +15C2 09CE E0A78E +15C3 09A509CD E0A6A5E0A78D +15C4 09A609CD E0A6A6E0A78D +15C5 09A709CD E0A6A7E0A78D +15C6 09A809CD E0A6A8E0A78D +15C7 09AA09CD E0A6AAE0A78D +15C8 09AB09CD E0A6ABE0A78D +15C9 09AC09CD E0A6ACE0A78D +15CA 09AD09CD E0A6ADE0A78D +15CB 09AE09CD E0A6AEE0A78D +15CC 09AF09CD E0A6AFE0A78D +15CD 09B009CD E0A6B0E0A78D +15CE 09F009CD E0A7B0E0A78D +15CF 09B209CD E0A6B2E0A78D +15D0 09F109CD E0A7B1E0A78D +15D1 09B609CD E0A6B6E0A78D +15D2 09B709CD E0A6B7E0A78D +15D3 09B809CD E0A6B8E0A78D +15D4 09B909CD E0A6B9E0A78D +SELECT HEX(WEIGHT_STRING(a)) as wa, +GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) +FROM t1 GROUP BY a ORDER BY a; +wa GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) +15A2 0985 +15A3 0986 +15A4 0987 +15A5 0988 +15A6 0989 +15A7 098A +15A8 098B +15A9 09E0 +15AA 098C +15AB 09E1 +15AC 098F +15AD 0990 +15AE 0993 +15AF 0994 +15B0 0982 +15B1 0983 +15B2 0981 +15B3 099509CD +15B315A2 0995,099509CD0985 +15B315A3 099509BE,099509CD0986 +15B315A4 099509BF,099509CD0987 +15B315A5 099509C0,099509CD0988 +15B315A6 099509C1,099509CD0989 +15B315A7 099509C2,099509CD098A +15B315A8 099509C3,099509CD098B +15B315A9 099509C4,099509CD09E0 +15B315AA 099509E2,099509CD098C +15B315AB 099509E3,099509CD09E1 +15B315AC 099509C7,099509CD098F +15B315AD 099509C8,099509CD0990 +15B315AE 099509CB,099509CD0993 +15B315AF 099509CC,099509CD0994 +15B4 099609CD +15B5 099709CD +15B6 099809CD +15B7 099909CD +15B8 099A09CD +15B9 099B09CD +15BA 099C09CD +15BB 099D09CD +15BC 099E09CD +15BD 099F09CD +15BE 09A009CD +15BF 09A109CD +15C0 09A209CD +15C1 09A309CD +15C2 09CE,09A409CD,09A409CD200D +15C3 09A509CD +15C4 09A609CD +15C5 09A709CD +15C6 09A809CD +15C7 09AA09CD +15C8 09AB09CD +15C9 09AC09CD +15CA 09AD09CD +15CB 09AE09CD +15CC 09AF09CD +15CD 09B009CD +15CE 09F009CD +15CF 09B209CD +15D0 09F109CD +15D1 09B609CD +15D2 09B709CD +15D3 09B809CD +15D4 09B909CD +DROP TABLE t1; +# +# WL#5624, shift after, using expansion +# +SET NAMES utf8 COLLATE utf8_5624_5; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +INSERT INTO t1 VALUES ('0'),('1'),('0z'),(_ucs2 0x0030FF9D); +INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'),('f'),('g'),('h'),('i'); +INSERT INTO t1 VALUES ('j'),('k'),('l'),('m'),('n'),('o'),('p'),('q'),('r'); +INSERT INTO t1 VALUES ('s'),('t'),('u'),('v'),('w'),('x'),('y'),('z'); +INSERT INTO t1 VALUES ('aa'),('aaa'); +INSERT INTO t1 VALUES ('A'),('B'),('C'),('D'),('E'),('F'),('G'),('H'),('I'); +INSERT INTO t1 VALUES ('J'),('K'),('L'),('M'),('N'),('O'),('P'),('Q'),('R'); +INSERT INTO t1 VALUES ('S'),('T'),('U'),('V'),('W'),('X'),('Y'),('Z'); +INSERT INTO t1 VALUES ('AA'),('AAA'); +SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a); +a HEX(WEIGHT_STRING(a)) +0 0E29 +0z 0E290E292357 +0ン 0E291E81 +a 0E29233E +b 0E29233F +c 0E292340 +d 0E292341 +e 0E292342 +f 0E292343 +g 0E292344 +h 0E292345 +i 0E292346 +j 0E292347 +k 0E292348 +l 0E292349 +m 0E29234A +n 0E29234B +o 0E29234C +p 0E29234D +q 0E29234E +r 0E29234F +s 0E292350 +t 0E292351 +u 0E292352 +v 0E292353 +w 0E292354 +x 0E292355 +y 0E292356 +z 0E292357 +aa 0E292358 +aaa 0E292359 +A 0E29333E +B 0E29333F +C 0E293340 +D 0E293341 +E 0E293342 +F 0E293343 +G 0E293344 +H 0E293345 +I 0E293346 +J 0E293347 +K 0E293348 +L 0E293349 +M 0E29334A +N 0E29334B +O 0E29334C +P 0E29334D +Q 0E29334E +R 0E29334F +S 0E293350 +T 0E293351 +U 0E293352 +V 0E293353 +W 0E293354 +X 0E293355 +Y 0E293356 +Z 0E293357 +AA 0E293358 +AAA 0E293359 +1 0E2A +DROP TABLE t1; +# +# End of WL#5624 +# diff --git a/mysql-test/suite/innodb/r/innodb_ctype_tis620.result b/mysql-test/suite/innodb/r/innodb_ctype_tis620.result new file mode 100644 index 00000000..cf15d123 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_tis620.result @@ -0,0 +1,94 @@ +SET DEFAULT_STORAGE_ENGINE=InnoDB; +# +# Start of 10.2 tests +# +# +# MDEV-24901 SIGSEGV in fts_get_table_name, SIGSEGV in ib_vector_size, SIGSEGV in row_merge_fts_doc_tokenize, stack smashing Export +# +CREATE TABLE t1(c TEXT CHARACTER SET tis620); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` text CHARACTER SET tis620 COLLATE tis620_thai_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES('100'); +ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1(c TEXT CHARACTER SET tis620 COLLATE tis620_thai_nopad_ci); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` text CHARACTER SET tis620 COLLATE tis620_thai_nopad_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES('100'); +ALTER TABLE t1 ADD FULLTEXT INDEX(c), ALGORITHM=INPLACE; +DROP TABLE t1; +# +# End of 10.2 tests +# +# +# Start of 10.4 tests +# +# +# MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +# +CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), KEY(a)) ENGINE=InnoDB COLLATE tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +DROP TABLE t1; +# +# MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit +# +CREATE TABLE t1 (a INT KEY,b INT,c CHAR,KEY(b),KEY(c)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (3,4,4); +DROP TABLE t1; +CREATE TABLE t1 (C1 CHAR KEY,B1 BIT,B2 BIT,C2 CHAR DEFAULT'') ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +SELECT HEX(c1),HEX (c2) FROM t1 WHERE c1>=''AND c1<''AND c2=''LIMIT 2; +HEX(c1) HEX (c2) +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT UNSIGNED,b INT,c CHAR(1),d BINARY (1),e VARCHAR(1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (4386060749083099108,157,0,0,0,0,0,0,12); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +INSERT INTO t1 VALUES (104,15158706241929488558,0,0,0,0,0,0,13); +Warnings: +Warning 1264 Out of range value for column 'b' at row 1 +SELECT GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) FROM t1; +GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) +4294967295157,1042147483647 +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a CHAR(9),b CHAR(7)) COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0); +ALTER TABLE t1 ADD INDEX kb (b),ADD INDEX kab (a,b),ALGORITHM=INPLACE; +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT UNSIGNED,b INT UNSIGNED,c CHAR(1),d CHAR(1),e VARCHAR(1),f VARCHAR(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (15842995496588415350,5339224446865937973,0,0,0,0,0,0,4); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +INSERT INTO t1 VALUES (8118894032862615316,5299008984764990929,0,0,0,0,0,0,1); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +SELECT GROUP_CONCAT(DISTINCT a,c ORDER BY a) FROM t1; +GROUP_CONCAT(DISTINCT a,c ORDER BY a) +42949672950 +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a CHAR,b CHAR,KEY(a,b)) ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB; +INSERT INTO t1 VALUES (0,0); +DROP TABLE t1; +CREATE TABLE t1 (a CHAR,b CHAR) COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0,0); +SELECT a,SUM(DISTINCT a),MIN(b) FROM t1 GROUP BY a; +a SUM(DISTINCT a) MIN(b) +0 0 0 +DROP TABLE t1; +CREATE TABLE t1 (a CHAR,KEY(a)) ENGINE=InnoDB COLLATE=tis620_thai_nopad_ci; +INSERT INTO t1 VALUES (0); +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result new file mode 100644 index 00000000..d817af27 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result @@ -0,0 +1,479 @@ +SET DEFAULT_STORAGE_ENGINE=InnoDB; +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET NAMES utf8; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# End of 10.2 tests +# +# +# Start of 10.4 tests +# +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci; +# +# MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations +# +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a TEXT COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a VARCHAR(2000) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +ERROR 23000: Duplicate entry 'ß ' for key 'a' +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)))', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +EXECUTE IMMEDIATE REPLACE( +'CREATE TABLE t1 ( ' + ' a CHAR(20) COLLATE ,' + 'UNIQUE(a(3)) USING HASH)', +'', @@collation_connection); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(3)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss '); +INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/; +DROP TABLE t1; +# +# MDEV-30048 Prefix keys for CHAR work differently for MyISAM vs InnoDB +# +SET NAMES utf8mb3; +CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss'),('ß'); +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(2))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(2)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss'),('ß'); +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(120) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss'),('ß'); +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(120) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(100)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss'),('ß'); +DROP TABLE t1; +# +# MDEV-30050 Inconsistent results of DISTINCT with NOPAD +# +CREATE TABLE t1 (c CHAR(100) COLLATE utf8mb3_unicode_nopad_ci); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss'),('ß'); +SET big_tables=0; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +SELECT DISTINCT c FROM t1; +c +ss +ß +SET big_tables=1; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +SELECT DISTINCT c FROM t1; +c +ss +ß +DROP TABLE t1; +SET big_tables=DEFAULT; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +# +# MDEV-30050 Inconsistent results of DISTINCT with NOPAD +# +CREATE OR REPLACE TABLE t1 (c CHAR(100) COLLATE utf8mb3_unicode_nopad_ci); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('ss'),('ß'); +SET big_tables=0; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +SELECT DISTINCT c FROM t1; +c +ss +ß +SET big_tables=1; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +SELECT DISTINCT c FROM t1; +c +ss +ß +DROP TABLE t1; +SET big_tables=DEFAULT; +Warnings: +Warning 1287 '@@big_tables' is deprecated and will be removed in a future release +# +# End 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_defrag_binlog.result b/mysql-test/suite/innodb/r/innodb_defrag_binlog.result new file mode 100644 index 00000000..b97061cc --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_defrag_binlog.result @@ -0,0 +1,31 @@ +include/master-slave.inc +[connection master] +drop table if exists t1; +create table t1(a int not null primary key auto_increment, b varchar(256), key second(b)) engine=innodb; +insert into t1 values (1, REPEAT("a", 256)); +insert into t1 values (2, REPEAT("a", 256)); +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +drop table t1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t1(a int not null primary key auto_increment, b varchar(256), key second(b)) engine=innodb +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 values (1, REPEAT("a", 256)) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 values (2, REPEAT("a", 256)) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; optimize table t1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +include/rpl_end.inc diff --git a/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result new file mode 100644 index 00000000..07c96e76 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result @@ -0,0 +1,102 @@ +SET @n_pages= @@GLOBAL.innodb_defragment_n_pages; +SET @accuracy= @@GLOBAL.innodb_defragment_stats_accuracy; +SET @sp= @@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent = 0; +set global innodb_defragment_stats_accuracy = 80; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, +b VARCHAR(256), +c INT, +g GEOMETRY NOT NULL, +t VARCHAR(256), +KEY second(a, b), +KEY third(c), +SPATIAL gk(g), +FULLTEXT INDEX fti(t)) ENGINE=INNODB; +connect con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect con3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect con4,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connection default; +SET @@global.innodb_defragment_n_pages = 20; +CREATE TEMPORARY TABLE tt (a INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO tt SELECT 0 FROM seq_1_to_180; +INSERT INTO tt SELECT 5 FROM seq_1_to_160; +INSERT INTO tt SELECT 1 FROM seq_1_to_1000; +OPTIMIZE TABLE tt; +Table Op Msg_type Msg_text +test.tt optimize note Table does not support optimize, doing recreate + analyze instead +test.tt optimize status OK +select count(*) from t1; +count(*) +20000 +select count(*) from t1 force index (second); +count(*) +20000 +select count(*) from t1 force index (third); +count(*) +20000 +select count(*) from t1; +count(*) +15800 +select count(*) from t1 force index (second); +count(*) +15800 +select count(*) from t1 force index (third); +count(*) +15800 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 +0 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 +connection con1; +optimize table t1;; +connection default; +INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000, Point(1,1),'More like a test but different.');; +connection con2; +INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000, Point(1,1),'Totally different text book.');; +connection con3; +DELETE FROM t1 where a between 1 and 100;; +connection con4; +UPDATE t1 SET c = c + 1 where c between 2000 and 8000;; +connection con1; +connection con2; +connection con3; +connection con4; +connection default; +disconnect con1; +disconnect con2; +disconnect con3; +disconnect con4; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +select count(*) from t1; +count(*) +15723 +select count(*) from t1 force index (second); +count(*) +15723 +select count(*) from t1 force index (third); +count(*) +15723 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 +drop table t1; +SET GLOBAL innodb_defragment_n_pages = @n_pages; +SET GLOBAL innodb_defragment_stats_accuracy = @accuracy; +SET GLOBAL innodb_stats_persistent = @sp; diff --git a/mysql-test/suite/innodb/r/innodb_defrag_stats.result b/mysql-test/suite/innodb/r/innodb_defrag_stats.result new file mode 100644 index 00000000..c6fd7006 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_defrag_stats.result @@ -0,0 +1,133 @@ +SET GLOBAL innodb_defragment_stats_accuracy = 20; +DELETE FROM mysql.innodb_index_stats; +# Create table. +CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), +KEY SECOND(a, b)) ENGINE=INNODB STATS_PERSISTENT=0; +INSERT INTO t1 SELECT 100*FLOOR(seq/70)+seq%70, REPEAT('A', 256) +FROM seq_1_to_1024; +# Not enough page splits to trigger persistent stats write yet. +SELECT * FROM mysql.innodb_index_stats; +database_name table_name index_name last_update stat_name stat_value sample_size stat_description +INSERT INTO t1 SELECT 100*FLOOR(seq/70)+seq%70, REPEAT('A', 256) +FROM seq_1025_to_1433; +BEGIN; +INSERT INTO t1 SELECT 100*20+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*19+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*18+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*17+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*16+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*15+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*14+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*13+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*12+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*11+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*10+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*9+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*8+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*7+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*6+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*5+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*4+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*3+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*2+seq, REPEAT('A', 256) +FROM seq_70_to_99; +INSERT INTO t1 SELECT 100*1+seq, REPEAT('A', 256) +FROM seq_70_to_99; +ROLLBACK; +SELECT @@GLOBAL.innodb_force_recovery<2 "have background defragmentation"; +have background defragmentation +1 +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t1 PRIMARY n_leaf_pages_defrag +t1 PRIMARY n_leaf_pages_reserved +t1 PRIMARY n_page_split +t1 SECOND n_leaf_pages_defrag +t1 SECOND n_leaf_pages_reserved +t1 SECOND n_page_split +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t1 PRIMARY n_leaf_pages_defrag +t1 PRIMARY n_leaf_pages_reserved +t1 PRIMARY n_page_split +t1 PRIMARY n_pages_freed +t1 SECOND n_leaf_pages_defrag +t1 SECOND n_leaf_pages_reserved +t1 SECOND n_page_split +t1 SECOND n_pages_freed +set global innodb_defragment_stats_accuracy = 40; +INSERT INTO t1 (b) SELECT b from t1; +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t1 PRIMARY n_leaf_pages_defrag +t1 PRIMARY n_leaf_pages_reserved +t1 PRIMARY n_page_split +t1 PRIMARY n_pages_freed +t1 SECOND n_leaf_pages_defrag +t1 SECOND n_leaf_pages_reserved +t1 SECOND n_page_split +t1 SECOND n_pages_freed +INSERT INTO t1 (b) SELECT b from t1; +SELECT stat_name FROM mysql.innodb_index_stats WHERE table_name='t1'; +stat_name +n_leaf_pages_defrag +n_leaf_pages_defrag +n_leaf_pages_reserved +n_leaf_pages_reserved +n_page_split +n_page_split +n_pages_freed +n_pages_freed +# Table rename should cause stats rename. +rename table t1 to t2; +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t2 PRIMARY n_leaf_pages_defrag +t2 PRIMARY n_leaf_pages_reserved +t2 PRIMARY n_page_split +t2 PRIMARY n_pages_freed +t2 SECOND n_leaf_pages_defrag +t2 SECOND n_leaf_pages_reserved +t2 SECOND n_page_split +t2 SECOND n_pages_freed +drop index SECOND on t2; +# +# MDEV-26636: Statistics must not be written for temporary tables +# +SET GLOBAL innodb_defragment_stats_accuracy = 1; +CREATE TEMPORARY TABLE t (a INT PRIMARY KEY, c CHAR(255) NOT NULL) +ENGINE=InnoDB; +INSERT INTO t SELECT seq, '' FROM seq_1_to_100; +# restart +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t2 PRIMARY n_leaf_pages_defrag +t2 PRIMARY n_leaf_pages_reserved +t2 PRIMARY n_page_split +t2 PRIMARY n_pages_freed +# Clean up +ALTER TABLE t2 STATS_PERSISTENT=1; +DROP TABLE t2; +SELECT * FROM mysql.innodb_index_stats; +database_name table_name index_name last_update stat_name stat_value sample_size stat_description diff --git a/mysql-test/suite/innodb/r/innodb_defrag_stats_many_tables.result b/mysql-test/suite/innodb/r/innodb_defrag_stats_many_tables.result new file mode 100644 index 00000000..e668c38e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_defrag_stats_many_tables.result @@ -0,0 +1,38 @@ +DROP TABLE if exists t1; +SET @start_table_definition_cache = @@global.table_definition_cache; +SET @@global.table_definition_cache = 400; +SET @start_flush_log_at_trx_commit = @@global.innodb_flush_log_at_trx_commit; +SET @@global.innodb_flush_log_at_trx_commit=2; +SET @start_innodb_defragment_stats_accuracy = @@global.innodb_defragment_stats_accuracy; +SET @@global.innodb_defragment_stats_accuracy = 80; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB; +INSERT INTO t1 VALUES(1, REPEAT('A', 256)); +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +select stat_value > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; +stat_value > 0 +Create 505 table to overflow the table cache. +Sleep for a while to make sure t1 is evicted. +select sleep(15); +sleep(15) +0 +Reload t1 to get defrag stats from persistent storage +INSERT INTO t1 (b) SELECT b from t1; +make sure the stats thread will wake up and do the write even if there's a race condition between set and reset. +select sleep(15); +sleep(15) +0 +select stat_value > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; +stat_value > 0 +SET @@global.innodb_defragment_stats_accuracy = @start_innodb_defragment_stats_accuracy; +SET @@global.table_definition_cache = @start_table_definition_cache; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_defragment.result b/mysql-test/suite/innodb/r/innodb_defragment.result new file mode 100644 index 00000000..533a39ee --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_defragment.result @@ -0,0 +1,133 @@ +set global innodb_defragment_stats_accuracy = 80; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +INSERT INTO t1 VALUES (100000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (200000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (300000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (400000, REPEAT('A', 256)); +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +create procedure defragment() +begin +set @i = 0; +repeat +set @i = @i + 1; +optimize table t1; +until @i = 3 end repeat; +end // +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) +0 +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) +2 +select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) +2 +select count(*) from t1; +count(*) +10004 +connect con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1; +call defragment(); +connection default; +connection con1; +connection default; +disconnect con1; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# restart +select count(*) from t1; +count(*) +7904 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +0 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 0 +1 +select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 0 +1 +select count(*) from t1 force index (second); +count(*) +7904 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 +SET @@global.innodb_defragment_n_pages = 3; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# restart +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) < 3 +1 +select count(*) from t1; +count(*) +6904 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) < 3 +1 +select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) < 3 +1 +select count(*) from t1 force index (second); +count(*) +6904 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 +SET @@global.innodb_defragment_n_pages = 10; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# restart +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); +count(stat_value) > 1 +1 +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); +count(stat_value) > 1 +1 +select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) > 1 +1 +select count(*) from t1 force index (second); +count(*) +6904 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split'); +count(stat_value) = 0 +1 +select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag'); +count(stat_value) = 0 +1 +DROP PROCEDURE defragment; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_defragment_small.result b/mysql-test/suite/innodb/r/innodb_defragment_small.result new file mode 100644 index 00000000..fcb3bf2e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_defragment_small.result @@ -0,0 +1,40 @@ +SET @innodb_defragment_orig=@@GLOBAL.innodb_defragment; +SET @innodb_optimize_fulltext_orig=@@GLOBAL.innodb_optimize_fulltext_only; +SET GLOBAL innodb_defragment = 1; +SET GLOBAL innodb_optimize_fulltext_only = 0; +# +# MDEV-12198 innodb_defragment=1 crashes server on +# OPTIMIZE TABLE when FULLTEXT index exists +# +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256), +KEY(a, b), FULLTEXT KEY(b)) ENGINE=INNODB; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +INSERT INTO t1 VALUES (100000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (200000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (300000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (400000, REPEAT('A', 256)); +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# +# MDEV-15824 innodb_defragment=ON trumps +# innodb_optimize_fulltext_only=ON in OPTIMIZE TABLE +# +SET GLOBAL innodb_optimize_fulltext_only = 1; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SET GLOBAL innodb_defragment = 0; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; +CREATE TABLE t1 (c POINT PRIMARY KEY, SPATIAL INDEX(c)) ENGINE=InnoDB; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; +SET GLOBAL innodb_defragment = @innodb_defragment_orig; +SET GLOBAL innodb_optimize_fulltext_only = @innodb_optimize_fulltext_orig; diff --git a/mysql-test/suite/innodb/r/innodb_force_pk.result b/mysql-test/suite/innodb/r/innodb_force_pk.result new file mode 100644 index 00000000..64f728e4 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_force_pk.result @@ -0,0 +1,65 @@ +create table t1(a integer) engine=innodb; +ERROR 42000: This table type requires a primary key +show warnings; +Level Code Message +Error 1173 This table type requires a primary key +create table t1(a integer unique key) engine=innodb; +ERROR 42000: This table type requires a primary key +show warnings; +Level Code Message +Error 1173 This table type requires a primary key +create table t1(a integer not null, b integer, +unique key(a,b)) engine=innodb; +ERROR 42000: This table type requires a primary key +show warnings; +Level Code Message +Error 1173 This table type requires a primary key +create table t1(a integer not null primary key) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show warnings; +Level Code Message +drop table t1; +create table t1(a integer not null unique key) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show warnings; +Level Code Message +drop table t1; +set global innodb_force_primary_key = 0; +create table t1(a integer) engine=innodb; +show warnings; +Level Code Message +insert into t1 values (1),(2),(3); +set global innodb_force_primary_key = 1; +select * from t1; +a +1 +2 +3 +create table t2(a integer) engine=innodb; +ERROR 42000: This table type requires a primary key +show warnings; +Level Code Message +Error 1173 This table type requires a primary key +drop table t1; +create table t1 (i int not null, key(i)) engine=innodb; +ERROR 42000: This table type requires a primary key +create table t1 (i int not null, unique key(i)) engine=innodb; +show warnings; +Level Code Message +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) NOT NULL, + UNIQUE KEY `i` (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result new file mode 100644 index 00000000..05239950 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result @@ -0,0 +1,117 @@ +create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb; +create table t2(f1 int primary key, f2 int, index idx(f2))engine=innodb; +insert into t1 values(1, 2); +insert into t2 values(1, 2); +SET GLOBAL innodb_fast_shutdown = 0; +# restart: --innodb-force-recovery=4 +select * from t1; +f1 f2 +1 2 +begin; +insert into t1 values(2, 3); +rollback; +alter table t1 add f3 int not null, algorithm=copy; +alter table t1 add f4 int not null, algorithm=inplace; +drop index idx on t1; +update t1 set f1=3 where f2=2; +create table t3(f1 int not null)engine=innodb; +drop table t3; +rename table t1 to t3; +rename table t3 to t1; +truncate table t1; +show tables; +Tables_in_test +t1 +t2 +# restart: --innodb-force-recovery=5 +select * from t2; +f1 f2 +1 2 +insert into t2 values(2, 3); +ERROR HY000: Running in read-only mode +alter table t2 add f3 int not null, algorithm=copy; +ERROR HY000: Can't create table `test`.`t2` (errno: 165 "Table is read only") +alter table t2 add f3 int not null, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY +drop index idx on t2; +ERROR HY000: Can't create table `test`.`t2` (errno: 165 "Table is read only") +update t2 set f1=3 where f2=2; +ERROR HY000: Running in read-only mode +create table t3(f1 int not null)engine=innodb; +ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only") +drop table t3; +ERROR HY000: Table 't3' is read only +rename table t2 to t3; +ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only") +truncate table t2; +ERROR HY000: Table 't2' is read only +drop table t2; +ERROR HY000: Table 't2' is read only +create schema db; +drop schema db; +show tables; +Tables_in_test +t1 +t2 +# restart: --innodb-force-recovery=6 +select * from t2; +f1 f2 +1 2 +insert into t2 values(2, 3); +ERROR HY000: Table 't2' is read only +alter table t2 add f3 int not null, algorithm=copy; +ERROR HY000: Table 't2' is read only +alter table t2 add f3 int not null, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY +drop index idx on t2; +ERROR HY000: Table 't2' is read only +update t2 set f1=3 where f2=2; +ERROR HY000: Table 't2' is read only +create table t3(f1 int not null)engine=innodb; +ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only") +drop table t1; +ERROR HY000: Table 't1' is read only +rename table t2 to t3; +ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only") +truncate table t2; +ERROR HY000: Table 't2' is read only +drop table t2; +ERROR HY000: Table 't2' is read only +show tables; +Tables_in_test +t1 +t2 +# restart: --innodb-force-recovery=2 +select * from t2; +f1 f2 +1 2 +begin; +update t2 set f2=3; +connect con1,localhost,root,,; +# Force a redo log flush of the above uncommitted UPDATE +SET GLOBAL innodb_flush_log_at_trx_commit=1; +drop table t1; +disconnect con1; +connection default; +# Kill the server +# restart: --innodb-force-recovery=3 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +select * from t2; +f1 f2 +1 3 +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +select * from t2; +f1 f2 +1 2 +SET SESSION innodb_lock_wait_timeout=1; +insert into t2 values(1,2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +insert into t2 values(9,10); +# restart +select * from t2; +f1 f2 +1 2 +9 10 +drop table t2; +show tables; +Tables_in_test diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result new file mode 100644 index 00000000..c2db4bed --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result @@ -0,0 +1,18 @@ +FLUSH TABLES; +# +# MDEV-21217 innodb_force_recovery=2 may wrongly abort the rollback +# of recovered transactions +# +connect con0,localhost,root; +CREATE TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB; +BEGIN; +INSERT INTO t0 SELECT * FROM seq_1_to_1000; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +# restart: --innodb-force-recovery=2 +disconnect con0; +connection default; +SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE; +a +DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result new file mode 100644 index 00000000..4c89ad4b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_gis.result @@ -0,0 +1,610 @@ +SET default_storage_engine=innodb; +DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT); +CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY); +SHOW CREATE TABLE gis_point; +Table Create Table +gis_point CREATE TABLE `gis_point` ( + `fid` int(11) NOT NULL AUTO_INCREMENT, + `g` point DEFAULT NULL, + PRIMARY KEY (`fid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW FIELDS FROM gis_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g point YES NULL +SHOW FIELDS FROM gis_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g linestring YES NULL +SHOW FIELDS FROM gis_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g polygon YES NULL +SHOW FIELDS FROM gis_multi_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multipoint YES NULL +SHOW FIELDS FROM gis_multi_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multilinestring YES NULL +SHOW FIELDS FROM gis_multi_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g multipolygon YES NULL +SHOW FIELDS FROM gis_geometrycollection; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g geometrycollection YES NULL +SHOW FIELDS FROM gis_geometry; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL auto_increment +g geometry YES NULL +INSERT INTO gis_point VALUES +(101, PointFromText('POINT(10 10)')), +(102, PointFromText('POINT(20 10)')), +(103, PointFromText('POINT(20 20)')), +(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); +INSERT INTO gis_line VALUES +(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), +(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), +(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); +INSERT INTO gis_polygon VALUES +(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), +(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), +(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); +INSERT INTO gis_multi_point VALUES +(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), +(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), +(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); +INSERT INTO gis_multi_line VALUES +(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), +(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), +(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); +INSERT INTO gis_multi_polygon VALUES +(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), +(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); +INSERT INTO gis_geometrycollection VALUES +(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), +(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); +INSERT into gis_geometry SELECT * FROM gis_point; +INSERT into gis_geometry SELECT * FROM gis_line; +INSERT into gis_geometry SELECT * FROM gis_polygon; +INSERT into gis_geometry SELECT * FROM gis_multi_point; +INSERT into gis_geometry SELECT * FROM gis_multi_line; +INSERT into gis_geometry SELECT * FROM gis_multi_polygon; +INSERT into gis_geometry SELECT * FROM gis_geometrycollection; +SELECT fid, AsText(g) FROM gis_point ORDER by fid; +fid AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +SELECT fid, AsText(g) FROM gis_line ORDER by fid; +fid AsText(g) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +SELECT fid, AsText(g) FROM gis_polygon ORDER by fid; +fid AsText(g) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid; +fid AsText(g) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid; +fid AsText(g) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid; +fid AsText(g) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid; +fid AsText(g) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, AsText(g) FROM gis_geometry ORDER by fid; +fid AsText(g) +101 POINT(10 10) +102 POINT(20 10) +103 POINT(20 20) +104 POINT(10 20) +105 LINESTRING(0 0,0 10,10 0) +106 LINESTRING(10 10,20 10,20 20,10 20,10 10) +107 LINESTRING(10 10,40 10) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) +110 POLYGON((0 0,30 0,30 30,0 0)) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) +114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) +115 MULTILINESTRING((10 48,10 21,10 0)) +116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) +117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) +119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) +120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) +121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) +SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid; +fid Dimension(g) +101 0 +102 0 +103 0 +104 0 +105 1 +106 1 +107 1 +108 2 +109 2 +110 2 +111 0 +112 0 +113 0 +114 1 +115 1 +116 1 +117 2 +118 2 +119 2 +120 1 +121 1 +SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid; +fid GeometryType(g) +101 POINT +102 POINT +103 POINT +104 POINT +105 LINESTRING +106 LINESTRING +107 LINESTRING +108 POLYGON +109 POLYGON +110 POLYGON +111 MULTIPOINT +112 MULTIPOINT +113 MULTIPOINT +114 MULTILINESTRING +115 MULTILINESTRING +116 MULTILINESTRING +117 MULTIPOLYGON +118 MULTIPOLYGON +119 MULTIPOLYGON +120 GEOMETRYCOLLECTION +121 GEOMETRYCOLLECTION +SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid; +fid IsEmpty(g) +101 0 +102 0 +103 0 +104 0 +105 0 +106 0 +107 0 +108 0 +109 0 +110 0 +111 0 +112 0 +113 0 +114 0 +115 0 +116 0 +117 0 +118 0 +119 0 +120 0 +121 0 +SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid; +fid AsText(Envelope(g)) +101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +104 POLYGON((10 20,10 20,10 20,10 20,10 20)) +105 POLYGON((0 0,10 0,10 10,0 10,0 0)) +106 POLYGON((10 10,20 10,20 20,10 20,10 10)) +107 POLYGON((10 10,40 10,40 10,10 10,10 10)) +108 POLYGON((10 10,20 10,20 20,10 20,10 10)) +109 POLYGON((0 0,50 0,50 50,0 50,0 0)) +110 POLYGON((0 0,30 0,30 30,0 30,0 0)) +111 POLYGON((0 0,20 0,20 20,0 20,0 0)) +112 POLYGON((1 1,21 1,21 21,1 21,1 1)) +113 POLYGON((3 6,4 6,4 10,3 10,3 6)) +114 POLYGON((10 0,16 0,16 48,10 48,10 0)) +115 POLYGON((10 0,10 0,10 48,10 48,10 0)) +116 POLYGON((1 2,21 2,21 8,1 8,1 2)) +117 POLYGON((28 0,84 0,84 42,28 42,28 0)) +118 POLYGON((28 0,84 0,84 42,28 42,28 0)) +119 POLYGON((0 0,3 0,3 3,0 3,0 0)) +120 POLYGON((0 0,10 0,10 10,0 10,0 0)) +121 POLYGON((3 6,44 6,44 9,3 9,3 6)) +explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00 +Warnings: +Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry` +SELECT fid, X(g) FROM gis_point ORDER by fid; +fid X(g) +101 10 +102 20 +103 20 +104 10 +SELECT fid, Y(g) FROM gis_point ORDER by fid; +fid Y(g) +101 10 +102 10 +103 20 +104 20 +explain extended select X(g),Y(g) FROM gis_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00 +Warnings: +Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point` +SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid; +fid AsText(StartPoint(g)) +105 POINT(0 0) +106 POINT(10 10) +107 POINT(10 10) +SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid; +fid AsText(EndPoint(g)) +105 POINT(10 0) +106 POINT(10 10) +107 POINT(40 10) +SELECT fid, GLength(g) FROM gis_line ORDER by fid; +fid GLength(g) +105 24.14213562373095 +106 40 +107 30 +SELECT fid, NumPoints(g) FROM gis_line ORDER by fid; +fid NumPoints(g) +105 3 +106 5 +107 2 +SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid; +fid AsText(PointN(g, 2)) +105 POINT(0 10) +106 POINT(20 10) +107 POINT(40 10) +SELECT fid, IsClosed(g) FROM gis_line ORDER by fid; +fid IsClosed(g) +105 0 +106 1 +107 0 +explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line` +SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid; +fid AsText(Centroid(g)) +108 POINT(15 15) +109 POINT(25.416666666666668 25.416666666666668) +110 POINT(20 10) +SELECT fid, Area(g) FROM gis_polygon ORDER by fid; +fid Area(g) +108 100 +109 2400 +110 450 +SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid; +fid AsText(ExteriorRing(g)) +108 LINESTRING(10 10,20 10,20 20,10 20,10 10) +109 LINESTRING(0 0,50 0,50 50,0 50,0 0) +110 LINESTRING(0 0,30 0,30 30,0 0) +SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid; +fid NumInteriorRings(g) +108 0 +109 1 +110 0 +SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid; +fid AsText(InteriorRingN(g, 1)) +108 NULL +109 LINESTRING(10 10,20 10,20 20,10 20,10 10) +110 NULL +explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon` +SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid; +fid IsClosed(g) +114 0 +115 0 +116 0 +SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid; +fid AsText(Centroid(g)) +117 POINT(57.98031067576927 17.854754130800433) +118 POINT(57.98031067576927 17.854754130800433) +119 POINT(2 2) +SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid; +fid Area(g) +117 1684.5 +118 1684.5 +119 4.5 +SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid; +fid NumGeometries(g) +111 4 +112 4 +113 2 +SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid; +fid NumGeometries(g) +114 2 +115 1 +116 2 +SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid; +fid NumGeometries(g) +117 2 +118 2 +119 1 +SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid; +fid NumGeometries(g) +120 2 +121 2 +explain extended SELECT fid, NumGeometries(g) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point` +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid; +fid AsText(GeometryN(g, 2)) +111 POINT(10 10) +112 POINT(11 11) +113 POINT(4 10) +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid; +fid AsText(GeometryN(g, 2)) +114 LINESTRING(16 0,16 23,16 48) +115 NULL +116 LINESTRING(2 5,5 8,21 7) +SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid; +fid AsText(GeometryN(g, 2)) +117 POLYGON((59 18,67 18,67 13,59 13,59 18)) +118 POLYGON((59 18,67 18,67 13,59 13,59 18)) +119 NULL +SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid; +fid AsText(GeometryN(g, 2)) +120 LINESTRING(0 0,10 10) +121 LINESTRING(3 6,7 9) +SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid; +fid AsText(GeometryN(g, 1)) +120 POINT(0 0) +121 POINT(44 6) +explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point` +SELECT g1.fid as first, g2.fid as second, +Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +first second w c o e d t i r +120 120 1 1 0 1 0 0 1 0 +120 121 0 0 1 0 0 0 1 0 +121 120 0 0 1 0 0 0 1 0 +121 121 1 1 0 1 0 0 1 0 +explain extended SELECT g1.fid as first, g2.fid as second, +Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, +Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, +Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r +FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` +DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; +CREATE TABLE t1 ( +a INTEGER PRIMARY KEY AUTO_INCREMENT, +gp point, +ln linestring, +pg polygon, +mp multipoint, +mln multilinestring, +mpg multipolygon, +gc geometrycollection, +gm geometry +); +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +ALTER TABLE t1 ADD fid INT; +SHOW FIELDS FROM t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment +gp point YES NULL +ln linestring YES NULL +pg polygon YES NULL +mp multipoint YES NULL +mln multilinestring YES NULL +mpg multipolygon YES NULL +gc geometrycollection YES NULL +gm geometry YES NULL +fid int(11) YES NULL +DROP TABLE t1; +create table t1 (pk integer primary key auto_increment, a geometry not null); +insert into t1 (a) values (GeomFromText('Point(1 2)')); +insert into t1 (a) values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert IGNORE into t1 (a) values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +drop table t1; +create table t1 (pk integer primary key auto_increment, fl geometry not null); +insert into t1 (fl) values (1); +ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl` +insert into t1 (fl) values (1.11); +ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl` +insert into t1 (fl) values ("qwerty"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 (fl) values (pointfromtext('point(1,1)')); +ERROR 23000: Column 'fl' cannot be null +drop table t1; +End of 4.1 tests +CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY); +INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); +INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); +INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); +INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); +INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); +INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrequal +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrintersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbroverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrtouches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrwithin +big,center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +contains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +disjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +equals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersects FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +intersects +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +overlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +touches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +within +big,center +SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = GeomFromText('POLYGON ((0 0))'); +SET @point2 = GeomFromText('POLYGON ((-2 0))'); +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name; +overlaps +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name; +overlaps +SELECT Overlaps(@horiz1, @vert1) FROM DUAL; +Overlaps(@horiz1, @vert1) +0 +SELECT Overlaps(@horiz1, @horiz2) FROM DUAL; +Overlaps(@horiz1, @horiz2) +1 +SELECT Overlaps(@horiz1, @horiz3) FROM DUAL; +Overlaps(@horiz1, @horiz3) +0 +SELECT Overlaps(@horiz1, @point1) FROM DUAL; +Overlaps(@horiz1, @point1) +0 +SELECT Overlaps(@horiz1, @point2) FROM DUAL; +Overlaps(@horiz1, @point2) +0 +DROP TABLE t1; +End of 5.0 tests +CREATE TABLE t1 (p POINT); +CREATE TABLE t2 (p POINT, INDEX(p)); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const 1 Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); +EXPLAIN +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const # Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +DROP TABLE t1, t2; +End of 5.0 tests +# +# Test for bug #58650 "Failing assertion: primary_key_no == -1 || +# primary_key_no == 0". +# +drop table if exists t1; +# The minimal test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a)); +drop table t1; +# The original test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12))); +create unique index a on t1(a); +drop table t1; +create table t1 (g geometry not null, spatial gk(g)) engine=innodb; +drop table t1; +create table t1(id int not null primary key, g1 geometry not null, spatial index(g1)); +insert into t1 values(1, polygonfromtext('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))')); +explain select id from t1 where contains(g1, pointfromtext('POINT(1 1)')); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range g1 g1 34 NULL 1 Using where +select id from t1 where contains(g1, pointfromtext('POINT(1 1)')); +id +1 +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb/r/innodb_information_schema.result new file mode 100644 index 00000000..921b062e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_information_schema.result @@ -0,0 +1,52 @@ +lock_mode lock_type lock_table lock_index lock_rec lock_data +X RECORD `test`.```t'\"_str` PRIMARY 1 # +X RECORD `test`.```t'\"_str` PRIMARY 1 # +X RECORD `test`.```t'\"_str` PRIMARY 2 # +X RECORD `test`.```t'\"_str` PRIMARY 2 # +X RECORD `test`.```t'\"_str` PRIMARY 3 # +X RECORD `test`.```t'\"_str` PRIMARY 3 # +X RECORD `test`.```t'\"_str` PRIMARY 4 # +X RECORD `test`.```t'\"_str` PRIMARY 4 # +X RECORD `test`.```t'\"_str` PRIMARY 5 # +X RECORD `test`.```t'\"_str` PRIMARY 5 # +X RECORD `test`.`t_max` PRIMARY 2 # +X RECORD `test`.`t_max` PRIMARY 2 # +X RECORD `test`.`t_min` PRIMARY 2 # +X RECORD `test`.`t_min` PRIMARY 2 # +lock_table COUNT(*) +`test`.`t_max` 2 +`test`.`t_min` 2 +`test`.```t'\"_str` 10 +lock_table COUNT(*) +"test"."t_max" 2 +"test"."t_min" 2 +"test"."`t'\""_str" 10 +Field Type Null Key Default Extra +trx_id bigint(21) unsigned NO NULL +trx_state varchar(13) NO NULL +trx_started datetime NO NULL +trx_requested_lock_id varchar(81) YES NULL +trx_wait_started datetime YES NULL +trx_weight bigint(21) unsigned NO NULL +trx_mysql_thread_id bigint(21) unsigned NO NULL +trx_query varchar(1024) YES NULL +trx_operation_state varchar(64) YES NULL +trx_tables_in_use bigint(21) unsigned NO NULL +trx_tables_locked bigint(21) unsigned NO NULL +trx_lock_structs bigint(21) unsigned NO NULL +trx_lock_memory_bytes bigint(21) unsigned NO NULL +trx_rows_locked bigint(21) unsigned NO NULL +trx_rows_modified bigint(21) unsigned NO NULL +trx_concurrency_tickets bigint(21) unsigned NO NULL +trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO NULL +trx_unique_checks int(1) NO NULL +trx_foreign_key_checks int(1) NO NULL +trx_last_foreign_key_error varchar(256) YES NULL +trx_is_read_only int(1) NO NULL +trx_autocommit_non_locking int(1) NO NULL +trx_state trx_weight trx_tables_in_use trx_tables_locked trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks +RUNNING 3 0 1 6 1 0 REPEATABLE READ 1 1 +trx_isolation_level trx_unique_checks trx_foreign_key_checks +SERIALIZABLE 0 0 +trx_state trx_isolation_level trx_last_foreign_key_error +RUNNING REPEATABLE READ `test`.`t2`, CONSTRAINT `fk1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`) diff --git a/mysql-test/suite/innodb/r/innodb_information_schema_buffer.result b/mysql-test/suite/innodb/r/innodb_information_schema_buffer.result new file mode 100644 index 00000000..e87b3538 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_information_schema_buffer.result @@ -0,0 +1,34 @@ +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS; +POOL_ID POOL_SIZE FREE_BUFFERS DATABASE_PAGES OLD_DATABASE_PAGES MODIFIED_DATABASE_PAGES PENDING_DECOMPRESS PENDING_READS PENDING_FLUSH_LRU PENDING_FLUSH_LIST PAGES_MADE_YOUNG PAGES_NOT_MADE_YOUNG PAGES_MADE_YOUNG_RATE PAGES_MADE_NOT_YOUNG_RATE NUMBER_PAGES_READ NUMBER_PAGES_CREATED NUMBER_PAGES_WRITTEN PAGES_READ_RATE PAGES_CREATE_RATE PAGES_WRITTEN_RATE NUMBER_PAGES_GET HIT_RATE YOUNG_MAKE_PER_THOUSAND_GETS NOT_YOUNG_MAKE_PER_THOUSAND_GETS NUMBER_PAGES_READ_AHEAD NUMBER_READ_AHEAD_EVICTED READ_AHEAD_RATE READ_AHEAD_EVICTED_RATE LRU_IO_TOTAL LRU_IO_CURRENT UNCOMPRESS_TOTAL UNCOMPRESS_CURRENT +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +CREATE TABLE infoschema_buffer_test (col1 INT) ENGINE = INNODB; +INSERT INTO infoschema_buffer_test VALUES(9); +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE +WHERE TABLE_NAME LIKE '%infoschema_buffer_test%' AND PAGE_TYPE='index'; +POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK +0 # # 3 INDEX 0 FIX AHI LSN LSN TIME `test`.`infoschema_buffer_test` GEN_CLUST_INDEX 1 29 0 FILE_PAGE IO_FIX OLD # +INSERT INTO infoschema_buffer_test VALUES(19); +CREATE INDEX idx ON infoschema_buffer_test(col1); +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE +WHERE TABLE_NAME LIKE '%infoschema_buffer_test%' AND PAGE_TYPE='index'; +POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK +0 # # 3 INDEX 0 FIX AHI LSN LSN TIME `test`.`infoschema_buffer_test` GEN_CLUST_INDEX 2 58 0 FILE_PAGE IO_FIX OLD # +0 # # 4 INDEX 0 FIX AHI LSN LSN TIME `test`.`infoschema_buffer_test` idx 2 32 0 FILE_PAGE IO_FIX OLD # +DROP TABLE infoschema_buffer_test; +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE +WHERE TABLE_NAME LIKE '%infoschema_buffer_test%'; +POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK +CREATE TABLE infoschema_parent (id INT NOT NULL, PRIMARY KEY (id)) +ENGINE=INNODB; +CREATE TABLE infoschema_child (id INT, parent_id INT, INDEX par_ind (parent_id), +FOREIGN KEY (parent_id) +REFERENCES infoschema_parent(id) +ON DELETE CASCADE) +ENGINE=INNODB; +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE +WHERE TABLE_NAME LIKE '%infoschema_child%'; +POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK +0 # # 3 INDEX 0 FIX AHI LSN LSN TIME `test`.`infoschema_child` GEN_CLUST_INDEX 0 0 0 FILE_PAGE IO_FIX OLD # +0 # # 4 INDEX 0 FIX AHI LSN LSN TIME `test`.`infoschema_child` par_ind 0 0 0 FILE_PAGE IO_FIX OLD # +DROP TABLE infoschema_child; +DROP TABLE infoschema_parent; diff --git a/mysql-test/suite/innodb/r/innodb_information_schema_tables.result b/mysql-test/suite/innodb/r/innodb_information_schema_tables.result new file mode 100644 index 00000000..ea713ea6 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_information_schema_tables.result @@ -0,0 +1,2 @@ +CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result new file mode 100644 index 00000000..797c30d7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result @@ -0,0 +1,361 @@ +# +# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout +# without error +# +CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES (1070109,99); +CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t2 (b,a) VALUES (7,1070109); +SELECT * FROM t1; +a b +1070109 99 +BEGIN; +SELECT b FROM t2 WHERE b=7 FOR UPDATE; +b +7 +CONNECT addconroot, localhost, root,,; +connection addconroot; +BEGIN; +SELECT b FROM t2 WHERE b=7 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +INSERT IGNORE INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7)); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1; +a b +1070109 99 +connection default; +disconnect addconroot; +DROP TABLE t2, t1; +# End of 5.0 tests +# +# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT +# FOR UPDATE +# +create table t1 (a int primary key auto_increment, +b int, index(b)) engine=innodb; +insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +set autocommit=0; +begin; +select * from t1 where b=5 for update; +a b +5 5 +connect con1, localhost, root,,; +connection con1; +insert ignore into t1 (b) select a as b from t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +# Cleanup +# +disconnect con1; +commit; +set autocommit=default; +drop table t1; +# +# Bug #37183 insert ignore into .. select ... hangs +# after deadlock was encountered +# +connect con1,localhost,root,,; +create table t1(id int primary key,v int)engine=innodb; +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +create table t2 like t1; +connection con1; +begin; +update t1 set v=id*2 where id=1; +connection default; +begin; +update t1 set v=id*2 where id=2; +connection con1; +update t1 set v=id*2 where id=2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +insert ignore into t2 select * from t1 where id=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +rollback; +connection con1; +rollback; +connection default; +disconnect con1; +drop table t1, t2; +# +# Bug#41756 Strange error messages about locks from InnoDB +# +# In the default transaction isolation mode, +# handler::unlock_row() in InnoDB does nothing. +# Thus in order to reproduce the condition that led to the +# warning, one needs to relax isolation by either +# setting a weaker tx_isolation value, or by turning on +# the unsafe replication switch. +set @@session.tx_isolation="read-committed"; +# Prepare data. We need a table with a unique index, +# for join_read_key to be used. The other column +# allows to control what passes WHERE clause filter. +create table t1 (a int primary key, b int) engine=innodb; +# Let's make sure t1 has sufficient amount of rows +# to exclude JT_ALL access method when reading it, +# i.e. make sure that JT_EQ_REF(a) is always preferred. +insert into t1 values (1,1), (2,null), (3,1), (4,1), +(5,1), (6,1), (7,1), (8,1), (9,1), (10,1), +(11,1), (12,1), (13,1), (14,1), (15,1), +(16,1), (17,1), (18,1), (19,1), (20,1); +# +# Demonstrate that for the SELECT statement +# used later in the test JT_EQ_REF access method is used. +# +explain +select 1 from t1 natural join (select 2 as a, 1 as b union all +select 2 as a, 2 as b) as t2 for update; +id 1 +select_type PRIMARY +table +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows 2 +Extra +id 1 +select_type PRIMARY +table t1 +type eq_ref +possible_keys PRIMARY +key PRIMARY +key_len 4 +ref t2.a +rows 1 +Extra Using where +id 2 +select_type DERIVED +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +id 3 +select_type UNION +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +# +# Demonstrate that the reported SELECT statement +# no longer produces warnings. +# +select 1 from t1 natural join (select 2 as a, 1 as b union all +select 2 as a, 2 as b) as t2 for update; +1 +commit; +# +# Demonstrate that due to lack of inter-sweep "reset" function, +# we keep some non-matching records locked, even though we know +# we could unlock them. +# To do that, show that if there is only one distinct value +# for a in t2 (a=2), we will keep record (2,null) in t1 locked. +# But if we add another value for "a" to t2, say 6, +# join_read_key cache will be pruned at least once, +# and thus record (2, null) in t1 will get unlocked. +# +begin; +select 1 from t1 natural join (select 2 as a, 1 as b union all +select 2 as a, 2 as b) as t2 for update; +1 +connect con1,localhost,root,,; +connection con1; +# We should be able to delete all records from t1 except (2, null), +# since they were not locked. +begin; +# Delete in series of 3 records so that full scan +# is not used and we're not blocked on record (2,null) +delete from t1 where a in (1,3,4); +delete from t1 where a in (5,6,7); +delete from t1 where a in (8,9,10); +delete from t1 where a in (11,12,13); +delete from t1 where a in (14,15,16); +delete from t1 where a in (17,18); +delete from t1 where a in (19,20); +# +# Record (2, null) is locked. This is actually unnecessary, +# because the previous select returned no rows. +# Just demonstrate the effect. +# +delete from t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +rollback; +connection default; +# +# Show that the original contents of t1 is intact: +select * from t1; +a b +1 1 +2 NULL +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +commit; +# +# Have a one more record in t2 to show that +# if join_read_key cache is purned, the current +# row under the cursor is unlocked (provided, this row didn't +# match the partial WHERE clause, of course). +# Sic: the result of this test dependent on the order of retrieval +# of records --echo # from the derived table, if ! +# We use DELETE to disable the JOIN CACHE. This DELETE modifies no +# records. It also should leave no InnoDB row locks. +# +begin; +delete t1.* from t1 natural join (select 2 as a, 2 as b union all +select 0 as a, 0 as b) as t2; +# Demonstrate that nothing was deleted form t1 +select * from t1; +a b +1 1 +2 NULL +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +connection con1; +begin; +# Since there is another distinct record in the derived table +# the previous matching record in t1 -- (2,null) -- was unlocked. +delete from t1; +# We will need the contents of the table again. +rollback; +select * from t1; +a b +1 1 +2 NULL +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +commit; +connection default; +rollback; +begin; +# +# Before this patch, we could wrongly unlock a record +# that was cached and later used in a join. Demonstrate that +# this is no longer the case. +# Sic: this test is also order-dependent (i.e. the +# the bug would show up only if the first record in the union +# is retreived and processed first. +# +# Verify that JT_EQ_REF is used. +explain +select 1 from t1 natural join (select 3 as a, 2 as b union all +select 3 as a, 1 as b) as t2 for update; +id 1 +select_type PRIMARY +table +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows 2 +Extra +id 1 +select_type PRIMARY +table t1 +type eq_ref +possible_keys PRIMARY +key PRIMARY +key_len 4 +ref t2.a +rows 1 +Extra Using where +id 2 +select_type DERIVED +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +id 3 +select_type UNION +table NULL +type NULL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows NULL +Extra No tables used +# Lock the record. +select 1 from t1 natural join (select 3 as a, 2 as b union all +select 3 as a, 1 as b) as t2 for update; +1 +1 +connection con1; +# +# We should not be able to delete record (3,1) from t1, +# (previously it was possible). +# +delete from t1 where a=3; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +commit; +disconnect con1; +set @@session.tx_isolation=default; +drop table t1; +# +# End of 5.1 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_multi_update.result b/mysql-test/suite/innodb/r/innodb_multi_update.result new file mode 100644 index 00000000..93bd4e67 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_multi_update.result @@ -0,0 +1,85 @@ +CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb; +INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); +INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100; +select * from bug38999_1; +a b +101 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101; +select * from bug38999_1; +a b +201 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2; +select * from bug38999_1; +a b +201 1 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100; +select * from bug38999_1; +a b +201 1 +103 5 +104 6 +106 6 +105 7 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +select * from bug38999_2; +a b +1 1 +2 2 +6 6 +7 7 +8 8 +9 9 +3 13 +4 14 +5 15 +drop table bug38999_1,bug38999_2; +# +# Bug#54475 improper error handling causes cascading crashing failures in innodb +# +CREATE TABLE t1(f1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1; +ERROR 21000: Operand should contain 1 column(s) +UPDATE (SELECT ((SELECT 1 FROM t1),1) = (1,1) FROM t1 WHERE (SELECT 1 FROM t1)) x, t1 AS d SET d.f1 = 1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result new file mode 100644 index 00000000..aa8cc118 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -0,0 +1,3364 @@ +SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB; +drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4; +drop procedure if exists p1; +create table t1 ( +c_id int(11) not null default '0', +org_id int(11) default null, +unique key contacts$c_id (c_id), +key contacts$org_id (org_id) +); +insert into t1 values +(2,null),(120,null),(141,null),(218,7), (128,1), +(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3), +(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4); +create table t2 ( +slai_id int(11) not null default '0', +owner_tbl int(11) default null, +owner_id int(11) default null, +sla_id int(11) default null, +inc_web int(11) default null, +inc_email int(11) default null, +inc_chat int(11) default null, +inc_csr int(11) default null, +inc_total int(11) default null, +time_billed int(11) default null, +activedate timestamp null default null, +expiredate timestamp null default null, +state int(11) default null, +sla_set int(11) default null, +unique key t2$slai_id (slai_id), +key t2$owner_id (owner_id), +key t2$sla_id (sla_id) +); +insert into t2(slai_id, owner_tbl, owner_id, sla_id) values +(1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7), +(8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12); +flush tables; +select si.slai_id +from t1 c join t2 si on +((si.owner_tbl = 3 and si.owner_id = c.org_id) or +( si.owner_tbl = 2 and si.owner_id = c.c_id)) +where +c.c_id = 218 and expiredate is null; +slai_id +12 +select * from t1 where org_id is null; +c_id org_id +2 NULL +120 NULL +141 NULL +select si.slai_id +from t1 c join t2 si on +((si.owner_tbl = 3 and si.owner_id = c.org_id) or +( si.owner_tbl = 2 and si.owner_id = c.c_id)) +where +c.c_id = 218 and expiredate is null; +slai_id +12 +drop table t1, t2; +CREATE TABLE t1 (a int, b int, KEY b (b)); +CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b)); +CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a), +UNIQUE KEY b (b,c), KEY a (a,b,c)); +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 SELECT a + 1, b + 1 FROM t1; +INSERT INTO t1 SELECT a + 2, b + 2 FROM t1; +INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8); +INSERT INTO t2 SELECT a + 1, b FROM t2; +DELETE FROM t2 WHERE a = 1 AND b < 2; +INSERT INTO t3 VALUES (1,1,1),(2,1,2); +INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3; +INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3; +SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE +t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2) +ORDER BY t1.b LIMIT 2; +b a +1 1 +2 2 +SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE +t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2) +ORDER BY t1.b LIMIT 5; +b a +1 1 +2 2 +2 2 +3 3 +3 3 +DROP TABLE t1, t2, t3; +CREATE TABLE `t1` (`id1` INT) ; +INSERT INTO `t1` (`id1`) VALUES (1),(5),(2); +CREATE TABLE `t2` ( +`id1` INT, +`id2` INT NOT NULL, +`id3` INT, +`id4` INT NOT NULL, +UNIQUE (`id2`,`id4`), +KEY (`id1`) +); +INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES +(1,1,1,0), +(1,1,2,1), +(5,1,2,2), +(6,1,2,3), +(1,2,2,2), +(1,2,1,1); +SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2); +id1 +2 +DROP TABLE t1, t2; +create table t1 (c1 int) engine=innodb; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con2; +handler t1 open; +handler t1 read first; +c1 +disconnect con2; +connection con1; +Before and after comparison +0 +connection default; +drop table t1; +disconnect con1; +CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1) +ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +c1 cnt +1a 1 +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +c1 cnt +1a 2 +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1) +ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +c1 cnt +1a 1 +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +c1 cnt +1a 2 +DROP TABLE t1; +CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1) +ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +c1 cnt +1a 1 +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +c1 cnt +1a 2 +DROP TABLE t1; +CREATE TABLE t1 ( +a1 decimal(10,0) DEFAULT NULL, +a2 blob, +a3 time DEFAULT NULL, +a4 blob, +a5 char(175) DEFAULT NULL, +a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +a7 tinyblob, +INDEX idx (a6,a7(239),a5) +) ENGINE=InnoDB; +EXPLAIN SELECT a4 FROM t1 WHERE +a6=NULL AND +a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE +t.a6=t.a6 AND t1.a6=NULL AND +t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; +create table t1m (a int) engine = MEMORY; +create table t1i (a int); +create table t2m (a int) engine = MEMORY; +create table t2i (a int); +insert into t2m values (5); +insert into t2i values (5); +select min(a) from t1i; +min(a) +NULL +select min(7) from t1i; +min(7) +NULL +select min(7) from DUAL; +min(7) +7 +explain select min(7) from t2i join t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1i ALL NULL NULL NULL NULL 0 +1 SIMPLE t2i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +select min(7) from t2i join t1i; +min(7) +NULL +select max(a) from t1i; +max(a) +NULL +select max(7) from t1i; +max(7) +NULL +select max(7) from DUAL; +max(7) +7 +explain select max(7) from t2i join t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1i ALL NULL NULL NULL NULL 0 +1 SIMPLE t2i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +select max(7) from t2i join t1i; +max(7) +NULL +select 1, min(a) from t1i where a=99; +1 min(a) +1 NULL +select 1, min(a) from t1i where 1=99; +1 min(a) +1 NULL +select 1, min(1) from t1i where a=99; +1 min(1) +1 NULL +select 1, min(1) from t1i where 1=99; +1 min(1) +1 NULL +select 1, max(a) from t1i where a=99; +1 max(a) +1 NULL +select 1, max(a) from t1i where 1=99; +1 max(a) +1 NULL +select 1, max(1) from t1i where a=99; +1 max(1) +1 NULL +select 1, max(1) from t1i where 1=99; +1 max(1) +1 NULL +explain select count(*), min(7), max(7) from t1m, t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t1i ALL NULL NULL NULL NULL 0 +select count(*), min(7), max(7) from t1m, t1i; +count(*) min(7) max(7) +0 NULL NULL +explain select count(*), min(7), max(7) from t1m, t2i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2i ALL NULL NULL NULL NULL 1 +select count(*), min(7), max(7) from t1m, t2i; +count(*) min(7) max(7) +0 NULL NULL +explain select count(*), min(7), max(7) from t2m, t1i; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2m system NULL NULL NULL NULL 1 +1 SIMPLE t1i ALL NULL NULL NULL NULL 0 +select count(*), min(7), max(7) from t2m, t1i; +count(*) min(7) max(7) +0 NULL NULL +drop table t1m, t1i, t2m, t2i; +create table t1 ( +a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' ' +) ENGINE = MEMORY; +insert into t1 (a1, a2, b, c, d) values +('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'), +('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'), +('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'), +('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'), +('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'), +('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'), +('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'), +('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'), +('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'), +('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'), +('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'), +('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'), +('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'), +('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'), +('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'), +('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'), +('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'), +('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'), +('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'), +('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'), +('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'), +('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'), +('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'), +('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'), +('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'), +('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'), +('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'), +('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'), +('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'), +('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'), +('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'), +('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'); +create table t4 ( +pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' ' +); +insert into t4 (a1, a2, b, c, d, dummy) select * from t1; +create index idx12672_0 on t4 (a1); +create index idx12672_1 on t4 (a1,a2,b,c); +create index idx12672_2 on t4 (a1,a2,b); +analyze table t4; +Table Op Msg_type Msg_text +test.t4 analyze status Engine-independent statistics collected +test.t4 analyze status OK +select distinct a1 from t4 where pk_col not in (1,2,3,4); +a1 +a +b +c +d +drop table t1,t4; +DROP TABLE IF EXISTS t2, t1; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; +CREATE TABLE t2 ( +i INT NOT NULL, +FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION +) ENGINE= InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +DELETE IGNORE FROM t1 WHERE i = 1; +Warnings: +Warning 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION) +SELECT * FROM t1, t2; +i i +1 1 +DROP TABLE t2, t1; +End of 4.1 tests. +create table t1 ( +a varchar(30), b varchar(30), primary key(a), key(b) +); +select distinct a from t1; +a +drop table t1; +create table t1(a int, key(a)); +insert into t1 values(1); +select a, count(a) from t1 group by a with rollup; +a count(a) +1 1 +NULL 1 +drop table t1; +create table t1 (f1 int, f2 char(1), primary key(f1,f2)) stats_persistent=0; +insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d"); +alter table t1 drop primary key, add primary key (f2, f1); +explain select distinct f1 a, f1 b from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary +explain select distinct f1, f2 from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index +drop table t1; +CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20), +INDEX (name)); +CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11)); +ALTER TABLE t2 ADD FOREIGN KEY (fkey) REFERENCES t2(id); +INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B'); +INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3); +EXPLAIN +SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id +WHERE t1.name LIKE 'A%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,name name 23 NULL 2 Using where; Using index +1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using index +EXPLAIN +SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id +WHERE t1.name LIKE 'A%' OR FALSE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,name name 23 NULL 2 Using where; Using index +1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using index +DROP TABLE t1,t2; +CREATE TABLE t1 ( +id int NOT NULL, +name varchar(20) NOT NULL, +dept varchar(20) NOT NULL, +age tinyint(3) unsigned NOT NULL, +PRIMARY KEY (id), +INDEX (name,dept) +) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1(id, dept, age, name) VALUES +(3987, 'cs1', 10, 'rs1'), (3988, 'cs2', 20, 'rs1'), (3995, 'cs3', 10, 'rs2'), +(3996, 'cs4', 20, 'rs2'), (4003, 'cs5', 10, 'rs3'), (4004, 'cs6', 20, 'rs3'), +(4011, 'cs7', 10, 'rs4'), (4012, 'cs8', 20, 'rs4'), (4019, 'cs9', 10, 'rs5'), +(4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6'); +set +@tmp_uss=@@use_stat_tables, +@tmp_occ=@@optimizer_use_condition_selectivity; +set +use_stat_tables='preferably', +optimizer_use_condition_selectivity=4; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +flush tables; +EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref name name 22 const 2 Using where; Using index +SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +name dept +rs5 cs10 +rs5 cs9 +DELETE FROM t1; +# Masking (#) number in "rows" column of the following EXPLAIN output, as it may vary (bug#47746). +EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref name name 22 const # Using where; Using index +SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; +name dept +DROP TABLE t1; +set +use_stat_tables=@tmp_uss, +optimizer_use_condition_selectivity=@tmp_occ; +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout OFF +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con2; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +connection con1; +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +5 +commit; +connection con2; +select * from t1; +a +1 +2 +commit; +connection default; +select * from t1; +a +1 +2 +5 +drop table t1; +disconnect con1; +disconnect con2; +set @save_qcache_size=@@global.query_cache_size; +set @save_qcache_type=@@global.query_cache_type; +set global query_cache_size=10*1024*1024; +set global query_cache_type=1; +connect con1,localhost,root,,; +connection con1; +drop table if exists `test`; +Warnings: +Note 1051 Unknown table 'test.test' +CREATE TABLE `test` (`test1` varchar(3) NOT NULL, +`test2` varchar(4) NOT NULL,PRIMARY KEY (`test1`)) +ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '5678'); +disconnect con1; +connect con2,localhost,root,,; +connection con2; +select * from test; +test1 test2 +tes 5678 +INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '1234') +ON DUPLICATE KEY UPDATE `test2` = '1234'; +select * from test; +test1 test2 +tes 1234 +flush tables; +select * from test; +test1 test2 +tes 1234 +disconnect con2; +connection default; +drop table test; +set global query_cache_type=@save_qcache_type; +set global query_cache_size=@save_qcache_size; +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout OFF +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con2; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +connection con1; +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +5 +commit; +connection con2; +select * from t1; +a +1 +2 +commit; +connection default; +select * from t1; +a +1 +2 +5 +drop table t1; +disconnect con1; +disconnect con2; +create table t1( +id int auto_increment, +c char(1) not null, +counter int not null default 1, +primary key (id), +unique key (c) +) engine=innodb; +insert into t1 (id, c) values +(NULL, 'a'), +(NULL, 'a') +on duplicate key update id = values(id), counter = counter + 1; +select * from t1; +id c counter +2 a 2 +insert into t1 (id, c) values +(NULL, 'b') +on duplicate key update id = values(id), counter = counter + 1; +select * from t1; +id c counter +2 a 2 +3 b 1 +truncate table t1; +insert into t1 (id, c) values (NULL, 'a'); +select * from t1; +id c counter +1 a 1 +insert into t1 (id, c) values (NULL, 'b'), (NULL, 'b') +on duplicate key update id = values(id), c = values(c), counter = counter + 1; +select * from t1; +id c counter +1 a 1 +3 b 2 +insert into t1 (id, c) values (NULL, 'a') +on duplicate key update id = values(id), c = values(c), counter = counter + 1; +select * from t1; +id c counter +3 b 2 +4 a 2 +drop table t1; +CREATE TABLE t1( +id int AUTO_INCREMENT PRIMARY KEY, +stat_id int NOT NULL, +acct_id int DEFAULT NULL, +INDEX idx1 (stat_id, acct_id), +INDEX idx2 (acct_id) +) ENGINE=MyISAM; +CREATE TABLE t2( +id int AUTO_INCREMENT PRIMARY KEY, +stat_id int NOT NULL, +acct_id int DEFAULT NULL, +INDEX idx1 (stat_id, acct_id), +INDEX idx2 (acct_id) +) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1(stat_id,acct_id) VALUES +(1,759), (2,831), (3,785), (4,854), (1,921), +(1,553), (2,589), (3,743), (2,827), (2,545), +(4,779), (4,783), (1,597), (1,785), (4,832), +(1,741), (1,833), (3,788), (2,973), (1,907); +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +INSERT IGNORE INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1; +Warnings: +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +UPDATE t1 SET acct_id=785 +WHERE MOD(stat_id,2)=0 AND MOD(id,stat_id)=MOD(acct_id,stat_id); +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +40960 +SELECT COUNT(*) FROM t1 WHERE acct_id=785; +COUNT(*) +8702 +EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx2 idx1 9 NULL 2 Using where; Using index +INSERT INTO t2 SELECT * FROM t1; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +DROP TABLE t1,t2; +create table t1(a int) engine=innodb; +alter table t1 comment '123'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='123' +drop table t1; +CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES ('uk'),('bg'); +SELECT * FROM t1 WHERE a = 'uk'; +a +uk +DELETE FROM t1 WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +a +UPDATE t1 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +a +CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB; +INSERT INTO t2 VALUES ('uk'),('bg'); +SELECT * FROM t2 WHERE a = 'uk'; +a +uk +DELETE FROM t2 WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +a +INSERT INTO t2 VALUES ('uk'); +UPDATE t2 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +a +CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM; +INSERT INTO t3 VALUES ('uk'),('bg'); +SELECT * FROM t3 WHERE a = 'uk'; +a +uk +DELETE FROM t3 WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +a +INSERT INTO t3 VALUES ('uk'); +UPDATE t3 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +a +DROP TABLE t1,t2,t3; +create table t1 (a int) engine=innodb; +select * from bug29807; +ERROR 42S02: Table 'test.bug29807' doesn't exist in engine +drop table t1; +drop table bug29807; +Warnings: +Warning 1932 Table 'test.bug29807' doesn't exist in engine +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +CONNECT c1,localhost,root,,; +CONNECT c2,localhost,root,,; +connection c1; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES (1); +connection c2; +SET AUTOCOMMIT=0; +SET @old_lock_wait_timeout= @@lock_wait_timeout; +SET lock_wait_timeout= 1; +LOCK TABLES t1 READ, t2 READ; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET @@lock_wait_timeout= @old_lock_wait_timeout; +connection c1; +COMMIT; +INSERT INTO t1 VALUES (1); +connection default; +SET AUTOCOMMIT=default; +disconnect c1; +disconnect c2; +DROP TABLE t1,t2; +CREATE TABLE t1 ( +id int NOT NULL auto_increment PRIMARY KEY, +b int NOT NULL, +c datetime NOT NULL, +INDEX idx_b(b), +INDEX idx_c(c) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +b int NOT NULL auto_increment PRIMARY KEY, +c datetime NOT NULL +) ENGINE= MyISAM; +INSERT INTO t2(c) VALUES ('2007-01-01'); +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-02'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-03'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +set @@sort_buffer_size=8192; +SELECT COUNT(*) FROM t1; +COUNT(*) +3072 +EXPLAIN +SELECT COUNT(*) FROM t1 +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL idx_b,idx_c NULL NULL NULL # Using where +SELECT COUNT(*) FROM t1 +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +COUNT(*) +3072 +EXPLAIN +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge idx_b,idx_c idx_c,idx_b 5,4 NULL # Using sort_union(idx_c,idx_b); Using where +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +COUNT(*) +3072 +set @@sort_buffer_size=default; +DROP TABLE t1,t2; +CREATE TABLE t1 (a int, b int); +insert into t1 values (1,1),(1,2); +CREATE TABLE t2 (primary key (a)) select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +drop table if exists t2; +Warnings: +Note 1051 Unknown table 'test.t2' +CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +drop table if exists t2; +Warnings: +Note 1051 Unknown table 'test.t2' +CREATE TABLE t2 (a int, b int, primary key (a)); +BEGIN; +INSERT INTO t2 values(100,100); +CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; +Warnings: +Note 1050 Table 't2' already exists +SELECT * from t2; +a b +100 100 +ROLLBACK; +SELECT * from t2; +a b +100 100 +TRUNCATE table t2; +INSERT INTO t2 select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT * from t2; +a b +drop table t2; +CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)); +BEGIN; +INSERT INTO t2 values(100,100); +CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; +Warnings: +Note 1050 Table 't2' already exists +SELECT * from t2; +a b +100 100 +COMMIT; +BEGIN; +INSERT INTO t2 values(101,101); +CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; +Warnings: +Note 1050 Table 't2' already exists +SELECT * from t2; +a b +100 100 +101 101 +ROLLBACK; +SELECT * from t2; +a b +100 100 +TRUNCATE table t2; +INSERT INTO t2 select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +SELECT * from t2; +a b +drop table t1,t2; +create table t1(f1 varchar(800) binary not null, key(f1)) +character set utf8 collate utf8_general_ci; +insert into t1 values('aaa'); +drop table t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; +INSERT INTO t1 VALUES ( 1 , 1 , 1); +INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1; +INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1; +EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 128 +EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort +DROP TABLE t1; +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout OFF +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con2; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +connection con1; +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +5 +commit; +connection con2; +select * from t1; +a +1 +2 +commit; +connection default; +select * from t1; +a +1 +2 +5 +drop table t1; +disconnect con1; +disconnect con2; +drop table if exists t1; +create table t1 (a int) engine=innodb; +alter table t1 alter a set default 1; +drop table t1; + +Bug#24918 drop table and lock / inconsistent between +perm and temp tables + +Check transactional tables under LOCK TABLES + +drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp, +t24918_access; +create table t24918_access (id int); +create table t24918 (id int) engine=myisam; +create temporary table t24918_tmp (id int) engine=myisam; +create table t24918_trans (id int) engine=innodb; +create temporary table t24918_trans_tmp (id int) engine=innodb; +lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write; +drop table t24918; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_trans; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_trans_tmp; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_tmp; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +unlock tables; +drop table t24918_access; +CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2); +INSERT INTO t1 SELECT a + 8, 2 FROM t1; +INSERT INTO t1 SELECT a + 16, 1 FROM t1; +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys bkey +key bkey +key_len 5 +ref const +rows 16 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a; +a b +1 2 +2 2 +3 2 +4 2 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +11 2 +12 2 +13 2 +14 2 +15 2 +16 2 +EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a; +id 1 +select_type SIMPLE +table t1 +type range +possible_keys bkey +key bkey +key_len 5 +ref NULL +rows 32 +Extra Using where; Using index; Using filesort +SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a; +a b +1 2 +2 2 +3 2 +4 2 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +11 2 +12 2 +13 2 +14 2 +15 2 +16 2 +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a; +id 1 +select_type SIMPLE +table t1 +type range +possible_keys bkey +key bkey +key_len 5 +ref NULL +rows 32 +Extra Using where; Using index +SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a; +a b +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +1 2 +2 2 +3 2 +4 2 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +11 2 +12 2 +13 2 +14 2 +15 2 +16 2 +CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c)) +ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1); +INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2; +INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2; +EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 5 +ref const +rows 16 +Extra Using where; Using index; Using filesort +SELECT * FROM t2 WHERE b=1 ORDER BY a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 10 +ref const,const +rows 16 +Extra Using where; Using index +SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 10 +ref const,const +rows 16 +Extra Using where; Using index +SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a; +id 1 +select_type SIMPLE +table t2 +type ref +possible_keys bkey +key bkey +key_len 10 +ref const,const +rows 16 +Extra Using where; Using index +SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a; +a b c +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +6 1 1 +7 1 1 +8 1 1 +9 1 1 +10 1 1 +11 1 1 +12 1 1 +13 1 1 +14 1 1 +15 1 1 +16 1 1 +DROP TABLE t1,t2; +CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 SELECT a + 8 FROM t1; +INSERT INTO t1 SELECT a + 16 FROM t1; +CREATE PROCEDURE p1 () +BEGIN +DECLARE i INT DEFAULT 50; +DECLARE cnt INT; +# Continue even in the presence of ER_LOCK_DEADLOCK. +DECLARE CONTINUE HANDLER FOR 1213 BEGIN END; +START TRANSACTION; +ALTER TABLE t1 ENGINE=InnoDB; +COMMIT; +START TRANSACTION; +WHILE (i > 0) DO +SET i = i - 1; +SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE; +END WHILE; +COMMIT; +END;| +CONNECT con1,localhost,root,,; +CONNECT con2,localhost,root,,; +connection con1; +CALL p1(); +connection con2; +CALL p1(); +connection default; +CALL p1(); +connection con1; +connection con2; +connection default; +disconnect con1; +disconnect con2; +DROP PROCEDURE p1; +DROP TABLE t1; +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for +alter table t1 add index(a(1024)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text DEFAULT NULL, + KEY `a` (`a`(1024)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +drop table t1; +CREATE TABLE t1 ( +a INT, +b INT, +KEY (b) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30); +START TRANSACTION; +SELECT * FROM t1 WHERE b=20 FOR UPDATE; +a b +2 20 +connect conn2, localhost, root,,test; +START TRANSACTION; +SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE; +a b +1 10 +2 10 +ROLLBACK; +disconnect conn2; +connection default; +ROLLBACK; +DROP TABLE t1; +CREATE TABLE t1( +a INT, +b INT NOT NULL, +c INT NOT NULL, +d INT, +UNIQUE KEY (c,b) +) engine=innodb; +INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); +EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +SELECT c,b,d FROM t1 GROUP BY c,b,d; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +SELECT c,b,d FROM t1 ORDER BY c,b,d; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 8 NULL 3 +SELECT c,b,d FROM t1 GROUP BY c,b; +c b d +1 1 50 +3 1 4 +3 2 40 +EXPLAIN SELECT c,b FROM t1 GROUP BY c,b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 8 NULL 3 Using index +SELECT c,b FROM t1 GROUP BY c,b; +c b +1 1 +3 1 +3 2 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), INDEX b (b)) ENGINE=InnoDB; +INSERT INTO t1(a,b) VALUES (1,1), (2,2), (3,2); +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys b +key b +key_len 5 +ref const +rows 2 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +a b +2 2 +3 2 +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys b +key b +key_len 5 +ref const +rows 2 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; +a b +3 2 +2 2 +EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a ASC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index +SELECT * FROM t1 ORDER BY b ASC, a ASC; +a b +1 1 +2 2 +3 2 +EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a DESC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index +SELECT * FROM t1 ORDER BY b DESC, a DESC; +a b +3 2 +2 2 +1 1 +EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a DESC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index; Using filesort +SELECT * FROM t1 ORDER BY b ASC, a DESC; +a b +1 1 +3 2 +2 2 +EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a ASC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index; Using filesort +SELECT * FROM t1 ORDER BY b DESC, a ASC; +a b +2 2 +3 2 +1 1 +DROP TABLE t1; + +# +# Bug#27610: ALTER TABLE ROW_FORMAT=... does not rebuild the table. +# + +# - prepare; + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1(c INT) +ENGINE = InnoDB +ROW_FORMAT = COMPACT; + +# - initial check; + +SELECT table_schema, table_name, row_format +FROM INFORMATION_SCHEMA.TABLES +WHERE table_schema = DATABASE() AND table_name = 't1'; +table_schema table_name row_format +test t1 Compact + +# - change ROW_FORMAT and check; + +ALTER TABLE t1 ROW_FORMAT = REDUNDANT; + +SELECT table_schema, table_name, row_format +FROM INFORMATION_SCHEMA.TABLES +WHERE table_schema = DATABASE() AND table_name = 't1'; +table_schema table_name row_format +test t1 Redundant + +# - that's it, cleanup. + +DROP TABLE t1; +create table t1(a char(10) not null, unique key aa(a(1)), +b char(4) not null, unique key bb(b(4))) engine=innodb; +desc t1; +Field Type Null Key Default Extra +a char(10) NO UNI NULL +b char(4) NO PRI NULL +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) NOT NULL, + `b` char(4) NOT NULL, + UNIQUE KEY `bb` (`b`), + UNIQUE KEY `aa` (`a`(1)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2); +EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL idx NULL NULL NULL 4 Using where; Using filesort +SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; +id type d +191 member 1 +NULL member 3 +NULL member 4 +DROP TABLE t1; +set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment; +set global innodb_autoextend_increment=8; +set global innodb_autoextend_increment=@my_innodb_autoextend_increment; +CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b)) +ENGINE=InnoDB; +INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1); +INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1; +EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using where +SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; +a b c +8 1 1 +7 1 1 +6 1 1 +5 1 1 +4 1 1 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a char(50)) ENGINE=InnoDB; +CREATE INDEX i1 on t1 (a(3)); +SELECT * FROM t1 WHERE a = 'abcde'; +a +DROP TABLE t1; +# +# BUG #26288: savepoint are not deleted on comit, if the transaction +# was otherwise empty +# +BEGIN; +SAVEPOINT s1; +COMMIT; +RELEASE SAVEPOINT s1; +ERROR 42000: SAVEPOINT s1 does not exist +BEGIN; +SAVEPOINT s2; +COMMIT; +ROLLBACK TO SAVEPOINT s2; +ERROR 42000: SAVEPOINT s2 does not exist +BEGIN; +SAVEPOINT s3; +ROLLBACK; +RELEASE SAVEPOINT s3; +ERROR 42000: SAVEPOINT s3 does not exist +BEGIN; +SAVEPOINT s4; +ROLLBACK; +ROLLBACK TO SAVEPOINT s4; +ERROR 42000: SAVEPOINT s4 does not exist +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NULL, f3 CHAR(10) DEFAULT 'My ID#', CONSTRAINT f2_ref FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=INNODB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL COMMENT 'My ID#', + `f2` int(11) DEFAULT NULL, + `f3` char(10) DEFAULT 'My ID#', + PRIMARY KEY (`f1`), + KEY `f2_ref` (`f2`), + CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# Bug #36995: valgrind error in remove_const during subquery executions +# +create table t1 (a bit(1) not null,b int) engine=myisam; +create table t2 (c int) engine=innodb; +set @save_optimizer_switch=@@optimizer_switch; +set @@optimizer_switch='in_to_exists=on,materialization=off'; +explain +select b from t1 where a not in (select max(b) from t1,t2 group by a) group by a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 Const row not found +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 +set optimizer_switch=@save_optimizer_switch; +DROP TABLE t1,t2; +End of 5.0 tests +CREATE TABLE `t2` ( +`k` int(11) NOT NULL auto_increment, +`a` int(11) default NULL, +`c` int(11) default NULL, +PRIMARY KEY (`k`), +UNIQUE KEY `idx_1` (`a`) +); +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +insert into t2 ( a ) values ( 7 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +2 +select * from t2; +k a c +1 6 NULL +2 7 NULL +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +2 +select last_insert_id(0); +last_insert_id(0) +0 +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +0 +select * from t2; +k a c +1 6 2 +2 7 NULL +insert ignore into t2 values (null,6,1),(10,8,1); +Warnings: +Warning 1062 Duplicate entry '6' for key 'idx_1' +select last_insert_id(); +last_insert_id() +0 +insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); +Warnings: +Warning 1062 Duplicate entry '6' for key 'idx_1' +Warning 1062 Duplicate entry '8' for key 'idx_1' +select last_insert_id(); +last_insert_id() +11 +select * from t2; +k a c +1 6 2 +2 7 NULL +10 8 1 +11 15 1 +12 20 1 +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1, k=last_insert_id(k); +select last_insert_id(); +last_insert_id() +1 +select * from t2; +k a c +1 6 3 +2 7 NULL +10 8 1 +11 15 1 +12 20 1 +drop table t2; +drop table if exists t1, t2; +create table t1 (i int); +alter table t1 modify i int default 1; +alter table t1 modify i int default 2, rename t2; +lock table t2 write; +alter table t2 modify i int default 3; +unlock tables; +lock table t2 write; +alter table t2 modify i int default 4, rename t1; +unlock tables; +drop table t1; +drop table if exists t1; +create table t1 (i int); +insert into t1 values (); +lock table t1 write; +alter table t1 modify i int default 1; +insert into t1 values (); +select * from t1; +i +NULL +1 +alter table t1 change i c char(10) default "Two"; +insert into t1 values (); +select * from t1; +c +NULL +1 +Two +unlock tables; +select * from t1; +c +NULL +1 +Two +drop tables t1; +create table t1(f1 varchar(5) unique, f2 timestamp NOT NULL DEFAULT +CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1(f1) values(1); +select @a:=f2 from t1; +@a:=f2 +# +update t1 set f1=1; +select @b:=f2 from t1; +@b:=f2 +# +select if(@a=@b,"ok","wrong"); +if(@a=@b,"ok","wrong") +ok +insert into t1(f1) values (1) on duplicate key update f1="1"; +select @b:=f2 from t1; +@b:=f2 +# +select if(@a=@b,"ok","wrong"); +if(@a=@b,"ok","wrong") +ok +insert into t1(f1) select f1 from t1 on duplicate key update f1="1"; +select @b:=f2 from t1; +@b:=f2 +# +select if(@a=@b,"ok","wrong"); +if(@a=@b,"ok","wrong") +ok +drop table t1; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +SET SESSION AUTOCOMMIT = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +set binlog_format=mixed; +connection con1; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) +ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,2); +# 1. test for locking: +BEGIN; +UPDATE t1 SET b = 12 WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 12 +connection con2; +UPDATE t1 SET b = 21 WHERE a = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +SELECT * FROM t1; +a b +1 12 +ROLLBACK; +connection con2; +ROLLBACK; +connection con1; +# 2. test for serialized update: +CREATE TABLE t2 (a INT); +TRUNCATE t1; +INSERT INTO t1 VALUES (1,'init'); +CREATE PROCEDURE p1() +BEGIN +# retry the UPDATE in case it times out the lock before con1 has time +# to COMMIT. +DECLARE do_retry INT DEFAULT 0; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1; +retry_loop:LOOP +UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; +IF do_retry = 0 THEN +LEAVE retry_loop; +END IF; +SET do_retry = 0; +END LOOP; +INSERT INTO t2 VALUES (); +END| +BEGIN; +UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 init+con1 +connection con2; +CALL p1;; +connection con1; +SELECT * FROM t1; +a b +1 init+con1 +COMMIT; +SELECT * FROM t1; +a b +1 init+con1 +connection con2; +SELECT * FROM t1; +a b +1 init+con1+con2 +COMMIT; +connection con1; +# 3. test for updated key column: +TRUNCATE t1; +TRUNCATE t2; +INSERT INTO t1 VALUES (1,'init'); +BEGIN; +UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +2 init+con1 +connection con2; +CALL p1;; +connection con1; +SELECT * FROM t1; +a b +2 init+con1 +COMMIT; +SELECT * FROM t1; +a b +2 init+con1 +connection con2; +SELECT * FROM t1; +a b +2 init+con1 +connection default; +disconnect con1; +disconnect con2; +DROP PROCEDURE p1; +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)) engine=innodb; +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c2 FOREIGN KEY f2 (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'f2': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'c2': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c1 FOREIGN KEY c2 (c) REFERENCES t1 (a) ON DELETE NO ACTION, +CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb; +ALTER TABLE t2 DROP FOREIGN KEY c2; +DROP TABLE t2; +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +FOREIGN KEY (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +FOREIGN KEY f1 (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb; +ERROR 42000: Incorrect foreign key definition for 'f1': Key reference and table reference don't match +CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d), +CONSTRAINT c1 FOREIGN KEY f1 (c) REFERENCES t1 (a) ON DELETE NO ACTION, +CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION, +FOREIGN KEY f3 (c) REFERENCES t1 (a) ON UPDATE NO ACTION, +FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c` int(11) NOT NULL, + `d` int(11) NOT NULL, + PRIMARY KEY (`c`,`d`), + CONSTRAINT `c1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON DELETE NO ACTION, + CONSTRAINT `c2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION, + CONSTRAINT `f3` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION, + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +DROP TABLE t1; +create table t1 (a int auto_increment primary key) engine=innodb; +set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for +alter table t1 order by a; +Warnings: +Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1' +drop table t1; +CREATE TABLE t1 +(vid integer NOT NULL, +tid integer NOT NULL, +idx integer NOT NULL, +name varchar(128) NOT NULL, +type varchar(128) NULL, +PRIMARY KEY(idx, vid, tid), +UNIQUE(vid, tid, name) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,1,1,'pk',NULL),(2,1,1,'pk',NULL),(3,1,1,'pk',NULL),(4,1,1,'c1',NULL), +(5,1,1,'pk',NULL),(1,1,2,'c1',NULL),(2,1,2,'c1',NULL),(3,1,2,'c1',NULL), +(4,1,2,'c2',NULL),(5,1,2,'c1',NULL),(2,1,3,'c2',NULL),(3,1,3,'c2',NULL), +(4,1,3,'pk',NULL),(5,1,3,'c2',NULL), +(2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL); +EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 12 NULL 16 Using where +SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; +vid tid idx name type +3 1 4 c_extra NULL +3 1 3 c2 NULL +3 1 2 c1 NULL +3 1 1 pk NULL +DROP TABLE t1; +# +# Bug #44290: explain crashes for subquery with distinct in +# SQL_SELECT::test_quick_select +# (reproduced only with InnoDB tables) +# +CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, KEY (c3), KEY (c2, c3)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +1 +1 +EXPLAIN +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ref c3,c2 c3 5 const 2 Using where +DROP TABLE t1; +CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +1 +1 +EXPLAIN +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ref c3,c2 c3 9 const 2 Using where +DROP TABLE t1; +CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2), +KEY (c3), KEY (c2, c3)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +1 +1 +EXPLAIN +SELECT 1 FROM (SELECT COUNT(DISTINCT c1) +FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ref c3,c2 c3 7 const 2 Using where +DROP TABLE t1; +End of 5.1 tests +# +# Bug#43600: Incorrect type conversion caused wrong result. +# +CREATE TABLE t1 ( +a int NOT NULL +) engine= innodb; +CREATE TABLE t2 ( +a int NOT NULL, +b int NOT NULL, +filler char(100) DEFAULT NULL, +KEY a (a,b) +) engine= innodb; +insert into t1 values (0),(1),(2),(3),(4); +insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B; +explain select * from t1, t2 where t2.a=t1.a and t2.b + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 ref a a 4 test.t1.a 1 Using index condition +select * from t1, t2 where t2.a=t1.a and t2.b + 1; +a a b filler +0 0 1 filler +1 1 1 filler +2 2 1 filler +3 3 1 filler +4 4 1 filler +drop table t1,t2; +# End of test case for the bug#43600 +# +# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE +# +# Check that a TRUNCATE TABLE statement, needing an exclusive meta +# data lock, waits for a shared metadata lock owned by a concurrent +# transaction. +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3); +BEGIN; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +connect con1, localhost, root,,; +TRUNCATE TABLE t1;; +connection default; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +ROLLBACK; +connection con1; +# Reaping TRUNCATE TABLE +SELECT * FROM t1; +a +disconnect con1; +connection default; +DROP TABLE t1; +drop table if exists t1, t2, t3; +# +# BUG#35850: Performance regression in 5.1.23/5.1.24 +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, pk int, key(a,b), primary key(pk)) engine=innodb; +insert into t2 select @a:=A.a+10*(B.a + 10*C.a),@a, @a from t1 A, t1 B, t1 C; +# this must use key 'a', not PRIMARY: +explain select a from t2 where a=b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL a 10 NULL # Using where; Using index +drop table t1, t2; +# +# Bug #40360: Binlog related errors with binlog off +# +SET SESSION BINLOG_FORMAT=STATEMENT; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation; +@@session.sql_log_bin 1 +@@session.binlog_format STATEMENT +@@session.tx_isolation READ-COMMITTED +CREATE TABLE t1 ( a INT ) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +DROP TABLE t1; +# +# Bug#37284 Crash in Field_string::type() +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a char(50)) ENGINE=InnoDB; +CREATE INDEX i1 on t1 (a(3)); +SELECT * FROM t1 WHERE a = 'abcde'; +a +DROP TABLE t1; +# +# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of +# requested column +# +CREATE TABLE foo (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=innodb; +CREATE TABLE foo2 (a int, b int, c char(10), +PRIMARY KEY (c), +KEY b (b) +) engine=innodb; +CREATE TABLE bar (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=myisam; +INSERT INTO foo VALUES +(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), +(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); +INSERT INTO bar SELECT * FROM foo; +INSERT INTO foo2 SELECT * FROM foo; +ANALYZE TABLE bar; +ANALYZE TABLE foo; +ANALYZE TABLE foo2; +EXPLAIN SELECT c FROM bar WHERE b>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE b>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE b>2;; +id 1 +select_type SIMPLE +table foo2 +type range +possible_keys b +key b +key_len 5 +ref NULL +rows 5 +Extra Using where; Using index +EXPLAIN SELECT c FROM bar WHERE c>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE c>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE c>2;; +id 1 +select_type SIMPLE +table foo2 +type index +possible_keys PRIMARY +key b +key_len 5 +ref NULL +rows 6 +Extra Using where; Using index +DROP TABLE foo, bar, foo2; +# +# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table +# +DROP TABLE IF EXISTS t1,t3,t2; +DROP FUNCTION IF EXISTS f1; +CREATE FUNCTION f1() RETURNS VARCHAR(250) +BEGIN +return 'hhhhhhh' ; +END| +CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; +BEGIN WORK; +CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; +CREATE TEMPORARY TABLE t3 LIKE t2; +INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); +SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); +PREPARE stmt1 FROM @stmt; +SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); +PREPARE stmt3 FROM @stmt; +EXECUTE stmt1; +COMMIT; +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt3; +DROP TABLE t1,t3,t2; +DROP FUNCTION f1; +# +# Bug#37016: TRUNCATE TABLE removes some rows but not all +# +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, +t1_id INT, INDEX par_ind (t1_id), +FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (3,2); +SET AUTOCOMMIT = 0; +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `test`.`t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +COMMIT; +SELECT * FROM t1; +id +1 +2 +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `test`.`t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +ROLLBACK; +SELECT * FROM t1; +id +1 +2 +SET AUTOCOMMIT = 1; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +COMMIT; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `test`.`t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +DELETE FROM t2 WHERE id = 3; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `test`.`t1` (`id`)) +ROLLBACK; +SELECT * FROM t1; +id +1 +2 +TRUNCATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; +# +# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 +# +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +aid INT UNSIGNED NOT NULL, +PRIMARY KEY (id), +FOREIGN KEY (aid) REFERENCES t1 (id) +) ENGINE=InnoDB; +CREATE TABLE t3 ( +bid INT UNSIGNED NOT NULL, +FOREIGN KEY (bid) REFERENCES t2 (id) +) ENGINE=InnoDB; +CREATE TABLE t4 ( +a INT +) ENGINE=InnoDB; +CREATE TABLE t5 ( +a INT +) ENGINE=InnoDB; +INSERT INTO t1 (id) VALUES (1); +INSERT INTO t2 (id, aid) VALUES (1, 1),(2,1),(3,1),(4,1); +INSERT INTO t3 (bid) VALUES (1); +INSERT INTO t4 VALUES (1),(2),(3),(4),(5); +INSERT INTO t5 VALUES (1); +DELETE t5 FROM t4 LEFT JOIN t5 ON t4.a= t5.a; +DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`)) +DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`)) +DELETE IGNORE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; +DROP TABLES t4,t5; +# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 +# Testing for any side effects of IGNORE on AFTER DELETE triggers used with +# transactional tables. +# +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a VARCHAR(100)) ENGINE=InnoDB; +CREATE TABLE t3 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t4 (i INT NOT NULL PRIMARY KEY, t1i INT, +FOREIGN KEY (t1i) REFERENCES t1(i)) +ENGINE=InnoDB; +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN +SET @b:='EXECUTED TRIGGER'; +INSERT INTO t2 VALUES (@b); +SET @a:= error_happens_here; +END|| +SET @b:=""; +SET @a:=""; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 SELECT * FROM t1; +** An error in a trigger causes rollback of the statement. +DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +ERROR 42S22: Unknown column 'error_happens_here' in 'field list' +SELECT @a,@b; +@a @b + EXECUTED TRIGGER +SELECT * FROM t2; +a +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +1 1 +2 2 +3 3 +4 4 +** Same happens with the IGNORE option +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +ERROR 42S22: Unknown column 'error_happens_here' in 'field list' +SELECT * FROM t2; +a +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +1 1 +2 2 +3 3 +4 4 +** +** The following is an attempt to demonstrate +** error handling inside a row iteration. +** +DROP TRIGGER trg; +DELETE FROM t1; +DELETE FROM t2; +DELETE FROM t3; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 VALUES (1),(2),(3),(4); +INSERT INTO t4 VALUES (3,3),(4,4); +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN +SET @b:= CONCAT('EXECUTED TRIGGER FOR ROW ',CAST(OLD.i AS CHAR)); +INSERT INTO t2 VALUES (@b); +END|| +** DELETE is prevented by foreign key constrains but errors are silenced. +** The AFTER trigger isn't fired. +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +** Tables are modified by best effort: +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +3 3 +4 4 +** The AFTER trigger was only executed on successful rows: +SELECT * FROM t2; +a +EXECUTED TRIGGER FOR ROW 1 +EXECUTED TRIGGER FOR ROW 2 +DROP TRIGGER trg; +** +** Induce an error midway through an AFTER-trigger +** +DELETE FROM t4; +DELETE FROM t1; +DELETE FROM t3; +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t3 VALUES (1),(2),(3),(4); +CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW +BEGIN +SET @a:= @a+1; +IF @a > 2 THEN +INSERT INTO t4 VALUES (5,5); +END IF; +END|| +SET @a:=0; +** Errors in the trigger causes the statement to abort. +DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`t1i`) REFERENCES `t1` (`i`)) +SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; +i i +1 1 +2 2 +3 3 +4 4 +SELECT * FROM t4; +i t1i +DROP TRIGGER trg; +DROP TABLE t4; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +# +# Bug#43580: Issue with Innodb on multi-table update +# +CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE = INNODB; +CREATE TABLE t2 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; +CREATE TABLE t3 (a INT, b INT KEY, KEY (a)) ENGINE = INNODB; +CREATE TABLE t4 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6); +INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106); +INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +UPDATE t2 straight_join t1 SET t1.a = t1.a + 100, t2.b = t1.a + 10 +WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b; +SELECT * FROM t2; +a b +1 1 +2 12 +3 13 +4 14 +5 5 +UPDATE t4 straight_join t3 SET t3.a = t3.a + 100, t4.b = t3.a + 10 +WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100; +SELECT * FROM t4; +a b +1 1 +2 12 +3 13 +4 14 +5 5 +DROP TABLE t1, t2, t3, t4; +# +# Bug#44886: SIGSEGV in test_if_skip_sort_order() - +# uninitialized variable used as subscript +# +CREATE TABLE t1 (a INT, b INT, c INT, d INT, PRIMARY KEY (b), KEY (a,c)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1,0); +CREATE TABLE t2 (a INT, b INT, e INT, KEY (e)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,1,2); +CREATE TABLE t3 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1, 1); +SELECT * FROM t1, t2, t3 +WHERE t1.a = t3.a AND (t1.b = t3.b OR t1.d) AND t2.b = t1.b AND t2.e = 2 +GROUP BY t1.b; +a b c d a b e a b +1 1 1 0 1 1 2 1 1 +DROP TABLE t1, t2, t3; +# +# Bug #45828: Optimizer won't use partial primary key if another +# index can prevent filesort +# +CREATE TABLE `t1` ( +c1 int NOT NULL, +c2 int NOT NULL, +c3 int NOT NULL, +PRIMARY KEY (c1,c2), +KEY (c3) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (5,2,1246276747); +INSERT INTO t1 VALUES (2,1,1246281721); +INSERT INTO t1 VALUES (7,3,1246281756); +INSERT INTO t1 VALUES (4,2,1246282139); +INSERT INTO t1 VALUES (3,1,1246282230); +INSERT INTO t1 VALUES (1,0,1246282712); +INSERT INTO t1 VALUES (8,3,1246282765); +INSERT INTO t1 SELECT c1+10,c2+10,c3+10 FROM t1; +INSERT INTO t1 SELECT c1+100,c2+100,c3+100 from t1; +INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1; +INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1; +INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1; +INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +c1 c2 c3 +EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref PRIMARY,c3 PRIMARY 4 const 1 Using where; Using filesort +EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 1 Using where; Using filesort +CREATE TABLE t2 ( +c1 int NOT NULL, +c2 int NOT NULL, +c3 int NOT NULL, +KEY (c1,c2), +KEY (c3) +) ENGINE=InnoDB; +explain SELECT * FROM t2 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c1,c3 c1 4 const 1 Using where; Using filesort +DROP TABLE t1,t2; +# +# 36259: Optimizing with ORDER BY +# +CREATE TABLE t1 ( +a INT NOT NULL AUTO_INCREMENT, +b INT NOT NULL, +c INT NOT NULL, +d VARCHAR(5), +e INT NOT NULL, +PRIMARY KEY (a), KEY i2 (b,c,d) +) ENGINE=InnoDB; +INSERT INTO t1 (b,c,d,e) VALUES (1,1,'a',1), (2,2,'b',2); +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; +ANALYZE TABLE t1; +EXPLAIN SELECT * FROM t1 WHERE b=1 AND c=1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort +EXPLAIN SELECT * FROM t1 FORCE INDEX(i2) WHERE b=1 and c=1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort +EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL {checked} Using where +DROP TABLE t1; +# +# Bug #47963: Wrong results when index is used +# +CREATE TABLE t1( +a VARCHAR(5) NOT NULL, +b VARCHAR(5) NOT NULL, +c DATETIME NOT NULL, +KEY (c) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00'); +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001'; +a b c +TEST TEST 2009-10-09 00:00:00 +SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; +a b c +EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND +c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; +# +# Bug #46175: NULL read_view and consistent read assertion +# +CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb; +CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb; +INSERT INTO t1 VALUES (),(); +INSERT INTO t2 VALUES (),(); +CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2 +WHERE b =(SELECT a FROM t1 LIMIT 1); +CONNECT con1, localhost, root,,; +connection default; +CREATE PROCEDURE p1(num INT) +BEGIN +DECLARE i INT DEFAULT 0; +REPEAT +SHOW CREATE VIEW v1; +SET i:=i+1; +UNTIL i>num END REPEAT; +END| +# Should not crash +# Should not crash +disconnect con1; +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1,t2; +# +# Bug #49324: more valgrind errors in test_if_skip_sort_order +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ; +# should not cause valgrind warnings +SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a; +1 +DROP TABLE t1; +# +# Bug#50843: Filesort used instead of clustered index led to +# performance degradation. +# +create table t1(f1 int not null primary key, f2 int) engine=innodb; +create table t2(f1 int not null, key (f1)) engine=innodb; +insert into t1 values (1,1),(2,2),(3,3); +insert into t2 values (1),(2),(3); +analyze table t1; +analyze table t2; +explain select t1.* from t1 left join t2 using(f1) group by t1.f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 +1 SIMPLE t2 ref f1 f1 4 test.t1.f1 1 Using index +drop table t1,t2; +# +# +# Bug #39653: find_shortest_key in sql_select.cc does not consider +# clustered primary keys +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT, +KEY (b,c)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3), +(4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6), +(7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9), +(11,11,11,11,11,11); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 10 +ref NULL +rows 10 +Extra Using index +DROP TABLE t1; +# +# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may +# corrupt definition at engine +# +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b)) +ENGINE=InnoDB; +ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); +SHOW INDEXES FROM t1;; +Table t1 +Non_unique 0 +Key_name k +Seq_in_index 1 +Column_name a +Collation A +Cardinality 0 +Sub_part NULL +Packed NULL +Null +Index_type BTREE +Comment +Index_comment +Ignored NO +Table t1 +Non_unique 0 +Key_name k +Seq_in_index 2 +Column_name b +Collation A +Cardinality 0 +Sub_part NULL +Packed NULL +Null +Index_type BTREE +Comment +Index_comment +Ignored NO +DROP TABLE t1; +# +# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when +# JOINed during an UPDATE +# +CREATE TABLE t1 (d INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT, b INT, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB; +# set up our data elements +INSERT INTO t1 (d) VALUES (1); +INSERT INTO t2 (a,b) VALUES (1,1); +SELECT SECOND(c) INTO @bug47453 FROM t2; +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +SECOND(c)-@bug47453 +0 +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +SECOND(c)-@bug47453 +0 +SELECT SLEEP(1); +SLEEP(1) +0 +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; +# should be 0 +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +SECOND(c)-@bug47453 +0 +DROP TABLE t1, t2; +# +# Bug #53334: wrong result for outer join with impossible ON condition +# (see the same test case for MyISAM in join.test) +# +CREATE TABLE t1 (id INT PRIMARY KEY); +CREATE TABLE t2 (id INT); +INSERT INTO t1 VALUES (75); +INSERT INTO t1 VALUES (79); +INSERT INTO t1 VALUES (78); +INSERT INTO t1 VALUES (77); +REPLACE INTO t1 VALUES (76); +REPLACE INTO t1 VALUES (76); +INSERT INTO t1 VALUES (104); +INSERT INTO t1 VALUES (103); +INSERT INTO t1 VALUES (102); +INSERT INTO t1 VALUES (101); +INSERT INTO t1 VALUES (105); +INSERT INTO t1 VALUES (106); +INSERT INTO t1 VALUES (107); +INSERT INTO t2 VALUES (107),(75),(1000); +SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0 +WHERE t2.id=75 AND t1.id IS NULL; +id id +NULL 75 +EXPLAIN SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0 +WHERE t2.id=75 AND t1.id IS NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +DROP TABLE t1,t2; +# +# Bug#38999 valgrind warnings for update statement in function compare_record() +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 values (1),(2),(3),(4),(5); +INSERT INTO t2 values (1); +SELECT * FROM t1 WHERE a = 2; +a +2 +UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1; +DROP TABLE t1,t2; +# +# Bug #53830: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index)) +# +CREATE TABLE t1 (a INT, b INT, c INT, d INT, +PRIMARY KEY(a,b,c), KEY(b,d)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES (0, 77, 1, 3); +UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25; +DROP TABLE t1; +# +# Bug#50389 Using intersect does not return all rows +# +CREATE TABLE t1 ( +f1 INT(10) NOT NULL, +f2 INT(10), +f3 INT(10), +f4 TINYINT(4), +f5 VARCHAR(50), +PRIMARY KEY (f1), +KEY idx1 (f2,f5,f4), +KEY idx2 (f2,f4) +) ENGINE=InnoDB; +LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1; +ANALYZE TABLE t1; +set @tmp_innodb_mysql= @@optimizer_switch; +set optimizer_switch='extended_keys=off'; +SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, +3470988,3305175,3329875,3817277,3856380,3796193, +3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; +f1 f2 f3 f4 f5 +3305175 1221457 0 0 abcdefghijklmnopwrst +3329875 1221457 1382427 0 abcdefghijklmnopwrst +3336022 1221457 0 0 abcdefghijklmnopwrst +3346860 1221457 0 0 abcdefghijklmnopwrst +3772880 1221457 0 0 abcdefghijklmnopwrst +3784744 1221457 1382427 0 abcdefghijklmnopwrst +3796193 1221457 0 0 abcdefghijklmnopwrst +4228206 1221457 0 0 abcdefghijklmnopwrst +4494153 1221457 0 0 abcdefghijklmnopwrst +4559596 1221457 0 0 abcdefghijklmnopwrst +EXPLAIN SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, +3470988,3305175,3329875,3817277,3856380,3796193, +3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where +set optimizer_switch=@tmp_innodb_mysql; +DROP TABLE t1; +# +# Bug#51431 Wrong sort order after import of dump file +# +CREATE TABLE t1 ( +f1 INT(11) NOT NULL, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +f4 tinyint(1) NOT NULL, +PRIMARY KEY (f1), +UNIQUE KEY (f2, f3), +KEY (f4) +) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 VALUES +(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1), +(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1), +(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1), +(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1), +(26,1,9921,1), (27,1,9922,1); +FLUSH TABLES; +SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +f1 f2 f3 f4 +27 1 9922 1 +26 1 9921 1 +25 1 9920 1 +24 1 9919 1 +23 1 9918 1 +EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range f2,f4 f4 1 NULL 22 Using where +DROP TABLE t1; +# +# Bug#54117 crash in thr_multi_unlock, temporary table +# +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB; +LOCK TABLES t1 READ; +ALTER TABLE t1 COMMENT 'test'; +UNLOCK TABLES; +DROP TABLE t1; +# +# Bug#55656: mysqldump can be slower after bug #39653 fix +# +CREATE TABLE t1 (a INT , b INT, c INT, d INT, +KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB STATS_PERSISTENT=0; +INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 4 +ref NULL +rows 3 +Extra Using index +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 8 +ref NULL +rows 3 +Extra Using index +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b,c); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key PRIMARY +key_len 8 +ref NULL +rows 3 +Extra Using index +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b,c,d); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key PRIMARY +key_len 8 +ref NULL +rows 3 +Extra Using index +DROP TABLE t1; +# +# Bug#55826: create table .. select crashes with when KILL_BAD_DATA +# is returned +# +CREATE TABLE t1(a INT) ENGINE=innodb; +INSERT INTO t1 VALUES (0); +SET SQL_MODE='STRICT_ALL_TABLES'; +CREATE TABLE t2 +SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`; +ERROR 22007: Truncated incorrect datetime value: '' +DROP TABLE t1; +SET SQL_MODE=DEFAULT; +# +# Bug#56862 Execution of a query that uses index merge returns a wrong result +# +CREATE TABLE t1 ( +pk int NOT NULL AUTO_INCREMENT PRIMARY KEY, +a int, +b int, +INDEX idx(a)) +ENGINE=INNODB; +INSERT INTO t1(a,b) VALUES +(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500), +(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800), +(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700), +(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000); +INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1; +INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1; +INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1(a,b) SELECT a,b FROM t1; +INSERT INTO t1 VALUES (1000000, 0, 0); +set @optimizer_switch_saved=@@optimizer_switch; +SET SESSION optimizer_switch='derived_merge=off'; +SET SESSION sort_buffer_size = 1024*36; +EXPLAIN +SELECT COUNT(*) FROM +(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) +WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL # +2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL # Using sort_union(idx,PRIMARY); Using where +SELECT COUNT(*) FROM +(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY) +WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; +COUNT(*) +1537 +set @@optimizer_switch=@optimizer_switch_saved; +SET SESSION sort_buffer_size = DEFAULT; +DROP TABLE t1; +# +# Test for bug #39932 "create table fails if column for FK is in different +# case than in corr index". +# +drop tables if exists t1, t2; +create table t1 (pk int primary key) engine=InnoDB; +create table t2 (fk int, key x (fk), +constraint x foreign key (FK) references t1 (PK)) engine=InnoDB; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `fk` int(11) DEFAULT NULL, + KEY `x` (`fk`), + CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2, t1; +# +# Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE:: +# UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK". +# +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1); +LOCK TABLES t1 READ; +# Even though temporary table was locked for READ we +# still allow writes to it to be compatible with MyISAM. +# This is possible since due to fact that temporary tables +# are specific to connection and therefore locking for them +# is irrelevant. +UPDATE t1 SET c = 5; +UNLOCK TABLES; +DROP TEMPORARY TABLE t1; +# End of 5.1 tests +# +# Bug#49604 "6.0 processing compound WHERE clause incorrectly +# with Innodb - extra rows" +# +CREATE TABLE t1 ( +c1 INT NOT NULL, +c2 INT, +PRIMARY KEY (c1), +KEY k1 (c2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (12,1); +INSERT INTO t1 VALUES (15,1); +INSERT INTO t1 VALUES (16,1); +INSERT INTO t1 VALUES (22,1); +INSERT INTO t1 VALUES (20,2); +CREATE TABLE t2 ( +c1 INT NOT NULL, +c2 INT, +PRIMARY KEY (c1) +) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,2); +INSERT INTO t2 VALUES (2,9); +SELECT STRAIGHT_JOIN t2.c2, t1.c2, t2.c1 +FROM t1 JOIN t2 ON t1.c2 = t2.c1 +WHERE t2.c1 IN (2, 1, 6) OR t2.c1 NOT IN (1); +c2 c2 c1 +2 1 1 +2 1 1 +2 1 1 +2 1 1 +9 2 2 +DROP TABLE t1, t2; +# +# Bug#44613 SELECT statement inside FUNCTION takes a shared lock +# +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +CREATE TABLE t1(x INT PRIMARY KEY, y INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 0), (2, 0); +CREATE FUNCTION f1(z INT) RETURNS INT READS SQL DATA +RETURN (SELECT x FROM t1 WHERE x = z); +START TRANSACTION; +SELECT f1(1); +f1(1) +1 +START TRANSACTION; +SELECT f1(1); +f1(1) +1 +UPDATE t1 SET y = 1 WHERE x = 1; +COMMIT; +disconnect con2; +connection default; +COMMIT; +DROP TABLE t1; +DROP FUNCTION f1; +# +# Bug#42744: Crash when using a join buffer to join a table with a blob +# column and an additional column used for duplicate elimination. +# +CREATE TABLE t1 (a tinyblob) ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY, b tinyblob) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('1'), (NULL); +INSERT INTO t2 VALUES (1, '1'); +EXPLAIN +SELECT t2.b FROM t1,t2 WHERE t1.a IN (SELECT 1 FROM t2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 1 +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t2 index NULL PRIMARY 4 NULL 1 Using index; FirstMatch(t1); Using join buffer (incremental, BNL join) +SELECT t2.b FROM t1,t2 WHERE t1.a IN (SELECT 1 FROM t2); +b +1 +DROP TABLE t1,t2; +# +# Bug#48093: 6.0 Server not processing equivalent IN clauses properly +# with Innodb tables +# +CREATE TABLE t1 ( +i int(11) DEFAULT NULL, +v1 varchar(1) DEFAULT NULL, +v2 varchar(20) DEFAULT NULL, +KEY i (i), +KEY v (v1,i) +) ENGINE=innodb; +INSERT INTO t1 VALUES (1,'f','no'); +INSERT INTO t1 VALUES (2,'u','yes-u'); +INSERT INTO t1 VALUES (2,'h','yes-h'); +INSERT INTO t1 VALUES (3,'d','no'); + +SELECT v2 +FROM t1 +WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2; +v2 +yes-u +yes-h + +# Should not use index_merge +EXPLAIN +SELECT v2 +FROM t1 +WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref i,v i 5 const 2 Using where +DROP TABLE t1; +# +# Bug#54606 innodb fast alter table + pack_keys=0 +# prevents adding new indexes +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT, b CHAR(9), c INT, key(b)) +ENGINE=InnoDB +PACK_KEYS=0; +CREATE INDEX a ON t1 (a); +CREATE INDEX c on t1 (c); +DROP TABLE t1; +# +# Additional coverage for refactoring which is made as part +# of fix for Bug#27480 "Extend CREATE TEMPORARY TABLES privilege +# to allow temp table operations". +# +# Check that OPTIMIZE table works for temporary InnoDB tables. +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=InnoDB; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +DROP TABLE t1; +# +# Bug#11762345 54927: DROPPING AND ADDING AN INDEX IN ONE +# COMMAND CAN FAIL IN INNODB PLUGIN 1.0 +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id int, a int, b int, PRIMARY KEY (id), +INDEX a (a)) ENGINE=innodb; +ALTER TABLE t1 DROP INDEX a, ADD INDEX a (b, a); +ALTER TABLE t1 DROP INDEX a, ADD INDEX (a, b); +DROP TABLE t1; +End of 6.0 tests diff --git a/mysql-test/suite/innodb/r/innodb_mysql_rbk.result b/mysql-test/suite/innodb/r/innodb_mysql_rbk.result new file mode 100644 index 00000000..64f508a5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_mysql_rbk.result @@ -0,0 +1,30 @@ +CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb +DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +CONNECT con1,localhost,root,,; +CONNECT con2,localhost,root,,; +connection con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +connection con2; +START TRANSACTION; +UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ROLLBACK; +connection con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +connection con2; +START TRANSACTION; +UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE b = 10; +a b +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_notembedded.result b/mysql-test/suite/innodb/r/innodb_notembedded.result new file mode 100644 index 00000000..b8ff28a1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_notembedded.result @@ -0,0 +1,34 @@ +drop table if exists t1; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; +connect a,localhost,root,,; +connect b,localhost,root,,; +SET GLOBAL log_bin_trust_function_creators = 1; +create table t1 (col1 integer primary key, col2 integer) engine=innodb; +insert t1 values (1,100); +create function f1 () returns integer begin +declare var1 int; +select col2 into var1 from t1 where col1=1 for update; +return var1; +end| +start transaction; +select f1(); +f1() +100 +connection b; +update t1 set col2=0 where col1=1; +connection default; +select * from t1; +col1 col2 +1 100 +connection a; +rollback; +connection b; +rollback; +connection a; +disconnect a; +connection b; +disconnect b; +connection default; +drop table t1; +drop function f1; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; diff --git a/mysql-test/suite/innodb/r/innodb_page_compressed.result b/mysql-test/suite/innodb/r/innodb_page_compressed.result new file mode 100644 index 00000000..a494ff03 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_page_compressed.result @@ -0,0 +1,53 @@ +SET @save_algorithm = @@GLOBAL.innodb_compression_algorithm; +create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +connect prevent_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +begin; +insert into innodb_normal SET b=REPEAT('Aa',50); +insert into innodb_page_compressed1 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed2 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed3 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed4 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed5 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed6 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed7 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed8 SET b=REPEAT('Aa',50); +insert into innodb_page_compressed9 SET b=REPEAT('Aa',50); +commit; +FLUSH TABLES innodb_normal, +innodb_page_compressed1, innodb_page_compressed2, innodb_page_compressed3, +innodb_page_compressed4, innodb_page_compressed5, innodb_page_compressed6, +innodb_page_compressed7, innodb_page_compressed8, innodb_page_compressed9 +FOR EXPORT; +FOUND 12 /AaAaAaAa/ in innodb_normal.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd +NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd +UNLOCK TABLES; +drop table innodb_normal; +drop table innodb_page_compressed1; +drop table innodb_page_compressed2; +drop table innodb_page_compressed3; +drop table innodb_page_compressed4; +drop table innodb_page_compressed5; +drop table innodb_page_compressed6; +drop table innodb_page_compressed7; +drop table innodb_page_compressed8; +drop table innodb_page_compressed9; +SET GLOBAL innodb_compression_algorithm=@save_algorithm; diff --git a/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result b/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result new file mode 100644 index 00000000..1e97c21c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result @@ -0,0 +1,92 @@ +CREATE TABLE worklog5743 ( +col_1_text TEXT(4000) , col_2_text TEXT(4000) , +PRIMARY KEY (col_1_text(3072)) +) ROW_FORMAT=DYNAMIC, engine = innodb; +INSERT INTO worklog5743 VALUES(REPEAT("a", 3500) , REPEAT("o", 3500)); +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +connect con1,localhost,root,,; +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +SELECT COUNT(*) FROM worklog5743; +COUNT(*) +1 +connect con2,localhost,root,,; +START TRANSACTION; +INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500)); +connection con1; +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +SELECT COUNT(*) FROM worklog5743; +COUNT(*) +1 +START TRANSACTION; +connection default; +SET GLOBAL innodb_fast_shutdown=3; +# restart +SELECT COUNT(*) FROM worklog5743; +COUNT(*) +1 +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +disconnect con1; +disconnect con2; +connect con1,localhost,root,,; +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +SELECT COUNT(*) FROM worklog5743; +COUNT(*) +1 +START TRANSACTION; +INSERT INTO worklog5743 VALUES(REPEAT("b", 3500) , REPEAT("o", 3500)); +DELETE FROM worklog5743 WHERE col_1_text = REPEAT("b", 3500); +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +connection default; +SET GLOBAL innodb_fast_shutdown=3; +# restart +SELECT COUNT(*) FROM worklog5743; +COUNT(*) +1 +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +disconnect con1; +connect con2,localhost,root,,; +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +SELECT COUNT(*) FROM worklog5743; +COUNT(*) +1 +START TRANSACTION; +UPDATE worklog5743 SET col_1_text = REPEAT("b", 3500) WHERE col_1_text = REPEAT("a", 3500); +SELECT col_1_text = REPEAT("b", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("b", 3500) col_2_text = REPEAT("o", 3500) +1 1 +connection default; +SET GLOBAL innodb_fast_shutdown=3; +# restart +SELECT COUNT(*) FROM worklog5743; +COUNT(*) +1 +SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM +worklog5743; +col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500) +1 1 +DROP TABLE worklog5743; diff --git a/mysql-test/suite/innodb/r/innodb_query_cache.result b/mysql-test/suite/innodb/r/innodb_query_cache.result new file mode 100644 index 00000000..bbacbdfd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_query_cache.result @@ -0,0 +1,39 @@ +# +# MDEV-16087 Inconsistent SELECT results when query cache is enabled +# +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; +create table t1 (id bigint(20) auto_increment, primary key (id)) ENGINE=InnoDB; +create table t2 (id bigint(20) auto_increment, primary key (id)) ENGINE=InnoDB; +create table t3 (id bigint(20) auto_increment, primary key (id)) ENGINE=InnoDB; +connect con1,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +select * from t2; +id +connection default; +insert into t3 () values (); +connection con1; +insert into t1 () values (); +select * from t3; +id +connect con2,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +select * from t3; +id +1 +select * from t3; +id +1 +select sql_no_cache * from t3; +id +1 +rollback; +connection con1; +rollback; +disconnect con1; +disconnect con2; +connection default; +drop table t1; +drop table t2; +drop table t3; +set GLOBAL query_cache_type=default; diff --git a/mysql-test/suite/innodb/r/innodb_rename_index.result b/mysql-test/suite/innodb/r/innodb_rename_index.result new file mode 100644 index 00000000..43cf8fc5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_rename_index.result @@ -0,0 +1,989 @@ +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +ALTER TABLE t RENAME INDEX i1 TO GEN_CLUST_INDEX; +ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX' +ALTER TABLE t RENAME INDEX i1 TO i1; +ALTER TABLE t RENAME INDEX aa TO aa; +ERROR 42000: Key 'aa' doesn't exist in table 't' +# combination: aaaa +ALTER TABLE t ADD INDEX i4(f), DROP INDEX i4, RENAME INDEX i4 TO i4; +ERROR 42000: Key 'i4' doesn't exist in table 't' +# combination: aabb +ALTER TABLE t ADD INDEX aa(f), DROP INDEX aa, RENAME INDEX i2 TO i2; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX aa, RENAME INDEX bb TO bb; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX bb TO bb; +ERROR 42000: Key 'bb' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i2 TO i2; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i2` (`c`), + KEY `i3` (`d`), + KEY `i4` (`e`), + KEY `i1` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i1 f +test/t i2 c +test/t i3 d +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +# combination: abcc +ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX cc TO cc; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX i3 TO i3; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX cc TO cc; +ERROR 42000: Key 'cc' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i3 TO i3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i1` (`b`), + KEY `i3` (`d`), + KEY `i4` (`e`), + KEY `aa` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t aa f +test/t i1 b +test/t i3 d +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +# combination: abaa +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i1, RENAME INDEX aa TO aa; +ERROR 42000: Key 'aa' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i1 TO i1; +ERROR 42000: Duplicate key name 'i1' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX bb, RENAME INDEX i1 TO i1; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX aa TO aa; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +# combination: baaa +ALTER TABLE t ADD INDEX i2(f), DROP INDEX i1, RENAME INDEX i1 TO i1; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t ADD INDEX bb(f), DROP INDEX i1, RENAME INDEX i1 TO i1; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i2(f), DROP INDEX aa, RENAME INDEX aa TO aa; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX bb(f), DROP INDEX aa, RENAME INDEX aa TO aa; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX aa(f), RENAME INDEX aa TO bb; +ERROR 42000: Key 'aa' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), RENAME INDEX bb TO aa; +ERROR 42000: Key 'bb' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), RENAME INDEX i2 TO aa; +ERROR 42000: Duplicate key name 'aa' +ALTER TABLE t ADD INDEX i1(f), RENAME INDEX i1 TO bb; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `bb` (`b`), + KEY `i2` (`c`), + KEY `i3` (`d`), + KEY `i4` (`e`), + KEY `i1` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t bb b +test/t i1 f +test/t i2 c +test/t i3 d +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +# combination: abba +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i2 TO i1; +ERROR 42000: Key 'i2' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i2 TO aa; +ERROR 42000: Key 'i2' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX bb, RENAME INDEX bb TO i1; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX bb TO aa; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +# combination: cabc +ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX i2 TO i3; +ERROR 42000: Duplicate key name 'i3' +ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX i2 TO i3; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX bb TO i3; +ERROR 42000: Key 'bb' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX bb TO i3; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX i2 TO cc; +ERROR 42000: Duplicate key name 'cc' +ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX i2 TO cc; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX bb TO cc; +ERROR 42000: Key 'bb' doesn't exist in table 't' +ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX bb TO cc; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t DROP INDEX i1, RENAME INDEX i1 TO bb; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t DROP INDEX aa, RENAME INDEX i2 TO aa; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t DROP INDEX aa, RENAME INDEX aa TO i2; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t DROP INDEX i1, RENAME INDEX i4 TO i1; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i2` (`c`), + KEY `i3` (`d`), + KEY `i1` (`e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i1 e +test/t i2 c +test/t i3 d +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +# combination: accb +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX i3 TO i2; +ERROR 42000: Key 'i3' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX i3 TO bb; +ERROR 42000: Key 'i3' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX cc TO i2; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX cc TO bb; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX cc TO i2; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX cc TO bb; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +# combination: aaab +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i1 TO i2; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i1 TO bb; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i1 TO i2; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX aa, RENAME INDEX aa TO bb; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +# combination: abcd +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX cc TO i4; +ERROR 42000: Key 'cc' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX cc TO dd; +ERROR 42000: Key 'cc' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX cc TO i4; +ERROR 42000: Key 'cc' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX cc TO dd; +ERROR 42000: Key 'cc' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i3 TO i4; +ERROR 42000: Duplicate key name 'i4' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i3 TO dd; +ERROR 42000: Duplicate key name 'i1' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i3 TO i4; +ERROR 42000: Duplicate key name 'i4' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i3 TO dd; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i1` (`b`), + KEY `dd` (`d`), + KEY `i4` (`e`), + KEY `aa` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t aa f +test/t dd d +test/t i1 b +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +# combination: abab +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i1 TO i2; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i2` (`b`), + KEY `i3` (`d`), + KEY `i4` (`e`), + KEY `i1` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i1 f +test/t i2 b +test/t i3 d +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +ALTER TABLE t ADD INDEX i1(f), DROP INDEX bb, RENAME INDEX i1 TO bb; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX aa TO i2; +ERROR 42000: Key 'aa' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX aa TO bb; +ERROR 42000: Can't DROP INDEX `bb`; check that it exists +# combination: acbc +ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX i2 TO cc; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX i2 TO cc; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX bb TO cc; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX bb TO cc; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX bb TO i3; +ERROR 42000: Key 'bb' doesn't exist in table 't' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i3, RENAME INDEX bb TO i3; +ERROR 42000: Key 'bb' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX i2 TO i3; +ERROR 42000: Duplicate key name 'i1' +ALTER TABLE t ADD INDEX aa(f), DROP INDEX i3, RENAME INDEX i2 TO i3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i1` (`b`), + KEY `i3` (`c`), + KEY `i4` (`e`), + KEY `aa` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t aa f +test/t i1 b +test/t i3 c +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +# combination: cacb +ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX cc TO i2; +ERROR 42000: Key 'cc' doesn't exist in table 't' +ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX cc TO i2; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX cc TO bb; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX cc TO bb; +ERROR 42000: Key 'cc' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX i3 TO i2; +ERROR 42000: Duplicate key name 'i2' +ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX i3 TO i2; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX i3 TO bb; +ERROR 42000: Can't DROP INDEX `aa`; check that it exists +ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX i3 TO bb; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i2` (`c`), + KEY `bb` (`d`), + KEY `i4` (`e`), + KEY `i3` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t bb d +test/t i2 c +test/t i3 f +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +# combination: ccab +ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX i1 TO i2; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX i1 TO bb; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX aa TO i2; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX aa TO bb; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX i3(f), DROP INDEX cc, RENAME INDEX aa TO i2; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX i3(f), DROP INDEX cc, RENAME INDEX aa TO bb; +ERROR 42000: Can't DROP INDEX `cc`; check that it exists +ALTER TABLE t ADD INDEX i3(f), DROP INDEX i3, RENAME INDEX i1 TO i2; +ERROR 42000: Duplicate key name 'i2' +ALTER TABLE t ADD INDEX i3(f), DROP INDEX i3, RENAME INDEX i1 TO bb; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `bb` (`b`), + KEY `i2` (`c`), + KEY `i4` (`e`), + KEY `i3` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t bb b +test/t i2 c +test/t i3 f +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +ALTER TABLE t RENAME INDEX i1 TO x; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `x` (`b`), + KEY `i2` (`c`), + KEY `i3` (`d`), + KEY `i4` (`e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i2 c +test/t i3 d +test/t i4 e +test/t PRIMARY a +test/t x b +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +ALTER TABLE t RENAME INDEX i1 TO i2; +ERROR 42000: Duplicate key name 'i2' +ALTER TABLE t RENAME INDEX foo TO i1; +ERROR 42000: Key 'foo' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i9 (f), RENAME INDEX i1 TO i8; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i8` (`b`), + KEY `i2` (`c`), + KEY `i3` (`d`), + KEY `i4` (`e`), + KEY `i9` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i2 c +test/t i3 d +test/t i4 e +test/t i8 b +test/t i9 f +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +ALTER TABLE t ADD INDEX i1 (f), RENAME INDEX i1 TO i9; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i9` (`b`), + KEY `i2` (`c`), + KEY `i3` (`d`), + KEY `i4` (`e`), + KEY `i1` (`f`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i1 f +test/t i2 c +test/t i3 d +test/t i4 e +test/t i9 b +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +a INT, +b INT, +c INT, +d INT, +e INT, +f INT, +PRIMARY KEY (a), +INDEX i1 (b), +INDEX i2 (c), +INDEX i3 (d), +INDEX i4 (e) +) ENGINE=INNODB; +INSERT INTO t SET a = 1; +ALTER TABLE t ADD INDEX foo (f), RENAME INDEX i1 TO foo; +ERROR 42000: Duplicate key name 'foo' +ALTER TABLE t ADD INDEX i1 (f), RENAME INDEX i1 TO foo, DROP INDEX i1; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t ADD INDEX i1 (f), RENAME INDEX i1 TO foo, DROP INDEX foo; +ERROR 42000: Can't DROP INDEX `foo`; check that it exists +ALTER TABLE t ADD INDEX foo (f), RENAME INDEX foo TO bar, DROP INDEX foo; +ERROR 42000: Can't DROP INDEX `foo`; check that it exists +ALTER TABLE t RENAME INDEX i1 TO x, RENAME INDEX i2 TO x; +ERROR 42000: Duplicate key name 'x' +ALTER TABLE t RENAME INDEX i1 TO x, RENAME INDEX i1 TO y; +ERROR 42000: Key 'i1' doesn't exist in table 't' +ALTER TABLE t RENAME INDEX i1 TO x, RENAME INDEX i1 TO x; +ERROR 42000: Key 'i1' doesn't exist in table 't' +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `f` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `i1` (`b`), + KEY `i2` (`c`), + KEY `i3` (`d`), + KEY `i4` (`e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i1 b +test/t i2 c +test/t i3 d +test/t i4 e +test/t PRIMARY a +DROP TABLE t; +CREATE TABLE t ( +c1 INT NOT NULL, +c2 INT NOT NULL, +c3 INT, +c4 INT, +PRIMARY KEY (c1), +INDEX i1 (c3), +INDEX i2 (c4) +) ENGINE=INNODB; +INSERT INTO t SET c1=1, c2=2; +ALTER TABLE t DROP PRIMARY KEY, ADD PRIMARY KEY (c2), RENAME INDEX i1 TO x; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + PRIMARY KEY (`c2`), + KEY `x` (`c3`), + KEY `i2` (`c4`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i2 c4 +test/t PRIMARY c2 +test/t x c3 +ALTER TABLE t RENAME INDEX i2 TO y, ROW_FORMAT=REDUNDANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + PRIMARY KEY (`c2`), + KEY `x` (`c3`), + KEY `y` (`c4`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t PRIMARY c2 +test/t x c3 +test/t y c4 +DROP TABLE t; +CREATE TABLE t ( +c1 INT NOT NULL, +c2 INT, +c3 INT, +INDEX i1 (c2), +INDEX i2 (c3) +) ENGINE=INNODB; +INSERT INTO t SET c1=1; +ALTER TABLE t ADD PRIMARY KEY (c1), RENAME INDEX i1 TO x; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `x` (`c2`), + KEY `i2` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +t.name AS table_name, +i.name AS index_name, +f.name AS column_name +FROM +information_schema.innodb_sys_tables t, +information_schema.innodb_sys_indexes i, +information_schema.innodb_sys_fields f +WHERE +t.name LIKE '%/t' AND +t.table_id = i.table_id AND +i.index_id = f.index_id +ORDER BY 1, 2, 3; +table_name index_name column_name +test/t i2 c3 +test/t PRIMARY c1 +test/t x c2 +DROP TABLE t; +CREATE TABLE t (a INT, INDEX iiiii (a)) ENGINE=INNODB; +INSERT INTO t SET a=NULL; +ALTER TABLE t RENAME INDEX iiiii TO i; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t RENAME INDEX i TO iiiii; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t RENAME INDEX iiiii TO i; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t RENAME INDEX i TO iiiii; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/innodb_row_lock_time_ms.result b/mysql-test/suite/innodb/r/innodb_row_lock_time_ms.result new file mode 100644 index 00000000..984d789e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_row_lock_time_ms.result @@ -0,0 +1,40 @@ +CREATE TABLE `t`(`id` INT, PRIMARY KEY(`id`)) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t VALUES (1); +SET GLOBAL innodb_monitor_reset = "module_innodb"; +BEGIN; +SELECT * FROM t FOR UPDATE; +id +1 +connect con1,localhost,root,,; +SET innodb_lock_wait_timeout = 1; +SELECT * FROM t FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +COMMIT; +SELECT variable_value > 100 FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_row_lock_time'; +variable_value > 100 +1 +SELECT variable_value > 100 FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; +variable_value > 100 +1 +SELECT variable_value > 100 FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; +variable_value > 100 +1 +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS +WHERE NAME="lock_row_lock_time"; +count_reset > 100 +1 +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS +WHERE NAME="lock_row_lock_time_max"; +count_reset > 100 +1 +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS +WHERE NAME="lock_row_lock_time_avg"; +count_reset > 100 +1 +DROP TABLE t; +SET GLOBAL innodb_monitor_reset=default; diff --git a/mysql-test/suite/innodb/r/innodb_scrub.result b/mysql-test/suite/innodb/r/innodb_scrub.result new file mode 100644 index 00000000..b4a418ce --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_scrub.result @@ -0,0 +1,27 @@ +CREATE TABLE t1(f1 int auto_increment primary key, +f2 varchar(256), +f3 text) engine = innodb; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +FOUND 500500 /unicycle|repairman/ in t1.ibd +DELETE FROM t1; +InnoDB 0 transactions not purged +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +NOT FOUND /unicycle|repairman/ in t1.ibd +DROP TABLE t1; +# +# MDEV-30527 Assertion !m_freed_pages in mtr_t::start() +# on DROP TEMPORARY TABLE +# +SET @scrub= @@GLOBAL.innodb_immediate_scrub_data_uncompressed; +SET GLOBAL innodb_immediate_scrub_data_uncompressed= 1; +SET @fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE t ENGINE=InnoDB AS SELECT 1; +DROP TABLE t; +SET GLOBAL innodb_file_per_table=@fpt; +CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT 1; +DROP TABLE tmp; +SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED= @scrub; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result new file mode 100644 index 00000000..832a4800 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -0,0 +1,337 @@ +select * from information_schema.innodb_trx; +trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks trx_last_foreign_key_error trx_is_read_only trx_autocommit_non_locking +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_trx but the InnoDB storage engine is not installed +select * from information_schema.innodb_locks; +lock_id lock_trx_id lock_mode lock_type lock_table lock_index lock_space lock_page lock_rec lock_data +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_locks but the InnoDB storage engine is not installed +select * from information_schema.innodb_lock_waits; +requesting_trx_id requested_lock_id blocking_trx_id blocking_lock_id +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_lock_waits but the InnoDB storage engine is not installed +select * from information_schema.innodb_cmp; +page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmp but the InnoDB storage engine is not installed +select * from information_schema.innodb_cmp_reset; +page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmp_reset but the InnoDB storage engine is not installed +select * from information_schema.innodb_cmp_per_index; +database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmp_per_index but the InnoDB storage engine is not installed +select * from information_schema.innodb_cmp_per_index_reset; +database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmp_per_index_reset but the InnoDB storage engine is not installed +select * from information_schema.innodb_cmpmem; +page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmpmem but the InnoDB storage engine is not installed +select * from information_schema.innodb_cmpmem_reset; +page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_cmpmem_reset but the InnoDB storage engine is not installed +select * from information_schema.innodb_metrics; +NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET ENABLED TYPE COMMENT +metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table handles opened +lock_deadlocks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of deadlocks +lock_timeouts lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of lock timeouts +lock_rec_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times enqueued into record lock wait queue +lock_table_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times enqueued into table lock wait queue +lock_rec_lock_requests lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks requested +lock_rec_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks created +lock_rec_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of record locks removed from the lock queue +lock_rec_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current number of record locks on tables +lock_table_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table locks created +lock_table_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of table locks removed from the lock queue +lock_table_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Current number of table locks on tables +lock_row_lock_current_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of row locks currently being waited for (innodb_row_lock_current_waits) +lock_row_lock_time lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time) +lock_row_lock_time_max lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max) +lock_row_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of times a row lock had to be waited for (innodb_row_lock_waits) +lock_row_lock_time_avg lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg) +buffer_pool_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Server buffer pool size (all buffer pools) in bytes +buffer_pool_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of reads directly from disk (innodb_buffer_pool_reads) +buffer_pool_read_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of logical read requests (innodb_buffer_pool_read_requests) +buffer_pool_write_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of write requests (innodb_buffer_pool_write_requests) +buffer_pool_wait_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of times waited for free buffer (innodb_buffer_pool_wait_free) +buffer_pool_read_ahead buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read as read ahead (innodb_buffer_pool_read_ahead) +buffer_pool_read_ahead_evicted buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted) +buffer_pool_pages_total buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Total buffer pool size in pages (innodb_buffer_pool_pages_total) +buffer_pool_pages_misc buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc) +buffer_pool_pages_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages containing data (innodb_buffer_pool_pages_data) +buffer_pool_bytes_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer bytes containing data (innodb_buffer_pool_bytes_data) +buffer_pool_pages_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently dirty (innodb_buffer_pool_pages_dirty) +buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty) +buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently free (innodb_buffer_pool_pages_free) +buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created) +buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written) +buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read) +buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data read in bytes (innodb_data_reads) +buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data written in bytes (innodb_data_written) +buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of flush batch +buffer_flush_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times buffer flush list flush is called +buffer_flush_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages scanned per flush batch scan +buffer_flush_batch_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of flush batch +buffer_flush_batches buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of flush batches +buffer_flush_batch_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a flush batch +buffer_flush_neighbor_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total neighbors flushed as part of neighbor flush +buffer_flush_neighbor buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times neighbors flushing is invoked +buffer_flush_neighbor_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a neighbor batch +buffer_flush_n_to_flush_requested buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages requested for flushing. +buffer_flush_n_to_flush_by_age buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages target by LSN Age for flushing. +buffer_flush_adaptive_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Avg time (ms) spent for adaptive flushing recently. +buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of adaptive flushes passed during the recent Avg period. +buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Total loops in LRU get free. +buffer_LRU_get_free_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Total sleep waits in LRU get free. +buffer_flush_avg_page_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Average number of pages at which flushing is happening +buffer_flush_lsn_avg_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Average redo generation rate +buffer_flush_pct_for_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Percent of IO capacity used to avoid max dirty page limit +buffer_flush_pct_for_lsn buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Percent of IO capacity used to avoid reusable redo space limit +buffer_flush_sync_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times a wait happens due to sync flushing +buffer_flush_adaptive_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of adaptive flushing +buffer_flush_adaptive buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of adaptive batches +buffer_flush_adaptive_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as an adaptive batch +buffer_flush_sync_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of sync batches +buffer_flush_sync buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of sync batches +buffer_flush_sync_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a sync batch +buffer_flush_background_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages flushed as part of background batches +buffer_flush_background buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of background batches +buffer_flush_background_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages queued as a background batch +buffer_LRU_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU batch +buffer_LRU_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU batch is called +buffer_LRU_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Pages scanned per LRU batch call +buffer_LRU_batch_flush_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Total pages flushed as part of LRU batches +buffer_LRU_batch_evict_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Total pages evicted as part of LRU batches +buffer_LRU_single_flush_failure_count Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times attempt to flush a single page from LRU failed +buffer_LRU_get_free_search Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of searches performed for a clean page +buffer_LRU_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU search +buffer_LRU_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU search is performed +buffer_LRU_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU search +buffer_LRU_unzip_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of LRU unzip search +buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Number of times LRU unzip search is performed +buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU unzip search +buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages read +buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages read +buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages read +buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages read +buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages read +buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages read +buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages read +buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages read +buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages read +buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages read +buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages read +buffer_page_read_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Extent Descriptor Pages read +buffer_page_read_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Uncompressed BLOB Pages read +buffer_page_read_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of First Compressed BLOB Pages read +buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Subsequent Compressed BLOB Pages read +buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version of InnoDB) Pages read +buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages written +buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages written +buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages written +buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages written +buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages written +buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages written +buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages written +buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages written +buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages written +buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages written +buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages written +buffer_page_written_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Extent Descriptor Pages written +buffer_page_written_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Uncompressed BLOB Pages written +buffer_page_written_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of First Compressed BLOB Pages written +buffer_page_written_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Subsequent Compressed BLOB Pages written +buffer_page_written_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version InnoDB) Pages written +os_data_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of reads initiated (innodb_data_reads) +os_data_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of writes initiated (innodb_data_writes) +os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of fsync() calls (innodb_data_fsyncs) +os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of reads pending +os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of writes pending +os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Bytes of log written (innodb_os_log_written) +trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-write transactions committed +trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-only transactions committed +trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of non-locking auto-commit read-only transactions committed +trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions committed with inserts and updates +trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back +trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint +trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list +trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of undo slots used +trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of undo slots cached +trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current rollback segment size in pages +purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of delete-marked rows purged +purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of purges on updates of existing records and updates on delete marked record with externally stored field +purge_invoked purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times purge was invoked +purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo log pages handled by the purge +purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Microseconds DML to be delayed due to purge lagging +purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was stopped +purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was resumed +log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of checkpoints +log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN of Last flush +log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN at last checkpoint +log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current LSN value +log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current LSN value minus LSN at last checkpoint +log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The oldest modified block LSN in the buffer pool +log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Maximum LSN difference; when exceeded, start asynchronous preflush +log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log waits due to small log buffer (innodb_log_waits) +log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log write requests (innodb_log_write_requests) +log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log writes (innodb_log_writes) +compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages compressed +compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decompressed +compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times padding is incremented to avoid compression failures +compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times padding is decremented due to good compressibility +compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of bytes saved by page compression +compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages compressed by page compression +compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of TRIM operation performed by page compression +compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decompressed by page compression +compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of page compression errors +compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages encrypted +compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decrypted +index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of index page splits +index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page merge attempts +index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of successful index page merges +index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index page reorganization attempts +index_page_reorg_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of successful index page reorganizations +index_page_discards index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages discarded +adaptive_hash_searches adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of successful searches using Adaptive Hash Index +adaptive_hash_searches_btree adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of searches using B-tree on an index search +adaptive_hash_pages_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages on which the Adaptive Hash Index is built +adaptive_hash_pages_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of index pages whose corresponding Adaptive Hash Index entries were removed +adaptive_hash_rows_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows added +adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows removed +adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries +adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows updated +file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of files currently open (innodb_num_open_files) +ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of inserted records merged by change buffering +ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted records merged by change buffering +ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge records merged by change buffering +ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of insert merged operations discarded +ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted merged operations discarded +ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge merged operations discarded +ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of change buffer merges +ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Change buffer size in pages +innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times (seconds) master thread sleeps +innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Current server activity count +innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is active +innodb_master_idle_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is idle +innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Time (in microseconds) spent to flush log records +innodb_dict_lru_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Time (in microseconds) spent to process DICT LRU list +innodb_dict_lru_count_active server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of tables evicted from DICT LRU list in the active loop +innodb_dict_lru_count_idle server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of tables evicted from DICT LRU list in the idle loop +innodb_dblwr_writes server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of doublewrite operations that have been performed (innodb_dblwr_writes) +innodb_dblwr_pages_written server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages that have been written for doublewrite operations (innodb_dblwr_pages_written) +innodb_page_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value InnoDB page size in bytes (innodb_page_size) +ddl_background_drop_indexes ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of indexes waiting to be dropped after failed index creation +ddl_online_create_index ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of indexes being created online +ddl_pending_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress +ddl_sort_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of sort files created during alter table +ddl_log_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of log files created during alter table +icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of attempts for index push-down condition checks +icp_no_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition does not match +icp_out_of_range icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition out of range +icp_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Index push-down condition matches +select * from information_schema.innodb_ft_default_stopword; +value +a +about +an +are +as +at +be +by +com +de +en +for +from +how +i +in +is +it +la +of +on +or +that +the +this +to +was +what +when +where +who +will +with +und +the +www +select * from information_schema.innodb_ft_deleted; +DOC_ID +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_deleted but the InnoDB storage engine is not installed +select * from information_schema.innodb_ft_being_deleted; +DOC_ID +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_being_deleted but the InnoDB storage engine is not installed +select * from information_schema.innodb_ft_index_cache; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_index_cache but the InnoDB storage engine is not installed +select * from information_schema.innodb_ft_index_table; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_index_table but the InnoDB storage engine is not installed +select * from information_schema.innodb_ft_config; +KEY VALUE +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_config but the InnoDB storage engine is not installed +select * from information_schema.innodb_buffer_page; +POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_buffer_page but the InnoDB storage engine is not installed +select * from information_schema.innodb_buffer_page_lru; +POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_buffer_page_lru but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_tables; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_tables but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_tablestats; +TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC REF_COUNT +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_tablestats but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_indexes; +INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_indexes but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_columns; +TABLE_ID NAME POS MTYPE PRTYPE LEN +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_columns but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_fields; +INDEX_ID NAME POS +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_fields but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_foreign; +ID FOR_NAME REF_NAME N_COLS TYPE +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_foreign but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_foreign_cols; +ID FOR_COL_NAME REF_COL_NAME POS +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_foreign_cols but the InnoDB storage engine is not installed +select * from information_schema.innodb_sys_tablespaces; +SPACE NAME FLAG ROW_FORMAT PAGE_SIZE FILENAME FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_tablespaces but the InnoDB storage engine is not installed +select * from information_schema.innodb_tablespaces_encryption; +SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER CURRENT_KEY_ID ROTATING_OR_FLUSHING +Warnings: +Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_encryption but the InnoDB storage engine is not installed diff --git a/mysql-test/suite/innodb/r/innodb_stats.result b/mysql-test/suite/innodb/r/innodb_stats.result new file mode 100644 index 00000000..b300af76 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats.result @@ -0,0 +1,532 @@ +TRUNCATE TABLE test_innodb_stats; +SELECT 'dummy INSERT, the table should be empty'; +dummy INSERT, the table should be empty +dummy INSERT, the table should be empty +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 0 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 0 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 0 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 1 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 1 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 1 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (1); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 1 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 2 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 2 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 1 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 3 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 3 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1), (1), (1), (1), (1), (1), (1), (1); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 1 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 10 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 2 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (2); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 2 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 2 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 2 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 2 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 3 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 3 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 3 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 3 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 3 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2), (3), (3); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 3 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 5 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 5 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO +TRUNCATE TABLE test_innodb_stats; +INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3), (4), (5), (1), (2), (3), (4), (5); +ANALYZE TABLE test_innodb_stats; +Table Op Msg_type Msg_text +test.test_innodb_stats analyze status OK +SELECT +stat_name, +stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE +database_name = DATABASE() AND +table_name = 'test_innodb_stats' AND +index_name = 'a_key' AND +stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') +ORDER BY stat_name; +stat_name n_diff_pfx01 +stat_value 5 +sample_size 1 +stat_description a +stat_name n_diff_pfx02 +stat_value 10 +sample_size 1 +stat_description a,DB_ROW_ID +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +FLUSH TABLE test_innodb_stats; +SELECT * FROM information_schema.statistics +WHERE table_name = 'test_innodb_stats'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME test_innodb_stats +NON_UNIQUE 1 +INDEX_SCHEMA test +INDEX_NAME a_key +SEQ_IN_INDEX 1 +COLUMN_NAME a +COLLATION A +CARDINALITY 10 +SUB_PART NULL +PACKED NULL +NULLABLE YES +INDEX_TYPE BTREE +COMMENT +INDEX_COMMENT +IGNORED NO diff --git a/mysql-test/suite/innodb/r/innodb_stats_create_on_corrupted.result b/mysql-test/suite/innodb/r/innodb_stats_create_on_corrupted.result new file mode 100644 index 00000000..3c3996e0 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_create_on_corrupted.result @@ -0,0 +1,42 @@ +call mtr.add_suppression("InnoDB: Table .*innodb_index_stats.* not found"); +call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table .*"); +call mtr.add_suppression("InnoDB: Table mysql\\.innodb_index_stats has length mismatch in the column name stat_description\\. Please run mariadb-upgrade"); +call mtr.add_suppression("InnoDB: Column stat_description in table mysql\\.innodb_index_stats is VARCHAR"); +ALTER TABLE mysql.innodb_index_stats RENAME TO mysql.innodb_index_stats_; +CREATE TABLE test_ps_create_on_corrupted +(a INT, PRIMARY KEY (a)) +ENGINE=INNODB STATS_PERSISTENT=1; +SELECT seq_in_index, column_name, cardinality +FROM information_schema.statistics WHERE table_name = 'test_ps_create_on_corrupted' +ORDER BY index_name, seq_in_index; +seq_in_index 1 +column_name a +cardinality 0 +SELECT table_rows, avg_row_length, max_data_length, index_length +FROM information_schema.tables WHERE table_name = 'test_ps_create_on_corrupted'; +table_rows 0 +avg_row_length 0 +max_data_length 0 +index_length 0 +ALTER TABLE mysql.innodb_index_stats_ RENAME TO mysql.innodb_index_stats; +SET old_mode=''; +ALTER TABLE mysql.innodb_index_stats +MODIFY stat_description VARCHAR(1024) COLLATE utf8_bin; +CREATE TABLE t (a INT) ENGINE=InnoDB STATS_PERSISTENT=1; +ALTER TABLE mysql.innodb_index_stats +MODIFY stat_description VARCHAR(1024) COLLATE utf8mb3_bin NOT NULL; +DROP TABLE t; +# restart +SELECT seq_in_index, column_name, cardinality +FROM information_schema.statistics WHERE table_name = 'test_ps_create_on_corrupted' +ORDER BY index_name, seq_in_index; +seq_in_index 1 +column_name a +cardinality 0 +SELECT table_rows, avg_row_length, max_data_length, index_length +FROM information_schema.tables WHERE table_name = 'test_ps_create_on_corrupted'; +table_rows 0 +avg_row_length 0 +max_data_length 0 +index_length 0 +DROP TABLE test_ps_create_on_corrupted; diff --git a/mysql-test/suite/innodb/r/innodb_stats_create_table.result b/mysql-test/suite/innodb/r/innodb_stats_create_table.result new file mode 100644 index 00000000..c37c4671 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_create_table.result @@ -0,0 +1,35 @@ +set @save_innodb_stats_persistent= @@innodb_stats_persistent; +set global innodb_stats_persistent=default; +SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE +database_name = 'test' AND +table_name = 'test_ps_create_table'; +COUNT(*) 0 +CREATE TABLE test_ps_create_table (a INT, PRIMARY KEY (a)) +ENGINE=INNODB STATS_PERSISTENT=0; +SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE +database_name = 'test' AND +table_name = 'test_ps_create_table'; +COUNT(*) 0 +DROP TABLE test_ps_create_table; +CREATE TABLE test_ps_create_table (a INT, PRIMARY KEY (a)) +ENGINE=INNODB; +SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE +database_name = 'test' AND +table_name = 'test_ps_create_table'; +COUNT(*) 1 +DROP TABLE test_ps_create_table; +CREATE TABLE test_ps_create_table (a INT, PRIMARY KEY (a)) +ENGINE=INNODB STATS_PERSISTENT=default; +SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE +database_name = 'test' AND +table_name = 'test_ps_create_table'; +COUNT(*) 1 +DROP TABLE test_ps_create_table; +CREATE TABLE test_ps_create_table (a INT, PRIMARY KEY (a)) +ENGINE=INNODB STATS_PERSISTENT=1; +SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE +database_name = 'test' AND +table_name = 'test_ps_create_table'; +COUNT(*) 1 +DROP TABLE test_ps_create_table; +set global innodb_stats_persistent= @save_innodb_stats_persistent; diff --git a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result new file mode 100644 index 00000000..70f1edab --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result @@ -0,0 +1,74 @@ +CREATE DATABASE unlocked; +CREATE TABLE unlocked.t1(a INT PRIMARY KEY) ENGINE=INNODB STATS_PERSISTENT=0; +CREATE DATABASE locked; +CREATE TABLE locked.t1(a INT PRIMARY KEY) ENGINE=INNODB STATS_PERSISTENT=1; +CREATE TABLE innodb_stats_drop_locked (c INT, KEY c_key (c)) +ENGINE=INNODB STATS_PERSISTENT=1; +ANALYZE TABLE innodb_stats_drop_locked; +Table Op Msg_type Msg_text +test.innodb_stats_drop_locked analyze status Engine-independent statistics collected +test.innodb_stats_drop_locked analyze status OK +BEGIN; +SELECT table_name FROM mysql.innodb_table_stats +WHERE table_name='innodb_stats_drop_locked' +FOR UPDATE; +table_name +innodb_stats_drop_locked +SELECT table_name FROM mysql.innodb_index_stats +WHERE table_name='innodb_stats_drop_locked' +FOR UPDATE; +table_name +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +connect con1,localhost,root,,; +SET innodb_lock_wait_timeout=1; +ALTER TABLE innodb_stats_drop_locked DROP INDEX c_key; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SHOW CREATE TABLE innodb_stats_drop_locked; +Table Create Table +innodb_stats_drop_locked CREATE TABLE `innodb_stats_drop_locked` ( + `c` int(11) DEFAULT NULL, + KEY `c_key` (`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 +DROP TABLE innodb_stats_drop_locked; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DROP DATABASE unlocked; +DROP DATABASE locked; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +COMMIT; +DROP DATABASE locked; +SELECT table_name FROM mysql.innodb_table_stats +WHERE table_name='innodb_stats_drop_locked'; +table_name +innodb_stats_drop_locked +SELECT table_name FROM mysql.innodb_index_stats +WHERE table_name='innodb_stats_drop_locked'; +table_name +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +ALTER TABLE innodb_stats_drop_locked DROP INDEX c_key; +SELECT table_name FROM mysql.innodb_index_stats +WHERE table_name='innodb_stats_drop_locked'; +table_name +innodb_stats_drop_locked +innodb_stats_drop_locked +innodb_stats_drop_locked +DROP TABLE innodb_stats_drop_locked; +SELECT table_name FROM mysql.innodb_table_stats +WHERE table_name='innodb_stats_drop_locked'; +table_name +SELECT table_name FROM mysql.innodb_index_stats +WHERE table_name='innodb_stats_drop_locked'; +table_name diff --git a/mysql-test/suite/innodb/r/innodb_stats_fetch.result b/mysql-test/suite/innodb/r/innodb_stats_fetch.result new file mode 100644 index 00000000..d7b7d78e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_fetch.result @@ -0,0 +1,152 @@ +set @save_use_stat_tables = @@use_stat_tables; +set @@use_stat_tables = COMPLEMENTARY; +CREATE TABLE test_ps_fetch +(a INT, b INT, c INT, d INT, PRIMARY KEY (a, b), INDEX idx (c, d)) +ENGINE=INNODB STATS_PERSISTENT=1; +ANALYZE TABLE test_ps_fetch; +Table test.test_ps_fetch +Op analyze +Msg_type status +Msg_text Engine-independent statistics collected +Table test.test_ps_fetch +Op analyze +Msg_type status +Msg_text OK +SELECT n_rows, clustered_index_size, sum_of_other_index_sizes +FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch'; +n_rows 0 +clustered_index_size 1 +sum_of_other_index_sizes 1 +SELECT index_name, stat_name, stat_value, sample_size, stat_description +FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_fetch' +ORDER BY index_name, stat_name; +index_name PRIMARY +stat_name n_diff_pfx01 +stat_value 0 +sample_size 1 +stat_description a +index_name PRIMARY +stat_name n_diff_pfx02 +stat_value 0 +sample_size 1 +stat_description a,b +index_name PRIMARY +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +index_name PRIMARY +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +index_name idx +stat_name n_diff_pfx01 +stat_value 0 +sample_size 1 +stat_description c +index_name idx +stat_name n_diff_pfx02 +stat_value 0 +sample_size 1 +stat_description c,d +index_name idx +stat_name n_diff_pfx03 +stat_value 0 +sample_size 1 +stat_description c,d,a +index_name idx +stat_name n_diff_pfx04 +stat_value 0 +sample_size 1 +stat_description c,d,a,b +index_name idx +stat_name n_leaf_pages +stat_value 1 +sample_size NULL +stat_description Number of leaf pages in the index +index_name idx +stat_name size +stat_value 1 +sample_size NULL +stat_description Number of pages in the index +SELECT index_name, seq_in_index, column_name, cardinality +FROM information_schema.statistics WHERE table_name = 'test_ps_fetch' +ORDER BY index_name, seq_in_index; +index_name idx +seq_in_index 1 +column_name c +cardinality 0 +index_name idx +seq_in_index 2 +column_name d +cardinality 0 +index_name PRIMARY +seq_in_index 1 +column_name a +cardinality 0 +index_name PRIMARY +seq_in_index 2 +column_name b +cardinality 0 +SELECT +table_rows, avg_row_length, max_data_length, index_length +FROM information_schema.tables WHERE table_name = 'test_ps_fetch'; +table_rows 0 +avg_row_length 0 +max_data_length 0 +index_length 16384 +UPDATE mysql.innodb_table_stats SET +n_rows = 1000, +clustered_index_size = 5 +WHERE +table_name = 'test_ps_fetch'; +UPDATE mysql.innodb_index_stats SET +stat_value = 20 +WHERE +table_name = 'test_ps_fetch' AND +index_name = 'PRIMARY' AND +stat_name = 'n_diff_pfx01'; +UPDATE mysql.innodb_index_stats SET +stat_value = 90 +WHERE +table_name = 'test_ps_fetch' AND +index_name = 'PRIMARY' AND +stat_name = 'n_diff_pfx02'; +UPDATE mysql.innodb_index_stats SET +stat_value = 3 +WHERE +table_name = 'test_ps_fetch' AND +index_name = 'idx' AND +stat_name = 'n_diff_pfx01'; +UPDATE mysql.innodb_index_stats SET +stat_value = 11 +WHERE +table_name = 'test_ps_fetch' AND +index_name = 'idx' AND +stat_name = 'n_diff_pfx02'; +FLUSH TABLE test_ps_fetch; +SELECT seq_in_index, column_name, cardinality +FROM information_schema.statistics WHERE table_name = 'test_ps_fetch' +ORDER BY index_name, seq_in_index; +seq_in_index 1 +column_name c +cardinality 6 +seq_in_index 2 +column_name d +cardinality 22 +seq_in_index 1 +column_name a +cardinality 40 +seq_in_index 2 +column_name b +cardinality 200 +SELECT +table_rows, avg_row_length, max_data_length, index_length +FROM information_schema.tables WHERE table_name = 'test_ps_fetch'; +table_rows 1000 +avg_row_length 81 +max_data_length 0 +index_length 16384 +DROP TABLE test_ps_fetch; +set @@use_stat_tables = @save_use_stat_tables; diff --git a/mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result b/mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result new file mode 100644 index 00000000..1f847130 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result @@ -0,0 +1,49 @@ +call mtr.add_suppression("InnoDB: Column stat_value in table mysql\\.innodb_index_stats is BIGINT UNSIGNED but should be BIGINT UNSIGNED NOT NULL"); +call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table"); +CREATE TABLE test_ps_fetch_corrupted +(a INT, PRIMARY KEY (a)) +ENGINE=INNODB STATS_PERSISTENT=1; +ANALYZE TABLE test_ps_fetch_corrupted; +Table test.test_ps_fetch_corrupted +Op analyze +Msg_type status +Msg_text Engine-independent statistics collected +Table test.test_ps_fetch_corrupted +Op analyze +Msg_type status +Msg_text OK +SELECT n_rows, clustered_index_size, sum_of_other_index_sizes +FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_corrupted'; +n_rows 0 +clustered_index_size 1 +sum_of_other_index_sizes 0 +ALTER TABLE mysql.innodb_index_stats MODIFY stat_value BIGINT UNSIGNED NULL; +FLUSH TABLE test_ps_fetch_corrupted; +SELECT seq_in_index, column_name, cardinality +FROM information_schema.statistics WHERE table_name = 'test_ps_fetch_corrupted' +ORDER BY index_name, seq_in_index; +seq_in_index 1 +column_name a +cardinality 0 +SELECT table_rows, avg_row_length, max_data_length, index_length +FROM information_schema.tables WHERE table_name = 'test_ps_fetch_corrupted'; +table_rows 0 +avg_row_length 0 +max_data_length 0 +index_length 0 +ALTER TABLE mysql.innodb_index_stats MODIFY stat_value BIGINT UNSIGNED NOT NULL; +FLUSH TABLE test_ps_fetch_corrupted; +SELECT seq_in_index, column_name, cardinality +FROM information_schema.statistics WHERE table_name = 'test_ps_fetch_corrupted' +ORDER BY index_name, seq_in_index; +seq_in_index 1 +column_name a +cardinality 0 +SELECT table_rows, avg_row_length, max_data_length, index_length +FROM information_schema.tables WHERE table_name = 'test_ps_fetch_corrupted'; +table_rows 0 +avg_row_length 0 +max_data_length 0 +index_length 0 +DROP TABLE test_ps_fetch_corrupted; +# restart diff --git a/mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result b/mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result new file mode 100644 index 00000000..91bb2bf3 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result @@ -0,0 +1,32 @@ +call mtr.add_suppression("InnoDB: Error: Fetch of persistent statistics requested for table *"); +CREATE TABLE test_ps_fetch_nonexistent +(a INT, PRIMARY KEY (a)) +ENGINE=INNODB STATS_PERSISTENT=1; +ANALYZE TABLE test_ps_fetch_nonexistent; +Table test.test_ps_fetch_nonexistent +Op analyze +Msg_type status +Msg_text Engine-independent statistics collected +Table test.test_ps_fetch_nonexistent +Op analyze +Msg_type status +Msg_text OK +SELECT COUNT(*) +FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_nonexistent'; +COUNT(*) 1 +DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_fetch_nonexistent'; +DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_nonexistent'; +FLUSH TABLE test_ps_fetch_nonexistent; +SELECT seq_in_index, column_name, cardinality +FROM information_schema.statistics WHERE table_name = 'test_ps_fetch_nonexistent' +ORDER BY index_name, seq_in_index; +seq_in_index 1 +column_name a +cardinality 0 +SELECT table_rows, avg_row_length, max_data_length, index_length +FROM information_schema.tables WHERE table_name = 'test_ps_fetch_nonexistent'; +table_rows 0 +avg_row_length 0 +max_data_length 0 +index_length 0 +DROP TABLE test_ps_fetch_nonexistent; diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent.result b/mysql-test/suite/innodb/r/innodb_stats_persistent.result new file mode 100644 index 00000000..a691ab19 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_persistent.result @@ -0,0 +1,105 @@ +SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked; +SET GLOBAL innodb_stats_include_delete_marked = ON; +SET @saved_traditional = @@GLOBAL.innodb_stats_traditional; +SET GLOBAL innodb_stats_traditional=false; +SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter; +SET GLOBAL innodb_stats_modified_counter=1; +CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val)) +ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +connect con1, localhost, root,,; +START TRANSACTION; +DELETE FROM t1; +SELECT COUNT(*) FROM t1; +connection default; +# With innodb_stats_include_delete_marked=ON, +# DELETE must not affect statistics before COMMIT. +EXPLAIN SELECT * FROM t1 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref val val 4 const 1 Using index +connection con1; +COUNT(*) +0 +ROLLBACK; +SELECT COUNT(*) FROM t1; +COUNT(*) +16 +EXPLAIN SELECT * FROM t1 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref val val 4 const 16 Using index +BEGIN; +DELETE FROM t1; +COMMIT; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +connection default; +BEGIN; +INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16; +# The INSERT will show up before COMMIT. +EXPLAIN SELECT * FROM t2 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref val val 4 const 16 Using index +SELECT COUNT(*) FROM t2; +COUNT(*) +16 +# The ROLLBACK of the INSERT must affect the statistics. +ROLLBACK; +SELECT COUNT(*) FROM t2; +COUNT(*) +0 +connection con1; +EXPLAIN SELECT * FROM t2 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref val val 4 const 1 Using index +InnoDB 0 transactions not purged +# After COMMIT and purge, the DELETE must show up. +EXPLAIN SELECT * FROM t1 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref val val 4 const 1 Using index +SET GLOBAL innodb_stats_include_delete_marked = OFF; +BEGIN; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; +EXPLAIN SELECT * FROM t1 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref val val 4 const 16 Using index +ROLLBACK; +EXPLAIN SELECT * FROM t1 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref val val 4 const 1 Using index +BEGIN; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE val=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref val val 4 const 16 Using index +BEGIN; +DELETE FROM t1; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +# With innodb_stats_include_delete_marked=OFF, +# DELETE must affect statistics even before COMMIT. +# However, if there was a WHERE condition, +# ha_innobase::records_in_range() would count the delete-marked records. +EXPLAIN SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL val 4 NULL 16 Using index +ROLLBACK; +EXPLAIN SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL val 4 NULL 16 Using index +SELECT COUNT(*) FROM t1; +COUNT(*) +16 +disconnect con1; +connection default; +DROP TABLE t1,t2; +SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked; +SET GLOBAL innodb_stats_traditional = @saved_traditional; +SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter; diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result b/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result new file mode 100644 index 00000000..ee1ad318 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result @@ -0,0 +1,24 @@ +# +# MDEV-13534 InnoDB STATS_PERSISTENT fails to ignore +# garbage delete-mark flag on node pointer pages +# +CREATE TABLE t(a INT UNSIGNED PRIMARY KEY) +ENGINE=InnoDB STATS_PERSISTENT=1 STATS_SAMPLE_PAGES=1; +BEGIN; +SET @save_debug = @@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +INSERT t VALUES(1),(5); +DELETE FROM t; +INSERT t VALUES(4); +DELETE FROM t; +INSERT t VALUES(3); +DELETE FROM t; +SET GLOBAL innodb_limit_optimistic_insert_debug = @save_debug; +connect con1, localhost, root,,; +ANALYZE TABLE t; +Table Op Msg_type Msg_text +test.t analyze status Engine-independent statistics collected +test.t analyze status OK +disconnect con1; +connection default; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/innodb_stats_rename_table.result b/mysql-test/suite/innodb/r/innodb_stats_rename_table.result new file mode 100644 index 00000000..20d82dff --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_rename_table.result @@ -0,0 +1,50 @@ +SELECT table_name, n_rows +FROM mysql.innodb_table_stats +WHERE table_name IN ('stats_rename_old', 'stats_rename_new'); +SELECT table_name, index_name, stat_name, stat_value +FROM mysql.innodb_index_stats +WHERE table_name IN ('stats_rename_old', 'stats_rename_new'); +CREATE TABLE stats_rename_old (a INT, PRIMARY KEY (a)) +ENGINE=INNODB STATS_PERSISTENT=1; +SELECT table_name, n_rows +FROM mysql.innodb_table_stats +WHERE table_name IN ('stats_rename_old', 'stats_rename_new'); +table_name stats_rename_old +n_rows 0 +SELECT table_name, index_name, stat_name, stat_value +FROM mysql.innodb_index_stats +WHERE table_name IN ('stats_rename_old', 'stats_rename_new'); +table_name stats_rename_old +index_name PRIMARY +stat_name n_diff_pfx01 +stat_value 0 +table_name stats_rename_old +index_name PRIMARY +stat_name n_leaf_pages +stat_value 1 +table_name stats_rename_old +index_name PRIMARY +stat_name size +stat_value 1 +RENAME TABLE stats_rename_old TO stats_rename_new; +SELECT table_name, n_rows +FROM mysql.innodb_table_stats +WHERE table_name IN ('stats_rename_old', 'stats_rename_new'); +table_name stats_rename_new +n_rows 0 +SELECT table_name, index_name, stat_name, stat_value +FROM mysql.innodb_index_stats +WHERE table_name IN ('stats_rename_old', 'stats_rename_new'); +table_name stats_rename_new +index_name PRIMARY +stat_name n_diff_pfx01 +stat_value 0 +table_name stats_rename_new +index_name PRIMARY +stat_name n_leaf_pages +stat_value 1 +table_name stats_rename_new +index_name PRIMARY +stat_name size +stat_value 1 +DROP TABLE stats_rename_new; diff --git a/mysql-test/suite/innodb/r/innodb_stats_rename_table_if_exists.result b/mysql-test/suite/innodb/r/innodb_stats_rename_table_if_exists.result new file mode 100644 index 00000000..a966f629 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_rename_table_if_exists.result @@ -0,0 +1,131 @@ +CREATE TABLE stats_rename1 (a INT PRIMARY KEY, b INT UNIQUE) +ENGINE=INNODB STATS_PERSISTENT=1; +BEGIN; +INSERT INTO mysql.innodb_table_stats +SELECT +database_name, +'stats_rename2' AS table_name, +last_update, +123 AS n_rows, +clustered_index_size, +sum_of_other_index_sizes +FROM mysql.innodb_table_stats +WHERE table_name = 'stats_rename1'; +INSERT INTO mysql.innodb_index_stats +SELECT +database_name, +'stats_rename2' AS table_name, +index_name, +last_update, +stat_name, +567 AS stat_value, +sample_size, +stat_description +FROM mysql.innodb_index_stats +WHERE table_name = 'stats_rename1'; +COMMIT; +SELECT table_name, n_rows +FROM mysql.innodb_table_stats +WHERE table_name IN ('stats_rename1', 'stats_rename2'); +table_name stats_rename1 +n_rows 0 +table_name stats_rename2 +n_rows 123 +SELECT table_name, index_name, stat_name, stat_value +FROM mysql.innodb_index_stats +WHERE table_name IN ('stats_rename1', 'stats_rename2'); +table_name stats_rename1 +index_name PRIMARY +stat_name n_diff_pfx01 +stat_value 0 +table_name stats_rename1 +index_name PRIMARY +stat_name n_leaf_pages +stat_value 1 +table_name stats_rename1 +index_name PRIMARY +stat_name size +stat_value 1 +table_name stats_rename1 +index_name b +stat_name n_diff_pfx01 +stat_value 0 +table_name stats_rename1 +index_name b +stat_name n_leaf_pages +stat_value 1 +table_name stats_rename1 +index_name b +stat_name size +stat_value 1 +table_name stats_rename2 +index_name PRIMARY +stat_name n_diff_pfx01 +stat_value 567 +table_name stats_rename2 +index_name PRIMARY +stat_name n_leaf_pages +stat_value 567 +table_name stats_rename2 +index_name PRIMARY +stat_name size +stat_value 567 +table_name stats_rename2 +index_name b +stat_name n_diff_pfx01 +stat_value 567 +table_name stats_rename2 +index_name b +stat_name n_leaf_pages +stat_value 567 +table_name stats_rename2 +index_name b +stat_name size +stat_value 567 +RENAME TABLE stats_rename1 TO stats_rename2; +ERROR 23000: Can't write; duplicate key in table 'mysql.innodb_table_stats' +BEGIN; +DELETE FROM mysql.innodb_table_stats WHERE table_name='stats_rename2'; +DELETE FROM mysql.innodb_index_stats WHERE table_name='stats_rename2'; +COMMIT; +RENAME TABLE stats_rename1 TO stats_rename2; +UPDATE mysql.innodb_index_stats SET index_name='c' +WHERE table_name='stats_rename2' AND index_name='PRIMARY'; +ALTER TABLE stats_rename2 CHANGE b d INT, RENAME INDEX b TO c; +ERROR 23000: Can't write; duplicate key in table 'mysql.innodb_index_stats' +UPDATE mysql.innodb_index_stats SET index_name='PRIMARY' +WHERE table_name='stats_rename2' AND index_name='c'; +ALTER TABLE stats_rename2 CHANGE b d INT, RENAME INDEX b TO c; +SELECT table_name, n_rows +FROM mysql.innodb_table_stats +WHERE table_name IN ('stats_rename1', 'stats_rename2'); +table_name stats_rename2 +n_rows 0 +SELECT table_name, index_name, stat_name, stat_value +FROM mysql.innodb_index_stats +WHERE table_name IN ('stats_rename1', 'stats_rename2'); +table_name stats_rename2 +index_name PRIMARY +stat_name n_diff_pfx01 +stat_value 0 +table_name stats_rename2 +index_name PRIMARY +stat_name n_leaf_pages +stat_value 1 +table_name stats_rename2 +index_name PRIMARY +stat_name size +stat_value 1 +table_name stats_rename2 +index_name c +stat_name n_diff_pfx01 +stat_value 0 +table_name stats_rename2 +index_name c +stat_name n_leaf_pages +stat_value 1 +table_name stats_rename2 +index_name c +stat_name size +stat_value 1 +DROP TABLE stats_rename2; diff --git a/mysql-test/suite/innodb/r/innodb_status_variables.result b/mysql-test/suite/innodb/r/innodb_status_variables.result new file mode 100644 index 00000000..3a86271c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_status_variables.result @@ -0,0 +1,113 @@ +SELECT variable_name FROM information_schema.global_status +WHERE variable_name LIKE 'INNODB_%' +AND variable_name NOT IN +('INNODB_ADAPTIVE_HASH_HASH_SEARCHES','INNODB_ADAPTIVE_HASH_NON_HASH_SEARCHES', +'INNODB_MEM_ADAPTIVE_HASH', +'INNODB_BUFFERED_AIO_SUBMITTED','INNODB_BUFFER_POOL_PAGES_LATCHED'); +variable_name +INNODB_BACKGROUND_LOG_SYNC +INNODB_BUFFER_POOL_DUMP_STATUS +INNODB_BUFFER_POOL_LOAD_STATUS +INNODB_BUFFER_POOL_RESIZE_STATUS +INNODB_BUFFER_POOL_LOAD_INCOMPLETE +INNODB_BUFFER_POOL_PAGES_DATA +INNODB_BUFFER_POOL_BYTES_DATA +INNODB_BUFFER_POOL_PAGES_DIRTY +INNODB_BUFFER_POOL_BYTES_DIRTY +INNODB_BUFFER_POOL_PAGES_FLUSHED +INNODB_BUFFER_POOL_PAGES_FREE +INNODB_BUFFER_POOL_PAGES_MADE_NOT_YOUNG +INNODB_BUFFER_POOL_PAGES_MADE_YOUNG +INNODB_BUFFER_POOL_PAGES_MISC +INNODB_BUFFER_POOL_PAGES_OLD +INNODB_BUFFER_POOL_PAGES_TOTAL +INNODB_BUFFER_POOL_PAGES_LRU_FLUSHED +INNODB_BUFFER_POOL_PAGES_LRU_FREED +INNODB_BUFFER_POOL_PAGES_SPLIT +INNODB_BUFFER_POOL_READ_AHEAD_RND +INNODB_BUFFER_POOL_READ_AHEAD +INNODB_BUFFER_POOL_READ_AHEAD_EVICTED +INNODB_BUFFER_POOL_READ_REQUESTS +INNODB_BUFFER_POOL_READS +INNODB_BUFFER_POOL_WAIT_FREE +INNODB_BUFFER_POOL_WRITE_REQUESTS +INNODB_CHECKPOINT_AGE +INNODB_CHECKPOINT_MAX_AGE +INNODB_DATA_FSYNCS +INNODB_DATA_PENDING_FSYNCS +INNODB_DATA_PENDING_READS +INNODB_DATA_PENDING_WRITES +INNODB_DATA_READ +INNODB_DATA_READS +INNODB_DATA_WRITES +INNODB_DATA_WRITTEN +INNODB_DBLWR_PAGES_WRITTEN +INNODB_DBLWR_WRITES +INNODB_DEADLOCKS +INNODB_HISTORY_LIST_LENGTH +INNODB_IBUF_DISCARDED_DELETE_MARKS +INNODB_IBUF_DISCARDED_DELETES +INNODB_IBUF_DISCARDED_INSERTS +INNODB_IBUF_FREE_LIST +INNODB_IBUF_MERGED_DELETE_MARKS +INNODB_IBUF_MERGED_DELETES +INNODB_IBUF_MERGED_INSERTS +INNODB_IBUF_MERGES +INNODB_IBUF_SEGMENT_SIZE +INNODB_IBUF_SIZE +INNODB_LOG_WAITS +INNODB_LOG_WRITE_REQUESTS +INNODB_LOG_WRITES +INNODB_LSN_CURRENT +INNODB_LSN_FLUSHED +INNODB_LSN_LAST_CHECKPOINT +INNODB_MASTER_THREAD_ACTIVE_LOOPS +INNODB_MASTER_THREAD_IDLE_LOOPS +INNODB_MAX_TRX_ID +INNODB_MEM_DICTIONARY +INNODB_OS_LOG_WRITTEN +INNODB_PAGE_SIZE +INNODB_PAGES_CREATED +INNODB_PAGES_READ +INNODB_PAGES_WRITTEN +INNODB_ROW_LOCK_CURRENT_WAITS +INNODB_ROW_LOCK_TIME +INNODB_ROW_LOCK_TIME_AVG +INNODB_ROW_LOCK_TIME_MAX +INNODB_ROW_LOCK_WAITS +INNODB_NUM_OPEN_FILES +INNODB_TRUNCATED_STATUS_WRITES +INNODB_AVAILABLE_UNDO_LOGS +INNODB_UNDO_TRUNCATIONS +INNODB_PAGE_COMPRESSION_SAVED +INNODB_NUM_PAGES_PAGE_COMPRESSED +INNODB_NUM_PAGE_COMPRESSED_TRIM_OP +INNODB_NUM_PAGES_PAGE_DECOMPRESSED +INNODB_NUM_PAGES_PAGE_COMPRESSION_ERROR +INNODB_NUM_PAGES_ENCRYPTED +INNODB_NUM_PAGES_DECRYPTED +INNODB_HAVE_LZ4 +INNODB_HAVE_LZO +INNODB_HAVE_LZMA +INNODB_HAVE_BZIP2 +INNODB_HAVE_SNAPPY +INNODB_HAVE_PUNCH_HOLE +INNODB_DEFRAGMENT_COMPRESSION_FAILURES +INNODB_DEFRAGMENT_FAILURES +INNODB_DEFRAGMENT_COUNT +INNODB_INSTANT_ALTER_COLUMN +INNODB_ONLINEDDL_ROWLOG_ROWS +INNODB_ONLINEDDL_ROWLOG_PCT_USED +INNODB_ONLINEDDL_PCT_PROGRESS +INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_CACHE +INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_DISK +INNODB_ENCRYPTION_ROTATION_PAGES_MODIFIED +INNODB_ENCRYPTION_ROTATION_PAGES_FLUSHED +INNODB_ENCRYPTION_ROTATION_ESTIMATED_IOPS +INNODB_ENCRYPTION_N_MERGE_BLOCKS_ENCRYPTED +INNODB_ENCRYPTION_N_MERGE_BLOCKS_DECRYPTED +INNODB_ENCRYPTION_N_ROWLOG_BLOCKS_ENCRYPTED +INNODB_ENCRYPTION_N_ROWLOG_BLOCKS_DECRYPTED +INNODB_ENCRYPTION_N_TEMP_BLOCKS_ENCRYPTED +INNODB_ENCRYPTION_N_TEMP_BLOCKS_DECRYPTED +INNODB_ENCRYPTION_NUM_KEY_REQUESTS diff --git a/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result new file mode 100644 index 00000000..6932b8f2 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result @@ -0,0 +1,52 @@ +# +# Bug #29717909 MEMORY LIFETIME OF VARIABLES BETWEEN CHECK AND UPDATE INCORRECTLY MANAGED +# +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +NULL +create table user_stopword_1(value varchar(30)) engine = innodb; +create table user_stopword_2(value varchar(30)) engine = innodb; +set @blah = 'test/user_stopword_1'; +SET GLOBAL innodb_ft_server_stopword_table= @blah; +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +test/user_stopword_1 +set @blah = 'test/user_stopword_2'; +SET GLOBAL innodb_ft_server_stopword_table= @blah; +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +test/user_stopword_2 +SET GLOBAL innodb_ft_server_stopword_table= NULL; +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +NULL +SET GLOBAL innodb_ft_server_stopword_table= default; +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +NULL +drop table user_stopword_1, user_stopword_2; +CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx +(opening_line)) ENGINE=InnoDB; +CREATE TABLE t2 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx +(opening_line)) ENGINE=InnoDB; +select @@innodb_ft_aux_table; +@@innodb_ft_aux_table +NULL +set @blah = 'test/t1'; +SET GLOBAL innodb_ft_aux_table = @blah; +select @@innodb_ft_aux_table; +@@innodb_ft_aux_table +test/t1 +set @blah = 'test/t2'; +SET GLOBAL innodb_ft_aux_table = @blah; +SET GLOBAL innodb_ft_aux_table = NULL; +select @@innodb_ft_aux_table; +@@innodb_ft_aux_table +NULL +SET GLOBAL innodb_ft_aux_table =default; +select @@innodb_ft_aux_table; +@@innodb_ft_aux_table +NULL +drop table t1,t2; diff --git a/mysql-test/suite/innodb/r/innodb_timeout_rollback.result b/mysql-test/suite/innodb/r/innodb_timeout_rollback.result new file mode 100644 index 00000000..30db5a21 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_timeout_rollback.result @@ -0,0 +1,44 @@ +drop table if exists t1; +show variables like 'innodb_rollback_on_timeout'; +Variable_name Value +innodb_rollback_on_timeout ON +create table t1 (a int unsigned not null primary key) engine = innodb; +insert into t1 values (1); +commit; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con2; +begin work; +insert into t1 values (2); +select * from t1; +a +1 +2 +connection con1; +begin work; +insert into t1 values (5); +select * from t1; +a +1 +5 +insert into t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +a +1 +commit; +connection con2; +select * from t1; +a +1 +2 +commit; +connection default; +select * from t1; +a +1 +2 +drop table t1; +disconnect con1; +disconnect con2; +End of 5.0 tests diff --git a/mysql-test/suite/innodb/r/innodb_trx_weight.result b/mysql-test/suite/innodb/r/innodb_trx_weight.result new file mode 100644 index 00000000..23c5b0cc --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_trx_weight.result @@ -0,0 +1 @@ +SET default_storage_engine=InnoDB; diff --git a/mysql-test/suite/innodb/r/innodb_uninstall.result b/mysql-test/suite/innodb/r/innodb_uninstall.result new file mode 100644 index 00000000..40c76b41 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_uninstall.result @@ -0,0 +1,34 @@ +install plugin innodb soname 'ha_innodb'; +create table t1(a int not null primary key) engine=innodb; +connect con1, localhost, root; +connection con1; +begin; +insert into t1 values(1); +connection default; +flush tables; +uninstall plugin innodb; +connection con1; +select sleep(1); +sleep(1) +0 +disconnect con1; +connection default; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown +connect con1, localhost, root; +connection con1; +install plugin innodb soname 'ha_innodb'; +drop table t1; +create table t2(a int not null primary key) engine=innodb; +insert into t2 values(1); +drop table t2; +connection default; +uninstall plugin innodb; +connection con1; +select sleep(1); +sleep(1) +0 +disconnect con1; +connection default; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown diff --git a/mysql-test/suite/innodb/r/insert-before-delete.result b/mysql-test/suite/innodb/r/insert-before-delete.result new file mode 100644 index 00000000..f2d2d260 --- /dev/null +++ b/mysql-test/suite/innodb/r/insert-before-delete.result @@ -0,0 +1,35 @@ +connect pause_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t VALUES (10, 100); +connect con1,localhost,root; +BEGIN; +SELECT * FROM t WHERE sk = 100 FOR UPDATE; +pk sk +10 100 +connect con2,localhost,root; +SET DEBUG_SYNC="lock_wait_start SIGNAL insert_wait_started"; +INSERT INTO t VALUES (5, 100) # trx 1; +connect con3,localhost,root; +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SET DEBUG_SYNC="now WAIT_FOR insert_wait_started"; +SET DEBUG_SYNC="lock_wait_start SIGNAL delete_started_waiting"; +DELETE FROM t WHERE sk = 100 # trx 2; +connection con1; +SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting"; +DELETE FROM t WHERE sk=100; +COMMIT; +disconnect con1; +connection con2; +disconnect con2; +connection con3; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con3; +connection default; +SELECT * FROM t; +pk sk +5 100 +disconnect pause_purge; +SET DEBUG_SYNC="RESET"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/insert_debug.result b/mysql-test/suite/innodb/r/insert_debug.result new file mode 100644 index 00000000..3ac9df58 --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_debug.result @@ -0,0 +1,31 @@ +# +# Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1 +# CAUSES INFINITE PAGE SPLIT +# +SET GLOBAL innodb_change_buffering_debug=1; +SET GLOBAL innodb_limit_optimistic_insert_debug=1; +CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB +PARTITION BY HASH (c1) PARTITIONS 15; +DROP TABLE t1; +SET GLOBAL innodb_change_buffering_debug=0; +SET GLOBAL innodb_limit_optimistic_insert_debug=0; +# +# Bug#25082593 FOREIGN KEY VALIDATION DOESN'T NEED +# TO ACQUIRE GAP LOCK IN READ COMMITTED +# +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +CREATE TABLE t1(col1 INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE t2(col1 INT PRIMARY KEY, col2 INT NOT NULL, +FOREIGN KEY(col2) REFERENCES t1(col1)) ENGINE=INNODB; +INSERT INTO t1 VALUES(1), (3), (4); +connect con1,localhost,root; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +START TRANSACTION; +INSERT INTO t2 VALUES(1, 3); +connection default; +START TRANSACTION; +INSERT INTO t1 VALUES(2); +disconnect con1; +SET GLOBAL innodb_limit_optimistic_insert_debug=0; +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff new file mode 100644 index 00000000..9d40decb --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff @@ -0,0 +1,9 @@ +@@ -377,8 +377,6 @@ + c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; + SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; + ALTER TABLE t1 FORCE; +-Warnings: +-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT IGNORE INTO t1 VALUES + (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), + (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); diff --git a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff new file mode 100644 index 00000000..baa017ec --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff @@ -0,0 +1,2 @@ +423a424 +> ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff new file mode 100644 index 00000000..9d40decb --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff @@ -0,0 +1,9 @@ +@@ -377,8 +377,6 @@ + c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; + SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; + ALTER TABLE t1 FORCE; +-Warnings: +-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT IGNORE INTO t1 VALUES + (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), + (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result new file mode 100644 index 00000000..0cdee172 --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -0,0 +1,469 @@ +SET foreign_key_checks=0, unique_checks=0; +# +# MDEV-24715 Assertion !node->table->skip_alter_undo +# +CREATE TABLE t (a INT UNIQUE) ENGINE=InnoDB +REPLACE SELECT 1 AS a, 2 AS b UNION SELECT 1 AS a, 3 AS c; +SELECT * FROM t; +a b +1 3 +DROP TABLE t; +CREATE TEMPORARY TABLE t (a INT UNIQUE) ENGINE=InnoDB +REPLACE SELECT 1 AS a, 2 AS b UNION SELECT 1 AS a, 3 AS c; +SELECT * FROM t; +a b +1 3 +DROP TEMPORARY TABLE t; +# +# MDEV-24720 AHI removal during bulk index rollback +# +SET @save_ahi = @@global.innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index = 1; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 SELECT * FROM seq_1_to_65536; +ROLLBACK; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +# +# MDEV-24832 Root page AHI Removal fails fails during +# bulk index rollback +# +BEGIN; +INSERT INTO t1 SELECT * FROM seq_1_to_500; +ROLLBACK; +DROP TABLE t1; +SET GLOBAL innodb_adaptive_hash_index = @save_ahi; +# +# MDEV-24951 Assertion m.first->second.valid(trx->undo_no) failed +# in trx_undo_report_row_operation +# +CREATE TEMPORARY TABLE t (c INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB; +SET tx_read_only=1; +BEGIN; +INSERT INTO t2 VALUES(0); +INSERT INTO t VALUES(0); +ROLLBACK; +BEGIN; +INSERT INTO t2 VALUES(0); +INSERT INTO t VALUES(0); +COMMIT; +INSERT INTO t VALUES(0); +DROP TEMPORARY TABLE t,t2; +ERROR 25006: Cannot execute statement in a READ ONLY transaction +SET tx_read_only=0; +DROP TEMPORARY TABLE t,t2; +# +# MDEV-24818 Optimize multiple INSERT into empty table +# +CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES (5),(6),(7); +INSERT INTO t1 VALUES (4),(5),(6); +ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +COMMIT; +SELECT * FROM t1; +f1 +BEGIN; +INSERT INTO t1 VALUES (5),(6),(7); +SAVEPOINT a; +INSERT INTO t1 VALUES (4),(5),(6); +ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +ROLLBACK TO SAVEPOINT a; +COMMIT; +SELECT * FROM t1; +f1 +5 +6 +7 +DROP TABLE t1; +SET foreign_key_checks=1; +CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES (5),(6),(7); +INSERT INTO t1 VALUES (4),(5),(6); +ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +COMMIT; +SELECT * FROM t1; +f1 +5 +6 +7 +BEGIN; +INSERT INTO t1 VALUES (5),(6),(7); +ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +SAVEPOINT a; +INSERT INTO t1 VALUES (4),(5),(6); +ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +ROLLBACK TO SAVEPOINT a; +COMMIT; +SELECT * FROM t1; +f1 +5 +6 +7 +DROP TABLE t1; +SET foreign_key_checks=0; +# +# MDEV-25315 Crash in SHOW ENGINE INNODB STATUS +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +BEGIN; +INSERT INTO t1 VALUES(1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO t2 VALUES(0); +INSERT INTO t1 VALUES(2), (2); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +SHOW ENGINE InnoDB STATUS; +COMMIT; +DROP TABLE t1,t2; +# +# MDEV-25297 Assertion: trx->roll_limit <= trx->undo_no +# in ROLLBACK TO SAVEPOINT +# +CREATE TABLE t1 (c INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (c INT PRIMARY KEY) ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(0); +SAVEPOINT x; +INSERT INTO t2 VALUES(0); +INSERT INTO t1 VALUES(0); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +ROLLBACK TO SAVEPOINT x; +ERROR HY000: Got error 153 "No savepoint with that name" during ROLLBACK +COMMIT; +SELECT * FROM t1; +c +SELECT * FROM t2; +c +DROP TABLE t1,t2; +# +# MDEV-25487 Assertion failed in lock_rec_move +# +CREATE TABLE t1 (a INT KEY) ENGINE=InnoDB; +SET @save_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug = 2; +BEGIN; +SELECT * FROM t1 LOCK IN SHARE MODE; +a +INSERT INTO t1 VALUES (0),(1),(2); +INSERT INTO t1 VALUES (0,1); +ERROR 21S01: Column count doesn't match value count at row 1 +INSERT INTO t1 VALUES (2); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +COMMIT; +SET GLOBAL innodb_limit_optimistic_insert_debug = @save_limit; +SELECT * FROM t1; +a +0 +1 +2 +DROP TABLE t1; +# +# MDEV-25534 Assertion lock_table_has...LOCK_IX +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +SET autocommit=0; +LOCK TABLE t1 WRITE; +INSERT INTO t1 VALUES (1); +COMMIT; +CREATE TEMPORARY TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t0 VALUES (1); +INSERT INTO t1 VALUES (2); +COMMIT; +SET autocommit=1; +DROP TABLE t1; +DROP TEMPORARY TABLE t0; +# +# MDEV-25496 Assertion 'trx->bulk_insert' failed +# in trx_undo_report_row_operation on INSERT +# +CREATE TABLE t (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2; +INSERT INTO t VALUES (0); +INSERT INTO t VALUES (1),(0),(1); +DROP TABLE t; +# +# MDEV-28327 InnoDB persistent statistics fail to update +# after bulk insert +# +CREATE TABLE t1 (a INT PRIMARY KEY)ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO t1 SELECT * FROM seq_1_to_4096; +# Wait till statistics update after bulk insert operation +SELECT n_rows>=4000 FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1"; +n_rows>=4000 +1 +DROP TABLE t1; +# +# MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ... +# +CREATE TABLE `t1` ( +`id` int(11) NOT NULL, +`a` int(11) DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO `t1` VALUES (1,2),(2,3),(3,4); +# Wait till statistics update after bulk insert operation +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; +TABLE_ROWS AVG_ROW_LENGTH>0 +3 1 +DROP TABLE t1; +# +# MDEV-29975 InnoDB fails to release savepoint during bulk insert +# +CREATE TABLE t (c INT KEY) ENGINE=InnoDB; +begin; +INSERT INTO t VALUES (0,0); +ERROR 21S01: Column count doesn't match value count at row 1 +SAVEPOINT a; +INSERT INTO t VALUES (0),(0); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +SAVEPOINT a; +commit; +SELECT * FROM t; +c +DROP TABLE t; +# +# MDEV-29545 InnoDB: Can't find record during replace stmt +# +CREATE TABLE t1(c1 INT PRIMARY KEY)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(3331); +connect con1,localhost,root,,,; +BEGIN; +SELECT c1 FROM t1; +c1 +connection default; +COMMIT; +connection con1; +REPLACE INTO t1 VALUES(1984), (1984); +COMMIT; +connection default; +disconnect con1; +SELECT * FROM t1; +c1 +1984 +3331 +DROP TABLE t1; +# End of 10.6 tests +# +# MDEV-26947 UNIQUE column checks fail in InnoDB resulting +# in table corruption +# +CREATE TABLE t (c1 INT KEY,c2 INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t VALUES (1,0),(2,0); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +COMMIT; +DROP TABLE t; +CREATE TABLE t (i INT UNIQUE)ENGINE=InnoDB; +INSERT INTO t VALUES (0),(0); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +DROP TABLE t; +CREATE TABLE t (c INT PRIMARY KEY,c2 CHAR(1) UNIQUE)ENGINE=InnoDB; +BEGIN; +INSERT INTO t VALUES(1, ''),(2, ''); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +SELECT * FROM t; +c c2 +DELETE FROM t; +COMMIT; +DROP TABLE t; +# +# MDEV-26956 LeakSanitizer/Valgrind errors in +# trx_mod_table_time_t::start_bulk_insert +# upon adding system versioning +# +CREATE TABLE t1(id INT, s DATE, e DATE, PERIOD FOR p(s,e), +PRIMARY KEY(id, p WITHOUT OVERLAPS)) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN row_start BIGINT UNSIGNED AS ROW START, +ADD COLUMN row_end BIGINT UNSIGNED AS ROW END, +ADD PERIOD FOR SYSTEM_TIME(row_start,row_end), WITH SYSTEM VERSIONING; +DROP TABLE t1; +# +# MDEV-27316 Assertion `!(index)->is_spatial()' failed. +# +CREATE TABLE t (c POINT NOT NULL, SPATIAL INDEX(c)) ENGINE=InnoDB; +INSERT INTO t VALUES (POINT(1, 1)); +SELECT COUNT(*) FROM t WHERE MBRWithin(t.c, POINT(1,1)); +COUNT(*) +1 +DROP TABLE t; +# +# MDEV-27318 Assertion data_size < srv_sort_buf_size failed in row_merge_bulk_buf_add +# +CREATE TABLE t1(f1 MEDIUMTEXT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(REPEAT(1, 8459264)); +SELECT length(f1) FROM t1; +length(f1) +8459264 +DROP TABLE t1; +# +# MDEV-27858 Assertion `page_dir_get_n_heap(new_page) == 2U' failed in PageBulk::init +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +LOCK TABLES t1 WRITE,t2 WRITE; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +DROP TABLE t2, t1; +# +# MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space +# +CREATE TABLE t1( +f1 SERIAL, +f2 LINESTRING NOT NULL DEFAULT LineFromText('LINESTRING(1 1,2 2,3 3)'), +SPATIAL INDEX(f2))ENGINE=InnoDB; +INSERT INTO t1(f1) VALUES(0), (1), (2); +ERROR 23000: Duplicate entry '1' for key 'f1' +DROP TABLE t1; +# +# MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE +# +CREATE TABLE t1 (c0 YEAR UNIQUE) ENGINE=InnoDB; +INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(0),(0); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +DELETE FROM t1; +DROP TABLE t1; +# +# MDEV-28037 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=InnoDB; +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW UPDATE t2 SET c=1; +INSERT INTO t1 VALUES (0); +SELECT * FROM t1; +c +0 +SELECT * FROM t2; +c +DROP TABLE t2, t1; +# +# MDEV-28242 Assertion `!check_foreigns' failed in +# trx_t::check_bulk_buffer +# +CREATE TABLE t1 (c INT)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(1), (1); +SET SESSION foreign_key_checks=TRUE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE TABLE t2(d INT)ENGINE=InnoDB; +DROP TABLE t2, t1; +# +# MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert +# +SET SESSION foreign_key_checks=0; +CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2; +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; +# +# MDEV-29570 InnoDB fails to clean bulk buffer when server +# does rollback operation +# +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB +PARTITION BY RANGE (pk) ( +PARTITION pn VALUES LESS THAN (20)); +INSERT INTO t1 VALUES (1),(21); +ERROR HY000: Table has no partition for value 21 +DROP TABLE t1; +# +# MDEV-29761 Bulk insert fails to rollback +# during insert..select +# +CREATE TABLE t1 (f1 INT)ENGINE=InnoDB; +CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB; +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1); +BEGIN; +INSERT t1 SELECT 1 FROM seq_1_to_2; +COMMIT; +SELECT * FROM t1; +f1 +SELECT * FROM t2; +f1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t1, t2; +# +# MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk +# insert operation +# +call mtr.add_suppression("InnoDB: Cannot add field `(c0[36]|c11)` in table"); +SET @format= @@innodb_default_row_format; +CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text, +c04 text, c05 text, c06 text, c07 text, c08 text, +c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; +ALTER TABLE t1 FORCE; +Warnings: +Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +INSERT IGNORE INTO t1 VALUES +(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), +(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format; +# +# MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file() +# +CREATE TABLE t1 ( +`id` int(11) NOT NULL, +`data` LONGBLOB NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1, REPEAT('X', @@innodb_sort_buffer_size)), +(2, REPEAT('X', @@innodb_sort_buffer_size)); +SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size); +nb_corrupted_rows +0 +DROP TABLE t1; +# End of 10.7 tests +# +# MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) +# during bulk insert +# +CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL, +f3 TEXT NOT NULL, f4 TEXT NOT NULL, +f5 TEXT NOT NULL, f6 TEXT NOT NULL, +PRIMARY KEY(f6(10)))ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES +(repeat('a', 200), repeat('b', 200), repeat('c', 200), +repeat('d', 200), repeat('e', 200), repeat('f', 200)), +(repeat('b', 20000), repeat('c', 16000), repeat('d', 12000), +repeat('e', 12000), repeat('f', 12000), repeat('f', 12000)); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +COMMIT; +DROP TABLE t1; +# End of 10.8 tests +# +# MDEV-31537 Bulk insert operation aborts the server +# for redundant table +# +CREATE TABLE t (a CHAR CHARACTER SET utf8) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT t SELECT left(seq,1) FROM seq_1_to_43691; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/insert_into_empty_debug.result b/mysql-test/suite/innodb/r/insert_into_empty_debug.result new file mode 100644 index 00000000..d9874802 --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty_debug.result @@ -0,0 +1,32 @@ +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 2), (2, 2); +SET DEBUG_SYNC="innodb_rollback_inplace_alter_table SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD UNIQUE KEY(f2); +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +DELETE FROM t1; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry '2' for key 'f2' +connection con1; +COMMIT; +TRUNCATE TABLE t1; +SET unique_checks=0, foreign_key_checks=0; +BEGIN; +INSERT INTO t1 VALUES(1, 2); +ROLLBACK; +connection default; +SELECT * FROM t1; +f1 f2 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +disconnect con1; +DROP TABLE t1; +SET DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result b/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result new file mode 100644 index 00000000..585a2e6c --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty_notembedded.result @@ -0,0 +1,59 @@ +# +# Start of 10.6 tests +# +# +# MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ... +# +CREATE DATABASE db1; +CREATE TABLE db1.t1 (id int, a int,PRIMARY KEY (id)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO db1.t1 VALUES (1,2),(2,3),(3,4); +DROP DATABASE IF EXISTS db1; +CREATE DATABASE db1; +# Wait till statistics update after bulk insert operation +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1'; +TABLE_ROWS AVG_ROW_LENGTH>0 +3 1 +OPTIMIZE TABLE db1.t1; +Table Op Msg_type Msg_text +db1.t1 optimize note Table does not support optimize, doing recreate + analyze instead +db1.t1 optimize status OK +# Wait till statistics update after bulk insert operation +SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1'; +TABLE_ROWS AVG_ROW_LENGTH>0 +3 1 +DROP DATABASE db1; +# +# End of 10.6 tests +# +SET foreign_key_checks=0, unique_checks=0; +# +# MDEV-30796 Auto_increment values not updated after bulk +# insert operation +# +CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT, +f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL AUTO_INCREMENT, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL AUTO_INCREMENT, + `f2` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1(f2) VALUES(5); +SELECT max(f1) FROM t1; +max(f1) +26 +DROP TABLE t1; +# End of 10.9 tests diff --git a/mysql-test/suite/innodb/r/instant_alter,32k.rdiff b/mysql-test/suite/innodb/r/instant_alter,32k.rdiff new file mode 100644 index 00000000..892b216b --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter,32k.rdiff @@ -0,0 +1,111 @@ +@@ -5,7 +5,7 @@ + SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; + call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); + CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT; +-ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED; ++ALTER TABLE t ADD e INT, ROW_FORMAT=DYNAMIC; + INSERT INTO t SET a=1; + SET @old_instant= + (SELECT variable_value FROM information_schema.global_status +@@ -36,17 +36,17 @@ + `c` int(11) NOT NULL, + `d` int(11) NOT NULL, + UNIQUE KEY `a` (`a`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC + SELECT variable_value-@old_instant instants + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-0 ++1 + SELECT variable_value-@old_instant instants + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-0 ++1 + DROP TABLE t; + connect analyze, localhost, root; + connection default; +@@ -404,7 +404,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -428,7 +428,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++5 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -442,7 +442,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -1326,7 +1326,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -1350,7 +1350,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++5 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -1364,7 +1364,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -2248,7 +2248,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -2272,7 +2272,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++5 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -2286,7 +2286,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff new file mode 100644 index 00000000..ab12a246 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -0,0 +1,322 @@ +@@ -244,7 +244,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++6 + connection default; + ROLLBACK; + connection analyze; +@@ -255,7 +255,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + BEGIN; + UPDATE t2 SET d1 = repeat(id, 200); +@@ -267,7 +267,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + ROLLBACK; + connection analyze; +@@ -278,11 +278,17 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + ALTER TABLE t2 DROP p; ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1979. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ++SET innodb_strict_mode = OFF; ++ALTER TABLE t2 DROP p; + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++SET innodb_strict_mode = ON; + SELECT * FROM t2; + id c1 d1 + 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +@@ -330,8 +336,14 @@ + affected rows: 0 + info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1979. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ++SET innodb_strict_mode = OFF; + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT INTO t3 SET id=4; + ERROR HY000: Field 'c2' doesn't have a default value + INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; +@@ -344,7 +356,9 @@ + ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, + CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; + affected rows: 4 +-info: Records: 4 Duplicates: 0 Warnings: 0 ++info: Records: 4 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT INTO t3 SET id=5, c2=9; + Warnings: + Note 1265 Data truncated for column 'c7' at row 1 +@@ -358,7 +372,9 @@ + 5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business + ALTER TABLE t3 DROP c3, DROP c7; + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + SELECT * FROM t3; + id c2 c4 c5 c6 c8 phrase b + 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +@@ -386,6 +402,8 @@ + (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), + p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) + ENGINE=InnoDB ROW_FORMAT=REDUNDANT; ++Warnings: ++Warning 139 Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + BEGIN; + INSERT INTO big + SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); +@@ -404,13 +422,15 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++8 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', + d3 TIMESTAMP NOT NULL DEFAULT current_timestamp ON UPDATE current_timestamp); + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECKSUM TABLE big; + Table Checksum + test.big 1705165209 +@@ -428,7 +448,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++28 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -442,7 +462,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++8 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -1166,7 +1186,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++6 + connection default; + ROLLBACK; + connection analyze; +@@ -1177,7 +1197,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + BEGIN; + UPDATE t2 SET d1 = repeat(id, 200); +@@ -1189,7 +1209,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + ROLLBACK; + connection analyze; +@@ -1200,11 +1220,13 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + ALTER TABLE t2 DROP p; + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + SELECT * FROM t2; + id c1 d1 + 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +@@ -1253,7 +1275,9 @@ + info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT INTO t3 SET id=4; + ERROR HY000: Field 'c2' doesn't have a default value + INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; +@@ -1266,7 +1290,9 @@ + ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, + CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; + affected rows: 4 +-info: Records: 4 Duplicates: 0 Warnings: 0 ++info: Records: 4 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + INSERT INTO t3 SET id=5, c2=9; + Warnings: + Note 1265 Data truncated for column 'c7' at row 1 +@@ -1280,7 +1306,9 @@ + 5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business + ALTER TABLE t3 DROP c3, DROP c7; + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + SELECT * FROM t3; + id c2 c4 c5 c6 c8 phrase b + 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +@@ -1308,6 +1336,8 @@ + (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), + p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) + ENGINE=InnoDB ROW_FORMAT=COMPACT; ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + BEGIN; + INSERT INTO big + SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); +@@ -1326,13 +1356,15 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++7 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', + d3 TIMESTAMP NOT NULL DEFAULT current_timestamp ON UPDATE current_timestamp); + affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++info: Records: 0 Duplicates: 0 Warnings: 1 ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECKSUM TABLE big; + Table Checksum + test.big 1705165209 +@@ -1350,7 +1382,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++23 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -1364,7 +1396,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++7 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -2088,7 +2120,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++6 + connection default; + ROLLBACK; + connection analyze; +@@ -2099,7 +2131,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + BEGIN; + UPDATE t2 SET d1 = repeat(id, 200); +@@ -2111,7 +2143,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + ROLLBACK; + connection analyze; +@@ -2122,7 +2154,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++4 + connection default; + ALTER TABLE t2 DROP p; + affected rows: 0 +@@ -2248,7 +2280,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++7 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -2272,7 +2304,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++23 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -2286,7 +2318,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++7 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -2836,6 +2868,6 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-209 ++211 + SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; + # diff --git a/mysql-test/suite/innodb/r/instant_alter,64k.rdiff b/mysql-test/suite/innodb/r/instant_alter,64k.rdiff new file mode 100644 index 00000000..919f23d1 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter,64k.rdiff @@ -0,0 +1,111 @@ +@@ -5,7 +5,7 @@ + SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; + call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); + CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT; +-ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED; ++ALTER TABLE t ADD e INT, ROW_FORMAT=DYNAMIC; + INSERT INTO t SET a=1; + SET @old_instant= + (SELECT variable_value FROM information_schema.global_status +@@ -36,17 +36,17 @@ + `c` int(11) NOT NULL, + `d` int(11) NOT NULL, + UNIQUE KEY `a` (`a`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC + SELECT variable_value-@old_instant instants + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-0 ++1 + SELECT variable_value-@old_instant instants + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-0 ++1 + DROP TABLE t; + connect analyze, localhost, root; + connection default; +@@ -404,7 +404,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -428,7 +428,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++3 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -442,7 +442,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -1326,7 +1326,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -1350,7 +1350,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++3 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -1364,7 +1364,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -2248,7 +2248,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -2272,7 +2272,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++3 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -2286,7 +2286,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++1 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; diff --git a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff new file mode 100644 index 00000000..3babe020 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff @@ -0,0 +1,189 @@ +@@ -244,7 +244,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++5 + connection default; + ROLLBACK; + connection analyze; +@@ -255,7 +255,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + BEGIN; + UPDATE t2 SET d1 = repeat(id, 200); +@@ -267,7 +267,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + ROLLBACK; + connection analyze; +@@ -278,7 +278,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + ALTER TABLE t2 DROP p; + affected rows: 0 +@@ -404,7 +404,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++5 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -428,7 +428,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++13 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -442,7 +442,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++5 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -1166,7 +1166,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++5 + connection default; + ROLLBACK; + connection analyze; +@@ -1177,7 +1177,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + BEGIN; + UPDATE t2 SET d1 = repeat(id, 200); +@@ -1189,7 +1189,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + ROLLBACK; + connection analyze; +@@ -1200,7 +1200,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + ALTER TABLE t2 DROP p; + affected rows: 0 +@@ -1326,7 +1326,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++5 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -1350,7 +1350,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++13 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -1364,7 +1364,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++5 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; +@@ -2088,7 +2088,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++5 + connection default; + ROLLBACK; + connection analyze; +@@ -2099,7 +2099,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + BEGIN; + UPDATE t2 SET d1 = repeat(id, 200); +@@ -2111,7 +2111,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + ROLLBACK; + connection analyze; +@@ -2122,7 +2122,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/t2'; + clust_index_size +-1 ++3 + connection default; + ALTER TABLE t2 DROP p; + affected rows: 0 +@@ -2248,7 +2248,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++5 + connection default; + ALTER TABLE big ADD COLUMN + (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +@@ -2272,7 +2272,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-7 ++13 + connection default; + ROLLBACK; + CHECKSUM TABLE big; +@@ -2286,7 +2286,7 @@ + SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS + WHERE name = 'test/big'; + clust_index_size +-3 ++5 + connection default; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,t4,big; diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result new file mode 100644 index 00000000..8670b994 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -0,0 +1,2939 @@ +# +# MDEV-11369: Instant ADD COLUMN for InnoDB +# +SET @saved_allowance = @@GLOBAL.innodb_instant_alter_column_allowed; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; +call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); +CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED; +INSERT INTO t SET a=1; +SET @old_instant= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'); +ALTER TABLE t ADD b INT NOT NULL, ALGORITHM=COPY; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t ADD c INT NOT NULL, FORCE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +0 +ALTER TABLE t ADD d INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t; +a e b c d +1 NULL 0 0 0 +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `e` int(11) DEFAULT NULL, + `b` int(11) NOT NULL, + `c` int(11) NOT NULL, + `d` int(11) NOT NULL, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +0 +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +0 +DROP TABLE t; +connect analyze, localhost, root; +connection default; +SET timestamp = 42; +SET time_zone='+03:00'; +SET @old_instant= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'); +CREATE TABLE t1 +(id INT PRIMARY KEY, c2 INT UNIQUE, +c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), +SPATIAL INDEX(c3)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 (id, c2) values(1,1); +SELECT id,c2,ST_AsText(c3) c3 FROM t1; +id c2 c3 +1 1 POINT(3 4) +ALTER TABLE t1 ADD COLUMN ( +d1 INT, d2 INT UNSIGNED DEFAULT 10, d3 VARCHAR(20) NOT NULL DEFAULT 'abcde', +d4 TIMESTAMP NOT NULL DEFAULT current_timestamp()); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD INDEX(d3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +BEGIN; +UPDATE t1 SET d3=''; +ROLLBACK; +SELECT id,c2,ST_AsText(c3) c3, d1, d2, d3, d4 FROM t1; +id c2 c3 d1 d2 d3 d4 +1 1 POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +INSERT INTO t1 (id) VALUES(2),(3),(4),(5),(6); +ALTER TABLE t1 CHANGE d1 d1 INT DEFAULT 5, CHANGE d2 d2 INT DEFAULT 15, +CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'fghij', +CHANGE d4 dfour TIMESTAMP NOT NULL DEFAULT now(); +affected rows: 6 +info: Records: 6 Duplicates: 0 Warnings: 0 +UPDATE t1 SET d3='foo' WHERE id = 2; +UPDATE t1 SET d3=DEFAULT WHERE id = 4; +INSERT INTO t1 SET id = 7; +SELECT id,c2,ST_AsText(c3) c3, d1, d2, d3, dfour FROM t1; +id c2 c3 d1 d2 d3 dfour +1 1 POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +2 NULL POINT(3 4) NULL 10 foo 1970-01-01 03:00:42 +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +4 NULL POINT(3 4) NULL 10 fghij 1970-01-01 03:00:42 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +6 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +7 NULL POINT(3 4) 5 15 fghij 1970-01-01 03:00:42 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD COLUMN e1 INT AS (id * 3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN e2 VARCHAR(30) AS (d3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN e3 INT AS (id * 2); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'foobar', +ADD COLUMN (d5 CHAR(20) DEFAULT 'hijkl', d6 INT DEFAULT -12345, d7 INT), +DROP INDEX d3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t1 SET id = 8; +UPDATE t1 SET d3 = 'yyyyy' WHERE id = 1; +UPDATE t1 SET d3 = 'xxxxx' WHERE id = 2; +BEGIN; +UPDATE t1 SET d3 = 'xxxxx' WHERE id = 3; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 3; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +3 NULL POINT(3 4) NULL 10 xxxxx 1970-01-01 03:00:42 9 xxxxx 6 hijkl -12345 NULL +ROLLBACK; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 3; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL +BEGIN; +UPDATE t1 SET d7 = NULL WHERE ID = 5; +ROLLBACK; +BEGIN; +UPDATE t1 SET d7 = NULL, d6 = 10 WHERE id = 5; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 5; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl 10 NULL +ROLLBACK; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 5; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL +ALTER TABLE t1 ADD COLUMN (f1 VARCHAR(20) AS (concat('x', e2)) STORED); +affected rows: 8 +info: Records: 8 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN (d8 VARCHAR(20) DEFAULT 'omnopq'); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7, f1, d8 FROM t1; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 +1 1 POINT(3 4) NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq +2 NULL POINT(3 4) NULL 10 xxxxx 1970-01-01 03:00:42 6 xxxxx 4 hijkl -12345 NULL xxxxxx omnopq +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL xabcde omnopq +4 NULL POINT(3 4) NULL 10 fghij 1970-01-01 03:00:42 12 fghij 8 hijkl -12345 NULL xfghij omnopq +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL xabcde omnopq +6 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 18 abcde 12 hijkl -12345 NULL xabcde omnopq +7 NULL POINT(3 4) 5 15 fghij 1970-01-01 03:00:42 21 fghij 14 hijkl -12345 NULL xfghij omnopq +8 NULL POINT(3 4) 5 15 foobar 1970-01-01 03:00:42 24 foobar 16 hijkl -12345 NULL xfoobar omnopq +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` point NOT NULL DEFAULT st_geometryfromtext('POINT(3 4)'), + `d1` int(11) DEFAULT 5, + `d2` int(11) DEFAULT 15, + `d3` varchar(20) NOT NULL DEFAULT 'foobar', + `dfour` timestamp NOT NULL DEFAULT current_timestamp(), + `e1` int(11) GENERATED ALWAYS AS (`id` * 3) VIRTUAL, + `e2` varchar(30) GENERATED ALWAYS AS (`d3`) VIRTUAL, + `e3` int(11) GENERATED ALWAYS AS (`id` * 2) VIRTUAL, + `d5` char(20) DEFAULT 'hijkl', + `d6` int(11) DEFAULT -12345, + `d7` int(11) DEFAULT NULL, + `f1` varchar(20) GENERATED ALWAYS AS (concat('x',`e2`)) STORED, + `d8` varchar(20) DEFAULT 'omnopq', + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`), + SPATIAL KEY `c3` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +ALTER TABLE t1 +CHANGE c2 c2 INT DEFAULT 42, +CHANGE d1 d1 INT DEFAULT 1, +CHANGE d2 d2 INT DEFAULT 20, +CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'boofar'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t1 SET id=9; +ALTER TABLE t1 DROP c3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT 42, + `d1` int(11) DEFAULT 1, + `d2` int(11) DEFAULT 20, + `d3` varchar(20) NOT NULL DEFAULT 'boofar', + `dfour` timestamp NOT NULL DEFAULT current_timestamp(), + `e1` int(11) GENERATED ALWAYS AS (`id` * 3) VIRTUAL, + `e2` varchar(30) GENERATED ALWAYS AS (`d3`) VIRTUAL, + `e3` int(11) GENERATED ALWAYS AS (`id` * 2) VIRTUAL, + `d5` char(20) DEFAULT 'hijkl', + `d6` int(11) DEFAULT -12345, + `d7` int(11) DEFAULT NULL, + `f1` varchar(20) GENERATED ALWAYS AS (concat('x',`e2`)) STORED, + `d8` varchar(20) DEFAULT 'omnopq', + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SELECT * FROM t1; +id c2 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 +1 1 NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq +2 NULL NULL 10 xxxxx 1970-01-01 03:00:42 6 xxxxx 4 hijkl -12345 NULL xxxxxx omnopq +3 NULL NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL xabcde omnopq +4 NULL NULL 10 fghij 1970-01-01 03:00:42 12 fghij 8 hijkl -12345 NULL xfghij omnopq +5 NULL NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL xabcde omnopq +6 NULL NULL 10 abcde 1970-01-01 03:00:42 18 abcde 12 hijkl -12345 NULL xabcde omnopq +7 NULL 5 15 fghij 1970-01-01 03:00:42 21 fghij 14 hijkl -12345 NULL xfghij omnopq +8 NULL 5 15 foobar 1970-01-01 03:00:42 24 foobar 16 hijkl -12345 NULL xfoobar omnopq +9 42 1 20 boofar 1970-01-01 03:00:42 27 boofar 18 hijkl -12345 NULL xboofar omnopq +CREATE TABLE t2 +(id INT primary key, c1 VARCHAR(4000), +p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'), +SPATIAL INDEX(p)) +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +BEGIN; +INSERT INTO t2 SET id=1, c1=REPEAT('a', 4000); +INSERT INTO t2 SET id=2, c1=REPEAT('a', 4000), p=ST_GeomFromText('POINT(1 1)'); +COMMIT; +ALTER TABLE t2 ADD COLUMN d1 VARCHAR(2000) DEFAULT REPEAT('asdf',500); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c1, ST_AsText(p) p, d1 FROM t2; +id c1 p d1 +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa LINESTRING(0 0,0 1,1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa POINT(1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +BEGIN; +UPDATE t2 SET c1 = repeat(id, 4000); +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ROLLBACK; +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +BEGIN; +UPDATE t2 SET d1 = repeat(id, 200); +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ROLLBACK; +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ALTER TABLE t2 DROP p; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t2; +id c1 d1 +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +CREATE TABLE t3 +(id INT PRIMARY KEY, c2 INT UNSIGNED NOT NULL UNIQUE, +c3 POLYGON NOT NULL DEFAULT ST_PolyFromText('POLYGON((1 1,2 2,3 3,1 1))'), +SPATIAL INDEX(c3)) +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t3(id,c2) VALUES(1,1),(2,2),(3,3); +SELECT id, c2, ST_AsText(c3) c3 FROM t3; +id c2 c3 +1 1 POLYGON((1 1,2 2,3 3,1 1)) +2 2 POLYGON((1 1,2 2,3 3,1 1)) +3 3 POLYGON((1 1,2 2,3 3,1 1)) +ALTER TABLE t3 ADD COLUMN +(c4 DATETIME DEFAULT current_timestamp(), +c5 TIMESTAMP NOT NULL DEFAULT current_timestamp(), +c6 POINT); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6 FROM t3; +id c2 c3 c4 c5 c6 +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +affected rows: 3 +ALTER TABLE t3 ADD COLUMN c7 TIME NOT NULL DEFAULT current_timestamp(); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'c7' at row 0 +ALTER TABLE t3 ADD COLUMN c8 DATE NOT NULL DEFAULT current_timestamp(); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'c8' at row 0 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8 FROM t3; +id c2 c3 c4 c5 c6 c7 c8 +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +ALTER TABLE t3 ADD COLUMN t TEXT CHARSET utf8 +DEFAULT 'The quick brown fox jumps over the lazy dog'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t3 SET id=4; +ERROR HY000: Field 'c2' doesn't have a default value +INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; +affected rows: 1 +Warnings: +Note 1265 Data truncated for column 'c7' at row 1 +Note 1265 Data truncated for column 'c8' at row 1 +SET innodb_strict_mode = OFF; +affected rows: 0 +ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, +CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; +affected rows: 4 +info: Records: 4 Duplicates: 0 Warnings: 0 +INSERT INTO t3 SET id=5, c2=9; +Warnings: +Note 1265 Data truncated for column 'c7' at row 1 +Note 1265 Data truncated for column 'c8' at row 1 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8, phrase, b FROM t3; +id c2 c3 c4 c5 c6 c7 c8 phrase b +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +4 0 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog 😱 +5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business +ALTER TABLE t3 DROP c3, DROP c7; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t3; +id c2 c4 c5 c6 c8 phrase b +1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +2 2 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +3 3 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +4 0 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog 😱 +5 9 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 ääH binary line of business +CREATE TABLE t4 +(id INT, foo INT DEFAULT 0, c1 VARCHAR(4000), +p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'), +PRIMARY KEY(id,foo)) +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000)); +ALTER TABLE t4 ADD COLUMN d1 INT; +BEGIN; +UPDATE t4 SET c1 = repeat('1', 4000), foo=1 WHERE id=1; +INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)); +UPDATE t4 SET c1 = repeat('2', 4000), foo=1 WHERE id=2; +ROLLBACK; +BEGIN; +UPDATE t4 SET d1 = 1,foo=2 WHERE id=1; +INSERT INTO t4 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000)); +COMMIT; +CREATE TABLE big +(id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), +p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +BEGIN; +INSERT INTO big +SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); +SET @i:=1; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +COMMIT; +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +3 +connection default; +ALTER TABLE big ADD COLUMN +(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +d3 TIMESTAMP NOT NULL DEFAULT current_timestamp ON UPDATE current_timestamp); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +CHECKSUM TABLE big; +Table Checksum +test.big 1705165209 +BEGIN; +INSERT INTO big(id, c1, c2, c3) SELECT @i:=@i+1, c1, c2, c3 FROM big; +INSERT INTO big(id, c1, c2, c3) SELECT @i:=@i+1, c1, c2, c3 FROM big; +CHECKSUM TABLE big; +Table Checksum +test.big 385477733 +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +7 +connection default; +ROLLBACK; +CHECKSUM TABLE big; +Table Checksum +test.big 1705165209 +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +3 +connection default; +InnoDB 0 transactions not purged +DROP TABLE t1,t2,t3,t4,big; +CREATE TABLE t1 (a VARCHAR(1) PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a='a'; +ALTER TABLE t1 ADD COLUMN b INT NOT NULL DEFAULT 0; +UPDATE t1 SET b = 1; +INSERT INTO t1 SET a='a'; +ERROR 23000: Duplicate entry 'a' for key 'PRIMARY' +SELECT * FROM t1; +a b +a 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b VARCHAR(8), PRIMARY KEY(b,a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (1,'foo'); +ALTER TABLE t1 ADD COLUMN c INT; +UPDATE t1 SET c = 1; +UPDATE t1 SET c = 2; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY(b) REFERENCES t1(a)) +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a=1; +INSERT INTO t2 SET b=1; +ALTER TABLE t2 ADD COLUMN a INT, DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD INDEX(a); +ALTER TABLE t1 ADD COLUMN b INT, ADD FOREIGN KEY(a) REFERENCES t2(a), +ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY +SET foreign_key_checks=0; +ALTER TABLE t1 ADD COLUMN b INT, ADD FOREIGN KEY(a) REFERENCES t2(a), +ALGORITHM=INSTANT; +ALTER TABLE t2 ADD CONSTRAINT fk FOREIGN KEY(b) REFERENCES t1(a), +ALGORITHM=INSTANT; +SET foreign_key_checks=1; +ALTER TABLE t2 COMMENT 'domestic keys only', DROP FOREIGN KEY fk; +ALTER TABLE t1 DROP FOREIGN KEY t1_ibfk_1; +ALTER TABLE t1 ADD COLUMN big BLOB NOT NULL +DEFAULT REPEAT('a', @@GLOBAL.innodb_page_size * .75); +CHECK TABLE t2, t1; +Table Op Msg_type Msg_text +test.t2 check status OK +test.t1 check status OK +DROP TABLE t2, t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a = 1; +ALTER TABLE t1 ADD COLUMN b TEXT; +BEGIN; +UPDATE t1 SET b = REPEAT('1', 32768); +UPDATE t1 SET a = 2; +INSERT INTO t1 SET a = 1; +SELECT a,LENGTH(b) FROM t1; +a LENGTH(b) +1 NULL +2 32768 +DELETE FROM t1; +COMMIT; +InnoDB 0 transactions not purged +DROP TABLE t1; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (7); +ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 0; +ALTER TABLE t1 ADD INDEX (c); +BEGIN; +DELETE FROM t1; +INSERT INTO t1 VALUES (4,0),(7,77); +COMMIT; +BEGIN; +DELETE FROM t1 WHERE a=7; +UPDATE t1 SET a=7; +COMMIT; +SELECT * FROM t1 FORCE INDEX(PRIMARY); +a c +7 0 +SELECT * FROM t1 FORCE INDEX(c); +a c +7 0 +DELETE FROM t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET innodb_strict_mode = ON; +CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 ADD d TEXT; +ALTER TABLE t1 ADD PRIMARY KEY (b,a); +ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; +DROP TABLE t1; +SET innodb_strict_mode = OFF; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a=42; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +DROP TABLE t1; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; +CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 (a) VALUES (NULL), (NULL); +ALTER TABLE t1 DROP a, ADD COLUMN a INT; +DELETE FROM t1; +BEGIN; +INSERT INTO t1 SET a=NULL; +ROLLBACK; +DELETE FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, t VARCHAR(33101) NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(347,''); +ALTER TABLE t1 DROP COLUMN t, ALGORITHM=INSTANT; +SELECT * FROM t1; +a +347 +DROP TABLE t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1() VALUES(); +ALTER TABLE t1 ADD COLUMN b INT FIRST, ADD COLUMN c INT AFTER b; +SELECT * FROM t1; +b c a +NULL NULL NULL +DROP TABLE t1; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SET @t=REPEAT('x',@@innodb_page_size / 2); +INSERT INTO t1 VALUES (@t),(@t),(@t),(@t),(@t),(@t),(NULL),(@t),(@t),(@t),(@t); +ALTER TABLE t1 ADD COLUMN a INT FIRST; +UPDATE t1 SET a = 0; +DROP TABLE t1; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET t = @x; +ALTER TABLE t1 DROP COLUMN t, ADD COLUMN i INT NOT NULL DEFAULT 1; +ALTER TABLE t1 ADD COLUMN t TEXT; +SELECT * FROM t1; +i t +1 NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT AUTO_INCREMENT, b INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a=NULL; +ALTER TABLE t1 DROP COLUMN b; +ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 42; +INSERT INTO t1 SET a=NULL; +UPDATE t1 SET a=a+2; +SELECT * FROM t1; +a c +3 42 +4 42 +DROP TABLE t1; +CREATE TABLE t1 (i INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET i=1; +ALTER TABLE t1 ADD COLUMN b BIT FIRST; +ALTER TABLE t1 ADD COLUMN v INT AS (i) VIRTUAL; +SELECT * FROM t1; +b i v +NULL 1 1 +DROP TABLE t1; +CREATE TABLE t1 (ts TIMESTAMP) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 ADD COLUMN f VARCHAR(8), ADD COLUMN dt DATETIME; +ALTER TABLE t1 ADD COLUMN b BIT, DROP COLUMN f, ADD COLUMN t TIME FIRST; +ALTER TABLE t1 ADD COLUMN ts2 TIMESTAMP; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (4,4,4); +ALTER TABLE t1 DROP f1, DROP f2, ADD f4 INT, ADD f5 INT; +DELETE FROM t1; +ALTER TABLE t1 DROP COLUMN f4; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DROP f2, ADD COLUMN f4 INT; +ALTER TABLE t1 DROP f4; +ALTER TABLE t1 DROP f1; +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DROP COLUMN id; +INSERT INTO t1 () VALUES (),(); +SELECT * FROM t1; +f +NULL +NULL +ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id); +SELECT * FROM t1; +id f +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET f=NULL; +ALTER TABLE t1 DROP COLUMN id; +INSERT INTO t1 SET f=NULL; +SELECT * FROM t1; +f +NULL +NULL +DROP TABLE t1; +CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DROP COLUMN f; +INSERT INTO t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1(pk INT PRIMARY KEY, f INT, k INT AUTO_INCREMENT, KEY(k)) +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DROP COLUMN f; +INSERT INTO t1 (pk) VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, +f1 INT, +f2 CHAR(255), +f3 BIGINT, +f4 INT, +f5 CHAR(255), +f6 CHAR(255), +f7 CHAR(255) NOT NULL, +f8 INT, +f9 CHAR(10) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'), +(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'), +(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'), +(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'), +(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'), +(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'), +(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'), +(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'), +(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'), +(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'), +(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'), +(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'), +(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'), +(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'), +(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o'); +DELETE FROM t1 WHERE pk=1; +InnoDB 0 transactions not purged +INSERT INTO t1 VALUES +(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'); +ALTER TABLE t1 DROP COLUMN f1; +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, +f1 INT, f2 CHAR(32) NOT NULL, +f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL, +f7 CHAR(32), f8 CHAR(32) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''), +(3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''), +(5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''), +(7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''), +(9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''), +(11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''), +(13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''), +(15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''), +(17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''), +(19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''), +(21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''), +(23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''), +(25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''), +(51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''), +(53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''), +(55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''), +(57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''), +(59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''), +(61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''), +(63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''), +(101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''), +(103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''), +(105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''), +(107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''), +(109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''), +(151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''), +(153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''), +(155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''), +(157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''), +(159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''), +(201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''), +(203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''), +(205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''), +(207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''), +(252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''), +(254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''), +(256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''), +(258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''), +(301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''), +(303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''), +(305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''), +(307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''), +(351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''), +(353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''), +(355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''), +(357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''), +(359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''), +(361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''), +(363,75,'',66,76,52,'','',''); +ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar '; +UPDATE t1 SET f1 = 0; +ALTER TABLE t1 DROP COLUMN x; +DROP TABLE t1; +CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST; +DROP TABLE t1; +CREATE TABLE t1 (a INT UNIQUE, b INT UNIQUE, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DROP PRIMARY KEY; +ALTER TABLE t1 CHANGE COLUMN a a INT; +DELETE FROM t1 WHERE a = NULL OR a IS NULL; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT, +e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b; +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (0,0); +ALTER TABLE t1 MODIFY a INT AFTER b; +ALTER TABLE t1 ADD COLUMN v INT AS (a) VIRTUAL; +ALTER TABLE t1 MODIFY b INT NOT NULL AFTER a; +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN b INT; +ALTER TABLE t1 MODIFY COLUMN a INT NULL; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a=1; +ALTER TABLE t1 DROP c; +ALTER TABLE t1 DROP b, ADD v INT AS (a); +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a=1; +ALTER TABLE t1 DROP c; +ALTER TABLE t1 DROP b, ADD v INT AS (a); +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, b BLOB NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (1,10,REPEAT('foobar',2000)); +ALTER TABLE t1 DROP COLUMN b; +INSERT INTO t1 VALUES (2,20); +ALTER TABLE t1 ADD COLUMN vpk INT AS (pk); +ALTER TABLE t1 DROP COLUMN i; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (1,1); +ALTER TABLE t1 ADD f DATE AFTER a; +ALTER TABLE t1 DROP b, DROP f; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (1,1); +ALTER TABLE t1 ADD COLUMN f INT AFTER a; +ALTER TABLE t1 DROP b, DROP f; +DROP TABLE t1; +CREATE TABLE t1(t TEXT NOT NULL, FULLTEXT(t)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 MODIFY COLUMN t TEXT; +DROP TABLE t1; +CREATE TABLE t1 (f TINYINT, g SMALLINT UNSIGNED) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(127,6502),(-128,33101); +ALTER TABLE t1 MODIFY f SMALLINT DEFAULT 12345, +MODIFY g BIGINT UNSIGNED DEFAULT 1234567; +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +f g +127 6502 +-128 33101 +DROP TABLE t1; +CREATE TABLE t1 (f BIT(8)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (b'10000000'),(b'00000001'); +ALTER TABLE t1 MODIFY f BIT(16); +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +INSERT INTO t1 VALUES (b'1000000010101111'),(b'10000000'); +SELECT HEX(f) FROM t1; +HEX(f) +80 +1 +80AF +80 +ALTER TABLE t1 MODIFY f SMALLINT; +ERROR 22003: Out of range value for column 'f' at row 3 +ALTER TABLE t1 MODIFY f SMALLINT UNSIGNED; +affected rows: 4 +info: Records: 4 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +f +128 +1 +32943 +128 +ALTER TABLE t1 MODIFY f BIT; +ERROR 22001: Data too long for column 'f' at row 1 +ALTER TABLE t1 MODIFY f BIT(15); +ERROR 22001: Data too long for column 'f' at row 3 +DELETE FROM t1 LIMIT 3; +ALTER TABLE t1 MODIFY f BIT(15); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY f BIT(8); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT HEX(f) FROM t1; +HEX(f) +80 +DROP TABLE t1; +CREATE TABLE t1 (b BIT NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT DEFAULT CHARSET utf16; +INSERT INTO t1 SET b=b'1'; +ALTER TABLE t1 CHANGE b c BIT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT HEX(c) FROM t1; +HEX(c) +1 +DROP TABLE t1; +CREATE TABLE t1 (c VARCHAR(10) NOT NULL DEFAULT 'scary') ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1() VALUES(); +ALTER TABLE t1 ADD f TINYINT NOT NULL DEFAULT -42; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY f MEDIUMINT NOT NULL DEFAULT 64802, +MODIFY c VARCHAR(20) NOT NULL DEFAULT 'gory', +ADD d DATETIME; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +INSERT INTO t1() VALUES(); +INSERT INTO t1 (c,f,d) VALUES ('fury', -8388608, now()); +SELECT * FROM t1; +c f d +scary -42 NULL +gory 64802 NULL +fury -8388608 1970-01-01 03:00:42 +DROP TABLE t1; +CREATE TABLE t1 (t TINYINT PRIMARY KEY, m MEDIUMINT UNIQUE) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT table_id INTO @table_id1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +INSERT INTO t1 VALUES (-42, -123456); +ALTER TABLE t1 CHANGE t s SMALLINT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT table_id INTO @table_id2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +affected rows: 1 +ALTER TABLE t1 CHANGE m i INT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +ALTER TABLE t1 CHANGE m i INT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT table_id INTO @table_id3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +affected rows: 1 +SELECT @table_id1 = @table_id2, @table_id2 = @table_id3; +@table_id1 = @table_id2 @table_id2 = @table_id3 +0 0 +INSERT IGNORE INTO t1 VALUES (0, -123456); +Warnings: +Warning 1062 Duplicate entry '-123456' for key 'm' +REPLACE INTO t1 VALUES(-42, 123456); +INSERT IGNORE INTO t1 VALUES(32768, 2147483648); +Warnings: +Warning 1264 Out of range value for column 's' at row 1 +Warning 1264 Out of range value for column 'i' at row 1 +SELECT * FROM t1; +s i +-42 123456 +32767 2147483647 +DROP TABLE t1; +CREATE TABLE t1 (a SERIAL, b INT, c TINYINT UNIQUE) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 (c) VALUES(1),(2),(3); +ALTER TABLE t1 MODIFY c BIGINT; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +UPDATE t1 SET b=1 WHERE c=2; +UPDATE t1 SET c=4 WHERE a=3; +UPDATE t1 SET b=2 WHERE c>3; +UPDATE t1 SET c=c+1; +ERROR 23000: Duplicate entry '2' for key 'c' +SELECT * FROM t1; +a b c +1 NULL 1 +2 1 2 +3 2 4 +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(1,'a'); +ALTER TABLE t1 MODIFY b VARCHAR(256), ADD COLUMN c INT; +INSERT INTO t1 VALUES(2,'bah',3); +SELECT * FROM t1; +a b c +1 a NULL +2 bah 3 +DROP TABLE t1; +CREATE TABLE t1(a CHAR(5) CHARACTER SET utf8 PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES('barf'); +ALTER TABLE t1 ADD b INT FIRST, ALGORITHM=INSTANT; +ALTER TABLE t1 ADD vb INT AS (b); +SELECT * FROM t1; +b a vb +NULL barf NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT, b TEXT, PRIMARY KEY(b(9))) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 ADD COLUMN c TEXT FIRST; +ALTER TABLE t1 ADD COLUMN d TEXT GENERATED ALWAYS AS (SUBSTR(b,1,499)) FIRST; +DROP TABLE t1; +CREATE TABLE t1(a CHAR(5), b INT, c CHAR(1), d CHAR(1), PRIMARY KEY(a,b)) +DEFAULT CHARACTER SET utf8 ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a='fubar',b=42; +ALTER TABLE t1 DROP c, DROP d, ALGORITHM=INSTANT; +ALTER TABLE t1 ADD vb INT AS (b); +SELECT * FROM t1; +a b vb +fubar 42 42 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 MODIFY b INT FIRST; +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET pk=1; +ALTER TABLE t1 ADD COLUMN b INT; +BEGIN; +UPDATE t1 SET pk=2; +UPDATE t1 SET pk=1; +connection analyze; +SELECT * FROM t1; +pk b +1 NULL +connection default; +DROP TABLE t1; +CREATE TABLE t1 +(id INT PRIMARY KEY, c2 INT UNIQUE, +c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), +SPATIAL INDEX(c3)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 (id, c2) values(1,1); +SELECT id,c2,ST_AsText(c3) c3 FROM t1; +id c2 c3 +1 1 POINT(3 4) +ALTER TABLE t1 ADD COLUMN ( +d1 INT, d2 INT UNSIGNED DEFAULT 10, d3 VARCHAR(20) NOT NULL DEFAULT 'abcde', +d4 TIMESTAMP NOT NULL DEFAULT current_timestamp()); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD INDEX(d3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +BEGIN; +UPDATE t1 SET d3=''; +ROLLBACK; +SELECT id,c2,ST_AsText(c3) c3, d1, d2, d3, d4 FROM t1; +id c2 c3 d1 d2 d3 d4 +1 1 POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +INSERT INTO t1 (id) VALUES(2),(3),(4),(5),(6); +ALTER TABLE t1 CHANGE d1 d1 INT DEFAULT 5, CHANGE d2 d2 INT DEFAULT 15, +CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'fghij', +CHANGE d4 dfour TIMESTAMP NOT NULL DEFAULT now(); +affected rows: 6 +info: Records: 6 Duplicates: 0 Warnings: 0 +UPDATE t1 SET d3='foo' WHERE id = 2; +UPDATE t1 SET d3=DEFAULT WHERE id = 4; +INSERT INTO t1 SET id = 7; +SELECT id,c2,ST_AsText(c3) c3, d1, d2, d3, dfour FROM t1; +id c2 c3 d1 d2 d3 dfour +1 1 POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +2 NULL POINT(3 4) NULL 10 foo 1970-01-01 03:00:42 +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +4 NULL POINT(3 4) NULL 10 fghij 1970-01-01 03:00:42 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +6 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +7 NULL POINT(3 4) 5 15 fghij 1970-01-01 03:00:42 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD COLUMN e1 INT AS (id * 3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN e2 VARCHAR(30) AS (d3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN e3 INT AS (id * 2); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'foobar', +ADD COLUMN (d5 CHAR(20) DEFAULT 'hijkl', d6 INT DEFAULT -12345, d7 INT), +DROP INDEX d3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t1 SET id = 8; +UPDATE t1 SET d3 = 'yyyyy' WHERE id = 1; +UPDATE t1 SET d3 = 'xxxxx' WHERE id = 2; +BEGIN; +UPDATE t1 SET d3 = 'xxxxx' WHERE id = 3; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 3; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +3 NULL POINT(3 4) NULL 10 xxxxx 1970-01-01 03:00:42 9 xxxxx 6 hijkl -12345 NULL +ROLLBACK; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 3; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL +BEGIN; +UPDATE t1 SET d7 = NULL WHERE ID = 5; +ROLLBACK; +BEGIN; +UPDATE t1 SET d7 = NULL, d6 = 10 WHERE id = 5; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 5; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl 10 NULL +ROLLBACK; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 5; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL +ALTER TABLE t1 ADD COLUMN (f1 VARCHAR(20) AS (concat('x', e2)) STORED); +affected rows: 8 +info: Records: 8 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN (d8 VARCHAR(20) DEFAULT 'omnopq'); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7, f1, d8 FROM t1; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 +1 1 POINT(3 4) NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq +2 NULL POINT(3 4) NULL 10 xxxxx 1970-01-01 03:00:42 6 xxxxx 4 hijkl -12345 NULL xxxxxx omnopq +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL xabcde omnopq +4 NULL POINT(3 4) NULL 10 fghij 1970-01-01 03:00:42 12 fghij 8 hijkl -12345 NULL xfghij omnopq +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL xabcde omnopq +6 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 18 abcde 12 hijkl -12345 NULL xabcde omnopq +7 NULL POINT(3 4) 5 15 fghij 1970-01-01 03:00:42 21 fghij 14 hijkl -12345 NULL xfghij omnopq +8 NULL POINT(3 4) 5 15 foobar 1970-01-01 03:00:42 24 foobar 16 hijkl -12345 NULL xfoobar omnopq +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` point NOT NULL DEFAULT st_geometryfromtext('POINT(3 4)'), + `d1` int(11) DEFAULT 5, + `d2` int(11) DEFAULT 15, + `d3` varchar(20) NOT NULL DEFAULT 'foobar', + `dfour` timestamp NOT NULL DEFAULT current_timestamp(), + `e1` int(11) GENERATED ALWAYS AS (`id` * 3) VIRTUAL, + `e2` varchar(30) GENERATED ALWAYS AS (`d3`) VIRTUAL, + `e3` int(11) GENERATED ALWAYS AS (`id` * 2) VIRTUAL, + `d5` char(20) DEFAULT 'hijkl', + `d6` int(11) DEFAULT -12345, + `d7` int(11) DEFAULT NULL, + `f1` varchar(20) GENERATED ALWAYS AS (concat('x',`e2`)) STORED, + `d8` varchar(20) DEFAULT 'omnopq', + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`), + SPATIAL KEY `c3` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +ALTER TABLE t1 +CHANGE c2 c2 INT DEFAULT 42, +CHANGE d1 d1 INT DEFAULT 1, +CHANGE d2 d2 INT DEFAULT 20, +CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'boofar'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t1 SET id=9; +ALTER TABLE t1 DROP c3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT 42, + `d1` int(11) DEFAULT 1, + `d2` int(11) DEFAULT 20, + `d3` varchar(20) NOT NULL DEFAULT 'boofar', + `dfour` timestamp NOT NULL DEFAULT current_timestamp(), + `e1` int(11) GENERATED ALWAYS AS (`id` * 3) VIRTUAL, + `e2` varchar(30) GENERATED ALWAYS AS (`d3`) VIRTUAL, + `e3` int(11) GENERATED ALWAYS AS (`id` * 2) VIRTUAL, + `d5` char(20) DEFAULT 'hijkl', + `d6` int(11) DEFAULT -12345, + `d7` int(11) DEFAULT NULL, + `f1` varchar(20) GENERATED ALWAYS AS (concat('x',`e2`)) STORED, + `d8` varchar(20) DEFAULT 'omnopq', + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +SELECT * FROM t1; +id c2 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 +1 1 NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq +2 NULL NULL 10 xxxxx 1970-01-01 03:00:42 6 xxxxx 4 hijkl -12345 NULL xxxxxx omnopq +3 NULL NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL xabcde omnopq +4 NULL NULL 10 fghij 1970-01-01 03:00:42 12 fghij 8 hijkl -12345 NULL xfghij omnopq +5 NULL NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL xabcde omnopq +6 NULL NULL 10 abcde 1970-01-01 03:00:42 18 abcde 12 hijkl -12345 NULL xabcde omnopq +7 NULL 5 15 fghij 1970-01-01 03:00:42 21 fghij 14 hijkl -12345 NULL xfghij omnopq +8 NULL 5 15 foobar 1970-01-01 03:00:42 24 foobar 16 hijkl -12345 NULL xfoobar omnopq +9 42 1 20 boofar 1970-01-01 03:00:42 27 boofar 18 hijkl -12345 NULL xboofar omnopq +CREATE TABLE t2 +(id INT primary key, c1 VARCHAR(4000), +p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'), +SPATIAL INDEX(p)) +ENGINE=InnoDB ROW_FORMAT=COMPACT; +BEGIN; +INSERT INTO t2 SET id=1, c1=REPEAT('a', 4000); +INSERT INTO t2 SET id=2, c1=REPEAT('a', 4000), p=ST_GeomFromText('POINT(1 1)'); +COMMIT; +ALTER TABLE t2 ADD COLUMN d1 VARCHAR(2000) DEFAULT REPEAT('asdf',500); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c1, ST_AsText(p) p, d1 FROM t2; +id c1 p d1 +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa LINESTRING(0 0,0 1,1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa POINT(1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +BEGIN; +UPDATE t2 SET c1 = repeat(id, 4000); +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ROLLBACK; +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +BEGIN; +UPDATE t2 SET d1 = repeat(id, 200); +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ROLLBACK; +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ALTER TABLE t2 DROP p; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t2; +id c1 d1 +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +CREATE TABLE t3 +(id INT PRIMARY KEY, c2 INT UNSIGNED NOT NULL UNIQUE, +c3 POLYGON NOT NULL DEFAULT ST_PolyFromText('POLYGON((1 1,2 2,3 3,1 1))'), +SPATIAL INDEX(c3)) +ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t3(id,c2) VALUES(1,1),(2,2),(3,3); +SELECT id, c2, ST_AsText(c3) c3 FROM t3; +id c2 c3 +1 1 POLYGON((1 1,2 2,3 3,1 1)) +2 2 POLYGON((1 1,2 2,3 3,1 1)) +3 3 POLYGON((1 1,2 2,3 3,1 1)) +ALTER TABLE t3 ADD COLUMN +(c4 DATETIME DEFAULT current_timestamp(), +c5 TIMESTAMP NOT NULL DEFAULT current_timestamp(), +c6 POINT); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6 FROM t3; +id c2 c3 c4 c5 c6 +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +affected rows: 3 +ALTER TABLE t3 ADD COLUMN c7 TIME NOT NULL DEFAULT current_timestamp(); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'c7' at row 0 +ALTER TABLE t3 ADD COLUMN c8 DATE NOT NULL DEFAULT current_timestamp(); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'c8' at row 0 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8 FROM t3; +id c2 c3 c4 c5 c6 c7 c8 +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +ALTER TABLE t3 ADD COLUMN t TEXT CHARSET utf8 +DEFAULT 'The quick brown fox jumps over the lazy dog'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t3 SET id=4; +ERROR HY000: Field 'c2' doesn't have a default value +INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; +affected rows: 1 +Warnings: +Note 1265 Data truncated for column 'c7' at row 1 +Note 1265 Data truncated for column 'c8' at row 1 +SET innodb_strict_mode = OFF; +affected rows: 0 +ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, +CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; +affected rows: 4 +info: Records: 4 Duplicates: 0 Warnings: 0 +INSERT INTO t3 SET id=5, c2=9; +Warnings: +Note 1265 Data truncated for column 'c7' at row 1 +Note 1265 Data truncated for column 'c8' at row 1 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8, phrase, b FROM t3; +id c2 c3 c4 c5 c6 c7 c8 phrase b +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +4 0 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog 😱 +5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business +ALTER TABLE t3 DROP c3, DROP c7; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t3; +id c2 c4 c5 c6 c8 phrase b +1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +2 2 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +3 3 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +4 0 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog 😱 +5 9 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 ääH binary line of business +CREATE TABLE t4 +(id INT, foo INT DEFAULT 0, c1 VARCHAR(4000), +p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'), +PRIMARY KEY(id,foo)) +ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000)); +ALTER TABLE t4 ADD COLUMN d1 INT; +BEGIN; +UPDATE t4 SET c1 = repeat('1', 4000), foo=1 WHERE id=1; +INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)); +UPDATE t4 SET c1 = repeat('2', 4000), foo=1 WHERE id=2; +ROLLBACK; +BEGIN; +UPDATE t4 SET d1 = 1,foo=2 WHERE id=1; +INSERT INTO t4 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000)); +COMMIT; +CREATE TABLE big +(id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), +p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) +ENGINE=InnoDB ROW_FORMAT=COMPACT; +BEGIN; +INSERT INTO big +SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); +SET @i:=1; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +COMMIT; +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +3 +connection default; +ALTER TABLE big ADD COLUMN +(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +d3 TIMESTAMP NOT NULL DEFAULT current_timestamp ON UPDATE current_timestamp); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +CHECKSUM TABLE big; +Table Checksum +test.big 1705165209 +BEGIN; +INSERT INTO big(id, c1, c2, c3) SELECT @i:=@i+1, c1, c2, c3 FROM big; +INSERT INTO big(id, c1, c2, c3) SELECT @i:=@i+1, c1, c2, c3 FROM big; +CHECKSUM TABLE big; +Table Checksum +test.big 385477733 +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +7 +connection default; +ROLLBACK; +CHECKSUM TABLE big; +Table Checksum +test.big 1705165209 +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +3 +connection default; +InnoDB 0 transactions not purged +DROP TABLE t1,t2,t3,t4,big; +CREATE TABLE t1 (a VARCHAR(1) PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a='a'; +ALTER TABLE t1 ADD COLUMN b INT NOT NULL DEFAULT 0; +UPDATE t1 SET b = 1; +INSERT INTO t1 SET a='a'; +ERROR 23000: Duplicate entry 'a' for key 'PRIMARY' +SELECT * FROM t1; +a b +a 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b VARCHAR(8), PRIMARY KEY(b,a)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (1,'foo'); +ALTER TABLE t1 ADD COLUMN c INT; +UPDATE t1 SET c = 1; +UPDATE t1 SET c = 2; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY(b) REFERENCES t1(a)) +ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a=1; +INSERT INTO t2 SET b=1; +ALTER TABLE t2 ADD COLUMN a INT, DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD INDEX(a); +ALTER TABLE t1 ADD COLUMN b INT, ADD FOREIGN KEY(a) REFERENCES t2(a), +ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY +SET foreign_key_checks=0; +ALTER TABLE t1 ADD COLUMN b INT, ADD FOREIGN KEY(a) REFERENCES t2(a), +ALGORITHM=INSTANT; +ALTER TABLE t2 ADD CONSTRAINT fk FOREIGN KEY(b) REFERENCES t1(a), +ALGORITHM=INSTANT; +SET foreign_key_checks=1; +ALTER TABLE t2 COMMENT 'domestic keys only', DROP FOREIGN KEY fk; +ALTER TABLE t1 DROP FOREIGN KEY t1_ibfk_1; +ALTER TABLE t1 ADD COLUMN big BLOB NOT NULL +DEFAULT REPEAT('a', @@GLOBAL.innodb_page_size * .75); +CHECK TABLE t2, t1; +Table Op Msg_type Msg_text +test.t2 check status OK +test.t1 check status OK +DROP TABLE t2, t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a = 1; +ALTER TABLE t1 ADD COLUMN b TEXT; +BEGIN; +UPDATE t1 SET b = REPEAT('1', 32768); +UPDATE t1 SET a = 2; +INSERT INTO t1 SET a = 1; +SELECT a,LENGTH(b) FROM t1; +a LENGTH(b) +1 NULL +2 32768 +DELETE FROM t1; +COMMIT; +InnoDB 0 transactions not purged +DROP TABLE t1; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (7); +ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 0; +ALTER TABLE t1 ADD INDEX (c); +BEGIN; +DELETE FROM t1; +INSERT INTO t1 VALUES (4,0),(7,77); +COMMIT; +BEGIN; +DELETE FROM t1 WHERE a=7; +UPDATE t1 SET a=7; +COMMIT; +SELECT * FROM t1 FORCE INDEX(PRIMARY); +a c +7 0 +SELECT * FROM t1 FORCE INDEX(c); +a c +7 0 +DELETE FROM t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET innodb_strict_mode = ON; +CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD d TEXT; +ALTER TABLE t1 ADD PRIMARY KEY (b,a); +ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; +DROP TABLE t1; +SET innodb_strict_mode = OFF; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a=42; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +DROP TABLE t1; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; +CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 (a) VALUES (NULL), (NULL); +ALTER TABLE t1 DROP a, ADD COLUMN a INT; +DELETE FROM t1; +BEGIN; +INSERT INTO t1 SET a=NULL; +ROLLBACK; +DELETE FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, t VARCHAR(33101) NOT NULL) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES(347,''); +ALTER TABLE t1 DROP COLUMN t, ALGORITHM=INSTANT; +SELECT * FROM t1; +a +347 +DROP TABLE t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1() VALUES(); +ALTER TABLE t1 ADD COLUMN b INT FIRST, ADD COLUMN c INT AFTER b; +SELECT * FROM t1; +b c a +NULL NULL NULL +DROP TABLE t1; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SET @t=REPEAT('x',@@innodb_page_size / 2); +INSERT INTO t1 VALUES (@t),(@t),(@t),(@t),(@t),(@t),(NULL),(@t),(@t),(@t),(@t); +ALTER TABLE t1 ADD COLUMN a INT FIRST; +UPDATE t1 SET a = 0; +DROP TABLE t1; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET t = @x; +ALTER TABLE t1 DROP COLUMN t, ADD COLUMN i INT NOT NULL DEFAULT 1; +ALTER TABLE t1 ADD COLUMN t TEXT; +SELECT * FROM t1; +i t +1 NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT AUTO_INCREMENT, b INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a=NULL; +ALTER TABLE t1 DROP COLUMN b; +ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 42; +INSERT INTO t1 SET a=NULL; +UPDATE t1 SET a=a+2; +SELECT * FROM t1; +a c +3 42 +4 42 +DROP TABLE t1; +CREATE TABLE t1 (i INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET i=1; +ALTER TABLE t1 ADD COLUMN b BIT FIRST; +ALTER TABLE t1 ADD COLUMN v INT AS (i) VIRTUAL; +SELECT * FROM t1; +b i v +NULL 1 1 +DROP TABLE t1; +CREATE TABLE t1 (ts TIMESTAMP) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD COLUMN f VARCHAR(8), ADD COLUMN dt DATETIME; +ALTER TABLE t1 ADD COLUMN b BIT, DROP COLUMN f, ADD COLUMN t TIME FIRST; +ALTER TABLE t1 ADD COLUMN ts2 TIMESTAMP; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (4,4,4); +ALTER TABLE t1 DROP f1, DROP f2, ADD f4 INT, ADD f5 INT; +DELETE FROM t1; +ALTER TABLE t1 DROP COLUMN f4; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DROP f2, ADD COLUMN f4 INT; +ALTER TABLE t1 DROP f4; +ALTER TABLE t1 DROP f1; +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DROP COLUMN id; +INSERT INTO t1 () VALUES (),(); +SELECT * FROM t1; +f +NULL +NULL +ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id); +SELECT * FROM t1; +id f +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET f=NULL; +ALTER TABLE t1 DROP COLUMN id; +INSERT INTO t1 SET f=NULL; +SELECT * FROM t1; +f +NULL +NULL +DROP TABLE t1; +CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DROP COLUMN f; +INSERT INTO t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1(pk INT PRIMARY KEY, f INT, k INT AUTO_INCREMENT, KEY(k)) +ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DROP COLUMN f; +INSERT INTO t1 (pk) VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, +f1 INT, +f2 CHAR(255), +f3 BIGINT, +f4 INT, +f5 CHAR(255), +f6 CHAR(255), +f7 CHAR(255) NOT NULL, +f8 INT, +f9 CHAR(10) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'), +(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'), +(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'), +(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'), +(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'), +(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'), +(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'), +(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'), +(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'), +(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'), +(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'), +(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'), +(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'), +(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'), +(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o'); +DELETE FROM t1 WHERE pk=1; +InnoDB 0 transactions not purged +INSERT INTO t1 VALUES +(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'); +ALTER TABLE t1 DROP COLUMN f1; +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, +f1 INT, f2 CHAR(32) NOT NULL, +f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL, +f7 CHAR(32), f8 CHAR(32) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''), +(3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''), +(5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''), +(7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''), +(9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''), +(11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''), +(13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''), +(15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''), +(17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''), +(19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''), +(21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''), +(23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''), +(25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''), +(51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''), +(53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''), +(55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''), +(57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''), +(59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''), +(61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''), +(63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''), +(101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''), +(103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''), +(105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''), +(107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''), +(109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''), +(151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''), +(153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''), +(155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''), +(157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''), +(159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''), +(201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''), +(203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''), +(205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''), +(207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''), +(252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''), +(254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''), +(256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''), +(258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''), +(301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''), +(303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''), +(305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''), +(307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''), +(351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''), +(353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''), +(355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''), +(357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''), +(359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''), +(361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''), +(363,75,'',66,76,52,'','',''); +ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar '; +UPDATE t1 SET f1 = 0; +ALTER TABLE t1 DROP COLUMN x; +DROP TABLE t1; +CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST; +DROP TABLE t1; +CREATE TABLE t1 (a INT UNIQUE, b INT UNIQUE, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 DROP PRIMARY KEY; +ALTER TABLE t1 CHANGE COLUMN a a INT; +DELETE FROM t1 WHERE a = NULL OR a IS NULL; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT, +e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b; +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (0,0); +ALTER TABLE t1 MODIFY a INT AFTER b; +ALTER TABLE t1 ADD COLUMN v INT AS (a) VIRTUAL; +ALTER TABLE t1 MODIFY b INT NOT NULL AFTER a; +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN b INT; +ALTER TABLE t1 MODIFY COLUMN a INT NULL; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a=1; +ALTER TABLE t1 DROP c; +ALTER TABLE t1 DROP b, ADD v INT AS (a); +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a=1; +ALTER TABLE t1 DROP c; +ALTER TABLE t1 DROP b, ADD v INT AS (a); +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, b BLOB NOT NULL) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (1,10,REPEAT('foobar',2000)); +ALTER TABLE t1 DROP COLUMN b; +INSERT INTO t1 VALUES (2,20); +ALTER TABLE t1 ADD COLUMN vpk INT AS (pk); +ALTER TABLE t1 DROP COLUMN i; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (1,1); +ALTER TABLE t1 ADD f DATE AFTER a; +ALTER TABLE t1 DROP b, DROP f; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (1,1); +ALTER TABLE t1 ADD COLUMN f INT AFTER a; +ALTER TABLE t1 DROP b, DROP f; +DROP TABLE t1; +CREATE TABLE t1(t TEXT NOT NULL, FULLTEXT(t)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 MODIFY COLUMN t TEXT; +DROP TABLE t1; +CREATE TABLE t1 (f TINYINT, g SMALLINT UNSIGNED) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES(127,6502),(-128,33101); +ALTER TABLE t1 MODIFY f SMALLINT DEFAULT 12345, +MODIFY g BIGINT UNSIGNED DEFAULT 1234567; +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +f g +127 6502 +-128 33101 +DROP TABLE t1; +CREATE TABLE t1 (f BIT(8)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES (b'10000000'),(b'00000001'); +ALTER TABLE t1 MODIFY f BIT(16); +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +INSERT INTO t1 VALUES (b'1000000010101111'),(b'10000000'); +SELECT HEX(f) FROM t1; +HEX(f) +80 +1 +80AF +80 +ALTER TABLE t1 MODIFY f SMALLINT; +ERROR 22003: Out of range value for column 'f' at row 3 +ALTER TABLE t1 MODIFY f SMALLINT UNSIGNED; +affected rows: 4 +info: Records: 4 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +f +128 +1 +32943 +128 +ALTER TABLE t1 MODIFY f BIT; +ERROR 22001: Data too long for column 'f' at row 1 +ALTER TABLE t1 MODIFY f BIT(15); +ERROR 22001: Data too long for column 'f' at row 3 +DELETE FROM t1 LIMIT 3; +ALTER TABLE t1 MODIFY f BIT(15); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY f BIT(8); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT HEX(f) FROM t1; +HEX(f) +80 +DROP TABLE t1; +CREATE TABLE t1 (b BIT NOT NULL) ENGINE=InnoDB ROW_FORMAT=COMPACT DEFAULT CHARSET utf16; +INSERT INTO t1 SET b=b'1'; +ALTER TABLE t1 CHANGE b c BIT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT HEX(c) FROM t1; +HEX(c) +1 +DROP TABLE t1; +CREATE TABLE t1 (c VARCHAR(10) NOT NULL DEFAULT 'scary') ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1() VALUES(); +ALTER TABLE t1 ADD f TINYINT NOT NULL DEFAULT -42; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY f MEDIUMINT NOT NULL DEFAULT 64802, +MODIFY c VARCHAR(20) NOT NULL DEFAULT 'gory', +ADD d DATETIME; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +INSERT INTO t1() VALUES(); +INSERT INTO t1 (c,f,d) VALUES ('fury', -8388608, now()); +SELECT * FROM t1; +c f d +scary -42 NULL +gory 64802 NULL +fury -8388608 1970-01-01 03:00:42 +DROP TABLE t1; +CREATE TABLE t1 (t TINYINT PRIMARY KEY, m MEDIUMINT UNIQUE) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT table_id INTO @table_id1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +INSERT INTO t1 VALUES (-42, -123456); +ALTER TABLE t1 CHANGE t s SMALLINT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT table_id INTO @table_id2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +affected rows: 1 +ALTER TABLE t1 CHANGE m i INT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +ALTER TABLE t1 CHANGE m i INT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT table_id INTO @table_id3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +affected rows: 1 +SELECT @table_id1 = @table_id2, @table_id2 = @table_id3; +@table_id1 = @table_id2 @table_id2 = @table_id3 +0 0 +INSERT IGNORE INTO t1 VALUES (0, -123456); +Warnings: +Warning 1062 Duplicate entry '-123456' for key 'm' +REPLACE INTO t1 VALUES(-42, 123456); +INSERT IGNORE INTO t1 VALUES(32768, 2147483648); +Warnings: +Warning 1264 Out of range value for column 's' at row 1 +Warning 1264 Out of range value for column 'i' at row 1 +SELECT * FROM t1; +s i +-42 123456 +32767 2147483647 +DROP TABLE t1; +CREATE TABLE t1 (a SERIAL, b INT, c TINYINT UNIQUE) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 (c) VALUES(1),(2),(3); +ALTER TABLE t1 MODIFY c BIGINT; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +UPDATE t1 SET b=1 WHERE c=2; +UPDATE t1 SET c=4 WHERE a=3; +UPDATE t1 SET b=2 WHERE c>3; +UPDATE t1 SET c=c+1; +ERROR 23000: Duplicate entry '2' for key 'c' +SELECT * FROM t1; +a b c +1 NULL 1 +2 1 2 +3 2 4 +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES(1,'a'); +ALTER TABLE t1 MODIFY b VARCHAR(256), ADD COLUMN c INT; +INSERT INTO t1 VALUES(2,'bah',3); +SELECT * FROM t1; +a b c +1 a NULL +2 bah 3 +DROP TABLE t1; +CREATE TABLE t1(a CHAR(5) CHARACTER SET utf8 PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES('barf'); +ALTER TABLE t1 ADD b INT FIRST, ALGORITHM=INSTANT; +ALTER TABLE t1 ADD vb INT AS (b); +SELECT * FROM t1; +b a vb +NULL barf NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT, b TEXT, PRIMARY KEY(b(9))) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD COLUMN c TEXT FIRST; +ALTER TABLE t1 ADD COLUMN d TEXT GENERATED ALWAYS AS (SUBSTR(b,1,499)) FIRST; +DROP TABLE t1; +CREATE TABLE t1(a CHAR(5), b INT, c CHAR(1), d CHAR(1), PRIMARY KEY(a,b)) +DEFAULT CHARACTER SET utf8 ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a='fubar',b=42; +ALTER TABLE t1 DROP c, DROP d, ALGORITHM=INSTANT; +ALTER TABLE t1 ADD vb INT AS (b); +SELECT * FROM t1; +a b vb +fubar 42 42 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 MODIFY b INT FIRST; +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET pk=1; +ALTER TABLE t1 ADD COLUMN b INT; +BEGIN; +UPDATE t1 SET pk=2; +UPDATE t1 SET pk=1; +connection analyze; +SELECT * FROM t1; +pk b +1 NULL +connection default; +DROP TABLE t1; +CREATE TABLE t1 +(id INT PRIMARY KEY, c2 INT UNIQUE, +c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), +SPATIAL INDEX(c3)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 (id, c2) values(1,1); +SELECT id,c2,ST_AsText(c3) c3 FROM t1; +id c2 c3 +1 1 POINT(3 4) +ALTER TABLE t1 ADD COLUMN ( +d1 INT, d2 INT UNSIGNED DEFAULT 10, d3 VARCHAR(20) NOT NULL DEFAULT 'abcde', +d4 TIMESTAMP NOT NULL DEFAULT current_timestamp()); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD INDEX(d3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +BEGIN; +UPDATE t1 SET d3=''; +ROLLBACK; +SELECT id,c2,ST_AsText(c3) c3, d1, d2, d3, d4 FROM t1; +id c2 c3 d1 d2 d3 d4 +1 1 POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +INSERT INTO t1 (id) VALUES(2),(3),(4),(5),(6); +ALTER TABLE t1 CHANGE d1 d1 INT DEFAULT 5, CHANGE d2 d2 INT DEFAULT 15, +CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'fghij', +CHANGE d4 dfour TIMESTAMP NOT NULL DEFAULT now(); +affected rows: 6 +info: Records: 6 Duplicates: 0 Warnings: 0 +UPDATE t1 SET d3='foo' WHERE id = 2; +UPDATE t1 SET d3=DEFAULT WHERE id = 4; +INSERT INTO t1 SET id = 7; +SELECT id,c2,ST_AsText(c3) c3, d1, d2, d3, dfour FROM t1; +id c2 c3 d1 d2 d3 dfour +1 1 POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +2 NULL POINT(3 4) NULL 10 foo 1970-01-01 03:00:42 +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +4 NULL POINT(3 4) NULL 10 fghij 1970-01-01 03:00:42 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +6 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 +7 NULL POINT(3 4) 5 15 fghij 1970-01-01 03:00:42 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD COLUMN e1 INT AS (id * 3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN e2 VARCHAR(30) AS (d3); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN e3 INT AS (id * 2); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'foobar', +ADD COLUMN (d5 CHAR(20) DEFAULT 'hijkl', d6 INT DEFAULT -12345, d7 INT), +DROP INDEX d3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t1 SET id = 8; +UPDATE t1 SET d3 = 'yyyyy' WHERE id = 1; +UPDATE t1 SET d3 = 'xxxxx' WHERE id = 2; +BEGIN; +UPDATE t1 SET d3 = 'xxxxx' WHERE id = 3; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 3; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +3 NULL POINT(3 4) NULL 10 xxxxx 1970-01-01 03:00:42 9 xxxxx 6 hijkl -12345 NULL +ROLLBACK; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 3; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL +BEGIN; +UPDATE t1 SET d7 = NULL WHERE ID = 5; +ROLLBACK; +BEGIN; +UPDATE t1 SET d7 = NULL, d6 = 10 WHERE id = 5; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 5; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl 10 NULL +ROLLBACK; +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7 FROM t1 WHERE id = 5; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL +ALTER TABLE t1 ADD COLUMN (f1 VARCHAR(20) AS (concat('x', e2)) STORED); +affected rows: 8 +info: Records: 8 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD COLUMN (d8 VARCHAR(20) DEFAULT 'omnopq'); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c2, ST_AsText(c3) c3, d1, d2, d3, dfour, e1, e2, e3, d5, d6, d7, f1, d8 FROM t1; +id c2 c3 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 +1 1 POINT(3 4) NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq +2 NULL POINT(3 4) NULL 10 xxxxx 1970-01-01 03:00:42 6 xxxxx 4 hijkl -12345 NULL xxxxxx omnopq +3 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL xabcde omnopq +4 NULL POINT(3 4) NULL 10 fghij 1970-01-01 03:00:42 12 fghij 8 hijkl -12345 NULL xfghij omnopq +5 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL xabcde omnopq +6 NULL POINT(3 4) NULL 10 abcde 1970-01-01 03:00:42 18 abcde 12 hijkl -12345 NULL xabcde omnopq +7 NULL POINT(3 4) 5 15 fghij 1970-01-01 03:00:42 21 fghij 14 hijkl -12345 NULL xfghij omnopq +8 NULL POINT(3 4) 5 15 foobar 1970-01-01 03:00:42 24 foobar 16 hijkl -12345 NULL xfoobar omnopq +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `c3` point NOT NULL DEFAULT st_geometryfromtext('POINT(3 4)'), + `d1` int(11) DEFAULT 5, + `d2` int(11) DEFAULT 15, + `d3` varchar(20) NOT NULL DEFAULT 'foobar', + `dfour` timestamp NOT NULL DEFAULT current_timestamp(), + `e1` int(11) GENERATED ALWAYS AS (`id` * 3) VIRTUAL, + `e2` varchar(30) GENERATED ALWAYS AS (`d3`) VIRTUAL, + `e3` int(11) GENERATED ALWAYS AS (`id` * 2) VIRTUAL, + `d5` char(20) DEFAULT 'hijkl', + `d6` int(11) DEFAULT -12345, + `d7` int(11) DEFAULT NULL, + `f1` varchar(20) GENERATED ALWAYS AS (concat('x',`e2`)) STORED, + `d8` varchar(20) DEFAULT 'omnopq', + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`), + SPATIAL KEY `c3` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +ALTER TABLE t1 +CHANGE c2 c2 INT DEFAULT 42, +CHANGE d1 d1 INT DEFAULT 1, +CHANGE d2 d2 INT DEFAULT 20, +CHANGE d3 d3 VARCHAR(20) NOT NULL DEFAULT 'boofar'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t1 SET id=9; +ALTER TABLE t1 DROP c3; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT 42, + `d1` int(11) DEFAULT 1, + `d2` int(11) DEFAULT 20, + `d3` varchar(20) NOT NULL DEFAULT 'boofar', + `dfour` timestamp NOT NULL DEFAULT current_timestamp(), + `e1` int(11) GENERATED ALWAYS AS (`id` * 3) VIRTUAL, + `e2` varchar(30) GENERATED ALWAYS AS (`d3`) VIRTUAL, + `e3` int(11) GENERATED ALWAYS AS (`id` * 2) VIRTUAL, + `d5` char(20) DEFAULT 'hijkl', + `d6` int(11) DEFAULT -12345, + `d7` int(11) DEFAULT NULL, + `f1` varchar(20) GENERATED ALWAYS AS (concat('x',`e2`)) STORED, + `d8` varchar(20) DEFAULT 'omnopq', + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SELECT * FROM t1; +id c2 d1 d2 d3 dfour e1 e2 e3 d5 d6 d7 f1 d8 +1 1 NULL 10 yyyyy 1970-01-01 03:00:42 3 yyyyy 2 hijkl -12345 NULL xyyyyy omnopq +2 NULL NULL 10 xxxxx 1970-01-01 03:00:42 6 xxxxx 4 hijkl -12345 NULL xxxxxx omnopq +3 NULL NULL 10 abcde 1970-01-01 03:00:42 9 abcde 6 hijkl -12345 NULL xabcde omnopq +4 NULL NULL 10 fghij 1970-01-01 03:00:42 12 fghij 8 hijkl -12345 NULL xfghij omnopq +5 NULL NULL 10 abcde 1970-01-01 03:00:42 15 abcde 10 hijkl -12345 NULL xabcde omnopq +6 NULL NULL 10 abcde 1970-01-01 03:00:42 18 abcde 12 hijkl -12345 NULL xabcde omnopq +7 NULL 5 15 fghij 1970-01-01 03:00:42 21 fghij 14 hijkl -12345 NULL xfghij omnopq +8 NULL 5 15 foobar 1970-01-01 03:00:42 24 foobar 16 hijkl -12345 NULL xfoobar omnopq +9 42 1 20 boofar 1970-01-01 03:00:42 27 boofar 18 hijkl -12345 NULL xboofar omnopq +CREATE TABLE t2 +(id INT primary key, c1 VARCHAR(4000), +p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'), +SPATIAL INDEX(p)) +ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +BEGIN; +INSERT INTO t2 SET id=1, c1=REPEAT('a', 4000); +INSERT INTO t2 SET id=2, c1=REPEAT('a', 4000), p=ST_GeomFromText('POINT(1 1)'); +COMMIT; +ALTER TABLE t2 ADD COLUMN d1 VARCHAR(2000) DEFAULT REPEAT('asdf',500); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c1, ST_AsText(p) p, d1 FROM t2; +id c1 p d1 +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa LINESTRING(0 0,0 1,1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa POINT(1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +BEGIN; +UPDATE t2 SET c1 = repeat(id, 4000); +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ROLLBACK; +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +BEGIN; +UPDATE t2 SET d1 = repeat(id, 200); +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ROLLBACK; +connection analyze; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t2'; +clust_index_size +1 +connection default; +ALTER TABLE t2 DROP p; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t2; +id c1 d1 +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf +CREATE TABLE t3 +(id INT PRIMARY KEY, c2 INT UNSIGNED NOT NULL UNIQUE, +c3 POLYGON NOT NULL DEFAULT ST_PolyFromText('POLYGON((1 1,2 2,3 3,1 1))'), +SPATIAL INDEX(c3)) +ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t3(id,c2) VALUES(1,1),(2,2),(3,3); +SELECT id, c2, ST_AsText(c3) c3 FROM t3; +id c2 c3 +1 1 POLYGON((1 1,2 2,3 3,1 1)) +2 2 POLYGON((1 1,2 2,3 3,1 1)) +3 3 POLYGON((1 1,2 2,3 3,1 1)) +ALTER TABLE t3 ADD COLUMN +(c4 DATETIME DEFAULT current_timestamp(), +c5 TIMESTAMP NOT NULL DEFAULT current_timestamp(), +c6 POINT); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6 FROM t3; +id c2 c3 c4 c5 c6 +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL +affected rows: 3 +ALTER TABLE t3 ADD COLUMN c7 TIME NOT NULL DEFAULT current_timestamp(); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'c7' at row 0 +ALTER TABLE t3 ADD COLUMN c8 DATE NOT NULL DEFAULT current_timestamp(); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Note 1265 Data truncated for column 'c8' at row 0 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8 FROM t3; +id c2 c3 c4 c5 c6 c7 c8 +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 +ALTER TABLE t3 ADD COLUMN t TEXT CHARSET utf8 +DEFAULT 'The quick brown fox jumps over the lazy dog'; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +INSERT INTO t3 SET id=4; +ERROR HY000: Field 'c2' doesn't have a default value +INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; +affected rows: 1 +Warnings: +Note 1265 Data truncated for column 'c7' at row 1 +Note 1265 Data truncated for column 'c8' at row 1 +SET innodb_strict_mode = OFF; +affected rows: 0 +ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, +CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; +affected rows: 4 +info: Records: 4 Duplicates: 0 Warnings: 0 +INSERT INTO t3 SET id=5, c2=9; +Warnings: +Note 1265 Data truncated for column 'c7' at row 1 +Note 1265 Data truncated for column 'c8' at row 1 +SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8, phrase, b FROM t3; +id c2 c3 c4 c5 c6 c7 c8 phrase b +1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +2 2 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +3 3 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog +4 0 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 The quick brown fox jumps over the lazy dog 😱 +5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business +ALTER TABLE t3 DROP c3, DROP c7; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT * FROM t3; +id c2 c4 c5 c6 c8 phrase b +1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +2 2 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +3 3 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +4 0 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog 😱 +5 9 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 ääH binary line of business +CREATE TABLE t4 +(id INT, foo INT DEFAULT 0, c1 VARCHAR(4000), +p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'), +PRIMARY KEY(id,foo)) +ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000)); +ALTER TABLE t4 ADD COLUMN d1 INT; +BEGIN; +UPDATE t4 SET c1 = repeat('1', 4000), foo=1 WHERE id=1; +INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)); +UPDATE t4 SET c1 = repeat('2', 4000), foo=1 WHERE id=2; +ROLLBACK; +BEGIN; +UPDATE t4 SET d1 = 1,foo=2 WHERE id=1; +INSERT INTO t4 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000)); +COMMIT; +CREATE TABLE big +(id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), +p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) +ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +BEGIN; +INSERT INTO big +SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); +SET @i:=1; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +INSERT INTO big SELECT @i:=@i+1, c1, c2, c3, p FROM big; +COMMIT; +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +3 +connection default; +ALTER TABLE big ADD COLUMN +(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', +d3 TIMESTAMP NOT NULL DEFAULT current_timestamp ON UPDATE current_timestamp); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +CHECKSUM TABLE big; +Table Checksum +test.big 1705165209 +BEGIN; +INSERT INTO big(id, c1, c2, c3) SELECT @i:=@i+1, c1, c2, c3 FROM big; +INSERT INTO big(id, c1, c2, c3) SELECT @i:=@i+1, c1, c2, c3 FROM big; +CHECKSUM TABLE big; +Table Checksum +test.big 385477733 +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +7 +connection default; +ROLLBACK; +CHECKSUM TABLE big; +Table Checksum +test.big 1705165209 +connection analyze; +ANALYZE TABLE big; +Table Op Msg_type Msg_text +test.big analyze status Engine-independent statistics collected +test.big analyze status OK +SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/big'; +clust_index_size +3 +connection default; +InnoDB 0 transactions not purged +DROP TABLE t1,t2,t3,t4,big; +CREATE TABLE t1 (a VARCHAR(1) PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a='a'; +ALTER TABLE t1 ADD COLUMN b INT NOT NULL DEFAULT 0; +UPDATE t1 SET b = 1; +INSERT INTO t1 SET a='a'; +ERROR 23000: Duplicate entry 'a' for key 'PRIMARY' +SELECT * FROM t1; +a b +a 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b VARCHAR(8), PRIMARY KEY(b,a)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1,'foo'); +ALTER TABLE t1 ADD COLUMN c INT; +UPDATE t1 SET c = 1; +UPDATE t1 SET c = 2; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY(b) REFERENCES t1(a)) +ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a=1; +INSERT INTO t2 SET b=1; +ALTER TABLE t2 ADD COLUMN a INT, DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD INDEX(a); +ALTER TABLE t1 ADD COLUMN b INT, ADD FOREIGN KEY(a) REFERENCES t2(a), +ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY +SET foreign_key_checks=0; +ALTER TABLE t1 ADD COLUMN b INT, ADD FOREIGN KEY(a) REFERENCES t2(a), +ALGORITHM=INSTANT; +ALTER TABLE t2 ADD CONSTRAINT fk FOREIGN KEY(b) REFERENCES t1(a), +ALGORITHM=INSTANT; +SET foreign_key_checks=1; +ALTER TABLE t2 COMMENT 'domestic keys only', DROP FOREIGN KEY fk; +ALTER TABLE t1 DROP FOREIGN KEY t1_ibfk_1; +ALTER TABLE t1 ADD COLUMN big BLOB NOT NULL +DEFAULT REPEAT('a', @@GLOBAL.innodb_page_size * .75); +CHECK TABLE t2, t1; +Table Op Msg_type Msg_text +test.t2 check status OK +test.t1 check status OK +DROP TABLE t2, t1; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a = 1; +ALTER TABLE t1 ADD COLUMN b TEXT; +BEGIN; +UPDATE t1 SET b = REPEAT('1', 32768); +UPDATE t1 SET a = 2; +INSERT INTO t1 SET a = 1; +SELECT a,LENGTH(b) FROM t1; +a LENGTH(b) +1 NULL +2 32768 +DELETE FROM t1; +COMMIT; +InnoDB 0 transactions not purged +DROP TABLE t1; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (7); +ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 0; +ALTER TABLE t1 ADD INDEX (c); +BEGIN; +DELETE FROM t1; +INSERT INTO t1 VALUES (4,0),(7,77); +COMMIT; +BEGIN; +DELETE FROM t1 WHERE a=7; +UPDATE t1 SET a=7; +COMMIT; +SELECT * FROM t1 FORCE INDEX(PRIMARY); +a c +7 0 +SELECT * FROM t1 FORCE INDEX(c); +a c +7 0 +DELETE FROM t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET innodb_strict_mode = ON; +CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 ADD d TEXT; +ALTER TABLE t1 ADD PRIMARY KEY (b,a); +ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; +DROP TABLE t1; +SET innodb_strict_mode = OFF; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a=42; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +DROP TABLE t1; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; +CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 (a) VALUES (NULL), (NULL); +ALTER TABLE t1 DROP a, ADD COLUMN a INT; +DELETE FROM t1; +BEGIN; +INSERT INTO t1 SET a=NULL; +ROLLBACK; +DELETE FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, t VARCHAR(33101) NOT NULL) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES(347,''); +ALTER TABLE t1 DROP COLUMN t, ALGORITHM=INSTANT; +SELECT * FROM t1; +a +347 +DROP TABLE t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1() VALUES(); +ALTER TABLE t1 ADD COLUMN b INT FIRST, ADD COLUMN c INT AFTER b; +SELECT * FROM t1; +b c a +NULL NULL NULL +DROP TABLE t1; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SET @t=REPEAT('x',@@innodb_page_size / 2); +INSERT INTO t1 VALUES (@t),(@t),(@t),(@t),(@t),(@t),(NULL),(@t),(@t),(@t),(@t); +ALTER TABLE t1 ADD COLUMN a INT FIRST; +UPDATE t1 SET a = 0; +DROP TABLE t1; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET t = @x; +ALTER TABLE t1 DROP COLUMN t, ADD COLUMN i INT NOT NULL DEFAULT 1; +ALTER TABLE t1 ADD COLUMN t TEXT; +SELECT * FROM t1; +i t +1 NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT AUTO_INCREMENT, b INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a=NULL; +ALTER TABLE t1 DROP COLUMN b; +ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 42; +INSERT INTO t1 SET a=NULL; +UPDATE t1 SET a=a+2; +SELECT * FROM t1; +a c +3 42 +4 42 +DROP TABLE t1; +CREATE TABLE t1 (i INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET i=1; +ALTER TABLE t1 ADD COLUMN b BIT FIRST; +ALTER TABLE t1 ADD COLUMN v INT AS (i) VIRTUAL; +SELECT * FROM t1; +b i v +NULL 1 1 +DROP TABLE t1; +CREATE TABLE t1 (ts TIMESTAMP) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 ADD COLUMN f VARCHAR(8), ADD COLUMN dt DATETIME; +ALTER TABLE t1 ADD COLUMN b BIT, DROP COLUMN f, ADD COLUMN t TIME FIRST; +ALTER TABLE t1 ADD COLUMN ts2 TIMESTAMP; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (4,4,4); +ALTER TABLE t1 DROP f1, DROP f2, ADD f4 INT, ADD f5 INT; +DELETE FROM t1; +ALTER TABLE t1 DROP COLUMN f4; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DROP f2, ADD COLUMN f4 INT; +ALTER TABLE t1 DROP f4; +ALTER TABLE t1 DROP f1; +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DROP COLUMN id; +INSERT INTO t1 () VALUES (),(); +SELECT * FROM t1; +f +NULL +NULL +ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id); +SELECT * FROM t1; +id f +1 NULL +2 NULL +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET f=NULL; +ALTER TABLE t1 DROP COLUMN id; +INSERT INTO t1 SET f=NULL; +SELECT * FROM t1; +f +NULL +NULL +DROP TABLE t1; +CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DROP COLUMN f; +INSERT INTO t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1(pk INT PRIMARY KEY, f INT, k INT AUTO_INCREMENT, KEY(k)) +ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DROP COLUMN f; +INSERT INTO t1 (pk) VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, +f1 INT, +f2 CHAR(255), +f3 BIGINT, +f4 INT, +f5 CHAR(255), +f6 CHAR(255), +f7 CHAR(255) NOT NULL, +f8 INT, +f9 CHAR(10) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'), +(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'), +(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'), +(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'), +(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'), +(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'), +(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'), +(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'), +(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'), +(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'), +(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'), +(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'), +(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'), +(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'), +(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o'); +DELETE FROM t1 WHERE pk=1; +InnoDB 0 transactions not purged +INSERT INTO t1 VALUES +(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'); +ALTER TABLE t1 DROP COLUMN f1; +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, +f1 INT, f2 CHAR(32) NOT NULL, +f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL, +f7 CHAR(32), f8 CHAR(32) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''), +(3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''), +(5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''), +(7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''), +(9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''), +(11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''), +(13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''), +(15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''), +(17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''), +(19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''), +(21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''), +(23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''), +(25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''), +(51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''), +(53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''), +(55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''), +(57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''), +(59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''), +(61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''), +(63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''), +(101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''), +(103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''), +(105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''), +(107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''), +(109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''), +(151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''), +(153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''), +(155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''), +(157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''), +(159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''), +(201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''), +(203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''), +(205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''), +(207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''), +(252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''), +(254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''), +(256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''), +(258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''), +(301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''), +(303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''), +(305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''), +(307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''), +(351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''), +(353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''), +(355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''), +(357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''), +(359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''), +(361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''), +(363,75,'',66,76,52,'','',''); +ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar '; +UPDATE t1 SET f1 = 0; +ALTER TABLE t1 DROP COLUMN x; +DROP TABLE t1; +CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST; +DROP TABLE t1; +CREATE TABLE t1 (a INT UNIQUE, b INT UNIQUE, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 DROP PRIMARY KEY; +ALTER TABLE t1 CHANGE COLUMN a a INT; +DELETE FROM t1 WHERE a = NULL OR a IS NULL; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT, +e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b; +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (0,0); +ALTER TABLE t1 MODIFY a INT AFTER b; +ALTER TABLE t1 ADD COLUMN v INT AS (a) VIRTUAL; +ALTER TABLE t1 MODIFY b INT NOT NULL AFTER a; +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN b INT; +ALTER TABLE t1 MODIFY COLUMN a INT NULL; +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a=1; +ALTER TABLE t1 DROP c; +ALTER TABLE t1 DROP b, ADD v INT AS (a); +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a=1; +ALTER TABLE t1 DROP c; +ALTER TABLE t1 DROP b, ADD v INT AS (a); +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, b BLOB NOT NULL) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1,10,REPEAT('foobar',2000)); +ALTER TABLE t1 DROP COLUMN b; +INSERT INTO t1 VALUES (2,20); +ALTER TABLE t1 ADD COLUMN vpk INT AS (pk); +ALTER TABLE t1 DROP COLUMN i; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1,1); +ALTER TABLE t1 ADD f DATE AFTER a; +ALTER TABLE t1 DROP b, DROP f; +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1,1); +ALTER TABLE t1 ADD COLUMN f INT AFTER a; +ALTER TABLE t1 DROP b, DROP f; +DROP TABLE t1; +CREATE TABLE t1(t TEXT NOT NULL, FULLTEXT(t)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 MODIFY COLUMN t TEXT; +DROP TABLE t1; +CREATE TABLE t1 (f TINYINT, g SMALLINT UNSIGNED) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES(127,6502),(-128,33101); +ALTER TABLE t1 MODIFY f SMALLINT DEFAULT 12345, +MODIFY g BIGINT UNSIGNED DEFAULT 1234567; +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +f g +127 6502 +-128 33101 +DROP TABLE t1; +CREATE TABLE t1 (f BIT(8)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (b'10000000'),(b'00000001'); +ALTER TABLE t1 MODIFY f BIT(16); +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +INSERT INTO t1 VALUES (b'1000000010101111'),(b'10000000'); +SELECT HEX(f) FROM t1; +HEX(f) +80 +1 +80AF +80 +ALTER TABLE t1 MODIFY f SMALLINT; +ERROR 22003: Out of range value for column 'f' at row 3 +ALTER TABLE t1 MODIFY f SMALLINT UNSIGNED; +affected rows: 4 +info: Records: 4 Duplicates: 0 Warnings: 0 +SELECT * FROM t1; +f +128 +1 +32943 +128 +ALTER TABLE t1 MODIFY f BIT; +ERROR 22001: Data too long for column 'f' at row 1 +ALTER TABLE t1 MODIFY f BIT(15); +ERROR 22001: Data too long for column 'f' at row 3 +DELETE FROM t1 LIMIT 3; +ALTER TABLE t1 MODIFY f BIT(15); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY f BIT(8); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT HEX(f) FROM t1; +HEX(f) +80 +DROP TABLE t1; +CREATE TABLE t1 (b BIT NOT NULL) ENGINE=InnoDB ROW_FORMAT=DYNAMIC DEFAULT CHARSET utf16; +INSERT INTO t1 SET b=b'1'; +ALTER TABLE t1 CHANGE b c BIT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT HEX(c) FROM t1; +HEX(c) +1 +DROP TABLE t1; +CREATE TABLE t1 (c VARCHAR(10) NOT NULL DEFAULT 'scary') ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1() VALUES(); +ALTER TABLE t1 ADD f TINYINT NOT NULL DEFAULT -42; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY f MEDIUMINT NOT NULL DEFAULT 64802, +MODIFY c VARCHAR(20) NOT NULL DEFAULT 'gory', +ADD d DATETIME; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +INSERT INTO t1() VALUES(); +INSERT INTO t1 (c,f,d) VALUES ('fury', -8388608, now()); +SELECT * FROM t1; +c f d +scary -42 NULL +gory 64802 NULL +fury -8388608 1970-01-01 03:00:42 +DROP TABLE t1; +CREATE TABLE t1 (t TINYINT PRIMARY KEY, m MEDIUMINT UNIQUE) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SELECT table_id INTO @table_id1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +INSERT INTO t1 VALUES (-42, -123456); +ALTER TABLE t1 CHANGE t s SMALLINT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT table_id INTO @table_id2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +affected rows: 1 +ALTER TABLE t1 CHANGE m i INT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +ALTER TABLE t1 CHANGE m i INT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SELECT table_id INTO @table_id3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name = 'test/t1'; +affected rows: 1 +SELECT @table_id1 = @table_id2, @table_id2 = @table_id3; +@table_id1 = @table_id2 @table_id2 = @table_id3 +0 0 +INSERT IGNORE INTO t1 VALUES (0, -123456); +Warnings: +Warning 1062 Duplicate entry '-123456' for key 'm' +REPLACE INTO t1 VALUES(-42, 123456); +INSERT IGNORE INTO t1 VALUES(32768, 2147483648); +Warnings: +Warning 1264 Out of range value for column 's' at row 1 +Warning 1264 Out of range value for column 'i' at row 1 +SELECT * FROM t1; +s i +-42 123456 +32767 2147483647 +DROP TABLE t1; +CREATE TABLE t1 (a SERIAL, b INT, c TINYINT UNIQUE) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 (c) VALUES(1),(2),(3); +ALTER TABLE t1 MODIFY c BIGINT; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +UPDATE t1 SET b=1 WHERE c=2; +UPDATE t1 SET c=4 WHERE a=3; +UPDATE t1 SET b=2 WHERE c>3; +UPDATE t1 SET c=c+1; +ERROR 23000: Duplicate entry '2' for key 'c' +SELECT * FROM t1; +a b c +1 NULL 1 +2 1 2 +3 2 4 +DROP TABLE t1; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES(1,'a'); +ALTER TABLE t1 MODIFY b VARCHAR(256), ADD COLUMN c INT; +INSERT INTO t1 VALUES(2,'bah',3); +SELECT * FROM t1; +a b c +1 a NULL +2 bah 3 +DROP TABLE t1; +CREATE TABLE t1(a CHAR(5) CHARACTER SET utf8 PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES('barf'); +ALTER TABLE t1 ADD b INT FIRST, ALGORITHM=INSTANT; +ALTER TABLE t1 ADD vb INT AS (b); +SELECT * FROM t1; +b a vb +NULL barf NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT, b TEXT, PRIMARY KEY(b(9))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 ADD COLUMN c TEXT FIRST; +ALTER TABLE t1 ADD COLUMN d TEXT GENERATED ALWAYS AS (SUBSTR(b,1,499)) FIRST; +DROP TABLE t1; +CREATE TABLE t1(a CHAR(5), b INT, c CHAR(1), d CHAR(1), PRIMARY KEY(a,b)) +DEFAULT CHARACTER SET utf8 ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a='fubar',b=42; +ALTER TABLE t1 DROP c, DROP d, ALGORITHM=INSTANT; +ALTER TABLE t1 ADD vb INT AS (b); +SELECT * FROM t1; +a b vb +fubar 42 42 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 MODIFY b INT FIRST; +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET pk=1; +ALTER TABLE t1 ADD COLUMN b INT; +BEGIN; +UPDATE t1 SET pk=2; +UPDATE t1 SET pk=1; +connection analyze; +SELECT * FROM t1; +pk b +1 NULL +connection default; +DROP TABLE t1; +disconnect analyze; +# +# MDEV-22465: DROP COLUMN is wrongly claimed to be ALGORITHM=INSTANT +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY +ALTER TABLE t1 DROP b, ALGORITHM=NOCOPY; +DROP TABLE t1; +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +209 +SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; +# +# MDEV-18266: Changing an index comment unnecessarily rebuilds index +# +CREATE TABLE t1(a INT, b INT) ENGINE=INNODB; +CREATE INDEX i1 ON t1(a) COMMENT 'comment1'; +ALTER TABLE t1 DROP INDEX i1, ADD INDEX i1(a) COMMENT 'comment2', ALGORITHM=INSTANT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `i1` (`a`) COMMENT 'comment2' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-25057 Assertion `n_fields < dtuple_get_n_fields(entry)' +# failed in dtuple_convert_big_rec +# +CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, +a CHAR(255) NOT NULL, +b CHAR(255) NOT NULL, c INT) ENGINE=InnoDB CHARSET utf32; +ALTER TABLE t1 DROP c; +INSERT INTO t1(a, b) SELECT '', '' FROM seq_1_to_16; +SELECT COUNT(*) FROM t1; +COUNT(*) +16 +DROP TABLE t1; +# +# MDEV-25630 Rollback of instant operation adds wrong +# column to secondary index +# +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, f4 INT, +PRIMARY KEY(f1, f4), +KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2 (f1 INT, f2 INT, PRIMARY KEY(f1), +FOREIGN KEY fk (f2) REFERENCES t2(f1) +)ENGINE=InnoDB; +ALTER TABLE t1 ADD f5 INT; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t1 DROP COLUMN f3, ADD FOREIGN KEY fk (f1) +REFERENCES x(x); +ERROR HY000: Failed to add the foreign key constraint 'test/fk' to system tables +ALTER TABLE t1 DROP COLUMN f5; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + `f3` int(11) DEFAULT NULL, + `f4` int(11) NOT NULL, + PRIMARY KEY (`f1`,`f4`), + KEY `f2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1, t2; +# +# MDEV-28822 Table from older version requires table rebuild when adding column to table with multi-column index +# +CREATE TABLE mdev28822_100427_innodb ( +id int not null primary key, +msg varchar(10), +index(id, msg) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +FLUSH TABLES; +ALTER TABLE mdev28822_100427_innodb ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE mdev28822_100427_innodb; diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result new file mode 100644 index 00000000..feacaa6b --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -0,0 +1,494 @@ +# +# MDEV-17821 Assertion `!page_rec_is_supremum(rec)' failed +# in btr_pcur_store_position +# +CREATE TABLE t1 (pk INT PRIMARY KEY, c INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,2); +ALTER TABLE t1 ADD COLUMN f VARCHAR(255); +ALTER TABLE t1 DROP COLUMN f; +DELETE FROM t1; +HANDLER t1 OPEN; +HANDLER t1 READ `PRIMARY` <= (3); +pk c +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT AUTO_INCREMENT, +f1 CHAR(32), +f2 CHAR(32), +f3 CHAR(32), +f4 INT, +f5 CHAR(32), +f6 INT, +f7 INT, +f8 INT, +PRIMARY KEY (pk), +UNIQUE (f6) +) ENGINE=InnoDB; +INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES +('reality', 'llt', 'within', -1996816384, 'j', 160, 7, -1822687232), +('h', 'j', 'j', 251, 'civilian', NULL, 211, NULL), +('ltq', 'b', 'mud', 111, 'v', 90, 0, NULL), +('toxic', 'breakfast', 'series', 2, 'x', NULL, 118, 2), +('h', 'n', 'vision', 84, 'n', NULL, 197, 103), +('h', 'tq', 'q', 6, 'bet', -1927151616, -446038016, 3), +('pocket', 'qjt', 'jtl', 0, 'blink', NULL, 12, 0), +('k', 'uv', 'exist', 37, 'g', 149, -1610219520, NULL), +('parent', 'motion', 'u', 70, 'promote', NULL, 178, NULL), +('get', 'convict', 'liquid', -780337152, 'd', NULL, 4, NULL), +('vp', 'px', 'xi', -631111680, 'support', NULL, 8, NULL), +('ck', 'z', 'minority', 8, 'k', NULL, 864878592, NULL), +('kxx', 'g', 'container', 1, 'cholesterol', NULL, 4, 1404436480), +('xxv', 'rail', 'j', 219, 'serious', NULL, -816119808, 62), +('x', 'v', 'vr', 146, 'm', 16, 170, -1765867520), +('age', 'm', 'q', -1251278848, 'rte', 6, 224, NULL), +('discrimination', 't', 'q', 31, 'exl', 0, 2, 244), +('water', 'x', 'ldb', 98, 'r', 235, 4, 63), +('d', 'db', 'p', 248, 'so-called', 102, -255524864, 198), +('last', 'bz', 'us', 0, 'experienced', 137, 240, 134), +('q', 'z', 'attract', 67, 'code', 67, 75, 1758920704), +('yellow', 'c', 'u', 6, 'v', 1731985408, 528154624, 2), +('cognitive', 'he', 'protective', 590020608, 'sentence', NULL, 4, 102), +('eih', 'l', 'ih', 1266024448, 'traditionally', NULL, 190, NULL), +('pine', 'i', 'y', 6, 'glimpse', 214, 7, -1486880768), +('jo', 'everyone', 'ol', 0, 'lj', NULL, 1, 0), +('blood', 'f', 'scientist', 54, 'j', 1341128704, 168, NULL), +('z', 'brief', 'ambassador', 115, 'ygp', 82, 129, NULL), +('gp', 'severe', 'consist', 7, 'p', -1829961728, 602669056, 154), +('admit', 'poetry', 'x', 116, 'enemy', 174, -2128543744, -407764992), +('s', 'norm', 'decide', 2055667712, 'rtz', NULL, 99, -1233715200), +('tzg', 'f', 'beg', 2016280576, 'w', NULL, -643825664, 137), +('zgg', 'x', 'f', 148, 'y', -987496448, -708116480, 8), +('attorney', 'perfectly', 's', 49, 'z', -1865285632, 56, -1518534656), +('concentrate', 's', 'k', -1028849664, 'tir', 83, -1592459264, 1820065792), +('t', 'sacrifice', 'ir', -2143879168, 'recipe', 156, 217, NULL), +('wdf', 'd', 'f', 137, 'empty', NULL, 188, NULL), +('o', 'customer', 'qd', -2135293952, 'z', 1527840768, 227, -1174929408), +('d', 'qow', 'o', 1472266240, 'whe', NULL, 7, 197), +('deny', 'reputation', 'dutch', 59, 'v', 124, 2, 191), +('m', 'liver', 'fv', 0, 'policy', 781582336, 198574080, 177), +('vk', 'kx', 'immigrant', -1452736512, 'x', 163, 76, 6) , +('j', 'ru', 'r', 67, 'joke', NULL, 3, NULL), +('o', 'u', 'a', -569442304, 'uz', NULL, 933298176, NULL), +('g', 'zb', 'c', -1694760960, 'fish', 18, -390463488, 1), +('bb', 'o', 'b', 6, 'z', 9, 12, NULL), +('compelling', 'xe', 'debut', 89, 'e', -734724096, 119, 175), +('md', 'r', 'object', 1046478848, 'frequently', 915537920, 0, 1506410496), +('dwn', 'wnz', 'x', 1767571456, 'nz', 241, -882180096, 9), +('zvf', 'vfo', 'g', -844824576, 'w', NULL, 1, 9), +('w', 'pose', 'r', 1029308416, 'a', -48627712, 1756168192, NULL), +('o', 'jwp', 'patient', 172, 'i', 297140224, 45809664, 3), +('w', 'p', 'american', 450297856, 'z', 20, 4, 186), +('ridiculous', 'helpful', 'vy', -2022899712, 'conspiracy', NULL, 162, -264634368), +('t', 'g', 'spite', 289931264, 'y', 4, 13, NULL), +('performer', 'i', 'tomato', -1519386624, 'mz', 8, 87, 106), +('m', 'z', 'hang', 3, 'crowded', -537919488, 1, 2), +('fu', 'uot', 'j', 1, 'o', 179, 220, -2084569088), +('ts', 'n', 'su', 1, 'o', 198, 9, 68), +('ball', 'halfway', 'uf', 40, 'l', 145948672, 9, 149), +('hunting', 'n', 'teenager', 0, 'neat', 209, 2044461056, 68), +('independent', 'along', 'fpn', 5, 'pn', 3, 1353252864, 217), +('p', 'presumably', 'n', -1977548800, 'balanced', 1909260288, 197, NULL), +('pink', 'h', 'tear', 8, 'n', 254, 8, 1006305280), +('tyy', 'n', 'yyr', 1107820544, 'yr', NULL, 0, 219), +('u', 'retirement', 'thread', -2083192832, 'rx', -678232064, 209, 1048969216), +('xk', 'kb', 'z', 9, 'ba', 218, 7, 8), +('a', 'plenty', 'forget', 36, 'c', 215, 2027094016, NULL), +('i', 'compromise', 'n', -1090256896, 'o', 10, 66, 1872887808), +('x', 'disappointment', 'cognitive', 753860608, 'ua', 77, 123, 10), +('e', 'added', 'aub', 2, 'u', NULL, 9, 92), +('bc', 'h', 'n', 146, 'master', NULL, 1003945984, NULL), +('execution', 'f', 'cgp', 574423040, 'gp', 2, -518782976, -1189085184), +('pv', 'bad', 'v', 132, 'r', 195, 6, 5), +('modify', 'participation', 'vol', 237, 'j', -842924032, 88, -747765760), +('substantially', 'i', 'congressional', 2, 'edit', NULL, 1003159552, NULL), +('tell', 'forty', 'v', -910098432, 'd', 43, 3, NULL), +('crawl', 'ad', 'respect', -1851195392, 'p', 72, -1709047808, 1343225856), +('w', 'reception', 'fiber', 56, 's', NULL, 2, -993787904), +('successful', 'instruct', 'dug', 2, 'u', 7, -411500544, NULL), +('appointment', 'pregnant', 'weird', 2, 'r', NULL, -897384448, 76), +('g', 'j', 'thin', 663617536, 'oan', 1, 7, NULL), +('secretary', 'a', 'o', 103, 'nj', 1977745408, -1291124736, -1314521088), +('g', 'jq', 'q', 1875116032, 'blame', NULL, 1, 4), +('oj', 'j', 'breast', 150, 'c', NULL, 3, NULL), +('rd', 'm', 'comprehensive', 1723334656, 't', NULL, 155, -312344576) , +('a', 'd', 'criminal', -1155137536, 'airplane', 242, -662896640, 1), +('fast', 'i', 'k', -386662400, 'zxe', NULL, 7, 119), +('xe', 'mouse', 'c', -205717504, 'ew', NULL, -729612288, 86), +('hang', 'j', 'o', 3, 'hungry', NULL, 200, 49), +('expense', 'z', 'sum', 2, 'gob', -472055808, -538181632, NULL), +('nest', 'o', 'k', 116, 'weak', NULL, 223, NULL); +INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3); +ERROR 23000: Duplicate entry '7' for key 'f6' +ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT ''; +SELECT * INTO OUTFILE 'load.data' FROM t1; +UPDATE IGNORE t1 SET pk = 0; +LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; +HANDLER t1 OPEN AS h; +HANDLER h READ `PRIMARY` PREV WHERE 0; +pk f1 f2 f3 f4 f5 f6 f7 f8 filler +HANDLER h CLOSE; +DROP TABLE t1; +# +# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys +# which are pointed to the table being altered +# +CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb; +CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL, +status ENUM ('a', 'b', 'c'), INDEX idx1(f2), +PRIMARY KEY(f1), +FOREIGN KEY (f2) REFERENCES t1(f1))ENGINE=InnoDB; +ALTER TABLE t1 CHANGE f1 f1_id INT NOT NULL, ADD f3 VARCHAR(255) DEFAULT NULL; +ALTER TABLE t1 CHANGE f1_id f1 INT NOT NULL; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f3` varchar(255) DEFAULT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL AUTO_INCREMENT, + `f2` int(11) NOT NULL, + `status` enum('a','b','c') DEFAULT NULL, + PRIMARY KEY (`f1`), + KEY `idx1` (`f2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t2 CHANGE status status VARCHAR(20) DEFAULT NULL; +DROP TABLE t2, t1; +# +# MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE +# +CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE, +FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB; +ALTER TABLE t2 +DROP FOREIGN KEY fk1, +CHANGE b d INT UNSIGNED, +ADD c INT; +DROP TABLE t2, t1; +# +# MDEV-22446 InnoDB aborts while adding instant column +# for discarded tablespace +# +CREATE TABLE t1(c1 INT NOT NULL, c2 INT NOT NULL DEFAULT 0)ENGINE=InnoDB; +INSERT INTO t1(c1) VALUES(1); +ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10; +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL)Engine=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +FLUSH TABLES; +ALTER TABLE t1 ADD COLUMN c2 INT NOT NULL; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) DEFAULT 10 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1; +c1 c2 c3 +1 0 10 +DROP TABLE t1; +# +# MDEV-23801 Assertion index->table->instant... failed +# in btr_pcur_store_position() +# +CREATE TABLE t ( +pk int auto_increment, +c01 char(255) not null default repeat('a',255), +c02 char(255) default repeat('a',255), +c03 char(255) default repeat('a',255), +c04 char(255) default repeat('a',255), +c05 char(255) not null default repeat('a',255), +c06 char(255) default repeat('a',255), +c07 char(255) default repeat('a',255), +c08 char(255) not null default repeat('a',255), +c09 char(255) default repeat('a',255), +c10 char(255) default repeat('a',255), +c11 char(255) default repeat('a',255), +c12 char(255) not null default repeat('a',255), +primary key (pk) +) ENGINE=InnoDB CHARACTER SET ucs2; +INSERT INTO t () VALUES (); +ALTER TABLE t ADD c INT; +BEGIN; +INSERT INTO t () VALUES (),(); +ROLLBACK; +DELETE FROM t; +InnoDB 0 transactions not purged +CREATE TABLE tt ENGINE=InnoDB AS SELECT c FROM t; +DROP TABLE t, tt; +# End of 10.3 tests +create table t ( +a varchar(9), +b int, +c int, +row_start bigint unsigned generated always as row start invisible, +row_end bigint unsigned generated always as row end invisible, +period for system_time (row_start, row_end) +) engine=innodb row_format=compressed with system versioning; +insert into t values (repeat('a', 9), 1, 1); +set @@system_versioning_alter_history = keep; +alter table t modify a varchar(10), algorithm=instant; +alter table t change b bb int, algorithm=instant; +alter table t modify c int without system versioning, algorithm=instant; +set @@system_versioning_alter_history = error; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +drop table t; +# +# MDEV-18219 Assertion `index->n_core_null_bytes <= ...' failed +# in rec_init_offsets after instant DROP COLUMN +# +CREATE TABLE t1 (a INT, b INT NOT NULL) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(0,9),(2,7),(3,1),(3,4),(8,4),(3,7),(6,1),(3,8),(1,2),(4,1),(0,8),(5,3), +(1,3),(1,6),(2,1),(8,7),(6,0),(1,9),(9,4),(0,6),(9,3),(0,9),(9,4),(2,4), +(2,7),(7,8),(8,2),(2,5),(6,1),(4,5),(5,3),(6,8),(4,9),(5,7),(7,5),(5,1), +(8,8),(5,7),(3,8),(0,1),(8,4),(8,3),(9,7),(4,8),(1,1),(0,4),(2,6),(8,5), +(8,8),(8,7),(6,7),(1,7),(9,6),(3,6),(1,9),(0,3),(5,3),(2,4),(0,6),(2,0), +(6,5),(1,6),(2,4),(9,1),(3,0),(6,4),(1,3),(0,8),(3,5),(3,1),(8,9),(9,9), +(7,9),(4,5),(2,2),(3,8),(0,8),(7,1),(2,0),(1,5),(7,3),(4,4),(3,9),(7,2), +(6,2),(0,4),(2,0),(1,5),(5,7),(4,5),(3,7),(6,0),(2,1),(5,0),(1,0),(2,0), +(8,4),(5,7),(3,5),(0,5),(7,6),(5,9),(1,2),(4,2),(8,5),(8,7),(2,8),(1,8), +(4,3),(1,6),(7,8),(3,7),(4,6),(1,1),(3,0),(1,6),(2,0),(3,4),(4,8),(3,9), +(8,0),(4,9),(4,0),(3,9),(6,4),(7,4),(5,8),(4,7),(7,3),(5,9),(2,3),(7,3), +(0,4),(5,9),(9,8),(4,2),(3,6),(2,6),(1,8),(7,0),(0,0),(2,3),(1,2),(3,3), +(2,7),(6,0),(9,0),(6,9),(4,6),(9,8),(0,7),(9,1),(9,6),(4,3),(7,7),(7,7), +(4,1),(4,7),(7,3),(2,8),(5,8),(8,9),(3,9),(7,7),(0,8),(4,9),(3,2),(5,0), +(1,7),(0,3),(2,9),(9,7),(7,5),(6,9),(8,5),(3,6),(1,1),(2,8),(7,9),(4,9), +(6,6),(5,9),(5,3),(9,8),(3,3),(5,6),(0,9),(3,9),(7,9),(7,3),(5,2),(1,4), +(4,4),(8,2),(2,2),(8,3),(9,1),(4,9),(9,8),(1,8),(1,8),(9,1),(1,1),(3,0), +(4,6),(9,3),(3,3),(5,2),(0,1),(3,4),(3,2),(1,3),(4,4),(7,0),(4,6),(7,2), +(4,5),(8,7),(7,8),(8,1),(3,5),(0,6),(3,5),(2,1),(4,4),(3,4),(2,1),(4,1); +INSERT INTO t1 SELECT * FROM t1; +ALTER TABLE t1 DROP a; +ALTER TABLE t1 ADD vb INT AS (b) VIRTUAL; +DROP TABLE t1; +# +# MDEV-19030 Assertion index->n_core_null_bytes <= ... failed +# in rec_init_offsets after instant DROP COLUMN +# +CREATE TABLE t1 (a INT, b INT NOT NULL DEFAULT 0) ENGINE=InnoDB; +INSERT INTO t1 () VALUES (),(),(),(); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +ALTER TABLE t1 FORCE; +INSERT INTO t1 SELECT * FROM t1; +ALTER TABLE t1 DROP a, ADD a SMALLINT NOT NULL; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +ALTER TABLE t1 ADD vb INT AS (b) VIRTUAL; +DROP TABLE t1; +# +# MDEV-18623 Assertion after DROP FULLTEXT INDEX and removing NOT NULL +# +CREATE TABLE t1 (c TEXT NOT NULL, FULLTEXT INDEX ftidx(c)) ENGINE=InnoDB +ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DROP INDEX ftidx; +ALTER TABLE t1 MODIFY c TEXT NULL, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY c TEXT NULL; +DROP TABLE t1; +# +# MDEV-20048 dtuple_get_nth_field(): Assertion 'n < tuple->n_fields' +# failed on ROLLBACK after instant DROP COLUMN +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET @b = REPEAT('b', @@innodb_page_size / 2 + 1); +INSERT INTO t1 VALUES(2, @b), (3, @b); +BEGIN; +DELETE FROM t1 WHERE a=2; +connect purge_control,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +COMMIT; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +BEGIN; +INSERT INTO t1 VALUES (2); +connection purge_control; +SELECT * FROM t1; +a +1 +2 +3 +disconnect purge_control; +connection default; +ROLLBACK; +SELECT * FROM t1; +a +1 +3 +DROP TABLE t1; +# +# MDEV-20479: assertion failure in dict_table_get_nth_col() after INSTANT DROP COLUMN +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN (b INT, c INT, d INT, e INT NOT NULL DEFAULT 0); +ALTER TABLE t1 ADD UNIQUE INDEX(e); +ALTER TABLE t1 DROP b, DROP c, DROP d, DROP e; +DROP TABLE t1; +# +# MDEV-20565 Assertion on CHANGE COLUMN...SYSTEM VERSIONING +# +set @@system_versioning_alter_history = keep; +CREATE TABLE t (a INT WITHOUT SYSTEM VERSIONING, b INT) ENGINE=InnoDB +WITH SYSTEM VERSIONING; +ALTER TABLE t CHANGE COLUMN a alpha INT WITH SYSTEM VERSIONING, +ALGORITHM=INSTANT; +DROP TABLE t; +CREATE TABLE t (alpha INT, b INT) ENGINE=InnoDB WITH SYSTEM VERSIONING; +ALTER TABLE t CHANGE COLUMN alpha a INT WITHOUT SYSTEM VERSIONING, +ALGORITHM=INSTANT; +DROP TABLE t; +set @@system_versioning_alter_history = error; +# +# MDEV-20117 Assertion 0 failed in row_sel_get_clust_rec_for_mysql +# +CREATE TABLE t (b INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t SET b=1; +ALTER TABLE t ADD COLUMN a INT FIRST, ALGORITHM=INSTANT; +DELETE FROM t; +ALTER TABLE t ADD COLUMN c INT, ALGORITHM=INSTANT; +ALTER TABLE t DROP COLUMN c, ALGORITHM=INSTANT; +SELECT * FROM t; +a b +DROP TABLE t; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT) ENGINE=InnoDB; +INSERT INTO t1 SET a=1; +INSERT INTO t1 SET a=2; +BEGIN; +UPDATE t1 SET b=1; +DELETE FROM t1; +COMMIT; +ALTER TABLE t1 DROP b, DROP c, DROP d, DROP e; +InnoDB 0 transactions not purged +SELECT * FROM t1; +a +DROP TABLE t1; +# +# MDEV-20190 Instant operation fails when add column and collation +# change on non-indexed column +# +CREATE TABLE t1 (a CHAR)ENGINE=INNODB; +ALTER TABLE t1 DEFAULT COLLATE= latin1_general_cs; +ALTER TABLE t1 ADD COLUMN b INT NOT NULL, MODIFY a CHAR, ALGORITHM=INSTANT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL, + `b` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs +DROP TABLE t1; +CREATE TABLE t1 (a CHAR NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DEFAULT COLLATE = latin1_general_cs; +ALTER TABLE t1 MODIFY a CHAR, ALGORITHM=INSTANT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs ROW_FORMAT=REDUNDANT +DROP TABLE t1; +CREATE TABLE t1 (a CHAR NOT NULL) CHARSET latin2 COLLATE latin2_bin +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 DEFAULT COLLATE = latin2_general_ci; +ALTER TABLE t1 MODIFY a CHAR, ALGORITHM=INSTANT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin2 COLLATE=latin2_general_ci ROW_FORMAT=REDUNDANT +DROP TABLE t1; +# +# MDEV-21645 SIGSEGV in innobase_get_computed_value +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, va INTEGER GENERATED ALWAYS AS (a)) +ENGINE=InnoDB; +INSERT INTO t1 SET a=1, b=NULL; +ALTER TABLE t1 MODIFY COLUMN b INT FIRST; +ALTER TABLE t1 ADD UNIQUE INDEX (va); +DROP TABLE t1; +# +# MDEV-22651 Assertion dict_col_get_fixed_size... +# in dict_table_t::init_instant() +# +CREATE TABLE t (i INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t SET i=1; +ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT; +DROP TABLE t; +# +# MDEV-23499 Assertion c.same_type(*o) failed +# +CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB; +ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST; +DROP TABLE t; +# +# MDEV-23672 Assertion `v.v_indexes.empty()' failed in dict_table_t::instant_column +# +create table t1 ( +col_int integer, +col_text text not null, +col_int_g integer generated always as (col_int) unique, +col_text_g text generated always as (substr(col_text,1,499)) ) +engine innodb row_format = redundant; +insert into t1 (col_int,col_text) values (0, 'a'), (null, 'b'); +alter table t1 modify column col_text text null, algorithm = instant; +insert into t1 (col_int,col_text) values (1, null), (null, null); +update t1 set col_text= 'd'; +select * from t1; +col_int col_text col_int_g col_text_g +0 d 0 d +NULL d NULL d +1 d 1 d +NULL d NULL d +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +# +# MDEV-24072 Assertion 'ib_table.n_v_cols' failed +# in instant_alter_column_possible() +# +CREATE TABLE t (a BLOB) ENGINE=InnoDB; +INSERT INTO t VALUES ('a'); +ALTER TABLE t ADD c INT GENERATED ALWAYS AS (a+1) VIRTUAL, ADD KEY(c); +ERROR 22007: Truncated incorrect DOUBLE value: 'a' +ALTER TABLE t ADD d INT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t; +# +# MDEV-28060 Online DDL fails while checking for instant +# alter condition +# +CREATE TABLE t1(f1 CHAR(10) NOT NULL)ROW_FORMAT=REDUNDANT,ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN(f2 INT NOT NULL, f3 INT NOT NULL, +f4 INT NOT NULL, f5 INT NOT NULL), +CHANGE COLUMN f1 f1 CHAR(10) DEFAULT NULL; +DROP TABLE t1; +# +# MDEV-26420 Buffer overflow on instant ADD/DROP of generated column +# +CREATE TABLE t1 (i int AS (0) STORED, j INT) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN i INT GENERATED ALWAYS AS (1), DROP COLUMN i; +DROP TABLE t1; +# End of 10.4 tests diff --git a/mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff b/mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff new file mode 100644 index 00000000..90846ac4 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_charset,redundant.rdiff @@ -0,0 +1,58 @@ +@@ -279,7 +279,6 @@ + alter table boundary_255 + modify a varchar(70) charset utf8mb4, + algorithm=instant; +-ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + drop table boundary_255; + create table t ( + a char(10) collate utf8mb3_general_ci, +@@ -297,32 +296,21 @@ + repeat('a', 10), repeat('a', 10) + ); + alter table t modify a char(10) collate utf8mb4_general_ci, algorithm=instant; +-check table t; +-Table Op Msg_type Msg_text +-test.t check status OK ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + alter table t modify b char(70) collate utf8mb4_general_ci, algorithm=instant; +-check table t; +-Table Op Msg_type Msg_text +-test.t check status OK ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + alter table t modify c char(100) collate utf8mb4_general_ci, algorithm=instant; +-check table t; +-Table Op Msg_type Msg_text +-test.t check status OK ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + alter table t modify aa char(10) collate utf8mb4_general_ci, algorithm=instant; +-check table t; +-Table Op Msg_type Msg_text +-test.t check status OK ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + alter table t modify bb char(70) collate utf8mb4_general_ci, algorithm=instant; +-check table t; +-Table Op Msg_type Msg_text +-test.t check status OK ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + alter table t modify cc char(100) collate utf8mb4_general_ci, algorithm=instant; +-check table t; +-Table Op Msg_type Msg_text +-test.t check status OK ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + alter table t modify d char(10) collate utf8mb4_spanish_ci, algorithm=instant; ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + alter table t modify dd char(10) collate utf8mb4_spanish_ci, algorithm=instant; +-ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY ++ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY + select * from t; + a b c aa bb cc d dd + aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaa +@@ -2066,7 +2054,7 @@ + ALTER TABLE t1 + CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci, + ADD UNIQUE INDEX test_key (a); +-ERROR 23000: Duplicate entry 'NULL' for key 'test_key' ++ERROR 23000: Duplicate entry 'a1' for key 'test_key' + ALTER TABLE t1 CONVERT TO CHARACTER SET UTF8MB4 COLLATE UTF8MB4_UNICODE_520_CI; + CHECK TABLE t1; + Table Op Msg_type Msg_text diff --git a/mysql-test/suite/innodb/r/instant_alter_charset.result b/mysql-test/suite/innodb/r/instant_alter_charset.result new file mode 100644 index 00000000..91b16658 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_charset.result @@ -0,0 +1,2078 @@ +set names utf8; +create table no_rebuild ( +a char(150) charset utf8mb3 collate utf8mb3_general_ci +) engine=innodb; +create table rebuild ( +a varchar(150) charset ascii +) engine=innodb; +set @id = (select table_id from information_schema.innodb_sys_tables +where name = 'test/no_rebuild'); +select name, prtype, len from information_schema.innodb_sys_columns +where table_id = @id; +name prtype len +a 2162942 450 +select c.prtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id +where t.name = 'test/rebuild' and c.name = 'a'; +prtype len +720911 150 +alter table no_rebuild +change a a char(150) charset utf8mb3 collate utf8mb3_spanish_ci, +algorithm=inplace; +alter table rebuild +change a a varchar(150) charset latin1 not null default 'asdf', +algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table rebuild +change a a varchar(150) charset latin1 not null default 'asdf', +algorithm=copy; +select name, prtype, len from information_schema.innodb_sys_columns +where table_id = @id; +name prtype len +a 13041918 450 +select c.prtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id +where t.name = 'test/rebuild' and c.name = 'a'; +prtype len +524559 150 +drop table no_rebuild, rebuild; +create table supported_types ( +id int primary key auto_increment, +a varchar(150) charset ascii, +b text(150) charset ascii, +c text charset ascii, +d tinytext charset ascii, +e mediumtext charset ascii, +f longtext charset ascii +) engine=innodb; +alter table supported_types +convert to charset ascii collate ascii_bin, +algorithm=instant; +drop table supported_types; +create table various_cases ( +a char(150) charset ascii, +b varchar(150) as (a) virtual, +c char(150) as (a) persistent +) engine=innodb; +alter table various_cases +change a a char(150) charset ascii collate ascii_bin, +algorithm=inplace; +alter table various_cases +change a a varchar(222), +algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table various_cases +change b b varchar(150) as (a) virtual, +algorithm=inplace; +alter table various_cases +change c c char(150) as (a) persistent, +algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +alter table various_cases +modify a char(150) charset utf8mb4, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table various_cases; +create table all_texts ( +a tinytext charset ascii, +b text charset ascii, +c mediumtext charset ascii, +d longtext charset ascii, +footer int +) engine=innodb; +alter table all_texts +convert to charset ascii collate ascii_bin, +algorithm=instant; +drop table all_texts; +create table all_binaries ( +a tinyblob, +b blob, +c mediumblob, +d longblob, +e varbinary(150), +f binary(150) +) engine=innodb; +alter table all_binaries modify a tinytext, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_binaries modify b text, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_binaries modify c mediumtext, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_binaries modify d longtext, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_binaries modify e varchar(150), algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_binaries modify f char(150), algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table all_binaries; +create table all_strings ( +a tinytext, +b text, +c mediumtext, +d longtext, +e varchar(150), +f char(150) +) engine=innodb; +alter table all_strings modify a tinyblob, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify b blob, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify c mediumblob, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify d longblob, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify e varbinary(150), algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify f binary(150), algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify a tinytext charset binary, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify b text charset binary, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify c mediumtext charset binary, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify d longtext charset binary, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify e varchar(150) charset binary, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table all_strings modify f char(150) charset binary, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table all_strings; +create table key_part_change ( +a char(150) charset ascii, +b char(150) charset ascii, +c char(150) charset ascii, +unique key ab (a,b) +) engine=innodb; +alter table key_part_change +modify a char(150) charset utf8mb4, +drop index ab, +add unique key ab(a,c), +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table key_part_change; +create table key_part_change_and_rename ( +a char(100) charset ascii, +b char(100) charset ascii, +unique key ab (a,b) +) engine=innodb; +alter table key_part_change_and_rename +change a b char(100) charset utf8mb4, +change b a char(100) charset utf8mb4, +drop index ab, +add unique key ab(a,b), +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table key_part_change_and_rename; +create table enum_and_set ( +a enum('one', 'two') charset utf8mb3, +b set('three', 'four') charset utf8mb3 +) engine=innodb; +alter table enum_and_set +modify a enum('one', 'two') charset utf8mb4, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table enum_and_set +modify b enum('three', 'four') charset utf8mb4, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table enum_and_set; +create table compressed ( +a varchar(255) compressed charset utf8mb3 +) engine=innodb; +insert into compressed values ('AAA'), ('bbb'), ('CCC'); +alter table compressed +modify a varchar(255) compressed charset utf8mb4, +algorithm=instant; +select * from compressed; +a +AAA +bbb +CCC +check table compresed; +Table Op Msg_type Msg_text +test.compresed check Error Table 'test.compresed' doesn't exist +test.compresed check status Operation failed +drop table compressed; +create table key_part_bug ( +id int primary key auto_increment, +a varchar(150) charset utf8mb3 unique key +) engine=innodb; +alter table key_part_bug +modify a varchar(150) charset utf8mb4, +algorithm=instant; +drop table key_part_bug; +create table latin1_swedish_special_case ( +copy1 varchar(150) charset ascii collate ascii_general_ci, +copy2 char(150) charset ascii collate ascii_general_ci, +instant1 varchar(150) charset ascii collate ascii_general_ci, +instant2 char(150) charset ascii collate ascii_general_ci +) engine=innodb; +select c.name, c.prtype, c.mtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id +where t.name = 'test/latin1_swedish_special_case'; +name prtype mtype len +copy1 720911 12 150 +copy2 721150 13 150 +instant1 720911 12 150 +instant2 721150 13 150 +alter table latin1_swedish_special_case +modify copy1 varchar(150) charset latin1 collate latin1_swedish_ci, +modify copy2 char(150) charset latin1 collate latin1_swedish_ci, +algorithm=copy; +alter table latin1_swedish_special_case +modify instant1 varchar(150) charset latin1 collate latin1_swedish_ci, +modify instant2 char(150) charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table latin1_swedish_special_case +modify instant1 varchar(150) charset latin1 collate latin1_swedish_ci, +modify instant2 char(150) charset latin1 collate latin1_swedish_ci, +algorithm=copy; +select c.name, c.prtype, c.mtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id +where t.name = 'test/latin1_swedish_special_case'; +name prtype mtype len +copy1 524303 1 150 +copy2 524542 2 150 +instant1 524303 1 150 +instant2 524542 2 150 +alter table latin1_swedish_special_case +modify copy1 varchar(150) charset latin1 collate latin1_general_ci, +modify copy2 char(150) charset latin1 collate latin1_general_ci, +algorithm=copy; +alter table latin1_swedish_special_case +modify instant1 varchar(150) charset latin1 collate latin1_general_ci, +modify instant2 char(150) charset latin1 collate latin1_general_ci, +algorithm=instant; +select c.name, c.prtype, c.mtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id +where t.name = 'test/latin1_swedish_special_case'; +name prtype mtype len +copy1 3145743 12 150 +copy2 3145982 13 150 +instant1 3145743 12 150 +instant2 3145982 13 150 +drop table latin1_swedish_special_case; +create table regression (a varchar(100) charset utf8mb3 primary key, b int) engine=innodb; +alter table regression convert to character set utf8mb4; +drop table regression; +create table boundary_255 ( +a varchar(50) charset ascii, +b varchar(200) charset ascii, +c varchar(300) charset ascii +) engine=innodb; +alter table boundary_255 +modify a varchar(50) charset utf8mb3, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table boundary_255 +modify a varchar(50) charset utf8mb3, +algorithm=copy; +alter table boundary_255 +modify b varchar(200) charset utf8mb3, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table boundary_255 +modify c varchar(300) charset utf8mb3, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table boundary_255; +create table boundary_255 ( +a varchar(70) charset utf8mb3 +) engine=innodb; +alter table boundary_255 +modify a varchar(70) charset utf8mb4, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table boundary_255; +create table t ( +a char(10) collate utf8mb3_general_ci, +b char(70) collate utf8mb3_general_ci, +c char(100) collate utf8mb3_general_ci, +aa char(10) collate utf8mb3_general_ci unique, +bb char(70) collate utf8mb3_general_ci unique, +cc char(100) collate utf8mb3_general_ci unique, +d char(10) collate utf8mb3_general_ci, +dd char(10) collate utf8mb3_general_ci unique +) engine=innodb; +insert into t values +(repeat('a', 10), repeat('a', 70), repeat('a', 100), +repeat('a', 10), repeat('a', 70), repeat('a', 100), +repeat('a', 10), repeat('a', 10) +); +alter table t modify a char(10) collate utf8mb4_general_ci, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify b char(70) collate utf8mb4_general_ci, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify c char(100) collate utf8mb4_general_ci, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify aa char(10) collate utf8mb4_general_ci, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify bb char(70) collate utf8mb4_general_ci, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify cc char(100) collate utf8mb4_general_ci, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify d char(10) collate utf8mb4_spanish_ci, algorithm=instant; +alter table t modify dd char(10) collate utf8mb4_spanish_ci, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +select * from t; +a b c aa bb cc d dd +aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaa +drop table t; +create table fully_compatible ( +id int auto_increment unique key, +from_charset char(255), +from_collate char(255), +to_charset char(255), +to_collate char(255) +); +insert into fully_compatible (from_charset, from_collate, to_charset, to_collate) values +('utf8mb3', 'utf8mb3_general_ci', 'utf8mb4', 'utf8mb4_general_ci'), +('utf8mb3', 'utf8mb3_bin', 'utf8mb4', 'utf8mb4_bin'), +('utf8mb3', 'utf8mb3_unicode_ci', 'utf8mb4', 'utf8mb4_unicode_ci'), +('utf8mb3', 'utf8mb3_icelandic_ci', 'utf8mb4', 'utf8mb4_icelandic_ci'), +('utf8mb3', 'utf8mb3_latvian_ci', 'utf8mb4', 'utf8mb4_latvian_ci'), +('utf8mb3', 'utf8mb3_romanian_ci', 'utf8mb4', 'utf8mb4_romanian_ci'), +('utf8mb3', 'utf8mb3_slovenian_ci', 'utf8mb4', 'utf8mb4_slovenian_ci'), +('utf8mb3', 'utf8mb3_polish_ci', 'utf8mb4', 'utf8mb4_polish_ci'), +('utf8mb3', 'utf8mb3_estonian_ci', 'utf8mb4', 'utf8mb4_estonian_ci'), +('utf8mb3', 'utf8mb3_spanish_ci', 'utf8mb4', 'utf8mb4_spanish_ci'), +('utf8mb3', 'utf8mb3_swedish_ci', 'utf8mb4', 'utf8mb4_swedish_ci'), +('utf8mb3', 'utf8mb3_turkish_ci', 'utf8mb4', 'utf8mb4_turkish_ci'), +('utf8mb3', 'utf8mb3_czech_ci', 'utf8mb4', 'utf8mb4_czech_ci'), +('utf8mb3', 'utf8mb3_danish_ci', 'utf8mb4', 'utf8mb4_danish_ci'), +('utf8mb3', 'utf8mb3_lithuanian_ci', 'utf8mb4', 'utf8mb4_lithuanian_ci'), +('utf8mb3', 'utf8mb3_slovak_ci', 'utf8mb4', 'utf8mb4_slovak_ci'), +('utf8mb3', 'utf8mb3_spanish2_ci', 'utf8mb4', 'utf8mb4_spanish2_ci'), +('utf8mb3', 'utf8mb3_roman_ci', 'utf8mb4', 'utf8mb4_roman_ci'), +('utf8mb3', 'utf8mb3_persian_ci', 'utf8mb4', 'utf8mb4_persian_ci'), +('utf8mb3', 'utf8mb3_esperanto_ci', 'utf8mb4', 'utf8mb4_esperanto_ci'), +('utf8mb3', 'utf8mb3_hungarian_ci', 'utf8mb4', 'utf8mb4_hungarian_ci'), +('utf8mb3', 'utf8mb3_sinhala_ci', 'utf8mb4', 'utf8mb4_sinhala_ci'), +('utf8mb3', 'utf8mb3_german2_ci', 'utf8mb4', 'utf8mb4_german2_ci'), +('utf8mb3', 'utf8mb3_croatian_mysql561_ci', 'utf8mb4', 'utf8mb4_croatian_mysql561_ci'), +('utf8mb3', 'utf8mb3_unicode_520_ci', 'utf8mb4', 'utf8mb4_unicode_520_ci'), +('utf8mb3', 'utf8mb3_vietnamese_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'), +('utf8mb3', 'utf8mb3_croatian_ci', 'utf8mb4', 'utf8mb4_croatian_ci'), +('utf8mb3', 'utf8mb3_myanmar_ci', 'utf8mb4', 'utf8mb4_myanmar_ci'), +('utf8mb3', 'utf8mb3_thai_520_w2', 'utf8mb4', 'utf8mb4_thai_520_w2'), +('utf8mb3', 'utf8mb3_general_nopad_ci', 'utf8mb4', 'utf8mb4_general_nopad_ci'), +('utf8mb3', 'utf8mb3_nopad_bin', 'utf8mb4', 'utf8mb4_nopad_bin'), +('utf8mb3', 'utf8mb3_unicode_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_nopad_ci'), +('utf8mb3', 'utf8mb3_unicode_520_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_520_nopad_ci') +; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_general_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_general_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_general_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_general_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_bin, +b varchar(50) charset utf8mb3 collate utf8mb3_bin primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_bin, +modify b varchar(50) charset utf8mb4 collate utf8mb4_bin, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_unicode_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_unicode_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_icelandic_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_icelandic_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_icelandic_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_icelandic_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_latvian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_latvian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_latvian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_latvian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_romanian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_romanian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_romanian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_romanian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_slovenian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_slovenian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_slovenian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_slovenian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_polish_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_polish_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_polish_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_polish_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_estonian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_estonian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_estonian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_estonian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_spanish_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_spanish_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_spanish_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_spanish_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_swedish_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_swedish_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_turkish_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_turkish_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_turkish_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_turkish_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_czech_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_czech_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_czech_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_czech_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_danish_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_danish_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_danish_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_lithuanian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_lithuanian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_slovak_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_slovak_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_slovak_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_slovak_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_spanish2_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_spanish2_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_spanish2_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_spanish2_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_roman_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_roman_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_roman_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_roman_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_persian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_persian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_persian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_persian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_esperanto_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_esperanto_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_esperanto_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_esperanto_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_hungarian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_hungarian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_hungarian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_hungarian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_sinhala_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_sinhala_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_sinhala_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_sinhala_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_german2_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_german2_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_german2_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_german2_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_croatian_mysql561_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_croatian_mysql561_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_croatian_mysql561_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_croatian_mysql561_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_unicode_520_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_unicode_520_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_unicode_520_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_unicode_520_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_vietnamese_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_vietnamese_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_croatian_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_croatian_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_croatian_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_croatian_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_myanmar_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_myanmar_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_thai_520_w2, +b varchar(50) charset utf8mb3 collate utf8mb3_thai_520_w2 primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2, +modify b varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_general_nopad_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_general_nopad_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin, +b varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_nopad_bin, +modify b varchar(50) charset utf8mb4 collate utf8mb4_nopad_bin, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_unicode_nopad_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_unicode_nopad_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_unicode_nopad_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_unicode_nopad_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_unicode_520_nopad_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_unicode_520_nopad_ci primary key +) engine=innodb; +insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb'); +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_unicode_520_nopad_ci, +modify b varchar(50) charset utf8mb4 collate utf8mb4_unicode_520_nopad_ci, +algorithm=instant; +check table tmp; +Table Op Msg_type Msg_text +test.tmp check status OK +drop table tmp; +drop table fully_compatible; +create table compatible_without_index ( +id int auto_increment unique key, +from_charset char(255), +from_collate char(255), +to_charset char(255), +to_collate char(255) +); +insert into compatible_without_index (from_charset, from_collate, to_charset, to_collate) values +('utf8mb3', 'utf8mb3_general_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'), +('utf8mb3', 'utf8mb3_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'), +('utf8mb3', 'utf8mb3_general_nopad_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'), +('utf8mb3', 'utf8mb3_nopad_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'), +('ascii', 'ascii_general_ci', 'ascii', 'ascii_bin'), +('utf8mb3', 'utf8mb3_roman_ci', 'utf8mb3', 'utf8mb3_lithuanian_ci'), +('utf8mb4', 'utf8mb4_thai_520_w2', 'utf8mb4', 'utf8mb4_persian_ci'), +('utf8mb3', 'utf8mb3_myanmar_ci', 'utf8mb4', 'utf8mb4_german2_ci'), +('utf8mb3', 'utf8mb3_general_ci', 'utf8mb3', 'utf8mb3_unicode_ci'), +('latin1', 'latin1_general_cs', 'latin1', 'latin1_general_ci'), +('utf16', 'utf16_general_ci', 'utf16', 'utf16_german2_ci') +; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_general_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_general_ci unique key, +c varchar(50) charset utf8mb3 collate utf8mb3_general_ci primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_bin, +b varchar(50) charset utf8mb3 collate utf8mb3_bin unique key, +c varchar(50) charset utf8mb3 collate utf8mb3_bin primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci unique key, +c varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin, +b varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin unique key, +c varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset ascii collate ascii_general_ci, +b varchar(50) charset ascii collate ascii_general_ci unique key, +c varchar(50) charset ascii collate ascii_general_ci primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset ascii collate ascii_bin, +algorithm=instant; +alter table tmp +modify b varchar(50) charset ascii collate ascii_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset ascii collate ascii_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_roman_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_roman_ci unique key, +c varchar(50) charset utf8mb3 collate utf8mb3_roman_ci primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2, +b varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2 unique key, +c varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2 primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_persian_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb4 collate utf8mb4_persian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb4 collate utf8mb4_persian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci unique key, +c varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb4 collate utf8mb4_german2_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb4 collate utf8mb4_german2_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb4 collate utf8mb4_german2_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf8mb3 collate utf8mb3_general_ci, +b varchar(50) charset utf8mb3 collate utf8mb3_general_ci unique key, +c varchar(50) charset utf8mb3 collate utf8mb3_general_ci primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset latin1 collate latin1_general_cs, +b varchar(50) charset latin1 collate latin1_general_cs unique key, +c varchar(50) charset latin1 collate latin1_general_cs primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset latin1 collate latin1_general_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset latin1 collate latin1_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset latin1 collate latin1_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(50) charset utf16 collate utf16_general_ci, +b varchar(50) charset utf16 collate utf16_general_ci unique key, +c varchar(50) charset utf16 collate utf16_general_ci primary key +) engine=innodb; +alter table tmp +change a a varchar(50) charset utf16 collate utf16_german2_ci, +algorithm=instant; +alter table tmp +modify b varchar(50) charset utf16 collate utf16_german2_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table tmp +modify c varchar(50) charset utf16 collate utf16_german2_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +drop table compatible_without_index; +create table fully_incompatible ( +id int auto_increment unique key, +from_charset char(255), +from_collate char(255), +to_charset char(255), +to_collate char(255) +); +insert into fully_incompatible (from_charset, from_collate, to_charset, to_collate) values +('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_general_ci'), +('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_general_ci'), +('ascii', 'ascii_general_ci', 'latin1', 'latin1_general_ci'), +('ascii', 'ascii_bin', 'latin1', 'latin1_bin'), +('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_nopad_bin'), +('ascii', 'ascii_general_ci', 'latin2', 'latin2_general_ci'), +('ascii', 'ascii_general_ci', 'latin7', 'latin7_general_ci'), +('ascii', 'ascii_bin', 'koi8u', 'koi8u_bin'), +('ascii', 'ascii_bin', 'ujis', 'ujis_bin'), +('ascii', 'ascii_bin', 'big5', 'big5_bin'), +('ascii', 'ascii_bin', 'gbk', 'gbk_bin'), +('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_swedish_ci'), +('ascii', 'ascii_bin', 'latin1', 'latin1_swedish_ci'), +('ascii', 'ascii_general_nopad_ci', 'latin1', 'latin1_swedish_ci'), +('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_swedish_ci'), +('ascii', 'ascii_general_ci', 'koi8u', 'koi8u_bin'), +('ascii', 'ascii_general_nopad_ci', 'koi8u', 'koi8u_bin'), +('ascii', 'ascii_nopad_bin', 'koi8u', 'koi8u_bin'), +('ascii', 'ascii_general_ci', 'latin1', 'latin1_swedish_ci'), +('ascii', 'ascii_bin', 'utf8mb3', 'utf8mb3_swedish_ci'), +('ascii', 'ascii_general_nopad_ci', 'utf8mb3', 'utf8mb3_swedish_ci'), +('ascii', 'ascii_nopad_bin', 'utf8mb3', 'utf8mb3_swedish_ci'), +('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_danish_ci'), +('ascii', 'ascii_bin', 'utf8mb4', 'utf8mb4_danish_ci'), +('ascii', 'ascii_general_nopad_ci', 'utf8mb4', 'utf8mb4_danish_ci'), +('ascii', 'ascii_nopad_bin', 'utf8mb4', 'utf8mb4_danish_ci'), +('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_ci'), +('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_nopad_ci'), +('ascii', 'ascii_general_ci', 'ujis', 'ujis_japanese_ci'), +('ascii', 'ascii_general_ci', 'big5', 'big5_chinese_ci'), +('ascii', 'ascii_general_ci', 'latin2', 'latin2_croatian_ci'), +('ascii', 'ascii_general_ci', 'latin7', 'latin7_estonian_cs'), +('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'), +('ucs2', 'ucs2_unicode_ci', 'utf16', 'utf16_unicode_ci'), +('ucs2', 'ucs2_icelandic_ci', 'utf16', 'utf16_icelandic_ci'), +('ucs2', 'ucs2_latvian_ci', 'utf16', 'utf16_latvian_ci'), +('ucs2', 'ucs2_romanian_ci', 'utf16', 'utf16_romanian_ci'), +('ucs2', 'ucs2_slovenian_ci', 'utf16', 'utf16_slovenian_ci'), +('ucs2', 'ucs2_polish_ci', 'utf16', 'utf16_polish_ci'), +('ucs2', 'ucs2_estonian_ci', 'utf16', 'utf16_estonian_ci'), +('ucs2', 'ucs2_spanish_ci', 'utf16', 'utf16_spanish_ci'), +('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'), +('ucs2', 'ucs2_myanmar_ci', 'utf16', 'utf16_thai_520_w2'), +('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_unicode_nopad_ci'), +('ucs2', 'ucs2_general_mysql500_ci', 'utf16', 'utf16_spanish2_ci'), +('utf8mb4', 'utf8mb4_general_ci', 'utf8mb3', 'utf8mb3_general_ci'), +('utf8mb4', 'utf8mb4_general_ci', 'ascii', 'ascii_general_ci'), +('utf8mb3', 'utf8mb3_general_ci', 'ascii', 'ascii_general_ci'), +('utf8mb3', 'utf8mb3_general_ci', 'latin1', 'latin1_general_ci'), +('utf16', 'utf16_general_ci', 'utf32', 'utf32_general_ci'), +('latin1', 'latin1_general_ci', 'ascii', 'ascii_general_ci'), +('ascii', 'ascii_general_ci', 'swe7', 'swe7_swedish_ci'), +('eucjpms', 'eucjpms_japanese_nopad_ci', 'geostd8', 'geostd8_general_ci'), +('latin1', 'latin1_general_ci', 'utf16', 'utf16_general_ci') +; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb3 collate utf8mb3_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb3 collate utf8mb3_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb4 collate utf8mb4_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb4 collate utf8mb4_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_nopad_bin, +b text(150) charset ascii collate ascii_nopad_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_nopad_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_nopad_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin2 collate latin2_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin2 collate latin2_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin7 collate latin7_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin7 collate latin7_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset ujis collate ujis_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset ujis collate ujis_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset big5 collate big5_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset big5 collate big5_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset gbk collate gbk_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset gbk collate gbk_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_nopad_ci, +b text(150) charset ascii collate ascii_general_nopad_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_nopad_bin, +b text(150) charset ascii collate ascii_nopad_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_nopad_ci, +b text(150) charset ascii collate ascii_general_nopad_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_nopad_bin, +b text(150) charset ascii collate ascii_nopad_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset koi8u collate koi8u_bin, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_nopad_ci, +b text(150) charset ascii collate ascii_general_nopad_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_nopad_bin, +b text(150) charset ascii collate ascii_nopad_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb3 collate utf8mb3_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_bin, +b text(150) charset ascii collate ascii_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_nopad_ci, +b text(150) charset ascii collate ascii_general_nopad_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_nopad_bin, +b text(150) charset ascii collate ascii_nopad_bin, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb4 collate utf8mb4_danish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset gbk collate gbk_chinese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset gbk collate gbk_chinese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset gbk collate gbk_chinese_nopad_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset gbk collate gbk_chinese_nopad_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset ujis collate ujis_japanese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset ujis collate ujis_japanese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset big5 collate big5_chinese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset big5 collate big5_chinese_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin2 collate latin2_croatian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin2 collate latin2_croatian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin7 collate latin7_estonian_cs, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin7 collate latin7_estonian_cs, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_general_ci, +b text(150) charset ucs2 collate ucs2_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_unicode_ci, +b text(150) charset ucs2 collate ucs2_unicode_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_unicode_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_unicode_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_icelandic_ci, +b text(150) charset ucs2 collate ucs2_icelandic_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_icelandic_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_icelandic_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_latvian_ci, +b text(150) charset ucs2 collate ucs2_latvian_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_latvian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_latvian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_romanian_ci, +b text(150) charset ucs2 collate ucs2_romanian_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_romanian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_romanian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_slovenian_ci, +b text(150) charset ucs2 collate ucs2_slovenian_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_slovenian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_slovenian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_polish_ci, +b text(150) charset ucs2 collate ucs2_polish_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_polish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_polish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_estonian_ci, +b text(150) charset ucs2 collate ucs2_estonian_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_estonian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_estonian_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_spanish_ci, +b text(150) charset ucs2 collate ucs2_spanish_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_spanish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_spanish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_general_ci, +b text(150) charset ucs2 collate ucs2_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_myanmar_ci, +b text(150) charset ucs2 collate ucs2_myanmar_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_thai_520_w2, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_thai_520_w2, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_general_ci, +b text(150) charset ucs2 collate ucs2_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_unicode_nopad_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_unicode_nopad_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ucs2 collate ucs2_general_mysql500_ci, +b text(150) charset ucs2 collate ucs2_general_mysql500_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_spanish2_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_spanish2_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset utf8mb4 collate utf8mb4_general_ci, +b text(150) charset utf8mb4 collate utf8mb4_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf8mb3 collate utf8mb3_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf8mb3 collate utf8mb3_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset utf8mb4 collate utf8mb4_general_ci, +b text(150) charset utf8mb4 collate utf8mb4_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset ascii collate ascii_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset ascii collate ascii_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset utf8mb3 collate utf8mb3_general_ci, +b text(150) charset utf8mb3 collate utf8mb3_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset ascii collate ascii_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset ascii collate ascii_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset utf8mb3 collate utf8mb3_general_ci, +b text(150) charset utf8mb3 collate utf8mb3_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset latin1 collate latin1_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset latin1 collate latin1_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset utf16 collate utf16_general_ci, +b text(150) charset utf16 collate utf16_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf32 collate utf32_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf32 collate utf32_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset latin1 collate latin1_general_ci, +b text(150) charset latin1 collate latin1_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset ascii collate ascii_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset ascii collate ascii_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset ascii collate ascii_general_ci, +b text(150) charset ascii collate ascii_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset swe7 collate swe7_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset swe7 collate swe7_swedish_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset eucjpms collate eucjpms_japanese_nopad_ci, +b text(150) charset eucjpms collate eucjpms_japanese_nopad_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset geostd8 collate geostd8_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset geostd8 collate geostd8_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +create table tmp ( +a varchar(150) charset latin1 collate latin1_general_ci, +b text(150) charset latin1 collate latin1_general_ci, +unique key b_idx (b(150)) +) engine=innodb; +alter table tmp +change a a varchar(150) charset utf16 collate utf16_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table tmp +modify b text charset utf16 collate utf16_general_ci, +algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +drop table tmp; +drop table fully_incompatible; +# +# MDEV-19284 INSTANT ALTER with ucs2-to-utf16 conversion produces bad data +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2, PRIMARY KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('a'),(0xD800); +ALTER TABLE t1 ALGORITHM=COPY, MODIFY a VARCHAR(10) CHARACTER SET utf16; +ERROR 22007: Incorrect string value: '\xD8\x00' for column `test`.`t1`.`a` at row 2 +ALTER TABLE t1 ALGORITHM=INSTANT, MODIFY a VARCHAR(10) CHARACTER SET utf16; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16; +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1366 Incorrect string value: '\xD8\x00' for column `test`.`t1`.`a` at row 2 +SELECT HEX(a) FROM t1; +HEX(a) +003F +0061 +DROP TABLE t1; +# +# MDEV-19285 INSTANT ALTER from ascii_general_ci to latin1_general_ci produces corrupt data +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii COLLATE ascii_general_ci, PRIMARY KEY(a)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('a'),(0xC0),('b'); +ALTER TABLE t1 ALGORITHM=COPY, MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci; +ERROR 22007: Incorrect string value: '\xC0' for column `test`.`t1`.`a` at row 3 +ALTER TABLE t1 ALGORITHM=INSTANT, MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1366 Incorrect string value: '\xC0' for column `test`.`t1`.`a` at row 3 +SELECT HEX(a) FROM t1; +HEX(a) +3F +61 +62 +DROP TABLE t1; +# +# MDEV-19524 Server crashes in Bitmap<64u>::is_clear_all / Field_longstr::csinfo_change_allows_instant_alter +# +CREATE TABLE t1 (a VARCHAR(1), UNIQUE(a)) ENGINE=InnoDB; +ALTER TABLE t1 MODIFY a INT, ADD b INT, ADD UNIQUE (b), ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +DROP TABLE t1; +# +# MDEV-17301 Change of COLLATE unnecessarily requires ALGORITHM=COPY +# +create table t ( +a char(10) collate latin1_general_ci primary key, +b char(10) collate latin1_general_ci, +c char(10) collate latin1_general_ci, +unique key b_key(b) +) engine=innodb; +insert into t values +('aaa', 'aaa', 'aaa'), ('ccc', 'ccc', 'ccc'), ('bbb', 'bbb', 'bbb'); +alter table t modify a char(10) collate latin1_general_cs, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table t modify b char(10) collate latin1_general_cs, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table t modify b char(10) collate latin1_general_cs, algorithm=nocopy; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify c char(10) collate latin1_general_cs, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +drop table t; +create table t ( +a varchar(10) collate latin1_general_ci primary key, +b varchar(10) collate latin1_general_ci, +c varchar(10) collate latin1_general_ci, +unique key b_key(b) +) engine=innodb; +insert into t values +('aaa', 'aaa', 'aaa'), ('ccc', 'ccc', 'ccc'), ('bbb', 'bbb', 'bbb'); +alter table t modify a varchar(10) collate latin1_general_cs, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY +alter table t modify b varchar(10) collate latin1_general_cs, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +alter table t modify b varchar(10) collate latin1_general_cs, algorithm=nocopy; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +alter table t modify c varchar(10) collate latin1_general_cs, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +drop table t; +# +# MDEV-20726: InnoDB: Assertion failure in file data0type.cc line 67 +# +CREATE TABLE t ( +id int(10) unsigned NOT NULL PRIMARY KEY, +a text CHARSET utf8mb3, +KEY a_idx(a(1)) +) ENGINE=InnoDB; +INSERT INTO t VALUES (1, 'something in the air'); +ALTER TABLE t MODIFY a text CHARSET utf8mb4; +DROP TABLE t; +# +# MDEV-22899: Assertion `field->col->is_binary() || field->prefix_len % field->col->mbmaxlen == 0' failed in dict_index_add_to_cache +# +CREATE TABLE t1 ( +a text CHARACTER SET utf8 DEFAULT NULL, +KEY a_key (a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +CREATE TABLE t1 ( +a text CHARACTER SET utf8 DEFAULT NULL, +b int, +KEY a_key (b, a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +CREATE TABLE t1 ( +a char(200) CHARACTER SET utf8 DEFAULT NULL, +KEY a_key (a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +CREATE TABLE t1 ( +a char(200) CHARACTER SET utf8 DEFAULT NULL, +b int, +KEY a_key (b, a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +CREATE TABLE t1 ( +a varchar(200) CHARACTER SET utf8 DEFAULT NULL, +KEY a_key (a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +CREATE TABLE t1 ( +a varchar(200) CHARACTER SET utf8 DEFAULT NULL, +b int, +KEY a_key (b, a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +CREATE TABLE t1 ( +a varchar(2000) CHARACTER SET utf8 DEFAULT NULL, +KEY a_key (a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +CREATE TABLE t1 ( +a varchar(2000) CHARACTER SET utf8 DEFAULT NULL, +b int, +KEY a_key (b, a(1)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY a text DEFAULT NULL; +DROP TABLE t1; +# +# MDEV-23245 Still getting assertion failure in file data0type.cc line 67 +# +CREATE TABLE Foo +( +Bar char(2) CHARACTER SET utf8, +KEY Bar (Bar(1)) +) ENGINE = InnoDB; +ALTER TABLE Foo MODIFY Bar char(2) CHARACTER SET utf8mb4; +INSERT INTO Foo VALUES ('a'); +DROP TABLE Foo; +CREATE TABLE Foo +( +Bar varchar(2) CHARACTER SET utf8, +KEY Bar (Bar(1)) +) ENGINE = InnoDB; +ALTER TABLE Foo MODIFY Bar varchar(2) CHARACTER SET utf8mb4; +INSERT INTO Foo VALUES ('a'); +DROP TABLE Foo; +CREATE TABLE Foo +( +Bar text CHARACTER SET utf8, +KEY Bar (Bar(1)) +) ENGINE = InnoDB; +ALTER TABLE Foo MODIFY Bar text CHARACTER SET utf8mb4; +INSERT INTO Foo VALUES ('a'); +DROP TABLE Foo; +CREATE TABLE t1 (a VARCHAR(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci, +PRIMARY KEY (a(1))) +ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, + PRIMARY KEY (`a`(1)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 MODIFY a VARCHAR(2) +CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +INSERT INTO t1 VALUES ('a'); +DROP TABLE t1; +# +# MDEV-22775 [HY000][1553] Changing name of primary key column with foreign key constraint fails. +# +create table t1 (id int primary key) engine=innodb default charset=utf8; +create table t2 (input_id int primary key, id int not null, +key a (id), +constraint a foreign key (id) references t1 (id) +)engine=innodb default charset=utf8; +alter table t1 change id id2 int; +drop table t2; +drop table t1; +# +# MDEV-25951 MariaDB crash after ALTER TABLE convert to utf8mb4 +# +CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(32), KEY (a(7))) ENGINE=INNODB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES (1, 'a1'), (2, 'a1'); +ALTER TABLE t1 +CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci, +ADD UNIQUE INDEX test_key (a); +ERROR 23000: Duplicate entry 'NULL' for key 'test_key' +ALTER TABLE t1 CONVERT TO CHARACTER SET UTF8MB4 COLLATE UTF8MB4_UNICODE_520_CI; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1; +id a +1 a1 +2 a1 +DROP TABLE t1; +CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(32), KEY (a(7))) ENGINE=INNODB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES (1, 'a1'), (2, 'a1'); +ALTER TABLE t1 +CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci, +ADD UNIQUE INDEX test_key (a); +ERROR 23000: Duplicate entry 'NULL' for key 'test_key' +ALTER TABLE t1 CONVERT TO CHARACTER SET UTF8MB4 COLLATE UTF8MB4_UNICODE_520_CI; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1; +id a +1 a1 +2 a1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_crash.result b/mysql-test/suite/innodb/r/instant_alter_crash.result new file mode 100644 index 00000000..c6f7d389 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_crash.result @@ -0,0 +1,228 @@ +FLUSH TABLES; +# +# MDEV-11369: Instant ADD COLUMN for InnoDB +# +CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE) +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 VALUES(0,2); +INSERT INTO t2 VALUES(2,1); +ALTER TABLE t2 ADD COLUMN (c3 TEXT NOT NULL DEFAULT 'De finibus bonorum'); +BEGIN; +INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium'); +connect ddl, localhost, root; +SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; +ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT NULL DEFAULT ' et malorum'); +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; +# Kill the server +disconnect ddl; +# restart +SELECT * FROM t1; +id c2 +0 2 +SELECT * FROM t2; +id c2 c3 +2 1 De finibus bonorum +3 4 accusantium doloremque laudantium +BEGIN; +DELETE FROM t1; +ROLLBACK; +InnoDB 0 transactions not purged +INSERT INTO t2 VALUES +(16,1551,'Omnium enim rerum'),(128,1571,' principia parva sunt'); +BEGIN; +UPDATE t1 SET c2=c2+1; +connect ddl, localhost, root; +SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; +ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere'; +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; +# Kill the server +disconnect ddl; +# restart +SELECT * FROM t1; +id c2 +0 3 +SELECT * FROM t2; +id c2 c3 +2 1 De finibus bonorum +3 4 accusantium doloremque laudantium +16 1551 Omnium enim rerum +128 1571 principia parva sunt +BEGIN; +INSERT INTO t1 SET id=1; +DELETE FROM t2; +ROLLBACK; +InnoDB 0 transactions not purged +INSERT INTO t2 VALUES (64,42,'De finibus bonorum'), (347,33101,' et malorum'); +BEGIN; +DELETE FROM t1; +connect ddl, localhost, root; +ALTER TABLE t2 DROP COLUMN c3; +SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; +ALTER TABLE t2 ADD COLUMN (c4 TEXT NOT NULL DEFAULT ' et malorum'); +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; +# Kill the server +disconnect ddl; +# restart +FOUND 3 /\[Note\] InnoDB: Rolled back recovered transaction / in mysqld.1.err +SELECT * FROM t1; +id c2 +SELECT * FROM t2; +id c2 +2 1 +3 4 +64 42 +16 1551 +128 1571 +347 33101 +BEGIN; +INSERT INTO t1 SET id=1; +DELETE FROM t2; +ROLLBACK; +InnoDB 0 transactions not purged +FLUSH TABLE t1,t2 FOR EXPORT; +t1 clustered index root page(type 17855): +N_RECS=0; LEVEL=0 +header=0x010000030074 (id=0x696e66696d756d00) +header=0x010008030000 (id=0x73757072656d756d00) +t2 clustered index root page(type 18): +N_RECS=7; LEVEL=0 +header=0x01000003008f (id=0x0000000000000000) +header=0x3000100c00d4 (id=0x80000000, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + BLOB=0x000000260000000000000008, + c2=NULL(4 bytes), + c3=0x44652066696e6962757320626f6e6f72756d) +header=0x0000180900f4 (id=0x80000002, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + c2=0x80000001) +header=0x0000200b0135 (id=0x80000003, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + c2=0x80000004, + c3=0x6163637573616e7469756d20646f6c6f72656d717565206c617564616e7469756d) +header=0x0000280b0165 (id=0x80000010, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + c2=0x8000060f, + c3=0x4f6d6e69756d20656e696d20726572756d) +header=0x000030090185 (id=0x80000040, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + c2=0x8000002a) +header=0x0000380b01ba (id=0x80000080, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + c2=0x80000623, + c3=0x207072696e63697069612070617276612073756e74) +header=0x0000400b0074 (id=0x8000015b, + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + c2=0x8000814d, + c3=0x206574206d616c6f72756d) +header=0x080008030000 (id=0x000000000000000100) +UNLOCK TABLES; +DELETE FROM t2; +InnoDB 0 transactions not purged +# +# MDEV-24323 Crash on recovery after kill during instant ADD COLUMN +# +BEGIN; +INSERT INTO t1 VALUES(0,0); +connect ddl, localhost, root; +CREATE TABLE t3(id INT PRIMARY KEY, c2 INT, v2 INT AS(c2) VIRTUAL, UNIQUE(v2)) +ENGINE=InnoDB; +INSERT INTO t3 SET id=1,c2=1; +SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; +ALTER TABLE t3 ADD COLUMN c3 TEXT NOT NULL DEFAULT 'sic transit gloria mundi'; +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; +# Kill the server +disconnect ddl; +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + `v2` int(11) GENERATED ALWAYS AS (`c2`) VIRTUAL, + PRIMARY KEY (`id`), + UNIQUE KEY `v2` (`v2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2,t3; +# +# MDEV-29440 InnoDB instant ALTER TABLE recovery wrongly uses +# READ COMMITTED isolation level instead of READ UNCOMMITTED +# +CREATE TABLE t2(a INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6); +BEGIN; +DELETE FROM t1; +connect ddl, localhost, root; +SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'; +ALTER TABLE t2 ADD COLUMN b TINYINT UNSIGNED NOT NULL DEFAULT 42 FIRST; +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; +# Kill the server +disconnect ddl; +# restart +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t1,t2; +db.opt +# +# MDEV-26198 Assertion `0' failed in row_log_table_apply_op during +# ADD PRIMARY KEY or OPTIMIZE TABLE +# +CREATE TABLE t1(f1 year default null, f2 year default null, +f3 text, f4 year default null, f5 year default null, +f6 year default null, f7 year default null, +f8 year default null)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(1, 1, 1, 1, 1, 1, 1, 1); +ALTER TABLE t1 ADD COLUMN f9 year default null, ALGORITHM=INPLACE; +set DEBUG_SYNC="row_log_table_apply1_before SIGNAL con1_insert WAIT_FOR con1_finish"; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ADD COLUMN f10 YEAR DEFAULT NULL, ALGORITHM=INPLACE; +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR con1_insert"; +INSERT IGNORE INTO t1 (f3) VALUES ( 'b' ); +INSERT IGNORE INTO t1 (f3) VALUES ( 'l' ); +SET DEBUG_SYNC="now SIGNAL con1_finish"; +connection default; +disconnect con1; +SET DEBUG_SYNC=RESET; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff b/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff new file mode 100644 index 00000000..cff4ff18 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff @@ -0,0 +1,6 @@ +@@ -527,4 +527,4 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-35 ++36 diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result new file mode 100644 index 00000000..68af5694 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_debug.result @@ -0,0 +1,526 @@ +SET @old_instant= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'); +CREATE TABLE t1 ( +pk INT AUTO_INCREMENT PRIMARY KEY, +c1 INT, +c2 VARCHAR(255), +c3 VARCHAR(255), +c4 INT, +c5 INT, +c6 INT, +c7 VARCHAR(255), +c8 TIMESTAMP NULL +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL,1,NULL,'foo',NULL,1,NULL,NULL,'2011-11-11 00:00:00'); +ALTER TABLE t1 ADD COLUMN f INT; +REPLACE INTO t1 (c7) VALUES ('bar'); +CREATE TABLE t2 (i INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t2 VALUES (-1),(1); +ALTER TABLE t2 ADD COLUMN j INT; +BEGIN; +DELETE FROM t2; +ROLLBACK; +TRUNCATE TABLE t2; +INSERT INTO t2 VALUES (1,2); +CREATE TABLE t3 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t3 () VALUES (); +ALTER TABLE t3 ADD COLUMN f INT; +UPDATE t3 SET pk = DEFAULT; +SELECT * FROM t3; +pk f +0 NULL +CREATE TABLE t4 (pk INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t4 VALUES (0); +ALTER TABLE t4 ADD COLUMN b INT; +SELECT COUNT(*)>0 FROM INFORMATION_SCHEMA.COLUMNS +LEFT JOIN t4 ON (NUMERIC_SCALE = pk); +COUNT(*)>0 +1 +ALTER TABLE t4 ADD COLUMN c INT; +CREATE TABLE t5 (i INT, KEY(i)) ENGINE=InnoDB; +INSERT INTO t5 VALUES (-42); +ALTER TABLE t5 ADD UNIQUE ui(i); +ALTER TABLE t5 ADD COLUMN i2 INT, DROP INDEX i; +CREATE TABLE t6 (i INT NOT NULL) ENGINE=InnoDB; +INSERT INTO t6 VALUES (0); +ALTER TABLE t6 ADD COLUMN j INT; +TRUNCATE TABLE t6; +INSERT INTO t6 VALUES (1,2); +CREATE TABLE t7 (i INT) ENGINE=InnoDB; +INSERT INTO t7 VALUES (1),(2),(3),(4),(5); +ALTER TABLE t7 ADD t TEXT DEFAULT ''; +CREATE TABLE t8 (i INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t8 VALUES (NULL); +ALTER TABLE t8 ADD c CHAR(3); +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml'; +ALTER TABLE t8 FORCE; +connect dml,localhost,root,,; +SET DEBUG_SYNC='now WAIT_FOR rebuilt'; +BEGIN; +INSERT INTO t8 SET i=1; +UPDATE t8 SET i=ISNULL(i); +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL dml'; +connection default; +SET DEBUG_SYNC='RESET'; +CREATE TABLE t9 ( +pk INT AUTO_INCREMENT PRIMARY KEY, +c1 BIGINT UNSIGNED, +c2 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, +c3 BIGINT, +c4 VARCHAR(257) CHARACTER SET utf8, +c5 TINYINT UNSIGNED, +c6 TINYINT, +c7 VARCHAR(257) CHARACTER SET latin1, +c8 VARCHAR(257) CHARACTER SET binary +) ENGINE=InnoDB; +INSERT INTO t9 () VALUES (); +ALTER TABLE t9 ADD COLUMN IF NOT EXISTS t TIMESTAMP NULL; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml'; +OPTIMIZE TABLE t9; +connection dml; +SET DEBUG_SYNC='now WAIT_FOR rebuilt'; +BEGIN; +INSERT INTO t9 () VALUES (),(); +UPDATE t9 SET t=current_timestamp(); +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL dml'; +disconnect dml; +connection default; +Table Op Msg_type Msg_text +test.t9 optimize note Table does not support optimize, doing recreate + analyze instead +test.t9 optimize status OK +SET DEBUG_SYNC='RESET'; +CREATE TABLE t10 (pk INT DEFAULT 0 KEY) ENGINE=InnoDB; +INSERT INTO t10 (pk) VALUES (1); +ALTER TABLE t10 ADD c INT; +TRUNCATE TABLE t10; +INSERT INTO t10 VALUES (1,1),(2,2); +ALTER TABLE t10 FORCE; +CREATE TABLE t11 ( +c01 enum('a','b'), +c02 bit, +c03 blob, +c04 enum('c','d'), +c05 blob, +c06 decimal, +c07 char(1), +c08 int, +c09 char(1), +c10 set('e','f'), +c11 char(1), +c12 float, +c13 bit, +c14 char(1), +c15 int, +c16 float, +c17 decimal, +c18 char(1) CHARACTER SET utf8 not null default '', +c19 float, +c20 set('g','h'), +c21 char(1), +c22 int, +c23 int, +c24 int, +c25 set('i','j'), +c26 decimal, +c27 float, +c28 char(1), +c29 int, +c30 enum('k','l'), +c31 decimal, +c32 char(1), +c33 decimal, +c34 bit, +c35 enum('m','n'), +c36 set('o','p'), +c37 enum('q','r'), +c38 blob, +c39 decimal, +c40 blob not null default '', +c41 char(1), +c42 int, +c43 float, +c44 float, +c45 enum('s','t'), +c46 decimal, +c47 set('u','v'), +c48 enum('w','x'), +c49 set('y','z'), +c50 float +) ENGINE=InnoDB; +INSERT INTO t11 () VALUES (); +ALTER TABLE t11 ADD COLUMN f INT; +INSERT INTO t11 () VALUES (); +UPDATE t11 SET c22 = 1; +InnoDB 0 transactions not purged +DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11; +# +# MDEV-15060 Assertion in row_log_table_apply_op after instant ADD +# when the table is emptied during subsequent ALTER TABLE +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +ALTER TABLE t1 ADD COLUMN b INT NOT NULL; +connect stop_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect ddl,localhost,root,,test; +DELETE FROM t1; +INSERT INTO t1 VALUES(1, 2); +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL copied WAIT_FOR logged'; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR copied'; +BEGIN; +INSERT INTO t1 SET b=1; +ROLLBACK; +connection stop_purge; +COMMIT; +connection default; +InnoDB 1 transactions not purged +SET DEBUG_SYNC='now SIGNAL logged'; +connection ddl; +connection default; +DROP TABLE t1; +SET DEBUG_SYNC='RESET'; +# +# MDEV-16131 Assertion failed in dict_index_t::instant_field_value() +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 SET a=0; +ALTER TABLE t1 ADD COLUMN b INT NOT NULL DEFAULT 2, ADD COLUMN c INT; +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('ALTER TABLE t1 ADD (c', +GROUP_CONCAT(seq SEPARATOR ' INT, c'), ' INT), ALGORITHM=INSTANT;') FROM seq_1_to_130); +EXECUTE IMMEDIATE c; +END; +$$ +connection stop_purge; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1; +connection ddl; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL copied WAIT_FOR logged'; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR copied'; +connection stop_purge; +COMMIT; +connection default; +InnoDB 1 transactions not purged +INSERT INTO t1 SET a=1; +INSERT INTO t1 SET a=2,b=3,c=4; +SET DEBUG_SYNC = 'now SIGNAL logged'; +connection ddl; +connection default; +SET DEBUG_SYNC = RESET; +SELECT a, b, c FROM t1; +a b c +1 2 NULL +2 3 4 +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +connection stop_purge; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1; +connection ddl; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL copied WAIT_FOR logged'; +ALTER TABLE t1 ADD COLUMN b INT NOT NULL DEFAULT 2 AFTER a, FORCE; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR copied'; +disconnect stop_purge; +InnoDB 1 transactions not purged +INSERT INTO t1 SET a=1; +INSERT INTO t1 SET a=2,c=4; +SET DEBUG_SYNC = 'now SIGNAL logged'; +connection ddl; +UPDATE t1 SET b = b + 1 WHERE a = 2; +connection default; +SET DEBUG_SYNC = RESET; +SELECT a, b, c FROM t1; +a b c +1 2 NULL +2 3 4 +# +# MDEV-15872 Crash in online ALTER TABLE...ADD PRIMARY KEY +# after instant ADD COLUMN ... NULL +# +ALTER TABLE t1 ADD COLUMN d INT, ALGORITHM=INSTANT; +UPDATE t1 SET d=1; +connection ddl; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL copied WAIT_FOR logged'; +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY (a,d); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR copied'; +BEGIN; +INSERT INTO t1 SET a=3; +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL logged'; +connection ddl; +disconnect ddl; +connection default; +SET DEBUG_SYNC = RESET; +SELECT a, b, c, d FROM t1; +a b c d +1 2 NULL 1 +2 3 4 1 +DROP TABLE t1; +# +# MDEV-19916 Corruption after instant ADD/DROP and shrinking the tree +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +SET @old_limit = @@innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug = 2; +INSERT INTO t1 VALUES (1),(5),(4),(3),(2); +SET GLOBAL innodb_limit_optimistic_insert_debug = @old_limit; +ALTER TABLE t1 ADD COLUMN b INT, ALGORITHM=INSTANT; +SET @old_defragment = @@innodb_defragment; +SET GLOBAL innodb_defragment = 1; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SET GLOBAL innodb_defragment = @old_defragment; +ALTER TABLE t1 ADD vb INT AS (b) VIRTUAL; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1; +a b vb +1 NULL NULL +2 NULL NULL +3 NULL NULL +4 NULL NULL +5 NULL NULL +DROP TABLE t1; +# +# MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col +# +CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 (a) VALUES ('foo'); +ALTER TABLE t1 ADD COLUMN b INT DEFAULT 0,algorithm=instant; +connect con2,localhost,root,,test; +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL onlinealter WAIT_FOR update'; +ALTER TABLE t1 ADD PRIMARY KEY (b); +connection default; +SET DEBUG_SYNC='now WAIT_FOR onlinealter'; +UPDATE t1 SET b = 1; +SET DEBUG_SYNC='now SIGNAL update'; +connection con2; +connection default; +DROP TABLE t1; +# +# MDEV-21658 Error on online ADD PRIMARY KEY after instant DROP/reorder +# +CREATE TABLE t1 (a INT, b INT, c INT, col INT) ENGINE=InnoDB; +INSERT INTO t1 () VALUES (); +ALTER TABLE t1 DROP b, DROP c, DROP col; +ALTER TABLE t1 ADD COLUMN col INT; +ALTER TABLE t1 DROP a, DROP col, ADD COLUMN b INT; +connection con2; +SET SQL_MODE= ''; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL scanned WAIT_FOR dml'; +ALTER TABLE t1 ADD PRIMARY KEY(b); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +UPDATE t1 SET b = 1; +SET DEBUG_SYNC = 'now SIGNAL dml'; +connection con2; +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +connection default; +SELECT * FROM t1; +b +1 +SET DEBUG_SYNC='RESET'; +disconnect con2; +DROP TABLE t1; +# +# MDEV-24653 Assertion block->page.id.page_no() == index->page failed +# in innobase_add_instant_try() +# +SET @saved_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug = 2; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3),(4); +ALTER TABLE t1 ADD COLUMN b INT; +DELETE FROM t1; +InnoDB 0 transactions not purged +ALTER TABLE t1 ADD COLUMN c INT; +SELECT * FROM t1; +a b c +DROP TABLE t1; +SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit; +# +# MDEV-24796 Assertion page_has_next... failed +# in btr_pcur_store_position() +# +CREATE TABLE t1 (c INT KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1),(2); +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +ALTER TABLE t1 ADD COLUMN d INT; +DELETE FROM t1; +InnoDB 0 transactions not purged +SELECT * FROM t1 WHERE c<>1 ORDER BY c DESC; +c d +DROP TABLE t1; +SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit; +# +# MDEV-24620 ASAN heap-buffer-overflow in btr_pcur_restore_position() +# +CREATE TABLE t1 (a VARCHAR(1) PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connect stop_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +ALTER TABLE t1 ADD c INT; +BEGIN; +DELETE FROM t1; +connect dml,localhost,root,,test; +SET DEBUG_SYNC='row_mysql_handle_errors SIGNAL s1 WAIT_FOR s2'; +UPDATE t1 SET c=1; +connection default; +SET DEBUG_SYNC='now WAIT_FOR s1'; +COMMIT; +connection stop_purge; +COMMIT; +disconnect stop_purge; +connection default; +InnoDB 1 transactions not purged +SET DEBUG_SYNC='now SIGNAL s2'; +connection dml; +disconnect dml; +connection default; +InnoDB 0 transactions not purged +SET DEBUG_SYNC=RESET; +DROP TABLE t1; +# End of 10.3 tests +# +# MDEV-17899 Assertion failures on rollback of instant ADD/DROP +# MDEV-18098 Crash after rollback of instant DROP COLUMN +# +SET @save_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,ib_commit_inplace_fail_1'; +CREATE TABLE t1 (a int, b int) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,2); +ALTER TABLE t1 DROP COLUMN b; +ERROR HY000: Internal error: Injected error! +ALTER TABLE t1 DROP COLUMN b; +ERROR HY000: Internal error: Injected error! +ALTER TABLE t1 ADD COLUMN c INT; +ERROR HY000: Internal error: Injected error! +SELECT * FROM t1; +a b +1 2 +DROP TABLE t1; +CREATE TABLE t1 (a int, b int) ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN c INT; +ERROR HY000: Internal error: Injected error! +BEGIN; +INSERT INTO t1 VALUES(1, 1); +ROLLBACK; +ALTER TABLE t1 DROP COLUMN b; +ERROR HY000: Internal error: Injected error! +INSERT INTO t1 values (1,1); +SELECT * FROM t1; +a b +1 1 +DROP TABLE t1; +SET debug_dbug = @save_dbug; +# +# MDEV-24512 Assertion failed in rec_is_metadata() +# in btr_discard_only_page_on_level() +# +SET @save_limit= @@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +CREATE TABLE t1 (c CHAR(1) UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 ADD c2 INT NOT NULL DEFAULT 0 FIRST; +INSERT INTO t1 (c) VALUES ('x'),('d'),('r'),('f'),('y'),('u'),('m'),('d'); +ERROR 23000: Duplicate entry 'd' for key 'c' +SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; +SELECT * FROM t1; +c2 c +DROP TABLE t1; +# +# MDEV-25236 Online log apply fails for ROW_FORMAT=REDUNDANT tables +# +CREATE TABLE t1 +(a INT NOT NULL, b INT, c INT, d INT, e INT, f INT, g INT, h INT, i TEXT) +ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 2, 3, 4, 5, 6, 7, 8, "test"); +ALTER TABLE t1 MODIFY a INT NULL; +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL alter WAIT_FOR go'; +ALTER TABLE t1 ADD PRIMARY KEY (a); +connect con1,localhost,root,,; +set DEBUG_SYNC='now WAIT_FOR alter'; +BEGIN; +INSERT INTO t1 SET a=0, i=REPEAT('1', 10000); +ROLLBACK; +set DEBUG_SYNC='now SIGNAL go'; +connection default; +SELECT * FROM t1; +a b c d e f g h i +1 2 3 4 5 6 7 8 test +DROP TABLE t1; +SET DEBUG_SYNC=RESET; +# +# MDEV-27962 Instant DDL downgrades the MDL when table is empty +# +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB; +SET DEBUG_SYNC="alter_table_inplace_after_lock_downgrade SIGNAL try_insert WAIT_FOR alter_progress"; +ALTER TABLE t1 ADD INDEX(f1), ADD INDEX(f2); +connection con1; +SET SESSION lock_wait_timeout=1; +SET DEBUG_SYNC="now WAIT_FOR try_insert"; +INSERT INTO t1 VALUES(1, 2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC="now SIGNAL alter_progress"; +disconnect con1; +connection default; +DROP TABLE t1; +SET DEBUG_SYNC=reset; +# End of 10.4 tests +# +# MDEV-22867 Assertion instant.n_core_fields == n_core_fields +# in dict_index_t::instant_add_field +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t1 SET a=1; +connect prevent_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +ALTER TABLE t1 ADD COLUMN c INT; +DELETE FROM t1; +connect con2,localhost,root,,test; +ALTER TABLE t1 DROP b, ADD INDEX(c), ALGORITHM=NOCOPY; +ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL ddl WAIT_FOR emptied'; +ALTER TABLE t1 DROP b; +connection default; +SET DEBUG_SYNC='now WAIT_FOR ddl'; +BEGIN; +INSERT INTO t1 SET a=1; +connection prevent_purge; +COMMIT; +disconnect prevent_purge; +connection default; +ROLLBACK; +SELECT * FROM t1; +a b c +SET DEBUG_SYNC='now SIGNAL emptied'; +connection con2; +disconnect con2; +connection default; +ALTER TABLE t1 DROP c; +INSERT INTO t1 VALUES (2),(3),(4); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET DEBUG_SYNC=RESET; +# End of 10.5 tests +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +35 diff --git a/mysql-test/suite/innodb/r/instant_alter_extend,utf8.rdiff b/mysql-test/suite/innodb/r/instant_alter_extend,utf8.rdiff new file mode 100644 index 00000000..08f9afa6 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_extend,utf8.rdiff @@ -0,0 +1,38 @@ +--- instant_alter_convert.result ++++ instant_alter_convert,utf8.result +@@ -38,7 +38,7 @@ + best.t check status OK + call check_table('t'); + name mtype prtype len +-a 2 800FE 200 ++a 13 2100FE 600 + # CHAR enlargement + alter table t modify a char(220); + affected rows: 2 +@@ -54,7 +54,7 @@ + best.t check status OK + call check_table('t'); + name mtype prtype len +-a 2 800FE 220 ++a 13 2100FE 660 + ALTER TABLE t CHANGE COLUMN a a CHAR(230) BINARY; + affected rows: 2 + info: Records: 2 Duplicates: 0 Warnings: 0 +@@ -69,7 +69,7 @@ + best.t check status OK + call check_table('t'); + name mtype prtype len +-a 13 2F00FE 230 ++a 13 5300FE 690 + # Convert from VARCHAR to a bigger CHAR + alter table t modify a varchar(200); + affected rows: 2 +@@ -92,7 +92,7 @@ + best.t check status OK + call check_table('t'); + name mtype prtype len +-a 2 800FE 255 ++a 13 2100FE 765 + # BINARY/VARBINARY test + create or replace table t (a varbinary(300)); + insert into t values(NULL); diff --git a/mysql-test/suite/innodb/r/instant_alter_extend.result b/mysql-test/suite/innodb/r/instant_alter_extend.result new file mode 100644 index 00000000..33a5f57c Binary files /dev/null and b/mysql-test/suite/innodb/r/instant_alter_extend.result differ diff --git a/mysql-test/suite/innodb/r/instant_alter_import.result b/mysql-test/suite/innodb/r/instant_alter_import.result new file mode 100644 index 00000000..3e7ee35f --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_import.result @@ -0,0 +1,159 @@ +call mtr.add_suppression("Operating system error number .* in a file operation."); +call mtr.add_suppression("The error means the system cannot find the path specified."); +call mtr.add_suppression("File ./test/t1.ibd was not found"); +set default_storage_engine=innodb; +# +# MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables +# +create table t2 (x int, z int default 41); +alter table t2 discard tablespace; +create table t1 (x int); +insert into t1 values (1); +alter table t1 add z int default 42, algorithm instant; +select * from t1; +x z +1 42 +flush tables t1 for export; +unlock tables; +# The metadata has to be updated to instant ADD COLUMN. +alter table t2 import tablespace; +select * from t2; +x z +1 42 +insert into t2 set x=2; +select * from t2; +x z +1 42 +2 41 +alter table t1 discard tablespace; +flush tables t2 for export; +unlock tables; +# Both the metadata and the data file used instant ADD COLUMN. +alter table t1 import tablespace; +select * from t1; +x z +1 42 +2 41 +drop table t2; +create table t2 select * from t1; +alter table t1 discard tablespace; +flush tables t2 for export; +unlock tables; +# The instant ADD COLUMN has to be removed from the metadata. +alter table t1 import tablespace; +select * from t1; +x z +1 42 +2 41 +# Remove metadata for instant DROP COLUMN, then import +alter table t1 drop x, add column x int first, algorithm instant; +select * from t1; +x z +NULL 42 +NULL 41 +alter table t1 discard tablespace; +alter table t1 import tablespace; +select * from t1; +x z +1 42 +2 41 +# Import a data file that contains instant DROP COLUMN metadata +alter table t2 drop x; +alter table t1 drop x, force; +alter table t1 discard tablespace; +flush tables t2 for export; +unlock tables; +alter table t1 import tablespace; +select * from t1; +z +42 +41 +drop table t2; +drop table t1; +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT, i2 INT) ENGINE=INNODB; +ALTER TABLE t2 DROP COLUMN i2, ALGORITHM=INSTANT; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +DROP TABLE t2, t1; +CREATE TABLE t1 (id INT PRIMARY KEY, i2 INT, i1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 1, 1); +ALTER TABLE t1 MODIFY COLUMN i2 INT AFTER i1, ALGORITHM=INSTANT; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +SELECT * FROM t2; +id i1 i2 +1 1 1 +DROP TABLE t2, t1; +CREATE TABLE t1 (id INT PRIMARY KEY, i2 INT, i1 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 1, 1); +ALTER TABLE t1 DROP COLUMN i2, ALGORITHM=INSTANT; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +SELECT * FROM t2; +id i1 +1 1 +DROP TABLE t2, t1; +CREATE TABLE t1 (id INT PRIMARY KEY, i2 INT, i1 INT) +ENGINE=INNODB PAGE_COMPRESSED=1; +INSERT INTO t1 VALUES (1, 1, 1); +ALTER TABLE t1 DROP COLUMN i2, ALGORITHM=INSTANT; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +DROP TABLE t2, t1; +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, i2 INT, i1 INT) ENGINE=INNODB; +INSERT INTO t1 (i2) SELECT 4 FROM seq_1_to_1024; +ALTER TABLE t1 DROP COLUMN i2, ALGORITHM=INSTANT; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +DROP TABLE t2, t1; +CREATE TABLE t1 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +CREATE TABLE t2 ( id INT NOT NULL, i1 INT, i2 INT, PRIMARY KEY (id)) engine=innodb; +ALTER TABLE test.t1 add COLUMN i3 INT AFTER i1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t2 IMPORT TABLESPACE; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +DROP TABLE t1, t2; +# +# MDEV-28919 Assertion `(((core_null) + 7) >> 3) == +# oindex.n_core_null_bytes || !not_redundant()' failed +# +call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded"); +CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL, +c INTEGER)engine=innodb; +ALTER TABLE t DISCARD TABLESPACE; +FLUSH TABLES; +ALTER TABLE t DROP COLUMN b, algorithm=instant; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +ALTER TABLE t DROP COLUMN c, algorithm=instant; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +CREATE TABLE t1(a INTEGER)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +FLUSH TABLE t1 FOR EXPORT; +unlock tables; +ALTER TABLE t IMPORT tablespace; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a +1 +DROP TABLE t, t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_index_rename.result b/mysql-test/suite/innodb/r/instant_alter_index_rename.result new file mode 100644 index 00000000..49f2213f --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_index_rename.result @@ -0,0 +1,248 @@ +create function get_index_id(tbl_id int, index_name char(100)) +returns int +begin +declare res int; +select index_id into res from information_schema.innodb_sys_indexes where +name=index_name and table_id = tbl_id; +return res; +end| +create table t ( +pk int primary key, +a int, +b int, +c int, +unique index a_key (a), +key c_key (c) +) engine=innodb stats_persistent=1; +insert into t values (1, 1, 1, 1); +set @table_id = (select table_id from information_schema.innodb_sys_tables where name='test/t'); +set @a_key_id = get_index_id(@table_id, 'a_key'); +set @c_key_id = get_index_id(@table_id, 'c_key'); +set @primary_id = get_index_id(@table_id, 'primary'); +select distinct(index_name) from mysql.innodb_index_stats where table_name = 't'; +index_name +PRIMARY +a_key +c_key +alter table t +drop index a_key, +add unique index a_key_strikes_back (a); +select distinct(index_name) from mysql.innodb_index_stats where table_name = 't'; +index_name +PRIMARY +a_key_strikes_back +c_key +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select @a_key_id = get_index_id(@table_id, 'a_key_strikes_back'), +@c_key_id = get_index_id(@table_id, 'c_key'), +@primary_id = get_index_id(@table_id, 'primary'); +@a_key_id = get_index_id(@table_id, 'a_key_strikes_back') @c_key_id = get_index_id(@table_id, 'c_key') @primary_id = get_index_id(@table_id, 'primary') +1 1 1 +set @a_key_strikes_back_id = get_index_id(@table_id, 'a_key_strikes_back'); +set @c_key_id = get_index_id(@table_id, 'c_key'); +set @primary_id = get_index_id(@table_id, 'primary'); +alter table t +drop index a_key_strikes_back, +add unique index a_key_returns (a), +drop primary key, +add primary key (pk), +add unique index b_key (b); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select @a_key_strikes_back_id = get_index_id(@table_id, 'a_key_returns'), +@c_key_id = get_index_id(@table_id, 'c_key'), +@primary_id = get_index_id(@table_id, 'primary'); +@a_key_strikes_back_id = get_index_id(@table_id, 'a_key_returns') @c_key_id = get_index_id(@table_id, 'c_key') @primary_id = get_index_id(@table_id, 'primary') +1 1 1 +set @a_key_returns_id = get_index_id(@table_id, 'a_key_returns'); +set @b_key_id = get_index_id(@table_id, 'b_key'); +set @c_key_id = get_index_id(@table_id, 'c_key'); +set @primary_id = get_index_id(@table_id, 'primary'); +alter table t +drop key c_key, +add key c_key2 (c); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select @a_key_returns_id = get_index_id(@table_id, 'a_key_returns'), +@b_key_id = get_index_id(@table_id, 'b_key'), +@c_key_id = get_index_id(@table_id, 'c_key2'), +@primary_id = get_index_id(@table_id, 'primary'); +@a_key_returns_id = get_index_id(@table_id, 'a_key_returns') @b_key_id = get_index_id(@table_id, 'b_key') @c_key_id = get_index_id(@table_id, 'c_key2') @primary_id = get_index_id(@table_id, 'primary') +1 1 1 1 +drop table t; +create table errors ( +a int, +unique key a_key (a), +b int +) engine=innodb; +alter table errors +drop key a_key, +drop key a_key, +add unique key a_key2 (a); +ERROR 42000: Can't DROP INDEX `a_key`; check that it exists +alter table errors +drop key a_key, +drop key a_key2, +add unique key a_key2 (a); +ERROR 42000: Can't DROP INDEX `a_key2`; check that it exists +alter table errors +add key b_key (b), +drop key b_key, +add key bb_key (b); +ERROR 42000: Can't DROP INDEX `b_key`; check that it exists +alter table errors +drop key a_key, +add key a_key2 (a), +drop key a_key, +add key a_key2 (a); +ERROR 42000: Can't DROP INDEX `a_key`; check that it exists +drop table errors; +create table corrupted ( +a int, +key a_key (a) +) engine=innodb; +insert into corrupted values (1); +select * from corrupted; +a +1 +SET @save_dbug = @@SESSION.debug_dbug; +SET debug_dbug = '+d,dict_set_index_corrupted'; +check table corrupted; +Table Op Msg_type Msg_text +test.corrupted check Warning InnoDB: Index a_key is marked as corrupted +test.corrupted check error Corrupt +SET debug_dbug = @save_dbug; +select * from corrupted; +ERROR HY000: Index corrupted is corrupted +alter table corrupted +drop key a_key, +add key a_key2 (a); +ERROR HY000: Index a_key is corrupted +alter table corrupted +drop key a_key; +select * from corrupted; +a +1 +check table corrupted; +Table Op Msg_type Msg_text +test.corrupted check status OK +drop table corrupted; +create table t ( +a int, +unique key a_key (a) +) engine=innodb stats_persistent=1; +SET @save_dbug = @@SESSION.debug_dbug; +SET debug_dbug = '+d,ib_rename_index_fail1'; +alter table t +drop key a_key, +add unique key a_key2 (a), +algorithm=instant; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SET debug_dbug = @save_dbug; +alter table t +drop key a_key, +add unique key `GEN_CLUST_INDEX` (a), +algorithm=instant; +ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX' +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + UNIQUE KEY `a_key` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1 +drop table t; +create table rename_column_and_index ( +a int, +unique index a_key(a) +) engine=innodb; +insert into rename_column_and_index values (1), (3); +alter table rename_column_and_index +change a aa int, +drop key a_key, +add unique key aa_key(aa), +algorithm=instant; +show create table rename_column_and_index; +Table Create Table +rename_column_and_index CREATE TABLE `rename_column_and_index` ( + `aa` int(11) DEFAULT NULL, + UNIQUE KEY `aa_key` (`aa`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +check table rename_column_and_index; +Table Op Msg_type Msg_text +test.rename_column_and_index check status OK +drop table rename_column_and_index; +# +# MDEV-19189: ASAN memcpy-param-overlap in fill_alter_inplace_info upon adding indexes +# +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT); +ALTER TABLE t1 ADD FOREIGN KEY f (f2) REFERENCES xx(f2); +ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1(f2), ADD KEY (f3), ADD KEY (f1); +DROP TABLE t1; +# +# MDEV-21669 InnoDB: Table ... contains indexes inside InnoDB, which is different from the number of indexes defined in the MariaDB +# +CREATE TABLE t1 (col_int INTEGER, col_char CHAR(20), col_varchar VARCHAR(500)) ENGINE=InnoDB; +SET @table_id = (SELECT table_id FROM information_schema.innodb_sys_tables WHERE name='test/t1'); +ALTER TABLE t1 ADD KEY idx3 (col_varchar(9)), ADD KEY idX2 (col_char(9)); +SET @idx3_key_id = get_index_id(@table_id, 'iDx3'); +ALTER TABLE t1 DROP KEY iDx3, ADD KEY Idx3 (col_varchar(9)); +SELECT @idx3_key_id = get_index_id(@table_id, 'Idx3'); +@idx3_key_id = get_index_id(@table_id, 'Idx3') +1 +CHECK TABLE t1 EXTENDED ; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +DROP FUNCTION get_index_id; +# +# MDEV-23356 InnoDB: Failing assertion: field->col->mtype == type, crash or ASAN failures in row_sel_convert_mysql_key_to_innobase, InnoDB indexes are inconsistent after INDEX changes +# +CREATE TABLE t1 (a INT, b INT, c CHAR(8), +KEY ind1(c), KEY ind2(b)) ENGINE=InnoDB STATS_PERSISTENT=1; +INSERT INTO t1 SELECT 1, 1, 'a' FROM seq_1_to_100; +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t1 GEN_CLUST_INDEX n_diff_pfx01 +t1 GEN_CLUST_INDEX n_leaf_pages +t1 GEN_CLUST_INDEX size +t1 ind1 n_diff_pfx01 +t1 ind1 n_diff_pfx02 +t1 ind1 n_leaf_pages +t1 ind1 size +t1 ind2 n_diff_pfx01 +t1 ind2 n_diff_pfx02 +t1 ind2 n_leaf_pages +t1 ind2 size +ALTER TABLE t1 DROP INDEX ind2, ADD INDEX ind3(b), +DROP INDEX ind1, ADD INDEX ind2(c); +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t1 GEN_CLUST_INDEX n_diff_pfx01 +t1 GEN_CLUST_INDEX n_leaf_pages +t1 GEN_CLUST_INDEX size +t1 ind2 n_diff_pfx01 +t1 ind2 n_diff_pfx02 +t1 ind2 n_leaf_pages +t1 ind2 size +t1 ind3 n_diff_pfx01 +t1 ind3 n_diff_pfx02 +t1 ind3 n_leaf_pages +t1 ind3 size +ALTER TABLE t1 DROP b, FORCE; +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name +t1 GEN_CLUST_INDEX n_diff_pfx01 +t1 GEN_CLUST_INDEX n_leaf_pages +t1 GEN_CLUST_INDEX size +t1 ind2 n_diff_pfx01 +t1 ind2 n_diff_pfx02 +t1 ind2 n_leaf_pages +t1 ind2 size +UPDATE t1 SET a = 1 WHERE c = 'foo'; +DROP TABLE t1; +SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats; +table_name index_name stat_name diff --git a/mysql-test/suite/innodb/r/instant_alter_inject.result b/mysql-test/suite/innodb/r/instant_alter_inject.result new file mode 100644 index 00000000..2b030ad0 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_inject.result @@ -0,0 +1,66 @@ +CREATE TABLE t1(a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB +ROW_FORMAT=REDUNDANT PARTITION BY KEY() PARTITIONS 3; +INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5); +SET @saved_dbug= @@SESSION.debug_dbug; +SET DEBUG_DBUG='+d,ib_commit_inplace_fail_2'; +ALTER TABLE t1 ADD COLUMN c CHAR(3) DEFAULT 'lie'; +ERROR HY000: Internal error: Injected error! +SET DEBUG_DBUG= @saved_dbug; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +BEGIN; +UPDATE t1 SET b=a+1; +INSERT INTO t1 VALUES (0,1); +ROLLBACK; +SELECT * FROM t1; +a b +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +ALTER TABLE t1 ADD COLUMN c CHAR(3) DEFAULT 'lie'; +SET DEBUG_DBUG='+d,ib_commit_inplace_fail_1'; +ALTER TABLE t1 ADD COLUMN d INT NOT NULL DEFAULT -42; +ERROR HY000: Internal error: Injected error! +SET DEBUG_DBUG= @saved_dbug; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +BEGIN; +DELETE FROM t1; +INSERT INTO t1 VALUES (1,2,'foo'); +ROLLBACK; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(3) DEFAULT 'lie', + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT + PARTITION BY KEY () +PARTITIONS 3 +DROP TABLE t1; +CREATE TABLE t2(a INT, KEY(a)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +SET DEBUG_DBUG='+d,ib_commit_inplace_fail_1'; +ALTER TABLE t2 ADD COLUMN b INT; +ERROR HY000: Internal error: Injected error! +SET DEBUG_DBUG= @saved_dbug; +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +BEGIN; +DELETE FROM t2; +INSERT INTO t2 VALUES (1); +ROLLBACK; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff new file mode 100644 index 00000000..57d87f71 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff @@ -0,0 +1,13 @@ +--- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 ++++ instant_alter_limit,16k.reject 2020-05-26 20:14:38.452463919 +0530 +@@ -45,3 +45,10 @@ + instants + 502 + DROP TABLE t; ++# ++# MDEV-21787 Alter table failure tries to access uninitialized column ++# ++CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT GENERATED ALWAYS AS (SUBSTR(f4, 1, 400)), f3 VARCHAR(500), f4 TEXT)ENGINE=InnoDB ROW_FORMAT=Compact; ++ALTER TABLE t1 ADD UNIQUE KEY (f2(9)); ++ALTER TABLE t1 ADD COLUMN f5 TEXT, ALGORITHM=INPLACE; ++DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff new file mode 100644 index 00000000..8f8cf64b --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff @@ -0,0 +1,16 @@ +--- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 ++++ instant_alter_limit,32k.reject 2020-05-26 19:59:19.743877366 +0530 +@@ -43,5 +43,12 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-502 ++506 + DROP TABLE t; ++# ++# MDEV-21787 Alter table failure tries to access uninitialized column ++# ++CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT GENERATED ALWAYS AS (SUBSTR(f4, 1, 400)), f3 VARCHAR(500), f4 TEXT)ENGINE=InnoDB ROW_FORMAT=Compact; ++ALTER TABLE t1 ADD UNIQUE KEY (f2(9)); ++ALTER TABLE t1 ADD COLUMN f5 TEXT, ALGORITHM=INPLACE; ++DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff new file mode 100644 index 00000000..dad28218 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff @@ -0,0 +1,313 @@ +--- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 ++++ instant_alter_limit,4k.reject 2020-05-26 20:17:53.314736548 +0530 +@@ -5,6 +5,276 @@ + ENGINE=InnoDB; + INSERT INTO t VALUES(1,2,3,4,5); + SET innodb_strict_mode = OFF; ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + SELECT * FROM t; + b d a c e + NULL NULL 1 NULL NULL +@@ -12,11 +282,17 @@ + ADD COLUMN b INT, ALGORITHM=INSTANT; + ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE + ALTER TABLE t CHANGE COLUMN b beta INT AFTER a, ALGORITHM=INSTANT; ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + ALTER TABLE t DROP e, DROP c, DROP d, ALGORITHM=INSTANT; ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + SELECT * FROM t; + a beta + 1 NULL + ALTER TABLE t DROP COLUMN beta, ALGORITHM=INSTANT; ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + ALTER TABLE t ADD COLUMN b INT NOT NULL, ALGORITHM=INSTANT; + ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE + SELECT variable_value-@old_instant instants +@@ -43,5 +319,14 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-502 ++474 + DROP TABLE t; ++# ++# MDEV-21787 Alter table failure tries to access uninitialized column ++# ++CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT GENERATED ALWAYS AS (SUBSTR(f4, 1, 400)), f3 VARCHAR(500), f4 TEXT)ENGINE=InnoDB ROW_FORMAT=Compact; ++ALTER TABLE t1 ADD UNIQUE KEY (f2(9)); ++ALTER TABLE t1 ADD COLUMN f5 TEXT, ALGORITHM=INPLACE; ++Warnings: ++Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff new file mode 100644 index 00000000..d7479dbb --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff @@ -0,0 +1,16 @@ +--- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 ++++ instant_alter_limit,64k.reject 2020-05-26 20:00:22.499711222 +0530 +@@ -43,5 +43,12 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-502 ++506 + DROP TABLE t; ++# ++# MDEV-21787 Alter table failure tries to access uninitialized column ++# ++CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT GENERATED ALWAYS AS (SUBSTR(f4, 1, 400)), f3 VARCHAR(500), f4 TEXT)ENGINE=InnoDB ROW_FORMAT=Compact; ++ALTER TABLE t1 ADD UNIQUE KEY (f2(9)); ++ALTER TABLE t1 ADD COLUMN f5 TEXT, ALGORITHM=INPLACE; ++DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff new file mode 100644 index 00000000..1fe3e1a5 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff @@ -0,0 +1,63 @@ +--- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 ++++ instant_alter_limit,8k.reject 2020-05-26 20:19:50.881869095 +0530 +@@ -5,6 +5,28 @@ + ENGINE=InnoDB; + INSERT INTO t VALUES(1,2,3,4,5); + SET innodb_strict_mode = OFF; ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + SELECT * FROM t; + b d a c e + NULL NULL 1 NULL NULL +@@ -12,11 +34,17 @@ + ADD COLUMN b INT, ALGORITHM=INSTANT; + ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE + ALTER TABLE t CHANGE COLUMN b beta INT AFTER a, ALGORITHM=INSTANT; ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + ALTER TABLE t DROP e, DROP c, DROP d, ALGORITHM=INSTANT; ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + SELECT * FROM t; + a beta + 1 NULL + ALTER TABLE t DROP COLUMN beta, ALGORITHM=INSTANT; ++Warnings: ++Warning 139 Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + ALTER TABLE t ADD COLUMN b INT NOT NULL, ALGORITHM=INSTANT; + ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE + SELECT variable_value-@old_instant instants +@@ -43,5 +71,12 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-502 ++492 + DROP TABLE t; ++# ++# MDEV-21787 Alter table failure tries to access uninitialized column ++# ++CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT GENERATED ALWAYS AS (SUBSTR(f4, 1, 400)), f3 VARCHAR(500), f4 TEXT)ENGINE=InnoDB ROW_FORMAT=Compact; ++ALTER TABLE t1 ADD UNIQUE KEY (f2(9)); ++ALTER TABLE t1 ADD COLUMN f5 TEXT, ALGORITHM=INPLACE; ++DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit.result b/mysql-test/suite/innodb/r/instant_alter_limit.result new file mode 100644 index 00000000..75fe40da --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_limit.result @@ -0,0 +1,47 @@ +SET @old_instant= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'); +CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, d INT, e INT) +ENGINE=InnoDB; +INSERT INTO t VALUES(1,2,3,4,5); +SET innodb_strict_mode = OFF; +SELECT * FROM t; +b d a c e +NULL NULL 1 NULL NULL +ALTER TABLE t DROP b, DROP c, DROP d, DROP e, +ADD COLUMN b INT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE +ALTER TABLE t CHANGE COLUMN b beta INT AFTER a, ALGORITHM=INSTANT; +ALTER TABLE t DROP e, DROP c, DROP d, ALGORITHM=INSTANT; +SELECT * FROM t; +a beta +1 NULL +ALTER TABLE t DROP COLUMN beta, ALGORITHM=INSTANT; +ALTER TABLE t ADD COLUMN b INT NOT NULL, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +256 +ALTER TABLE t ADD COLUMN b INT NOT NULL; +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +256 +SELECT * FROM t; +a b +1 0 +ALTER TABLE t ADD COLUMN (c CHAR(255) NOT NULL, d BIGINT NOT NULL), +ALGORITHM=INSTANT; +UPDATE t SET b=b+1,d=d+1,c='foo'; +SELECT * FROM t; +a b c d +1 1 foo 1 +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +502 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/instant_alter_null.result b/mysql-test/suite/innodb/r/instant_alter_null.result new file mode 100644 index 00000000..f49d60fc --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_null.result @@ -0,0 +1,56 @@ +create table t (a int NOT NULL) engine=innodb row_format= compressed; +alter table t modify a int NULL, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE +drop table t; +create table t (a int NOT NULL) engine=innodb row_format= dynamic; +alter table t modify a int NULL, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE +drop table t; +create table t (a int NOT NULL) engine=innodb row_format= compact; +alter table t modify a int NULL, algorithm=instant; +ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE +drop table t; +create table t ( +id int primary key, +a int NOT NULL default 0, +b int NOT NULL default 0, +c int NOT NULL default 0, +index idx (a,b,c) +) engine=innodb row_format=redundant; +insert into t (id, a) values (0, NULL); +ERROR 23000: Column 'a' cannot be null +insert into t (id, b) values (0, NULL); +ERROR 23000: Column 'b' cannot be null +insert into t (id, c) values (0, NULL); +ERROR 23000: Column 'c' cannot be null +insert into t values (1,1,1,1); +set @id = (select table_id from information_schema.innodb_sys_tables +where name = 'test/t'); +select * from information_schema.innodb_sys_columns where table_id=@id; +TABLE_ID NAME POS MTYPE PRTYPE LEN +TABLE_ID id 0 6 1283 4 +TABLE_ID a 1 6 1283 4 +TABLE_ID b 2 6 1283 4 +TABLE_ID c 3 6 1283 4 +alter table t modify a int NULL, algorithm=instant; +insert into t values (2, NULL, 2, 2); +alter table t modify b int NULL, algorithm=nocopy; +insert into t values (3, NULL, NULL, 3); +alter table t modify c int NULL, algorithm=inplace; +insert into t values (4, NULL, NULL, NULL); +select * from information_schema.innodb_sys_columns where table_id=@id; +TABLE_ID NAME POS MTYPE PRTYPE LEN +TABLE_ID id 0 6 1283 4 +TABLE_ID a 1 6 1027 4 +TABLE_ID b 2 6 1027 4 +TABLE_ID c 3 6 1027 4 +select * from t; +id a b c +4 NULL NULL NULL +3 NULL NULL 3 +2 NULL 2 2 +1 1 1 1 +check table t; +Table Op Msg_type Msg_text +test.t check status OK +drop table t; diff --git a/mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff b/mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff new file mode 100644 index 00000000..23f6c915 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff @@ -0,0 +1,18 @@ +--- instant_alter_purge.result ++++ instant_alter_purge,release.result +@@ -32,15 +32,10 @@ + START TRANSACTION WITH CONSISTENT SNAPSHOT; + connection default; + DELETE FROM t1; +-SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL go WAIT_FOR do'; + ALTER TABLE t1 ADD COLUMN f3 INT; + connection purge_control; +-SET DEBUG_SYNC='now WAIT_FOR go'; + COMMIT; + SET GLOBAL innodb_max_purge_lag_wait= 0; +-InnoDB 0 transactions not purged +-SET DEBUG_SYNC='now SIGNAL do'; + disconnect purge_control; + connection default; +-SET DEBUG_SYNC=RESET; + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_purge.result b/mysql-test/suite/innodb/r/instant_alter_purge.result new file mode 100644 index 00000000..61cffc9a --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_purge.result @@ -0,0 +1,22 @@ +InnoDB 0 transactions not purged +# +# MDEV-17793 Crash in purge after instant DROP and emptying the table +# +connect prevent_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 () VALUES (); +ALTER TABLE t1 DROP f2, ADD COLUMN f2 INT; +ALTER TABLE t1 DROP f1; +DELETE FROM t1; +connection prevent_purge; +COMMIT; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +ALTER TABLE t1 ADD COLUMN extra TINYINT UNSIGNED NOT NULL DEFAULT 42; +SET GLOBAL innodb_max_purge_lag_wait=1; +ALTER TABLE t1 DROP extra; +disconnect prevent_purge; +InnoDB 0 transactions not purged +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_rollback.result b/mysql-test/suite/innodb/r/instant_alter_rollback.result new file mode 100644 index 00000000..dd427b62 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_rollback.result @@ -0,0 +1,63 @@ +FLUSH TABLES; +# +# MDEV-11369: Instant ADD COLUMN for InnoDB +# MDEV-15562: Instant DROP COLUMN or changing the order of columns +# +connect to_be_killed, localhost, root; +SET @old_instant= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'); +CREATE TABLE empty (id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB; +CREATE TABLE once LIKE empty; +CREATE TABLE twice LIKE empty; +CREATE TABLE thrice LIKE empty; +INSERT INTO once SET id=1,c2=1; +INSERT INTO twice SET id=1,c2=1; +INSERT INTO thrice SET id=1,c2=1; +ALTER TABLE empty ADD COLUMN (d1 INT DEFAULT 15); +ALTER TABLE once ADD COLUMN (d1 INT DEFAULT 20); +ALTER TABLE twice ADD COLUMN (d1 INT DEFAULT 20); +ALTER TABLE thrice ADD COLUMN (d1 INT DEFAULT 20); +ALTER TABLE twice ADD COLUMN +(d2 INT NOT NULL DEFAULT 10, +d3 VARCHAR(15) NOT NULL DEFAULT 'var och en char'); +ALTER TABLE thrice ADD COLUMN +(d2 INT NOT NULL DEFAULT 10, +d3 TEXT NOT NULL DEFAULT 'con'); +ALTER TABLE thrice DROP c2, DROP d3, CHANGE d2 d3 INT NOT NULL FIRST; +SELECT variable_value-@old_instant instants +FROM information_schema.global_status +WHERE variable_name = 'innodb_instant_alter_column'; +instants +7 +BEGIN; +INSERT INTO empty set id=0,c2=42; +UPDATE once set c2=c2+1; +UPDATE twice set c2=c2+1; +UPDATE thrice set d3=d3+1; +INSERT INTO twice SET id=2,c2=0,d3=''; +INSERT INTO thrice SET id=2,d3=0; +DELETE FROM empty; +DELETE FROM once; +DELETE FROM twice; +DELETE FROM thrice; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +CREATE TABLE foo(a INT PRIMARY KEY) ENGINE=InnoDB; +# Kill the server +disconnect to_be_killed; +# restart +DROP TABLE foo; +InnoDB 0 transactions not purged +SELECT * FROM empty; +id c2 d1 +SELECT * FROM once; +id c2 d1 +1 1 20 +SELECT * FROM twice; +id c2 d1 d2 d3 +1 1 20 10 var och en char +SELECT * FROM thrice; +d3 id d1 +10 1 20 +DROP TABLE empty, once, twice, thrice; diff --git a/mysql-test/suite/innodb/r/instant_alter_upgrade.result b/mysql-test/suite/innodb/r/instant_alter_upgrade.result new file mode 100644 index 00000000..fc7d2896 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_upgrade.result @@ -0,0 +1,9 @@ +# +# MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) +# during ADD COLUMN +# +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB; +FLUSH TABLES; +ALTER TABLE t2 ADD COLUMN b INT; +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/r/instant_auto_inc.result b/mysql-test/suite/innodb/r/instant_auto_inc.result new file mode 100644 index 00000000..a893b917 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_auto_inc.result @@ -0,0 +1,21 @@ +create table t(id int primary key, a int) engine=InnoDB; +insert into t (id, a) values (1, 1); +alter table t modify column id int auto_increment; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +insert into t (a) values (2); +alter table t modify column id int, algorithm=instant; +check table t; +Table Op Msg_type Msg_text +test.t check status OK +insert into t (id, a) values (3, 3); +select * from t; +id a +1 1 +2 2 +3 3 +check table t; +Table Op Msg_type Msg_text +test.t check status OK +drop table t; diff --git a/mysql-test/suite/innodb/r/instant_drop.result b/mysql-test/suite/innodb/r/instant_drop.result new file mode 100644 index 00000000..b9df9b0c --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_drop.result @@ -0,0 +1,205 @@ +create table t1(f1 int not null, f2 int not null, f3 int not null)engine=innodb; +insert into t1 values(1, 2, 3),(4, 5, 6); +alter table t1 drop column f2, algorithm=instant; +select * from t1; +f1 f3 +1 3 +4 6 +insert into t1 values(1,2); +select * from t1; +f1 f3 +1 3 +4 6 +1 2 +alter table t1 add column f4 int not null default 5, algorithm=instant; +select * from t1; +f1 f3 f4 +1 3 5 +4 6 5 +1 2 5 +alter table t1 drop column f1, algorithm=instant; +select * from t1; +f3 f4 +3 5 +6 5 +2 5 +insert into t1 values(7, 9); +select * from t1; +f3 f4 +3 5 +6 5 +2 5 +7 9 +alter table t1 add column f5 blob default repeat('aaa', 950), drop column f4, algorithm=instant; +select * from t1; +f3 f5 +3 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +6 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +select f3 from t1; +f3 +3 +6 +2 +7 +update t1 set f3 = 10 where f3 > 2; +select * from t1; +f3 f5 +10 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +10 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +10 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +delete from t1 where f3 = 10; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f3` int(11) NOT NULL, + `f5` blob DEFAULT repeat('aaa',950) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select f3 from t1; +f3 +2 +update t1 set f5 = 'world'; +select * from t1; +f3 f5 +2 world +drop table t1; +create table t1(f1 int, f2 int not null, index idx(f2))engine=innodb; +insert into t1 values(1, 2); +alter table t1 drop column f1, add column f3 varchar(100) default 'thiru', algorithm=instant; +select * from t1 force index (idx); +f2 f3 +2 thiru +alter table t1 drop column f3, algorithm=instant; +select * from t1; +f2 +2 +begin; +insert into t1 values(10); +select * from t1; +f2 +2 +10 +update t1 set f2 = 100; +select * from t1; +f2 +100 +100 +delete from t1 where f2 = 100; +select * from t1; +f2 +rollback; +select * from t1; +f2 +2 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f2` int(11) NOT NULL, + KEY `idx` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1; +create table t1(f1 int, f2 int not null)engine=innodb; +insert into t1 values(1, 2); +alter table t1 drop column f2, algorithm=instant; +insert into t1 values(NULL); +select * from t1; +f1 +1 +NULL +drop table t1; +create table t1(f1 int not null, f2 int not null)engine=innodb; +insert into t1 values(1, 2); +alter table t1 add column f5 int default 10, algorithm=instant; +alter table t1 add column f3 int not null default 100, algorithm=instant; +alter table t1 add column f4 int default 100, drop column f3, algorithm=instant; +insert into t1 values(2, 3, 20, 100); +select * from t1; +f1 f2 f5 f4 +1 2 10 100 +2 3 20 100 +drop table t1; +create table t1(f1 int not null, f2 int not null) engine=innodb; +insert into t1 values(1, 1); +alter table t1 drop column f2, add column f3 int default 3, algorithm=instant; +select * from t1; +f1 f3 +1 3 +update t1 set f3 = 19; +select * from t1; +f1 f3 +1 19 +alter table t1 drop column f1, add column f5 tinyint default 10 first, +algorithm=instant; +insert into t1 values(4, 10); +select * from t1; +f5 f3 +10 19 +4 10 +create table t2(f1 int, f2 int not null) engine=innodb; +insert into t2(f1, f2) values(1, 2); +alter table t2 drop column f2, add column f4 varchar(100) default repeat('a', 20), add column f5 int default 10, algorithm=instant; +select * from t2; +f1 f4 f5 +1 aaaaaaaaaaaaaaaaaaaa 10 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) DEFAULT NULL, + `f4` varchar(100) DEFAULT repeat('a',20), + `f5` int(11) DEFAULT 10 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t2 add column f6 char(100) default repeat('a', 99), algorithm=instant; +create table t3(f1 int, f2 int not null)engine=innodb; +insert into t3 values(1, 2); +alter table t3 drop column f2, add column f3 int default 1, add column f4 int default 4, algorithm=instant; +create table t4(a varchar(1), b int, c int, primary key(a,b))engine=innodb; +insert into t4 values('4',5,6); +alter table t4 drop column c; +# restart +select * from t1; +f5 f3 +10 19 +4 10 +alter table t1 add column f6 int default 9,drop column f5, algorithm = instant; +insert into t1 values(4, 9); +alter table t1 force, algorithm=inplace; +select * from t1; +f3 f6 +19 9 +10 9 +4 9 +select * from t2; +f1 f4 f5 f6 +1 aaaaaaaaaaaaaaaaaaaa 10 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +alter table t2 force, algorithm=inplace; +select * from t2; +f1 f4 f5 f6 +1 aaaaaaaaaaaaaaaaaaaa 10 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) DEFAULT NULL, + `f4` varchar(100) DEFAULT repeat('a',20), + `f5` int(11) DEFAULT 10, + `f6` char(100) DEFAULT repeat('a',99) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select * from t3; +f1 f3 f4 +1 1 4 +alter table t3 add column f5 char(100) default repeat('a', 99), algorithm=instant; +select * from t4; +a b +4 5 +alter table t4 add column d varchar(5) default 'fubar'; +insert into t4 values('',0,'snafu'); +# restart +select * from t3; +f1 f3 f4 f5 +1 1 4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +select * from t4; +a b d + 0 snafu +4 5 fubar +drop table t1,t2,t3,t4; diff --git a/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result new file mode 100644 index 00000000..ca010d66 --- /dev/null +++ b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result @@ -0,0 +1,24 @@ +CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0; +SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG = 2; +INSERT INTO t1 VALUES(1, 'sql'), (2, 'server'), (3, 'mariadb'), +(4, 'mariadb'), (5, 'test1'), (6, 'test2'), (7, 'test3'), +(8, 'test4'), (9, 'test5'), (10, 'test6'), (11, 'test7'), +(12, 'test8'); +SELECT COUNT(*) FROM t1; +COUNT(*) +12 +UPDATE t1 SET c='best8' WHERE pk=12; +# Kill the server +# Corrupt the pages +SELECT * FROM t1 WHERE PK = 1; +ERROR 42000: Unknown storage engine 'InnoDB' +SELECT * FROM t1 WHERE PK = 1; +pk c +1 sql +SELECT * FROM t1 WHERE pk = 12; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Warning InnoDB: The B-tree of index PRIMARY is corrupted. +test.t1 check error Corrupt +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/lock_delete_updated.result b/mysql-test/suite/innodb/r/lock_delete_updated.result new file mode 100644 index 00000000..3ce63be3 --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_delete_updated.result @@ -0,0 +1,22 @@ +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t VALUES (3); +BEGIN; +UPDATE t SET a = 2; +connect con1,localhost,root; +SET DEBUG_SYNC="lock_wait_start SIGNAL del_locked"; +DELETE FROM t; +connection default; +SET DEBUG_SYNC="now WAIT_FOR del_locked"; +UPDATE t SET a = 1; +COMMIT; +connection con1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con1; +connection default; +# The above DELETE must delete all the rows in the table, so the +# following SELECT must show 0 rows. +SELECT count(*) FROM t; +count(*) +1 +SET DEBUG_SYNC="reset"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/lock_deleted.result b/mysql-test/suite/innodb/r/lock_deleted.result new file mode 100644 index 00000000..0fcb8bd5 --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_deleted.result @@ -0,0 +1,57 @@ +connect stop_purge, localhost, root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect delete, localhost, root,,; +connection default; +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +DELETE FROM t1; +SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked'; +BEGIN; +INSERT INTO t1 VALUES(1,1); +connection delete; +SET DEBUG_SYNC='now WAIT_FOR inserted'; +SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked'; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +DELETE FROM t1 WHERE b=1; +connection default; +connection delete; +COMMIT; +connection default; +SET DEBUG_SYNC='RESET'; +ROLLBACK; +SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked'; +BEGIN; +INSERT INTO t1 VALUES(1,1); +connection delete; +SET DEBUG_SYNC='now WAIT_FOR inserted'; +SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked'; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +BEGIN; +DELETE FROM t1 WHERE b=1; +connection default; +connection delete; +COMMIT; +connection default; +SET DEBUG_SYNC='RESET'; +ROLLBACK; +SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked'; +BEGIN; +SET innodb_lock_wait_timeout=1; +INSERT INTO t1 VALUES(1,1); +connection delete; +SET DEBUG_SYNC='now WAIT_FOR inserted'; +SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked'; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +DELETE FROM t1 WHERE b=1; +connection default; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +COMMIT; +SET DEBUG_SYNC='RESET'; +connection delete; +COMMIT; +disconnect delete; +disconnect stop_purge; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/lock_insert_into_empty.result b/mysql-test/suite/innodb/r/lock_insert_into_empty.result new file mode 100644 index 00000000..c1dea2fc --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_insert_into_empty.result @@ -0,0 +1,57 @@ +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +BEGIN; +DELETE FROM t1; +INSERT INTO t2 VALUES(1),(1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +BEGIN; +SELECT * FROM t2 LOCK IN SHARE MODE; +a +connect con1,localhost,root,,; +SET innodb_lock_wait_timeout=0; +INSERT INTO t2 VALUES(2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +ROLLBACK; +connection con1; +INSERT INTO t2 VALUES(3); +COMMIT; +disconnect con1; +connection default; +SELECT * FROM t1; +a +SELECT * FROM t2; +a +3 +DROP TABLE t1, t2; +# +# MDEV-24700 Assertion "lock not found"==0 in lock_table_x_unlock() +# +SET FOREIGN_KEY_CHECKS=OFF; +CREATE TABLE t1 (id INT PRIMARY KEY, f INT REFERENCES nonexistent(x)) +ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=ON; +BEGIN; +INSERT IGNORE INTO t1 VALUES (1,11); +Warnings: +Warning 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f`) REFERENCES `nonexistent` (`x`)) +REPLACE INTO t1 VALUES (1,12); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f`) REFERENCES `nonexistent` (`x`)) +COMMIT; +DROP TABLE t1; +# +# MDEV-25942 Assertion failed in trx_t::drop_table() +# +CREATE TABLE t1 (k INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 SET k=1; +START TRANSACTION; +INSERT INTO t1 SET k=2; +connect con1,localhost,root,,test; +SET innodb_lock_wait_timeout=0; +CREATE TABLE t2 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB +AS SELECT k FROM t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result b/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result new file mode 100644 index 00000000..572fbc9b --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result @@ -0,0 +1,34 @@ +CREATE TABLE t (pk int PRIMARY KEY, c varchar(10)) ENGINE=InnoDB; +INSERT INTO t VALUES (10, "0123456789"); +connection default; +BEGIN; +SELECT * FROM t WHERE c = 10 FOR UPDATE; +pk c +connect trx2, localhost,root,,; +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL trx2_start_waiting"; +SET DEBUG_SYNC="lock_wait_end SIGNAL trx2_wait_end WAIT_FOR trx2_cont_upd"; +SET DEBUG_SYNC="lock_rec_store_on_page_infimum_end SIGNAL trx2_moved_locks WAIT_FOR trx2_cont"; +UPDATE t SET c = NULL WHERE pk = 10; +connect trx3, localhost,root,,; +SET DEBUG_SYNC="now WAIT_FOR trx2_start_waiting"; +SET innodb_lock_wait_timeout=1; +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL trx3_start_waiting WAIT_FOR trx3_cont_waiting"; +SET DEBUG_SYNC="lock_sys_t_cancel_enter SIGNAL trx3_cancel_enter WAIT_FOR trx3_cont_cancel_waiting"; +UPDATE t SET c = "abcdefghij" WHERE pk = 10; +connection default; +SET DEBUG_SYNC="now WAIT_FOR trx3_start_waiting"; +COMMIT; +SET DEBUG_SYNC="now WAIT_FOR trx2_wait_end"; +SET DEBUG_SYNC="now SIGNAL trx3_cont_waiting"; +SET DEBUG_SYNC="now WAIT_FOR trx3_cancel_enter"; +SET DEBUG_SYNC="now SIGNAL trx2_cont_upd"; +SET DEBUG_SYNC="now WAIT_FOR trx2_moved_locks"; +SET DEBUG_SYNC="now SIGNAL trx3_cont_cancel_waiting"; +SET DEBUG_SYNC="now SIGNAL trx2_cont"; +disconnect trx2; +disconnect trx3; +connection default; +SET DEBUG_SYNC="RESET"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/lock_update_split_rc.result b/mysql-test/suite/innodb/r/lock_update_split_rc.result new file mode 100644 index 00000000..6bdce124 --- /dev/null +++ b/mysql-test/suite/innodb/r/lock_update_split_rc.result @@ -0,0 +1,34 @@ +CREATE TABLE t ( +`a` INT NOT NULL, +`b` INT NOT NULL, +PRIMARY KEY (`a`) +) ENGINE=InnoDB; +SET GLOBAL innodb_limit_optimistic_insert_debug = 3; +INSERT INTO t VALUES(10, 0); +INSERT INTO t VALUES(20, 0); +INSERT INTO t VALUES(30, 0); +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +XA START '1'; +REPLACE INTO t VALUES(10, 1); +REPLACE INTO t VALUES(20, 1); +SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL inserted WAIT_FOR cont'; +REPLACE INTO t VALUES(30, 1); +connect con1,localhost,root; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +XA START '2'; +SET DEBUG_SYNC= 'now WAIT_FOR inserted'; +INSERT INTO t VALUES(40, 2); +SET DEBUG_SYNC= 'now SIGNAL cont'; +connection default; +XA END '1'; +XA PREPARE '1'; +connection default; +XA COMMIT '1'; +connection con1; +XA END '2'; +XA PREPARE '2'; +XA COMMIT '2'; +disconnect con1; +connection default; +SET DEBUG_SYNC= "RESET"; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result new file mode 100644 index 00000000..df58a90d --- /dev/null +++ b/mysql-test/suite/innodb/r/log_corruption.result @@ -0,0 +1,204 @@ +# redo log from before MariaDB 10.2.2/MySQL 5.7.9 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2\./ in mysqld.1.err +# redo log from before MariaDB 10.2.2, with corrupted log checkpoint +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint/ in mysqld.1.err +# redo log from before MariaDB 10.2.2, with corrupted log block +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint/ in mysqld.1.err +# empty redo log from before MariaDB 10.2.2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 1 /InnoDB: Upgrading redo log:/ in mysqld.1.err +# Corrupted multi-file redo log from before MariaDB 10.2.2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +0 +FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and it appears corrupted/ in mysqld.1.err +# Empty multi-file redo log (wrong offset) from before MariaDB 10.2.2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +0 +FOUND 3 /Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint\./ in mysqld.1.err +# Multi-file redo log with size mismatch from after MariaDB 10.2.2 +# Corrupted multi-file redo log from after MariaDB 10.2.2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +0 +FOUND 3 /Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint\./ in mysqld.1.err +FOUND 1 /InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\.2\.3\.4\./ in mysqld.1.err +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +0 +FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 1048576 bytes!/ in mysqld.1.err +FOUND 2 /InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\.2\.3\.4\./ in mysqld.1.err +# Empty multi-file redo log from after MariaDB 10.2.2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +0 +FOUND 3 /InnoDB: No valid checkpoint was found; the log was created with BogoDB 1\.2\.3\.4\./ in mysqld.1.err +# redo log from "after" MariaDB 10.2.2, but with invalid header checksum +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files 4194304 bytes!/ in mysqld.1.err +FOUND 1 /InnoDB: Invalid log header checksum/ in mysqld.1.err +# distant future redo log format, with valid header checksum +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Unsupported redo log format. The redo log was created with malicious intentions, or perhaps\./ in mysqld.1.err +# valid header, but old-format checkpoint blocks +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: No valid checkpoint was found; the log was created with malicious intentions, or perhaps\./ in mysqld.1.err +# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 2 /InnoDB: Invalid log header checksum/ in mysqld.1.err +FOUND 1 /InnoDB: Upgrade after a crash is not supported\. The redo log was created with malicious intentions, or perhaps, and it appears corrupted\./ in mysqld.1.err +# same, but with current-version header +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 3 /InnoDB: Invalid log header checksum/ in mysqld.1.err +# --innodb-force-recovery=6 (skip the entire redo log) +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=6 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +InnoDB YES Supports transactions, row-level locking, foreign keys and encryption for tables YES YES YES +FOUND 1 /\[Note\] InnoDB: log sequence number 0.*; transaction id 0/ in mysqld.1.err +# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# --innodb-force-recovery=6 (skip the entire redo log) +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=6 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +InnoDB YES Supports transactions, row-level locking, foreign keys and encryption for tables YES YES YES +# Test a corrupted MLOG_FILE_NAME record. +# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /\[ERROR\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1\./ in mysqld.1.err +# Test a corrupted MLOG_FILE_NAME record. +# valid header, invalid checkpoint 1, valid checkpoint 2, invalid block +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +NOT FOUND /InnoDB: Invalid log header checksum +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1, and it appears corrupted\./ in mysqld.1.err +# valid header, invalid checkpoint 1, valid checkpoint 2, invalid log record +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 2 /\[ERROR\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1\./ in mysqld.1.err +# 10.2 missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /\[ERROR\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with ibbackup was here!!!1!\./ in mysqld.1.err +# 10.3 missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 3 /\[ERROR\] InnoDB: Upgrade after a crash is not supported\. The redo log was created with MariaDB 10\.3\.1\./ in mysqld.1.err +# Empty 10.3 redo log +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 1 /InnoDB: log sequence number 1213964\b.*; transaction id 0/ in mysqld.1.err +# Empty 10.2 redo log +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 3 /InnoDB: Upgrading redo log:/ in mysqld.1.err +# Empty 10.5 redo log +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 4 /InnoDB: Upgrading redo log:/ in mysqld.1.err +# Minimal MariaDB 10.1.21 encrypted redo log +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Obtaining redo log encryption key version 1 failed/ in mysqld.1.err +FOUND 1 /InnoDB: Decrypting checkpoint failed/ in mysqld.1.err +ib_buffer_pool +ib_logfile0 +ibdata1 +# restart diff --git a/mysql-test/suite/innodb/r/log_data_file_size.result b/mysql-test/suite/innodb/r/log_data_file_size.result new file mode 100644 index 00000000..d33752b0 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_data_file_size.result @@ -0,0 +1,8 @@ +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE t(a INT)ENGINE=InnoDB; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE ibd4(a INT UNIQUE)ENGINE=InnoDB; +CREATE TABLE ibd4f(a INT UNIQUE)ENGINE=InnoDB; +CREATE TABLE ibd5(a INT UNIQUE, b INT UNIQUE)ENGINE=InnoDB; +# Kill the server +DROP TABLE t,ibd4,ibd4f,ibd5; diff --git a/mysql-test/suite/innodb/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result new file mode 100644 index 00000000..f5e98d30 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file.result @@ -0,0 +1,304 @@ +# Testcase for the following bugs +# Bug#16691130 - ASSERT WHEN INNODB_LOG_GROUP_HOME_DIR DOES NOT EXIST +# Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES +# Start mysqld without the possibility to create innodb_undo_tablespaces +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /\[ERROR\] InnoDB: Could not create undo tablespace '.*undo002'/ in mysqld.1.err +# Remove undo001,undo002,ibdata1,ibdata2,ib_logfile101 +# Start mysqld with non existent innodb_log_group_home_dir +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend --innodb_log_group_home_dir=/path/to/non-existent/ +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /Cannot create /path/to/non-existent/ib_logfile101/ in mysqld.1.err +# Successfully let InnoDB create tablespaces +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES +WHERE engine='innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +1 +1 +# Backup tmp/logfile/* +# 1. With ibdata2, Without ibdata1 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /The data file '.*ibdata1' was not found but one of the other data files '.*ibdata2' exists/ in mysqld.1.err +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata2 +undo001 +undo002 +undo003 +# 2. With ibdata1, without ibdata2 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Tablespace size stored in header is \d+ pages, but the sum of data file sizes is \d+ pages/ in mysqld.1.err +FOUND 1 /InnoDB: Cannot start InnoDB. The tail of the system tablespace is missing/ in mysqld.1.err +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata1 +ibdata2 +undo001 +undo002 +undo003 +# 3. Without ibdata1 & ibdata2 +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +undo001 +undo002 +undo003 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\./ in mysqld.1.err +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +undo001 +undo002 +undo003 +# 4. Without ibdata*, ib_logfile* and with undo00* +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +undo001 +undo002 +undo003 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +undo001 +undo002 +undo003 +# 5. Without ibdata*,ib_logfile* files & Without undo002 +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +undo001 +undo003 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +undo001 +undo003 +# 6. Without ibdata*,ib_logfile* files & Without undo001, undo002 +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +undo003 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /undo tablespace .*undo003.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\./ in mysqld.1.err +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +undo003 +# 7. With ibdata files & Without undo002 +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata1 +ibdata2 +undo001 +undo003 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Failed to open the undo tablespace/ in mysqld.1.err +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata1 +ibdata2 +undo001 +undo003 +# 8. With ibdata files & Without undo001, undo002 +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata1 +ibdata2 +undo003 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 2 /InnoDB: Failed to open the undo tablespace/ in mysqld.1.err +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata1 +ibdata2 +undo003 +# 9. Without ibdata*, without undo* +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log file is not recommended\. Please delete redo log file before creating new system tablespace\./ in mysqld.1.err +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +# 10. With ibdata*, without ib_logfile0 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ibdata1 +ibdata2 +undo001 +undo002 +undo003 +# 11. With ibdata* +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata1 +ibdata2 +undo001 +undo002 +undo003 +# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend +SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES +WHERE engine='innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +1 +1 +# restart +# Cleanup +bak_ib_logfile0 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ibdata1 +ibdata2 +undo001 +undo002 +undo003 diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result new file mode 100644 index 00000000..76612295 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_name.result @@ -0,0 +1,95 @@ +SET GLOBAL innodb_file_per_table=ON; +FLUSH TABLES; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +# restart +CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB; +BEGIN; +INSERT INTO t3 VALUES (33101),(347); +INSERT INTO t1 VALUES (42),(9),(101); +RENAME TABLE t1 TO t2; +UPDATE t2 SET a=347 where a=42; +COMMIT; +# Kill the server +# Fault 0 (no real fault): Orphan file with duplicate space_id. +# Fault 1: Two dirty files with the same space_id. +# restart +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID/ in mysqld.1.err +# Fault 2: Wrong space_id in a dirty file, and a missing file. +# restart +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Tablespace \d+ was not found at.*t3.ibd/ in mysqld.1.err +# Fault 3: Wrong space_id in a dirty file, and no missing file. +# restart +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Ignoring data file '.*t[23].ibd' with space ID/ in mysqld.1.err +NOT FOUND /InnoDB: Tablespace \d+ was not found at .*t1.ibd/ in mysqld.1.err +FOUND 1 /InnoDB: Tablespace \d+ was not found at .*t3.ibd/ in mysqld.1.err +FOUND 2 /InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace/ in mysqld.1.err +# Fault 4: Missing data file +# restart +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Tablespace \d+ was not found at .*t[12].ibd. +.*InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace/ in mysqld.1.err +# Fault 5: Wrong type of data file +# restart +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# restart +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*t2.ibd/ in mysqld.1.err +FOUND 1 /.*\[ERROR\] InnoDB: Cannot apply log to \[page id: space=[1-9][0-9]*, page number=3\] of corrupted file './test/t2\.ibd'/ in mysqld.1.err +# restart +SELECT * FROM t2; +a +9 +101 +347 +SELECT * FROM t3; +a +347 +33101 +SHOW TABLES; +Tables_in_test +t2 +t3 +DROP TABLE t2,t3; +CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t0` (errno: 184 "Tablespace already exists") +CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t0` (errno: 184 "Tablespace already exists") +CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB; +DROP TABLE t0; +CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u4(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO u4 VALUES(1); +RENAME TABLE u4 TO u5; +RENAME TABLE u5 TO u6; +INSERT INTO u6 VALUES(2); +# Kill the server +# Fault 6: All-zero data file and innodb_force_recovery +# restart: --innodb-force-recovery=1 +DROP TABLE u1,u2,u3,u6; +# List of files: +db.opt +SHOW TABLES; +Tables_in_test diff --git a/mysql-test/suite/innodb/r/log_file_size.result b/mysql-test/suite/innodb/r/log_file_size.result new file mode 100644 index 00000000..7b4935e1 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_size.result @@ -0,0 +1,66 @@ +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +# restart: --innodb-log-file-size=4m +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +# restart: --innodb-log-file-size=20M +BEGIN; +INSERT INTO t1 VALUES (42); +# restart: --innodb-log-file-size=12M +SELECT * FROM t1; +a +INSERT INTO t1 VALUES (42); +BEGIN; +DELETE FROM t1; +# restart: --innodb-log-file-size=5M +SELECT * FROM t1; +a +42 +INSERT INTO t1 VALUES (0),(123); +BEGIN; +DELETE FROM t1 WHERE a>0; +# Persist the state of the above incomplete transaction by +# causing a redo log write for another transaction. +connect con1, localhost, root; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE a=0; +disconnect con1; +connection default; +# Kill the server +# restart: --innodb-log-group-home-dir=foo\;bar +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +FOUND 1 /syntax error in innodb_log_group_home_dir/ in mysqld.1.err +# restart: --debug=d,innodb_log_abort_1 +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +FOUND 1 /InnoDB: Starting crash recovery from checkpoint LSN=.*/ in mysqld.1.err +# restart: --innodb-read-only +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +FOUND 1 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err +# restart: --debug=d,innodb_log_abort_5 +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +FOUND 1 /redo log from 5\.000MiB to [0-9.]*[KMGT]iB/ in mysqld.1.err +# restart: --innodb-read-only +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +FOUND 2 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err +# restart +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +FOUND 1 /InnoDB: File .*ib_logfile0 is too small/ in mysqld.1.err +# restart +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +FOUND 1 /InnoDB: Expecting only ib_logfile0/ in mysqld.1.err +# restart +FOUND 1 /InnoDB: File .*ib_logfile0 was not found/ in mysqld.1.err +# restart +SELECT * FROM t1; +a +42 +123 +DROP TABLE t1; +FOUND 2 /InnoDB: Resizing redo log from 5\.000MiB to [0-9.]*[KMGT]iB; LSN=\d+\b/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result new file mode 100644 index 00000000..1db2fdde --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_size_online.result @@ -0,0 +1,47 @@ +SET GLOBAL innodb_log_file_size=4194304; +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 4194304 +SELECT global_value FROM information_schema.system_variables +WHERE variable_name = 'innodb_log_file_size'; +global_value +4194304 +CREATE TABLE t ( +a INT PRIMARY KEY AUTO_INCREMENT, +b CHAR(255) NOT NULL) +ENGINE=INNODB; +INSERT INTO t SELECT NULL, REPEAT('a', 255) FROM seq_1_to_20000; +# restart: --innodb-log-file-size=4194304 +SELECT COUNT(*) FROM t; +COUNT(*) +20000 +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 4194304 +FOUND 1 /InnoDB: Resized log to 4\.000MiB/ in mysqld.1.err +UPDATE t SET b='' WHERE a<10; +SET GLOBAL innodb_log_file_size=5242880; +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 5242880 +SELECT global_value FROM information_schema.system_variables +WHERE variable_name = 'innodb_log_file_size'; +global_value +5242880 +# restart +SELECT * FROM t WHERE a<10; +a b +1 +2 +3 +4 +5 +6 +7 +8 +9 +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 5242880 +FOUND 1 /InnoDB: Resized log to 5\.000MiB/ in mysqld.1.err +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/log_upgrade.result b/mysql-test/suite/innodb/r/log_upgrade.result new file mode 100644 index 00000000..4da83460 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_upgrade.result @@ -0,0 +1,16 @@ +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); +# +# MDEV-24412 InnoDB: Upgrade after a crash is not supported +# +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 1 /InnoDB: Upgrading redo log:/ in mysqld.1.err +ib_buffer_pool +ib_logfile0 +ibdata1 +# restart +# End of 10.5 tests diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,compact,innodb.rdiff new file mode 100644 index 00000000..118145be --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,16k,compact,innodb.rdiff @@ -0,0 +1,80 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:51:26.070418078 +0300 +@@ -3,45 +3,65 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,dynamic,innodb.rdiff new file mode 100644 index 00000000..33067866 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,16k,dynamic,innodb.rdiff @@ -0,0 +1,224 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:52:54.580956978 +0300 +@@ -3,45 +3,207 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) +-) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788), c83 VARCHAR(788) ++) ENGINE=INNODB; ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ++CREATE TABLE t1 ( ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT, ++c190 TEXT, c191 TEXT, c192 TEXT, c193 TEXT, c194 TEXT, c195 TEXT, c196 TEXT, ++c197 TEXT, c198 TEXT, c199 TEXT, c200 TEXT, c201 TEXT, c202 TEXT, c203 TEXT, ++c204 TEXT, c205 TEXT, c206 TEXT, c207 TEXT, c208 TEXT, c209 TEXT, c210 TEXT, ++c211 TEXT, c212 TEXT, c213 TEXT, c214 TEXT, c215 TEXT, c216 TEXT, c217 TEXT, ++c218 TEXT, c219 TEXT, c220 TEXT, c221 TEXT, c222 TEXT, c223 TEXT, c224 TEXT, ++c225 TEXT, c226 TEXT, c227 TEXT, c228 TEXT, c229 TEXT, c230 TEXT, c231 TEXT, ++c232 TEXT, c233 TEXT, c234 TEXT, c235 TEXT, c236 TEXT, c237 TEXT, c238 TEXT, ++c239 TEXT, c240 TEXT, c241 TEXT, c242 TEXT, c243 TEXT, c244 TEXT, c245 TEXT, ++c246 TEXT, c247 TEXT, c248 TEXT, c249 TEXT, c250 TEXT, c251 TEXT, c252 TEXT, ++c253 TEXT, c254 TEXT, c255 TEXT, c256 TEXT, c257 TEXT, c258 TEXT, c259 TEXT, ++c260 TEXT, c261 TEXT, c262 TEXT, c263 TEXT, c264 TEXT, c265 TEXT, c266 TEXT, ++c267 TEXT, c268 TEXT, c269 TEXT, c270 TEXT, c271 TEXT, c272 TEXT, c273 TEXT, ++c274 TEXT, c275 TEXT, c276 TEXT, c277 TEXT, c278 TEXT, c279 TEXT, c280 TEXT, ++c281 TEXT, c282 TEXT, c283 TEXT, c284 TEXT, c285 TEXT, c286 TEXT, c287 TEXT, ++c288 TEXT, c289 TEXT, c290 TEXT, c291 TEXT, c292 TEXT, c293 TEXT, c294 TEXT, ++c295 TEXT, c296 TEXT, c297 TEXT, c298 TEXT, c299 TEXT, c300 TEXT, c301 TEXT, ++c302 TEXT, c303 TEXT, c304 TEXT, c305 TEXT, c306 TEXT, c307 TEXT, c308 TEXT, ++c309 TEXT, c310 TEXT, c311 TEXT, c312 TEXT, c313 TEXT, c314 TEXT, c315 TEXT, ++c316 TEXT, c317 TEXT, c318 TEXT, c319 TEXT, c320 TEXT, c321 TEXT, c322 TEXT, ++c323 TEXT, c324 TEXT, c325 TEXT, c326 TEXT, c327 TEXT, c328 TEXT, c329 TEXT, ++c330 TEXT, c331 TEXT, c332 TEXT, c333 TEXT, c334 TEXT, c335 TEXT, c336 TEXT, ++c337 TEXT, c338 TEXT, c339 TEXT, c340 TEXT, c341 TEXT, c342 TEXT, c343 TEXT, ++c344 TEXT, c345 TEXT, c346 TEXT, c347 TEXT, c348 TEXT, c349 TEXT, c350 TEXT, ++c351 TEXT, c352 TEXT, c353 TEXT, c354 TEXT, c355 TEXT, c356 TEXT, c357 TEXT, ++c358 TEXT, c359 TEXT, c360 TEXT, c361 TEXT, c362 TEXT, c363 TEXT, c364 TEXT, ++c365 TEXT, c366 TEXT, c367 TEXT, c368 TEXT, c369 TEXT, c370 TEXT, c371 TEXT, ++c372 TEXT, c373 TEXT, c374 TEXT, c375 TEXT, c376 TEXT, c377 TEXT, c378 TEXT, ++c379 TEXT, c380 TEXT, c381 TEXT, c382 TEXT, c383 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT, ++c190 TEXT, c191 TEXT, c192 TEXT, c193 TEXT, c194 TEXT, c195 TEXT, c196 TEXT, ++c197 TEXT, c198 TEXT, c199 TEXT, c200 TEXT, c201 TEXT, c202 TEXT, c203 TEXT, ++c204 TEXT, c205 TEXT, c206 TEXT, c207 TEXT, c208 TEXT, c209 TEXT, c210 TEXT, ++c211 TEXT, c212 TEXT, c213 TEXT, c214 TEXT, c215 TEXT, c216 TEXT, c217 TEXT, ++c218 TEXT, c219 TEXT, c220 TEXT, c221 TEXT, c222 TEXT, c223 TEXT, c224 TEXT, ++c225 TEXT, c226 TEXT, c227 TEXT, c228 TEXT, c229 TEXT, c230 TEXT, c231 TEXT, ++c232 TEXT, c233 TEXT, c234 TEXT, c235 TEXT, c236 TEXT, c237 TEXT, c238 TEXT, ++c239 TEXT, c240 TEXT, c241 TEXT, c242 TEXT, c243 TEXT, c244 TEXT, c245 TEXT, ++c246 TEXT, c247 TEXT, c248 TEXT, c249 TEXT, c250 TEXT, c251 TEXT, c252 TEXT, ++c253 TEXT, c254 TEXT, c255 TEXT, c256 TEXT, c257 TEXT, c258 TEXT, c259 TEXT, ++c260 TEXT, c261 TEXT, c262 TEXT, c263 TEXT, c264 TEXT, c265 TEXT, c266 TEXT, ++c267 TEXT, c268 TEXT, c269 TEXT, c270 TEXT, c271 TEXT, c272 TEXT, c273 TEXT, ++c274 TEXT, c275 TEXT, c276 TEXT, c277 TEXT, c278 TEXT, c279 TEXT, c280 TEXT, ++c281 TEXT, c282 TEXT, c283 TEXT, c284 TEXT, c285 TEXT, c286 TEXT, c287 TEXT, ++c288 TEXT, c289 TEXT, c290 TEXT, c291 TEXT, c292 TEXT, c293 TEXT, c294 TEXT, ++c295 TEXT, c296 TEXT, c297 TEXT, c298 TEXT, c299 TEXT, c300 TEXT, c301 TEXT, ++c302 TEXT, c303 TEXT, c304 TEXT, c305 TEXT, c306 TEXT, c307 TEXT, c308 TEXT, ++c309 TEXT, c310 TEXT, c311 TEXT, c312 TEXT, c313 TEXT, c314 TEXT, c315 TEXT, ++c316 TEXT, c317 TEXT, c318 TEXT, c319 TEXT, c320 TEXT, c321 TEXT, c322 TEXT, ++c323 TEXT, c324 TEXT, c325 TEXT, c326 TEXT, c327 TEXT, c328 TEXT, c329 TEXT, ++c330 TEXT, c331 TEXT, c332 TEXT, c333 TEXT, c334 TEXT, c335 TEXT, c336 TEXT, ++c337 TEXT, c338 TEXT, c339 TEXT, c340 TEXT, c341 TEXT, c342 TEXT, c343 TEXT, ++c344 TEXT, c345 TEXT, c346 TEXT, c347 TEXT, c348 TEXT, c349 TEXT, c350 TEXT, ++c351 TEXT, c352 TEXT, c353 TEXT, c354 TEXT, c355 TEXT, c356 TEXT, c357 TEXT, ++c358 TEXT, c359 TEXT, c360 TEXT, c361 TEXT, c362 TEXT, c363 TEXT, c364 TEXT, ++c365 TEXT, c366 TEXT, c367 TEXT, c368 TEXT, c369 TEXT, c370 TEXT, c371 TEXT, ++c372 TEXT, c373 TEXT, c374 TEXT, c375 TEXT, c376 TEXT, c377 TEXT, c378 TEXT, ++c379 TEXT, c380 TEXT, c381 TEXT, c382 TEXT, c383 TEXT, c384 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,innodb,redundant.rdiff new file mode 100644 index 00000000..e50e4d2b --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,16k,innodb,redundant.rdiff @@ -0,0 +1,80 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:55:05.258762945 +0300 +@@ -3,45 +3,65 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8123). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8123). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8123). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 8123). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,compact,innodb.rdiff new file mode 100644 index 00000000..1bc03a5d --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,32k,compact,innodb.rdiff @@ -0,0 +1,121 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:27:08.004932026 +0300 +@@ -3,45 +3,104 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16318). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16318). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) +-) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788) ++) ENGINE=INNODB; ++ERROR 42000: Row size too large (> 16318). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++CREATE TABLE t1 ( ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16318). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,dynamic,innodb.rdiff new file mode 100644 index 00000000..71c4c2e4 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,32k,dynamic,innodb.rdiff @@ -0,0 +1,366 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:38:41.609328820 +0300 +@@ -3,45 +3,351 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16318). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16318). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788), c83 VARCHAR(788) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT, ++c190 TEXT, c191 TEXT, c192 TEXT, c193 TEXT, c194 TEXT, c195 TEXT, c196 TEXT, ++c197 TEXT, c198 TEXT, c199 TEXT, c200 TEXT, c201 TEXT, c202 TEXT, c203 TEXT, ++c204 TEXT, c205 TEXT, c206 TEXT, c207 TEXT, c208 TEXT, c209 TEXT, c210 TEXT, ++c211 TEXT, c212 TEXT, c213 TEXT, c214 TEXT, c215 TEXT, c216 TEXT, c217 TEXT, ++c218 TEXT, c219 TEXT, c220 TEXT, c221 TEXT, c222 TEXT, c223 TEXT, c224 TEXT, ++c225 TEXT, c226 TEXT, c227 TEXT, c228 TEXT, c229 TEXT, c230 TEXT, c231 TEXT, ++c232 TEXT, c233 TEXT, c234 TEXT, c235 TEXT, c236 TEXT, c237 TEXT, c238 TEXT, ++c239 TEXT, c240 TEXT, c241 TEXT, c242 TEXT, c243 TEXT, c244 TEXT, c245 TEXT, ++c246 TEXT, c247 TEXT, c248 TEXT, c249 TEXT, c250 TEXT, c251 TEXT, c252 TEXT, ++c253 TEXT, c254 TEXT, c255 TEXT, c256 TEXT, c257 TEXT, c258 TEXT, c259 TEXT, ++c260 TEXT, c261 TEXT, c262 TEXT, c263 TEXT, c264 TEXT, c265 TEXT, c266 TEXT, ++c267 TEXT, c268 TEXT, c269 TEXT, c270 TEXT, c271 TEXT, c272 TEXT, c273 TEXT, ++c274 TEXT, c275 TEXT, c276 TEXT, c277 TEXT, c278 TEXT, c279 TEXT, c280 TEXT, ++c281 TEXT, c282 TEXT, c283 TEXT, c284 TEXT, c285 TEXT, c286 TEXT, c287 TEXT, ++c288 TEXT, c289 TEXT, c290 TEXT, c291 TEXT, c292 TEXT, c293 TEXT, c294 TEXT, ++c295 TEXT, c296 TEXT, c297 TEXT, c298 TEXT, c299 TEXT, c300 TEXT, c301 TEXT, ++c302 TEXT, c303 TEXT, c304 TEXT, c305 TEXT, c306 TEXT, c307 TEXT, c308 TEXT, ++c309 TEXT, c310 TEXT, c311 TEXT, c312 TEXT, c313 TEXT, c314 TEXT, c315 TEXT, ++c316 TEXT, c317 TEXT, c318 TEXT, c319 TEXT, c320 TEXT, c321 TEXT, c322 TEXT, ++c323 TEXT, c324 TEXT, c325 TEXT, c326 TEXT, c327 TEXT, c328 TEXT, c329 TEXT, ++c330 TEXT, c331 TEXT, c332 TEXT, c333 TEXT, c334 TEXT, c335 TEXT, c336 TEXT, ++c337 TEXT, c338 TEXT, c339 TEXT, c340 TEXT, c341 TEXT, c342 TEXT, c343 TEXT, ++c344 TEXT, c345 TEXT, c346 TEXT, c347 TEXT, c348 TEXT, c349 TEXT, c350 TEXT, ++c351 TEXT, c352 TEXT, c353 TEXT, c354 TEXT, c355 TEXT, c356 TEXT, c357 TEXT, ++c358 TEXT, c359 TEXT, c360 TEXT, c361 TEXT, c362 TEXT, c363 TEXT, c364 TEXT, ++c365 TEXT, c366 TEXT, c367 TEXT, c368 TEXT, c369 TEXT, c370 TEXT, c371 TEXT, ++c372 TEXT, c373 TEXT, c374 TEXT, c375 TEXT, c376 TEXT, c377 TEXT, c378 TEXT, ++c379 TEXT, c380 TEXT, c381 TEXT, c382 TEXT, c383 TEXT, c384 TEXT, c385 TEXT, ++c386 TEXT, c387 TEXT, c388 TEXT, c389 TEXT, c390 TEXT, c391 TEXT, c392 TEXT, ++c393 TEXT, c394 TEXT, c395 TEXT, c396 TEXT, c397 TEXT, c398 TEXT, c399 TEXT, ++c400 TEXT, c401 TEXT, c402 TEXT, c403 TEXT, c404 TEXT, c405 TEXT, c406 TEXT, ++c407 TEXT, c408 TEXT, c409 TEXT, c410 TEXT, c411 TEXT, c412 TEXT, c413 TEXT, ++c414 TEXT, c415 TEXT, c416 TEXT, c417 TEXT, c418 TEXT, c419 TEXT, c420 TEXT, ++c421 TEXT, c422 TEXT, c423 TEXT, c424 TEXT, c425 TEXT, c426 TEXT, c427 TEXT, ++c428 TEXT, c429 TEXT, c430 TEXT, c431 TEXT, c432 TEXT, c433 TEXT, c434 TEXT, ++c435 TEXT, c436 TEXT, c437 TEXT, c438 TEXT, c439 TEXT, c440 TEXT, c441 TEXT, ++c442 TEXT, c443 TEXT, c444 TEXT, c445 TEXT, c446 TEXT, c447 TEXT, c448 TEXT, ++c449 TEXT, c450 TEXT, c451 TEXT, c452 TEXT, c453 TEXT, c454 TEXT, c455 TEXT, ++c456 TEXT, c457 TEXT, c458 TEXT, c459 TEXT, c460 TEXT, c461 TEXT, c462 TEXT, ++c463 TEXT, c464 TEXT, c465 TEXT, c466 TEXT, c467 TEXT, c468 TEXT, c469 TEXT, ++c470 TEXT, c471 TEXT, c472 TEXT, c473 TEXT, c474 TEXT, c475 TEXT, c476 TEXT, ++c477 TEXT, c478 TEXT, c479 TEXT, c480 TEXT, c481 TEXT, c482 TEXT, c483 TEXT, ++c484 TEXT, c485 TEXT, c486 TEXT, c487 TEXT, c488 TEXT, c489 TEXT, c490 TEXT, ++c491 TEXT, c492 TEXT, c493 TEXT, c494 TEXT, c495 TEXT, c496 TEXT, c497 TEXT, ++c498 TEXT, c499 TEXT, c500 TEXT, c501 TEXT, c502 TEXT, c503 TEXT, c504 TEXT, ++c505 TEXT, c506 TEXT, c507 TEXT, c508 TEXT, c509 TEXT, c510 TEXT, c511 TEXT, ++c512 TEXT, c513 TEXT, c514 TEXT, c515 TEXT, c516 TEXT, c517 TEXT, c518 TEXT, ++c519 TEXT, c520 TEXT, c521 TEXT, c522 TEXT, c523 TEXT, c524 TEXT, c525 TEXT, ++c526 TEXT, c527 TEXT, c528 TEXT, c529 TEXT, c530 TEXT, c531 TEXT, c532 TEXT, ++c533 TEXT, c534 TEXT, c535 TEXT, c536 TEXT, c537 TEXT, c538 TEXT, c539 TEXT, ++c540 TEXT, c541 TEXT, c542 TEXT, c543 TEXT, c544 TEXT, c545 TEXT, c546 TEXT, ++c547 TEXT, c548 TEXT, c549 TEXT, c550 TEXT, c551 TEXT, c552 TEXT, c553 TEXT, ++c554 TEXT, c555 TEXT, c556 TEXT, c557 TEXT, c558 TEXT, c559 TEXT, c560 TEXT, ++c561 TEXT, c562 TEXT, c563 TEXT, c564 TEXT, c565 TEXT, c566 TEXT, c567 TEXT, ++c568 TEXT, c569 TEXT, c570 TEXT, c571 TEXT, c572 TEXT, c573 TEXT, c574 TEXT, ++c575 TEXT, c576 TEXT, c577 TEXT, c578 TEXT, c579 TEXT, c580 TEXT, c581 TEXT, ++c582 TEXT, c583 TEXT, c584 TEXT, c585 TEXT, c586 TEXT, c587 TEXT, c588 TEXT, ++c589 TEXT, c590 TEXT, c591 TEXT, c592 TEXT, c593 TEXT, c594 TEXT, c595 TEXT, ++c596 TEXT, c597 TEXT, c598 TEXT, c599 TEXT, c600 TEXT, c601 TEXT, c602 TEXT, ++c603 TEXT, c604 TEXT, c605 TEXT, c606 TEXT, c607 TEXT, c608 TEXT, c609 TEXT, ++c610 TEXT, c611 TEXT, c612 TEXT, c613 TEXT, c614 TEXT, c615 TEXT, c616 TEXT, ++c617 TEXT, c618 TEXT, c619 TEXT, c620 TEXT, c621 TEXT, c622 TEXT, c623 TEXT, ++c624 TEXT, c625 TEXT, c626 TEXT, c627 TEXT, c628 TEXT, c629 TEXT, c630 TEXT, ++c631 TEXT, c632 TEXT, c633 TEXT, c634 TEXT, c635 TEXT, c636 TEXT, c637 TEXT, ++c638 TEXT, c639 TEXT, c640 TEXT, c641 TEXT, c642 TEXT, c643 TEXT, c644 TEXT, ++c645 TEXT, c646 TEXT, c647 TEXT, c648 TEXT, c649 TEXT, c650 TEXT, c651 TEXT, ++c652 TEXT, c653 TEXT, c654 TEXT, c655 TEXT, c656 TEXT, c657 TEXT, c658 TEXT, ++c659 TEXT, c660 TEXT, c661 TEXT, c662 TEXT, c663 TEXT, c664 TEXT, c665 TEXT, ++c666 TEXT, c667 TEXT, c668 TEXT, c669 TEXT, c670 TEXT, c671 TEXT, c672 TEXT, ++c673 TEXT, c674 TEXT, c675 TEXT, c676 TEXT, c677 TEXT, c678 TEXT, c679 TEXT, ++c680 TEXT, c681 TEXT, c682 TEXT, c683 TEXT, c684 TEXT, c685 TEXT, c686 TEXT, ++c687 TEXT, c688 TEXT, c689 TEXT, c690 TEXT, c691 TEXT, c692 TEXT, c693 TEXT, ++c694 TEXT, c695 TEXT, c696 TEXT, c697 TEXT, c698 TEXT, c699 TEXT, c700 TEXT, ++c701 TEXT, c702 TEXT, c703 TEXT, c704 TEXT, c705 TEXT, c706 TEXT, c707 TEXT, ++c708 TEXT, c709 TEXT, c710 TEXT, c711 TEXT, c712 TEXT, c713 TEXT, c714 TEXT, ++c715 TEXT, c716 TEXT, c717 TEXT, c718 TEXT, c719 TEXT, c720 TEXT, c721 TEXT, ++c722 TEXT, c723 TEXT, c724 TEXT, c725 TEXT, c726 TEXT, c727 TEXT, c728 TEXT, ++c729 TEXT, c730 TEXT, c731 TEXT, c732 TEXT, c733 TEXT, c734 TEXT, c735 TEXT, ++c736 TEXT, c737 TEXT, c738 TEXT, c739 TEXT, c740 TEXT, c741 TEXT, c742 TEXT, ++c743 TEXT, c744 TEXT, c745 TEXT, c746 TEXT, c747 TEXT, c748 TEXT, c749 TEXT, ++c750 TEXT, c751 TEXT, c752 TEXT, c753 TEXT, c754 TEXT, c755 TEXT, c756 TEXT, ++c757 TEXT, c758 TEXT, c759 TEXT, c760 TEXT, c761 TEXT, c762 TEXT, c763 TEXT, ++c764 TEXT, c765 TEXT, c766 TEXT, c767 TEXT, c768 TEXT, c769 TEXT, c770 TEXT, ++c771 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT, ++c190 TEXT, c191 TEXT, c192 TEXT, c193 TEXT, c194 TEXT, c195 TEXT, c196 TEXT, ++c197 TEXT, c198 TEXT, c199 TEXT, c200 TEXT, c201 TEXT, c202 TEXT, c203 TEXT, ++c204 TEXT, c205 TEXT, c206 TEXT, c207 TEXT, c208 TEXT, c209 TEXT, c210 TEXT, ++c211 TEXT, c212 TEXT, c213 TEXT, c214 TEXT, c215 TEXT, c216 TEXT, c217 TEXT, ++c218 TEXT, c219 TEXT, c220 TEXT, c221 TEXT, c222 TEXT, c223 TEXT, c224 TEXT, ++c225 TEXT, c226 TEXT, c227 TEXT, c228 TEXT, c229 TEXT, c230 TEXT, c231 TEXT, ++c232 TEXT, c233 TEXT, c234 TEXT, c235 TEXT, c236 TEXT, c237 TEXT, c238 TEXT, ++c239 TEXT, c240 TEXT, c241 TEXT, c242 TEXT, c243 TEXT, c244 TEXT, c245 TEXT, ++c246 TEXT, c247 TEXT, c248 TEXT, c249 TEXT, c250 TEXT, c251 TEXT, c252 TEXT, ++c253 TEXT, c254 TEXT, c255 TEXT, c256 TEXT, c257 TEXT, c258 TEXT, c259 TEXT, ++c260 TEXT, c261 TEXT, c262 TEXT, c263 TEXT, c264 TEXT, c265 TEXT, c266 TEXT, ++c267 TEXT, c268 TEXT, c269 TEXT, c270 TEXT, c271 TEXT, c272 TEXT, c273 TEXT, ++c274 TEXT, c275 TEXT, c276 TEXT, c277 TEXT, c278 TEXT, c279 TEXT, c280 TEXT, ++c281 TEXT, c282 TEXT, c283 TEXT, c284 TEXT, c285 TEXT, c286 TEXT, c287 TEXT, ++c288 TEXT, c289 TEXT, c290 TEXT, c291 TEXT, c292 TEXT, c293 TEXT, c294 TEXT, ++c295 TEXT, c296 TEXT, c297 TEXT, c298 TEXT, c299 TEXT, c300 TEXT, c301 TEXT, ++c302 TEXT, c303 TEXT, c304 TEXT, c305 TEXT, c306 TEXT, c307 TEXT, c308 TEXT, ++c309 TEXT, c310 TEXT, c311 TEXT, c312 TEXT, c313 TEXT, c314 TEXT, c315 TEXT, ++c316 TEXT, c317 TEXT, c318 TEXT, c319 TEXT, c320 TEXT, c321 TEXT, c322 TEXT, ++c323 TEXT, c324 TEXT, c325 TEXT, c326 TEXT, c327 TEXT, c328 TEXT, c329 TEXT, ++c330 TEXT, c331 TEXT, c332 TEXT, c333 TEXT, c334 TEXT, c335 TEXT, c336 TEXT, ++c337 TEXT, c338 TEXT, c339 TEXT, c340 TEXT, c341 TEXT, c342 TEXT, c343 TEXT, ++c344 TEXT, c345 TEXT, c346 TEXT, c347 TEXT, c348 TEXT, c349 TEXT, c350 TEXT, ++c351 TEXT, c352 TEXT, c353 TEXT, c354 TEXT, c355 TEXT, c356 TEXT, c357 TEXT, ++c358 TEXT, c359 TEXT, c360 TEXT, c361 TEXT, c362 TEXT, c363 TEXT, c364 TEXT, ++c365 TEXT, c366 TEXT, c367 TEXT, c368 TEXT, c369 TEXT, c370 TEXT, c371 TEXT, ++c372 TEXT, c373 TEXT, c374 TEXT, c375 TEXT, c376 TEXT, c377 TEXT, c378 TEXT, ++c379 TEXT, c380 TEXT, c381 TEXT, c382 TEXT, c383 TEXT, c384 TEXT, c385 TEXT, ++c386 TEXT, c387 TEXT, c388 TEXT, c389 TEXT, c390 TEXT, c391 TEXT, c392 TEXT, ++c393 TEXT, c394 TEXT, c395 TEXT, c396 TEXT, c397 TEXT, c398 TEXT, c399 TEXT, ++c400 TEXT, c401 TEXT, c402 TEXT, c403 TEXT, c404 TEXT, c405 TEXT, c406 TEXT, ++c407 TEXT, c408 TEXT, c409 TEXT, c410 TEXT, c411 TEXT, c412 TEXT, c413 TEXT, ++c414 TEXT, c415 TEXT, c416 TEXT, c417 TEXT, c418 TEXT, c419 TEXT, c420 TEXT, ++c421 TEXT, c422 TEXT, c423 TEXT, c424 TEXT, c425 TEXT, c426 TEXT, c427 TEXT, ++c428 TEXT, c429 TEXT, c430 TEXT, c431 TEXT, c432 TEXT, c433 TEXT, c434 TEXT, ++c435 TEXT, c436 TEXT, c437 TEXT, c438 TEXT, c439 TEXT, c440 TEXT, c441 TEXT, ++c442 TEXT, c443 TEXT, c444 TEXT, c445 TEXT, c446 TEXT, c447 TEXT, c448 TEXT, ++c449 TEXT, c450 TEXT, c451 TEXT, c452 TEXT, c453 TEXT, c454 TEXT, c455 TEXT, ++c456 TEXT, c457 TEXT, c458 TEXT, c459 TEXT, c460 TEXT, c461 TEXT, c462 TEXT, ++c463 TEXT, c464 TEXT, c465 TEXT, c466 TEXT, c467 TEXT, c468 TEXT, c469 TEXT, ++c470 TEXT, c471 TEXT, c472 TEXT, c473 TEXT, c474 TEXT, c475 TEXT, c476 TEXT, ++c477 TEXT, c478 TEXT, c479 TEXT, c480 TEXT, c481 TEXT, c482 TEXT, c483 TEXT, ++c484 TEXT, c485 TEXT, c486 TEXT, c487 TEXT, c488 TEXT, c489 TEXT, c490 TEXT, ++c491 TEXT, c492 TEXT, c493 TEXT, c494 TEXT, c495 TEXT, c496 TEXT, c497 TEXT, ++c498 TEXT, c499 TEXT, c500 TEXT, c501 TEXT, c502 TEXT, c503 TEXT, c504 TEXT, ++c505 TEXT, c506 TEXT, c507 TEXT, c508 TEXT, c509 TEXT, c510 TEXT, c511 TEXT, ++c512 TEXT, c513 TEXT, c514 TEXT, c515 TEXT, c516 TEXT, c517 TEXT, c518 TEXT, ++c519 TEXT, c520 TEXT, c521 TEXT, c522 TEXT, c523 TEXT, c524 TEXT, c525 TEXT, ++c526 TEXT, c527 TEXT, c528 TEXT, c529 TEXT, c530 TEXT, c531 TEXT, c532 TEXT, ++c533 TEXT, c534 TEXT, c535 TEXT, c536 TEXT, c537 TEXT, c538 TEXT, c539 TEXT, ++c540 TEXT, c541 TEXT, c542 TEXT, c543 TEXT, c544 TEXT, c545 TEXT, c546 TEXT, ++c547 TEXT, c548 TEXT, c549 TEXT, c550 TEXT, c551 TEXT, c552 TEXT, c553 TEXT, ++c554 TEXT, c555 TEXT, c556 TEXT, c557 TEXT, c558 TEXT, c559 TEXT, c560 TEXT, ++c561 TEXT, c562 TEXT, c563 TEXT, c564 TEXT, c565 TEXT, c566 TEXT, c567 TEXT, ++c568 TEXT, c569 TEXT, c570 TEXT, c571 TEXT, c572 TEXT, c573 TEXT, c574 TEXT, ++c575 TEXT, c576 TEXT, c577 TEXT, c578 TEXT, c579 TEXT, c580 TEXT, c581 TEXT, ++c582 TEXT, c583 TEXT, c584 TEXT, c585 TEXT, c586 TEXT, c587 TEXT, c588 TEXT, ++c589 TEXT, c590 TEXT, c591 TEXT, c592 TEXT, c593 TEXT, c594 TEXT, c595 TEXT, ++c596 TEXT, c597 TEXT, c598 TEXT, c599 TEXT, c600 TEXT, c601 TEXT, c602 TEXT, ++c603 TEXT, c604 TEXT, c605 TEXT, c606 TEXT, c607 TEXT, c608 TEXT, c609 TEXT, ++c610 TEXT, c611 TEXT, c612 TEXT, c613 TEXT, c614 TEXT, c615 TEXT, c616 TEXT, ++c617 TEXT, c618 TEXT, c619 TEXT, c620 TEXT, c621 TEXT, c622 TEXT, c623 TEXT, ++c624 TEXT, c625 TEXT, c626 TEXT, c627 TEXT, c628 TEXT, c629 TEXT, c630 TEXT, ++c631 TEXT, c632 TEXT, c633 TEXT, c634 TEXT, c635 TEXT, c636 TEXT, c637 TEXT, ++c638 TEXT, c639 TEXT, c640 TEXT, c641 TEXT, c642 TEXT, c643 TEXT, c644 TEXT, ++c645 TEXT, c646 TEXT, c647 TEXT, c648 TEXT, c649 TEXT, c650 TEXT, c651 TEXT, ++c652 TEXT, c653 TEXT, c654 TEXT, c655 TEXT, c656 TEXT, c657 TEXT, c658 TEXT, ++c659 TEXT, c660 TEXT, c661 TEXT, c662 TEXT, c663 TEXT, c664 TEXT, c665 TEXT, ++c666 TEXT, c667 TEXT, c668 TEXT, c669 TEXT, c670 TEXT, c671 TEXT, c672 TEXT, ++c673 TEXT, c674 TEXT, c675 TEXT, c676 TEXT, c677 TEXT, c678 TEXT, c679 TEXT, ++c680 TEXT, c681 TEXT, c682 TEXT, c683 TEXT, c684 TEXT, c685 TEXT, c686 TEXT, ++c687 TEXT, c688 TEXT, c689 TEXT, c690 TEXT, c691 TEXT, c692 TEXT, c693 TEXT, ++c694 TEXT, c695 TEXT, c696 TEXT, c697 TEXT, c698 TEXT, c699 TEXT, c700 TEXT, ++c701 TEXT, c702 TEXT, c703 TEXT, c704 TEXT, c705 TEXT, c706 TEXT, c707 TEXT, ++c708 TEXT, c709 TEXT, c710 TEXT, c711 TEXT, c712 TEXT, c713 TEXT, c714 TEXT, ++c715 TEXT, c716 TEXT, c717 TEXT, c718 TEXT, c719 TEXT, c720 TEXT, c721 TEXT, ++c722 TEXT, c723 TEXT, c724 TEXT, c725 TEXT, c726 TEXT, c727 TEXT, c728 TEXT, ++c729 TEXT, c730 TEXT, c731 TEXT, c732 TEXT, c733 TEXT, c734 TEXT, c735 TEXT, ++c736 TEXT, c737 TEXT, c738 TEXT, c739 TEXT, c740 TEXT, c741 TEXT, c742 TEXT, ++c743 TEXT, c744 TEXT, c745 TEXT, c746 TEXT, c747 TEXT, c748 TEXT, c749 TEXT, ++c750 TEXT, c751 TEXT, c752 TEXT, c753 TEXT, c754 TEXT, c755 TEXT, c756 TEXT, ++c757 TEXT, c758 TEXT, c759 TEXT, c760 TEXT, c761 TEXT, c762 TEXT, c763 TEXT, ++c764 TEXT, c765 TEXT, c766 TEXT, c767 TEXT, c768 TEXT, c769 TEXT, c770 TEXT, ++c771 TEXT, c772 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16318). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,innodb,redundant.rdiff new file mode 100644 index 00000000..e42b3de8 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,32k,innodb,redundant.rdiff @@ -0,0 +1,121 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:41:03.319664978 +0300 +@@ -3,45 +3,104 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16315). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16315). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) +-) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788) ++) ENGINE=INNODB; ++ERROR 42000: Row size too large (> 16315). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++CREATE TABLE t1 ( ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16315). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,compact,innodb.rdiff new file mode 100644 index 00000000..6f08dab3 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,4k,compact,innodb.rdiff @@ -0,0 +1,62 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:56:23.489432164 +0300 +@@ -1,47 +1,37 @@ + call mtr.add_suppression("Cannot add field `.*` in table `test`.`t1` because after adding it, the row size is"); + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +-c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +-c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c5 CHAR(255), c6 CHAR(255), c7 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +-c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +-c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +-c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +-c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +-c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +-c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( +-c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c1 VARCHAR(788), c2 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) ++c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c1 TEXT, c2 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,dynamic,innodb.rdiff new file mode 100644 index 00000000..bd37d435 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,4k,dynamic,innodb.rdiff @@ -0,0 +1,128 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:57:38.636143710 +0300 +@@ -1,47 +1,103 @@ + call mtr.add_suppression("Cannot add field `.*` in table `test`.`t1` because after adding it, the row size is"); + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +-c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +-c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c5 CHAR(255), c6 CHAR(255), c7 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +-c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +-c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +-c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +-c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +-c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +-c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) +-) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788), c83 VARCHAR(788) ++) ENGINE=INNODB; ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ++CREATE TABLE t1 ( ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,innodb,redundant.rdiff new file mode 100644 index 00000000..93c39ff6 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,4k,innodb,redundant.rdiff @@ -0,0 +1,62 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:58:58.318768169 +0300 +@@ -1,47 +1,37 @@ + call mtr.add_suppression("Cannot add field `.*` in table `test`.`t1` because after adding it, the row size is"); + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +-c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +-c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c5 CHAR(255), c6 CHAR(255), c7 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +-c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +-c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +-c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +-c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +-c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +-c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( +-c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c1 VARCHAR(788), c2 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) ++c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c1 TEXT, c2 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,compact,innodb.rdiff new file mode 100644 index 00000000..5e6c6221 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,64k,compact,innodb.rdiff @@ -0,0 +1,203 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:45:21.760116841 +0300 +@@ -3,45 +3,186 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255), ++c65 CHAR(255), c66 CHAR(255), c67 CHAR(255), c68 CHAR(255), ++c69 CHAR(255), c70 CHAR(255), c71 CHAR(255), c72 CHAR(255), ++c73 CHAR(255), c74 CHAR(255), c75 CHAR(255), c76 CHAR(255), ++c77 CHAR(255), c78 CHAR(255), c79 CHAR(255), c80 CHAR(255), ++c81 CHAR(255), c82 CHAR(255), c83 CHAR(255), c84 CHAR(255), ++c85 CHAR(255), c86 CHAR(255), c87 CHAR(255), c88 CHAR(255), ++c89 CHAR(255), c90 CHAR(255), c91 CHAR(255), c92 CHAR(255), ++c93 CHAR(255), c94 CHAR(255), c95 CHAR(255), c96 CHAR(255), ++c97 CHAR(255), c98 CHAR(255), c99 CHAR(255), c100 CHAR(255), ++c101 CHAR(255), c102 CHAR(255), c103 CHAR(255), c104 CHAR(255), ++c105 CHAR(255), c106 CHAR(255), c107 CHAR(255), c108 CHAR(255), ++c109 CHAR(255), c110 CHAR(255), c111 CHAR(255), c112 CHAR(255), ++c113 CHAR(255), c114 CHAR(255), c115 CHAR(255), c116 CHAR(255), ++c117 CHAR(255), c118 CHAR(255), c119 CHAR(255), c120 CHAR(255), ++c121 CHAR(255), c122 CHAR(255), c123 CHAR(255), c124 CHAR(255), ++c125 CHAR(255), c126 CHAR(255), c127 CHAR(255), c128 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255), ++c65 CHAR(255), c66 CHAR(255), c67 CHAR(255), c68 CHAR(255), ++c69 CHAR(255), c70 CHAR(255), c71 CHAR(255), c72 CHAR(255), ++c73 CHAR(255), c74 CHAR(255), c75 CHAR(255), c76 CHAR(255), ++c77 CHAR(255), c78 CHAR(255), c79 CHAR(255), c80 CHAR(255), ++c81 CHAR(255), c82 CHAR(255), c83 CHAR(255), c84 CHAR(255), ++c85 CHAR(255), c86 CHAR(255), c87 CHAR(255), c88 CHAR(255), ++c89 CHAR(255), c90 CHAR(255), c91 CHAR(255), c92 CHAR(255), ++c93 CHAR(255), c94 CHAR(255), c95 CHAR(255), c96 CHAR(255), ++c97 CHAR(255), c98 CHAR(255), c99 CHAR(255), c100 CHAR(255), ++c101 CHAR(255), c102 CHAR(255), c103 CHAR(255), c104 CHAR(255), ++c105 CHAR(255), c106 CHAR(255), c107 CHAR(255), c108 CHAR(255), ++c109 CHAR(255), c110 CHAR(255), c111 CHAR(255), c112 CHAR(255), ++c113 CHAR(255), c114 CHAR(255), c115 CHAR(255), c116 CHAR(255), ++c117 CHAR(255), c118 CHAR(255), c119 CHAR(255), c120 CHAR(255), ++c121 CHAR(255), c122 CHAR(255), c123 CHAR(255), c124 CHAR(255), ++c125 CHAR(255), c126 CHAR(255), c127 CHAR(255), c128 CHAR(255), ++c129 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255), ++c65 VARCHAR(255), c66 VARCHAR(255), c67 VARCHAR(255), c68 VARCHAR(255), ++c69 VARCHAR(255), c70 VARCHAR(255), c71 VARCHAR(255), c72 VARCHAR(255), ++c73 VARCHAR(255), c74 VARCHAR(255), c75 VARCHAR(255), c76 VARCHAR(255), ++c77 VARCHAR(255), c78 VARCHAR(255), c79 VARCHAR(255), c80 VARCHAR(255), ++c81 VARCHAR(255), c82 VARCHAR(255), c83 VARCHAR(255), c84 VARCHAR(255), ++c85 VARCHAR(255), c86 VARCHAR(255), c87 VARCHAR(255), c88 VARCHAR(255), ++c89 VARCHAR(255), c90 VARCHAR(255), c91 VARCHAR(255), c92 VARCHAR(255), ++c93 VARCHAR(255), c94 VARCHAR(255), c95 VARCHAR(255), c96 VARCHAR(255), ++c97 VARCHAR(255), c98 VARCHAR(255), c99 VARCHAR(255), c100 VARCHAR(255), ++c101 VARCHAR(255), c102 VARCHAR(255), c103 VARCHAR(255), c104 VARCHAR(255), ++c105 VARCHAR(255), c106 VARCHAR(255), c107 VARCHAR(255), c108 VARCHAR(255), ++c109 VARCHAR(255), c110 VARCHAR(255), c111 VARCHAR(255), c112 VARCHAR(255), ++c113 VARCHAR(255), c114 VARCHAR(255), c115 VARCHAR(255), c116 VARCHAR(255), ++c117 VARCHAR(255), c118 VARCHAR(255), c119 VARCHAR(255), c120 VARCHAR(255), ++c121 VARCHAR(255), c122 VARCHAR(255), c123 VARCHAR(255), c124 VARCHAR(255), ++c125 VARCHAR(255), c126 VARCHAR(255), c127 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255), ++c65 VARCHAR(255), c66 VARCHAR(255), c67 VARCHAR(255), c68 VARCHAR(255), ++c69 VARCHAR(255), c70 VARCHAR(255), c71 VARCHAR(255), c72 VARCHAR(255), ++c73 VARCHAR(255), c74 VARCHAR(255), c75 VARCHAR(255), c76 VARCHAR(255), ++c77 VARCHAR(255), c78 VARCHAR(255), c79 VARCHAR(255), c80 VARCHAR(255), ++c81 VARCHAR(255), c82 VARCHAR(255), c83 VARCHAR(255), c84 VARCHAR(255), ++c85 VARCHAR(255), c86 VARCHAR(255), c87 VARCHAR(255), c88 VARCHAR(255), ++c89 VARCHAR(255), c90 VARCHAR(255), c91 VARCHAR(255), c92 VARCHAR(255), ++c93 VARCHAR(255), c94 VARCHAR(255), c95 VARCHAR(255), c96 VARCHAR(255), ++c97 VARCHAR(255), c98 VARCHAR(255), c99 VARCHAR(255), c100 VARCHAR(255), ++c101 VARCHAR(255), c102 VARCHAR(255), c103 VARCHAR(255), c104 VARCHAR(255), ++c105 VARCHAR(255), c106 VARCHAR(255), c107 VARCHAR(255), c108 VARCHAR(255), ++c109 VARCHAR(255), c110 VARCHAR(255), c111 VARCHAR(255), c112 VARCHAR(255), ++c113 VARCHAR(255), c114 VARCHAR(255), c115 VARCHAR(255), c116 VARCHAR(255), ++c117 VARCHAR(255), c118 VARCHAR(255), c119 VARCHAR(255), c120 VARCHAR(255), ++c121 VARCHAR(255), c122 VARCHAR(255), c123 VARCHAR(255), c124 VARCHAR(255), ++c125 VARCHAR(255), c126 VARCHAR(255), c127 VARCHAR(255), c128 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) +-) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788) ++) ENGINE=INNODB; ++ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++CREATE TABLE t1 ( ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,dynamic,innodb.rdiff new file mode 100644 index 00000000..2cbf4cd9 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,64k,dynamic,innodb.rdiff @@ -0,0 +1,501 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:48:32.453208310 +0300 +@@ -3,45 +3,486 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255), ++c65 CHAR(255), c66 CHAR(255), c67 CHAR(255), c68 CHAR(255), ++c69 CHAR(255), c70 CHAR(255), c71 CHAR(255), c72 CHAR(255), ++c73 CHAR(255), c74 CHAR(255), c75 CHAR(255), c76 CHAR(255), ++c77 CHAR(255), c78 CHAR(255), c79 CHAR(255), c80 CHAR(255), ++c81 CHAR(255), c82 CHAR(255), c83 CHAR(255), c84 CHAR(255), ++c85 CHAR(255), c86 CHAR(255), c87 CHAR(255), c88 CHAR(255), ++c89 CHAR(255), c90 CHAR(255), c91 CHAR(255), c92 CHAR(255), ++c93 CHAR(255), c94 CHAR(255), c95 CHAR(255), c96 CHAR(255), ++c97 CHAR(255), c98 CHAR(255), c99 CHAR(255), c100 CHAR(255), ++c101 CHAR(255), c102 CHAR(255), c103 CHAR(255), c104 CHAR(255), ++c105 CHAR(255), c106 CHAR(255), c107 CHAR(255), c108 CHAR(255), ++c109 CHAR(255), c110 CHAR(255), c111 CHAR(255), c112 CHAR(255), ++c113 CHAR(255), c114 CHAR(255), c115 CHAR(255), c116 CHAR(255), ++c117 CHAR(255), c118 CHAR(255), c119 CHAR(255), c120 CHAR(255), ++c121 CHAR(255), c122 CHAR(255), c123 CHAR(255), c124 CHAR(255), ++c125 CHAR(255), c126 CHAR(255), c127 CHAR(255), c128 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255), ++c65 CHAR(255), c66 CHAR(255), c67 CHAR(255), c68 CHAR(255), ++c69 CHAR(255), c70 CHAR(255), c71 CHAR(255), c72 CHAR(255), ++c73 CHAR(255), c74 CHAR(255), c75 CHAR(255), c76 CHAR(255), ++c77 CHAR(255), c78 CHAR(255), c79 CHAR(255), c80 CHAR(255), ++c81 CHAR(255), c82 CHAR(255), c83 CHAR(255), c84 CHAR(255), ++c85 CHAR(255), c86 CHAR(255), c87 CHAR(255), c88 CHAR(255), ++c89 CHAR(255), c90 CHAR(255), c91 CHAR(255), c92 CHAR(255), ++c93 CHAR(255), c94 CHAR(255), c95 CHAR(255), c96 CHAR(255), ++c97 CHAR(255), c98 CHAR(255), c99 CHAR(255), c100 CHAR(255), ++c101 CHAR(255), c102 CHAR(255), c103 CHAR(255), c104 CHAR(255), ++c105 CHAR(255), c106 CHAR(255), c107 CHAR(255), c108 CHAR(255), ++c109 CHAR(255), c110 CHAR(255), c111 CHAR(255), c112 CHAR(255), ++c113 CHAR(255), c114 CHAR(255), c115 CHAR(255), c116 CHAR(255), ++c117 CHAR(255), c118 CHAR(255), c119 CHAR(255), c120 CHAR(255), ++c121 CHAR(255), c122 CHAR(255), c123 CHAR(255), c124 CHAR(255), ++c125 CHAR(255), c126 CHAR(255), c127 CHAR(255), c128 CHAR(255), ++c129 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255), ++c65 VARCHAR(255), c66 VARCHAR(255), c67 VARCHAR(255), c68 VARCHAR(255), ++c69 VARCHAR(255), c70 VARCHAR(255), c71 VARCHAR(255), c72 VARCHAR(255), ++c73 VARCHAR(255), c74 VARCHAR(255), c75 VARCHAR(255), c76 VARCHAR(255), ++c77 VARCHAR(255), c78 VARCHAR(255), c79 VARCHAR(255), c80 VARCHAR(255), ++c81 VARCHAR(255), c82 VARCHAR(255), c83 VARCHAR(255), c84 VARCHAR(255), ++c85 VARCHAR(255), c86 VARCHAR(255), c87 VARCHAR(255), c88 VARCHAR(255), ++c89 VARCHAR(255), c90 VARCHAR(255), c91 VARCHAR(255), c92 VARCHAR(255), ++c93 VARCHAR(255), c94 VARCHAR(255), c95 VARCHAR(255), c96 VARCHAR(255), ++c97 VARCHAR(255), c98 VARCHAR(255), c99 VARCHAR(255), c100 VARCHAR(255), ++c101 VARCHAR(255), c102 VARCHAR(255), c103 VARCHAR(255), c104 VARCHAR(255), ++c105 VARCHAR(255), c106 VARCHAR(255), c107 VARCHAR(255), c108 VARCHAR(255), ++c109 VARCHAR(255), c110 VARCHAR(255), c111 VARCHAR(255), c112 VARCHAR(255), ++c113 VARCHAR(255), c114 VARCHAR(255), c115 VARCHAR(255), c116 VARCHAR(255), ++c117 VARCHAR(255), c118 VARCHAR(255), c119 VARCHAR(255), c120 VARCHAR(255), ++c121 VARCHAR(255), c122 VARCHAR(255), c123 VARCHAR(255), c124 VARCHAR(255), ++c125 VARCHAR(255), c126 VARCHAR(255), c127 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255), ++c65 VARCHAR(255), c66 VARCHAR(255), c67 VARCHAR(255), c68 VARCHAR(255), ++c69 VARCHAR(255), c70 VARCHAR(255), c71 VARCHAR(255), c72 VARCHAR(255), ++c73 VARCHAR(255), c74 VARCHAR(255), c75 VARCHAR(255), c76 VARCHAR(255), ++c77 VARCHAR(255), c78 VARCHAR(255), c79 VARCHAR(255), c80 VARCHAR(255), ++c81 VARCHAR(255), c82 VARCHAR(255), c83 VARCHAR(255), c84 VARCHAR(255), ++c85 VARCHAR(255), c86 VARCHAR(255), c87 VARCHAR(255), c88 VARCHAR(255), ++c89 VARCHAR(255), c90 VARCHAR(255), c91 VARCHAR(255), c92 VARCHAR(255), ++c93 VARCHAR(255), c94 VARCHAR(255), c95 VARCHAR(255), c96 VARCHAR(255), ++c97 VARCHAR(255), c98 VARCHAR(255), c99 VARCHAR(255), c100 VARCHAR(255), ++c101 VARCHAR(255), c102 VARCHAR(255), c103 VARCHAR(255), c104 VARCHAR(255), ++c105 VARCHAR(255), c106 VARCHAR(255), c107 VARCHAR(255), c108 VARCHAR(255), ++c109 VARCHAR(255), c110 VARCHAR(255), c111 VARCHAR(255), c112 VARCHAR(255), ++c113 VARCHAR(255), c114 VARCHAR(255), c115 VARCHAR(255), c116 VARCHAR(255), ++c117 VARCHAR(255), c118 VARCHAR(255), c119 VARCHAR(255), c120 VARCHAR(255), ++c121 VARCHAR(255), c122 VARCHAR(255), c123 VARCHAR(255), c124 VARCHAR(255), ++c125 VARCHAR(255), c126 VARCHAR(255), c127 VARCHAR(255), c128 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788), c83 VARCHAR(788) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT, ++c190 TEXT, c191 TEXT, c192 TEXT, c193 TEXT, c194 TEXT, c195 TEXT, c196 TEXT, ++c197 TEXT, c198 TEXT, c199 TEXT, c200 TEXT, c201 TEXT, c202 TEXT, c203 TEXT, ++c204 TEXT, c205 TEXT, c206 TEXT, c207 TEXT, c208 TEXT, c209 TEXT, c210 TEXT, ++c211 TEXT, c212 TEXT, c213 TEXT, c214 TEXT, c215 TEXT, c216 TEXT, c217 TEXT, ++c218 TEXT, c219 TEXT, c220 TEXT, c221 TEXT, c222 TEXT, c223 TEXT, c224 TEXT, ++c225 TEXT, c226 TEXT, c227 TEXT, c228 TEXT, c229 TEXT, c230 TEXT, c231 TEXT, ++c232 TEXT, c233 TEXT, c234 TEXT, c235 TEXT, c236 TEXT, c237 TEXT, c238 TEXT, ++c239 TEXT, c240 TEXT, c241 TEXT, c242 TEXT, c243 TEXT, c244 TEXT, c245 TEXT, ++c246 TEXT, c247 TEXT, c248 TEXT, c249 TEXT, c250 TEXT, c251 TEXT, c252 TEXT, ++c253 TEXT, c254 TEXT, c255 TEXT, c256 TEXT, c257 TEXT, c258 TEXT, c259 TEXT, ++c260 TEXT, c261 TEXT, c262 TEXT, c263 TEXT, c264 TEXT, c265 TEXT, c266 TEXT, ++c267 TEXT, c268 TEXT, c269 TEXT, c270 TEXT, c271 TEXT, c272 TEXT, c273 TEXT, ++c274 TEXT, c275 TEXT, c276 TEXT, c277 TEXT, c278 TEXT, c279 TEXT, c280 TEXT, ++c281 TEXT, c282 TEXT, c283 TEXT, c284 TEXT, c285 TEXT, c286 TEXT, c287 TEXT, ++c288 TEXT, c289 TEXT, c290 TEXT, c291 TEXT, c292 TEXT, c293 TEXT, c294 TEXT, ++c295 TEXT, c296 TEXT, c297 TEXT, c298 TEXT, c299 TEXT, c300 TEXT, c301 TEXT, ++c302 TEXT, c303 TEXT, c304 TEXT, c305 TEXT, c306 TEXT, c307 TEXT, c308 TEXT, ++c309 TEXT, c310 TEXT, c311 TEXT, c312 TEXT, c313 TEXT, c314 TEXT, c315 TEXT, ++c316 TEXT, c317 TEXT, c318 TEXT, c319 TEXT, c320 TEXT, c321 TEXT, c322 TEXT, ++c323 TEXT, c324 TEXT, c325 TEXT, c326 TEXT, c327 TEXT, c328 TEXT, c329 TEXT, ++c330 TEXT, c331 TEXT, c332 TEXT, c333 TEXT, c334 TEXT, c335 TEXT, c336 TEXT, ++c337 TEXT, c338 TEXT, c339 TEXT, c340 TEXT, c341 TEXT, c342 TEXT, c343 TEXT, ++c344 TEXT, c345 TEXT, c346 TEXT, c347 TEXT, c348 TEXT, c349 TEXT, c350 TEXT, ++c351 TEXT, c352 TEXT, c353 TEXT, c354 TEXT, c355 TEXT, c356 TEXT, c357 TEXT, ++c358 TEXT, c359 TEXT, c360 TEXT, c361 TEXT, c362 TEXT, c363 TEXT, c364 TEXT, ++c365 TEXT, c366 TEXT, c367 TEXT, c368 TEXT, c369 TEXT, c370 TEXT, c371 TEXT, ++c372 TEXT, c373 TEXT, c374 TEXT, c375 TEXT, c376 TEXT, c377 TEXT, c378 TEXT, ++c379 TEXT, c380 TEXT, c381 TEXT, c382 TEXT, c383 TEXT, c384 TEXT, c385 TEXT, ++c386 TEXT, c387 TEXT, c388 TEXT, c389 TEXT, c390 TEXT, c391 TEXT, c392 TEXT, ++c393 TEXT, c394 TEXT, c395 TEXT, c396 TEXT, c397 TEXT, c398 TEXT, c399 TEXT, ++c400 TEXT, c401 TEXT, c402 TEXT, c403 TEXT, c404 TEXT, c405 TEXT, c406 TEXT, ++c407 TEXT, c408 TEXT, c409 TEXT, c410 TEXT, c411 TEXT, c412 TEXT, c413 TEXT, ++c414 TEXT, c415 TEXT, c416 TEXT, c417 TEXT, c418 TEXT, c419 TEXT, c420 TEXT, ++c421 TEXT, c422 TEXT, c423 TEXT, c424 TEXT, c425 TEXT, c426 TEXT, c427 TEXT, ++c428 TEXT, c429 TEXT, c430 TEXT, c431 TEXT, c432 TEXT, c433 TEXT, c434 TEXT, ++c435 TEXT, c436 TEXT, c437 TEXT, c438 TEXT, c439 TEXT, c440 TEXT, c441 TEXT, ++c442 TEXT, c443 TEXT, c444 TEXT, c445 TEXT, c446 TEXT, c447 TEXT, c448 TEXT, ++c449 TEXT, c450 TEXT, c451 TEXT, c452 TEXT, c453 TEXT, c454 TEXT, c455 TEXT, ++c456 TEXT, c457 TEXT, c458 TEXT, c459 TEXT, c460 TEXT, c461 TEXT, c462 TEXT, ++c463 TEXT, c464 TEXT, c465 TEXT, c466 TEXT, c467 TEXT, c468 TEXT, c469 TEXT, ++c470 TEXT, c471 TEXT, c472 TEXT, c473 TEXT, c474 TEXT, c475 TEXT, c476 TEXT, ++c477 TEXT, c478 TEXT, c479 TEXT, c480 TEXT, c481 TEXT, c482 TEXT, c483 TEXT, ++c484 TEXT, c485 TEXT, c486 TEXT, c487 TEXT, c488 TEXT, c489 TEXT, c490 TEXT, ++c491 TEXT, c492 TEXT, c493 TEXT, c494 TEXT, c495 TEXT, c496 TEXT, c497 TEXT, ++c498 TEXT, c499 TEXT, c500 TEXT, c501 TEXT, c502 TEXT, c503 TEXT, c504 TEXT, ++c505 TEXT, c506 TEXT, c507 TEXT, c508 TEXT, c509 TEXT, c510 TEXT, c511 TEXT, ++c512 TEXT, c513 TEXT, c514 TEXT, c515 TEXT, c516 TEXT, c517 TEXT, c518 TEXT, ++c519 TEXT, c520 TEXT, c521 TEXT, c522 TEXT, c523 TEXT, c524 TEXT, c525 TEXT, ++c526 TEXT, c527 TEXT, c528 TEXT, c529 TEXT, c530 TEXT, c531 TEXT, c532 TEXT, ++c533 TEXT, c534 TEXT, c535 TEXT, c536 TEXT, c537 TEXT, c538 TEXT, c539 TEXT, ++c540 TEXT, c541 TEXT, c542 TEXT, c543 TEXT, c544 TEXT, c545 TEXT, c546 TEXT, ++c547 TEXT, c548 TEXT, c549 TEXT, c550 TEXT, c551 TEXT, c552 TEXT, c553 TEXT, ++c554 TEXT, c555 TEXT, c556 TEXT, c557 TEXT, c558 TEXT, c559 TEXT, c560 TEXT, ++c561 TEXT, c562 TEXT, c563 TEXT, c564 TEXT, c565 TEXT, c566 TEXT, c567 TEXT, ++c568 TEXT, c569 TEXT, c570 TEXT, c571 TEXT, c572 TEXT, c573 TEXT, c574 TEXT, ++c575 TEXT, c576 TEXT, c577 TEXT, c578 TEXT, c579 TEXT, c580 TEXT, c581 TEXT, ++c582 TEXT, c583 TEXT, c584 TEXT, c585 TEXT, c586 TEXT, c587 TEXT, c588 TEXT, ++c589 TEXT, c590 TEXT, c591 TEXT, c592 TEXT, c593 TEXT, c594 TEXT, c595 TEXT, ++c596 TEXT, c597 TEXT, c598 TEXT, c599 TEXT, c600 TEXT, c601 TEXT, c602 TEXT, ++c603 TEXT, c604 TEXT, c605 TEXT, c606 TEXT, c607 TEXT, c608 TEXT, c609 TEXT, ++c610 TEXT, c611 TEXT, c612 TEXT, c613 TEXT, c614 TEXT, c615 TEXT, c616 TEXT, ++c617 TEXT, c618 TEXT, c619 TEXT, c620 TEXT, c621 TEXT, c622 TEXT, c623 TEXT, ++c624 TEXT, c625 TEXT, c626 TEXT, c627 TEXT, c628 TEXT, c629 TEXT, c630 TEXT, ++c631 TEXT, c632 TEXT, c633 TEXT, c634 TEXT, c635 TEXT, c636 TEXT, c637 TEXT, ++c638 TEXT, c639 TEXT, c640 TEXT, c641 TEXT, c642 TEXT, c643 TEXT, c644 TEXT, ++c645 TEXT, c646 TEXT, c647 TEXT, c648 TEXT, c649 TEXT, c650 TEXT, c651 TEXT, ++c652 TEXT, c653 TEXT, c654 TEXT, c655 TEXT, c656 TEXT, c657 TEXT, c658 TEXT, ++c659 TEXT, c660 TEXT, c661 TEXT, c662 TEXT, c663 TEXT, c664 TEXT, c665 TEXT, ++c666 TEXT, c667 TEXT, c668 TEXT, c669 TEXT, c670 TEXT, c671 TEXT, c672 TEXT, ++c673 TEXT, c674 TEXT, c675 TEXT, c676 TEXT, c677 TEXT, c678 TEXT, c679 TEXT, ++c680 TEXT, c681 TEXT, c682 TEXT, c683 TEXT, c684 TEXT, c685 TEXT, c686 TEXT, ++c687 TEXT, c688 TEXT, c689 TEXT, c690 TEXT, c691 TEXT, c692 TEXT, c693 TEXT, ++c694 TEXT, c695 TEXT, c696 TEXT, c697 TEXT, c698 TEXT, c699 TEXT, c700 TEXT, ++c701 TEXT, c702 TEXT, c703 TEXT, c704 TEXT, c705 TEXT, c706 TEXT, c707 TEXT, ++c708 TEXT, c709 TEXT, c710 TEXT, c711 TEXT, c712 TEXT, c713 TEXT, c714 TEXT, ++c715 TEXT, c716 TEXT, c717 TEXT, c718 TEXT, c719 TEXT, c720 TEXT, c721 TEXT, ++c722 TEXT, c723 TEXT, c724 TEXT, c725 TEXT, c726 TEXT, c727 TEXT, c728 TEXT, ++c729 TEXT, c730 TEXT, c731 TEXT, c732 TEXT, c733 TEXT, c734 TEXT, c735 TEXT, ++c736 TEXT, c737 TEXT, c738 TEXT, c739 TEXT, c740 TEXT, c741 TEXT, c742 TEXT, ++c743 TEXT, c744 TEXT, c745 TEXT, c746 TEXT, c747 TEXT, c748 TEXT, c749 TEXT, ++c750 TEXT, c751 TEXT, c752 TEXT, c753 TEXT, c754 TEXT, c755 TEXT, c756 TEXT, ++c757 TEXT, c758 TEXT, c759 TEXT, c760 TEXT, c761 TEXT, c762 TEXT, c763 TEXT, ++c764 TEXT, c765 TEXT, c766 TEXT, c767 TEXT, c768 TEXT, c769 TEXT, c770 TEXT, ++c771 TEXT, c772 TEXT, c773 TEXT, c774 TEXT, c775 TEXT, c776 TEXT, c777 TEXT, ++c778 TEXT, c779 TEXT, c780 TEXT, c781 TEXT, c782 TEXT, c783 TEXT, c784 TEXT, ++c785 TEXT, c786 TEXT, c787 TEXT, c788 TEXT, c789 TEXT, c790 TEXT, c791 TEXT, ++c792 TEXT, c793 TEXT, c794 TEXT, c795 TEXT, c796 TEXT, c797 TEXT, c798 TEXT, ++c799 TEXT, c800 TEXT, c801 TEXT, c802 TEXT, c803 TEXT, c804 TEXT, c805 TEXT, ++c806 TEXT, c807 TEXT, c808 TEXT, c809 TEXT, c810 TEXT, c811 TEXT, c812 TEXT, ++c813 TEXT, c814 TEXT, c815 TEXT, c816 TEXT, c817 TEXT, c818 TEXT, c819 TEXT, ++c820 TEXT, c821 TEXT, c822 TEXT, c823 TEXT, c824 TEXT, c825 TEXT, c826 TEXT, ++c827 TEXT, c828 TEXT, c829 TEXT, c830 TEXT, c831 TEXT, c832 TEXT, c833 TEXT, ++c834 TEXT, c835 TEXT, c836 TEXT, c837 TEXT, c838 TEXT, c839 TEXT, c840 TEXT, ++c841 TEXT, c842 TEXT, c843 TEXT, c844 TEXT, c845 TEXT, c846 TEXT, c847 TEXT, ++c848 TEXT, c849 TEXT, c850 TEXT, c851 TEXT, c852 TEXT, c853 TEXT, c854 TEXT, ++c855 TEXT, c856 TEXT, c857 TEXT, c858 TEXT, c859 TEXT, c860 TEXT, c861 TEXT, ++c862 TEXT, c863 TEXT, c864 TEXT, c865 TEXT, c866 TEXT, c867 TEXT, c868 TEXT, ++c869 TEXT, c870 TEXT, c871 TEXT, c872 TEXT, c873 TEXT, c874 TEXT, c875 TEXT, ++c876 TEXT, c877 TEXT, c878 TEXT, c879 TEXT, c880 TEXT, c881 TEXT, c882 TEXT, ++c883 TEXT, c884 TEXT, c885 TEXT, c886 TEXT, c887 TEXT, c888 TEXT, c889 TEXT, ++c890 TEXT, c891 TEXT, c892 TEXT, c893 TEXT, c894 TEXT, c895 TEXT, c896 TEXT, ++c897 TEXT, c898 TEXT, c899 TEXT, c900 TEXT, c901 TEXT, c902 TEXT, c903 TEXT, ++c904 TEXT, c905 TEXT, c906 TEXT, c907 TEXT, c908 TEXT, c909 TEXT, c910 TEXT, ++c911 TEXT, c912 TEXT, c913 TEXT, c914 TEXT, c915 TEXT, c916 TEXT, c917 TEXT, ++c918 TEXT, c919 TEXT, c920 TEXT, c921 TEXT, c922 TEXT, c923 TEXT, c924 TEXT, ++c925 TEXT, c926 TEXT, c927 TEXT, c928 TEXT, c929 TEXT, c930 TEXT, c931 TEXT, ++c932 TEXT, c933 TEXT, c934 TEXT, c935 TEXT, c936 TEXT, c937 TEXT, c938 TEXT, ++c939 TEXT, c940 TEXT, c941 TEXT, c942 TEXT, c943 TEXT, c944 TEXT, c945 TEXT, ++c946 TEXT, c947 TEXT, c948 TEXT, c949 TEXT, c950 TEXT, c951 TEXT, c952 TEXT, ++c953 TEXT, c954 TEXT, c955 TEXT, c956 TEXT, c957 TEXT, c958 TEXT, c959 TEXT, ++c960 TEXT, c961 TEXT, c962 TEXT, c963 TEXT, c964 TEXT, c965 TEXT, c966 TEXT, ++c967 TEXT, c968 TEXT, c969 TEXT, c970 TEXT, c971 TEXT, c972 TEXT, c973 TEXT, ++c974 TEXT, c975 TEXT, c976 TEXT, c977 TEXT, c978 TEXT, c979 TEXT, c980 TEXT, ++c981 TEXT, c982 TEXT, c983 TEXT, c984 TEXT, c985 TEXT, c986 TEXT, c987 TEXT, ++c988 TEXT, c989 TEXT, c990 TEXT, c991 TEXT, c992 TEXT, c993 TEXT, c994 TEXT, ++c995 TEXT, c996 TEXT, c997 TEXT, c998 TEXT, c999 TEXT, c1000 TEXT, c1001 TEXT, ++c1002 TEXT, c1003 TEXT, c1004 TEXT, c1005 TEXT, c1006 TEXT, c1007 TEXT, c1008 TEXT, ++c1009 TEXT, c1010 TEXT, c1011 TEXT, c1012 TEXT, c1013 TEXT, c1014 TEXT, c1015 TEXT, ++c1016 TEXT, c1017 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT, ++c190 TEXT, c191 TEXT, c192 TEXT, c193 TEXT, c194 TEXT, c195 TEXT, c196 TEXT, ++c197 TEXT, c198 TEXT, c199 TEXT, c200 TEXT, c201 TEXT, c202 TEXT, c203 TEXT, ++c204 TEXT, c205 TEXT, c206 TEXT, c207 TEXT, c208 TEXT, c209 TEXT, c210 TEXT, ++c211 TEXT, c212 TEXT, c213 TEXT, c214 TEXT, c215 TEXT, c216 TEXT, c217 TEXT, ++c218 TEXT, c219 TEXT, c220 TEXT, c221 TEXT, c222 TEXT, c223 TEXT, c224 TEXT, ++c225 TEXT, c226 TEXT, c227 TEXT, c228 TEXT, c229 TEXT, c230 TEXT, c231 TEXT, ++c232 TEXT, c233 TEXT, c234 TEXT, c235 TEXT, c236 TEXT, c237 TEXT, c238 TEXT, ++c239 TEXT, c240 TEXT, c241 TEXT, c242 TEXT, c243 TEXT, c244 TEXT, c245 TEXT, ++c246 TEXT, c247 TEXT, c248 TEXT, c249 TEXT, c250 TEXT, c251 TEXT, c252 TEXT, ++c253 TEXT, c254 TEXT, c255 TEXT, c256 TEXT, c257 TEXT, c258 TEXT, c259 TEXT, ++c260 TEXT, c261 TEXT, c262 TEXT, c263 TEXT, c264 TEXT, c265 TEXT, c266 TEXT, ++c267 TEXT, c268 TEXT, c269 TEXT, c270 TEXT, c271 TEXT, c272 TEXT, c273 TEXT, ++c274 TEXT, c275 TEXT, c276 TEXT, c277 TEXT, c278 TEXT, c279 TEXT, c280 TEXT, ++c281 TEXT, c282 TEXT, c283 TEXT, c284 TEXT, c285 TEXT, c286 TEXT, c287 TEXT, ++c288 TEXT, c289 TEXT, c290 TEXT, c291 TEXT, c292 TEXT, c293 TEXT, c294 TEXT, ++c295 TEXT, c296 TEXT, c297 TEXT, c298 TEXT, c299 TEXT, c300 TEXT, c301 TEXT, ++c302 TEXT, c303 TEXT, c304 TEXT, c305 TEXT, c306 TEXT, c307 TEXT, c308 TEXT, ++c309 TEXT, c310 TEXT, c311 TEXT, c312 TEXT, c313 TEXT, c314 TEXT, c315 TEXT, ++c316 TEXT, c317 TEXT, c318 TEXT, c319 TEXT, c320 TEXT, c321 TEXT, c322 TEXT, ++c323 TEXT, c324 TEXT, c325 TEXT, c326 TEXT, c327 TEXT, c328 TEXT, c329 TEXT, ++c330 TEXT, c331 TEXT, c332 TEXT, c333 TEXT, c334 TEXT, c335 TEXT, c336 TEXT, ++c337 TEXT, c338 TEXT, c339 TEXT, c340 TEXT, c341 TEXT, c342 TEXT, c343 TEXT, ++c344 TEXT, c345 TEXT, c346 TEXT, c347 TEXT, c348 TEXT, c349 TEXT, c350 TEXT, ++c351 TEXT, c352 TEXT, c353 TEXT, c354 TEXT, c355 TEXT, c356 TEXT, c357 TEXT, ++c358 TEXT, c359 TEXT, c360 TEXT, c361 TEXT, c362 TEXT, c363 TEXT, c364 TEXT, ++c365 TEXT, c366 TEXT, c367 TEXT, c368 TEXT, c369 TEXT, c370 TEXT, c371 TEXT, ++c372 TEXT, c373 TEXT, c374 TEXT, c375 TEXT, c376 TEXT, c377 TEXT, c378 TEXT, ++c379 TEXT, c380 TEXT, c381 TEXT, c382 TEXT, c383 TEXT, c384 TEXT, c385 TEXT, ++c386 TEXT, c387 TEXT, c388 TEXT, c389 TEXT, c390 TEXT, c391 TEXT, c392 TEXT, ++c393 TEXT, c394 TEXT, c395 TEXT, c396 TEXT, c397 TEXT, c398 TEXT, c399 TEXT, ++c400 TEXT, c401 TEXT, c402 TEXT, c403 TEXT, c404 TEXT, c405 TEXT, c406 TEXT, ++c407 TEXT, c408 TEXT, c409 TEXT, c410 TEXT, c411 TEXT, c412 TEXT, c413 TEXT, ++c414 TEXT, c415 TEXT, c416 TEXT, c417 TEXT, c418 TEXT, c419 TEXT, c420 TEXT, ++c421 TEXT, c422 TEXT, c423 TEXT, c424 TEXT, c425 TEXT, c426 TEXT, c427 TEXT, ++c428 TEXT, c429 TEXT, c430 TEXT, c431 TEXT, c432 TEXT, c433 TEXT, c434 TEXT, ++c435 TEXT, c436 TEXT, c437 TEXT, c438 TEXT, c439 TEXT, c440 TEXT, c441 TEXT, ++c442 TEXT, c443 TEXT, c444 TEXT, c445 TEXT, c446 TEXT, c447 TEXT, c448 TEXT, ++c449 TEXT, c450 TEXT, c451 TEXT, c452 TEXT, c453 TEXT, c454 TEXT, c455 TEXT, ++c456 TEXT, c457 TEXT, c458 TEXT, c459 TEXT, c460 TEXT, c461 TEXT, c462 TEXT, ++c463 TEXT, c464 TEXT, c465 TEXT, c466 TEXT, c467 TEXT, c468 TEXT, c469 TEXT, ++c470 TEXT, c471 TEXT, c472 TEXT, c473 TEXT, c474 TEXT, c475 TEXT, c476 TEXT, ++c477 TEXT, c478 TEXT, c479 TEXT, c480 TEXT, c481 TEXT, c482 TEXT, c483 TEXT, ++c484 TEXT, c485 TEXT, c486 TEXT, c487 TEXT, c488 TEXT, c489 TEXT, c490 TEXT, ++c491 TEXT, c492 TEXT, c493 TEXT, c494 TEXT, c495 TEXT, c496 TEXT, c497 TEXT, ++c498 TEXT, c499 TEXT, c500 TEXT, c501 TEXT, c502 TEXT, c503 TEXT, c504 TEXT, ++c505 TEXT, c506 TEXT, c507 TEXT, c508 TEXT, c509 TEXT, c510 TEXT, c511 TEXT, ++c512 TEXT, c513 TEXT, c514 TEXT, c515 TEXT, c516 TEXT, c517 TEXT, c518 TEXT, ++c519 TEXT, c520 TEXT, c521 TEXT, c522 TEXT, c523 TEXT, c524 TEXT, c525 TEXT, ++c526 TEXT, c527 TEXT, c528 TEXT, c529 TEXT, c530 TEXT, c531 TEXT, c532 TEXT, ++c533 TEXT, c534 TEXT, c535 TEXT, c536 TEXT, c537 TEXT, c538 TEXT, c539 TEXT, ++c540 TEXT, c541 TEXT, c542 TEXT, c543 TEXT, c544 TEXT, c545 TEXT, c546 TEXT, ++c547 TEXT, c548 TEXT, c549 TEXT, c550 TEXT, c551 TEXT, c552 TEXT, c553 TEXT, ++c554 TEXT, c555 TEXT, c556 TEXT, c557 TEXT, c558 TEXT, c559 TEXT, c560 TEXT, ++c561 TEXT, c562 TEXT, c563 TEXT, c564 TEXT, c565 TEXT, c566 TEXT, c567 TEXT, ++c568 TEXT, c569 TEXT, c570 TEXT, c571 TEXT, c572 TEXT, c573 TEXT, c574 TEXT, ++c575 TEXT, c576 TEXT, c577 TEXT, c578 TEXT, c579 TEXT, c580 TEXT, c581 TEXT, ++c582 TEXT, c583 TEXT, c584 TEXT, c585 TEXT, c586 TEXT, c587 TEXT, c588 TEXT, ++c589 TEXT, c590 TEXT, c591 TEXT, c592 TEXT, c593 TEXT, c594 TEXT, c595 TEXT, ++c596 TEXT, c597 TEXT, c598 TEXT, c599 TEXT, c600 TEXT, c601 TEXT, c602 TEXT, ++c603 TEXT, c604 TEXT, c605 TEXT, c606 TEXT, c607 TEXT, c608 TEXT, c609 TEXT, ++c610 TEXT, c611 TEXT, c612 TEXT, c613 TEXT, c614 TEXT, c615 TEXT, c616 TEXT, ++c617 TEXT, c618 TEXT, c619 TEXT, c620 TEXT, c621 TEXT, c622 TEXT, c623 TEXT, ++c624 TEXT, c625 TEXT, c626 TEXT, c627 TEXT, c628 TEXT, c629 TEXT, c630 TEXT, ++c631 TEXT, c632 TEXT, c633 TEXT, c634 TEXT, c635 TEXT, c636 TEXT, c637 TEXT, ++c638 TEXT, c639 TEXT, c640 TEXT, c641 TEXT, c642 TEXT, c643 TEXT, c644 TEXT, ++c645 TEXT, c646 TEXT, c647 TEXT, c648 TEXT, c649 TEXT, c650 TEXT, c651 TEXT, ++c652 TEXT, c653 TEXT, c654 TEXT, c655 TEXT, c656 TEXT, c657 TEXT, c658 TEXT, ++c659 TEXT, c660 TEXT, c661 TEXT, c662 TEXT, c663 TEXT, c664 TEXT, c665 TEXT, ++c666 TEXT, c667 TEXT, c668 TEXT, c669 TEXT, c670 TEXT, c671 TEXT, c672 TEXT, ++c673 TEXT, c674 TEXT, c675 TEXT, c676 TEXT, c677 TEXT, c678 TEXT, c679 TEXT, ++c680 TEXT, c681 TEXT, c682 TEXT, c683 TEXT, c684 TEXT, c685 TEXT, c686 TEXT, ++c687 TEXT, c688 TEXT, c689 TEXT, c690 TEXT, c691 TEXT, c692 TEXT, c693 TEXT, ++c694 TEXT, c695 TEXT, c696 TEXT, c697 TEXT, c698 TEXT, c699 TEXT, c700 TEXT, ++c701 TEXT, c702 TEXT, c703 TEXT, c704 TEXT, c705 TEXT, c706 TEXT, c707 TEXT, ++c708 TEXT, c709 TEXT, c710 TEXT, c711 TEXT, c712 TEXT, c713 TEXT, c714 TEXT, ++c715 TEXT, c716 TEXT, c717 TEXT, c718 TEXT, c719 TEXT, c720 TEXT, c721 TEXT, ++c722 TEXT, c723 TEXT, c724 TEXT, c725 TEXT, c726 TEXT, c727 TEXT, c728 TEXT, ++c729 TEXT, c730 TEXT, c731 TEXT, c732 TEXT, c733 TEXT, c734 TEXT, c735 TEXT, ++c736 TEXT, c737 TEXT, c738 TEXT, c739 TEXT, c740 TEXT, c741 TEXT, c742 TEXT, ++c743 TEXT, c744 TEXT, c745 TEXT, c746 TEXT, c747 TEXT, c748 TEXT, c749 TEXT, ++c750 TEXT, c751 TEXT, c752 TEXT, c753 TEXT, c754 TEXT, c755 TEXT, c756 TEXT, ++c757 TEXT, c758 TEXT, c759 TEXT, c760 TEXT, c761 TEXT, c762 TEXT, c763 TEXT, ++c764 TEXT, c765 TEXT, c766 TEXT, c767 TEXT, c768 TEXT, c769 TEXT, c770 TEXT, ++c771 TEXT, c772 TEXT, c773 TEXT, c774 TEXT, c775 TEXT, c776 TEXT, c777 TEXT, ++c778 TEXT, c779 TEXT, c780 TEXT, c781 TEXT, c782 TEXT, c783 TEXT, c784 TEXT, ++c785 TEXT, c786 TEXT, c787 TEXT, c788 TEXT, c789 TEXT, c790 TEXT, c791 TEXT, ++c792 TEXT, c793 TEXT, c794 TEXT, c795 TEXT, c796 TEXT, c797 TEXT, c798 TEXT, ++c799 TEXT, c800 TEXT, c801 TEXT, c802 TEXT, c803 TEXT, c804 TEXT, c805 TEXT, ++c806 TEXT, c807 TEXT, c808 TEXT, c809 TEXT, c810 TEXT, c811 TEXT, c812 TEXT, ++c813 TEXT, c814 TEXT, c815 TEXT, c816 TEXT, c817 TEXT, c818 TEXT, c819 TEXT, ++c820 TEXT, c821 TEXT, c822 TEXT, c823 TEXT, c824 TEXT, c825 TEXT, c826 TEXT, ++c827 TEXT, c828 TEXT, c829 TEXT, c830 TEXT, c831 TEXT, c832 TEXT, c833 TEXT, ++c834 TEXT, c835 TEXT, c836 TEXT, c837 TEXT, c838 TEXT, c839 TEXT, c840 TEXT, ++c841 TEXT, c842 TEXT, c843 TEXT, c844 TEXT, c845 TEXT, c846 TEXT, c847 TEXT, ++c848 TEXT, c849 TEXT, c850 TEXT, c851 TEXT, c852 TEXT, c853 TEXT, c854 TEXT, ++c855 TEXT, c856 TEXT, c857 TEXT, c858 TEXT, c859 TEXT, c860 TEXT, c861 TEXT, ++c862 TEXT, c863 TEXT, c864 TEXT, c865 TEXT, c866 TEXT, c867 TEXT, c868 TEXT, ++c869 TEXT, c870 TEXT, c871 TEXT, c872 TEXT, c873 TEXT, c874 TEXT, c875 TEXT, ++c876 TEXT, c877 TEXT, c878 TEXT, c879 TEXT, c880 TEXT, c881 TEXT, c882 TEXT, ++c883 TEXT, c884 TEXT, c885 TEXT, c886 TEXT, c887 TEXT, c888 TEXT, c889 TEXT, ++c890 TEXT, c891 TEXT, c892 TEXT, c893 TEXT, c894 TEXT, c895 TEXT, c896 TEXT, ++c897 TEXT, c898 TEXT, c899 TEXT, c900 TEXT, c901 TEXT, c902 TEXT, c903 TEXT, ++c904 TEXT, c905 TEXT, c906 TEXT, c907 TEXT, c908 TEXT, c909 TEXT, c910 TEXT, ++c911 TEXT, c912 TEXT, c913 TEXT, c914 TEXT, c915 TEXT, c916 TEXT, c917 TEXT, ++c918 TEXT, c919 TEXT, c920 TEXT, c921 TEXT, c922 TEXT, c923 TEXT, c924 TEXT, ++c925 TEXT, c926 TEXT, c927 TEXT, c928 TEXT, c929 TEXT, c930 TEXT, c931 TEXT, ++c932 TEXT, c933 TEXT, c934 TEXT, c935 TEXT, c936 TEXT, c937 TEXT, c938 TEXT, ++c939 TEXT, c940 TEXT, c941 TEXT, c942 TEXT, c943 TEXT, c944 TEXT, c945 TEXT, ++c946 TEXT, c947 TEXT, c948 TEXT, c949 TEXT, c950 TEXT, c951 TEXT, c952 TEXT, ++c953 TEXT, c954 TEXT, c955 TEXT, c956 TEXT, c957 TEXT, c958 TEXT, c959 TEXT, ++c960 TEXT, c961 TEXT, c962 TEXT, c963 TEXT, c964 TEXT, c965 TEXT, c966 TEXT, ++c967 TEXT, c968 TEXT, c969 TEXT, c970 TEXT, c971 TEXT, c972 TEXT, c973 TEXT, ++c974 TEXT, c975 TEXT, c976 TEXT, c977 TEXT, c978 TEXT, c979 TEXT, c980 TEXT, ++c981 TEXT, c982 TEXT, c983 TEXT, c984 TEXT, c985 TEXT, c986 TEXT, c987 TEXT, ++c988 TEXT, c989 TEXT, c990 TEXT, c991 TEXT, c992 TEXT, c993 TEXT, c994 TEXT, ++c995 TEXT, c996 TEXT, c997 TEXT, c998 TEXT, c999 TEXT, c1000 TEXT, c1001 TEXT, ++c1002 TEXT, c1003 TEXT, c1004 TEXT, c1005 TEXT, c1006 TEXT, c1007 TEXT, c1008 TEXT, ++c1009 TEXT, c1010 TEXT, c1011 TEXT, c1012 TEXT, c1013 TEXT, c1014 TEXT, c1015 TEXT, ++c1016 TEXT, c1017 TEXT, c1018 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR HY000: Can't create table `test`.`t1` (errno: 185 "Too many columns") diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,innodb,redundant.rdiff new file mode 100644 index 00000000..c324969f --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,64k,innodb,redundant.rdiff @@ -0,0 +1,121 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 12:50:05.663724193 +0300 +@@ -3,45 +3,104 @@ + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), + c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) ++c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), ++c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), ++c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), ++c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ++c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255), ++c33 CHAR(255), c34 CHAR(255), c35 CHAR(255), c36 CHAR(255), ++c37 CHAR(255), c38 CHAR(255), c39 CHAR(255), c40 CHAR(255), ++c41 CHAR(255), c42 CHAR(255), c43 CHAR(255), c44 CHAR(255), ++c45 CHAR(255), c46 CHAR(255), c47 CHAR(255), c48 CHAR(255), ++c49 CHAR(255), c50 CHAR(255), c51 CHAR(255), c52 CHAR(255), ++c53 CHAR(255), c54 CHAR(255), c55 CHAR(255), c56 CHAR(255), ++c57 CHAR(255), c58 CHAR(255), c59 CHAR(255), c60 CHAR(255), ++c61 CHAR(255), c62 CHAR(255), c63 CHAR(255), c64 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16382). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +-c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) ++c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255), ++c17 VARCHAR(255), c18 VARCHAR(255), c19 VARCHAR(255), c20 VARCHAR(255), ++c21 VARCHAR(255), c22 VARCHAR(255), c23 VARCHAR(255), c24 VARCHAR(255), ++c25 VARCHAR(255), c26 VARCHAR(255), c27 VARCHAR(255), c28 VARCHAR(255), ++c29 VARCHAR(255), c30 VARCHAR(255), c31 VARCHAR(255), c32 VARCHAR(255), ++c33 VARCHAR(255), c34 VARCHAR(255), c35 VARCHAR(255), c36 VARCHAR(255), ++c37 VARCHAR(255), c38 VARCHAR(255), c39 VARCHAR(255), c40 VARCHAR(255), ++c41 VARCHAR(255), c42 VARCHAR(255), c43 VARCHAR(255), c44 VARCHAR(255), ++c45 VARCHAR(255), c46 VARCHAR(255), c47 VARCHAR(255), c48 VARCHAR(255), ++c49 VARCHAR(255), c50 VARCHAR(255), c51 VARCHAR(255), c52 VARCHAR(255), ++c53 VARCHAR(255), c54 VARCHAR(255), c55 VARCHAR(255), c56 VARCHAR(255), ++c57 VARCHAR(255), c58 VARCHAR(255), c59 VARCHAR(255), c60 VARCHAR(255), ++c61 VARCHAR(255), c62 VARCHAR(255), c63 VARCHAR(255), c64 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16382). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) +-) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788) ++) ENGINE=INNODB; ++ERROR 42000: Row size too large (> 16382). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++CREATE TABLE t1 ( ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 16382). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,8k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,8k,compact,innodb.rdiff new file mode 100644 index 00000000..4db669a8 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,8k,compact,innodb.rdiff @@ -0,0 +1,35 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 13:00:25.037261867 +0300 +@@ -12,7 +12,7 @@ + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), + c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +@@ -26,7 +26,7 @@ + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), + c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), + c5 VARCHAR(788) +@@ -36,7 +36,7 @@ + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), + c5 VARCHAR(788), c6 VARCHAR(788) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CREATE TABLE t1 ( + c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT + ) ENGINE=INNODB; +@@ -44,4 +44,4 @@ + CREATE TABLE t1 ( + c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size,8k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,8k,dynamic,innodb.rdiff new file mode 100644 index 00000000..5f79d77e --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size,8k,dynamic,innodb.rdiff @@ -0,0 +1,134 @@ +--- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 ++++ max_record_size.reject 2019-07-03 13:01:51.215756779 +0300 +@@ -12,7 +12,7 @@ + c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), + c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), + c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +@@ -26,22 +26,113 @@ + c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), + c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788) ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788) + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( + c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +-c5 VARCHAR(788), c6 VARCHAR(788) +-) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT ++c5 VARCHAR(788), c6 VARCHAR(788), c7 VARCHAR(788), c8 VARCHAR(788), ++c9 VARCHAR(788), c10 VARCHAR(788), c11 VARCHAR(788), c12 VARCHAR(788), ++c13 VARCHAR(788), c14 VARCHAR(788), c15 VARCHAR(788), c16 VARCHAR(788), ++c17 VARCHAR(788), c18 VARCHAR(788), c19 VARCHAR(788), c20 VARCHAR(788), ++c21 VARCHAR(788), c22 VARCHAR(788), c23 VARCHAR(788), c24 VARCHAR(788), ++c25 VARCHAR(788), c26 VARCHAR(788), c27 VARCHAR(788), c28 VARCHAR(788), ++c29 VARCHAR(788), c30 VARCHAR(788), c31 VARCHAR(788), c32 VARCHAR(788), ++c33 VARCHAR(788), c34 VARCHAR(788), c35 VARCHAR(788), c36 VARCHAR(788), ++c37 VARCHAR(788), c38 VARCHAR(788), c39 VARCHAR(788), c40 VARCHAR(788), ++c41 VARCHAR(788), c42 VARCHAR(788), c43 VARCHAR(788), c44 VARCHAR(788), ++c45 VARCHAR(788), c46 VARCHAR(788), c47 VARCHAR(788), c48 VARCHAR(788), ++c49 VARCHAR(788), c50 VARCHAR(788), c51 VARCHAR(788), c52 VARCHAR(788), ++c53 VARCHAR(788), c54 VARCHAR(788), c55 VARCHAR(788), c56 VARCHAR(788), ++c57 VARCHAR(788), c58 VARCHAR(788), c59 VARCHAR(788), c60 VARCHAR(788), ++c61 VARCHAR(788), c62 VARCHAR(788), c63 VARCHAR(788), c64 VARCHAR(788), ++c65 VARCHAR(788), c66 VARCHAR(788), c67 VARCHAR(788), c68 VARCHAR(788), ++c69 VARCHAR(788), c70 VARCHAR(788), c71 VARCHAR(788), c72 VARCHAR(788), ++c73 VARCHAR(788), c74 VARCHAR(788), c75 VARCHAR(788), c76 VARCHAR(788), ++c77 VARCHAR(788), c78 VARCHAR(788), c79 VARCHAR(788), c80 VARCHAR(788), ++c81 VARCHAR(788), c82 VARCHAR(788), c83 VARCHAR(788) ++) ENGINE=INNODB; ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ++CREATE TABLE t1 ( ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT + ) ENGINE=INNODB; + DROP TABLE t1; + CREATE TABLE t1 ( +-c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT ++c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT, c7 TEXT, ++c8 TEXT, c9 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, ++c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT, c21 TEXT, ++c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, ++c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, ++c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT, c41 TEXT, c42 TEXT, ++c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT, ++c50 TEXT, c51 TEXT, c52 TEXT, c53 TEXT, c54 TEXT, c55 TEXT, c56 TEXT, ++c57 TEXT, c58 TEXT, c59 TEXT, c60 TEXT, c61 TEXT, c62 TEXT, c63 TEXT, ++c64 TEXT, c65 TEXT, c66 TEXT, c67 TEXT, c68 TEXT, c69 TEXT, c70 TEXT, ++c71 TEXT, c72 TEXT, c73 TEXT, c74 TEXT, c75 TEXT, c76 TEXT, c77 TEXT, ++c78 TEXT, c79 TEXT, c80 TEXT, c81 TEXT, c82 TEXT, c83 TEXT, c84 TEXT, ++c85 TEXT, c86 TEXT, c87 TEXT, c88 TEXT, c89 TEXT, c90 TEXT, c91 TEXT, ++c92 TEXT, c93 TEXT, c94 TEXT, c95 TEXT, c96 TEXT, c97 TEXT, c98 TEXT, ++c99 TEXT, c100 TEXT, c101 TEXT, c102 TEXT, c103 TEXT, c104 TEXT, c105 TEXT, ++c106 TEXT, c107 TEXT, c108 TEXT, c109 TEXT, c110 TEXT, c111 TEXT, c112 TEXT, ++c113 TEXT, c114 TEXT, c115 TEXT, c116 TEXT, c117 TEXT, c118 TEXT, c119 TEXT, ++c120 TEXT, c121 TEXT, c122 TEXT, c123 TEXT, c124 TEXT, c125 TEXT, c126 TEXT, ++c127 TEXT, c128 TEXT, c129 TEXT, c130 TEXT, c131 TEXT, c132 TEXT, c133 TEXT, ++c134 TEXT, c135 TEXT, c136 TEXT, c137 TEXT, c138 TEXT, c139 TEXT, c140 TEXT, ++c141 TEXT, c142 TEXT, c143 TEXT, c144 TEXT, c145 TEXT, c146 TEXT, c147 TEXT, ++c148 TEXT, c149 TEXT, c150 TEXT, c151 TEXT, c152 TEXT, c153 TEXT, c154 TEXT, ++c155 TEXT, c156 TEXT, c157 TEXT, c158 TEXT, c159 TEXT, c160 TEXT, c161 TEXT, ++c162 TEXT, c163 TEXT, c164 TEXT, c165 TEXT, c166 TEXT, c167 TEXT, c168 TEXT, ++c169 TEXT, c170 TEXT, c171 TEXT, c172 TEXT, c173 TEXT, c174 TEXT, c175 TEXT, ++c176 TEXT, c177 TEXT, c178 TEXT, c179 TEXT, c180 TEXT, c181 TEXT, c182 TEXT, ++c183 TEXT, c184 TEXT, c185 TEXT, c186 TEXT, c187 TEXT, c188 TEXT, c189 TEXT, ++c190 TEXT + ) ENGINE=INNODB; +-ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/max_record_size.result b/mysql-test/suite/innodb/r/max_record_size.result new file mode 100644 index 00000000..6eefd262 --- /dev/null +++ b/mysql-test/suite/innodb/r/max_record_size.result @@ -0,0 +1,47 @@ +call mtr.add_suppression("Cannot add field `.*` in table `test`.`t1` because after adding it, the row size is"); +CREATE TABLE t1 ( +c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +c13 CHAR(255), c14 CHAR(255), c15 CHAR(255) +) ENGINE=INNODB; +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), +c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), +c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), +c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) +) ENGINE=INNODB; +ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +CREATE TABLE t1 ( +c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255) +) ENGINE=INNODB; +DROP TABLE t1; +CREATE TABLE t1 ( +c1 VARCHAR(255), c2 VARCHAR(255), c3 VARCHAR(255), c4 VARCHAR(255), +c5 VARCHAR(255), c6 VARCHAR(255), c7 VARCHAR(255), c8 VARCHAR(255), +c9 VARCHAR(255), c10 VARCHAR(255), c11 VARCHAR(255), c12 VARCHAR(255), +c13 VARCHAR(255), c14 VARCHAR(255), c15 VARCHAR(255), c16 VARCHAR(255) +) ENGINE=INNODB; +ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +CREATE TABLE t1 ( +c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +c5 VARCHAR(788) +) ENGINE=INNODB; +DROP TABLE t1; +CREATE TABLE t1 ( +c1 VARCHAR(788), c2 VARCHAR(788), c3 VARCHAR(788), c4 VARCHAR(788), +c5 VARCHAR(788), c6 VARCHAR(788) +) ENGINE=INNODB; +ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +CREATE TABLE t1 ( +c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT +) ENGINE=INNODB; +DROP TABLE t1; +CREATE TABLE t1 ( +c1 TEXT, c2 TEXT, c3 TEXT, c4 TEXT, c5 TEXT, c6 TEXT +) ENGINE=INNODB; +ERROR 42000: Row size too large (> 4027). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. diff --git a/mysql-test/suite/innodb/r/mdev-117.result b/mysql-test/suite/innodb/r/mdev-117.result new file mode 100644 index 00000000..979f1ae0 --- /dev/null +++ b/mysql-test/suite/innodb/r/mdev-117.result @@ -0,0 +1,18 @@ +SET GLOBAL innodb_lock_wait_timeout=3; +CREATE TABLE t1 (col_int_key INT, KEY (col_int_key)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (6); +connect con1,localhost,root,,test; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +SET AUTOCOMMIT=OFF; +SELECT col_int_key FROM t1; +col_int_key +6 +connection default; +DELETE IGNORE FROM t1;; +connection con1; +DELETE FROM t1 WHERE col_int_key IN (1, 40000000); +connection default; +disconnect con1; +drop table t1; +SET GLOBAL innodb_lock_wait_timeout=default; +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); diff --git a/mysql-test/suite/innodb/r/mdev-14846.result b/mysql-test/suite/innodb/r/mdev-14846.result new file mode 100644 index 00000000..a1ccfb6b --- /dev/null +++ b/mysql-test/suite/innodb/r/mdev-14846.result @@ -0,0 +1,53 @@ +CREATE TABLE t1 ( +pk INT, +f1 VARCHAR(10) NOT NULL, +f2 VARCHAR(10) NULL, +f3 INT UNSIGNED NULL, +KEY (f1), +PRIMARY KEY (pk) +) ENGINE=InnoDB; +CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL); +CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB; +INSERT INTO t2 VALUES (NULL),('g'),('e'),('g'); +CREATE TABLE t3 ( +f1 VARCHAR(10) NOT NULL, +f2 VARCHAR(10) NULL, +f3 INT UNSIGNED NULL +) ENGINE=InnoDB; +INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6); +CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB; +INSERT INTO t4 VALUES (8),(9); +UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 ); +SET DEBUG_SYNC='now SIGNAL con1_dml'; +connect con1,localhost,root,,test; +SET DEBUG_SYNC='now WAIT_FOR con1_dml'; +begin; +SELECT * FROM t1 for update; +pk f1 f2 f3 +-109 a r NULL +1 k g 6 +2 y r 0 +3 t q 1 +5 z t NULL +SET DEBUG_SYNC='now SIGNAL default_dml'; +SET DEBUG_SYNC='now SIGNAL con2_dml'; +connection default; +SET DEBUG_SYNC='now WAIT_FOR default_dml'; +UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h'; +connect con2,localhost,root,,test; +set debug_sync='now WAIT_FOR con2_dml'; +SET DEBUG_SYNC='now SIGNAL con1_dml2'; +disconnect con2; +connection con1; +SET DEBUG_SYNC='now WAIT_FOR con1_dml2'; +UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 ); +connection default; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection con1; +COMMIT; +disconnect con1; +connection default; +DROP VIEW v4; +DROP TABLE t1, t2, t3, t4; +set debug_sync= reset; diff --git a/mysql-test/suite/innodb/r/mdev-15707.result b/mysql-test/suite/innodb/r/mdev-15707.result new file mode 100644 index 00000000..3967ce48 --- /dev/null +++ b/mysql-test/suite/innodb/r/mdev-15707.result @@ -0,0 +1,24 @@ +CREATE TABLE t1( +a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(255), +INDEX(b)) +ENGINE=InnoDB; +INSERT INTO t1(b) SELECT UUID(); +BEGIN; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +INSERT INTO t1(b) SELECT UUID() FROM t1; +COMMIT; +UPDATE t1 SET b=UUID(); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/missing_tablespaces.result b/mysql-test/suite/innodb/r/missing_tablespaces.result new file mode 100644 index 00000000..11b79273 --- /dev/null +++ b/mysql-test/suite/innodb/r/missing_tablespaces.result @@ -0,0 +1,11 @@ +# +# Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND" +# +CREATE DATABASE `..................................................`; +USE `..................................................`; +CREATE TABLE `..................................................` (ID INT) +ENGINE=INNODB; +select * from `..................................................`; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +DROP TABLE `..................................................`; +DROP DATABASE `..................................................`; diff --git a/mysql-test/suite/innodb/r/mon_lock_wait_current_count.result b/mysql-test/suite/innodb/r/mon_lock_wait_current_count.result new file mode 100644 index 00000000..442baeca --- /dev/null +++ b/mysql-test/suite/innodb/r/mon_lock_wait_current_count.result @@ -0,0 +1,54 @@ +connect prevent_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +SET GLOBAL innodb_monitor_disable='lock_row_lock_time_avg'; +CREATE TABLE `t` (a INT PRIMARY KEY) engine=InnoDB STATS_PERSISTENT=0; +INSERT INTO t VALUES (5); +SELECT name, count FROM information_schema.innodb_metrics +WHERE name ='lock_row_lock_current_waits'; +name count +lock_row_lock_current_waits 0 +connect con1,localhost,root,,; +BEGIN; +SELECT * FROM t FOR UPDATE; +a +5 +connect con2,localhost,root,,; +SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL blocked WAIT_FOR cont"; +BEGIN; +SELECT * FROM t FOR UPDATE; +connection default; +SET DEBUG_SYNC="now WAIT_FOR blocked"; +SELECT name, count FROM information_schema.innodb_metrics +WHERE name ='lock_row_lock_current_waits'; +name count +lock_row_lock_current_waits 1 +SET GLOBAL innodb_monitor_disable='lock_row_lock_current_waits'; +SET GLOBAL innodb_monitor_reset_all='lock_row_lock_current_waits'; +SET GLOBAL innodb_monitor_enable='lock_row_lock_current_waits'; +SELECT name, count FROM information_schema.innodb_metrics +WHERE name ='lock_row_lock_current_waits'; +name count +lock_row_lock_current_waits 1 +SET DEBUG_SYNC="now SIGNAL cont"; +disconnect con1; +connection con2; +a +5 +COMMIT; +disconnect con2; +connection default; +SET DEBUG_SYNC="reset"; +SELECT name, count FROM information_schema.innodb_metrics +WHERE name ='lock_row_lock_current_waits'; +name count +lock_row_lock_current_waits 0 +DROP TABLE `t`; +SET GLOBAL innodb_monitor_disable='lock_row_lock_current_waits'; +SET GLOBAL innodb_monitor_reset_all='lock_row_lock_current_waits'; +SET GLOBAL innodb_monitor_enable='lock_row_lock_current_waits'; +SET GLOBAL innodb_monitor_enable='lock_row_lock_time_avg'; +SET GLOBAL innodb_monitor_disable=default; +SET GLOBAL innodb_monitor_reset_all=default; +SET GLOBAL innodb_monitor_enable=default; +disconnect prevent_purge; diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result new file mode 100644 index 00000000..d99dd69e --- /dev/null +++ b/mysql-test/suite/innodb/r/monitor.result @@ -0,0 +1,604 @@ +select name, if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics; +name status +metadata_table_handles_opened disabled +lock_deadlocks enabled +lock_timeouts enabled +lock_rec_lock_waits disabled +lock_table_lock_waits disabled +lock_rec_lock_requests disabled +lock_rec_lock_created disabled +lock_rec_lock_removed disabled +lock_rec_locks disabled +lock_table_lock_created disabled +lock_table_lock_removed disabled +lock_table_locks disabled +lock_row_lock_current_waits enabled +lock_row_lock_time enabled +lock_row_lock_time_max enabled +lock_row_lock_waits enabled +lock_row_lock_time_avg enabled +buffer_pool_size enabled +buffer_pool_reads enabled +buffer_pool_read_requests enabled +buffer_pool_write_requests enabled +buffer_pool_wait_free enabled +buffer_pool_read_ahead enabled +buffer_pool_read_ahead_evicted enabled +buffer_pool_pages_total enabled +buffer_pool_pages_misc enabled +buffer_pool_pages_data enabled +buffer_pool_bytes_data enabled +buffer_pool_pages_dirty enabled +buffer_pool_bytes_dirty enabled +buffer_pool_pages_free enabled +buffer_pages_created enabled +buffer_pages_written enabled +buffer_pages_read enabled +buffer_data_reads enabled +buffer_data_written enabled +buffer_flush_batch_scanned disabled +buffer_flush_batch_num_scan disabled +buffer_flush_batch_scanned_per_call disabled +buffer_flush_batch_total_pages disabled +buffer_flush_batches disabled +buffer_flush_batch_pages disabled +buffer_flush_neighbor_total_pages disabled +buffer_flush_neighbor disabled +buffer_flush_neighbor_pages disabled +buffer_flush_n_to_flush_requested disabled +buffer_flush_n_to_flush_by_age disabled +buffer_flush_adaptive_avg_time disabled +buffer_flush_adaptive_avg_pass disabled +buffer_LRU_get_free_loops disabled +buffer_LRU_get_free_waits disabled +buffer_flush_avg_page_rate disabled +buffer_flush_lsn_avg_rate disabled +buffer_flush_pct_for_dirty disabled +buffer_flush_pct_for_lsn disabled +buffer_flush_sync_waits disabled +buffer_flush_adaptive_total_pages disabled +buffer_flush_adaptive disabled +buffer_flush_adaptive_pages disabled +buffer_flush_sync_total_pages disabled +buffer_flush_sync disabled +buffer_flush_sync_pages disabled +buffer_flush_background_total_pages disabled +buffer_flush_background disabled +buffer_flush_background_pages disabled +buffer_LRU_batch_scanned disabled +buffer_LRU_batch_num_scan disabled +buffer_LRU_batch_scanned_per_call disabled +buffer_LRU_batch_flush_total_pages enabled +buffer_LRU_batch_evict_total_pages enabled +buffer_LRU_single_flush_failure_count disabled +buffer_LRU_get_free_search disabled +buffer_LRU_search_scanned disabled +buffer_LRU_search_num_scan disabled +buffer_LRU_search_scanned_per_call disabled +buffer_LRU_unzip_search_scanned disabled +buffer_LRU_unzip_search_num_scan disabled +buffer_LRU_unzip_search_scanned_per_call disabled +buffer_page_read_index_leaf disabled +buffer_page_read_index_non_leaf disabled +buffer_page_read_index_ibuf_leaf disabled +buffer_page_read_index_ibuf_non_leaf disabled +buffer_page_read_undo_log disabled +buffer_page_read_index_inode disabled +buffer_page_read_ibuf_free_list disabled +buffer_page_read_ibuf_bitmap disabled +buffer_page_read_system_page disabled +buffer_page_read_trx_system disabled +buffer_page_read_fsp_hdr disabled +buffer_page_read_xdes disabled +buffer_page_read_blob disabled +buffer_page_read_zblob disabled +buffer_page_read_zblob2 disabled +buffer_page_read_other disabled +buffer_page_written_index_leaf disabled +buffer_page_written_index_non_leaf disabled +buffer_page_written_index_ibuf_leaf disabled +buffer_page_written_index_ibuf_non_leaf disabled +buffer_page_written_undo_log disabled +buffer_page_written_index_inode disabled +buffer_page_written_ibuf_free_list disabled +buffer_page_written_ibuf_bitmap disabled +buffer_page_written_system_page disabled +buffer_page_written_trx_system disabled +buffer_page_written_fsp_hdr disabled +buffer_page_written_xdes disabled +buffer_page_written_blob disabled +buffer_page_written_zblob disabled +buffer_page_written_zblob2 disabled +buffer_page_written_other disabled +os_data_reads enabled +os_data_writes enabled +os_data_fsyncs enabled +os_pending_reads enabled +os_pending_writes enabled +os_log_bytes_written enabled +trx_rw_commits disabled +trx_ro_commits disabled +trx_nl_ro_commits disabled +trx_commits_insert_update disabled +trx_rollbacks disabled +trx_rollbacks_savepoint disabled +trx_rseg_history_len enabled +trx_undo_slots_used disabled +trx_undo_slots_cached enabled +trx_rseg_current_size disabled +purge_del_mark_records disabled +purge_upd_exist_or_extern_records disabled +purge_invoked disabled +purge_undo_log_pages disabled +purge_dml_delay_usec disabled +purge_stop_count disabled +purge_resume_count disabled +log_checkpoints disabled +log_lsn_last_flush disabled +log_lsn_last_checkpoint disabled +log_lsn_current disabled +log_lsn_checkpoint_age disabled +log_lsn_buf_pool_oldest disabled +log_max_modified_age_async disabled +log_waits enabled +log_write_requests enabled +log_writes enabled +compress_pages_compressed disabled +compress_pages_decompressed disabled +compression_pad_increments disabled +compression_pad_decrements disabled +compress_saved disabled +compress_pages_page_compressed disabled +compress_page_compressed_trim_op disabled +compress_pages_page_decompressed disabled +compress_pages_page_compression_error disabled +compress_pages_encrypted disabled +compress_pages_decrypted disabled +index_page_splits disabled +index_page_merge_attempts disabled +index_page_merge_successful disabled +index_page_reorg_attempts disabled +index_page_reorg_successful disabled +index_page_discards disabled +adaptive_hash_searches enabled +adaptive_hash_searches_btree enabled +adaptive_hash_pages_added disabled +adaptive_hash_pages_removed disabled +adaptive_hash_rows_added disabled +adaptive_hash_rows_removed disabled +adaptive_hash_rows_deleted_no_hash_entry disabled +adaptive_hash_rows_updated disabled +file_num_open_files enabled +ibuf_merges_insert enabled +ibuf_merges_delete_mark enabled +ibuf_merges_delete enabled +ibuf_merges_discard_insert enabled +ibuf_merges_discard_delete_mark enabled +ibuf_merges_discard_delete enabled +ibuf_merges enabled +ibuf_size enabled +innodb_master_thread_sleeps disabled +innodb_activity_count enabled +innodb_master_active_loops disabled +innodb_master_idle_loops disabled +innodb_log_flush_usec disabled +innodb_dict_lru_usec disabled +innodb_dict_lru_count_active disabled +innodb_dict_lru_count_idle disabled +innodb_dblwr_writes enabled +innodb_dblwr_pages_written enabled +innodb_page_size enabled +ddl_background_drop_indexes disabled +ddl_online_create_index disabled +ddl_pending_alter_table disabled +ddl_sort_file_alter_table disabled +ddl_log_file_alter_table disabled +icp_attempts disabled +icp_no_match disabled +icp_out_of_range disabled +icp_match disabled +set global innodb_monitor_disable = All; +select name from information_schema.innodb_metrics where enabled; +name +set global innodb_monitor_enable = all; +select name from information_schema.innodb_metrics where not enabled; +name +set global innodb_monitor_enable = aaa; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa' +set global innodb_monitor_disable = All; +select name from information_schema.innodb_metrics where enabled; +name +set global innodb_monitor_reset_all = all; +select name from information_schema.innodb_metrics where count!=0; +name +set global innodb_monitor_enable = "%lock%"; +select name from information_schema.innodb_metrics +where enabled != (name like "%lock%"); +name +set global innodb_monitor_disable = "%lock%"; +select name, if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name like "%lock%"; +name status +lock_deadlocks disabled +lock_timeouts disabled +lock_rec_lock_waits disabled +lock_table_lock_waits disabled +lock_rec_lock_requests disabled +lock_rec_lock_created disabled +lock_rec_lock_removed disabled +lock_rec_locks disabled +lock_table_lock_created disabled +lock_table_lock_removed disabled +lock_table_locks disabled +lock_row_lock_current_waits disabled +lock_row_lock_time disabled +lock_row_lock_time_max disabled +lock_row_lock_waits disabled +lock_row_lock_time_avg disabled +set global innodb_monitor_enable = "%lock*"; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*' +set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; +select name from information_schema.innodb_metrics where not enabled; +name +set global innodb_monitor_disable="%%%%%"; +select name from information_schema.innodb_metrics where enabled; +name +set global innodb_monitor_enable="%"; +select name from information_schema.innodb_metrics where not enabled; +name +set global innodb_monitor_disable="%_%"; +select name from information_schema.innodb_metrics where enabled; +name +set global innodb_monitor_enable="log%%%%"; +select name from information_schema.innodb_metrics +where enabled != (name like "log%"); +name +set global innodb_monitor_enable="os_%a_fs_ncs"; +set global innodb_monitor_enable="os%pending%"; +select name, if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name like "os%"; +name status +os_data_reads disabled +os_data_writes disabled +os_data_fsyncs enabled +os_pending_reads enabled +os_pending_writes enabled +os_log_bytes_written disabled +set global innodb_monitor_enable=""; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '' +set global innodb_monitor_enable="_"; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_' +SET global innodb_monitor_disable = module_metadata; +SET global innodb_monitor_reset_all = module_metadata; +set global innodb_monitor_enable = metadata_table_handles_opened; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled +set global innodb_monitor_reset = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled +drop table monitor_test; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled +set global innodb_monitor_reset_all = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled +set global innodb_monitor_disable = metadata_table_handles_opened; +set global innodb_monitor_reset = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +drop table monitor_test; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +set global innodb_monitor_reset_all = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = metadata_table_handles_opened; +drop table monitor_test; +create table monitor_test(col int) engine = innodb stats_persistent=0; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled +set global innodb_monitor_disable = module_metadata; +set global innodb_monitor_reset = module_metadata; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 NULL NULL 0 disabled +set global innodb_monitor_reset_all = module_metadata; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = module_trx; +begin; +insert into monitor_test values(9); +commit; +begin; +insert into monitor_test values(9); +rollback; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name='trx_rollbacks'; +name max_count min_count count max_count_reset min_count_reset count_reset status +trx_rollbacks 1 NULL 1 1 NULL 1 enabled +set global innodb_monitor_disable = module_trx; +drop table monitor_test; +set global innodb_monitor_enable = file_num_open_files; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, +if(enabled,'enabled','disabled') status +from information_schema.innodb_metrics +where name like "file_num_open_files"; +name max_count min_count count max_count_reset min_count_reset count_reset status +file_num_open_files # # # # # # enabled +set global innodb_monitor_disable = file_num_open_files; +set global innodb_monitor_enable = "icp%"; +create table monitor_test(a char(3), b int, c char(2), +primary key (a(1), c(1)), key(b)) engine = innodb; +insert into monitor_test values("13", 2, "aa"); +select a from monitor_test where b < 1 for update; +a +select name, count from information_schema.innodb_metrics +where name like "icp%"; +name count +icp_attempts 1 +icp_no_match 0 +icp_out_of_range 1 +icp_match 0 +select a from monitor_test where b < 3 for update; +a +13 +select name, count from information_schema.innodb_metrics +where name like "icp%"; +name count +icp_attempts 2 +icp_no_match 0 +icp_out_of_range 1 +icp_match 1 +drop table monitor_test; +set global innodb_monitor_disable = All; +set global innodb_monitor_reset_all = all; +select 1 from `information_schema`.`INNODB_METRICS` +where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; +1 +set global innodb_monitor_enable = default; +set global innodb_monitor_disable = default; +set global innodb_monitor_reset = default; +set global innodb_monitor_reset_all = default; +# +# Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL +# MONITORS +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT > 0 +buffer_page_written_index_leaf 0 +SET GLOBAL innodb_monitor_enable='module_buffer_page'; +INSERT INTO t1 VALUES (1), (2), (3), (4); +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT > 0 +buffer_page_written_index_leaf 1 +SET GLOBAL innodb_monitor_disable='module_buffer_page'; +SET GLOBAL innodb_monitor_reset_all='module_buffer_page'; +SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT > 0 +buffer_page_written_index_leaf 0 +SET GLOBAL innodb_monitor_enable='%'; +SET GLOBAL innodb_monitor_reset_all= '%', innodb_compression_algorithm= foo; +ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'foo' +INSERT INTO t1 VALUES (5), (6), (7), (8); +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT > 0 +buffer_page_written_index_leaf 1 +SET GLOBAL innodb_monitor_disable='%'; +SET GLOBAL innodb_monitor_reset_all='%'; +SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT > 0 +buffer_page_written_index_leaf 0 +SET GLOBAL innodb_monitor_enable='ALL'; +INSERT INTO t1 VALUES (9), (10), (11), (12); +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT > 0 +buffer_page_written_index_leaf 1 +DROP TABLE t1; +CREATE TABLE fl0 ( +id INT NOT NULL PRIMARY KEY +) ENGINE = InnoDB; +CREATE TABLE fl1 ( +id INT NOT NULL PRIMARY KEY, +fl0_id INT, +CONSTRAINT `fkl0` + FOREIGN KEY (fl0_id) REFERENCES fl0 (id) +ON DELETE CASCADE +ON UPDATE RESTRICT +) ENGINE = InnoDB; +CREATE TABLE fl2 ( +id INT NOT NULL PRIMARY KEY, +fl1_id INT, +CONSTRAINT `fkl1` + FOREIGN KEY (fl1_id) REFERENCES fl1 (id) +ON DELETE CASCADE +ON UPDATE SET NULL +) ENGINE = InnoDB; +INSERT INTO fl0 VALUES (1000); +INSERT INTO fl1 VALUES (500, 1000), (1500, 1000); +INSERT INTO fl2 VALUES (200, 500), (800, 500), (1200, 1500), (1800, 1500); +CREATE TABLE t1(id INT PRIMARY KEY, a INT, b CHAR(1), UNIQUE KEY u(a,b)) +ENGINE=InnoDB; +SET @start = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME += 'lock_rec_lock_created'); +BEGIN; +INSERT INTO t1 VALUES(1,1,'a'),(2,9999,'b'),(3,10000,'c'),(4,4,'d'); +DELETE FROM t1 WHERE a = 9999 AND b='b'; +COMMIT; +SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME += 'lock_rec_lock_created'); +SELECT @end - @start; +@end - @start +1 +# Records must not be S/X-locked if a table is X-locked. +SET @start = @end; +SET autocommit = 0; +BEGIN; +LOCK TABLE t1 WRITE; +SELECT * FROM t1; +id a b +1 1 a +4 4 d +3 10000 c +SELECT * FROM t1 WHERE a>=10000; +id a b +3 10000 c +SELECT * FROM t1 FOR UPDATE; +id a b +1 1 a +4 4 d +3 10000 c +SELECT * FROM t1 WHERE a>=10000 FOR UPDATE; +id a b +3 10000 c +UPDATE t1 SET b = 'b' WHERE id = 4; +UPDATE t1 SET b = 'b' WHERE a = 10000; +REPLACE INTO t1 VALUES (4,3,'a'); +INSERT INTO t1 VALUES (3,1,'e') ON DUPLICATE KEY UPDATE b = 'b'; +INSERT INTO t1 VALUES (5,5,'e'); +DELETE FROM t1 WHERE a = 1 AND b='a'; +DELETE FROM t1; +COMMIT; +UNLOCK TABLES; +SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'lock_rec_lock_created'); +SELECT @end - @start; +@end - @start +0 +# Records must not be S-locked if a table is S-locked. +SET @start = @end; +BEGIN; +LOCK TABLE t1 WRITE; +INSERT INTO t1 VALUES(1,1,'a'),(2,9999,'b'),(3,10000,'c'),(4,4,'d'); +DELETE FROM t1 WHERE a = 9999 AND b='b'; +COMMIT; +UNLOCK TABLES; +BEGIN; +LOCK TABLE t1 READ; +SELECT * FROM t1 LOCK IN SHARE MODE; +id a b +1 1 a +4 4 d +3 10000 c +SELECT * FROM t1 WHERE a>=10000 LOCK IN SHARE MODE; +id a b +3 10000 c +COMMIT; +UNLOCK TABLES; +SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'lock_rec_lock_created'); +SELECT @end - @start; +@end - @start +0 +# Records must not be S-locked for foreign keys enforcement +SET @start = @end; +BEGIN; +LOCK TABLE fl0 READ, fl1 READ, fl2 WRITE; +INSERT INTO fl2 VALUES (300, 500), (700, 500), (1300, 1500), (1700, 1500); +SELECT * FROM fl1 LOCK IN SHARE MODE; +id fl0_id +500 1000 +1500 1000 +COMMIT; +UNLOCK TABLES; +SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'lock_rec_lock_created'); +SELECT @end - @start; +@end - @start +0 +# Records must not be X-locked for foreign keys cascade +SET @start = @end; +BEGIN; +LOCK TABLE fl0 READ, fl1 WRITE, fl2 WRITE; +DELETE FROM fl1 WHERE id = 1500; +UPDATE fl1 SET id = 2500 WHERE id = 500; +COMMIT; +UNLOCK TABLES; +SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'lock_rec_lock_created'); +SELECT @end - @start; +@end - @start +0 +SET autocommit = default; +DROP TABLE t1; +DROP TABLE fl2; +DROP TABLE fl1; +DROP TABLE fl0; +SET GLOBAL innodb_monitor_enable=default; +SET GLOBAL innodb_monitor_disable=default; +SET GLOBAL innodb_monitor_reset_all=default; diff --git a/mysql-test/suite/innodb/r/multi_repair-7404.result b/mysql-test/suite/innodb/r/multi_repair-7404.result new file mode 100644 index 00000000..b3db5755 --- /dev/null +++ b/mysql-test/suite/innodb/r/multi_repair-7404.result @@ -0,0 +1,21 @@ +create table `t1`(`a` int) engine=innodb partition by key (`a`); +create table `t2`(`b` int) engine=innodb; +create table `t3`(`c` int) engine=innodb; +insert t1 values (1); +insert t2 values (2); +insert t3 values (3); +repair table `t1`,`t2`,`t3`; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t2 repair status OK +test.t3 repair status OK +select * from t1; +a +1 +select * from t2; +b +2 +select * from t3; +c +3 +drop table t1, t2, t3; diff --git a/mysql-test/suite/innodb/r/mvcc.result b/mysql-test/suite/innodb/r/mvcc.result new file mode 100644 index 00000000..215b2165 --- /dev/null +++ b/mysql-test/suite/innodb/r/mvcc.result @@ -0,0 +1,46 @@ +SET @save_per_table= @@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table= 1; +# +# MDEV-15249 Crash in MVCC read after IMPORT TABLESPACE +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +FLUSH TABLES t1 WITH READ LOCK; +UNLOCK TABLES; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect con1,localhost,root,,; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +connection default; +SELECT * FROM t1; +ERROR HY000: Table definition has changed, please retry transaction +COMMIT; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection con1; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; +disconnect con1; +connection default; +# FIXME: Block this with ER_TABLE_DEF_CHANGED +SELECT * FROM t1; +a +0 +COMMIT; +SELECT * FROM t1; +a +0 +DROP TABLE t1; +# +# MDEV-23198 Crash in REPLACE +# +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(id INT PRIMARY KEY, c', +GROUP_CONCAT(seq SEPARATOR ' INT, c'), +' INT NOT NULL UNIQUE) ENGINE=InnoDB') +FROM seq_1_to_294); +EXECUTE IMMEDIATE c; +END; +$$ +INSERT INTO t1 SET id=1,c294=1; +REPLACE t1 SET id=1,c294=1; +DROP TABLE t1; +SET GLOBAL innodb_file_per_table= @save_per_table; diff --git a/mysql-test/suite/innodb/r/mvcc_secondary.result b/mysql-test/suite/innodb/r/mvcc_secondary.result new file mode 100644 index 00000000..2289742e --- /dev/null +++ b/mysql-test/suite/innodb/r/mvcc_secondary.result @@ -0,0 +1,24 @@ +# +# MDEV-25459 MVCC read from index on CHAR or VARCHAR wrongly omits rows +# +CREATE TABLE t1 ( +pk int PRIMARY KEY, c varchar(255) UNIQUE, +d char(255), e varchar(255), f char(255), g char(255) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC DEFAULT CHARACTER SET ucs2; +INSERT INTO t1 VALUES +(1,REPEAT('c',248),REPEAT('a',106),REPEAT('b',220),REPEAT('x',14),''); +BEGIN; +UPDATE t1 SET c=REPEAT('d',170); +connect con1,localhost,root,,; +SELECT pk FROM t1 FORCE INDEX (c); +pk +1 +connection default; +COMMIT; +connection con1; +SELECT pk FROM t1 FORCE INDEX (c); +pk +1 +disconnect con1; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/no_pad.result b/mysql-test/suite/innodb/r/no_pad.result new file mode 100644 index 00000000..0c039c30 --- /dev/null +++ b/mysql-test/suite/innodb/r/no_pad.result @@ -0,0 +1,7 @@ +CREATE TABLE t1 (a CHAR(8), id INT, PRIMARY KEY (a,id)) COLLATE utf8_nopad_bin +ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES ('',1); +ALTER TABLE t1 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('',2); +ALTER TABLE t1 ROW_FORMAT=REDUNDANT; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/online_table_rebuild.result b/mysql-test/suite/innodb/r/online_table_rebuild.result new file mode 100644 index 00000000..46d9780d --- /dev/null +++ b/mysql-test/suite/innodb/r/online_table_rebuild.result @@ -0,0 +1,67 @@ +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB; +INSERT INTO t1 VALUES(3, "innodb", "alter log"); +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD PRIMARY KEY(f3(10)), ADD UNIQUE KEY(f2(10)); +CONNECT con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 VALUES(1, repeat('b', 100), repeat('c', 100)); +INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('a', 100)); +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry 'bbbbbbbbbb' for key 'f2' +connection default; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD PRIMARY KEY(f1); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +INSERT INTO t1 SELECT 10, repeat('a', 100), repeat('b', 100) FROM seq_1_to_4800; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR HY000: Creating index 'PRIMARY' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again +DELETE FROM t1; +INSERT INTO t1 VALUES(1, repeat('a', 100), repeat('b', 100)); +ALTER TABLE t1 ADD PRIMARY KEY(f1); +set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(f3(10)); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('c', 100)); +UPDATE t1 set f3=repeat('c', 100) where f1=1; +COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR 23000: Duplicate entry 'cccccccccc' for key 'PRIMARY' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` char(200) DEFAULT NULL, + `f3` char(200) DEFAULT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-30183 Assertion `!memcmp(rec_trx_id, old_pk_trx_id->data, +# 6 + 7)' failed in row_log_table_apply_update +# +set @old_sql_mode = @@sql_mode; +set @@sql_mode=""; +CREATE TABLE t1(col_int int, col_varchar varchar(500))ENGINE=InnoDB; +INSERT INTO t1(col_int) values(2560); +set debug_sync="row_log_table_apply1_before SIGNAL con1_begin WAIT_FOR con1_commit"; +ALTER TABLE t1 ADD PRIMARY KEY ( col_varchar); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_begin"; +UPDATE t1 SET col_int = 2178; +INSERT INTO t1(col_int) VALUES(3016); +UPDATE t1 set col_int=2802; +SET DEBUG_SYNC="now SIGNAL con1_commit"; +connection default; +ERROR 23000: Duplicate entry '' for key 'PRIMARY' +DROP TABLE t1; +SET @@sql_mode = @old_sql_mode; +disconnect con1; +SET DEBUG_SYNC=reset; diff --git a/mysql-test/suite/innodb/r/page_cleaner.result b/mysql-test/suite/innodb/r/page_cleaner.result new file mode 100644 index 00000000..97dd0120 --- /dev/null +++ b/mysql-test/suite/innodb/r/page_cleaner.result @@ -0,0 +1,14 @@ +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=90.0; +CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; +SELECT variable_value>0 FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; +variable_value>0 +1 +SET GLOBAL innodb_max_dirty_pages_pct=0.0; +DROP TABLE t; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; diff --git a/mysql-test/suite/innodb/r/page_id_innochecksum.result b/mysql-test/suite/innodb/r/page_id_innochecksum.result new file mode 100644 index 00000000..7915a7ba --- /dev/null +++ b/mysql-test/suite/innodb/r/page_id_innochecksum.result @@ -0,0 +1,8 @@ +# Set the environmental variables +create table t1(f1 int not null)engine=innodb; +insert into t1 values(1), (2), (3); +# Change the page offset +FOUND 1 /page id mismatch/ in result.log +InnoDB 0 transactions not purged +drop table t1; +call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test/t1\\.ibd': Page read from tablespace is corrupted\\."); diff --git a/mysql-test/suite/innodb/r/page_reorganize.result b/mysql-test/suite/innodb/r/page_reorganize.result new file mode 100644 index 00000000..20e1600b --- /dev/null +++ b/mysql-test/suite/innodb/r/page_reorganize.result @@ -0,0 +1,34 @@ +# +# Bug# 20005279 ASSERT !OTHER_LOCK, LOCK_MOVE_REORGANIZE_PAGE() +# +create table t1 (f1 int auto_increment primary key, +f2 char(255)) engine=innodb; +start transaction; +commit; +start transaction; +select f1, f2 from t1 where f1 = 20 for update; +f1 f2 +20 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +connect con1,localhost,root,,; +select f1 from t1 where f1 = 20 for update; +connection default; +SET @save_dbug = @@debug_dbug; +SET DEBUG_DBUG = '+d,do_page_reorganize,do_lock_reverse_page_reorganize'; +insert into t1(f2) values (repeat('+', 100)); +SET DEBUG = @save_dbug; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +commit; +connection con1; +f1 +20 +disconnect con1; +connection default; +drop table t1; +# +# MDEV-27993 Assertion failed in btr_page_reorganize_low() +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_DBUG = '+d,do_page_reorganize'; +INSERT INTO t1 VALUES(0,0); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/partition_locking.result b/mysql-test/suite/innodb/r/partition_locking.result new file mode 100644 index 00000000..f25b8a15 --- /dev/null +++ b/mysql-test/suite/innodb/r/partition_locking.result @@ -0,0 +1,461 @@ +set @start_read_only= @@global.read_only; +set @start_autocommit= @@global.autocommit; +set default_storage_engine= innodb; +set @@global.autocommit= 0; +CREATE USER test@localhost; +grant CREATE, SELECT, UPDATE, INSERT on *.* to test@localhost; +CREATE USER test2@localhost; +grant CREATE, SELECT, UPDATE on *.* to test2@localhost; +CREATE TABLE t1 ( +a char(2) NOT NULL, +b char(2) NOT NULL, +c int(10) unsigned NOT NULL, +d varchar(255) DEFAULT NULL, +e varchar(1000) DEFAULT NULL, +PRIMARY KEY (a, b, c), +KEY (a), +KEY (a, b) +) charset latin1 PARTITION BY KEY (a) PARTITIONS 20; +INSERT INTO t1 (a, b, c, d, e) VALUES +('07', '03', 343, '1', '07_03_343'), +('01', '04', 343, '2', '01_04_343'), +('01', '06', 343, '3', '01_06_343'), +('01', '07', 343, '4', '01_07_343'), +('01', '08', 343, '5', '01_08_343'), +('01', '09', 343, '6', '01_09_343'), +('03', '03', 343, '7', '03_03_343'), +('03', '06', 343, '8', '03_06_343'), +('03', '07', 343, '9', '03_07_343'), +('04', '03', 343, '10', '04_03_343'), +('04', '06', 343, '11', '04_06_343'), +('05', '03', 343, '12', '05_03_343'), +('11', '03', 343, '13', '11_03_343'), +('11', '04', 343, '14', '11_04_343') +; +CREATE TABLE t2 (a int, name VARCHAR(50), purchased DATE) +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (3), +PARTITION p1 VALUES LESS THAN (7), +PARTITION p2 VALUES LESS THAN (9), +PARTITION p3 VALUES LESS THAN (11)); +INSERT INTO t2 VALUES +(1, 'desk organiser', '2003-10-15'), +(2, 'CD player', '1993-11-05'), +(3, 'TV set', '1996-03-10'), +(4, 'bookcase', '1982-01-10'), +(5, 'exercise bike', '2004-05-09'), +(6, 'sofa', '1987-06-05'), +(7, 'popcorn maker', '2001-11-22'), +(8, 'acquarium', '1992-08-04'), +(9, 'study desk', '1984-09-16'), +(10, 'lava lamp', '1998-12-25'); +CREATE TABLE t3 SELECT * FROM t1; +ALTER TABLE t3 ADD PRIMARY KEY (d); +ALTER TABLE t3 ADD KEY (a); +ALTER TABLE t3 ADD KEY (a, b); +ANALYZE TABLE t3; +Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +######################################################################## +connect con1,localhost,test,,test; +BEGIN; +SELECT d,a,b,c FROM t1 partition (p0); +d a b c +SELECT d,a,b,c FROM t1 partition (p1); +d a b c +7 03 03 343 +8 03 06 343 +9 03 07 343 +SELECT d,a,b,c FROM t1 partition (p2); +d a b c +SELECT d,a,b,c FROM t1 partition (p3); +d a b c +SELECT d,a,b,c FROM t1 partition (p4); +d a b c +SELECT d,a,b,c FROM t1 partition (p5); +d a b c +SELECT d,a,b,c FROM t1 partition (p6); +d a b c +SELECT d,a,b,c FROM t1 partition (p7); +d a b c +SELECT d,a,b,c FROM t1 partition (p8); +d a b c +SELECT d,a,b,c FROM t1 partition (p9); +d a b c +2 01 04 343 +3 01 06 343 +4 01 07 343 +5 01 08 343 +6 01 09 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +SELECT d,a,b,c FROM t1 partition (p10); +d a b c +SELECT d,a,b,c FROM t1 partition (p11); +d a b c +13 11 03 343 +14 11 04 343 +SELECT d,a,b,c FROM t1 partition (p12); +d a b c +SELECT d,a,b,c FROM t1 partition (p13); +d a b c +SELECT d,a,b,c FROM t1 partition (p14); +d a b c +SELECT d,a,b,c FROM t1 partition (p15); +d a b c +SELECT d,a,b,c FROM t1 partition (p16); +d a b c +SELECT d,a,b,c FROM t1 partition (p17); +d a b c +1 07 03 343 +SELECT d,a,b,c FROM t1 partition (p18); +d a b c +SELECT d,a,b,c FROM t1 partition (p19); +d a b c +SELECT * FROM t1 WHERE a='01' FOR UPDATE ; +a b c d e +01 04 343 2 01_04_343 +01 06 343 3 01_06_343 +01 07 343 4 01_07_343 +01 08 343 5 01_08_343 +01 09 343 6 01_09_343 +SELECT * FROM t3 FORCE INDEX(a) WHERE a='01' FOR UPDATE ; +a b c d e +01 04 343 2 01_04_343 +01 06 343 3 01_06_343 +01 07 343 4 01_07_343 +01 08 343 5 01_08_343 +01 09 343 6 01_09_343 +connect con2,localhost,test,,test; +BEGIN; +SET SESSION innodb_lock_wait_timeout=1; +# +# SHARE ... +SELECT * FROM t1 LOCK IN SHARE MODE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 LOCK IN SHARE MODE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; +a b c d e +07 03 343 1 07_03_343 +04 03 343 10 04_03_343 +04 06 343 11 04_06_343 +05 03 343 12 05_03_343 +11 03 343 13 11_03_343 +11 04 343 14 11_04_343 +03 03 343 7 03_03_343 +03 06 343 8 03_06_343 +03 07 343 9 03_07_343 +SELECT a,count(b) FROM t1 GROUP BY a ORDER BY a LOCK IN SHARE MODE SKIP LOCKED; +a count(b) +01 5 +03 3 +04 2 +05 1 +07 1 +11 2 +SELECT d,a,b,c FROM t1 partition (p1,p9,p11,p17) ORDER BY d +LOCK IN SHARE MODE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +SELECT d,a,b,c FROM t1 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +ANALYZE TABLE t3; +Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +SELECT d,a,b,c FROM t3 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +explain SELECT d,a,b,c FROM t3 ORDER BY d +LOCK IN SHARE MODE SKIP LOCKED; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 index NULL PRIMARY 257 NULL 14 +# +# UPDATE ... +SELECT * FROM t1 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 ORDER BY a FOR UPDATE SKIP LOCKED; +a b c d e +03 03 343 7 03_03_343 +03 06 343 8 03_06_343 +03 07 343 9 03_07_343 +04 03 343 10 04_03_343 +04 06 343 11 04_06_343 +05 03 343 12 05_03_343 +07 03 343 1 07_03_343 +11 03 343 13 11_03_343 +11 04 343 14 11_04_343 +SELECT a,count(b) FROM t1 GROUP BY a ORDER BY a FOR UPDATE SKIP LOCKED; +a count(b) +03 3 +04 2 +05 1 +07 1 +11 2 +SELECT d,a,b,c FROM t1 partition (p1,p9,p11,p17) ORDER BY d +FOR UPDATE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +SELECT d,a,b,c FROM t1 ORDER BY d FOR UPDATE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +SELECT d,a,b,c FROM t3 ORDER BY d FOR UPDATE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +connection con1; +COMMIT; +connection con1; +BEGIN; +SELECT * FROM t1 WHERE a='01' LOCK IN SHARE MODE ; +a b c d e +01 04 343 2 01_04_343 +01 06 343 3 01_06_343 +01 07 343 4 01_07_343 +01 08 343 5 01_08_343 +01 09 343 6 01_09_343 +SELECT * FROM t3 FORCE INDEX(a) WHERE a='01' LOCK IN SHARE MODE ; +a b c d e +01 04 343 2 01_04_343 +01 06 343 3 01_06_343 +01 07 343 4 01_07_343 +01 08 343 5 01_08_343 +01 09 343 6 01_09_343 +connection con2; +BEGIN; +SET SESSION innodb_lock_wait_timeout=1; +# +# SHARE ... +SELECT * FROM t1 LOCK IN SHARE MODE; +a b c d e +03 03 343 7 03_03_343 +03 06 343 8 03_06_343 +03 07 343 9 03_07_343 +01 04 343 2 01_04_343 +01 06 343 3 01_06_343 +01 07 343 4 01_07_343 +01 08 343 5 01_08_343 +01 09 343 6 01_09_343 +04 03 343 10 04_03_343 +04 06 343 11 04_06_343 +05 03 343 12 05_03_343 +11 03 343 13 11_03_343 +11 04 343 14 11_04_343 +07 03 343 1 07_03_343 +SELECT * FROM t1 LOCK IN SHARE MODE NOWAIT; +a b c d e +03 03 343 7 03_03_343 +03 06 343 8 03_06_343 +03 07 343 9 03_07_343 +01 04 343 2 01_04_343 +01 06 343 3 01_06_343 +01 07 343 4 01_07_343 +01 08 343 5 01_08_343 +01 09 343 6 01_09_343 +04 03 343 10 04_03_343 +04 06 343 11 04_06_343 +05 03 343 12 05_03_343 +11 03 343 13 11_03_343 +11 04 343 14 11_04_343 +07 03 343 1 07_03_343 +SELECT * FROM t1 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; +a b c d e +07 03 343 1 07_03_343 +04 03 343 10 04_03_343 +04 06 343 11 04_06_343 +05 03 343 12 05_03_343 +11 03 343 13 11_03_343 +11 04 343 14 11_04_343 +01 04 343 2 01_04_343 +01 06 343 3 01_06_343 +01 07 343 4 01_07_343 +01 08 343 5 01_08_343 +01 09 343 6 01_09_343 +03 03 343 7 03_03_343 +03 06 343 8 03_06_343 +03 07 343 9 03_07_343 +SELECT a,count(b) FROM t1 GROUP BY a ORDER BY a LOCK IN SHARE MODE SKIP LOCKED; +a count(b) +01 5 +03 3 +04 2 +05 1 +07 1 +11 2 +SELECT d,a,b,c FROM t1 partition (p1,p9,p11,p17) ORDER BY d +LOCK IN SHARE MODE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +2 01 04 343 +3 01 06 343 +4 01 07 343 +5 01 08 343 +6 01 09 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +SELECT d,a,b,c FROM t1 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +2 01 04 343 +3 01 06 343 +4 01 07 343 +5 01 08 343 +6 01 09 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +ANALYZE TABLE t3; +Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +SELECT d,a,b,c FROM t3 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +2 01 04 343 +3 01 06 343 +4 01 07 343 +5 01 08 343 +6 01 09 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +explain SELECT d,a,b,c FROM t3 ORDER BY d +LOCK IN SHARE MODE SKIP LOCKED; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 index NULL PRIMARY 257 NULL 14 +# +# UPDATE ... +SELECT * FROM t1 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 ORDER BY a FOR UPDATE SKIP LOCKED; +a b c d e +03 03 343 7 03_03_343 +03 06 343 8 03_06_343 +03 07 343 9 03_07_343 +04 03 343 10 04_03_343 +04 06 343 11 04_06_343 +05 03 343 12 05_03_343 +07 03 343 1 07_03_343 +11 03 343 13 11_03_343 +11 04 343 14 11_04_343 +SELECT a,count(b) FROM t1 GROUP BY a ORDER BY a FOR UPDATE SKIP LOCKED; +a count(b) +03 3 +04 2 +05 1 +07 1 +11 2 +SELECT d,a,b,c FROM t1 partition (p1,p9,p11,p17) ORDER BY d +FOR UPDATE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +SELECT d,a,b,c FROM t1 ORDER BY d FOR UPDATE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +SELECT d,a,b,c FROM t3 ORDER BY d FOR UPDATE SKIP LOCKED; +d a b c +1 07 03 343 +10 04 03 343 +11 04 06 343 +12 05 03 343 +13 11 03 343 +14 11 04 343 +7 03 03 343 +8 03 06 343 +9 03 07 343 +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t1, t2, t3; +DROP USER test@localhost; +DROP USER test2@localhost; +set @@global.read_only= @start_read_only; +set @@global.autocommit= @start_autocommit; +set default_storage_engine= default; diff --git a/mysql-test/suite/innodb/r/purge.result b/mysql-test/suite/innodb/r/purge.result new file mode 100644 index 00000000..ed14fad7 --- /dev/null +++ b/mysql-test/suite/innodb/r/purge.result @@ -0,0 +1,118 @@ +# Bug #12429576 - Test an assertion failure on purge. +CREATE TABLE t1_purge ( +A int, +B blob, C blob, D blob, E blob, +F blob, G blob, H blob, +PRIMARY KEY (B(767), C(767), D(767), E(767), A), +INDEX (A) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1_purge VALUES (1, +REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766), +REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766)); +CREATE TABLE t2_purge ( +A int PRIMARY KEY, +B blob, C blob, D blob, E blob, +F blob, G blob, H blob, I blob, +J blob, K blob, L blob, +INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t2_purge VALUES (1, +REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766), +REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766), +REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766)); +CREATE TABLE t3_purge ( +A int, +B varchar(800), C varchar(800), D varchar(800), E varchar(800), +F varchar(800), G varchar(800), H varchar(800), +PRIMARY KEY (B(767), C(767), D(767), E(767), A), +INDEX (A) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t3_purge SELECT * FROM t1_purge; +CREATE TABLE t4_purge ( +A int PRIMARY KEY, +B varchar(800), C varchar(800), D varchar(800), E varchar(800), +F varchar(800), G varchar(800), H varchar(800), I varchar(800), +J varchar(800), K varchar(800), L varchar(800), +INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t4_purge SELECT * FROM t2_purge; +DELETE FROM t1_purge; +DELETE FROM t2_purge; +DELETE FROM t3_purge; +DELETE FROM t4_purge; +SET @r=REPEAT('a',500); +CREATE TABLE t12637786(a int, +v1 varchar(500), v2 varchar(500), v3 varchar(500), +v4 varchar(500), v5 varchar(500), v6 varchar(500), +v7 varchar(500), v8 varchar(500), v9 varchar(500), +v10 varchar(500), v11 varchar(500), v12 varchar(500), +v13 varchar(500), v14 varchar(500), v15 varchar(500), +v16 varchar(500), v17 varchar(500), v18 varchar(500) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +CREATE INDEX idx1 ON t12637786(a,v1); +INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r); +UPDATE t12637786 SET a=1000; +DELETE FROM t12637786; +# Bug#12963823 - Test that the purge thread does not crash when +CREATE TABLE t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob, +i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob) +ENGINE=innodb ROW_FORMAT=dynamic; +SET @r = REPEAT('a', 767); +INSERT INTO t12963823 VALUES (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r); +CREATE INDEX ndx_a ON t12963823 (a(500)); +CREATE INDEX ndx_b ON t12963823 (b(500)); +CREATE INDEX ndx_c ON t12963823 (c(500)); +CREATE INDEX ndx_d ON t12963823 (d(500)); +CREATE INDEX ndx_e ON t12963823 (e(500)); +CREATE INDEX ndx_f ON t12963823 (f(500)); +CREATE INDEX ndx_k ON t12963823 (k(500)); +CREATE INDEX ndx_l ON t12963823 (l(500)); +SET @r = REPEAT('b', 500); +UPDATE t12963823 set a=@r,b=@r,c=@r,d=@r; +UPDATE t12963823 set e=@r,f=@r,g=@r,h=@r; +UPDATE t12963823 set i=@r,j=@r,k=@r,l=@r; +UPDATE t12963823 set m=@r,n=@r,o=@r,p=@r; +ALTER TABLE t12963823 DROP INDEX ndx_a; +ALTER TABLE t12963823 DROP INDEX ndx_b; +CREATE INDEX ndx_g ON t12963823 (g(500)); +CREATE INDEX ndx_h ON t12963823 (h(500)); +CREATE INDEX ndx_i ON t12963823 (i(500)); +CREATE INDEX ndx_j ON t12963823 (j(500)); +CREATE INDEX ndx_m ON t12963823 (m(500)); +CREATE INDEX ndx_n ON t12963823 (n(500)); +CREATE INDEX ndx_o ON t12963823 (o(500)); +CREATE INDEX ndx_p ON t12963823 (p(500)); +SHOW CREATE TABLE t12963823; +Table Create Table +t12963823 CREATE TABLE `t12963823` ( + `a` blob DEFAULT NULL, + `b` blob DEFAULT NULL, + `c` blob DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` blob DEFAULT NULL, + `f` blob DEFAULT NULL, + `g` blob DEFAULT NULL, + `h` blob DEFAULT NULL, + `i` blob DEFAULT NULL, + `j` blob DEFAULT NULL, + `k` blob DEFAULT NULL, + `l` blob DEFAULT NULL, + `m` blob DEFAULT NULL, + `n` blob DEFAULT NULL, + `o` blob DEFAULT NULL, + `p` blob DEFAULT NULL, + KEY `ndx_c` (`c`(500)), + KEY `ndx_d` (`d`(500)), + KEY `ndx_e` (`e`(500)), + KEY `ndx_f` (`f`(500)), + KEY `ndx_k` (`k`(500)), + KEY `ndx_l` (`l`(500)), + KEY `ndx_g` (`g`(500)), + KEY `ndx_h` (`h`(500)), + KEY `ndx_i` (`i`(500)), + KEY `ndx_j` (`j`(500)), + KEY `ndx_m` (`m`(500)), + KEY `ndx_n` (`n`(500)), + KEY `ndx_o` (`o`(500)), + KEY `ndx_p` (`p`(500)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +InnoDB 0 transactions not purged +DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; diff --git a/mysql-test/suite/innodb/r/purge_secondary.result b/mysql-test/suite/innodb/r/purge_secondary.result new file mode 100644 index 00000000..9801e985 --- /dev/null +++ b/mysql-test/suite/innodb/r/purge_secondary.result @@ -0,0 +1,169 @@ +CREATE TABLE t1 ( +a SERIAL, b CHAR(255) NOT NULL DEFAULT '', c BOOLEAN DEFAULT false, +l LINESTRING NOT NULL DEFAULT ST_linefromtext('linestring(448 -689, + 453 -684,451 -679,453 -677,458 -681,463 -681,468 -678,470 -676,470 -678, + 468 -675,472 -675,472 -675,474 -674,479 -676,477 -675,473 -676,475 1324, + 479 1319,484 1322,483 1323,486 1323,491 1328,492 1325,496 1325,498 1325, + 501 1330,498 1331,500 1331,504 1330,508 1329,512 1332,513 1337,518 1339, + 518 1339,513 1344,513 1344,512 1346,514 1351,515 1353,519 1358,518 1362, + 522 1365,525 1360,526 1362,527 1362,528 1367,525 1371,528 1366,532 1369, + 536 1374,539 1377,543 1379,539 1381,541 1382,543 1383,546 1388,549 1393, + 554 1393,554 1395,554 1392,550 1394,550 1392,546 1394,549 1397,550 1393, + 549 1394,554 1390,554 1391,549 1396,551 1396,547 1400,547 1402,551 1407, + 554 1412,554 1415,558 1418,463 -681,465 -677,465 -675,470 -670,470 -665, + 470 -660,470 -659,473 -656,476 -656,481 -655,482 -652,486 -654,486 -652, + 486 -648,491 -646,490 -651,494 -646,493 -644,493 -644,490 -644,491 2356, + 495 2359,495 2364,500 2359,503 5359,504 5364,509 5368,504 5367,499 5368, + 498 5371,498 5369,500 5370,504 5370,508 5370,511 5370,507 5374,508 5378, + 511 5382,507 5387,509 5389,512 5388,515 5393,520 5396,517 5397,517 5402, + 515 5404,520 5402,521 5405,525 5405,526 5408,530 7408,535 7413,533 7415, + 529 7412,532 7416,4532 7416,4534 7421,4533 7417,4536 7413,4536 7418, + 4540 3418,4545 3418,4549 3415,4551 3419,4554 3421,4559 3423,4559 3426, + 4557 3424,4561 3428,4558 3428,4563 3431,4565 3435,4569 3439,4569 3439, + 4569 3444,4567 3444,4572 3446,4577 3447,4581 3444,4581 3448,4584 3448, + 4579 3447,4580 3450,4583 3449,4583 3453,4587 3455,4588 3458,4593 3463, + 4598 3465,4601 3468,4598 3464,4598 3460,4593 5460,4595 5461,4600 5464, + 4600 5465,4601 5466,4606 5466,4608 5466,4605 5464,4608 5467,4607 5468, + 4609 5465,4614 5461,4618 5463,4621 5467,4623 5470,4622 5470,4622 5470, + 4625 6470,4627 6471,4627 6472,4627 6473,6627 6474,6625 6474,6628 6477, + 6633 6481,6633 6480,6637 6475,7637 6479,7638 6482,7643 6487,7644 6492, + 7647 6492,7648 6495,7646 6498,7650 6499,7646 6494,7644 6499,7644 6497, + 7644 6499,7647 6502,7649 6504,7650 6501,7647 6503,7649 6504,7650 6508, + 7651 6503,7652 6508,7655 6508,7650 6511,7655 6515,7658 6513,7663 6513, + 7665 6514,7669 6512,7667 6510,7664 6510,472 -675,477 -670,479 -666, + 482 -663,484 -668,484 -666,485 -664,481 -664,479 -659,482 -659,484 -658, + 483 -659,488 2341,493 2339,489 2338,491 2342,491 2346,494 2346,490 2348, + 493 2348,498 2349,498 2350,499 2349,502 2350,503 2348,506 2348,506 2348, + 507 2353,507 2355,504 2359,504 2364,504 2361,499 2365,502 2360,502 2358, + 503 2357,504 2353,504 2357,500 2356,497 2355,498 2355,500 2359,502 2361, + 505 2364,508 2364,506 2368,506 2370,504 2373,499 2373,496 2372,493 2377, + 497 2380,495 2383,496 7383,493 7386,497 7391,494 7387,495 7389,498 7392, + 498 7392,495 7395,493 7398,498 7401,498 7403,503 7400,498 8400,501 8401, + 503 8401,503 8401,501 10401,496 10396,491 10401,492 10399,493 10403, + 496 10403,491 10403,493 10407,489 10410,493 10407,489 10403,498 7403, + 497 7399,496 7403,500 7405,500 7407,503 7411,508 7415,511 7415,511 7420, + 515 7420,520 7423,523 7423,520 7427,523 7427,523 7427,522 7432,525 4432, + 527 4434,530 4437,534 4441,529 4446,529 4441,534 4436,537 4436,535 4437, + 532 4437,534 4432,535 4429,538 4430,542 4427,542 4431,538 4431,541 4431, + 541 4433,543 4433,545 4432,549 4428,552 4426,556 4427,557 4423,560 4427, + 561 4428,558 4430,559 4434,559 4432,561 4434,561 4437,563 4435,559 4430, + 561 4435,4561 4437,4566 4441,4568 4446,4568 4450,4569 4455,4565 4458, + 4561 4463,4561 9463,4564 9463,4565 9461,9565 9463,9560 9467,9560 9466, + 9555 9469,9555 9471,9559 9469,9557 9473,9553 9478,9555 9480,9557 9481, + 9557 9481,9557 9483,9562 9487,9558 9487,9558 9490,9561 9493,9562 9493, + 9557 9493,9560 9496,9555 9501,9553 9503,9553 9506,9557 9510,9558 9511, + 9561 9514,9563 9512,9568 9514,9567 9514,9567 13514,9570 13517,9566 13521, + 9571 13521,9571 13526,9573 13521,9571 13521,9576 10521,9580 10526,9582 10525, + 9584 10528,9584 10531,9584 10533,9589 10533,9588 10537,9588 10541,9589 10542, + 9593 10544,9595 10540,9597 10541,9600 10545,9601 15545,9603 15549,9605 15553, + 9601 15558,9601 15553,9605 15551,9605 15550,9605 15554,9607 15556,9605 15556, + 9604 15561,9607 15559,9603 15559,9603 15562,9604 15563,9608 15566,9612 15570, + 9617 15565,9622 15568,9627 15566,9628 15564,9629 15564,9633 15569,9636 15569, + 9634 15571,9634 15572,9636 15574,9634 15570,9629 15570,9631 15567,9629 15570, + 9626 15574,9626 15575,498 7401,502 7401,506 7397,506 7395,502 7398,497 7401, + 502 7402,505 7397,508 7400,504 7404,3504 7409,3505 7405,3508 7410,3511 7413, + 3511 7416,3511 7419,3511 7419,3513 7421,3517 7424,3519 7426,3520 11426, + 3523 11421,3527 11418,3530 11415,3530 11416,3533 11418,7533 11415,7531 11415, + 7531 11417,7536 11420,7541 11424,7543 11425,7543 11427,7543 11429,7540 11429, + 7542 11425,7541 11420,7542 11421,7542 11422,7540 11424,7540 11423,7543 11422, + 7546 11426,7550 11431,7553 11436,7555 16436,7553 16438,7558 16438,7559 16438, + 7560 16439,7565 16437,7560 16435,7563 16435,7566 16440,7566 16444,7564 16447, + 7559 16443,7561 16443,7566 16448,7570 16451,7574 16456,7578 16459, + 12578 16459,12578 20459,12577 20456,12581 20454,12585 20456,12585 20456, + 12585 20456,12583 20456,12579 20459,12580 20461,12580 20462,12580 20460, + 12585 20465,12586 20467,12590 20470,12590 20470,12589 20471,12584 20471, + 12589 20471,9589 20472,9594 20472,9595 20472,9596 20477,9598 20482, + 9603 20480,9608 20484,9613 20484,9610 20486,9608 20488,9608 20489,9610 20489, + 9614 20486,9619 20481,9620 20481,9618 21481,9621 21483,9626 21483,9628 21485, + 9623 21487,9622 21490,9626 21493,9621 21495,9626 21498,9622 21499,9624 21504, + 9625 21499,9629 21501,9633 21498,9637 21495,9639 21498,9644 21501,9557 9481, + 9560 9485,9561 9490,9563 9488,9560 9486,9558 9488,9561 9492,9563 9495, + 9567 9492,9567 9488,9564 9490,9559 9495,9559 9498,9557 9502,9562 9506, + 9564 9509,9569 9512,9569 9516,9569 9518,9569 9515,9571 9513,9571 9512, + 9573 9513,9578 9516,9581 9516,9585 11516,9585 11521,9590 10521,9586 10524, + 9589 10529,9589 10527,9589 10527,9594 10532,9594 10534,9598 10536,9598 10540, + 9600 10542,9604 10538,9607 10538,9609 10543,9613 10538,9613 10533,9613 10537, + 9610 10537,9614 10542,9609 10542,9610 10543,9610 10548,9611 10553,9616 7553, + 9620 7553,9621 7557,9618 7559,9618 7554,9622 7557,9622 7561,9622 7556, + 9622 7560,9619 7560,9620 7565,9622 7563,9627 7566,9630 7570,9630 7571, + 9632 7573,9637 7576,9639 7578,9640 7576,9640 7579,9640 7575,9642 7570, + 9646 7570,9651 7574,9653 7577,9652 7572,9653 7576,9653 7576,9651 7581, + 9656 7585,9660 7586,9659 7591,9657 7594,9661 7598,9664 7602,9668 12602, + 9673 12604,9676 12606,9679 12602,9682 12605,9677 12610,9674 12606,9674 12601, + 9674 12603,9672 9603,9668 9605,9671 9606,9668 9611,9668 9606,9671 9611, + 9675 9615,9677 9620,9678 9622,9679 9624,9684 9626,9685 9627,9685 9622, + 9685 9626,9689 9628,9694 9633,9699 9637,9699 9637,9704 9636,9708 9637, + 9709 9638,9707 9639,9705 9642,9707 9647,9710 9649,9711 9653,9716 9649, + 9716 9648,9720 9650,9721 9648,9723 9648,9726 4648,12726 4653,12731 4655, + 12734 4660,12730 4661,12733 4664,12733 4665,12735 4670,12737 4674,12741 4674, + 12738 4675,12740 4675,12737 4675,12742 4678,12743 4681,12746 4677)'), +INDEX(b,c), SPATIAL INDEX `sidx`(l) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 () VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +SELECT LENGTH(l) FROM t1; +LENGTH(l) +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +11197 +INSERT INTO t1 (a) SELECT NULL FROM t1; +INSERT INTO t1 (a) SELECT NULL FROM t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +UPDATE t1 SET c=true, l=ST_linefromtext('linestring(0 0,1 1,2 2)'); +DELETE FROM t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +InnoDB 0 transactions not purged +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT OTHER_INDEX_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE NAME='test/t1'; +OTHER_INDEX_SIZE +1 +ALTER TABLE t1 DROP INDEX `sidx`; +INSERT INTO t1 (a) SELECT * FROM seq_1_to_544; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +SELECT (variable_value > 0) FROM information_schema.global_status +WHERE LOWER(variable_name) LIKE 'INNODB_BUFFER_POOL_PAGES_FLUSHED'; +(variable_value > 0) +1 +# Note: The OTHER_INDEX_SIZE does not cover any SPATIAL INDEX. +# To test that all indexes were emptied, replace DROP TABLE +# with the following, and examine the root pages in t1.ibd: +# FLUSH TABLES t1 FOR EXPORT; +# UNLOCK TABLES; +DROP TABLE t1; +# +# MDEV-29666 InnoDB fails to purge secondary index records +# when indexed virtual columns exist +# +CREATE TABLE t1 (a INT, b INT, a1 INT AS(a) VIRTUAL, +INDEX(a1),INDEX(b)) ENGINE=InnoDB; +INSERT INTO t1 SET a=1, b=1; +UPDATE t1 SET a=2, b=3; +InnoDB 0 transactions not purged +FLUSH TABLE t1 FOR EXPORT; +page 4: N_RECS=0x0001 +page 5: N_RECS=0x0001 +UNLOCK TABLES; +DROP TABLE t1; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/purge_thread_shutdown.result b/mysql-test/suite/innodb/r/purge_thread_shutdown.result new file mode 100644 index 00000000..747fe91c --- /dev/null +++ b/mysql-test/suite/innodb/r/purge_thread_shutdown.result @@ -0,0 +1,27 @@ +connect con1, localhost, root; +create table t1 (a int) engine=innodb; +insert t1 values (1),(2),(3),(4); +delete from t1 where a=1; +select user,state from information_schema.processlist order by 2; +user state +root +root Filling schema table +set global debug_dbug='+d,only_kill_system_threads'; +set global innodb_fast_shutdown=0; +shutdown; +connection default; +disconnect con1; +select user,state from information_schema.processlist order by 2; +user state +root Filling schema table +set global innodb_fast_shutdown=1; +select user,state from information_schema.processlist order by 2; +user state +root Filling schema table +delete from t1 where a=3; +set global innodb_fast_shutdown=0; +ERROR 42000: Variable 'innodb_fast_shutdown' can't be set to the value of '0' +kill ID; +Got one of the listed errors +# restart +drop table t1; diff --git a/mysql-test/suite/innodb/r/read_only_recover_committed.result b/mysql-test/suite/innodb/r/read_only_recover_committed.result new file mode 100644 index 00000000..0cdf4ec1 --- /dev/null +++ b/mysql-test/suite/innodb/r/read_only_recover_committed.result @@ -0,0 +1,82 @@ +connect con1, localhost, root; +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t VALUES(1); +BEGIN; +INSERT INTO t VALUES(2); +UPDATE t SET a=20 WHERE a=2; +connect con2, localhost, root; +# Normal MariaDB shutdown would roll back the above transaction. +# We want the transaction to remain open, so we will kill the server +# after ensuring that any non-transactional files are clean. +FLUSH TABLES; +# Create another transaction that will be recovered as COMMITTED. +BEGIN; +SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL committed WAIT_FOR ever'; +COMMIT; +connection default; +SET DEBUG_SYNC='now WAIT_FOR committed'; +# Ensure that the above transactions become durable. +SET GLOBAL innodb_flush_log_at_trx_commit=1; +BEGIN; +INSERT INTO t VALUES(-10000); +DELETE FROM t WHERE a=-10000; +COMMIT; +# restart: --innodb-force-recovery=3 +disconnect con1; +disconnect con2; +SELECT * FROM t; +a +1 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t; +a +1 +20 +UPDATE t SET a=3 WHERE a=1; +# restart: --innodb-read-only +SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output; +# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. +# In earlier versions, this would return the last committed version +# (only a=3; no record for a=20)! +SELECT * FROM t; +a +3 +20 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t; +a +3 +20 +# restart: --innodb-force-recovery=5 +# +# MDEV-15418 innodb_force_recovery=5 displays bogus warnings +# about too new transaction identifier +# +# With the fix, innodb_force_recovery=5 implies READ UNCOMMITTED. +SELECT * FROM t; +a +3 +20 +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; +SELECT * FROM t; +a +3 +20 +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT * FROM t; +a +3 +20 +# +# MDEV-27332 SIGSEGV in fetch_data_into_cache +# +BEGIN; +SELECT trx_state FROM information_schema.innodb_trx; +trx_state +COMMIT; +# restart +SELECT * FROM t; +a +3 +DROP TABLE t; +FOUND 1 /Rolled back recovered transaction [^0]/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/read_only_recovery.result b/mysql-test/suite/innodb/r/read_only_recovery.result new file mode 100644 index 00000000..add0da94 --- /dev/null +++ b/mysql-test/suite/innodb/r/read_only_recovery.result @@ -0,0 +1,44 @@ +connect con1, localhost, root; +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t VALUES(1); +BEGIN; +INSERT INTO t VALUES(2); +DELETE FROM t WHERE a=2; +connection default; +# Normal MariaDB shutdown would roll back the above transaction. +# We want the transaction to remain open, so we will kill the server +# after ensuring that any non-transactional files are clean. +FLUSH TABLES; +# Ensure that the above incomplete transaction becomes durable. +SET GLOBAL innodb_flush_log_at_trx_commit=1; +BEGIN; +INSERT INTO t VALUES(0); +DELETE FROM t WHERE a=0; +COMMIT; +# restart: --innodb-force-recovery=3 +disconnect con1; +SELECT * FROM t; +a +1 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t; +a +1 +UPDATE t SET a=3 WHERE a=1; +# restart: --innodb-read-only +# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. +# In earlier versions, this would return the last committed version +# (empty table)! +SELECT * FROM t; +a +3 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t; +a +3 +SET GLOBAL innodb_max_purge_lag_wait=0; +# restart +SELECT * FROM t; +a +3 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/readahead.result b/mysql-test/suite/innodb/r/readahead.result new file mode 100644 index 00000000..962434c7 --- /dev/null +++ b/mysql-test/suite/innodb/r/readahead.result @@ -0,0 +1,7 @@ +# Bug#25330449 ASSERT SIZE==SPACE->SIZE DURING BUF_READ_AHEAD_RANDOM +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=INNODB ROW_FORMAT=COMPRESSED; +# restart +SET @saved = @@GLOBAL.innodb_random_read_ahead; +SET GLOBAL innodb_random_read_ahead = 1; +DROP TABLE t1; +SET GLOBAL innodb_random_read_ahead = @saved; diff --git a/mysql-test/suite/innodb/r/recovery_memory.result b/mysql-test/suite/innodb/r/recovery_memory.result new file mode 100644 index 00000000..9aba9bcc --- /dev/null +++ b/mysql-test/suite/innodb/r/recovery_memory.result @@ -0,0 +1,32 @@ +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +CREATE TABLE t1(c TEXT, KEY(c(3072)))ENGINE=InnoDB; +CREATE PROCEDURE dorepeat() +LOOP +INSERT INTO t1 VALUES ('abc'); +UPDATE t1 SET c='cba'; +END LOOP +| +connect con1,localhost,root,,,; +CALL dorepeat(); +connection default; +# restart: --innodb_buffer_pool_size=5242880 +DROP TABLE t1; +DROP PROCEDURE dorepeat; +# +# MDEV-30552 InnoDB recovery crashes when error +# handling scenario +# +SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM seq_1_to_65536; +# restart: with restart_parameters +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/recovery_shutdown.result b/mysql-test/suite/innodb/r/recovery_shutdown.result new file mode 100644 index 00000000..6f7ca6e0 --- /dev/null +++ b/mysql-test/suite/innodb/r/recovery_shutdown.result @@ -0,0 +1,68 @@ +FLUSH TABLES; +call mtr.add_suppression("Found 1 prepared XA transactions"); +# +# MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup +# while rolling back recovered incomplete transactions +# +connect con$c,localhost,root,,; +CREATE TABLE t8 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +XA START 'x'; +INSERT INTO t8 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t8 SET a=a+100, b=a; +DELETE FROM t8; +XA END 'x'; +XA PREPARE 'x'; +connect con$c,localhost,root,,; +CREATE TABLE t7 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t7 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t7 SET a=a+100, b=a; +DELETE FROM t7; +connect con$c,localhost,root,,; +CREATE TABLE t6 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t6 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t6 SET a=a+100, b=a; +DELETE FROM t6; +connect con$c,localhost,root,,; +CREATE TABLE t5 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t5 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t5 SET a=a+100, b=a; +DELETE FROM t5; +connect con$c,localhost,root,,; +CREATE TABLE t4 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t4 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t4 SET a=a+100, b=a; +DELETE FROM t4; +connect con$c,localhost,root,,; +CREATE TABLE t3 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t3 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t3 SET a=a+100, b=a; +DELETE FROM t3; +connect con$c,localhost,root,,; +CREATE TABLE t2 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t2 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t2 SET a=a+100, b=a; +DELETE FROM t2; +connect con$c,localhost,root,,; +CREATE TABLE t1 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 (a) SELECT NULL FROM seq_1_to_100; +UPDATE t1 SET a=a+100, b=a; +DELETE FROM t1; +INSERT INTO t1(a) SELECT NULL FROM seq_1_to_1600; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +CREATE TABLE MDEV_29559 (a TINYINT UNSIGNED PRIMARY KEY, KEY(a)) ENGINE=InnoDB; +INSERT INTO MDEV_29559 VALUES (0x69); +FLUSH TABLES; +# restart +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 x +# restart +DROP TABLE MDEV_29559; diff --git a/mysql-test/suite/innodb/r/rename_table.result b/mysql-test/suite/innodb/r/rename_table.result new file mode 100644 index 00000000..0ed56005 --- /dev/null +++ b/mysql-test/suite/innodb/r/rename_table.result @@ -0,0 +1,42 @@ +call mtr.add_suppression("InnoDB: In RENAME TABLE table `test`.`t4` is referenced in foreign key constraints which are not compatible with the new table definition."); +CREATE DATABASE test_jfg; +CREATE DATABASE test_jfg2; +CREATE TABLE test_jfg.test (a int unsigned PRIMARY KEY) ENGINE=InnoDB; +RENAME TABLE test_jfg.test TO test_jfg2.test; +SELECT REPLACE(filename,'\\','/') path +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE filename LIKE '%test%'; +path +./test_jfg2/test.ibd +DROP DATABASE test_jfg; +# restart +DROP DATABASE test_jfg2; +CREATE DATABASE abc_def; +CREATE DATABASE abc_def2; +CREATE TABLE abc_def.test (a int unsigned PRIMARY KEY) ENGINE=InnoDB; +RENAME TABLE abc_def.test TO abc_def2.test1; +SELECT REPLACE(filename,'\\','/') path +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE filename LIKE '%test%'; +path +./abc_def2/test1.ibd +DROP DATABASE abc_def; +# restart +DROP DATABASE abc_def2; +call mtr.add_suppression("InnoDB: (Operating system error|Error number \\d+ means|Cannot rename file)"); +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +RENAME TABLE t1 TO non_existing_db.t1; +ERROR HY000: Error on rename of './test/t1' to './non_existing_db/t1' (errno: 168 "Unknown (generic) error from engine") +FOUND 1 /\[ERROR\] InnoDB: Cannot rename file '.*t1\.ibd' to '.*non_existing_db/ in mysqld.1.err +DROP TABLE t1; +# +# MDEV-25509 Atomic DDL: Assertion `err != DB_DUPLICATE_KEY' +# fails after previous error upon multi-RENAME +# +SET FOREIGN_KEY_CHECKS= OFF; +CREATE TABLE t1 (pk INT PRIMARY KEY, f INT, FOREIGN KEY (f) REFERENCES t4 (x)) ENGINE=InnoDB; +ALTER TABLE t1 DROP KEY f; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +RENAME TABLE t1 TO t3, t3 TO t4; +ERROR HY000: Error on rename of './test/t3' to './test/t4' (errno: 150 "Foreign key constraint is incorrectly formed") +RENAME TABLE t2 TO t3; +DROP TABLE t3, t1; +SET FOREIGN_KEY_CHECKS=DEFAULT; diff --git a/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff new file mode 100644 index 00000000..b36ed067 --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:12:28.602794678 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 5242880 for innodb_page_size=16384 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff new file mode 100644 index 00000000..8fa05781 --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:07:57.402230887 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 10485760 for innodb_page_size=32768 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff new file mode 100644 index 00000000..7d084636 --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:13:56.397475513 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 2097152 for innodb_page_size=4096 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff new file mode 100644 index 00000000..3ac9f45b --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:11:32.418759095 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 20971520 for innodb_page_size=65536 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff new file mode 100644 index 00000000..4da55ebf --- /dev/null +++ b/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff @@ -0,0 +1,16 @@ +--- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 ++++ suite/innodb/r/restart.reject 2022-01-19 08:13:11.027788852 +1100 +@@ -32,10 +32,10 @@ + SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; + SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +-ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' + SHOW WARNINGS; + Level Code Message +-Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +-Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' ++Warning 1210 innodb_buffer_pool_size must be at least 3145728 for innodb_page_size=8192 ++Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' + EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); + SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart.result b/mysql-test/suite/innodb/r/restart.result new file mode 100644 index 00000000..95d79a0a --- /dev/null +++ b/mysql-test/suite/innodb/r/restart.result @@ -0,0 +1,52 @@ +# +# MDEV-15333 MariaDB (still) slow start +# +# FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files +# of tables with .isl file or DATA DIRECTORY attribute. +call mtr.add_suppression("\\[ERROR\\] InnoDB: MySQL-8\\.0 tablespace in "); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Restart in MySQL for migration/recovery\\."); +# FIXME: This is much more noisy than MariaDB 10.1! +call mtr.add_suppression("\\[ERROR\\] InnoDB: Tablespace flags are invalid in datafile: .*test.t[rcd]\\.ibd"); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\."); +call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace for test/td because it could not be opened\\."); +CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT +PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9; +CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC +STATS_PERSISTENT=0 DATA DIRECTORY='MYSQL_TMP_DIR'; +# restart: --skip-innodb-buffer-pool-load-at-startup +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +# restart +SELECT * FROM tr; +a +SELECT * FROM tc; +a +SELECT * FROM td; +a +DROP TABLE tr,tc,td; +# +# MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup +# +SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; +SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; +EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); +ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' +SHOW WARNINGS; +Level Code Message +Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE +Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' +EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); +SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; +# +# MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +# +FOUND 1 /InnoDB: MySQL-8\.0 tablespace in \./ibdata1/ in attempted_start.err +# restart +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/innodb/r/row_format_redundant.result b/mysql-test/suite/innodb/r/row_format_redundant.result new file mode 100644 index 00000000..d95c37f1 --- /dev/null +++ b/mysql-test/suite/innodb/r/row_format_redundant.result @@ -0,0 +1,76 @@ +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 +SET GLOBAL innodb_file_per_table=1; +# +# Bug#21644827 - FTS, ASSERT !SRV_READ_ONLY_MODE || M_IMPL.M_LOG_MODE == +# MTR_LOG_NO_REDO +# +SET GLOBAL innodb_file_per_table=ON; +create table t1 (a int not null, d varchar(15) not null, b +varchar(198) not null, c char(156)) engine=InnoDB +row_format=redundant; +create temporary table t like t1; +insert into t values(123, 'abcdef', 'jghikl', 'mnop'); +insert into t values(456, 'abcdef', 'jghikl', 'mnop'); +insert into t values(789, 'abcdef', 'jghikl', 'mnop'); +insert into t values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf'); +insert into t1 select a,d,b,c from t, seq_1_to_1024; +SET GLOBAL innodb_file_per_table=OFF; +create table t2 (a int not null, d varchar(15) not null, b +varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB +row_format=redundant; +insert into t2 select a,d,b,c from t, seq_1_to_1024; +create table t3 (a int not null, d varchar(15) not null, b varchar(198), +c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB +row_format=redundant; +insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa'); +insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa'); +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --innodb-read-only +SELECT COUNT(*) FROM t1; +COUNT(*) +4096 +SELECT COUNT(*) FROM t2; +COUNT(*) +4096 +SELECT COUNT(*) FROM t3; +COUNT(*) +2 +TRUNCATE TABLE t1; +ERROR HY000: Table 't1' is read only +TRUNCATE TABLE t2; +ERROR HY000: Table 't2' is read only +TRUNCATE TABLE t3; +ERROR HY000: Table 't3' is read only +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --skip-innodb-fast-shutdown +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +corrupted SYS_TABLES.MIX_LEN for test/t1 +corrupted SYS_TABLES.MIX_LEN for test/t2 +corrupted SYS_TABLES.MIX_LEN for test/t3 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --skip-innodb-fast-shutdown +TRUNCATE TABLE t1; +ERROR 42S02: Table 'test.t1' doesn't exist in engine +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +SELECT COUNT(*) FROM t1; +ERROR 42S02: Table 'test.t1' doesn't exist in engine +SELECT COUNT(*) FROM t2; +COUNT(*) +0 +SELECT COUNT(*) FROM t3; +COUNT(*) +0 +RENAME TABLE t1 TO tee_one; +ERROR HY000: Error on rename of './test/t1' to './test/tee_one' (errno: 155 "The table does not exist in the storage engine") +DROP TABLE t1; +Warnings: +Warning 1932 Table 'test.t1' doesn't exist in engine +DROP TABLE t2,t3; +FOUND 6 /\[ERROR\] InnoDB: Table test/t1 in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b/ in mysqld.1.err +# restart +ib_buffer_pool +ib_logfile0 +ibdata1 +db.opt diff --git a/mysql-test/suite/innodb/r/row_lock.result b/mysql-test/suite/innodb/r/row_lock.result new file mode 100644 index 00000000..bfd7656d --- /dev/null +++ b/mysql-test/suite/innodb/r/row_lock.result @@ -0,0 +1,23 @@ +CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE TABLE t2 (c INT, d INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,1), (2,2); +CREATE TABLE t3 (e INT) ENGINE=InnoDB; +CREATE TABLE t4 ENGINE=InnoDB AS SELECT * FROM t2; +connect con11,localhost,root,,test; +BEGIN; +UPDATE t1 SET a = 0 WHERE a = ( SELECT e FROM t3 ); +connect con12,localhost,root,,test; +UPDATE t4 SET d = 1 WHERE d in ( SELECT a FROM t1 ) ORDER BY c LIMIT 6; +connection con11; +UPDATE t4 SET d = 9; +connection con12; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection con11; +commit; +connection default; +disconnect con12; +disconnect con11; +drop table t1,t2,t3,t4; +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +call mtr.add_suppression("Sort aborted.*"); diff --git a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result new file mode 100644 index 00000000..21085e4c --- /dev/null +++ b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result @@ -0,0 +1,84 @@ +call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); +SET innodb_strict_mode = 0; +SET @@global.log_warnings = 3; +CREATE TABLE t1 ( +col_1 TEXT +,col_2 TEXT +,col_3 TEXT +,col_4 TEXT +,col_5 TEXT +,col_6 TEXT +,col_7 TEXT +,col_8 TEXT +,col_9 TEXT +,col_10 TEXT +,col_11 TEXT +) ENGINE=INNODB ROW_FORMAT=COMPACT; +Warnings: +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +TRUNCATE TABLE t1; +Warnings: +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +Warnings: +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +ALTER TABLE t1 FORCE; +Warnings: +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +SET innodb_strict_mode = ON; +TRUNCATE TABLE t1; +Warnings: +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +Warnings: +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +ALTER TABLE t1 FORCE; +Warnings: +Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +DROP TABLE t1; +SET @@global.log_warnings = 2; +# +# MDEV-20194 Warnings inconsistently issued upon CHECK on +# table from older versions +# +set global innodb_compression_level=1; +CREATE TABLE t1( +f1 INT, f2 CHAR(200), f3 CHAR(200), +f4 CHAR(200), f5 CHAR(200), f6 CHAR(200), +f7 CHAR(200), f8 CHAR(200), f9 CHAR(106), +PRIMARY KEY(f1, f2(20), f3(20), f4(20)) +) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, repeat('a', 200), repeat('b', 200), +repeat('c', 200), repeat('d', 200), +repeat('d', 200), repeat('e', 200), +repeat('f', 200), repeat('g', 106) FROM seq_1_to_20; +DROP TABLE t1; +set global innodb_compression_level=default; +CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200), +f4 char(200), f5 char(200), f6 char(200), +f7 char(200), f8 char(200), f9 char(200), +f10 char(200), f11 char(200), f12 char(200), +f13 char(200), f14 char(200), f15 char(200), +f16 char(200), f17 char(200), f18 char(200), +f19 char(200), f20 char(200), f21 char(200), +f22 char(200), f23 char(200), f24 char(200), +f25 char(200), f26 char(200), f27 char(200), +f28 char(200), f29 char(200), f30 char(200), +f31 char(200), f32 char(200), f33 char(200), +primary key(f1(10), f2(10), f3(10), f4(10), +f5(10), f6(10), f7(10), f8(10), +f9(10), f10(10), f11(10), f12(10), +f13(10), f14(10), f15(10), f16(10), +f17(10), f18(10), f19(10), f20(10), +f21(10), f22(10), f23(10), f24(10), +f25(10), f26(10), f27(10), f28(10), +f29(10), f30(10), f31(10), f32(10), +f33(10))) +ENGINE=InnoDB; +ERROR 42000: Too many key parts specified; max 32 parts allowed diff --git a/mysql-test/suite/innodb/r/scrub.result b/mysql-test/suite/innodb/r/scrub.result new file mode 100644 index 00000000..4b976c32 --- /dev/null +++ b/mysql-test/suite/innodb/r/scrub.result @@ -0,0 +1,12 @@ +SET GLOBAL +innodb_file_per_table=OFF, +innodb_immediate_scrub_data_uncompressed=ON; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +f3 INT NOT NULL, INDEX(f1), +INDEX(f2), INDEX(f3))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384; +INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384; +INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384; +DROP TABLE t1; +SET GLOBAL innodb_max_purge_lag_wait=0; +# restart diff --git a/mysql-test/suite/innodb/r/scrub_debug.result b/mysql-test/suite/innodb/r/scrub_debug.result new file mode 100644 index 00000000..1e60fb73 --- /dev/null +++ b/mysql-test/suite/innodb/r/scrub_debug.result @@ -0,0 +1,19 @@ +SET @save_debug=@@GLOBAL.INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG; +SET @save_scrub=@@GLOBAL.INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED; +SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED=1; +SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2; +CREATE TABLE t1(f1 INT AUTO_INCREMENT PRIMARY KEY, +f2 VARCHAR(256) GENERATED ALWAYS as('repairman'), +INDEX idx(f2))ENGINE= InnoDB; +INSERT INTO t1(f1) SELECT seq FROM seq_1_to_50; +FLUSH TABLE t1 FOR EXPORT; +FOUND 108 /repairman/ in t1.ibd +UNLOCK TABLES; +ALTER TABLE t1 DROP INDEX idx; +InnoDB 0 transactions not purged +FLUSH TABLE t1 FOR EXPORT; +NOT FOUND /repairman/ in t1.ibd +UNLOCK TABLES; +DROP TABLE t1; +SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=@save_debug; +SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED=@save_scrub; diff --git a/mysql-test/suite/innodb/r/skip_locked_nowait.result b/mysql-test/suite/innodb/r/skip_locked_nowait.result new file mode 100644 index 00000000..5ff7ef44 --- /dev/null +++ b/mysql-test/suite/innodb/r/skip_locked_nowait.result @@ -0,0 +1,205 @@ +connect con1,localhost,root,,; +SET SESSION innodb_lock_wait_timeout=1; +connection default; +SET SESSION innodb_lock_wait_timeout=1; +# Case 1: Test primary index +CREATE TABLE t1( +seat_id INT, +state INT, +PRIMARY KEY(seat_id) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,0), (2,0), (3,0), (4,0); +BEGIN; +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE; +seat_id state +1 0 +2 0 +connection con1; +BEGIN; +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE; +seat_id state +1 0 +2 0 +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE SKIP LOCKED; +seat_id state +1 0 +2 0 +SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE SKIP LOCKED; +seat_id state +3 0 +4 0 +SELECT * FROM t1 WHERE seat_id > 0 LIMIT 2 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE seat_id > 0 LIMIT 2 FOR UPDATE SKIP LOCKED; +seat_id state +3 0 +4 0 +COMMIT; +connection default; +SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE; +seat_id state +1 0 +2 0 +connection con1; +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 LIMIT 2 LOCK IN SHARE MODE SKIP LOCKED; +seat_id state +3 0 +4 0 +SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 LIMIT 2 FOR UPDATE SKIP LOCKED; +seat_id state +3 0 +4 0 +SELECT * FROM t1 WHERE seat_id > 0 LIMIT 2 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE seat_id > 0 LIMIT 2 FOR UPDATE SKIP LOCKED; +seat_id state +3 0 +4 0 +COMMIT; +connection default; +COMMIT; +DROP TABLE t1; +# Case 2: Test primary index & secondary index +CREATE TABLE t1( +seat_id INT, +row_id INT, +state INT, +PRIMARY KEY(seat_id), +KEY(row_id) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1,0), (2,1,0), (3,2,0), (4,2,0); +# Test secondary key +BEGIN; +SELECT * FROM t1 WHERE state = 0 AND row_id = 1 LIMIT 1 FOR UPDATE NOWAIT; +seat_id row_id state +1 1 0 +connection con1; +BEGIN; +SELECT * FROM t1 WHERE state = 0 AND row_id = 1 LIMIT 1 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 AND row_id = 1 LIMIT 1 FOR UPDATE SKIP LOCKED; +seat_id row_id state +2 1 0 +SELECT * FROM t1 WHERE state = 0 AND row_id > 0 LIMIT 1 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 AND row_id > 0 LIMIT 1 FOR UPDATE SKIP LOCKED; +seat_id row_id state +2 1 0 +SELECT * FROM t1 WHERE state = 0 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 FOR UPDATE SKIP LOCKED; +seat_id row_id state +2 1 0 +3 2 0 +4 2 0 +COMMIT; +connection default; +COMMIT; +BEGIN; +SELECT * FROM t1 WHERE seat_id = 1 FOR UPDATE NOWAIT; +seat_id row_id state +1 1 0 +connection con1; +BEGIN; +SELECT * FROM t1 WHERE state = 0 AND row_id = 1 LIMIT 1 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 AND row_id = 1 LIMIT 1 FOR UPDATE SKIP LOCKED; +seat_id row_id state +2 1 0 +SELECT * FROM t1 WHERE state = 0 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE state = 0 FOR UPDATE SKIP LOCKED; +seat_id row_id state +2 1 0 +3 2 0 +4 2 0 +COMMIT; +connection default; +COMMIT; +DROP TABLE t1; +# Case 3: Test primary index & spatial index +CREATE TABLE t1( +seat_id INT, +pos POINT NOT NULL, +state INT, +PRIMARY KEY(seat_id), +SPATIAL KEY(pos) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,ST_PointFromText('POINT(1 0)'),0), +(2,ST_PointFromText('POINT(1 1)'),0), +(3,ST_PointFromText('POINT(2 0)'),0), +(4,ST_PointFromText('POINT(2 1)'),0), +(5,ST_PointFromText('POINT(3 0)'),0), +(6,ST_PointFromText('POINT(3 1)'),0); +BEGIN; +SET @g = ST_GeomFromText('POLYGON((0 0,0 2,2 2,0 2,0 0))'); +SELECT seat_id, state, ST_AsText(pos) FROM t1 FORCE INDEX (pos) +WHERE state = 0 AND MBRWithin(pos, @g) FOR UPDATE NOWAIT; +seat_id state ST_AsText(pos) +2 0 POINT(1 1) +connection con1; +BEGIN; +SET @g = ST_GeomFromText('POLYGON((0 0,0 4,4 4,0 4,0 0))'); +SELECT seat_id, state, ST_AsText(pos) FROM t1 FORCE INDEX (pos) +WHERE state = 0 AND MBRWithin(pos, @g) FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT seat_id, state, ST_AsText(pos) FROM t1 +WHERE state = 0 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT seat_id, state, ST_AsText(pos) FROM t1 +WHERE state = 0 FOR UPDATE SKIP LOCKED; +seat_id state ST_AsText(pos) +5 0 POINT(3 0) +6 0 POINT(3 1) +COMMIT; +connection default; +COMMIT; +connection con1; +SET @g = ST_GeomFromText('POLYGON((0 0,0 3,3 3,0 3,0 0))'); +SELECT seat_id, state, ST_AsText(pos) FROM t1 FORCE INDEX (pos) +WHERE state = 0 AND MBRWithin(pos, @g) FOR UPDATE; +seat_id state ST_AsText(pos) +4 0 POINT(2 1) +2 0 POINT(1 1) +connection default; +BEGIN; +SELECT seat_id, state, ST_AsText(pos) FROM t1 +WHERE seat_id = 4 FOR UPDATE NOWAIT; +seat_id state ST_AsText(pos) +4 0 POINT(2 1) +connection con1; +SELECT seat_id, state, ST_AsText(pos) FROM t1 FORCE INDEX (pos) +WHERE state = 0 AND MBRWithin(pos, @g) FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT seat_id, state, ST_AsText(pos) FROM t1 FORCE INDEX (pos) +WHERE state = 0 AND MBRWithin(pos, @g) FOR UPDATE SKIP LOCKED; +seat_id state ST_AsText(pos) +2 0 POINT(1 1) +SELECT seat_id, state, ST_AsText(pos) FROM t1 +WHERE state = 0 FOR UPDATE NOWAIT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT seat_id, state, ST_AsText(pos) FROM t1 +WHERE state = 0 FOR UPDATE SKIP LOCKED; +seat_id state ST_AsText(pos) +1 0 POINT(1 0) +2 0 POINT(1 1) +3 0 POINT(2 0) +5 0 POINT(3 0) +6 0 POINT(3 1) +connection default; +COMMIT; +DROP TABLE t1; +disconnect con1; diff --git a/mysql-test/suite/innodb/r/skip_symbolic_links.result b/mysql-test/suite/innodb/r/skip_symbolic_links.result new file mode 100644 index 00000000..42d42ef0 --- /dev/null +++ b/mysql-test/suite/innodb/r/skip_symbolic_links.result @@ -0,0 +1,56 @@ +SELECT @@have_symlink; +@@have_symlink +DISABLED +CREATE TABLE t1(a INT) ENGINE=InnoDB DATA DIRECTORY 'MYSQL_TMP_DIR'; +Warnings: +Warning 1618 option ignored +DROP TABLE t1; +CREATE TABLE t1(a INT) ENGINE=InnoDB; +ALTER TABLE t1 DATA DIRECTORY 'MYSQL_TMP_DIR'; +Warnings: +Warning 1618 option ignored +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# restart: --symbolic-links +CREATE TABLE t1(a INT PRIMARY KEY, b INT) ENGINE=InnoDB +DATA DIRECTORY 'MYSQL_TMP_DIR'; +CREATE TABLE t2(a INT PRIMARY KEY, b INT) ENGINE=InnoDB +DATA DIRECTORY 'MYSQL_TMP_DIR'; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +# restart +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +Warnings: +Warning 1618 option ignored +ALTER TABLE t2 FORCE, ALGORITHM=COPY; +Warnings: +Warning 1618 option ignored +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +Warnings: +Warning 1618 option ignored +t1.ibd +DROP TABLE t2; +RENAME TABLE t1 TO t2; +ALTER TABLE t2 ADD UNIQUE INDEX(b), RENAME TO t3; +Warnings: +Warning 1618 option ignored +ALTER TABLE t3 RENAME TO t2; +ALTER TABLE t2 DROP INDEX b, RENAME TO t1; +Warnings: +Warning 1618 option ignored +ALTER TABLE t1 CHANGE b c INT; +Warnings: +Warning 1618 option ignored +ALTER TABLE t1 CHANGE c b INT NOT NULL; +Warnings: +Warning 1618 option ignored +t1.ibd +TRUNCATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/snapshot.result b/mysql-test/suite/innodb/r/snapshot.result new file mode 100644 index 00000000..fa4ec2bd --- /dev/null +++ b/mysql-test/suite/innodb/r/snapshot.result @@ -0,0 +1,10 @@ +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect con1,localhost,root,,test; +CREATE TABLE IF NOT EXISTS t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=InnoDB; +connection default; +UPDATE t1 SET i = 0; +ERROR HY000: Table definition has changed, please retry transaction +UPDATE t1 SET pk = 0; +ERROR HY000: Table definition has changed, please retry transaction +commit; +drop table t1; diff --git a/mysql-test/suite/innodb/r/sp_temp_table.result b/mysql-test/suite/innodb/r/sp_temp_table.result new file mode 100644 index 00000000..0361e8b8 --- /dev/null +++ b/mysql-test/suite/innodb/r/sp_temp_table.result @@ -0,0 +1,253 @@ +# +# Bug #19306524 FAILING ASSERTION WITH TEMP TABLE FOR A PROCEDURE +# CALLED FROM A FUNCTION +# +call mtr.add_suppression("MariaDB is trying to drop table"); +CREATE PROCEDURE cachedata( +IN obj_id BIGINT UNSIGNED, +IN start DATETIME, +IN end DATETIME +) +cachedata:BEGIN +DECLARE cache_count BIGINT; +SET @timestamp := NOW(); +CREATE TEMPORARY TABLE IF NOT EXISTS cachedata ( +timestamp DATETIME, +object_id BIGINT UNSIGNED NOT NULL, +start DATETIME, +end DATETIME, +seqno BIGINT AUTO_INCREMENT, +value FLOAT, +PRIMARY KEY (seqno), +INDEX (timestamp), +INDEX (object_id, start, end) +) ENGINE=INNODB; +DELETE FROM cachedata WHERE +timestamp < DATE_SUB(@timestamp, INTERVAL 15 SECOND); +SELECT count(*) INTO cache_count FROM cachedata WHERE +object_id = obj_id +AND start = start +AND end = end; +IF cache_count > 0 THEN LEAVE cachedata; +END IF; +INSERT INTO cachedata (timestamp, object_id, start, end, value) VALUES +(@timestamp, obj_id, start, end, 1234), +(@timestamp, obj_id, start, end, 4567), +(@timestamp, obj_id, start, end, 8901), +(@timestamp, obj_id, start, end, 1234), +(@timestamp, obj_id, start, end, 4567), +(@timestamp, obj_id, start, end, 8901), +(@timestamp, obj_id, start, end, 1234), +(@timestamp, obj_id, start, end, 4567), +(@timestamp, obj_id, start, end, 8901), +(@timestamp, obj_id, start, end, 1234), +(@timestamp, obj_id, start, end, 4567), +(@timestamp, obj_id, start, end, 8901), +(@timestamp, obj_id, start, end, 2345), +(@timestamp, obj_id, start, end, 1234), +(@timestamp, obj_id, start, end, 4567), +(@timestamp, obj_id, start, end, 8901), +(@timestamp, obj_id, start, end, 2345), +(@timestamp, obj_id, start, end, 1234), +(@timestamp, obj_id, start, end, 4567), +(@timestamp, obj_id, start, end, 8901), +(@timestamp, obj_id, start, end, 2345); +END$$ +CREATE FUNCTION get_cache( +obj_id BIGINT UNSIGNED, +start DATETIME, +end DATETIME +) +RETURNS FLOAT +READS SQL DATA +BEGIN +DECLARE result FLOAT; +CALL cachedata(obj_id, start, end); +SELECT SUM(value) INTO result FROM cachedata WHERE +object_id = obj_id +AND start = start +AND end = end; +RETURN result; +END$$ +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +SELECT get_cache(1, '2014-01-01', '2014-02-01'); +get_cache(1, '2014-01-01', '2014-02-01') +95247 +select sleep(1); +sleep(1) +0 +DROP FUNCTION get_cache; +DROP PROCEDURE cachedata; diff --git a/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result b/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result new file mode 100644 index 00000000..09c1cf57 --- /dev/null +++ b/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result @@ -0,0 +1,51 @@ +SET default_storage_engine=InnoDB; +# +# Start of 10.4 tests +# +# +# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +# +# +# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic +# +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (a INT,b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +SET sql_mode='pad_char_to_full_length'; +INSERT INTO t1 VALUES (0,0); +DELETE FROM t1; +DROP TABLE t1; +SET sql_mode=''; +CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) DEFAULT NULL, + `b` char(20) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE UNIQUE INDEX bi USING HASH ON t1 (b); +INSERT INTO t1 VALUES (0,0); +SET sql_mode='pad_char_to_full_length'; +DELETE FROM t1; +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result new file mode 100644 index 00000000..99c862fe --- /dev/null +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -0,0 +1,85 @@ +rename table mysql.table_stats to mysql.table_stats_save; +flush tables; +set use_stat_tables= PREFERABLY; +create table t1 (a int) engine=InnoDB; +start transaction; +insert t1 values (1); +insert t1 values (2); +commit; +select * from t1; +a +1 +2 +drop table t1; +rename table mysql.table_stats_save to mysql.table_stats; +flush tables; +# +# MDEV-26753 Assertion state == TRX_STATE_PREPARED ||... failed +# +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +XA START 'test'; +SELECT COUNT(*)>0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE; +COUNT(*)>0 +1 +INSERT INTO t1 VALUES (1),(2); +UPDATE mysql.innodb_table_stats SET last_update=NULL WHERE table_name='t1'; +XA END 'test'; +XA ROLLBACK 'test'; +DROP TABLE t1; +# +# MDEV-30483 After upgrade to 10.6 from Mysql 5.7 seeing "InnoDB: Column last_update in table mysql.innodb_table_stats is BINARY(4) NOT NULL but should be INT UNSIGNED NOT NULL" +# +# +# Testing a non-default format: Field_timestamp0 - UINT4 based +# +SET @@global.mysql56_temporal_format=0; +ALTER TABLE mysql.innodb_table_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(); +ALTER TABLE mysql.innodb_index_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(); +SHOW COLUMNS FROM mysql.innodb_table_stats LIKE 'last_update'; +Field Type Null Key Default Extra +last_update timestamp /* mariadb-5.3 */ NO current_timestamp() on update current_timestamp() +SHOW COLUMNS FROM mysql.innodb_index_stats LIKE 'last_update'; +Field Type Null Key Default Extra +last_update timestamp /* mariadb-5.3 */ NO current_timestamp() on update current_timestamp() +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1; +SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_table_stats +WHERE database_name='test' AND table_name='t1'; +TIMESTAMPDIFF(DAY,last_update,now())<=1 +1 +SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_index_stats +WHERE database_name='test' AND table_name='t1' AND stat_name='size'; +TIMESTAMPDIFF(DAY,last_update,now())<=1 +1 +DROP TABLE t1; +# +# Now as the table t1 is dropped, expect no statistics +# +SELECT * FROM mysql.innodb_table_stats +WHERE database_name='test' AND table_name='t1'; +database_name table_name last_update n_rows clustered_index_size sum_of_other_index_sizes +SELECT * FROM mysql.innodb_index_stats +WHERE database_name='test' AND table_name='t1' AND stat_name='size'; +database_name table_name index_name last_update stat_name stat_value sample_size stat_description +# +# Testing with the default format: Field_timestampf - BINARY(4) based with the UNSIGNED_FLAG +# +SET @@global.mysql56_temporal_format=1; +ALTER TABLE mysql.innodb_table_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(); +ALTER TABLE mysql.innodb_index_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(); +SHOW COLUMNS FROM mysql.innodb_table_stats LIKE 'last_update'; +Field Type Null Key Default Extra +last_update timestamp NO current_timestamp() on update current_timestamp() +SHOW COLUMNS FROM mysql.innodb_index_stats LIKE 'last_update'; +Field Type Null Key Default Extra +last_update timestamp NO current_timestamp() on update current_timestamp() +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1; +SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_table_stats +WHERE database_name='test' AND table_name='t1'; +TIMESTAMPDIFF(DAY,last_update,now())<=1 +1 +SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_index_stats +WHERE database_name='test' AND table_name='t1' AND stat_name='size'; +TIMESTAMPDIFF(DAY,last_update,now())<=1 +1 +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/stats_persistent.result b/mysql-test/suite/innodb/r/stats_persistent.result new file mode 100644 index 00000000..7e9c038d --- /dev/null +++ b/mysql-test/suite/innodb/r/stats_persistent.result @@ -0,0 +1,19 @@ +# +# MDEV-23991 dict_table_stats_lock() has unnecessarily long scope +# +CREATE TABLE t1(a INT) ENGINE=INNODB STATS_PERSISTENT=1; +SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go'; +ANALYZE TABLE t1; +connect con1, localhost, root; +SET DEBUG_SYNC='now WAIT_FOR stop'; +SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; +SUM(DATA_LENGTH+INDEX_LENGTH) +SUM +SET DEBUG_SYNC='now SIGNAL go'; +disconnect con1; +connection default; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/stored_fk.result b/mysql-test/suite/innodb/r/stored_fk.result new file mode 100644 index 00000000..542d362f --- /dev/null +++ b/mysql-test/suite/innodb/r/stored_fk.result @@ -0,0 +1,75 @@ +create table t1(f1 int primary key) engine=innodb; +# Create statement with FK on base column of stored column +create table t2(f1 int not null, f2 int as (f1) stored, +foreign key(f1) references t1(f1) on update cascade)engine=innodb; +ERROR HY000: Function or expression 'f1' cannot be used in the GENERATED ALWAYS AS clause of `f2` +create table t2(f1 int not null, f2 int as (f1) virtual, f3 int as (f2) stored, +foreign key(f1) references t1(f1) on update cascade)engine=innodb; +ERROR HY000: Function or expression 'f2' cannot be used in the GENERATED ALWAYS AS clause of `f3` +# adding new stored column during alter table copy operation. +create table t2(f1 int not null, f2 int as (f1) virtual, +foreign key(f1) references t1(f1) on update cascade)engine=innodb; +alter table t2 add column f3 int as (f1) stored, add column f4 int as (f1) virtual; +ERROR HY000: Function or expression 'f1' cannot be used in the GENERATED ALWAYS AS clause of `f3` +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL, + KEY `f1` (`f1`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +# adding foreign key constraint for base columns during alter copy. +create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; +alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=copy; +ERROR HY000: Function or expression 'f1' cannot be used in the GENERATED ALWAYS AS clause of `f2` +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) GENERATED ALWAYS AS (`f1`) STORED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t2; +# adding foreign key constraint for base columns during online alter. +create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; +set foreign_key_checks = 0; +alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=inplace; +ERROR HY000: Function or expression 'f1' cannot be used in the GENERATED ALWAYS AS clause of `f2` +drop table t2; +# adding stored column via online alter. +create table t2(f1 int not null, +foreign key(f1) references t1(f1) on update cascade)engine=innodb; +alter table t2 add column f2 int as (f1) stored, algorithm=inplace; +ERROR HY000: Function or expression 'f1' cannot be used in the GENERATED ALWAYS AS clause of `f2` +drop table t2, t1; +# +# BUG#26731689 FK ON TABLE WITH GENERATED COLS: ASSERTION POS < N_DEF +# +CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED, c INT, +d INT GENERATED ALWAYS AS (0) VIRTUAL, e INT) ENGINE=innodb; +CREATE TABLE t (a INT) ENGINE=innodb; +ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't' +ALTER TABLE t ADD PRIMARY KEY(a); +ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; +DROP TABLE s,t; +CREATE TABLE s (a INT GENERATED ALWAYS AS (0) VIRTUAL, +b INT GENERATED ALWAYS AS (0) STORED, c INT) ENGINE=innodb; +CREATE TABLE t (a INT) ENGINE=innodb; +ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't' +ALTER TABLE t ADD PRIMARY KEY(a); +ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; +DROP TABLE s,t; +CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED) ENGINE=innodb; +CREATE TABLE t (a INT PRIMARY KEY) ENGINE=innodb; +ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; +DROP TABLE s,t; +CREATE TABLE s (a INT, b INT) ENGINE=innodb; +CREATE TABLE t (a INT) ENGINE=innodb; +ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; +ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't' +ALTER TABLE t ADD PRIMARY KEY(a); +ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; +DROP TABLE s,t; diff --git a/mysql-test/suite/innodb/r/strict_mode.result b/mysql-test/suite/innodb/r/strict_mode.result new file mode 100644 index 00000000..ae149f96 --- /dev/null +++ b/mysql-test/suite/innodb/r/strict_mode.result @@ -0,0 +1,413 @@ +# +# Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN +# INNODB_STRICT_MODE = 1 +# +call mtr.add_suppression("InnoDB: Cannot add field .* in table"); +set innodb_strict_mode = 0; +create table t1 (id int auto_increment primary key, +v varchar(32), +col1 text, +col2 text, +col3 text, +col4 text, +col5 text, +col6 text, +col7 text, +col8 text, +col9 text, +col10 text, +col11 text, +col12 text, +col13 text, +col14 text, +col15 text, +col16 text, +col17 text, +col18 text, +col19 text, +col20 text, +col21 text, +col22 text, +col23 text, +col24 text, +col25 text, +col26 text, +col27 text, +col28 text, +col29 text, +col30 text, +col31 text, +col32 text, +col33 text, +col34 text, +col35 text, +col36 text, +col37 text, +col38 text, +col39 text, +col40 text, +col41 text, +col42 text, +col43 text, +col44 text, +col45 text , +col46 text, +col47 text, +col48 text, +col49 text, +col50 text, +col51 text, +col52 text, +col53 text, +col54 text, +col55 text, +col56 text, +col57 text, +col58 text, +col59 text, +col60 text, +col61 text, +col62 text, +col63 text, +col64 text, +col65 text, +col66 text, +col67 text, +col68 text , +col69 text, +col70 text, +col71 text, +col72 text, +col73 text, +col74 text, +col75 text, +col76 text, +col77 text, +col78 text, +col79 text, +col80 text, +col81 text, +col82 text, +col83 text, +col84 text, +col85 text, +col86 text, +col87 text, +col88 text, +col89 text, +col90 text, +col91 text, +col92 text, +col93 text, +col94 text, +col95 text, +col96 text, +col97 text, +col98 text, +col99 text, +col100 text, +col101 text, +col102 text, +col103 text, +col104 text, +col105 text, +col106 text, +col107 text, +col108 text, +col109 text, +col110 text, +col111 text, +col112 text, +col113 text, +col114 text, +col115 text, +col116 text, +col117 text, +col118 text, +col119 text, +col120 text, +col121 text, +col122 text, +col123 text, +col124 text, +col125 text, +col126 text , +col127 text, +col128 text, +col129 text, +col130 text, +col131 text, +col132 text, +col133 text, +col134 text, +col135 text, +col136 text, +col137 text, +col138 text, +col139 text, +col140 text, +col141 text, +col142 text, +col143 text, +col144 text, +col145 text, +col146 text, +col147 text , +col148 text, +col149 text, +col150 text, +col151 text, +col152 text, +col153 text, +col154 text, +col155 text, +col156 text, +col157 text, +col158 text, +col159 text, +col160 text, +col161 text, +col162 text, +col163 text, +col164 text, +col165 text, +col166 text, +col167 text, +col168 text, +col169 text, +col170 text, +col171 text, +col172 text , +col173 text, +col174 text, +col175 text, +col176 text, +col177 text, +col178 text, +col179 text, +col180 text, +col181 text, +col182 text, +col183 text, +col184 text, +col185 text, +col186 text, +col187 text, +col188 text, +col189 text, +col190 text, +col191 text, +col192 text, +col193 text, +col194 text, +col195 text, +col196 text, +col197 text, +col198 text, +col199 text, +col200 text, +col201 text, +col202 text, +col203 text, +col204 text, +col205 text, +col206 text, +col207 text, +col208 text, +col209 text, +col210 text, +col211 text, +col212 text, +col213 text, +col214 text, +col215 text, +col216 text, +col217 text, +col218 text, +col219 text, +col220 text, +col221 text, +col222 text, +col223 text, +col224 text, +col225 text, +col226 text, +col227 text, +col228 text, +col229 text, +col230 text, +col231 text, +col232 text, +col233 text, +col234 text, +col235 text, +col236 text, +col237 text, +col238 text, +col239 text, +col240 text, +col241 text, +col242 text, +col243 text, +col244 text, +col245 text, +col246 text, +col247 text, +col248 text, +col249 text, +col250 text, +col251 text, +col252 text, +col253 text, +col254 text, +col255 text, +col256 text, +col257 text, +col258 text, +col259 text, +col260 text, +col261 text, +col262 text, +col263 text, +col264 text, +col265 text, +col266 text, +col267 text, +col268 text, +col269 text, +col270 text, +col271 text, +col272 text, +col273 text, +col274 text, +col275 text, +col276 text, +col277 text, +col278 text, +col279 text, +col280 text, +col281 text, +col282 text, +col283 text, +col284 text, +col285 text, +col286 text, +col287 text, +col288 text, +col289 text, +col290 text, +col291 text, +col292 text, +col293 text, +col294 text, +col295 text, +col296 text, +col297 text, +col298 text, +col299 text, +col300 text, +col301 text, +col302 text, +col303 text, +col304 text, +col305 text, +col306 text, +col307 text, +col308 text, +col309 text, +col310 text, +col311 text, +col312 text, +col313 text, +col314 text, +col315 text, +col316 text, +col317 text, +col318 text, +col319 text, +col320 text, +col321 text, +col322 text, +col323 text, +col324 text, +col325 text, +col326 text, +col327 text, +col328 text, +col329 text, +col330 text, +col331 text, +col332 text, +col333 text, +col334 text, +col335 text, +col336 text, +col337 text, +col338 text, +col339 text, +col340 text, +col341 text, +col342 text, +col343 text, +col344 text, +col345 text, +col346 text, +col347 text, +col348 text, +col349 text, +col350 text, +col351 text, +col352 text, +col353 text, +col354 text, +col355 text, +col356 text, +col357 text, +col358 text, +col359 text, +col360 text, +col361 text, +col362 text, +col363 text, +col364 text, +col365 text, +col366 text, +col367 text, +col368 text, +col369 text, +col370 text, +col371 text, +col372 text, +col373 text, +col374 text, +col375 text, +col376 text, +col377 text, +col378 text, +col379 text, +col380 text, +col381 text, +col382 text, +col383 text +) ENGINE=InnoDB; +Warnings: +Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +set innodb_strict_mode = 1; +alter table t1 engine=InnoDB; +ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs +drop table t1; +# +# MDEV-32128 wrong table name in innodb's "row too big" errors +# +create temporary table t1 ( +c1 char(255), c2 char(255), c3 char(255), c4 char(255), +c5 char(255), c6 char(255), c7 char(255), c8 char(255), +c9 char(255), c10 char(255), c11 char(255), c12 char(255), +c13 char(255), c14 char(255), c15 char(255), c16 char(255), +c17 char(255), c18 char(255), c19 char(255), c20 char(255), +c21 char(255), c22 char(255), c23 char(255), c24 char(255), +c25 char(255), c26 char(255), c27 char(255), c28 char(255), +c29 char(255), c30 char(255), c31 char(255), c32 char(255) +) engine=innodb; +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. +FOUND 1 /Cannot add field `c32` in table `test`.`t1` because/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/system_tables.result b/mysql-test/suite/innodb/r/system_tables.result new file mode 100644 index 00000000..7ccf76f5 --- /dev/null +++ b/mysql-test/suite/innodb/r/system_tables.result @@ -0,0 +1,9 @@ +alter table mysql.time_zone_name engine=InnoDB; +create table envois3 (starttime datetime) engine=InnoDB; +insert envois3 values ('2008-08-11 22:43:00'); +# restart +select convert_tz(starttime,'UTC','Europe/Moscow') starttime from envois3; +starttime +2008-08-12 02:43:00 +drop table envois3; +alter table mysql.time_zone_name engine=Aria; diff --git a/mysql-test/suite/innodb/r/table_definition_cache_debug.result b/mysql-test/suite/innodb/r/table_definition_cache_debug.result new file mode 100644 index 00000000..6bd754aa --- /dev/null +++ b/mysql-test/suite/innodb/r/table_definition_cache_debug.result @@ -0,0 +1,23 @@ +call mtr.add_suppression("InnoDB: innodb_open_files=.* is exceeded"); +SET @save_tdc= @@GLOBAL.table_definition_cache; +SET @save_toc= @@GLOBAL.table_open_cache; +SET GLOBAL table_definition_cache= 400; +SET GLOBAL table_open_cache= 1024; +CREATE TABLE to_be_evicted(a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB; +INSERT INTO to_be_evicted VALUES(1,2),(2,1); +connect ddl,localhost,root,,; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR got_duplicate'; +ALTER TABLE to_be_evicted ADD UNIQUE INDEX(b); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +BEGIN; +INSERT INTO to_be_evicted VALUES(3, 2); +COMMIT; +SET DEBUG_SYNC = 'now SIGNAL got_duplicate'; +connection ddl; +ERROR 23000: Duplicate entry '2' for key 'b' +disconnect ddl; +connection default; +COMMIT; +SET DEBUG_SYNC = RESET; +FLUSH TABLES; diff --git a/mysql-test/suite/innodb/r/table_flags,32k.rdiff b/mysql-test/suite/innodb/r/table_flags,32k.rdiff new file mode 100644 index 00000000..8079d58b --- /dev/null +++ b/mysql-test/suite/innodb/r/table_flags,32k.rdiff @@ -0,0 +1,20 @@ +--- suite/innodb/r/table_flags.result ++++ suite/innodb/r/table_flags.reject +@@ -6,6 +6,8 @@ + SET innodb_strict_mode=OFF; + CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED + KEY_BLOCK_SIZE=1; ++Warnings: ++Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC. + SET innodb_strict_mode=ON; + CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC + PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9; +@@ -87,7 +89,7 @@ + DB_ROLL_PTR=0x80000000000000, + ID=0x0000000000000011, + N_COLS=0x80000001, +- TYPE=0x00000023, ++ TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), diff --git a/mysql-test/suite/innodb/r/table_flags,64k.rdiff b/mysql-test/suite/innodb/r/table_flags,64k.rdiff new file mode 100644 index 00000000..8079d58b --- /dev/null +++ b/mysql-test/suite/innodb/r/table_flags,64k.rdiff @@ -0,0 +1,20 @@ +--- suite/innodb/r/table_flags.result ++++ suite/innodb/r/table_flags.reject +@@ -6,6 +6,8 @@ + SET innodb_strict_mode=OFF; + CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED + KEY_BLOCK_SIZE=1; ++Warnings: ++Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC. + SET innodb_strict_mode=ON; + CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC + PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9; +@@ -87,7 +89,7 @@ + DB_ROLL_PTR=0x80000000000000, + ID=0x0000000000000011, + N_COLS=0x80000001, +- TYPE=0x00000023, ++ TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result new file mode 100644 index 00000000..77999035 --- /dev/null +++ b/mysql-test/suite/innodb/r/table_flags.result @@ -0,0 +1,192 @@ +# restart: with restart_parameters +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE tr(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE tc(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPACT; +CREATE TABLE td(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SET innodb_strict_mode=OFF; +CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED +KEY_BLOCK_SIZE=1; +SET innodb_strict_mode=ON; +CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC +PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9; +SYS_TABLES clustered index root page (8): +N_RECS=8; LEVEL=0; INDEX_ID=0x0000000000000001 +header=0x01000003008d (NAME=0x696e66696d756d00) +header=0x0000101500d5 (NAME='SYS_FOREIGN', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x000000000000000b, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +header=0x000018150122 (NAME='SYS_FOREIGN_COLS', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x000000000000000c, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +header=0x0000201501ae (NAME='SYS_VIRTUAL', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x000000000000000d, + N_COLS=0x00000003, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +header=0x0400301501f2 (NAME='test/tc', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x000000000000000f, + N_COLS=0x80000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000002) +header=0x00003815027a (NAME='test/td', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x0000000000000010, + N_COLS=0x80000001, + TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000003) +header=0x00004815016a (NAME='test/tp', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x0000000000000012, + N_COLS=0x80000001, + TYPE=0x000009a1, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000005) +header=0x000028150236 (NAME='test/tr', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x000000000000000e, + N_COLS=0x00000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000001) +header=0x000040150074 (NAME='test/tz', + DB_TRX_ID=0x000000000000, + DB_ROLL_PTR=0x80000000000000, + ID=0x0000000000000011, + N_COLS=0x80000001, + TYPE=0x00000023, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000004) +header=0x050008030000 (NAME=0x73757072656d756d00) +# restart: with restart_parameters +SHOW CREATE TABLE tr; +ERROR 42S02: Table 'test.tr' doesn't exist in engine +SHOW CREATE TABLE tc; +ERROR 42S02: Table 'test.tc' doesn't exist in engine +SELECT * FROM tc; +ERROR 42S02: Table 'test.tc' doesn't exist in engine +SHOW CREATE TABLE td; +Table Create Table +td CREATE TABLE `td` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SELECT * FROM td; +a +SHOW CREATE TABLE tz; +Table Create Table +tz CREATE TABLE `tz` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 +BEGIN; +INSERT INTO tz VALUES(42); +ROLLBACK; +SELECT * FROM tz; +a +42 +SHOW CREATE TABLE tp; +ERROR 42S02: Table 'test.tp' doesn't exist in engine +FOUND 5 /InnoDB: Table test/t[cp] in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=(129|289|3873|1232[13]) SYS_TABLES\.N_COLS=2147483649/ in mysqld.1.err +FOUND 2 /InnoDB: Table test/tr in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=65 SYS_TABLES\.MIX_LEN=4294967295\b/ in mysqld.1.err +Restoring SYS_TABLES clustered index root page (8) +# restart: with restart_parameters +SHOW CREATE TABLE tr; +Table Create Table +tr CREATE TABLE `tr` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +SHOW CREATE TABLE tc; +Table Create Table +tc CREATE TABLE `tc` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +SHOW CREATE TABLE td; +Table Create Table +td CREATE TABLE `td` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +SHOW CREATE TABLE tz; +Table Create Table +tz CREATE TABLE `tz` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 +SHOW CREATE TABLE tp; +Table Create Table +tp CREATE TABLE `tp` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=9 +BEGIN; +INSERT INTO tr VALUES(1); +INSERT INTO tc VALUES(1); +INSERT INTO td VALUES(1); +INSERT INTO tp VALUES(1); +ROLLBACK; +SELECT * FROM tr; +a +SELECT * FROM tc; +a +SELECT * FROM td; +a +SELECT * FROM tp; +a +DROP TABLE tr,tc,td,tz,tp; +# restart +ib_logfile0 +ibdata1 +sys_tables.bin +call mtr.add_suppression("ERROR HY000: Can't create table `test`.`t1`"); +CREATE TABLE t1(f1 INT, f2 VARCHAR(1), KEY k1(f2), +FULLTEXT KEY(f2), +FOREIGN KEY (f2) REFERENCES t1(f3))ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +# +# MDEV-23199 page_compression flag is missing +# for full_crc32 tablespace +# +CREATE TABLE t1(f1 BIGINT PRIMARY KEY)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +ALTER TABLE t1 PAGE_COMPRESSED = 1; +INSERT INTO t1 VALUES(2); +# restart +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/table_index_statistics.result b/mysql-test/suite/innodb/r/table_index_statistics.result new file mode 100644 index 00000000..286c5f93 --- /dev/null +++ b/mysql-test/suite/innodb/r/table_index_statistics.result @@ -0,0 +1,48 @@ +SET @default_storage_engine_old = @@session.default_storage_engine; +SET SESSION default_storage_engine = INNODB; +FLUSH INDEX_STATISTICS; +FLUSH TABLE_STATISTICS; +SET @userstat_old= @@userstat; +SET GLOBAL userstat=ON; +CREATE TABLE t1 (id int(10), PRIMARY KEY (id)); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +FLUSH TABLE_STATISTICS; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +FLUSH INDEX_STATISTICS; +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; +ROWS_READ +10 +DROP TABLE t1; +CREATE TABLE t2 (c1 INT UNSIGNED); +ALTER TABLE t2 MODIFY c1 FLOAT; +SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +DROP TABLE t2; +CREATE TABLE t2 (c1 INT UNSIGNED); +ALTER TABLE t2 MODIFY c1 FLOAT; +SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +DROP TABLE t2; +SET GLOBAL userstat= @userstat_old; +SET SESSION default_storage_engine = @default_storage_engine_old; diff --git a/mysql-test/suite/innodb/r/temp_table.result b/mysql-test/suite/innodb/r/temp_table.result new file mode 100644 index 00000000..dea47787 --- /dev/null +++ b/mysql-test/suite/innodb/r/temp_table.result @@ -0,0 +1,597 @@ +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc), index sec_index(c1) +) engine = innodb; +create temporary table t2 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc), index sec_index(c1) +) engine = innodb; +create procedure populate_t1() +begin +declare i int default 1; +while (i <= 200) do +insert into t1 values (i, 'a', 'b'); +set i = i + 1; +end while; +end| +create procedure populate_t1_small() +begin +declare i int default 1; +while (i <= 20) do +insert into t1 values (i, 'c', 'd'); +set i = i + 1; +end while; +end| +create procedure populate_t1_small2() +begin +declare i int default 30; +while (i <= 50) do +insert into t1 values (i, 'e', 'f'); +set i = i + 1; +end while; +end| +begin; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +200 +select * from t1 limit 10; +keyc c1 c2 +1 a b +2 a b +3 a b +4 a b +5 a b +6 a b +7 a b +8 a b +9 a b +10 a b +rollback; +select count(*) from t1; +count(*) +0 +begin; +call populate_t1(); +select count(*) from t1; +count(*) +200 +commit; +select count(*) from t1; +count(*) +200 +truncate table t1; +select count(*) from t1; +count(*) +0 +call populate_t1_small(); +select count(*) from t1; +count(*) +20 +rollback; +select count(*) from t1; +count(*) +20 +truncate table t1; +call populate_t1(); +select count(*) from t1; +count(*) +200 +delete from t1 where keyc <= 60; +select count(*) from t1; +count(*) +140 +call populate_t1_small(); +select count(*) from t1; +count(*) +160 +select * from t1 limit 10; +keyc c1 c2 +1 c d +2 c d +3 c d +4 c d +5 c d +6 c d +7 c d +8 c d +9 c d +10 c d +begin; +call populate_t1_small2(); +select count(*) from t1; +count(*) +181 +select * from t1 where keyc > 30 limit 10; +keyc c1 c2 +31 e f +32 e f +33 e f +34 e f +35 e f +36 e f +37 e f +38 e f +39 e f +40 e f +rollback; +select count(*) from t1; +count(*) +160 +select * from t1 where keyc > 30 limit 10; +keyc c1 c2 +61 a b +62 a b +63 a b +64 a b +65 a b +66 a b +67 a b +68 a b +69 a b +70 a b +update t1 set keyc = keyc + 2000; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +rollback; +begin; +update t1 set keyc = keyc + 2000; +select * from t1 limit 10; +keyc c1 c2 +4001 c d +4002 c d +4003 c d +4004 c d +4005 c d +4006 c d +4007 c d +4008 c d +4009 c d +4010 c d +rollback; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +commit; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +insert into t2 select * from t1 where keyc < 2101; +select count(*) from t2; +count(*) +60 +drop procedure populate_t1; +drop procedure populate_t1_small; +drop procedure populate_t1_small2; +drop temporary table t1,t2; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc), index sec_index(c1) +) engine = innodb key_block_size = 4; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc), index sec_index(c1) +) engine = innodb; +set innodb_strict_mode=off; +create temporary table t2 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc), index sec_index(c1) +) engine = innodb key_block_size = 8; +set innodb_strict_mode=on; +create procedure populate_t1() +begin +declare i int default 1; +while (i <= 200) do +insert into t1 values (i, 'a', 'b'); +set i = i + 1; +end while; +end| +create procedure populate_t1_small() +begin +declare i int default 1; +while (i <= 20) do +insert into t1 values (i, 'c', 'd'); +set i = i + 1; +end while; +end| +create procedure populate_t1_small2() +begin +declare i int default 30; +while (i <= 50) do +insert into t1 values (i, 'e', 'f'); +set i = i + 1; +end while; +end| +begin; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +200 +select * from t1 limit 10; +keyc c1 c2 +1 a b +2 a b +3 a b +4 a b +5 a b +6 a b +7 a b +8 a b +9 a b +10 a b +rollback; +select count(*) from t1; +count(*) +0 +begin; +call populate_t1(); +select count(*) from t1; +count(*) +200 +commit; +select count(*) from t1; +count(*) +200 +truncate table t1; +select count(*) from t1; +count(*) +0 +call populate_t1_small(); +select count(*) from t1; +count(*) +20 +rollback; +select count(*) from t1; +count(*) +20 +truncate table t1; +call populate_t1(); +select count(*) from t1; +count(*) +200 +delete from t1 where keyc <= 60; +select count(*) from t1; +count(*) +140 +call populate_t1_small(); +select count(*) from t1; +count(*) +160 +select * from t1 limit 10; +keyc c1 c2 +1 c d +2 c d +3 c d +4 c d +5 c d +6 c d +7 c d +8 c d +9 c d +10 c d +begin; +call populate_t1_small2(); +select count(*) from t1; +count(*) +181 +select * from t1 where keyc > 30 limit 10; +keyc c1 c2 +31 e f +32 e f +33 e f +34 e f +35 e f +36 e f +37 e f +38 e f +39 e f +40 e f +rollback; +select count(*) from t1; +count(*) +160 +select * from t1 where keyc > 30 limit 10; +keyc c1 c2 +61 a b +62 a b +63 a b +64 a b +65 a b +66 a b +67 a b +68 a b +69 a b +70 a b +update t1 set keyc = keyc + 2000; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +rollback; +begin; +update t1 set keyc = keyc + 2000; +select * from t1 limit 10; +keyc c1 c2 +4001 c d +4002 c d +4003 c d +4004 c d +4005 c d +4006 c d +4007 c d +4008 c d +4009 c d +4010 c d +rollback; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +commit; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +insert into t2 select * from t1 where keyc < 2101; +select count(*) from t2; +count(*) +60 +drop procedure populate_t1; +drop procedure populate_t1_small; +drop procedure populate_t1_small2; +drop temporary table t1, t2; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc), index sec_index(c1) +) engine = innodb; +create temporary table t2 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc), index sec_index(c1) +) engine = innodb; +create procedure populate_t1() +begin +declare i int default 1; +while (i <= 200) do +insert into t1 values (i, 'a', 'b'); +set i = i + 1; +end while; +end| +create procedure populate_t1_small() +begin +declare i int default 1; +while (i <= 20) do +insert into t1 values (i, 'c', 'd'); +set i = i + 1; +end while; +end| +create procedure populate_t1_small2() +begin +declare i int default 30; +while (i <= 50) do +insert into t1 values (i, 'e', 'f'); +set i = i + 1; +end while; +end| +begin; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +200 +select * from t1 limit 10; +keyc c1 c2 +1 a b +2 a b +3 a b +4 a b +5 a b +6 a b +7 a b +8 a b +9 a b +10 a b +rollback; +select count(*) from t1; +count(*) +0 +begin; +call populate_t1(); +select count(*) from t1; +count(*) +200 +commit; +select count(*) from t1; +count(*) +200 +truncate table t1; +select count(*) from t1; +count(*) +0 +call populate_t1_small(); +select count(*) from t1; +count(*) +20 +rollback; +select count(*) from t1; +count(*) +20 +truncate table t1; +call populate_t1(); +select count(*) from t1; +count(*) +200 +delete from t1 where keyc <= 60; +select count(*) from t1; +count(*) +140 +call populate_t1_small(); +select count(*) from t1; +count(*) +160 +select * from t1 limit 10; +keyc c1 c2 +1 c d +2 c d +3 c d +4 c d +5 c d +6 c d +7 c d +8 c d +9 c d +10 c d +begin; +call populate_t1_small2(); +select count(*) from t1; +count(*) +181 +select * from t1 where keyc > 30 limit 10; +keyc c1 c2 +31 e f +32 e f +33 e f +34 e f +35 e f +36 e f +37 e f +38 e f +39 e f +40 e f +rollback; +select count(*) from t1; +count(*) +160 +select * from t1 where keyc > 30 limit 10; +keyc c1 c2 +61 a b +62 a b +63 a b +64 a b +65 a b +66 a b +67 a b +68 a b +69 a b +70 a b +update t1 set keyc = keyc + 2000; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +rollback; +begin; +update t1 set keyc = keyc + 2000; +select * from t1 limit 10; +keyc c1 c2 +4001 c d +4002 c d +4003 c d +4004 c d +4005 c d +4006 c d +4007 c d +4008 c d +4009 c d +4010 c d +rollback; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +commit; +select * from t1 limit 10; +keyc c1 c2 +2001 c d +2002 c d +2003 c d +2004 c d +2005 c d +2006 c d +2007 c d +2008 c d +2009 c d +2010 c d +insert into t2 select * from t1 where keyc < 2101; +select count(*) from t2; +count(*) +60 +drop procedure populate_t1; +drop procedure populate_t1_small; +drop procedure populate_t1_small2; diff --git a/mysql-test/suite/innodb/r/temp_table_savepoint.result b/mysql-test/suite/innodb/r/temp_table_savepoint.result new file mode 100644 index 00000000..44c8db04 --- /dev/null +++ b/mysql-test/suite/innodb/r/temp_table_savepoint.result @@ -0,0 +1,242 @@ +create procedure populate_tables() +begin +declare n int default 20; +declare inner_loop int default 100; +create temporary table t5(c1 int not null, +c2 int not null, +c3 char(255) not null, +c4 text(6000) not null, +c5 blob(6000) not null, +c6 varchar(2000) not null, +c7 varchar(2000) not null, +c8 datetime, +c9 decimal(6,3), +primary key (c1), +index (c3,c4(50),c5(50)), +index (c2)) +engine=innodb; +create temporary table t6 ( a int ) engine = innodb; +insert into t6 values (50),(100),(150),(190); +while (n > 0) do +start transaction; +insert ignore into t5 values(n,n,repeat(concat(' tc3_',n),30), +repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), +repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), +now(),(100.55+n)); +if (n > 10) then +commit; +else +delete from t5 where c1 > 10 ; +rollback; +start transaction; +update t5 set c1 = c1 + 1000 where c1 > 10; +rollback; +end if; +start transaction; +insert ignore into t5 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), +repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), +repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +now(),(100.55+n+inner_loop)); +delete from t5 where c1 between 100 and 110; +update t5 set c1 = c1+1 where c1>110; +savepoint a; +insert ignore into t5 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), +repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), +repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +now(),(100.55+n+inner_loop)); +savepoint b; +insert into t5 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), +repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), +repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +now(),(100.55+n+inner_loop)); +savepoint c; +rollback to b; +rollback to a; +commit; +commit; +rollback; +set n = n - 1; +end while; +end| +connect con1,localhost,root,,; +call populate_tables();; +connect con2,localhost,root,,; +call populate_tables();; +connection con1; +select c1 from t5; +c1 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +122 +124 +126 +128 +130 +132 +134 +136 +138 +140 +connection con2; +select c1 from t5; +c1 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +122 +124 +126 +128 +130 +132 +134 +136 +138 +140 +connection con1; +set autocommit = 0; +insert into t5 values (20,1,'a','a','a','a','a',now(),100.55); +ERROR 23000: Duplicate entry '20' for key 'PRIMARY' +insert ignore into t5 values (20,1,'a','a','a','a','a',now(),100.55); +Warnings: +Warning 1062 Duplicate entry '20' for key 'PRIMARY' +insert into t5 values (1,1,'a','a','a','a','a',now(),100.55), +(20,1,'a','a','a','a','a',now(),100.55); +ERROR 23000: Duplicate entry '20' for key 'PRIMARY' +set autocommit = 1; +select c1,c2 from t5 where c1 in (20,1); +c1 c2 +20 20 +replace into t5 values (20,1,'a','a','a','a','a',now(),100.55); +select c1,c2,c3,c4,c5,c6,c7,c9 from t5 where c1 = 20; +c1 c2 c3 c4 c5 c6 c7 c9 +20 1 a a a a a 100.550 +update ignore t5 set c1 = 20 where c1 = 140 ; +select count(*) from t5 where c1 = 140; +count(*) +1 +select * into outfile "VARDIR/tmp/t5.outfile" from t5; +create temporary table temp_1 engine = innodb as select * from t5 where 1=2; +select count(*) from temp_1; +count(*) +0 +load data infile 'VARDIR/tmp/t5.outfile' into table temp_1; +select count(*) from temp_1; +count(*) +20 +alter table temp_1 add column c10 int default 99 , +add column c11 varchar(100) default 'test'; +alter table temp_1 add primary key (c1); +insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55); +select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0; +c1 c2 c3 c4 c5 c6 c7 c9 c10 c11 +-1 -1 a a a a a 100.550 99 test +select count(*) from temp_1 where c10 = 99 and c11 like 'test'; +count(*) +21 +insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55) +on duplicate key update c1=-2,c2=-2; +select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0; +c1 c2 c3 c4 c5 c6 c7 c9 c10 c11 +-2 -2 a a a a a 100.550 99 test +disconnect con1; +disconnect con2; +connection default; +drop procedure populate_tables; +create temporary table prep_1(c1 int not null, +c2 int not null, +c3 char(255) not null, +c4 text(6000) not null, +c5 blob(6000) not null, +c6 varchar(2000) not null, +c7 varchar(2000) not null, +c8 datetime, +c9 decimal(6,3), +index (c3,c4(50),c5(50)), +index (c2)) +engine=innodb; +PREPARE stm FROM "insert into prep_1 values(?,?,repeat(concat(' tc3_',?),30),repeat(concat(' tc4_',?),800),repeat(concat(' tc_',?),800),repeat(concat(' tc6_',?),245),repeat(concat(' tc7_',?),245),now(),(100.55+?))"; +set @var = 5; +set @var_static = 5; +EXECUTE stm USING @var,@var,@var,@var,@var,@var,@var,@var; +EXECUTE stm USING @var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static; +set @var = @var - 1; +EXECUTE stm USING @var,@var,@var,@var,@var,@var,@var,@var; +EXECUTE stm USING @var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static; +set @var = @var - 1; +EXECUTE stm USING @var,@var,@var,@var,@var,@var,@var,@var; +EXECUTE stm USING @var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static; +set @var = @var - 1; +EXECUTE stm USING @var,@var,@var,@var,@var,@var,@var,@var; +EXECUTE stm USING @var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static; +set @var = @var - 1; +EXECUTE stm USING @var,@var,@var,@var,@var,@var,@var,@var; +EXECUTE stm USING @var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static; +set @var = @var - 1; +select c1,left(c3,15) from prep_1 order by c1 ; +c1 left(c3,15) +1 tc3_1 tc3_1 tc +2 tc3_2 tc3_2 tc +3 tc3_3 tc3_3 tc +4 tc3_4 tc3_4 tc +5 tc3_5 tc3_5 tc +5 tc3_5 tc3_5 tc +5 tc3_5 tc3_5 tc +5 tc3_5 tc3_5 tc +5 tc3_5 tc3_5 tc +5 tc3_5 tc3_5 tc +select count(*) from prep_1; +count(*) +10 +PREPARE stm_1 FROM "UPDATE prep_1 SET c1 = c1 + 1"; +EXECUTE stm_1; +EXECUTE stm_1; +select c1,left(c3,15) from prep_1 order by c1 ; +c1 left(c3,15) +3 tc3_1 tc3_1 tc +4 tc3_2 tc3_2 tc +5 tc3_3 tc3_3 tc +6 tc3_4 tc3_4 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +select count(*) from prep_1; +count(*) +10 +PREPARE stm_2 FROM "DELETE FROM prep_1 ORDER BY c1 LIMIT 1"; +EXECUTE stm_2; +EXECUTE stm_2; +select c1,left(c3,15) from prep_1 order by c1 ; +c1 left(c3,15) +5 tc3_3 tc3_3 tc +6 tc3_4 tc3_4 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +7 tc3_5 tc3_5 tc +select count(*) from prep_1; +count(*) +8 +drop prepare stm; +drop prepare stm_1; +drop prepare stm_2; diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result new file mode 100644 index 00000000..ffcee726 --- /dev/null +++ b/mysql-test/suite/innodb/r/temporary_table.result @@ -0,0 +1,804 @@ +# files in MYSQL_DATA_DIR +ibtmp1 +create temporary table t1 (i int, f float, c char(100)) engine=innodb; +insert into t1 values (100, 1.1, 'pune'); +insert into t1 values (99, 1.2, 'mumbai'); +insert into t1 values (98, 1.3, 'jaipur'); +insert into t1 values (97, 1.4, 'delhi'); +insert into t1 values (96, 1.5, 'ahmedabad'); +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +select * from t1 where i = 98; +i f c +98 1.3 jaipur +select * from t1 where i < 100; +i f c +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +explain select * from t1 where f > 1.29999; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +alter table t1 add index sec_index(f); +explain select * from t1 where f > 1.29999; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range sec_index sec_index 5 NULL 3 Using index condition +select * from t1 where f > 1.29999; +i f c +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +explain select * from t1 where i = 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +alter table t1 add unique index pri_index(i); +explain select * from t1 where i = 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const pri_index pri_index 5 const 1 +select * from t1 where i = 100; +i f c +100 1.1 pune +delete from t1 where i < 97; +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +insert into t1 values (96, 1.5, 'kolkata'); +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 kolkata +update t1 set f = 1.44 where c = 'delhi'; +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.44 delhi +96 1.5 kolkata +truncate table t1; +insert into t1 values (100, 1.1, 'pune'); +insert into t1 values (99, 1.2, 'mumbai'); +insert into t1 values (98, 1.3, 'jaipur'); +insert into t1 values (97, 1.4, 'delhi'); +insert into t1 values (96, 1.5, 'ahmedabad'); +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +alter table t1 discard tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +alter table t1 import tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +drop temporary table t1; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) engine = innodb; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i INT DEFAULT 1; +while (i <= 20000) DO +insert into t1 values (i, 'a', 'b'); +SET i = i + 1; +END WHILE; +END| +set autocommit=0; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +20000 +select * from t1 limit 10; +keyc c1 c2 +1 a b +2 a b +3 a b +4 a b +5 a b +6 a b +7 a b +8 a b +9 a b +10 a b +set autocommit=1; +truncate table t1; +select * from t1; +keyc c1 c2 +# test condition of full-temp-tablespace +# restart: --innodb_temp_data_file_path=ibtmp1:12M +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) engine = innodb; +begin; +call populate_t1(); +ERROR HY000: The table 't1' is full +drop procedure populate_t1; +# test read-only mode +# restart: --innodb-read-only +# files in MYSQL_DATA_DIR +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist +show tables; +Tables_in_test +create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb; +ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only") +SET GLOBAL innodb_encrypt_tables=DEFAULT; +# test various bad start-up parameters +FOUND 2 /InnoDB: Unable to create temporary file/ in mysqld.1.err +# restart: --innodb_data_file_path=ibdata1:12M:autoextend --innodb_temp_data_file_path=ibdata1:12M:autoextend +FOUND 1 /innodb_temporary and innodb_system file names seem to be the same/ in mysqld.1.err +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# restart: --innodb_temp_data_file_path=foobar:3Gnewraw +FOUND 1 /support raw device/ in mysqld.1.err +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# restart: --innodb_temp_data_file_path=barbar:3Graw +FOUND 2 /support raw device/ in mysqld.1.err +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# restart: --innodb_temp_data_file_path= +FOUND 1 /InnoDB: syntax error in file path/ in mysqld.1.err +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# restart +create temporary table t ( +i int) +engine = innodb row_format = compressed; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +create temporary table t ( +i int) +engine = innodb row_format = compressed key_block_size = 8; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +set innodb_strict_mode = off; +create temporary table t ( +i int) +engine = innodb row_format = compressed key_block_size = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +show warnings; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +set innodb_strict_mode = default; +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = compressed; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +#files in MYSQL_TMP_DIR, expecting only default temporary tablespace file +ibtmp1 +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +set innodb_strict_mode = off; +create temporary table t ( +i int) +engine = innodb row_format = dynamic key_block_size = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +show warnings; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = compact; +show warnings; +Level Code Message +drop table t; +create temporary table t ( +i int) +engine = innodb key_block_size = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +show warnings; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +drop table t; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPACT; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +ALTER TABLE t1 KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 +ALTER TABLE t1 KEY_BLOCK_SIZE = 4 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 +ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 +DROP TABLE t1; +set innodb_strict_mode = ON; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +ALTER TABLE t1 KEY_BLOCK_SIZE = 4; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +set innodb_strict_mode = OFF; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +set innodb_strict_mode = ON; +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +set innodb_strict_mode = OFF; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +ALTER TABLE t1 KEY_BLOCK_SIZE = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +set innodb_strict_mode = ON; +ALTER TABLE t1 ADD COLUMN j INT; +ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +set innodb_strict_mode = OFF; +ALTER TABLE t1 KEY_BLOCK_SIZE = 0; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +set innodb_strict_mode = ON; +ALTER TABLE t1 ADD COLUMN j INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `j` int(11) DEFAULT NULL, + PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +DROP TABLE t1; +CREATE TEMPORARY TABLE t1(f1 INT, KEY(f1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +UPDATE t1 SET f1 = 0; +START TRANSACTION; +UPDATE t1 SET f1 = 4; +UPDATE t1 SET f1 = 0; +ROLLBACK; +SELECT * FROM t1; +f1 +0 +DROP TABLE t1; +create procedure t1_proc() +begin +DECLARE var INT UNSIGNED; +CREATE TEMPORARY TABLE t1(f1 INT UNSIGNED, f2 INT UNSIGNED, KEY( f1, f2 ) )engine=innodb; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +START TRANSACTION; +INSERT INTO t1 SET f1 = 1, f2 = 1; +UPDATE t1 SET f2 = 2; +SET var = ( SELECT 1 FROM t1 ); +DROP TABLE t1; +END// +call t1_proc; +drop procedure t1_proc; +# +# MDEV-15874 CREATE TABLE creates extra transaction +# +call mtr.add_suppression("Warning 150 Create table `mysqld.1`.`t1` with foreign key constraint failed. Temporary tables can't have foreign key constraints.*"); +SET FOREIGN_KEY_CHECKS = 0; +CREATE TEMPORARY TABLE t1(f1 INT NOT NULL, +FOREIGN KEY(f1) REFERENCES t0(f1))ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +CREATE TABLE t (c INT) ENGINE=InnoDB; +INSERT INTO t VALUES(0); +CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB; +START TRANSACTION READ ONLY; +INSERT INTO t2 SELECT * FROM t; +COMMIT; +DROP TABLE t, t2; +CREATE TEMPORARY TABLE t (c INT,c2 INT) ENGINE=InnoDB; +START TRANSACTION READ ONLY; +INSERT INTO t VALUES(0); +ERROR 21S01: Column count doesn't match value count at row 1 +SAVEPOINT s; +INSERT INTO t VALUES(0,0); +COMMIT; +DROP TABLE t; +CREATE TEMPORARY TABLE t (c INT,c2 INT) ENGINE=InnoDB; +START TRANSACTION READ ONLY; +INSERT INTO t VALUES(0); +ERROR 21S01: Column count doesn't match value count at row 1 +SAVEPOINT s; +INSERT INTO t VALUES(0,0); +ROLLBACK; +DROP TABLE t; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +START TRANSACTION READ ONLY; +UPDATE t1 SET a= 2; +COMMIT; +DROP TABLE t1; +CREATE TEMPORARY TABLE t(c INT) ENGINE=InnoDB; +SET SESSION tx_read_only=TRUE; +LOCK TABLE test.t READ; +SELECT * FROM t; +c +INSERT INTO t VALUES(0xADC3); +SET SESSION tx_read_only=FALSE; +DROP TABLE t; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +START TRANSACTION READ ONLY; +UPDATE t1 SET a= 2; +COMMIT; +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY, b int) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 1); +START TRANSACTION READ ONLY; +UPDATE t1 SET b= 2; +COMMIT; +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY, b int, c varchar(255)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 1, repeat('a', 200)); +START TRANSACTION READ ONLY; +UPDATE t1 SET b= 2, c=repeat('a', 250); +COMMIT; +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +START TRANSACTION READ ONLY; +UPDATE t1 SET a= 2; +ROLLBACK; +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +START TRANSACTION READ ONLY; +DELETE FROM t1 WHERE a= 2; +COMMIT; +DROP TABLE t1; +CREATE TEMPORARY TABLE tmp (a INT) ENGINE=InnoDB; +INSERT INTO tmp () VALUES (),(); +SET TX_READ_ONLY= 1; +INSERT INTO tmp SELECT * FROM tmp; +SET TX_READ_ONLY= 0; +DROP TABLE tmp; +SET sql_mode=''; +SET GLOBAL tx_read_only=TRUE; +CREATE TEMPORARY TABLE t (c INT); +SET SESSION tx_read_only=DEFAULT; +INSERT INTO t VALUES(1); +INSERT INTO t SELECT * FROM t; +SET SESSION tx_read_only=FALSE; +SET GLOBAL tx_read_only=OFF; +DROP TABLE t; +CREATE TEMPORARY TABLE t(a INT); +SET SESSION tx_read_only=ON; +LOCK TABLE t READ; +SELECT COUNT(*)FROM t; +COUNT(*) +0 +INSERT INTO t VALUES (0); +SET SESSION tx_read_only=OFF; +DROP TABLE t; +CREATE TEMPORARY TABLE t (a INT) ENGINE=InnoDB; +INSERT INTO t VALUES (1); +START TRANSACTION READ ONLY; +UPDATE t SET a = NULL; +ROLLBACK; +DROP TABLE t; +# +# MDEV-29886 Assertion !index->table->is_temporary() failed +# in trx_undo_prev_version_build upon CHECK +# +CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1; +UPDATE t SET a=2; +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +DROP TEMPORARY TABLE t; +# +# MDEV-29978 Corruption errors upon CHECK on temporary InnoDB table +# +CREATE TEMPORARY TABLE t (f INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t (f) VALUES (1),(2); +CHECK TABLE t; +Table Op Msg_type Msg_text +test.t check status OK +CHECK TABLE t EXTENDED; +Table Op Msg_type Msg_text +test.t check status OK +DROP TEMPORARY TABLE t; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/temporary_table_optimization.result b/mysql-test/suite/innodb/r/temporary_table_optimization.result new file mode 100644 index 00000000..e2e9131b --- /dev/null +++ b/mysql-test/suite/innodb/r/temporary_table_optimization.result @@ -0,0 +1,257 @@ +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +i +1 +2 +3 +4 +select * from t1 where i = 4; +i +4 +drop table t1; +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +i +1 +2 +3 +4 +select * from t1 where i = 4; +i +4 +drop table t1; +create temporary table t2 (i int) engine = innodb; +insert into t2 values (1), (2), (3), (4); +select * from t2; +i +1 +2 +3 +4 +select * from t2 where i = 4; +i +4 +drop table t2; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) engine = innodb; +create procedure populate_t1() +begin +declare i int default 1; +while (i <= 200) DO +insert into t1 values (i, 'a', 'b'); +set i = i + 1; +end while; +end| +set autocommit=0; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +200 +select * from t1 limit 10; +keyc c1 c2 +1 a b +2 a b +3 a b +4 a b +5 a b +6 a b +7 a b +8 a b +9 a b +10 a b +set autocommit=1; +truncate table t1; +select count(*) from t1; +count(*) +0 +drop table t1; +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +i +1 +2 +3 +4 +select * from t1 where i = 4; +i +4 +drop table t1; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) +engine = innodb; +begin; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +200 +rollback; +select count(*) from t1; +count(*) +0 +begin; +call populate_t1(); +commit; +select count(*) from t1; +count(*) +200 +truncate table t1; +select count(*) from t1; +count(*) +0 +drop table t1; +drop procedure populate_t1; +create temporary table t1 (t1_i int, t1_f float) engine = innodb; +insert into t1 values (1, 1.1), (2, 2.5), (3, 2.5), (4, 4.4); +explain select * from t1 where t1_i = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +alter table t1 add unique index pri_index(t1_i); +explain select * from t1 where t1_i = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const pri_index pri_index 5 const 1 +select * from t1 where t1_i = 1; +t1_i t1_f +1 1.1 +alter table t1 add unique index sec_index(t1_f); +ERROR 23000: Duplicate entry '2.5' for key 'sec_index' +alter table t1 add index sec_index(t1_f); +explain select * from t1 where t1_f >= 2.5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range sec_index sec_index 5 NULL 3 Using index condition +select * from t1 where t1_f >= 2.5; +t1_i t1_f +2 2.5 +3 2.5 +4 4.4 +alter table t1 add column (t1_c char(10)); +select * from t1; +t1_i t1_f t1_c +1 1.1 NULL +2 2.5 NULL +3 2.5 NULL +4 4.4 NULL +insert into t1 values (5, 5.5, 'krunal'); +alter table t1 drop column t1_f; +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `t1_i` int(11) DEFAULT NULL, + `t1_c` char(10) DEFAULT NULL, + UNIQUE KEY `pri_index` (`t1_i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select * from t1 where t1_f >= 2.5; +ERROR 42S22: Unknown column 't1_f' in 'where clause' +alter table t1 add index sec_index2(t1_c), algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +drop table t1; +create temporary table t1 (i int, f float) engine = innodb; +insert into t1 values (10, 1.1), (20, 2.2); +select * from t1; +i f +10 1.1 +20 2.2 +alter table t1 discard tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +alter table t1 import tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +drop table t1; +create temporary table t1 (i int) engine=innodb; +insert into t1 values (1), (2), (3); +select * from t1; +i +1 +2 +3 +alter table t1 rename t2; +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist +select * from t2; +i +1 +2 +3 +insert into t2 values (1), (2), (6), (7); +select * from t2; +i +1 +2 +3 +1 +2 +6 +7 +drop table t2; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +SET innodb_strict_mode=OFF; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = compact engine=innodb; +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = compressed engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = compact engine=innodb; +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +CREATE TEMPORARY TABLE t2 ( i INT ) ENGINE = Innodb; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +COUNT(*) +1 +CREATE TEMPORARY table t3 ( i INT ) ENGINE = Innodb; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +COUNT(*) +1 +DROP TABLE t1,t2,t3; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +COUNT(*) +0 diff --git a/mysql-test/suite/innodb/r/tmpdir.result b/mysql-test/suite/innodb/r/tmpdir.result new file mode 100644 index 00000000..a277883a --- /dev/null +++ b/mysql-test/suite/innodb/r/tmpdir.result @@ -0,0 +1,55 @@ +# +# Bug #19183565 CREATE DYNAMIC INNODB_TMPDIR VARIABLE TO CONTROL +# WHERE INNODB WRITES TEMP FILES +# +# If innodb_tmpdir is NULL or "", temporary file will be created in +# server configuration variable location(--tmpdir) +create table t1(a int primary key)engine=innodb; +show session variables like 'innodb_tmpdir'; +Variable_name Value +innodb_tmpdir +alter table t1 add column b int not null; +set global innodb_tmpdir=NULL; +connect con1,localhost,root; +show session variables like 'innodb_tmpdir'; +Variable_name Value +innodb_tmpdir +alter table t1 add key(b); +connection default; +disconnect con1; +drop table t1; +# innodb_tmpdir with invalid path. +create table t1(a int primary key)engine=innodb; +set global innodb_tmpdir='wrong_value'; +ERROR 42000: Variable 'innodb_tmpdir' can't be set to the value of 'wrong_value' +show warnings; +Level Code Message +Warning 1210 InnoDB: Path doesn't exist. +Error 1231 Variable 'innodb_tmpdir' can't be set to the value of 'wrong_value' +drop table t1; +# innodb_tmpdir with mysql data directory path. +create table t1(a text, b text, fulltext(a,b))engine=innodb; +insert into t1 values('test1', 'test2'); +insert into t1 values('text1', 'text2'); +set global innodb_tmpdir = @@global.datadir; +ERROR 42000: Variable 'innodb_tmpdir' can't be set to the value of 'MYSQL_DATADIR' +show warnings; +Level Code Message +Warning 1210 InnoDB: Path Location should not be same as mysql data directory location. +Error 1231 DATADIR/data/' +drop table t1; +# innodb_tmpdir with valid location. +create table t1(a text, b text, fulltext(a,b))engine=innodb; +insert into t1 values('test1', 'test2'); +insert into t1 values('text1', 'text2'); +set @tmpdir = @@global.tmpdir; +set global innodb_tmpdir = @tmpdir; +show session variables like 'innodb_tmpdir'; +Variable_name Value +innodb_tmpdir +connect con3,localhost,root; +alter table t1 add fulltext(b); +disconnect con3; +connection default; +set global innodb_tmpdir=NULL; +drop table t1; diff --git a/mysql-test/suite/innodb/r/trigger.result b/mysql-test/suite/innodb/r/trigger.result new file mode 100644 index 00000000..8218e6e8 --- /dev/null +++ b/mysql-test/suite/innodb/r/trigger.result @@ -0,0 +1,28 @@ +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT) ENGINE=InnoDB; +CREATE TABLE t3 (c INT) ENGINE=InnoDB; +CREATE TRIGGER tr BEFORE INSERT ON t3 FOR EACH ROW BEGIN SAVEPOINT sv; INSERT INTO t2 VALUES (0); END $$ +START TRANSACTION; +DELETE FROM t1; +connect con1,localhost,root,,test; +START TRANSACTION; +INSERT INTO t2 VALUES (2); +UPDATE t2 SET b = b+1; +INSERT INTO t1 VALUES (1); +connection default; +COMMIT; +connection con1; +COMMIT; +disconnect con1; +connection default; +SELECT * FROM t1; +a +1 +SELECT * FROM t2; +b +3 +SELECT * FROM t3; +c +DROP TABLE t1, t2, t3; +DROP TRIGGER tr; +ERROR HY000: Trigger does not exist diff --git a/mysql-test/suite/innodb/r/trigger_error.result b/mysql-test/suite/innodb/r/trigger_error.result new file mode 100644 index 00000000..ef5f910e --- /dev/null +++ b/mysql-test/suite/innodb/r/trigger_error.result @@ -0,0 +1,28 @@ +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +CREATE TABLE t2 (i INT) ENGINE=InnoDB; +CREATE OR REPLACE TRIGGER tr1 +AFTER UPDATE ON t2 +FOR EACH ROW +INSERT INTO tlog (i) VALUES (1); +INSERT IGNORE INTO t2 VALUES (1); +CREATE TRIGGER IF NOT EXISTS tr2 +BEFORE INSERT ON t2 +FOR EACH ROW +INSERT INTO tlog (i) VALUES (2); +START TRANSACTION; +INSERT INTO t1 VALUES (1); +UPDATE t2 SET i = 3; +ERROR 42S02: Table 'test.tlog' doesn't exist +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (4); +ERROR 42S02: Table 'test.tlog' doesn't exist +UPDATE t1 SET i = 4 LIMIT 1; +COMMIT; +SELECT * FROM t1; +i +4 +2 +SELECT * FROM t2; +i +1 +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/r/truncate.result b/mysql-test/suite/innodb/r/truncate.result new file mode 100644 index 00000000..ae1ca0f4 --- /dev/null +++ b/mysql-test/suite/innodb/r/truncate.result @@ -0,0 +1,62 @@ +CREATE TABLE t (a SERIAL) ENGINE=InnoDB; +connect dml,localhost,root; +select * from t; +a +connection default; +TRUNCATE TABLE t; +disconnect dml; +DROP TABLE t; +# +# MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED +# +CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB KEY_BLOCK_SIZE=4; +TRUNCATE TABLE t1; +SHOW TABLE STATUS; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 InnoDB # Compressed # # # # # # 1 # # NULL latin1_swedish_ci NULL key_block_size=4 0 N +DROP TABLE t1; +# +# MDEV-17859 Operating system errors in file operations +# after failed CREATE +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +call mtr.add_suppression("InnoDB: (Operating system )?[Ee]rror number"); +call mtr.add_suppression("InnoDB: Cannot create file '.*t1\\.ibd"); +FLUSH TABLES; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +ERROR 42S01: Table '`test`.`t1`' already exists +SELECT * FROM t1; +a +1 +DROP TABLE t1; +# +# MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO +# +CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +TRUNCATE t1; +SELECT * FROM t1; +a +DROP TEMPORARY TABLE t1; +# +# MDEV-23705 Assertion 'table->data_dir_path || !space' +# +CREATE TABLE t(c INT) ENGINE=InnoDB; +ALTER TABLE t DISCARD TABLESPACE; +RENAME TABLE t TO u; +TRUNCATE u; +Warnings: +Warning 1814 Tablespace has been discarded for table `u` +TRUNCATE u; +DROP TABLE u; +# +# Test for a regression found during MDEV-25506 rewrite of DROP +# +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=InnoDB; +LOCK TABLE t1 READ; +TRUNCATE TABLE t1; +TRUNCATE TABLE t1; +UNLOCK TABLES; +DROP TEMPORARY TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/truncate_crash.result b/mysql-test/suite/innodb/r/truncate_crash.result new file mode 100644 index 00000000..5e7380e3 --- /dev/null +++ b/mysql-test/suite/innodb/r/truncate_crash.result @@ -0,0 +1,16 @@ +FLUSH TABLES; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +connect wait,localhost,root,,test; +SET DEBUG_SYNC='before_trx_state_committed_in_memory SIGNAL c WAIT_FOR ever'; +TRUNCATE TABLE t1; +connection default; +SET DEBUG_SYNC='now WAIT_FOR c'; +# restart +disconnect wait; +InnoDB 0 transactions not purged +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +TRUNCATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/truncate_foreign.result b/mysql-test/suite/innodb/r/truncate_foreign.result new file mode 100644 index 00000000..e587baa5 --- /dev/null +++ b/mysql-test/suite/innodb/r/truncate_foreign.result @@ -0,0 +1,101 @@ +CREATE TABLE parent (a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO parent SET a=1; +CREATE TABLE child (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES parent(a) +ON UPDATE CASCADE) +ENGINE=InnoDB; +INSERT INTO child SET a=1; +TRUNCATE TABLE parent; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`parent` (`a`)) +TRUNCATE TABLE child; +INSERT INTO child SET a=1; +UPDATE parent SET a=2; +SELECT * FROM child; +a +2 +connect dml,localhost,root; +SET DEBUG_SYNC='foreign_constraint_update_cascade SIGNAL fk WAIT_FOR go'; +UPDATE parent SET a=3; +connection default; +SET DEBUG_SYNC='now WAIT_FOR fk'; +SET lock_wait_timeout=1; +TRUNCATE TABLE child; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC='now SIGNAL go'; +connection dml; +SELECT * FROM child; +a +3 +SET DEBUG_SYNC='foreign_constraint_check_for_update SIGNAL fk WAIT_FOR go'; +DELETE FROM parent; +connection default; +SET DEBUG_SYNC='now WAIT_FOR fk'; +SET lock_wait_timeout=1; +TRUNCATE TABLE child; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC='now SIGNAL go'; +connection dml; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON UPDATE CASCADE) +SELECT * FROM child; +a +3 +INSERT INTO parent SET a=5; +SET DEBUG_SYNC='foreign_constraint_check_for_ins SIGNAL fk WAIT_FOR go'; +INSERT INTO child SET a=5; +connection default; +SET DEBUG_SYNC='now WAIT_FOR fk'; +SET foreign_key_checks=0, innodb_lock_wait_timeout=0; +TRUNCATE TABLE parent; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC='now SIGNAL go'; +connection dml; +SELECT * FROM parent; +a +3 +5 +SELECT * FROM child; +a +3 +5 +disconnect dml; +connection default; +SET DEBUG_SYNC = RESET; +DROP TABLE child, parent; +# +# MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE or +# ER_CRASHED_ON_USAGE after ALTER on table with foreign key +# +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a) ON UPDATE CASCADE; +LOCK TABLE t1 WRITE; +TRUNCATE TABLE t1; +ALTER TABLE t1 ADD c INT; +UNLOCK TABLES; +DROP TABLE t1; +# +# MDEV-26052 Assertion prebuilt->trx_id < table->def_trx_id failed +# +call mtr.add_suppression("InnoDB: In ALTER TABLE `test`\\.`t1` has or is"); +CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a), ALGORITHM=COPY; +INSERT INTO t1 VALUES (1,1); +LOCK TABLES t1 WRITE; +SET FOREIGN_KEY_CHECKS=1; +TRUNCATE t1; +ERROR HY000: Cannot add foreign key constraint for `t1` +INSERT INTO t1 VALUES (2,2); +ERROR HY000: Table 't1' was not locked with LOCK TABLES +SELECT * FROM t1; +pk a +1 1 +UNLOCK TABLES; +INSERT INTO t1 VALUES (2,2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) +SET FOREIGN_KEY_CHECKS=0; +INSERT INTO t1 VALUES (2,2); +SELECT * FROM t1; +pk a +1 1 +2 2 +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/truncate_missing.result b/mysql-test/suite/innodb/r/truncate_missing.result new file mode 100644 index 00000000..9e28d0fe --- /dev/null +++ b/mysql-test/suite/innodb/r/truncate_missing.result @@ -0,0 +1,18 @@ +call mtr.add_suppression("InnoDB: Operating system error number "); +call mtr.add_suppression("InnoDB: (Error number \\d+ means|If you are|Cannot open datafile) "); +call mtr.add_suppression("InnoDB: Ignoring tablespace for test/t "); +call mtr.add_suppression("InnoDB: Table test/t .* does not exist"); +CREATE TABLE t (a SERIAL) ENGINE=InnoDB; +INSERT INTO t() VALUES(); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `a` (`a`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# restart +SELECT * FROM t; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +TRUNCATE TABLE t; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/trx_id_future.result b/mysql-test/suite/innodb/r/trx_id_future.result new file mode 100644 index 00000000..c9beb17b --- /dev/null +++ b/mysql-test/suite/innodb/r/trx_id_future.result @@ -0,0 +1,13 @@ +# +# Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING +# IN THE FUTURE +# +CREATE TABLE t1(a INT) row_format=redundant engine=innoDB; +INSERT INTO t1 VALUES(1); +InnoDB 0 transactions not purged +call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum"); +call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption"); +call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); +SELECT * FROM t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/trx_sys_t_find_lf_hash_error.result b/mysql-test/suite/innodb/r/trx_sys_t_find_lf_hash_error.result new file mode 100644 index 00000000..11d3fb4a --- /dev/null +++ b/mysql-test/suite/innodb/r/trx_sys_t_find_lf_hash_error.result @@ -0,0 +1,25 @@ +create table t1 (a int) engine=innodb STATS_PERSISTENT=0; +create table t2 (a int) engine=innodb STATS_PERSISTENT=0; +BEGIN; +insert into t1 values(1); +connect con_1, localhost, root,,; +SET DEBUG_SYNC="before_trx_hash_find_element_mutex_enter SIGNAL before_mutex_enter WAIT_FOR cont1"; +SET DEBUG_SYNC="after_trx_hash_find_element_mutex_enter SIGNAL after_mutex_enter WAIT_FOR cont2"; +SELECT * FROM t1 WHERE a = 1 FOR UPDATE; +connection default; +SET DEBUG_SYNC="now WAIT_FOR before_mutex_enter"; +COMMIT; +SET DEBUG_SYNC="now SIGNAL cont1"; +SET DEBUG_SYNC="now WAIT_FOR after_mutex_enter"; +insert into t2 values(1); +BEGIN; +INSERT INTO t2 VALUES(2); +SET DEBUG_SYNC="now SIGNAL cont2"; +connection con_1; +a +1 +disconnect con_1; +connection default; +DROP TABLE t1; +DROP TABLE t2; +SET DEBUG_SYNC="reset"; diff --git a/mysql-test/suite/innodb/r/undo_log.result b/mysql-test/suite/innodb/r/undo_log.result new file mode 100644 index 00000000..6e377951 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_log.result @@ -0,0 +1,156 @@ +SET innodb_strict_mode=OFF; +CREATE TABLE test_tab ( +a_str_18 mediumtext, +b_str_3 varchar(32) DEFAULT NULL, +a_str_13 mediumtext, +b_str_5 varchar(40) DEFAULT NULL, +b_str_6 varchar(50) DEFAULT NULL, +b_str_7 char(32) DEFAULT NULL, +b_str_8 varchar(32) DEFAULT NULL, +b_str_9 varchar(255) DEFAULT NULL, +a_str_28 char(255) DEFAULT NULL, +a_str_27 varchar(255) DEFAULT NULL, +b_str_10 varchar(32) DEFAULT NULL, +a_str_26 varchar(255) DEFAULT NULL, +a_str_6 varchar(50) DEFAULT NULL, +b_str_11 varchar(32) DEFAULT NULL, +b_str_12 varchar(255) DEFAULT NULL, +b_str_13 char(32) DEFAULT NULL, +b_str_14 varchar(32) DEFAULT NULL, +b_str_15 char(32) DEFAULT NULL, +b_str_16 char(32) DEFAULT NULL, +b_str_17 varchar(32) DEFAULT NULL, +b_str_18 varchar(32) DEFAULT NULL, +a_str_25 varchar(40) DEFAULT NULL, +b_str_19 varchar(255) DEFAULT NULL, +a_str_23 varchar(40) DEFAULT NULL, +b_str_20 varchar(32) DEFAULT NULL, +a_str_21 varchar(255) DEFAULT NULL, +a_str_20 varchar(255) DEFAULT NULL, +a_str_39 varchar(255) DEFAULT NULL, +a_str_38 varchar(255) DEFAULT NULL, +a_str_37 varchar(255) DEFAULT NULL, +b_str_21 char(32) DEFAULT NULL, +b_str_23 varchar(80) DEFAULT NULL, +b_str_24 varchar(32) DEFAULT NULL, +b_str_25 varchar(32) DEFAULT NULL, +b_str_26 char(32) NOT NULL DEFAULT '', +b_str_27 varchar(255) DEFAULT NULL, +a_str_36 varchar(255) DEFAULT NULL, +a_str_33 varchar(100) DEFAULT NULL, +a_ref_10 char(32) DEFAULT NULL, +b_str_28 char(32) DEFAULT NULL, +b_str_29 char(32) DEFAULT NULL, +a_ref_6 char(32) DEFAULT NULL, +a_ref_12 varchar(32) DEFAULT NULL, +a_ref_11 varchar(32) DEFAULT NULL, +a_str_49 varchar(40) DEFAULT NULL, +b_str_30 varchar(32) DEFAULT NULL, +a_ref_3 varchar(32) DEFAULT NULL, +a_str_48 varchar(40) DEFAULT NULL, +a_ref_1 char(32) DEFAULT NULL, +b_str_31 varchar(32) DEFAULT NULL, +b_str_32 varchar(255) DEFAULT NULL, +b_str_33 char(32) DEFAULT NULL, +b_str_34 varchar(32) DEFAULT NULL, +a_str_47 varchar(40) DEFAULT NULL, +b_str_36 varchar(255) DEFAULT NULL, +a_str_46 varchar(40) DEFAULT NULL, +a_str_45 varchar(255) DEFAULT NULL, +b_str_38 varchar(32) DEFAULT NULL, +b_str_39 char(32) DEFAULT NULL, +b_str_40 varchar(32) DEFAULT NULL, +a_str_41 varchar(255) DEFAULT NULL, +b_str_41 varchar(32) DEFAULT NULL, +PRIMARY KEY (b_str_26), +UNIQUE KEY a_str_47 (a_str_47), +UNIQUE KEY a_str_49 (a_str_49), +UNIQUE KEY a_str_33 (a_str_33), +UNIQUE KEY a_str_46 (a_str_46), +UNIQUE KEY a_str_48 (a_str_48), +KEY b_str_18 (b_str_18), +KEY a_str_26 (a_str_26), +KEY b_str_27 (b_str_27,b_str_19), +KEY b_str_41 (b_str_41), +KEY b_str_15 (b_str_15), +KEY a_str_20 (a_str_20), +KEY b_str_17 (b_str_17), +KEY b_str_40 (b_str_40), +KEY b_str_24 (b_str_24), +KEY b_str_10 (b_str_10), +KEY b_str_16 (b_str_16), +KEY b_str_29 (b_str_29), +KEY a_str_41 (a_str_41), +KEY b_str_7 (b_str_7), +KEY a_str_45 (a_str_45), +KEY a_str_28 (a_str_28), +KEY a_str_37 (a_str_37), +KEY b_str_6 (b_str_6), +KEY a_ref_6 (a_ref_6), +KEY b_str_34 (b_str_34), +KEY b_str_38 (b_str_38), +KEY a_ref_10 (a_ref_10), +KEY b_str_21 (b_str_21), +KEY b_str_23 (b_str_23,b_str_19), +KEY b_str_33 (b_str_33), +KEY a_ref_12 (a_ref_12), +KEY a_str_18 (a_str_18(255)), +KEY a_str_39 (a_str_39), +KEY a_str_27 (a_str_27), +KEY a_str_25 (a_str_25), +KEY b_str_9 (b_str_9), +KEY a_str_23 (a_str_23), +KEY b_str_8 (b_str_8), +KEY a_str_21 (a_str_21), +KEY b_str_3 (b_str_3), +KEY b_str_30 (b_str_30), +KEY b_str_12 (b_str_12), +KEY b_str_25 (b_str_25), +KEY b_str_13 (b_str_13), +KEY a_str_38 (a_str_38), +KEY a_str_13 (a_str_13(255)), +KEY a_str_36 (a_str_36), +KEY b_str_28 (b_str_28), +KEY b_str_19 (b_str_19), +KEY b_str_11 (b_str_11), +KEY a_ref_1 (a_ref_1), +KEY b_str_20 (b_str_20), +KEY b_str_14 (b_str_14), +KEY a_ref_3 (a_ref_3), +KEY b_str_39 (b_str_39), +KEY b_str_32 (b_str_32), +KEY a_str_6 (a_str_6), +KEY b_str_5 (b_str_5), +KEY b_str_31 (b_str_31), +KEY a_ref_11 (a_ref_11) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT; +Warnings: +Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +SET innodb_strict_mode=ON; +BEGIN; +INSERT INTO test_tab (b_str_26, a_str_13, a_str_18) VALUES +('a', REPEAT('f',4031), REPEAT('g', 4031)); +UPDATE test_tab SET a_str_13=REPEAT('h',4032), a_str_18=REPEAT('i',4032); +SELECT 'Reducing length to 4030'; +Reducing length to 4030 +Reducing length to 4030 +UPDATE test_tab SET a_str_13=REPEAT('j',4030), a_str_18=REPEAT('k',4030); +UPDATE test_tab SET a_str_13=REPEAT('l',4031), a_str_18=REPEAT('m',4031); +ROLLBACK; +SELECT COUNT(*) FROM test_tab; +COUNT(*) +0 +CHECK TABLE test_tab; +Table Op Msg_type Msg_text +test.test_tab check status OK +DROP TABLE test_tab; +CREATE TEMPORARY TABLE t2(i INT)ENGINE=InnoDB; +CREATE TABLE t1(i TEXT NOT NULL) ENGINE=INNODB; +BEGIN; +INSERT t1 SET i=REPEAT('1234567890',840); +UPDATE t1 SET i=''; +INSERT INTO t2 VALUES(2); +ROLLBACK; +InnoDB 0 transactions not purged +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/undo_space_dblwr.result b/mysql-test/suite/innodb/r/undo_space_dblwr.result new file mode 100644 index 00000000..d6822b20 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_space_dblwr.result @@ -0,0 +1,20 @@ +call mtr.add_suppression("Checksum mismatch in the first page of file"); +show variables like 'innodb_doublewrite'; +Variable_name Value +innodb_doublewrite ON +create table t1(f1 int not null, f2 int not null)engine=innodb; +insert into t1 values (1, 1); +InnoDB 0 transactions not purged +set GLOBAL innodb_log_checkpoint_now=1; +# Make the first page dirty for undo tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 1; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=0.0; +# Kill the server +# restart +FOUND 1 /Checksum mismatch in the first page of file/ in mysqld.1.err +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/suite/innodb/r/undo_truncate.result b/mysql-test/suite/innodb/r/undo_truncate.result new file mode 100644 index 00000000..f90bef94 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_truncate.result @@ -0,0 +1,40 @@ +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=2 +SET GLOBAL innodb_undo_log_truncate = 0; +=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === +Space_Name Page_Size Zip_Size Path +innodb_undo001 DEFAULT DEFAULT MYSQLD_DATADIR//undo001 +innodb_undo002 DEFAULT DEFAULT MYSQLD_DATADIR//undo002 +innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 +create table t1(keyc int primary key, c char(100)) engine = innodb; +create table t2(keyc int primary key, c char(100)) engine = innodb; +connect con1,localhost,root,,; +begin; +insert into t1 select seq,'a' from seq_1_to_20000; +connect con2,localhost,root,,; +begin; +insert into t2 select seq,'a' from seq_1_to_20000; +connection con1; +update t1 set c = 'mysql'; +connection con2; +update t2 set c = 'mysql'; +connection con1; +update t1 set c = 'oracle'; +connection con2; +update t2 set c = 'oracle'; +connection con1; +delete from t1; +connection con2; +delete from t2; +connection con1; +SET GLOBAL innodb_undo_log_truncate = 1; +commit; +disconnect con1; +connection con2; +commit; +disconnect con2; +connection default; +SET GLOBAL innodb_max_purge_lag_wait=0; +set global innodb_fast_shutdown=0; +# restart +drop table t1, t2; diff --git a/mysql-test/suite/innodb/r/undo_truncate_recover.result b/mysql-test/suite/innodb/r/undo_truncate_recover.result new file mode 100644 index 00000000..777c9ce5 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result @@ -0,0 +1,16 @@ +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=2 +SET GLOBAL innodb_undo_log_truncate = 1; +create table t1(keyc int primary key, c char(100)) engine = innodb; +begin; +commit; +begin; +update t1 set c = 'MariaDB'; +update t1 set c = 'InnoDB'; +set global debug_dbug = '+d,ib_undo_trunc'; +commit; +drop table t1; +call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces"); +SET GLOBAL innodb_fast_shutdown=0; +FOUND 1 /ib_undo_trunc/ in mysqld.1.err +# restart: with restart_parameters diff --git a/mysql-test/suite/innodb/r/undo_upgrade.result b/mysql-test/suite/innodb/r/undo_upgrade.result new file mode 100644 index 00000000..f2eca9e2 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_upgrade.result @@ -0,0 +1,64 @@ +# +# MDEV-19229 Allow innodb_undo_tablespaces to be changed +# after database creation +# +call mtr.add_suppression("Found .* prepared XA transactions"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); +call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=\\d+ because previous shutdown was not with innodb_fast_shutdown=0"); +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +# case 1: XA transaction alone left +InnoDB 0 transactions not purged +XA START 'zombie'; +INSERT INTO t1 VALUES(2); +XA END 'zombie'; +XA PREPARE 'zombie'; +# restart +# Display 4 undo tablespaces +select @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +4 +# Should list 4 undo log tablespaces +undo001 +undo002 +undo003 +undo004 +XA COMMIT 'zombie'; +# case 2: Successful innodb_undo_tablespace upgrade +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=2 +# Display 2 undo tablespaces +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +2 +# Should list 2 undo log tablespaces +undo001 +undo002 +DROP TABLE t1; +InnoDB 0 transactions not purged +# case 3: Reduce the innodb_undo_tablespace to 0 +# restart: --innodb_undo_tablespaces=0 +# Display 0 undo tablespace +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +0 +# Shouldn't list any undo log tablespaces +# case 4: Change undo tablespace when force_recovery < 5 +# restart: --innodb_undo_tablespaces=2 --innodb_force_recovery=4 +# Display 2 undo tablespace +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +2 +# Should list 2 undo log tablespaces +undo001 +undo002 +# case 5: Fail to change undo tablespace when force_recovery > 4 +# restart: --innodb_undo_tablespaces=4 --innodb_force_recovery=5 +# Display 2 undo tablespace +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +2 +# Should list 2 undo log tablespaces, not 4 +undo001 +undo002 diff --git a/mysql-test/suite/innodb/r/undo_upgrade_debug.result b/mysql-test/suite/innodb/r/undo_upgrade_debug.result new file mode 100644 index 00000000..9c464459 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_upgrade_debug.result @@ -0,0 +1,43 @@ +# +# MDEV-19229 Allow innodb_undo_tablespaces to be changed +# after database creation +# +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); +set global innodb_fast_shutdown=0; +# case 1: Abort after resetting TRX_SYS page rollback segments +# restart: --innodb_undo_tablespaces=4 --debug_dbug=+d,after_rseg_reset_abort +# restart: --innodb_undo_tablespaces=4 +# Should list 4 undo log tablespaces +undo001 +undo002 +undo003 +undo004 +# case 2: Abort after deleting the old undo tablespaces +# restart: --innodb_undo_tablespaces=2 --debug_dbug=+d,after_deleting_old_undo_abort +# restart: --innodb_undo_tablespaces=2 +# Should list 2 undo log tablespaces +undo001 +undo002 +# case 3: Abort after successfully deleting the old undo tablespace +# restart: --innodb_undo_tablespaces=3 --debug_dbug=+d,after_deleting_old_undo_success +# restart: --innodb_undo_tablespaces=3 +# Should list 3 undo log tablespaces +undo001 +undo002 +undo003 +# case 4: Abort after re-creating new undo tablespaces +# restart: --innodb_undo_tablespaces=4 --debug_dbug=+d,after_reinit_undo_abort +# restart: --innodb_undo_tablespaces=4 +# Should list 4 undo log tablespaces +undo001 +undo002 +undo003 +undo004 +# case 5: Abort after re-creating new undo tablespaces successfully +# restart: --innodb_undo_tablespaces=2 --debug_dbug=+d,after_reinit_undo_success +# restart: --innodb_undo_tablespaces=2 +# Should list 2 undo log tablespaces +undo001 +undo002 diff --git a/mysql-test/suite/innodb/r/update-cascade.result b/mysql-test/suite/innodb/r/update-cascade.result new file mode 100644 index 00000000..00d052a0 --- /dev/null +++ b/mysql-test/suite/innodb/r/update-cascade.result @@ -0,0 +1,290 @@ +# +# Bug #18451287 REDUNDANT DELETE MARKING AFTER DB_LOCK_WAIT +# +create table t1 (f1 int primary key, f2 blob) engine=innodb; +create table t2 (f1 int primary key, f2 int, +foreign key (f2) references t1(f1) on update cascade) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` blob DEFAULT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + PRIMARY KEY (`f1`), + KEY `f2` (`f2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values (1, repeat('+', 20000)); +insert into t1 values (2, repeat('-', 20000)); +insert into t1 values (3, repeat('=', 20000)); +insert into t2 values (1, 2); +select f1, right(f2, 20) as p2 from t1; +f1 p2 +1 ++++++++++++++++++++ +2 -------------------- +3 ==================== +select f1, f2 from t2; +f1 f2 +1 2 +connect con1,localhost,root,,test; +start transaction; +select f1, f2 from t2 for update; +f1 f2 +1 2 +connection default; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; +update t1 set f1 = 10 where f1 = 2; +connection con1; +set debug_sync='now WAIT_FOR upd_waiting'; +rollback; +set debug_sync='now SIGNAL go_upd'; +connection default; +# reap: update t1 set f1 = 10 where f1 = 2; +select f1, right(f2, 20) as p2 from t1; +f1 p2 +1 ++++++++++++++++++++ +3 ==================== +10 -------------------- +select f1, f2 from t2; +f1 f2 +1 10 +drop table t2, t1; +set debug_sync = reset; +# +# Test Scenario: Two tables t1 -> t2 are involved in update cascade. +# If DB_LOCK_WAIT happens when t1 is being updated and FK constraints +# are being checked in t2, then retry must happen on t1. The update +# cascade happens in secondary index. For secondary index testing, +# blobs are not needed. +# +create table t1 (f1 int primary key, f2 int, key k1(f2)) engine=innodb; +create table t2 (f1 int primary key, f2 int, +foreign key (f2) references t1(f2) on update cascade) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + PRIMARY KEY (`f1`), + KEY `k1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + PRIMARY KEY (`f1`), + KEY `f2` (`f2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values (1, 91); +insert into t2 values (1, 91); +select f1, f2 from t1; +f1 f2 +1 91 +select f1, f2 from t2; +f1 f2 +1 91 +connection con1; +start transaction; +select f1, f2 from t2 for update; +f1 f2 +1 91 +connection default; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; +update t1 set f2 = 28 where f2 = 91; +connection con1; +set debug_sync='now WAIT_FOR upd_waiting'; +rollback; +set debug_sync='now SIGNAL go_upd'; +connection default; +# reap: update t1 set f1 = 10 where f1 = 2; +select f1, f2 from t1; +f1 f2 +1 28 +select f1, f2 from t2; +f1 f2 +1 28 +drop table t2, t1; +set debug_sync = reset; +# +# Test Scenario: Three tables t1 -> t2 -> t3 are involved in update cascade. +# If DB_LOCK_WAIT happens when t2 is being updated, then retry must happen +# on t2. +# +create table t1 (f1 int primary key, f2 blob) engine=innodb; +create table t2 (f1 int primary key, f2 blob, +foreign key (f1) references t1(f1) on update cascade) engine=innodb; +create table t3 (f1 int primary key, f2 blob, +foreign key (f1) references t2(f1) on update cascade) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` blob DEFAULT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` blob DEFAULT NULL, + PRIMARY KEY (`f1`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `f1` int(11) NOT NULL, + `f2` blob DEFAULT NULL, + PRIMARY KEY (`f1`), + CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t2` (`f1`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values (2, repeat('-', 20000)); +insert into t2 values (2, repeat('%', 20000)); +insert into t3 values (2, repeat('+', 20000)); +select f1, right(f2, 20) as p2 from t1; +f1 p2 +2 -------------------- +select f1, right(f2, 20) as p2 from t2; +f1 p2 +2 %%%%%%%%%%%%%%%%%%%% +select f1, right(f2, 20) as p2 from t3; +f1 p2 +2 ++++++++++++++++++++ +connection con1; +start transaction; +select f1 from t3 for update; +f1 +2 +connection default; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; +update t1 set f1 = 10 where f1 = 2; +connection con1; +set debug_sync='now WAIT_FOR upd_waiting'; +rollback; +# The table t1 is updated. +# In t2 delete-mark happened. Retry will happen on t2. +# In t3 yet to be updated. +set session transaction isolation level read uncommitted; +start transaction; +select f1, right(f2, 20) as p2 from t1; +f1 p2 +select f1, right(f2, 20) as p2 from t2; +f1 p2 +select f1, right(f2, 20) as p2 from t3; +f1 p2 +2 ++++++++++++++++++++ +commit; +set debug_sync='now SIGNAL go_upd'; +connection default; +# reap: update t1 set f1 = 10 where f1 = 2; +start transaction; +select f1, right(f2, 20) as p2 from t1; +f1 p2 +10 -------------------- +select f1, right(f2, 20) as p2 from t2; +f1 p2 +10 %%%%%%%%%%%%%%%%%%%% +select f1, right(f2, 20) as p2 from t3; +f1 p2 +10 ++++++++++++++++++++ +commit; +drop table t3, t2, t1; +set debug_sync = reset; +# +# Test Scenario: Three tables t1 -> t2 -> t3 are involved in update +# cascade. If DB_LOCK_WAIT happens when t2 is being updated, then +# retry must happen on t2. The update cascade is happening via +# secondary index (hence blobs are not needed). +# +create table t1 (f1 int primary key, f2 int, key k1(f2)) engine=innodb; +create table t2 (f1 int primary key, f2 int, +foreign key (f2) references t1(f2) on update cascade) engine=innodb; +create table t3 (f1 int primary key, f2 int, +foreign key (f2) references t2(f2) on update cascade) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + PRIMARY KEY (`f1`), + KEY `k1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + PRIMARY KEY (`f1`), + KEY `f2` (`f2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `f1` int(11) NOT NULL, + `f2` int(11) DEFAULT NULL, + PRIMARY KEY (`f1`), + KEY `f2` (`f2`), + CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t2` (`f2`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values (2, 91); +insert into t2 values (2, 91); +insert into t3 values (2, 91); +select f1, f2 from t1; +f1 f2 +2 91 +select f1, f2 from t2; +f1 f2 +2 91 +select f1, f2 from t3; +f1 f2 +2 91 +connection con1; +start transaction; +select f1 from t3 for update; +f1 +2 +connection default; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; +update t1 set f2 = 28 where f2 = 91; +connection con1; +set debug_sync='now WAIT_FOR upd_waiting'; +rollback; +# The table t1 is updated. +# In t2 delete-mark happened. Retry will happen on t2. +# In t3 yet to be updated. +set session transaction isolation level read uncommitted; +start transaction; +select f1, f2 from t1; +f1 f2 +select f1, f2 from t2; +f1 f2 +select f1, f2 from t3; +f1 f2 +2 91 +commit; +set debug_sync='now SIGNAL go_upd'; +disconnect con1; +connection default; +# reap: update t1 set f2 = 28 where f2 = 91; +start transaction; +select f1, f2 from t1; +f1 f2 +2 28 +select f1, f2 from t2; +f1 f2 +2 28 +select f1, f2 from t3; +f1 f2 +2 28 +commit; +drop table t3, t2, t1; +set debug_sync = reset; diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result new file mode 100644 index 00000000..50f4f881 --- /dev/null +++ b/mysql-test/suite/innodb/r/update_time.result @@ -0,0 +1,38 @@ +# +# Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled +# correctly for InnoDB tables. +# +CREATE TABLE t (a INT) ENGINE=INNODB STATS_PERSISTENT=0; +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; +update_time +NULL +INSERT INTO t VALUES (1); +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; +COUNT(*) +1 +# We cant deterministically check that the saved value is correct, but +# at least we check that it is a timestamp not older than 2 minutes. +# Usually update_time and NOW() are equal below, but on heavily loaded +# machines NOW() could be younger. +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; +COUNT(*) +1 +# Test the behavior after restart with a prepared XA transaction +XA START 'xatrx'; +DELETE FROM t; +XA END 'xatrx'; +XA PREPARE 'xatrx'; +CONNECT con1,localhost,root,,; +call mtr.add_suppression("Found 1 prepared XA transactions"); +FLUSH TABLES; +# restart +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; +update_time +NULL +XA COMMIT 'xatrx'; +SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t'; +COUNT(update_time) +1 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/update_time_wl6658.result b/mysql-test/suite/innodb/r/update_time_wl6658.result new file mode 100644 index 00000000..fd8f8457 --- /dev/null +++ b/mysql-test/suite/innodb/r/update_time_wl6658.result @@ -0,0 +1,229 @@ +CREATE TABLE tab1(c1 int,c2 varchar(30), c3 BLOB) ENGINE=InnoDB; +CREATE TABLE tab1u LIKE tab1; +CREATE TABLE tab1d LIKE tab1; +CREATE TABLE tab1i LIKE tab1; +CREATE TABLE tab3(c1 int,c2 varchar(30)) ENGINE=InnoDB; +CREATE TABLE tab4(c1 int,c2 varchar(30)) ENGINE=InnoDB; +CREATE TABLE tab5(c1 int,c2 varchar(30)) ENGINE=InnoDB; +INSERT INTO tab1u VALUES(1,'Testing the wl6658','Testing the wl6658'); +INSERT INTO tab1d VALUES(1,'Updated','Updated'); +INSERT INTO tab4 VALUES(1,'Test for Update'); +INSERT INTO tab5 VALUES(1,'Test for Delete'); +CREATE TRIGGER test_trig BEFORE INSERT ON tab1 +FOR EACH ROW BEGIN +INSERT INTO tab3 VALUES(1,'Inserted From Trigger'); +UPDATE tab4 SET c2='Updated from Trigger' WHERE c1=1; +DELETE FROM tab5; +END | +CREATE TABLE tab2( +id INT NOT NULL, +store_name VARCHAR(30), +parts VARCHAR(30), +store_id INT +) ENGINE=InnoDB +PARTITION BY LIST(store_id) ( +PARTITION pNorth VALUES IN (10,20,30), +PARTITION pEast VALUES IN (40,50,60), +PARTITION pWest VALUES IN (70,80,100) +); +SELECT update_time +FROM information_schema.tables WHERE table_name='tab2'; +update_time +NULL +CREATE PROCEDURE proc_wl6658() +BEGIN +INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10); +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +COMMIT; +END | +CALL proc_wl6658; +SELECT * FROM tab2 ORDER BY id,store_id; +id store_name parts store_id +1 ORACLE NUTT 10 +2 HUAWEI BOLT 40 +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; +COUNT(update_time) +1 +TRUNCATE TABLE tab2; +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; +COUNT(update_time) +1 +CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB; +CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT, +FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE ) +ENGINE=INNODB; +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; +table_name update_time +tab7 NULL +tab8 NULL +INSERT INTO tab7 VALUES(1); +INSERT INTO tab8 VALUES(1,1); +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; +table_name COUNT(update_time) +tab7 1 +tab8 1 +#restart the server +# restart +SELECT table_name,update_time +FROM information_schema.tables +WHERE table_name IN ('tab1','tab2','tab3','tab4','tab5','tab7','tab8') +ORDER BY table_name; +table_name update_time +tab1 NULL +tab2 NULL +tab3 NULL +tab4 NULL +tab5 NULL +tab7 NULL +tab8 NULL +#case1: +BEGIN WORK; +INSERT INTO tab1 +VALUES(1,'Testing the wl6658', 'Testing the wl6658'); +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1'; +update_time +NULL +COMMIT; +SELECT * FROM tab1; +c1 c2 c3 +1 Testing the wl6658 Testing the wl6658 +SELECT * FROM tab3; +c1 c2 +1 Inserted From Trigger +SELECT * FROM tab4; +c1 c2 +1 Updated from Trigger +SELECT * FROM tab5; +c1 c2 +SELECT table_name,COUNT(update_time) +FROM information_schema.tables +WHERE table_name IN ('tab1','tab3','tab4','tab5') +GROUP BY table_name ORDER BY table_name; +table_name COUNT(update_time) +tab1 1 +tab3 1 +tab4 1 +tab5 1 +Testcase with UPDATE stmt and transaction +SELECT * FROM tab1u; +c1 c2 c3 +1 Testing the wl6658 Testing the wl6658 +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1u'; +update_time +NULL +#case2: +START TRANSACTION; +UPDATE tab1u SET c2='Updated',c3='Updated' WHERE c1=1; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1u'; +update_time +NULL +COMMIT; +SELECT * FROM tab1u; +c1 c2 c3 +1 Updated Updated +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1u'; +COUNT(update_time) +1 +SELECT * FROM tab1d; +c1 c2 c3 +1 Updated Updated +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1d'; +update_time +NULL +#case3: +START TRANSACTION; +DELETE FROM tab1d; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1d'; +update_time +NULL +COMMIT; +SELECT * FROM tab1d; +c1 c2 c3 +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1d'; +COUNT(update_time) +1 +SELECT * FROM tab1i; +c1 c2 c3 +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; +update_time +NULL +#case4: +START TRANSACTION; +INSERT INTO tab1i +VALUES(1,'Testing the wl6658', 'Testing the wl6658'); +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; +update_time +NULL +ROLLBACK; +SELECT * FROM tab1i; +c1 c2 c3 +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; +update_time +NULL +BEGIN WORK; +DELETE FROM tab1i; +SAVEPOINT A; +INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10); +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +SAVEPOINT B; +INSERT INTO tab2 VALUES(3,'IBM','NAIL',70); +SAVEPOINT C; +ROLLBACK to A; +SELECT * FROM tab2; +id store_name parts store_id +SELECT update_time +FROM information_schema.tables WHERE table_name='tab2'; +update_time +NULL +#execute DDL instead of commit +create table tab6(c1 int); +SELECT update_time +FROM information_schema.tables WHERE table_name='tab2'; +update_time +NULL +START TRANSACTION; +DELETE FROM tab7; +ROLLBACK; +SELECT * FROM tab7; +c1 +1 +SELECT * FROM tab8; +c1 c2 +1 1 +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; +table_name update_time +tab7 NULL +tab8 NULL +DELETE FROM tab7; +SELECT * FROM tab7; +c1 +SELECT * FROM tab8; +c1 c2 +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; +table_name COUNT(update_time) +tab7 1 +tab8 1 +#cleanup +DROP TRIGGER test_trig; +DROP TABLE tab1,tab1u,tab1d,tab1i,tab2,tab3,tab4,tab5,tab6,tab8,tab7; +DROP PROCEDURE proc_wl6658; diff --git a/mysql-test/suite/innodb/r/xa_debug.result b/mysql-test/suite/innodb/r/xa_debug.result new file mode 100644 index 00000000..7c2bd9f9 --- /dev/null +++ b/mysql-test/suite/innodb/r/xa_debug.result @@ -0,0 +1,362 @@ +call mtr.add_suppression("Found 50 prepared XA transactions"); +create table t1 (a int) engine=innodb; +insert into t1 values(1); +connect con$trial, localhost, root,,; +xa start 'test50'; +insert into t1 values(1); +xa end 'test50'; +xa prepare 'test50'; +connect con$trial, localhost, root,,; +xa start 'test49'; +insert into t1 values(1); +xa end 'test49'; +xa prepare 'test49'; +connect con$trial, localhost, root,,; +xa start 'test48'; +insert into t1 values(1); +xa end 'test48'; +xa prepare 'test48'; +connect con$trial, localhost, root,,; +xa start 'test47'; +insert into t1 values(1); +xa end 'test47'; +xa prepare 'test47'; +connect con$trial, localhost, root,,; +xa start 'test46'; +insert into t1 values(1); +xa end 'test46'; +xa prepare 'test46'; +connect con$trial, localhost, root,,; +xa start 'test45'; +insert into t1 values(1); +xa end 'test45'; +xa prepare 'test45'; +connect con$trial, localhost, root,,; +xa start 'test44'; +insert into t1 values(1); +xa end 'test44'; +xa prepare 'test44'; +connect con$trial, localhost, root,,; +xa start 'test43'; +insert into t1 values(1); +xa end 'test43'; +xa prepare 'test43'; +connect con$trial, localhost, root,,; +xa start 'test42'; +insert into t1 values(1); +xa end 'test42'; +xa prepare 'test42'; +connect con$trial, localhost, root,,; +xa start 'test41'; +insert into t1 values(1); +xa end 'test41'; +xa prepare 'test41'; +connect con$trial, localhost, root,,; +xa start 'test40'; +insert into t1 values(1); +xa end 'test40'; +xa prepare 'test40'; +connect con$trial, localhost, root,,; +xa start 'test39'; +insert into t1 values(1); +xa end 'test39'; +xa prepare 'test39'; +connect con$trial, localhost, root,,; +xa start 'test38'; +insert into t1 values(1); +xa end 'test38'; +xa prepare 'test38'; +connect con$trial, localhost, root,,; +xa start 'test37'; +insert into t1 values(1); +xa end 'test37'; +xa prepare 'test37'; +connect con$trial, localhost, root,,; +xa start 'test36'; +insert into t1 values(1); +xa end 'test36'; +xa prepare 'test36'; +connect con$trial, localhost, root,,; +xa start 'test35'; +insert into t1 values(1); +xa end 'test35'; +xa prepare 'test35'; +connect con$trial, localhost, root,,; +xa start 'test34'; +insert into t1 values(1); +xa end 'test34'; +xa prepare 'test34'; +connect con$trial, localhost, root,,; +xa start 'test33'; +insert into t1 values(1); +xa end 'test33'; +xa prepare 'test33'; +connect con$trial, localhost, root,,; +xa start 'test32'; +insert into t1 values(1); +xa end 'test32'; +xa prepare 'test32'; +connect con$trial, localhost, root,,; +xa start 'test31'; +insert into t1 values(1); +xa end 'test31'; +xa prepare 'test31'; +connect con$trial, localhost, root,,; +xa start 'test30'; +insert into t1 values(1); +xa end 'test30'; +xa prepare 'test30'; +connect con$trial, localhost, root,,; +xa start 'test29'; +insert into t1 values(1); +xa end 'test29'; +xa prepare 'test29'; +connect con$trial, localhost, root,,; +xa start 'test28'; +insert into t1 values(1); +xa end 'test28'; +xa prepare 'test28'; +connect con$trial, localhost, root,,; +xa start 'test27'; +insert into t1 values(1); +xa end 'test27'; +xa prepare 'test27'; +connect con$trial, localhost, root,,; +xa start 'test26'; +insert into t1 values(1); +xa end 'test26'; +xa prepare 'test26'; +connect con$trial, localhost, root,,; +xa start 'test25'; +insert into t1 values(1); +xa end 'test25'; +xa prepare 'test25'; +connect con$trial, localhost, root,,; +xa start 'test24'; +insert into t1 values(1); +xa end 'test24'; +xa prepare 'test24'; +connect con$trial, localhost, root,,; +xa start 'test23'; +insert into t1 values(1); +xa end 'test23'; +xa prepare 'test23'; +connect con$trial, localhost, root,,; +xa start 'test22'; +insert into t1 values(1); +xa end 'test22'; +xa prepare 'test22'; +connect con$trial, localhost, root,,; +xa start 'test21'; +insert into t1 values(1); +xa end 'test21'; +xa prepare 'test21'; +connect con$trial, localhost, root,,; +xa start 'test20'; +insert into t1 values(1); +xa end 'test20'; +xa prepare 'test20'; +connect con$trial, localhost, root,,; +xa start 'test19'; +insert into t1 values(1); +xa end 'test19'; +xa prepare 'test19'; +connect con$trial, localhost, root,,; +xa start 'test18'; +insert into t1 values(1); +xa end 'test18'; +xa prepare 'test18'; +connect con$trial, localhost, root,,; +xa start 'test17'; +insert into t1 values(1); +xa end 'test17'; +xa prepare 'test17'; +connect con$trial, localhost, root,,; +xa start 'test16'; +insert into t1 values(1); +xa end 'test16'; +xa prepare 'test16'; +connect con$trial, localhost, root,,; +xa start 'test15'; +insert into t1 values(1); +xa end 'test15'; +xa prepare 'test15'; +connect con$trial, localhost, root,,; +xa start 'test14'; +insert into t1 values(1); +xa end 'test14'; +xa prepare 'test14'; +connect con$trial, localhost, root,,; +xa start 'test13'; +insert into t1 values(1); +xa end 'test13'; +xa prepare 'test13'; +connect con$trial, localhost, root,,; +xa start 'test12'; +insert into t1 values(1); +xa end 'test12'; +xa prepare 'test12'; +connect con$trial, localhost, root,,; +xa start 'test11'; +insert into t1 values(1); +xa end 'test11'; +xa prepare 'test11'; +connect con$trial, localhost, root,,; +xa start 'test10'; +insert into t1 values(1); +xa end 'test10'; +xa prepare 'test10'; +connect con$trial, localhost, root,,; +xa start 'test9'; +insert into t1 values(1); +xa end 'test9'; +xa prepare 'test9'; +connect con$trial, localhost, root,,; +xa start 'test8'; +insert into t1 values(1); +xa end 'test8'; +xa prepare 'test8'; +connect con$trial, localhost, root,,; +xa start 'test7'; +insert into t1 values(1); +xa end 'test7'; +xa prepare 'test7'; +connect con$trial, localhost, root,,; +xa start 'test6'; +insert into t1 values(1); +xa end 'test6'; +xa prepare 'test6'; +connect con$trial, localhost, root,,; +xa start 'test5'; +insert into t1 values(1); +xa end 'test5'; +xa prepare 'test5'; +connect con$trial, localhost, root,,; +xa start 'test4'; +insert into t1 values(1); +xa end 'test4'; +xa prepare 'test4'; +connect con$trial, localhost, root,,; +xa start 'test3'; +insert into t1 values(1); +xa end 'test3'; +xa prepare 'test3'; +connect con$trial, localhost, root,,; +xa start 'test2'; +insert into t1 values(1); +xa end 'test2'; +xa prepare 'test2'; +connect con$trial, localhost, root,,; +xa start 'test1'; +insert into t1 values(1); +xa end 'test1'; +xa prepare 'test1'; +connection default; +FLUSH TABLES; +xa recover; +formatID gtrid_length bqual_length data +1 5 0 test1 +1 5 0 test2 +1 5 0 test3 +1 5 0 test4 +1 5 0 test5 +1 5 0 test6 +1 5 0 test7 +1 5 0 test8 +1 5 0 test9 +1 6 0 test10 +1 6 0 test11 +1 6 0 test12 +1 6 0 test13 +1 6 0 test14 +1 6 0 test15 +1 6 0 test16 +1 6 0 test17 +1 6 0 test18 +1 6 0 test19 +1 6 0 test20 +1 6 0 test21 +1 6 0 test22 +1 6 0 test23 +1 6 0 test24 +1 6 0 test25 +1 6 0 test26 +1 6 0 test27 +1 6 0 test28 +1 6 0 test29 +1 6 0 test30 +1 6 0 test31 +1 6 0 test32 +1 6 0 test33 +1 6 0 test34 +1 6 0 test35 +1 6 0 test36 +1 6 0 test37 +1 6 0 test38 +1 6 0 test39 +1 6 0 test40 +1 6 0 test41 +1 6 0 test42 +1 6 0 test43 +1 6 0 test44 +1 6 0 test45 +1 6 0 test46 +1 6 0 test47 +1 6 0 test48 +1 6 0 test49 +1 6 0 test50 +xa recover; +formatID gtrid_length bqual_length data +1 5 0 test1 +1 5 0 test2 +1 5 0 test3 +1 5 0 test4 +1 5 0 test5 +1 5 0 test6 +1 5 0 test7 +1 5 0 test8 +1 5 0 test9 +1 6 0 test10 +1 6 0 test11 +1 6 0 test12 +1 6 0 test13 +1 6 0 test14 +1 6 0 test15 +1 6 0 test16 +1 6 0 test17 +1 6 0 test18 +1 6 0 test19 +1 6 0 test20 +1 6 0 test21 +1 6 0 test22 +1 6 0 test23 +1 6 0 test24 +1 6 0 test25 +1 6 0 test26 +1 6 0 test27 +1 6 0 test28 +1 6 0 test29 +1 6 0 test30 +1 6 0 test31 +1 6 0 test32 +1 6 0 test33 +1 6 0 test34 +1 6 0 test35 +1 6 0 test36 +1 6 0 test37 +1 6 0 test38 +1 6 0 test39 +1 6 0 test40 +1 6 0 test41 +1 6 0 test42 +1 6 0 test43 +1 6 0 test44 +1 6 0 test45 +1 6 0 test46 +1 6 0 test47 +1 6 0 test48 +1 6 0 test49 +1 6 0 test50 +xa recover; +formatID gtrid_length bqual_length data +drop table t1; diff --git a/mysql-test/suite/innodb/r/xa_prepare_reset_supremum_lock.result b/mysql-test/suite/innodb/r/xa_prepare_reset_supremum_lock.result new file mode 100644 index 00000000..bd971adf --- /dev/null +++ b/mysql-test/suite/innodb/r/xa_prepare_reset_supremum_lock.result @@ -0,0 +1,33 @@ +CREATE TABLE t ( +`a` INT NOT NULL, +PRIMARY KEY (`a`) +) ENGINE=InnoDB; +INSERT INTO t VALUES(10); +INSERT INTO t VALUES(20); +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +XA START '1'; +SELECT * FROM t WHERE a > 20 FOR UPDATE; +a +INSERT INTO t VALUES(40); +XA END '1'; +XA PREPARE '1'; +connect con1,localhost,root; +SET innodb_lock_wait_timeout=1; +INSERT INTO t VALUES(50); +connection default; +XA COMMIT '1'; +XA START '1'; +SELECT * FROM t WHERE a > 20 LOCK IN SHARE MODE; +a +40 +50 +INSERT INTO t VALUES (5); +XA END '1'; +XA PREPARE '1'; +connection con1; +INSERT INTO t VALUES (60); +INSERT INTO t VALUES (30); +disconnect con1; +connection default; +XA COMMIT '1'; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result new file mode 100644 index 00000000..f61e29be --- /dev/null +++ b/mysql-test/suite/innodb/r/xa_recovery.result @@ -0,0 +1,39 @@ +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connect con1,localhost,root; +XA START 'x'; +UPDATE t1 set a=2; +XA END 'x'; +XA PREPARE 'x'; +connect con2,localhost,root; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +XA START 'y'; +INSERT INTO t2 VALUES (1); +XA END 'y'; +XA PREPARE 'y'; +connection default; +# restart: --innodb-force-recovery=2 +disconnect con1; +disconnect con2; +connect con1,localhost,root; +SELECT * FROM t1 LOCK IN SHARE MODE; +connection default; +SET innodb_lock_wait_timeout=1; +DROP TABLE t2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t1; +a +2 +XA ROLLBACK 'x'; +SELECT * FROM t1; +a +1 +DROP TABLE t1; +DROP TABLE t2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +XA ROLLBACK 'y'; +DROP TABLE t2; +SET GLOBAL innodb_fast_shutdown=0; +# restart diff --git a/mysql-test/suite/innodb/r/xa_recovery_debug.result b/mysql-test/suite/innodb/r/xa_recovery_debug.result new file mode 100644 index 00000000..d387bca2 --- /dev/null +++ b/mysql-test/suite/innodb/r/xa_recovery_debug.result @@ -0,0 +1,27 @@ +# +# Bug#20872655 XA ROLLBACK IS NOT CRASH-SAFE +# +CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=INNODB; +INSERT INTO t SET a=0; +connect con1,localhost,root; +XA START 'zombie'; +INSERT INTO t SET a=1; +UPDATE t SET b=1 WHERE a=1; +SELECT COUNT(*) FROM t; +COUNT(*) +2 +XA END 'zombie'; +XA PREPARE 'zombie'; +SET DEBUG_SYNC='trx_after_rollback_row SIGNAL s1 WAIT_FOR s2'; +XA ROLLBACK 'zombie'; +connection default; +SET DEBUG_SYNC='now WAIT_FOR s1'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t LIMIT 1; +# restart +disconnect con1; +XA COMMIT 'zombie'; +ERROR XAE04: XAER_NOTA: Unknown XID +SELECT * FROM t; +a b +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/xap_release_locks_on_dict_stats_table.result b/mysql-test/suite/innodb/r/xap_release_locks_on_dict_stats_table.result new file mode 100644 index 00000000..1a849f1c --- /dev/null +++ b/mysql-test/suite/innodb/r/xap_release_locks_on_dict_stats_table.result @@ -0,0 +1,17 @@ +call mtr.add_suppression("bytes freed by"); +SET @old_innodb_stats_persistent = @@innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=1; +CREATE TABLE t ENGINE=InnoDB AS SELECT 1; +SET @old_debug_dbug = @@global.debug_dbug; +XA START 'a'; +INSERT INTO mysql.innodb_index_stats SELECT '','' AS table_name,index_name,LAST_UPDATE,stat_name,0 AS stat_value,sample_size,stat_description FROM mysql.innodb_index_stats WHERE table_name='dummy' FOR UPDATE; +SET GLOBAL debug_dbug = "+d,dict_stats_save_exit_notify"; +INSERT INTO t VALUES (1); +XA END 'a'; +XA PREPARE 'a'; +SET DEBUG_SYNC="now WAIT_FOR dict_stats_save_finished"; +SET @@global.debug_dbug = @old_debug_dbug; +SET DEBUG_SYNC="RESET"; +SET GLOBAL innodb_stats_persistent = @old_innodb_stats_persistent; +XA COMMIT 'a'; +DROP TABLE t; -- cgit v1.2.3