Skip to content

Commit

Permalink
Some pending review comments from previous PRs (#2260)
Browse files Browse the repository at this point in the history
1. Changed the deep-copy library to github.com/jinzhu/copier as it looks more popular and maintained (last updated 6 months ago). (comment from Fix: Do not redact password for conn pool connection URI while connecting to DB  #2203 )
2. Change the `Stringbuilder.append` to `String.format()` in java debezium exporter for MAP type conversion. (comment from Fix: MAP value converter for data via debezium #2156)
  • Loading branch information
priyanshi-yb authored Jan 28, 2025
1 parent 396bece commit 18d3d28
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,7 @@ Escaping the key and value here for the double quote (")" and backslash char (\
LOGGER.debug("[MAP] after transforming key - {}", key);
LOGGER.debug("[MAP] after transforming value - {}", val);

mapString.append("\"");
mapString.append(key);
mapString.append("\"");
mapString.append(" => ");
mapString.append("\"");
mapString.append(val);
mapString.append("\"");
mapString.append(",");
mapString.append(String.format("\"%s\" => \"%s\",", key, val));
}
if(mapString.length() == 0) {
return "";
Expand Down
2 changes: 1 addition & 1 deletion yb-voyager/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ require (
github.com/jackc/pgconn v1.14.3
github.com/jackc/pgx/v4 v4.18.3
github.com/jackc/pgx/v5 v5.0.3
github.com/jinzhu/copier v0.4.0
github.com/mattn/go-sqlite3 v1.14.17
github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2
github.com/mitchellh/go-ps v1.0.0
Expand All @@ -37,7 +38,6 @@ require (
github.com/tebeka/atexit v0.3.0
github.com/testcontainers/testcontainers-go v0.34.0
github.com/testcontainers/testcontainers-go/modules/yugabytedb v0.34.0
github.com/tiendc/go-deepcopy v1.2.0
github.com/vbauerster/mpb/v8 v8.4.0
gocloud.dev v0.29.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
Expand Down
4 changes: 2 additions & 2 deletions yb-voyager/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,8 @@ github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxy
github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc=
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down Expand Up @@ -1932,8 +1934,6 @@ github.com/testcontainers/testcontainers-go v0.34.0/go.mod h1:6P/kMkQe8yqPHfPWNu
github.com/testcontainers/testcontainers-go/modules/yugabytedb v0.34.0 h1:9wIqSZJwBr4s8Q7R3S+rhe1J2zqHHxH0S1bN17ld+CI=
github.com/testcontainers/testcontainers-go/modules/yugabytedb v0.34.0/go.mod h1:bgHrbdYjpNPSstf8HfxChUxc6XztBCSoqDR0syb1Oeg=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tiendc/go-deepcopy v1.2.0 h1:6vCCs+qdLQHzFqY1fcPirsAWOmrLbuccilfp8UzD1Qo=
github.com/tiendc/go-deepcopy v1.2.0/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
Expand Down
6 changes: 3 additions & 3 deletions yb-voyager/src/tgtdb/yugabytedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import (
"github.com/jackc/pgx/v4"
pgconn5 "github.com/jackc/pgx/v5/pgconn"
_ "github.com/jackc/pgx/v5/stdlib"
"github.com/jinzhu/copier"
"github.com/samber/lo"
log "github.com/sirupsen/logrus"
"github.com/tiendc/go-deepcopy"
"golang.org/x/exp/slices"

"github.com/yugabyte/yb-voyager/yb-voyager/src/callhome"
Expand Down Expand Up @@ -246,8 +246,8 @@ func (yb *TargetYugabyteDB) InitConnPool() error {
yb.connPool = NewConnectionPool(params)
redactedParams := &ConnectionParams{}
//Whenever adding new fields to CONNECTION PARAMS check if that needs to be redacted while logging
err := deepcopy.Copy(redactedParams, params)
if err!= nil {
err := copier.Copy(redactedParams, params)
if err != nil {
log.Errorf("couldn't get the copy of connection params for logging: %v", err)
return nil
}
Expand Down

0 comments on commit 18d3d28

Please sign in to comment.