Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from dolthub:main #13

Merged
merged 39 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
900ef12
Add helper function which catches errors that mean the operation isn'…
nicktobey Jun 27, 2024
83b1adf
Fix bug were an error during `processBuffer` could cause an infinite …
nicktobey Jun 27, 2024
5ad48f7
Correctly generate jsonLocation objects from keys in IndexedJsonDocum…
nicktobey Jun 29, 2024
b3bb151
Add tests for inserting into large (multi-chunk) JSON documents.
nicktobey Jun 29, 2024
dd20e08
Remove unused "strings" import.
nicktobey Jul 1, 2024
e136333
Verify that large inserts in "TestIndexedJsonDocument_Insert" moves c…
nicktobey Jul 1, 2024
7f66c4b
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
nicktobey Jul 1, 2024
d01a38a
Merge pull request #8088 from dolthub/nicktobey/json-tests
nicktobey Jul 3, 2024
8c441e9
go.mod: Migrate from gopkg.in/square/go-jose.v2 to gopkg.in/go-jose/g…
reltuk Jul 3, 2024
79b64da
Merge pull request #8101 from dolthub/aaron/gojose-bump
reltuk Jul 3, 2024
3393dc2
Bug fix for binlog heartbeat nextLogPosition field, when sent out bef…
fulghum Jul 3, 2024
d182f70
Implement IndexedJSONDocument::Remove
nicktobey Jun 28, 2024
f1ba971
Add tests for removing from large (multi-chunk) JSON documents.
nicktobey Jun 29, 2024
56eaca2
Refactor IndexedJsonDocument
nicktobey Jul 2, 2024
a0f5626
Merge pull request #8102 from dolthub/fulghum/bugfix
fulghum Jul 3, 2024
def23a2
[ga-bump-dep] Bump dependency in Dolt by fulghum
fulghum Jul 3, 2024
237bc14
Update uses of MutableJSON::Set and MutableJSON::Replace to use context.
nicktobey Jul 3, 2024
3db313f
Merge pull request #8104 from dolthub/fulghum-beee66e2
fulghum Jul 3, 2024
a43c7b4
[ga-bump-release] Update Dolt version to 1.41.3 and release v1.41.3
coffeegoddd Jul 4, 2024
716d65d
Respond to PR feedback.
nicktobey Jul 8, 2024
094ba06
Merge pull request #8103 from dolthub/nicktobey/json-remove
nicktobey Jul 8, 2024
d702af0
Update integration workflow
Hydrocharged Jul 8, 2024
2652db0
Merge pull request #8106 from dolthub/daylon/integration-workflow-update
Hydrocharged Jul 8, 2024
6a4134c
Add indexed json tests for JSON_REPLACE and JSON_SET
nicktobey Jul 2, 2024
d7cb874
Add support for JSON_SET and JSON_REPLACE
nicktobey Jul 2, 2024
56f5acc
[ga-bump-dep] Bump dependency in Dolt by tbantle22
tbantle22 Jul 8, 2024
e60da10
Merge pull request #8108 from dolthub/tbantle22-2c7d9503
tbantle22 Jul 9, 2024
4c2765c
[ga-bump-dep] Bump dependency in Dolt by tbantle22
tbantle22 Jul 9, 2024
563e607
Merge pull request #8112 from dolthub/tbantle22-10da4b78
tbantle22 Jul 9, 2024
2c9d4cb
[ga-bump-dep] Bump dependency in Dolt by tbantle22
tbantle22 Jul 9, 2024
2753e1b
Merge pull request #8113 from dolthub/tbantle22-d096364c
tbantle22 Jul 10, 2024
bfae45a
[ga-bump-dep] Bump dependency in Dolt by fulghum
fulghum Jul 10, 2024
586ef39
Merge pull request #8115 from dolthub/fulghum-a2f9636b
fulghum Jul 10, 2024
00add71
Merge pull request #8107 from dolthub/nicktobey/json-set
nicktobey Jul 10, 2024
0d11170
[ga-bump-dep] Bump dependency in Dolt by fulghum
fulghum Jul 11, 2024
dfd9b53
Merge pull request #8119 from dolthub/fulghum-9d40038e
fulghum Jul 11, 2024
db2efff
/docker/{Dockerfile,serverDockerfile}: change dolt installation to us…
coffeegoddd Jul 11, 2024
bef8c79
Merge pull request #8118 from dolthub/db/fix-dockerhub
coffeegoddd Jul 11, 2024
3745baa
[ga-bump-release] Update Dolt version to 1.41.4 and release v1.41.4
coffeegoddd Jul 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 34 additions & 21 deletions .github/workflows/doltgres-dependency.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
name: Test Integration with DoltgreSQL
on: [pull_request]

