@ -244,7 +244,7 @@ func (e *SetExecutor) setSysVariable(ctx context.Context, name string, v *expres
|
||||
return err
|
||||
}
|
||||
// Clients are often noisy in setting session variables such as
|
||||
// autocommit, timezone, query cache
|
||||
// autocommit, timezone, etc
|
||||
logutil.BgLogger().Debug("set session var", zap.Uint64("conn", sessionVars.ConnectionID), zap.String("name", name), zap.String("val", valStr))
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1351,13 +1351,11 @@ func TestValidateSetVar(t *testing.T) {
|
||||
err = tk.ExecToErr("set @@global.innodb_ft_enable_stopword=2")
|
||||
require.True(t, terror.ErrorEqual(err, variable.ErrWrongValueForVar), fmt.Sprintf("err %v", err))
|
||||
|
||||
tk.MustExec("set @@query_cache_type=0")
|
||||
result = tk.MustQuery("select @@query_cache_type;")
|
||||
result.Check(testkit.Rows("OFF"))
|
||||
tk.MustContainErrMsg("set @@query_cache_type=0", "[variable:1193]Unknown system variable 'query_cache_type'")
|
||||
tk.MustContainErrMsg("select @@query_cache_type;", "[variable:1193]Unknown system variable 'query_cache_type'")
|
||||
|
||||
tk.MustExec("set @@query_cache_type=2")
|
||||
result = tk.MustQuery("select @@query_cache_type;")
|
||||
result.Check(testkit.Rows("DEMAND"))
|
||||
tk.MustContainErrMsg("set @@query_cache_type=2", "[variable:1193]Unknown system variable 'query_cache_type'")
|
||||
tk.MustContainErrMsg("select @@query_cache_type;", "[variable:1193]Unknown system variable 'query_cache_type'")
|
||||
|
||||
tk.MustExec("set @@global.sync_binlog=-1")
|
||||
tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1292|Truncated incorrect sync_binlog value: '-1'"))
|
||||
|
||||
@ -21,8 +21,8 @@ import (
|
||||
)
|
||||
|
||||
// The following sysVars are noops.
|
||||
// Some applications will depend on certain variables to be present or settable,
|
||||
// for example query_cache_time. These are included for MySQL compatibility,
|
||||
// Some applications will depend on certain variables to be present or settable.
|
||||
// These are included for MySQL compatibility,
|
||||
// but changing them has no effect on behavior.
|
||||
|
||||
var noopSysVars = []*SysVar{
|
||||
@ -45,7 +45,6 @@ var noopSysVars = []*SysVar{
|
||||
return checkReadOnly(vars, normalizedValue, originalValue, scope, false)
|
||||
}},
|
||||
{Scope: ScopeGlobal, Name: ConnectTimeout, Value: "10", Type: TypeUnsigned, MinValue: 2, MaxValue: secondsPerYear},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: QueryCacheWlockInvalidate, Value: Off, Type: TypeBool},
|
||||
{
|
||||
Scope: ScopeGlobal | ScopeSession,
|
||||
Name: "sql_buffer_result",
|
||||
@ -90,7 +89,6 @@ var noopSysVars = []*SysVar{
|
||||
{Scope: ScopeGlobal, Name: "innodb_max_purge_lag", Value: "0"},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: "preload_buffer_size", Value: "32768"},
|
||||
{Scope: ScopeGlobal, Name: CheckProxyUsers, Value: Off, Type: TypeBool},
|
||||
{Scope: ScopeNone, Name: "have_query_cache", Value: "YES"},
|
||||
{Scope: ScopeGlobal, Name: "innodb_flush_log_at_timeout", Value: "1"},
|
||||
{Scope: ScopeGlobal, Name: "innodb_max_undo_log_size", Value: ""},
|
||||
{
|
||||
@ -174,7 +172,6 @@ var noopSysVars = []*SysVar{
|
||||
}},
|
||||
{Scope: ScopeGlobal, Name: InnodbOptimizeFullTextOnly, Value: "0"},
|
||||
{Scope: ScopeNone, Name: "character_sets_dir", Value: "/usr/local/mysql-5.6.25-osx10.8-x86_64/share/charsets/"},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: QueryCacheType, Value: Off, Type: TypeEnum, PossibleValues: []string{Off, On, "DEMAND"}},
|
||||
{Scope: ScopeNone, Name: "innodb_rollback_on_timeout", Value: "0"},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: "query_alloc_block_size", Value: "8192"},
|
||||
{Scope: ScopeNone, Name: "have_compress", Value: "YES"},
|
||||
@ -333,7 +330,6 @@ var noopSysVars = []*SysVar{
|
||||
{Scope: ScopeGlobal, Name: "sha256_password_proxy_users", Value: ""},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: SQLQuoteShowCreate, Value: On, Type: TypeBool},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: "binlogging_impossible_mode", Value: "IGNORE_ERROR"},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: QueryCacheSize, Value: "1048576"},
|
||||
{Scope: ScopeGlobal, Name: "innodb_stats_transient_sample_pages", Value: "8"},
|
||||
{Scope: ScopeGlobal, Name: InnodbStatsOnMetadata, Value: "0"},
|
||||
{Scope: ScopeNone, Name: "server_uuid", Value: "00000000-0000-0000-0000-000000000000"},
|
||||
@ -516,7 +512,6 @@ var noopSysVars = []*SysVar{
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: "optimizer_trace_features", Value: "greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on"},
|
||||
{Scope: ScopeGlobal, Name: "innodb_flush_log_at_trx_commit", Value: "1"},
|
||||
{Scope: ScopeGlobal, Name: "rewriter_enabled", Value: ""},
|
||||
{Scope: ScopeGlobal, Name: "query_cache_min_res_unit", Value: "4096"},
|
||||
{
|
||||
Scope: ScopeGlobal | ScopeSession,
|
||||
Name: "updatable_views_with_limit",
|
||||
@ -533,7 +528,6 @@ var noopSysVars = []*SysVar{
|
||||
{Scope: ScopeGlobal, Name: "binlog_checksum", Value: "CRC32"},
|
||||
{Scope: ScopeNone, Name: "report_port", Value: "3306"},
|
||||
{Scope: ScopeGlobal | ScopeSession, Name: ShowOldTemporals, Value: Off, Type: TypeBool},
|
||||
{Scope: ScopeGlobal, Name: "query_cache_limit", Value: "1048576"},
|
||||
{Scope: ScopeGlobal, Name: "innodb_buffer_pool_size", Value: "4294967296"},
|
||||
{Scope: ScopeGlobal, Name: InnodbAdaptiveFlushing, Value: On, Type: TypeBool, AutoConvertNegativeBool: true},
|
||||
{Scope: ScopeGlobal, Name: "innodb_monitor_enable", Value: ""},
|
||||
|
||||
@ -3638,8 +3638,6 @@ const (
|
||||
SuperReadOnly = "super_read_only"
|
||||
// SQLNotes is the name for 'sql_notes' system variable.
|
||||
SQLNotes = "sql_notes"
|
||||
// QueryCacheType is the name for 'query_cache_type' system variable.
|
||||
QueryCacheType = "query_cache_type"
|
||||
// SlaveCompressedProtocol is the name for 'slave_compressed_protocol' system variable.
|
||||
SlaveCompressedProtocol = "slave_compressed_protocol"
|
||||
// BinlogRowQueryLogEvents is the name for 'binlog_rows_query_log_events' system variable.
|
||||
@ -3650,8 +3648,6 @@ const (
|
||||
LogSlowAdminStatements = "log_slow_admin_statements"
|
||||
// LogQueriesNotUsingIndexes is the name for 'log_queries_not_using_indexes' system variable.
|
||||
LogQueriesNotUsingIndexes = "log_queries_not_using_indexes"
|
||||
// QueryCacheWlockInvalidate is the name for 'query_cache_wlock_invalidate' system variable.
|
||||
QueryCacheWlockInvalidate = "query_cache_wlock_invalidate"
|
||||
// SQLAutoIsNull is the name for 'sql_auto_is_null' system variable.
|
||||
SQLAutoIsNull = "sql_auto_is_null"
|
||||
// RelayLogPurge is the name for 'relay_log_purge' system variable.
|
||||
@ -3738,8 +3734,6 @@ const (
|
||||
InnodbStatusOutput = "innodb_status_output"
|
||||
// NetBufferLength is the name for 'net_buffer_length' system variable.
|
||||
NetBufferLength = "net_buffer_length"
|
||||
// QueryCacheSize is the name of 'query_cache_size' system variable.
|
||||
QueryCacheSize = "query_cache_size"
|
||||
// TxReadOnly is the name of 'tx_read_only' system variable.
|
||||
TxReadOnly = "tx_read_only"
|
||||
// TransactionReadOnly is the name of 'transaction_read_only' system variable.
|
||||
|
||||
@ -477,10 +477,6 @@ func TestValidate(t *testing.T) {
|
||||
{EnforceGtidConsistency, "OFF", false},
|
||||
{EnforceGtidConsistency, "ON", false},
|
||||
{EnforceGtidConsistency, "WARN", false},
|
||||
{QueryCacheType, "OFF", false},
|
||||
{QueryCacheType, "ON", false},
|
||||
{QueryCacheType, "DEMAND", false},
|
||||
{QueryCacheType, "3", true},
|
||||
{SecureAuth, "1", false},
|
||||
{SecureAuth, "3", true},
|
||||
{MyISAMUseMmap, "ON", false},
|
||||
|
||||
@ -19,42 +19,42 @@ select @@global.tidb_max_delta_schema_count;
|
||||
@@global.tidb_max_delta_schema_count
|
||||
2048
|
||||
set @@global.tidb_max_delta_schema_count= default;
|
||||
SELECT @@query_cache_type;
|
||||
@@query_cache_type
|
||||
OFF
|
||||
SHOW VARIABLES LIKE 'query_cache_type';
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
@@innodb_buffer_pool_size
|
||||
4294967296
|
||||
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
|
||||
Variable_name Value
|
||||
query_cache_type OFF
|
||||
SET query_cache_type=2;
|
||||
SELECT @@query_cache_type;
|
||||
@@query_cache_type
|
||||
DEMAND
|
||||
innodb_buffer_pool_size 4294967296
|
||||
SET GLOBAL innodb_buffer_pool_size=134217728;
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
@@innodb_buffer_pool_size
|
||||
134217728
|
||||
SET GLOBAL tidb_enable_noop_variables = OFF;
|
||||
SELECT @@global.tidb_enable_noop_variables;
|
||||
@@global.tidb_enable_noop_variables
|
||||
OFF
|
||||
SELECT @@query_cache_type;
|
||||
@@query_cache_type
|
||||
DEMAND
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
@@innodb_buffer_pool_size
|
||||
134217728
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 8145 variable query_cache_type has no effect in TiDB
|
||||
SHOW VARIABLES LIKE 'query_cache_type';
|
||||
Warning 8145 variable innodb_buffer_pool_size has no effect in TiDB
|
||||
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
|
||||
Variable_name Value
|
||||
SET query_cache_type = OFF;
|
||||
SET GLOBAL innodb_buffer_pool_size = 805306368;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 8144 setting query_cache_type has no effect in TiDB
|
||||
SELECT @@query_cache_type;
|
||||
@@query_cache_type
|
||||
OFF
|
||||
Warning 8144 setting innodb_buffer_pool_size has no effect in TiDB
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
@@innodb_buffer_pool_size
|
||||
805306368
|
||||
SET GLOBAL tidb_enable_noop_variables = 2;
|
||||
Error 1231 (42000): Variable 'tidb_enable_noop_variables' can't be set to the value of '2'
|
||||
SET GLOBAL tidb_enable_noop_variables = 'warn';
|
||||
Error 1231 (42000): Variable 'tidb_enable_noop_variables' can't be set to the value of 'warn'
|
||||
SET GLOBAL tidb_enable_noop_variables = ON;
|
||||
SET GLOBAL tidb_enable_noop_variables = default;
|
||||
SET query_cache_type = default;
|
||||
SET GLOBAL innodb_buffer_pool_size = default;
|
||||
show VARIABLES like 'character_set_%';
|
||||
Variable_name Value
|
||||
character_set_client utf8mb4
|
||||
|
||||
@ -119,8 +119,7 @@ OR Variable_name = 'character_set' OR Variable_name = 'character_set_server' OR
|
||||
OR Variable_name = 'transaction_isolation' OR Variable_name = 'character_set_results' OR Variable_name = 'timezone'
|
||||
OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone'
|
||||
OR Variable_name = 'lower_case_table_names' OR Variable_name = 'max_allowed_packet' OR Variable_name = 'net_buffer_length'
|
||||
OR Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR Variable_name = 'query_cache_size'
|
||||
OR Variable_name = 'license' OR Variable_name = 'init_connect';
|
||||
OR Variable_name = 'sql_mode' OR Variable_name = 'license' OR Variable_name = 'init_connect';
|
||||
Variable_name Value
|
||||
character_set_client utf8mb4
|
||||
character_set_connection utf8mb4
|
||||
@ -133,8 +132,6 @@ lower_case_table_names 2
|
||||
max_allowed_packet 67108864
|
||||
net_buffer_length 16384
|
||||
net_write_timeout 60
|
||||
query_cache_size 1048576
|
||||
query_cache_type OFF
|
||||
sql_mode ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
||||
system_time_zone Asia/Shanghai
|
||||
time_zone Asia/Shanghai
|
||||
|
||||
@ -12,18 +12,18 @@ select @@global.tidb_max_delta_schema_count;
|
||||
set @@global.tidb_max_delta_schema_count= default;
|
||||
|
||||
# TestGetSetNoopVars
|
||||
SELECT @@query_cache_type;
|
||||
SHOW VARIABLES LIKE 'query_cache_type';
|
||||
SET query_cache_type=2;
|
||||
SELECT @@query_cache_type;
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
|
||||
SET GLOBAL innodb_buffer_pool_size=134217728;
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
SET GLOBAL tidb_enable_noop_variables = OFF;
|
||||
SELECT @@global.tidb_enable_noop_variables;
|
||||
SELECT @@query_cache_type;
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
SHOW WARNINGS;
|
||||
SHOW VARIABLES LIKE 'query_cache_type';
|
||||
SET query_cache_type = OFF;
|
||||
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
|
||||
SET GLOBAL innodb_buffer_pool_size = 805306368;
|
||||
SHOW WARNINGS;
|
||||
SELECT @@query_cache_type;
|
||||
SELECT @@innodb_buffer_pool_size;
|
||||
-- error 1231
|
||||
SET GLOBAL tidb_enable_noop_variables = 2;
|
||||
-- error 1231
|
||||
@ -31,7 +31,7 @@ SET GLOBAL tidb_enable_noop_variables = 'warn';
|
||||
SET GLOBAL tidb_enable_noop_variables = ON;
|
||||
|
||||
SET GLOBAL tidb_enable_noop_variables = default;
|
||||
SET query_cache_type = default;
|
||||
SET GLOBAL innodb_buffer_pool_size = default;
|
||||
|
||||
# TestSetCharset
|
||||
show VARIABLES like 'character_set_%';
|
||||
|
||||
@ -89,8 +89,7 @@ OR Variable_name = 'character_set' OR Variable_name = 'character_set_server' OR
|
||||
OR Variable_name = 'transaction_isolation' OR Variable_name = 'character_set_results' OR Variable_name = 'timezone'
|
||||
OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone'
|
||||
OR Variable_name = 'lower_case_table_names' OR Variable_name = 'max_allowed_packet' OR Variable_name = 'net_buffer_length'
|
||||
OR Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR Variable_name = 'query_cache_size'
|
||||
OR Variable_name = 'license' OR Variable_name = 'init_connect';
|
||||
OR Variable_name = 'sql_mode' OR Variable_name = 'license' OR Variable_name = 'init_connect';
|
||||
|
||||
# TestFloat64Inf
|
||||
select '1e800' + 1e100;
|
||||
|
||||
Reference in New Issue
Block a user