func NewDomain(store kv.Storage, lease time.Duration) (d *Domain, err error) {
	d = &Domain{store: store,
		SchemaValidity: &schemaValidityInfo{}}

	d.infoHandle, err = infoschema.NewHandle(d.store)
	if err != nil {
		return nil, errors.Trace(err)
	}
	d.ddl = ddl.NewDDL(d.store, d.infoHandle, &ddlCallback{do: d}, lease)
	if err = d.Reload(); err != nil {
		return nil, errors.Trace(err)
	}
	d.SchemaValidity.SetExpireInfo(false, 0)

	variable.RegisterStatistics(d)

	// Only when the store is local that the lease value is 0.
	// If the store is local, it doesn't need loadSchemaInLoop and checkValidityInLoop.
	if lease > 0 {
		d.checkCh = make(chan time.Duration, 1)
		d.loadCh = make(chan time.Duration, 1)
		go d.checkValidityInLoop(lease)
	}
	// Local store needs to get the change information for every DDL state in each session.
	go d.loadSchemaInLoop(lease)

	return d, nil
}
// NewDomain creates a new domain. Should not create multiple domains for the same store.
NewDomain creates a new domain. Should not create multiple domains for the same store.
// NewDomain creates a new domain . Should not create multiple domains for the same store .
func NewDomain(store kv.Storage, lease time.Duration) (d *Domain, err error) {
	d = &Domain{store: store,
		SchemaValidity: &schemaValidityInfo{}}
	d.infoHandle, err = infoschema.NewHandle(d.store)
	if err != nil {
		return nil, errors.Trace(err)
	}
	d.ddl = ddl.NewDDL(d.store, d.infoHandle, &ddlCallback{do: d}, lease)
	if err = d.Reload(); err != nil {
		return nil, errors.Trace(err)
	}
	d.SchemaValidity.SetExpireInfo(false, 0)
	variable.RegisterStatistics(d)
	if lease > 0 {
		d.checkCh = make(chan time.Duration, 1)
		d.loadCh = make(chan time.Duration, 1)
		go d.checkValidityInLoop(lease)
	}
	go d.loadSchemaInLoop(lease)
	return d, nil
}
func NewDomain ( store kv . Storage , lease time . Duration ) ( d * Domain , err error ) { d = & Domain { store : store , SchemaValidity : & schemaValidityInfo { } } d . infoHandle , err = infoschema . NewHandle ( d . store ) if err != nil { return nil , errors . Trace ( err ) } d . ddl = ddl . NewDDL ( d . store , d . infoHandle , & ddlCallback { do : d } , lease ) if err = d . Reload ( ) ; err != nil { return nil , errors . Trace ( err ) } d . SchemaValidity . SetExpireInfo ( false , 0 ) variable . RegisterStatistics ( d ) if lease > 0 { d . checkCh = make ( chan time . Duration , 1 ) d . loadCh = make ( chan time . Duration , 1 ) go d . checkValidityInLoop ( lease ) } go d . loadSchemaInLoop ( lease ) return d , nil }
NewDomain creates a new domain.
NewDomain creates a new domain .
// Only when the store is local that the lease value is 0. // If the store is local, it doesn't need loadSchemaInLoop and checkValidityInLoop. // Local store needs to get the change information for every DDL state in each session.