on:
pull_request:
types: [opened, synchronize, reopened]
issue_comment:
types: [created, edited]

jobs:
test-integration:
if: github.event_name == 'issue_comment' && github.event.issue.pull_request != '' || github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:
- name: Checkout go-mysql-server
- name: Check for a DoltgreSQL PR link
run: |
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments)
COMMENT_EXISTS=$(echo "$COMMENTS" | jq -r '.[] | select(.body | contains("github.com/dolthub/doltgresql/pull/"))')
if [ -n "$COMMENT_EXISTS" ]; then
exit 0
fi

- name: Checkout Dolt
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
Expand All @@ -19,29 +34,27 @@ jobs:
- name: Clone DoltgreSQL repository
run: git clone https://github.com/dolthub/doltgresql.git

- name: Update DoltgreSQL's dependency
- name: Build DoltgreSQL's parser
run: |
cd doltgresql
./postgres/parser/build.sh
go get github.com/dolthub/dolt/go@${{ github.event.pull_request.head.sha }}
go get github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi@${{ github.event.pull_request.head.sha }}
go mod tidy

- name: Test DoltgreSQL
- name: Test DoltgreSQL against main
id: test_doltgresql_main
continue-on-error: true
run: |
cd doltgresql/testing/go
go test ./... --count=1 -skip Replication || echo "doltgresql-tests-failed" > $GITHUB_WORKSPACE/doltgresql-test-result.txt
cd doltgresql
go get github.com/dolthub/dolt/go@main
go mod tidy
cd testing/go
go test ./... --count=1 -skip Replication

- name: Comment on failures
if: always()
- name: Test DoltgreSQL against PR
if: steps.test_doltgresql_main.outcome == 'success'
run: |
TEST_COMMENT=""
if [ -f $GITHUB_WORKSPACE/doltgresql-test-result.txt ]; then
TEST_COMMENT="Additional work is required for integration with [DoltgreSQL](https://github.com/dolthub/doltgresql)."
fi
if [ -n "$TEST_COMMENT" ]; then
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-X POST \
-d "{\"body\": \"$TEST_COMMENT\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
fi
cd doltgresql
git reset --hard
go get github.com/${{ github.event.pull_request.head.repo.full_name }}/go@${{ github.event.pull_request.head.sha }}
go mod tidy
cd testing/go
go test ./... --count=1 -skip Replication
12 changes: 6 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# syntax=docker/dockerfile:1.3-labs
FROM --platform=$BUILDPLATFORM ubuntu:22.04
FROM ubuntu:22.04

ARG DOLT_VERSION
ARG BUILDARCH

