Skip to content

Commit c1d8c14

Browse files
Release-15: Cherry pick vtorc no cgo (vitessio#12223)
* Move vtorc from go-sqlite3 to modernc.org/sqlite (vitessio#12214) * Move vtorc from go-sqlite3 to modernc.org/sqlite This moves vtorc from the go-sqlite3 library that uses CGO, to use modernc.org/sqlite which is a pure Go implementation. vtorc is the only component we have to build with CGO but it's causing pain for releases since we need to build it against an old Linux for linking against glibc. Using modernc.org/sqlite allows for using Go only again and makes all Vitess components buildable without CGO. In https://datastation.multiprocess.io/blog/2022-05-12-sqlite-in-go-with-and-without-cgo.html someone ran some basic benchmarks. It shows that the pure Go version can be twice as slow, but the usage of vtorc is very limited and we operate on small datasets, so I think the performance impact purely of a somewhat slower sqlite implementation is negligable. None of this is in a hot query serving path or anything like that, so I have little concern performance wise. Signed-off-by: Dirkjan Bussink <[email protected]> * Fix error handling in RowToArray Signed-off-by: Dirkjan Bussink <[email protected]> --------- Signed-off-by: Dirkjan Bussink <[email protected]> * empty-commit Signed-off-by: Manan Gupta <[email protected]> * Run go mod tidy Signed-off-by: Dirkjan Bussink <[email protected]> --------- Signed-off-by: Dirkjan Bussink <[email protected]> Signed-off-by: Manan Gupta <[email protected]> Co-authored-by: Manan Gupta <[email protected]>
1 parent 91e7790 commit c1d8c14

33 files changed

+99
-82
lines changed

Makefile

+1-10
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ endif
9292
-ldflags "$(shell tools/build_version_flags.sh)" \
9393
-o ${VTROOTBIN} ./go/...
9494

95-
# build vtorc with CGO, because it depends on sqlite
96-
CGO_ENABLED=1 go build \
97-
-trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) \
98-
-ldflags "$(shell tools/build_version_flags.sh)" \
99-
-o ${VTROOTBIN} ./go/cmd/vtorc/...
100-
10195
# cross-build can be used to cross-compile Vitess client binaries
10296
# Outside of select client binaries (namely vtctlclient & vtexplain), cross-compiled Vitess Binaries are not recommended for production deployments
10397
# Usage: GOOS=darwin GOARCH=amd64 make cross-build
@@ -120,8 +114,6 @@ endif
120114
echo "Missing vttablet at: ${VTROOTBIN}/${GOOS}_${GOARCH}." && exit; \
121115
fi
122116

123-
# Cross-compiling w/ cgo isn't trivial and we don't need vtorc, so we can skip building it
124-
125117
debug:
126118
ifndef NOBANNER
127119
echo $$(date): Building source tree
@@ -145,8 +137,7 @@ install: build
145137
cross-install: cross-build
146138
# binaries
147139
mkdir -p "$${PREFIX}/bin"
148-
# Still no vtorc for cross-compile
149-
cp "${VTROOTBIN}/${GOOS}_${GOARCH}/"{mysqlctl,mysqlctld,vtadmin,vtctld,vtctlclient,vtctldclient,vtgate,vttablet,vtbackup} "$${PREFIX}/bin/"
140+
cp "${VTROOTBIN}/${GOOS}_${GOARCH}/"{mysqlctl,mysqlctld,vtorc,vtadmin,vtctld,vtctlclient,vtctldclient,vtgate,vttablet,vtbackup} "$${PREFIX}/bin/"
150141

151142
# Install local install the binaries needed to run vitess locally
152143
# Usage: make install-local PREFIX=/path/to/install/root

go.mod

+17-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/golang/mock v1.5.0
2727
github.com/golang/protobuf v1.5.2
2828
github.com/golang/snappy v0.0.3
29-
github.com/google/go-cmp v0.5.8
29+
github.com/google/go-cmp v0.5.9
3030
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
3131
github.com/google/uuid v1.3.0
3232
github.com/googleapis/gnostic v0.4.1 // indirect
@@ -49,7 +49,7 @@ require (
4949
github.com/klauspost/pgzip v1.2.4
5050
github.com/krishicks/yaml-patch v0.0.10
5151
github.com/magiconair/properties v1.8.5
52-
github.com/mattn/go-sqlite3 v1.14.14
52+
github.com/mattn/go-sqlite3 v1.14.16 // indirect
5353
github.com/minio/minio-go v0.0.0-20190131015406-c8a261de75c1
5454
github.com/mitchellh/go-testing-interface v1.14.0 // indirect
5555
github.com/montanaflynn/stats v0.6.3
@@ -90,7 +90,7 @@ require (
9090
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
9191
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
9292
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f
93-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
93+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
9494
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
9595
golang.org/x/text v0.3.8
9696
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
@@ -117,7 +117,7 @@ require (
117117

118118
require (
119119
github.com/bndr/gotabulate v1.1.2
120-
github.com/openark/golib v0.0.0-20210531070646-355f37940af8
120+
modernc.org/sqlite v1.20.3
121121
)
122122

123123
require (
@@ -131,6 +131,7 @@ require (
131131
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
132132
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
133133
github.com/davecgh/go-spew v1.1.1 // indirect
134+
github.com/dustin/go-humanize v1.0.0 // indirect
134135
github.com/fatih/color v1.9.0 // indirect
135136
github.com/felixge/httpsnoop v1.0.1 // indirect
136137
github.com/frankban/quicktest v1.14.3 // indirect
@@ -147,9 +148,10 @@ require (
147148
github.com/inconshreveable/mousetrap v1.0.0 // indirect
148149
github.com/json-iterator/go v1.1.11 // indirect
149150
github.com/jstemmer/go-junit-report v0.9.1 // indirect
151+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
150152
github.com/mattn/go-colorable v0.1.6 // indirect
151153
github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d // indirect
152-
github.com/mattn/go-isatty v0.0.12 // indirect
154+
github.com/mattn/go-isatty v0.0.16 // indirect
153155
github.com/mattn/go-runewidth v0.0.7 // indirect
154156
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
155157
github.com/mitchellh/go-homedir v1.1.0 // indirect
@@ -162,6 +164,7 @@ require (
162164
github.com/pmezard/go-difflib v1.0.0 // indirect
163165
github.com/prometheus/client_model v0.2.0 // indirect
164166
github.com/prometheus/procfs v0.6.0 // indirect
167+
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
165168
github.com/russross/blackfriday/v2 v2.1.0 // indirect
166169
github.com/satori/go.uuid v1.2.0 // indirect
167170
github.com/spf13/afero v1.6.0 // indirect
@@ -186,5 +189,14 @@ require (
186189
k8s.io/klog/v2 v2.4.0 // indirect
187190
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd // indirect
188191
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
192+
lukechampine.com/uint128 v1.2.0 // indirect
193+
modernc.org/cc/v3 v3.40.0 // indirect
194+
modernc.org/ccgo/v3 v3.16.13 // indirect
195+
modernc.org/libc v1.22.2 // indirect
196+
modernc.org/mathutil v1.5.0 // indirect
197+
modernc.org/memory v1.4.0 // indirect
198+
modernc.org/opt v0.1.3 // indirect
199+
modernc.org/strutil v1.1.3 // indirect
200+
modernc.org/token v1.0.1 // indirect
189201
sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect
190202
)

go.sum

+38-9
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
183183
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
184184
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
185185
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
186+
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
186187
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
187188
github.com/dvyukov/go-fuzz v0.0.0-20210914135545-4980593459a1/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
188189
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
@@ -332,8 +333,8 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
332333
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
333334
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
334335
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
335-
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
336-
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
336+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
337+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
337338
github.com/google/go-github/v27 v27.0.4/go.mod h1:/0Gr8pJ55COkmv+S/yPKCczSkUPIM/LnFyubufRNIS0=
338339
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
339340
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
@@ -355,6 +356,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe
355356
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
356357
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
357358
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
359+
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
358360
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
359361
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
360362
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
@@ -475,6 +477,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
475477
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
476478
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
477479
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
480+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
481+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
478482
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
479483
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
480484
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
@@ -517,13 +521,14 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
517521
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
518522
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
519523
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
520-
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
521524
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
525+
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
526+
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
522527
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
523528
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
524529
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
525-
github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw=
526-
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
530+
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
531+
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
527532
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
528533
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
529534
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
@@ -577,8 +582,6 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa
577582
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
578583
github.com/onsi/gomega v1.10.3 h1:gph6h/qe9GSUw1NhH1gp+qb+h8rXD8Cy60Z32Qw3ELA=
579584
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
580-
github.com/openark/golib v0.0.0-20210531070646-355f37940af8 h1:9ciIHNuyFqRWi9NpMNw9sVLB6z1ItpP5ZhTY9Q1xVu4=
581-
github.com/openark/golib v0.0.0-20210531070646-355f37940af8/go.mod h1:1jj8x1eDVZxgc/Z4VyamX4qTbAdHPUQA6NeVtCd8Sl8=
582585
github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02 h1:0R5mDLI66Qw13qN80TRz85zthQ2nf2+uDyiV23w6c3Q=
583586
github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc=
584587
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
@@ -638,6 +641,8 @@ github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3x
638641
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
639642
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
640643
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
644+
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
645+
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
641646
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
642647
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
643648
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
@@ -978,8 +983,8 @@ golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7w
978983
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
979984
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
980985
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
981-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
982-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
986+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
987+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
983988
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
984989
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
985990
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -1271,6 +1276,30 @@ k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAG
12711276
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
12721277
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw=
12731278
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
1279+
lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
1280+
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
1281+
modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw=
1282+
modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0=
1283+
modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw=
1284+
modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY=
1285+
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
1286+
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
1287+
modernc.org/libc v1.22.2 h1:4U7v51GyhlWqQmwCHj28Rdq2Yzwk55ovjFrdPjs8Hb0=
1288+
modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug=
1289+
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
1290+
modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
1291+
modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk=
1292+
modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
1293+
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
1294+
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
1295+
modernc.org/sqlite v1.20.3 h1:SqGJMMxjj1PHusLxdYxeQSodg7Jxn9WWkaAQjKrntZs=
1296+
modernc.org/sqlite v1.20.3/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
1297+
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
1298+
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
1299+
modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34=
1300+
modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg=
1301+
modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
1302+
modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE=
12741303
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
12751304
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
12761305
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

go/cmd/vtorc/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"strings"
2323

2424
_ "github.com/go-sql-driver/mysql"
25-
_ "github.com/mattn/go-sqlite3"
2625
"github.com/spf13/pflag"
26+
_ "modernc.org/sqlite"
2727

2828
"vitess.io/vitess/go/acl"
2929
"vitess.io/vitess/go/vt/grpccommon"

go/test/endtoend/vtorc/readtopologyinstance/main_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import (
3030
"vitess.io/vitess/go/vt/vtorc/server"
3131

3232
_ "github.com/go-sql-driver/mysql"
33-
_ "github.com/mattn/go-sqlite3"
3433
"github.com/stretchr/testify/assert"
3534
"github.com/stretchr/testify/require"
35+
_ "modernc.org/sqlite"
3636
)
3737

3838
func TestReadTopologyInstanceBufferable(t *testing.T) {

go/vt/vtgr/external/golib/sqlutils/sqlutils.go go/vt/external/golib/sqlutils/sqlutils.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const DateTimeFormat = "2006-01-02 15:04:05.999999"
3838
// for easy, typed getters by column name.
3939
type RowMap map[string]CellData
4040

41-
// Cell data is the result of a single (atomic) column in a single row
41+
// CellData is the result of a single (atomic) column in a single row
4242
type CellData sql.NullString
4343

4444
func (this *CellData) MarshalJSON() ([]byte, error) {
@@ -200,31 +200,34 @@ func GetDB(mysql_uri string) (*sql.DB, bool, error) {
200200
return GetGenericDB("mysql", mysql_uri)
201201
}
202202

203-
// GetDB returns a SQLite DB instance based on DB file name.
203+
// GetSQLiteDB returns a SQLite DB instance based on DB file name.
204204
// bool result indicates whether the DB was returned from cache; err
205205
func GetSQLiteDB(dbFile string) (*sql.DB, bool, error) {
206-
return GetGenericDB("sqlite3", dbFile)
206+
return GetGenericDB("sqlite", dbFile)
207207
}
208208

209209
// RowToArray is a convenience function, typically not called directly, which maps a
210210
// single read database row into a NullString
211-
func RowToArray(rows *sql.Rows, columns []string) []CellData {
211+
func RowToArray(rows *sql.Rows, columns []string) ([]CellData, error) {
212212
buff := make([]any, len(columns))
213213
data := make([]CellData, len(columns))
214214
for i := range buff {
215215
buff[i] = data[i].NullString()
216216
}
217-
rows.Scan(buff...)
218-
return data
217+
err := rows.Scan(buff...)
218+
return data, err
219219
}
220220

221221
// ScanRowsToArrays is a convenience function, typically not called directly, which maps rows
222222
// already read from the databse into arrays of NullString
223223
func ScanRowsToArrays(rows *sql.Rows, on_row func([]CellData) error) error {
224224
columns, _ := rows.Columns()
225225
for rows.Next() {
226-
arr := RowToArray(rows, columns)
227-
err := on_row(arr)
226+
arr, err := RowToArray(rows, columns)
227+
if err != nil {
228+
return err
229+
}
230+
err = on_row(arr)
228231
if err != nil {
229232
return err
230233
}

go/vt/vtgr/config/vtgr_config.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ type Configuration struct {
104104
MySQLTopologyUseMutualTLS bool // Turn on TLS authentication with the Topology MySQL instances
105105
MySQLTopologyUseMixedTLS bool // Mixed TLS and non-TLS authentication with the Topology MySQL instances
106106
TLSCacheTTLFactor uint // Factor of InstancePollSeconds that we set as TLS info cache expiry
107-
BackendDB string // EXPERIMENTAL: type of backend db; either "mysql" or "sqlite3"
108-
SQLite3DataFile string // when BackendDB == "sqlite3", full path to sqlite3 datafile
107+
BackendDB string // EXPERIMENTAL: type of backend db; either "mysql" or "sqlite"
108+
SQLite3DataFile string // when BackendDB == "sqlite", full path to sqlite3 datafile
109109
SkipOrchestratorDatabaseUpdate bool // When true, do not check backend database schema nor attempt to update it. Useful when you may be running multiple versions of orchestrator, and you only wish certain boxes to dictate the db structure (or else any time a different orchestrator version runs it will rebuild database schema)
110110
PanicIfDifferentDatabaseDeploy bool // When true, and this process finds the orchestrator backend DB was provisioned by a different version, panic
111111
RaftEnabled bool // When true, setup orchestrator in a raft consensus layout. When false (default) all Raft* variables are ignored
@@ -477,7 +477,7 @@ func (config *Configuration) postReadAdjustments() error {
477477
}
478478

479479
if config.IsSQLite() && config.SQLite3DataFile == "" {
480-
return fmt.Errorf("SQLite3DataFile must be set when BackendDB is sqlite3")
480+
return fmt.Errorf("SQLite3DataFile must be set when BackendDB is sqlite")
481481
}
482482
if config.RaftEnabled && config.RaftDataDir == "" {
483483
return fmt.Errorf("RaftDataDir must be defined since raft is enabled (RaftEnabled)")

0 commit comments

Comments
 (0)