Akshay Apte
Akshay Apte

Reputation: 1653

Client error while writing row to Cloud Bigtable

I am trying to write a row to a Bigtable table using the Go SDK for Bigtable. I am using the apply method on a table object.

I receive the following error when I try to write more than once:

rpc error: code = Canceled desc = grpc: the client connection is closing

Following is my code:

func Put(tableName string, columnFamilyName string, rowKey string, attrMap map[string]interface{}) error {

    tbl := BigTableClient.Open(tableName)
    mut := bigtable.NewMutation()

    for key, val := range attrMap {
        if utils.IsJSON(val.(string)) {
            v, _ := json.Marshal(val)
            mut.Set(columnFamilyName, key, bigtable.Now(), []byte(v))
        } else {
            v := val.(string)
            mut.Set(columnFamilyName, key, bigtable.Now(), []byte(v))
        }
    }
    err := tbl.Apply(BigTableContext, rowKey, mut)
    if err != nil {
        errMsg := "Error while writing to BT: " + err.Error()
        logger.LogError(errMsg)
    }
    return err
}

Can someone help me understand the issue?

Upvotes: 1

Views: 363

Answers (1)

albttx
albttx

Reputation: 3784

This seems to be a gRPC error.

Maybe you have network latency that cause gRPC error.

You could test to use as mentioned here using Bigtable with your own gRPC conn.

Upvotes: 1

Related Questions