Skip to content

Commit

Permalink
Merge pull request #2 from daichirata/feature/partitioned_update
Browse files Browse the repository at this point in the history
Use PartitionedUpdate instead of Update
  • Loading branch information
daichirata committed Jan 26, 2020
2 parents 6ceabba + 6be2224 commit a342cd9
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 a342cd9

Please sign in to comment.