tidb: remove tidb dependencies. (#1068)
* tidb: remove tidb dependencies. Define multiple main packages for different storage engine, remove `tidb` dependencies. * *: register store in tidb-server/main.go
This commit is contained in:
@ -23,14 +23,17 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ngaut/log"
|
||||
"github.com/pingcap/ticlient"
|
||||
"github.com/pingcap/tidb"
|
||||
"github.com/pingcap/tidb/metric"
|
||||
"github.com/pingcap/tidb/store/hbase"
|
||||
"github.com/pingcap/tidb/store/localstore/boltdb"
|
||||
"github.com/pingcap/tidb/tidb-server/server"
|
||||
"github.com/pingcap/tidb/util/printer"
|
||||
)
|
||||
|
||||
var (
|
||||
store = flag.String("store", "goleveldb", "registered store name, [hbase, memory, goleveldb, boltdb]")
|
||||
store = flag.String("store", "goleveldb", "registered store name, [memory, goleveldb, hbase, boltdb, tikv]")
|
||||
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")
|
||||
@ -38,6 +41,10 @@ var (
|
||||
)
|
||||
|
||||
func main() {
|
||||
tidb.RegisterStore("hbase", hbasekv.Driver{})
|
||||
tidb.RegisterLocalStore("boltdb", boltdb.Driver{})
|
||||
tidb.RegisterStore("tikv", ticlient.Driver{})
|
||||
|
||||
metric.RunMetric(3 * time.Second)
|
||||
printer.PrintTiDBInfo()
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
17
tidb.go
17
tidb.go
@ -29,7 +29,6 @@ import (
|
||||
|
||||
"github.com/juju/errors"
|
||||
"github.com/ngaut/log"
|
||||
"github.com/pingcap/ticlient"
|
||||
"github.com/pingcap/tidb/ast"
|
||||
"github.com/pingcap/tidb/context"
|
||||
"github.com/pingcap/tidb/domain"
|
||||
@ -38,9 +37,7 @@ import (
|
||||
"github.com/pingcap/tidb/parser"
|
||||
"github.com/pingcap/tidb/sessionctx/autocommit"
|
||||
"github.com/pingcap/tidb/sessionctx/variable"
|
||||
"github.com/pingcap/tidb/store/hbase"
|
||||
"github.com/pingcap/tidb/store/localstore"
|
||||
"github.com/pingcap/tidb/store/localstore/boltdb"
|
||||
"github.com/pingcap/tidb/store/localstore/engine"
|
||||
"github.com/pingcap/tidb/store/localstore/goleveldb"
|
||||
"github.com/pingcap/tidb/util/types"
|
||||
@ -48,13 +45,9 @@ import (
|
||||
|
||||
// Engine prefix name
|
||||
const (
|
||||
EngineGoLevelDBMemory = "memory://"
|
||||
EngineGoLevelDBPersistent = "goleveldb://"
|
||||
EngineBoltDB = "boltdb://"
|
||||
EngineHBase = "hbase://"
|
||||
EngineTiKV = "tikv://"
|
||||
defaultMaxRetries = 30
|
||||
retrySleepInterval = 500 * time.Millisecond
|
||||
EngineGoLevelDBMemory = "memory://"
|
||||
defaultMaxRetries = 30
|
||||
retrySleepInterval = 500 * time.Millisecond
|
||||
)
|
||||
|
||||
type domainMap struct {
|
||||
@ -288,10 +281,6 @@ func init() {
|
||||
// Register default memory and goleveldb storage
|
||||
RegisterLocalStore("memory", goleveldb.MemoryDriver{})
|
||||
RegisterLocalStore("goleveldb", goleveldb.Driver{})
|
||||
RegisterLocalStore("boltdb", boltdb.Driver{})
|
||||
RegisterStore("hbase", hbasekv.Driver{})
|
||||
RegisterStore("tikv", ticlient.Driver{})
|
||||
|
||||
// start pprof handlers
|
||||
if EnablePprof {
|
||||
go http.ListenAndServe(PprofAddr, nil)
|
||||
|
||||
Reference in New Issue
Block a user