diff --git a/client.go b/client.go index 982ddb27..af8553cf 100644 --- a/client.go +++ b/client.go @@ -90,6 +90,9 @@ type client struct { // regionReadTimeout is the maximum amount of time to wait for regionserver reply regionReadTimeout time.Duration + // The lock to control meta table lookup + lock sync.Mutex + done chan struct{} closeOnce sync.Once diff --git a/rpc.go b/rpc.go index 370e6187..d47705a7 100644 --- a/rpc.go +++ b/rpc.go @@ -342,8 +342,10 @@ func (c *client) metaLookup(ctx context.Context, return nil, "", err } + c.lock.Lock() scanner := c.Scan(rpc) resp, err := scanner.Next() + c.lock.Unlock() if err == io.EOF { return nil, "", TableNotFound }