From 638d33090934f0d86544555897ebf628d1f6a429 Mon Sep 17 00:00:00 2001 From: siddontang Date: Mon, 30 Nov 2015 12:37:39 +0800 Subject: [PATCH] *: use default 1s for schema lease. --- interpreter/main.go | 2 +- tidb-server/main.go | 2 +- tidb.go | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/interpreter/main.go b/interpreter/main.go index 2d0d10fb91325..c9a4ddabfb817 100644 --- a/interpreter/main.go +++ b/interpreter/main.go @@ -35,7 +35,7 @@ var ( logLevel = flag.String("L", "error", "log level") store = flag.String("store", "goleveldb", "the name for the registered storage, e.g. memory, goleveldb, boltdb") dbPath = flag.String("dbpath", "test/test", "db path") - lease = flag.Int("lease", 300, "schema lease seconds, very dangerous to change only if you know what you do") + lease = flag.Int("lease", 1, "schema lease seconds, very dangerous to change only if you know what you do") line *liner.State historyPath = "/tmp/tidb_interpreter" diff --git a/tidb-server/main.go b/tidb-server/main.go index 5dd6a2decea44..caa791b25a5ae 100644 --- a/tidb-server/main.go +++ b/tidb-server/main.go @@ -34,7 +34,7 @@ var ( storePath = flag.String("path", "/tmp/tidb", "tidb storage path") logLevel = flag.String("L", "debug", "log level: info, debug, warn, error, fatal") port = flag.String("P", "4000", "mp server port") - lease = flag.Int("lease", 300, "schema lease seconds, very dangerous to change only if you know what you do") + lease = flag.Int("lease", 1, "schema lease seconds, very dangerous to change only if you know what you do") ) func main() { diff --git a/tidb.go b/tidb.go index 395572aca7eb4..7285e0af514aa 100644 --- a/tidb.go +++ b/tidb.go @@ -92,12 +92,13 @@ var ( // store.UUID()-> IfBootstrapped storeBootstrapped = make(map[string]bool) - // SchemaLease is the time(seconds) for re-updating remote schema. + // schemaLease is the time for re-updating remote schema. // In online DDL, we must wait 2 * SchemaLease time to guarantee // all servers get the neweset schema. - // Default schema lease time is 300 seconds, you can change it with a proper time, + // Default schema lease time is 1 second, you can change it with a proper time, // but you must know that too little may cause badly performance degradation. - schemaLease = 300 * time.Second + // For production, you should set a big schema lease, like 300s+. + schemaLease = 1 * time.Second ) // SetSchemaLease changes the default schema lease time for DDL.