Skip to content

Commit 0ea4a31

Browse files
committed
splitted trace.BulkUpsert{Start,Done}Info for client and session
1 parent 865024a commit 0ea4a31

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

internal/table/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ func New(ctx context.Context, cc grpc.ClientConnInterface, config *config.Config
2929
return &Client{
3030
clock: config.Clock(),
3131
config: config,
32-
client: Ydb_Table_V1.NewTableServiceClient(cc),
3332
cc: cc,
3433
build: func(ctx context.Context) (s *session, err error) {
3534
return newSession(ctx, cc, config)
@@ -89,7 +88,6 @@ func New(ctx context.Context, cc grpc.ClientConnInterface, config *config.Config
8988
type Client struct {
9089
// read-only fields
9190
config *config.Config
92-
client Ydb_Table_V1.TableServiceClient
9391
build sessionBuilder
9492
cc grpc.ClientConnInterface
9593
clock clockwork.Clock
@@ -309,10 +307,12 @@ func (c *Client) BulkUpsert(
309307
return xerrors.WithStackTrace(err)
310308
}
311309

310+
client := Ydb_Table_V1.NewTableServiceClient(c.cc)
311+
312312
err = retry.Retry(ctx,
313313
func(ctx context.Context) (err error) {
314314
attempts++
315-
_, err = c.client.BulkUpsert(ctx, request)
315+
_, err = client.BulkUpsert(ctx, request)
316316

317317
return err
318318
},

internal/table/session.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ func (s *session) BulkUpsert(ctx context.Context, table string, rows value.Value
12651265
)
12661266
defer func() {
12671267
defer a.Free()
1268-
onDone(err, 1)
1268+
onDone(err)
12691269
}()
12701270

12711271
for _, opt := range opts {

table/table.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,9 @@ func BulkUpsertDataArrow(data []byte, opts ...arrowFormatOption) bulkUpsertArrow
743743

744744
type arrowSchemaOption []byte
745745

746-
func (schema arrowSchemaOption) applyArrowFormatOption(dataFormat *Ydb_Table.BulkUpsertRequest_ArrowBatchSettings) error {
746+
func (schema arrowSchemaOption) applyArrowFormatOption(
747+
dataFormat *Ydb_Table.BulkUpsertRequest_ArrowBatchSettings,
748+
) error {
747749
dataFormat.ArrowBatchSettings.Schema = schema
748750

749751
return nil

trace/table.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type (
3535
OnSessionKeepAlive func(TableKeepAliveStartInfo) func(TableKeepAliveDoneInfo)
3636
// Query events
3737
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
38-
OnSessionBulkUpsert func(TableBulkUpsertStartInfo) func(TableBulkUpsertDoneInfo)
38+
OnSessionBulkUpsert func(TableSessionBulkUpsertStartInfo) func(TableSessionBulkUpsertDoneInfo)
3939
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
4040
OnSessionQueryPrepare func(TablePrepareDataQueryStartInfo) func(TablePrepareDataQueryDoneInfo)
4141
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
@@ -151,6 +151,19 @@ type (
151151
Attempts int
152152
}
153153
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
154+
TableSessionBulkUpsertStartInfo struct {
155+
// Context make available context in trace callback function.
156+
// Pointer to context provide replacement of context in trace callback function.
157+
// Warning: concurrent access to pointer on client side must be excluded.
158+
// Safe replacement of context are provided only inside callback function
159+
Context *context.Context
160+
Call call
161+
}
162+
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
163+
TableSessionBulkUpsertDoneInfo struct {
164+
Error error
165+
}
166+
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
154167
TableSessionDeleteStartInfo struct {
155168
// Context make available context in trace callback function.
156169
// Pointer to context provide replacement of context in trace callback function.

trace/table_gtrace.go

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)