Skip to content

Commit

Permalink
Use PartitionedUpdate instead of Update
Browse files Browse the repository at this point in the history
  • Loading branch information
daichirata committed Jan 26, 2020
1 parent 6ceabba commit 6be2224
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions internal/hammer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (c *Client) ApplyDatabaseDDL(ctx context.Context, ddl DDL) error {
}
stmts = stmts[:0]
}
if err := c.update(ctx, stmt.SQL()); err != nil {
if err := c.partitionedUpdate(ctx, stmt.SQL()); err != nil {
return err
}
}
Expand All @@ -109,13 +109,8 @@ func (c *Client) updateDatabaseDDL(ctx context.Context, stmts []string) error {
return op.Wait(ctx)
}

func (c *Client) update(ctx context.Context, stmt string) error {
_, err := c.client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *spanner.ReadWriteTransaction) error {
_, err := tx.Update(ctx, spanner.Statement{
SQL: stmt,
})
return err
})
func (c *Client) partitionedUpdate(ctx context.Context, stmt string) error {
_, err := c.client.PartitionedUpdate(ctx, spanner.Statement{SQL: stmt})
return err
}

Expand Down

0 comments on commit 6be2224

Please sign in to comment.