Skip to content

Commit

Permalink
variable: Change the default value of charset/collation to utfbmb4/ut…
Browse files Browse the repository at this point in the history
…f8mb4_bin

TiDB does not support latin charset now. So change them to utf8mb4 to
avoid potential issues.
  • Loading branch information
shenli committed Aug 8, 2018
1 parent af7fed9 commit 811d9e5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/mysql"
"github.com/pingcap/tidb/terror"
"github.com/pingcap/tidb/util/charset"
)

// ScopeFlag is for system variable whether can be changed in global/session dynamically or not.
Expand Down Expand Up @@ -163,7 +164,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal, "innodb_max_undo_log_size", ""},
{ScopeGlobal | ScopeSession, "range_alloc_block_size", "4096"},
{ScopeGlobal, "connect_timeout", "10"},
{ScopeGlobal | ScopeSession, "collation_server", "latin1_swedish_ci"},
{ScopeGlobal | ScopeSession, "collation_server", charset.CollationUTF8MB4},
{ScopeNone, "have_rtree_keys", "YES"},
{ScopeGlobal, "innodb_old_blocks_pct", "37"},
{ScopeGlobal, "innodb_file_format", "Antelope"},
Expand Down Expand Up @@ -295,7 +296,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal | ScopeSession, "query_cache_wlock_invalidate", "OFF"},
{ScopeGlobal | ScopeSession, "sql_buffer_result", "OFF"},
{ScopeGlobal | ScopeSession, "character_set_filesystem", "binary"},
{ScopeGlobal | ScopeSession, "collation_database", "latin1_swedish_ci"},
{ScopeGlobal | ScopeSession, "collation_database", charset.CollationUTF8MB4},
{ScopeGlobal | ScopeSession, "auto_increment_increment", "1"},
{ScopeGlobal | ScopeSession, "max_heap_table_size", "16777216"},
{ScopeGlobal | ScopeSession, "div_precision_increment", "4"},
Expand All @@ -316,7 +317,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal, "innodb_purge_batch_size", "300"},
{ScopeNone, "have_profiling", "NO"},
{ScopeGlobal, "slave_checkpoint_group", "512"},
{ScopeGlobal | ScopeSession, "character_set_client", "latin1"},
{ScopeGlobal | ScopeSession, "character_set_client", charset.CharsetUTF8MB4},
{ScopeNone, "slave_load_tmpdir", "/var/tmp/"},
{ScopeGlobal, "innodb_buffer_pool_dump_now", "OFF"},
{ScopeGlobal, "relay_log_purge", "ON"},
Expand Down Expand Up @@ -391,7 +392,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal | ScopeSession, "binlog_direct_non_transactional_updates", "OFF"},
{ScopeGlobal, "innodb_change_buffering", "all"},
{ScopeGlobal | ScopeSession, "sql_big_selects", "ON"},
{ScopeGlobal | ScopeSession, CharacterSetResults, "latin1"},
{ScopeGlobal | ScopeSession, CharacterSetResults, charset.CharsetUTF8MB4},
{ScopeGlobal, "innodb_max_purge_lag_delay", "0"},
{ScopeGlobal | ScopeSession, "session_track_schema", ""},
{ScopeGlobal, "innodb_io_capacity_max", "2000"},
Expand All @@ -404,7 +405,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal, "innodb_buffer_pool_load_abort", "OFF"},
{ScopeGlobal | ScopeSession, "tx_isolation", "REPEATABLE-READ"},
{ScopeGlobal | ScopeSession, "transaction_isolation", "REPEATABLE-READ"},
{ScopeGlobal | ScopeSession, "collation_connection", "latin1_swedish_ci"},
{ScopeGlobal | ScopeSession, "collation_connection", charset.CollationUTF8MB4},
{ScopeGlobal, "rpl_semi_sync_master_timeout", ""},
{ScopeGlobal | ScopeSession, "transaction_prealloc_size", "4096"},
{ScopeNone, "slave_skip_errors", "OFF"},
Expand Down Expand Up @@ -499,7 +500,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal, "max_points_in_geometry", ""},
{ScopeGlobal, "innodb_stats_sample_pages", "8"},
{ScopeGlobal | ScopeSession, "profiling_history_size", "15"},
{ScopeGlobal | ScopeSession, "character_set_database", "latin1"},
{ScopeGlobal | ScopeSession, "character_set_database", charset.CharsetUTF8MB4},
{ScopeNone, "have_symlink", "YES"},
{ScopeGlobal | ScopeSession, "storage_engine", "InnoDB"},
{ScopeGlobal | ScopeSession, "sql_log_off", "OFF"},
Expand Down Expand Up @@ -578,10 +579,10 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal, "flush", "OFF"},
{ScopeGlobal | ScopeSession, "eq_range_index_dive_limit", "10"},
{ScopeNone, "performance_schema_events_stages_history_size", "10"},
{ScopeGlobal | ScopeSession, "character_set_connection", "latin1"},
{ScopeGlobal | ScopeSession, "character_set_connection", charset.CharsetUTF8MB4},
{ScopeGlobal, "myisam_use_mmap", "OFF"},
{ScopeGlobal | ScopeSession, "ndb_join_pushdown", ""},
{ScopeGlobal | ScopeSession, "character_set_server", "latin1"},
{ScopeGlobal | ScopeSession, "character_set_server", charset.CharsetUTF8MB4},
{ScopeGlobal, "validate_password_special_char_count", "1"},
{ScopeNone, "performance_schema_max_thread_instances", "402"},
{ScopeGlobal, "slave_rows_search_algorithms", "TABLE_SCAN,INDEX_SCAN"},
Expand Down

0 comments on commit 811d9e5

Please sign in to comment.