File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 1+ Fixed race in integration test ` TestTopicWriterLogMessagesWithoutData `
2+
13## v3.117.0
24* Fixed ` conn/pool.Get() ` behaviour for YDB databases with public IPs. Bug was introduced in v3.116.2
35* Added helper methods ` log.WithFields ` and ` log.FieldsFromContext ` for working with structured logging fields via context.
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import (
2727 "github.com/ydb-platform/ydb-go-sdk/v3/internal/version"
2828 "github.com/ydb-platform/ydb-go-sdk/v3/log"
2929 xtest "github.com/ydb-platform/ydb-go-sdk/v3/pkg/xtest"
30+ tu "github.com/ydb-platform/ydb-go-sdk/v3/testutil"
3031 "github.com/ydb-platform/ydb-go-sdk/v3/topic/topicoptions"
3132 "github.com/ydb-platform/ydb-go-sdk/v3/topic/topicsugar"
3233 "github.com/ydb-platform/ydb-go-sdk/v3/topic/topictypes"
@@ -44,7 +45,7 @@ func TestTopicWriterLogMessagesWithoutData(t *testing.T) {
4445 metaKey := "gyoeexiufo"
4546 metaValue := "fjedeikeosbv"
4647
47- logs := & strings. Builder {}
48+ logs := & tu. ThreadSafeBuilder {}
4849 writer , err := scope .Driver ().Topic ().StartWriter (
4950 scope .TopicPath (),
5051 topicoptions .WithWriterProducerID (producerID ),
Original file line number Diff line number Diff line change 1+ package testutil
2+
3+ import (
4+ "strings"
5+ "sync"
6+ )
7+
8+ type ThreadSafeBuilder struct {
9+ mu sync.Mutex
10+ b strings.Builder
11+ }
12+
13+ func (tsb * ThreadSafeBuilder ) WriteString (s string ) (int , error ) {
14+ tsb .mu .Lock ()
15+ defer tsb .mu .Unlock ()
16+
17+ return tsb .b .WriteString (s )
18+ }
19+
20+ func (tsb * ThreadSafeBuilder ) Write (p []byte ) (int , error ) {
21+ tsb .mu .Lock ()
22+ defer tsb .mu .Unlock ()
23+
24+ return tsb .b .Write (p )
25+ }
26+
27+ func (tsb * ThreadSafeBuilder ) String () string {
28+ tsb .mu .Lock ()
29+ defer tsb .mu .Unlock ()
30+
31+ return tsb .b .String ()
32+ }
33+
34+ func (tsb * ThreadSafeBuilder ) Reset () {
35+ tsb .mu .Lock ()
36+ defer tsb .mu .Unlock ()
37+ tsb .b .Reset ()
38+ }
You can’t perform that action at this time.
0 commit comments