RUN apt update -y && \
apt install -y \
curl \
tini \
ca-certificates && \
apt clean && \
rm -rf /var/lib/apt/lists/*

ADD https://github.com/dolthub/dolt/releases/download/v${DOLT_VERSION}/dolt-linux-${BUILDARCH}.tar.gz dolt-linux-${BUILDARCH}.tar.gz
RUN tar zxvf dolt-linux-${BUILDARCH}.tar.gz && \
cp dolt-linux-${BUILDARCH}/bin/dolt /usr/local/bin && \
rm -rf dolt-linux-${BUILDARCH} dolt-linux-${BUILDARCH}.tar.gz
# we install dolt with the install.sh script, which will determine the platform/arch of the container
# and install the proper dolt binary
RUN bash -c 'curl -L https://github.com/dolthub/dolt/releases/download/v${DOLT_VERSION}/install.sh | bash'
RUN /usr/local/bin/dolt version

WORKDIR /var/lib/dolt
ENTRYPOINT ["tini", "--", "/usr/local/bin/dolt"]
12 changes: 6 additions & 6 deletions docker/serverDockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# syntax=docker/dockerfile:1.3-labs
FROM --platform=$BUILDPLATFORM ubuntu:22.04
FROM ubuntu:22.04

ARG DOLT_VERSION
ARG BUILDARCH

RUN apt update -y && \
apt install -y \
curl \
tini \
ca-certificates && \
apt clean && \
rm -rf /var/lib/apt/lists/*

ADD https://github.com/dolthub/dolt/releases/download/v${DOLT_VERSION}/dolt-linux-${BUILDARCH}.tar.gz dolt-linux-${BUILDARCH}.tar.gz
RUN tar zxvf dolt-linux-${BUILDARCH}.tar.gz && \
cp dolt-linux-${BUILDARCH}/bin/dolt /usr/local/bin && \
rm -rf dolt-linux-${BUILDARCH} dolt-linux-${BUILDARCH}.tar.gz
# we install dolt with the install.sh script, which will determine the platform/arch of the container
# and install the proper dolt binary
RUN bash -c 'curl -L https://github.com/dolthub/dolt/releases/download/v${DOLT_VERSION}/install.sh | bash'
RUN /usr/local/bin/dolt version

RUN mkdir /docker-entrypoint-initdb.d
VOLUME /var/lib/dolt
Expand Down
2 changes: 1 addition & 1 deletion go/Godeps/LICENSES

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/cmd/dolt/doltversion/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
package doltversion

const (
Version = "1.41.2"
Version = "1.41.4"
)
6 changes: 3 additions & 3 deletions go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/dolthub/fslock v0.0.3
github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
github.com/dolthub/vitess v0.0.0-20240626174323-4083c07f5e9c
github.com/dolthub/vitess v0.0.0-20240711213744-4232e1c4edae
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.13.0
github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568
Expand Down Expand Up @@ -45,7 +45,6 @@ require (
google.golang.org/api v0.126.0
google.golang.org/grpc v1.57.1
google.golang.org/protobuf v1.31.0
gopkg.in/square/go-jose.v2 v2.5.1
gopkg.in/src-d/go-errors.v1 v1.0.0
gopkg.in/yaml.v2 v2.4.0
)
Expand All @@ -57,7 +56,7 @@ require (
github.com/cespare/xxhash v1.1.0
github.com/creasty/defaults v1.6.0
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
github.com/dolthub/go-mysql-server v0.18.2-0.20240703002444-01667a0198d3
github.com/dolthub/go-mysql-server v0.18.2-0.20240711220745-9d40038e08d7
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63
github.com/dolthub/swiss v0.1.0
github.com/goccy/go-json v0.10.2
Expand Down Expand Up @@ -91,6 +90,7 @@ require (
golang.org/x/text v0.16.0
gonum.org/v1/plot v0.11.0
gopkg.in/errgo.v2 v2.1.0
gopkg.in/go-jose/go-jose.v2 v2.6.3
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
12 changes: 6 additions & 6 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw1+y/N5SSCkma7FhAPw7KeGmD6c9PBZW9Y=
github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168=
github.com/dolthub/go-mysql-server v0.18.2-0.20240703002444-01667a0198d3 h1:HoLlqFO9gQHwURwkpgCPOXH4wU3W00J3x6NeNL0B9/Q=
github.com/dolthub/go-mysql-server v0.18.2-0.20240703002444-01667a0198d3/go.mod h1:JahRYjx/Py6T/bWrnTu25CaGn94Df+McAuWGEG0shwU=
github.com/dolthub/go-mysql-server v0.18.2-0.20240711220745-9d40038e08d7 h1:UieqVU1binGIf81PoGYlNJ/wfluex2WfZw6EPJDAKBg=
github.com/dolthub/go-mysql-server v0.18.2-0.20240711220745-9d40038e08d7/go.mod h1:P6bG0p+3mH4LS4DLo3BySh10ZJTDqgWyfWBu8gGE3eU=
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI=
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q=
github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE=
Expand All @@ -197,8 +197,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY=
github.com/dolthub/swiss v0.1.0 h1:EaGQct3AqeP/MjASHLiH6i4TAmgbG/c4rA6a1bzCOPc=
github.com/dolthub/swiss v0.1.0/go.mod h1:BeucyB08Vb1G9tumVN3Vp/pyY4AMUnr9p7Rz7wJ7kAQ=
github.com/dolthub/vitess v0.0.0-20240626174323-4083c07f5e9c h1:Y3M0hPCUvT+5RTNbJLKywGc9aHIRCIlg+0NOhC91GYE=
github.com/dolthub/vitess v0.0.0-20240626174323-4083c07f5e9c/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
github.com/dolthub/vitess v0.0.0-20240711213744-4232e1c4edae h1:SAYP6+hzkoYLWVzQTwQO0QbhVOwMsgy0dpRcL/QriS8=
github.com/dolthub/vitess v0.0.0-20240711213744-4232e1c4edae/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
Expand Down Expand Up @@ -1157,14 +1157,14 @@ gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/go-jose/go-jose.v2 v2.6.3 h1:nt80fvSDlhKWQgSWyHyy5CfmlQr+asih51R8PTWNKKs=
gopkg.in/go-jose/go-jose.v2 v2.6.3/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q=
gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4=
gopkg.in/jcmturner/gokrb5.v7 v7.3.0/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w=
gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/src-d/go-errors.v1 v1.0.0 h1:cooGdZnCjYbeS1zb1s6pVAAimTdKceRrpn7aKOnNIfc=
gopkg.in/src-d/go-errors.v1 v1.0.0/go.mod h1:q1cBlomlw2FnDBDNGlnh6X0jPihy+QxZfMMNxPCbdYg=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
Expand Down
4 changes: 2 additions & 2 deletions go/libraries/doltcore/creds/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"time"

"golang.org/x/crypto/ed25519"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
"gopkg.in/go-jose/go-jose.v2"
"gopkg.in/go-jose/go-jose.v2/jwt"

"github.com/dolthub/dolt/go/libraries/utils/set"
"github.com/dolthub/dolt/go/store/util/datetime"
Expand Down
2 changes: 1 addition & 1 deletion go/libraries/doltcore/merge/merge_prolly_rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ func mergeJSON(ctx context.Context, base types.JSONDocument, left types.JSONDocu

switch threeWayDiff.Op {
case tree.DiffOpRightAdd, tree.DiffOpConvergentAdd, tree.DiffOpRightModify, tree.DiffOpConvergentModify:
_, _, err := merged.Set(threeWayDiff.Key, threeWayDiff.Right)
_, _, err := merged.Set(ctx, threeWayDiff.Key, threeWayDiff.Right)
if err != nil {
return types.JSONDocument{}, true, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func newBinlogStreamer() *binlogStreamer {
// is received over the stream (e.g. the connection closing) or the streamer is closed,
// through it's quit channel.
func (streamer *binlogStreamer) startStream(ctx *sql.Context, conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEventMeta mysql.BinlogEventMetadata) error {
if err := sendInitialEvents(ctx, conn, binlogFormat, binlogEventMeta); err != nil {
if err := sendInitialEvents(ctx, conn, binlogFormat, &binlogEventMeta); err != nil {
return err
}

Expand Down Expand Up @@ -185,7 +185,7 @@ func sendHeartbeat(conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEve

// sendInitialEvents sends the initial binlog events (i.e. Rotate, FormatDescription) over a newly established binlog
// streaming connection.
func sendInitialEvents(_ *sql.Context, conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEventMeta mysql.BinlogEventMetadata) error {
func sendInitialEvents(_ *sql.Context, conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEventMeta *mysql.BinlogEventMetadata) error {
err := sendRotateEvent(conn, binlogFormat, binlogEventMeta)
if err != nil {
return err
Expand All @@ -199,16 +199,20 @@ func sendInitialEvents(_ *sql.Context, conn *mysql.Conn, binlogFormat *mysql.Bin
return conn.FlushBuffer()
}

func sendRotateEvent(conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEventMeta mysql.BinlogEventMetadata) error {
func sendRotateEvent(conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEventMeta *mysql.BinlogEventMetadata) error {
binlogFilePosition := uint64(0)
binlogEventMeta.NextLogPosition = uint32(binlogFilePosition)

binlogEvent := mysql.NewRotateEvent(*binlogFormat, binlogEventMeta, binlogFilePosition, binlogFilename)
// The Rotate event sent at the start of a stream is a "virtual" event that isn't actually
// recorded to the binary log file, but sent to the replica so it knows what file is being
// read from. Because it is virtual, we do NOT update the nextLogPosition field of
// BinlogEventMetadata.
binlogEvent := mysql.NewRotateEvent(*binlogFormat, *binlogEventMeta, binlogFilePosition, binlogFilename)
return conn.WriteBinlogEvent(binlogEvent, false)
}

func sendFormatDescription(conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEventMeta mysql.BinlogEventMetadata) error {
binlogEvent := mysql.NewFormatDescriptionEvent(*binlogFormat, binlogEventMeta)
func sendFormatDescription(conn *mysql.Conn, binlogFormat *mysql.BinlogFormat, binlogEventMeta *mysql.BinlogEventMetadata) error {
binlogEvent := mysql.NewFormatDescriptionEvent(*binlogFormat, *binlogEventMeta)
binlogEventMeta.NextLogPosition += binlogEvent.Length()
return conn.WriteBinlogEvent(binlogEvent, false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,14 @@ func TestBinlogPrimary_Heartbeats(t *testing.T) {
defer teardown(t)
startSqlServersWithDoltSystemVars(t, doltReplicationPrimarySystemVars)
setupForDoltToMySqlReplication()
startReplication(t, doltPort)

primaryDatabase.MustExec("create table db01.heartbeatTest(pk int);")
// Start replication, with a 45s delay before any commands are sent to the primary.
// This gives enough time for the first heartbeat event to be sent, before any user
// initiated binlog events, so we can test that scenario.
startReplicationWithDelay(t, doltPort, 45*time.Second)

// Insert a row every second, for 70s, which gives the server a chance to send two heartbeats
primaryDatabase.MustExec("create table db01.heartbeatTest(pk int);")
endTime := time.Now().Add(70 * time.Second)
maxInsertValue := 0
for time.Now().Before(endTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,15 +681,24 @@ func stopDoltSqlServer(t *testing.T) {
}
}

// startReplication starts up replication on the replica, connecting to |port| on the primary,
// creates the test database, db01, on the primary, and ensures it gets replicated to the replica.
func startReplication(t *testing.T, port int) {
startReplicationWithDelay(t, port, 100*time.Millisecond)
}

// startReplication starts up replication on the replica, connecting to |port| on the primary,
// pauses for |delay| before creating the test database, db01, on the primary, and ensures it
// gets replicated to the replica.
func startReplicationWithDelay(t *testing.T, port int, delay time.Duration) {
replicaDatabase.MustExec("SET @@GLOBAL.server_id=123;")
replicaDatabase.MustExec(
fmt.Sprintf("change replication source to SOURCE_HOST='localhost', "+
"SOURCE_USER='replicator', SOURCE_PASSWORD='Zqr8_blrGm1!', "+
"SOURCE_PORT=%v, SOURCE_AUTO_POSITION=1, SOURCE_CONNECT_RETRY=5;", port))

replicaDatabase.MustExec("start replica;")
time.Sleep(100 * time.Millisecond)
time.Sleep(delay)

// Look to see if the test database, db01, has been created yet. If not, create it and wait for it to
// replicate to the replica. Note that when re-starting replication in certain tests, we can't rely on
Expand Down
2 changes: 1 addition & 1 deletion go/libraries/doltcore/sqle/cluster/interceptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"gopkg.in/square/go-jose.v2/jwt"
"gopkg.in/go-jose/go-jose.v2/jwt"

"github.com/dolthub/dolt/go/libraries/utils/jwtauth"
)
Expand Down
4 changes: 2 additions & 2 deletions go/libraries/doltcore/sqle/cluster/interceptors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import (
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
"gopkg.in/go-jose/go-jose.v2"
"gopkg.in/go-jose/go-jose.v2/jwt"

"github.com/dolthub/dolt/go/libraries/utils/jwtauth"
)
Expand Down
4 changes: 2 additions & 2 deletions go/libraries/doltcore/sqle/cluster/jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"encoding/json"
"net/http"

"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
"gopkg.in/go-jose/go-jose.v2"
"gopkg.in/go-jose/go-jose.v2/jwt"

"github.com/dolthub/dolt/go/libraries/doltcore/creds"
)
Expand Down
2 changes: 1 addition & 1 deletion go/libraries/utils/jwtauth/claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package jwtauth

import (
"gopkg.in/square/go-jose.v2/jwt"
"gopkg.in/go-jose/go-jose.v2/jwt"
)

type Claims struct {
Expand Down
4 changes: 2 additions & 2 deletions go/libraries/utils/jwtauth/jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"time"

"github.com/sirupsen/logrus"
jose "gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/json"
jose "gopkg.in/go-jose/go-jose.v2"
"gopkg.in/go-jose/go-jose.v2/json"
)

type cachedJWKS struct {
Expand Down
4 changes: 2 additions & 2 deletions go/libraries/utils/jwtauth/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"fmt"
"time"

jose "gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
jose "gopkg.in/go-jose/go-jose.v2"
"gopkg.in/go-jose/go-jose.v2/jwt"
)

type KeyProvider interface {
Expand Down
2 changes: 1 addition & 1 deletion go/libraries/utils/jwtauth/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package jwtauth
import (
"time"

"gopkg.in/square/go-jose.v2/jwt"
"gopkg.in/go-jose/go-jose.v2/jwt"
)

type JWTValidator interface {
Expand Down
Loading
Loading