If you can, provide logs
12 |
13 | ```bash
14 | any logs here
15 | ```
16 |
17 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: gomod
4 | directory: /
5 | schedule:
6 | interval: "monthly"
7 | groups:
8 | dev-dependencies:
9 | applies-to: version-updates
10 | patterns:
11 | - "*"
12 | - package-ecosystem: github-actions
13 | directory: /
14 | schedule:
15 | interval: "monthly"
16 | groups:
17 | actions-dependencies:
18 | applies-to: version-updates
19 | patterns:
20 | - "*"
21 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | name: CodeQL
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 | schedule:
9 | - cron: '30 06 * * 6'
10 |
11 | env:
12 | GO_VERSION: 1.22.1
13 |
14 | jobs:
15 | analyze:
16 | runs-on: ubuntu-latest
17 | permissions:
18 | security-events: write
19 | steps:
20 | - name: Check out code into the Go module directory
21 | uses: actions/checkout@v4
22 | - name: Set up Go 1.x
23 | uses: actions/setup-go@v5
24 | with:
25 | go-version: ${{ env.GO_VERSION }}
26 | - name: Initialize CodeQL
27 | uses: github/codeql-action/init@v3
28 | with:
29 | languages: go
30 | build-mode: manual
31 | - name: Build
32 | run: go build -tags netgo,osusergo -o ./cmd/mysync/mysync ./cmd/mysync/...
33 | - name: Perform CodeQL Analysis
34 | uses: github/codeql-action/analyze@v3
35 | with:
36 | category: "/language:go"
37 |
--------------------------------------------------------------------------------
/.github/workflows/docker-jepsen.yml:
--------------------------------------------------------------------------------
1 | name: Jepsen tests
2 |
3 | on:
4 | schedule:
5 | - cron: '0 0 * * *'
6 |
7 | env:
8 | GO_VERSION: 1.22.4
9 |
10 | jobs:
11 | test:
12 | name: jepsen
13 | runs-on: ubuntu-22.04
14 | steps:
15 | - name: Set up Go 1.x
16 | uses: actions/setup-go@v5
17 | with:
18 | go-version: ${{ env.GO_VERSION }}
19 | id: go
20 |
21 | - name: Check out code into the Go module directory
22 | uses: actions/checkout@v4
23 |
24 | - name: Get dependencies
25 | run: |
26 | go get -v -t -d ./...
27 |
28 | - name: Test
29 | run: make base_img jepsen_base_img jepsen_test
30 |
31 | - uses: actions/upload-artifact@v4
32 | if: failure()
33 | with:
34 | name: logs
35 | path: tests/logs
36 |
--------------------------------------------------------------------------------
/.github/workflows/docker-tests-8.0.yml:
--------------------------------------------------------------------------------
1 | name: Docker tests (8.0)
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | env:
10 | GO_VERSION: 1.22.4
11 | DOCKER_API_VERSION: 1.43
12 |
13 | jobs:
14 | buildimages:
15 | name: Build images
16 | runs-on: ubuntu-22.04
17 | steps:
18 | - name: Check out code into the Go module directory
19 | uses: actions/checkout@v4
20 |
21 | - name: Docker images caching
22 | id: cache-images
23 | uses: actions/cache@v4
24 | with:
25 | path: ~/mysync-base-img8.0.tgz
26 | key: mysync-base-img8.0-${{ hashFiles('tests/images/base/*') }}
27 |
28 | - name: Build images
29 | if: steps.cache-images.outputs.cache-hit != 'true'
30 | run: make base_img_8.0
31 |
32 | - name: Export image
33 | if: steps.cache-images.outputs.cache-hit != 'true'
34 | run: docker save mysync-test-base8.0 | gzip -c > ~/mysync-base-img8.0.tgz
35 |
36 | test:
37 | name: test
38 | runs-on: ubuntu-22.04
39 | needs: [ buildimages ]
40 | strategy:
41 | matrix:
42 | command:
43 | - 'VERSION=8.0 GODOG_FEATURE=active_nodes.feature make test'
44 | - 'VERSION=8.0 GODOG_FEATURE=async.feature make test'
45 | - 'VERSION=8.0 GODOG_FEATURE=async_setting.feature make test'
46 | - 'VERSION=8.0 GODOG_FEATURE=cascade_replicas.feature make test'
47 | - 'VERSION=8.0 GODOG_FEATURE=CLI.feature make test'
48 | - 'VERSION=8.0 GODOG_FEATURE=crash_recovery.feature make test'
49 | - 'VERSION=8.0 GODOG_FEATURE=events_reenable.feature make test'
50 | - 'VERSION=8.0 GODOG_FEATURE=external_replication.feature make test'
51 | - 'VERSION=8.0 GODOG_FEATURE=failover.feature make test'
52 | - 'VERSION=8.0 GODOG_FEATURE=free_space.feature make test'
53 | - 'VERSION=8.0 GODOG_FEATURE=host_discovery.feature make test'
54 | - 'VERSION=8.0 GODOG_FEATURE=host_management.feature make test'
55 | - 'VERSION=8.0 GODOG_FEATURE=maintenance.feature make test'
56 | - 'VERSION=8.0 GODOG_FEATURE=offline_mode.feature make test'
57 | - 'VERSION=8.0 GODOG_FEATURE=priority.feature make test'
58 | - 'VERSION=8.0 GODOG_FEATURE=readonly_filesystem.feature make test'
59 | - 'VERSION=8.0 GODOG_FEATURE=recovery.feature make test'
60 | - 'VERSION=8.0 GODOG_FEATURE=repair.feature make test'
61 | - 'VERSION=8.0 GODOG_FEATURE=repl_mon.feature make test'
62 | - 'VERSION=8.0 GODOG_FEATURE=statefile.feature make test'
63 | - 'VERSION=8.0 GODOG_FEATURE=switchover_from.feature make test'
64 | - 'VERSION=8.0 GODOG_FEATURE=switchover_to.feature make test'
65 | - 'VERSION=8.0 GODOG_FEATURE=zk_failure.feature make test'
66 | - 'VERSION=8.0 GODOG_FEATURE=zk_maintenance.feature make test'
67 | - 'VERSION=8.0 GODOG_FEATURE=manager_switchover.feature make test'
68 | fail-fast: false
69 |
70 | steps:
71 | - name: Set up Go 1.x
72 | uses: actions/setup-go@v5
73 | with:
74 | go-version: ${{ env.GO_VERSION }}
75 | id: go
76 |
77 | - name: Check out code into the Go module directory
78 | uses: actions/checkout@v4
79 |
80 | - name: Get dependencies
81 | run: |
82 | go get -v -t -d ./...
83 |
84 | - name: Load docker images
85 | id: cache-images
86 | uses: actions/cache@v4
87 | with:
88 | path: ~/mysync-base-img8.0.tgz
89 | key: mysync-base-img8.0-${{ hashFiles('tests/images/base/*') }}
90 |
91 | - name: Fail if no cached images
92 | if: steps.cache-images.outputs.cache-hit != 'true'
93 | run: |
94 | echo "Failed to fetch cached docker images. Will now exit..."
95 | exit 1
96 |
97 | - name: Import image
98 | run: docker load -i ~/mysync-base-img8.0.tgz
99 |
100 | - name: Run test
101 | run: ${{ matrix.command }}
102 |
103 | - uses: actions/upload-artifact@v4
104 | if: failure()
105 | with:
106 | name: logs
107 | path: tests/logs
108 |
--------------------------------------------------------------------------------
/.github/workflows/docker-tests-8.4.yml:
--------------------------------------------------------------------------------
1 | name: Docker tests (8.4)
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | env:
10 | GO_VERSION: 1.22.4
11 | DOCKER_API_VERSION: 1.43
12 |
13 | jobs:
14 | buildimages:
15 | name: Build images
16 | runs-on: ubuntu-22.04
17 | steps:
18 | - name: Check out code into the Go module directory
19 | uses: actions/checkout@v4
20 |
21 | - name: Docker images caching
22 | id: cache-images
23 | uses: actions/cache@v4
24 | with:
25 | path: ~/mysync-base-img8.4.tgz
26 | key: mysync-base-img8.4-${{ hashFiles('tests/images/base/*') }}
27 |
28 | - name: Build images
29 | if: steps.cache-images.outputs.cache-hit != 'true'
30 | run: make base_img_8.4
31 |
32 | - name: Export image
33 | if: steps.cache-images.outputs.cache-hit != 'true'
34 | run: docker save mysync-test-base8.4 | gzip -c > ~/mysync-base-img8.4.tgz
35 |
36 | test:
37 | name: test
38 | runs-on: ubuntu-22.04
39 | needs: [ buildimages ]
40 | strategy:
41 | matrix:
42 | command:
43 | - 'VERSION=8.4 GODOG_FEATURE=active_nodes.feature make test'
44 | - 'VERSION=8.4 GODOG_FEATURE=async.feature make test'
45 | - 'VERSION=8.4 GODOG_FEATURE=async_setting.feature make test'
46 | - 'VERSION=8.4 GODOG_FEATURE=cascade_replicas.84.feature make test'
47 | - 'VERSION=8.4 GODOG_FEATURE=CLI.feature make test'
48 | - 'VERSION=8.4 GODOG_FEATURE=crash_recovery.feature make test'
49 | - 'VERSION=8.4 GODOG_FEATURE=events_reenable.84.feature make test'
50 | - 'VERSION=8.4 GODOG_FEATURE=external_replication.feature make test'
51 | - 'VERSION=8.4 GODOG_FEATURE=failover.84.feature make test'
52 | - 'VERSION=8.4 GODOG_FEATURE=free_space.feature make test'
53 | - 'VERSION=8.4 GODOG_FEATURE=host_discovery.feature make test'
54 | - 'VERSION=8.4 GODOG_FEATURE=host_management.feature make test'
55 | - 'VERSION=8.4 GODOG_FEATURE=maintenance.84.feature make test'
56 | - 'VERSION=8.4 GODOG_FEATURE=offline_mode.84.feature make test'
57 | - 'VERSION=8.4 GODOG_FEATURE=priority.feature make test'
58 | - 'VERSION=8.4 GODOG_FEATURE=readonly_filesystem.feature make test'
59 | - 'VERSION=8.4 GODOG_FEATURE=recovery.feature make test'
60 | - 'VERSION=8.4 GODOG_FEATURE=repair.feature make test'
61 | - 'VERSION=8.4 GODOG_FEATURE=repl_mon.feature make test'
62 | - 'VERSION=8.4 GODOG_FEATURE=statefile.feature make test'
63 | - 'VERSION=8.4 GODOG_FEATURE=switchover_from.84.feature make test'
64 | - 'VERSION=8.4 GODOG_FEATURE=switchover_to.feature make test'
65 | - 'VERSION=8.4 GODOG_FEATURE=zk_failure.feature make test'
66 | - 'VERSION=8.4 GODOG_FEATURE=zk_maintenance.feature make test'
67 | - 'VERSION=8.4 GODOG_FEATURE=manager_switchover.feature make test'
68 | fail-fast: false
69 |
70 | steps:
71 | - name: Set up Go 1.x
72 | uses: actions/setup-go@v5
73 | with:
74 | go-version: ${{ env.GO_VERSION }}
75 | id: go
76 |
77 | - name: Check out code into the Go module directory
78 | uses: actions/checkout@v4
79 |
80 | - name: Get dependencies
81 | run: |
82 | go get -v -t -d ./...
83 |
84 | - name: Load docker images
85 | id: cache-images
86 | uses: actions/cache@v4
87 | with:
88 | path: ~/mysync-base-img8.4.tgz
89 | key: mysync-base-img8.4-${{ hashFiles('tests/images/base/*') }}
90 |
91 | - name: Fail if no cached images
92 | if: steps.cache-images.outputs.cache-hit != 'true'
93 | run: |
94 | echo "Failed to fetch cached docker images. Will now exit..."
95 | exit 1
96 |
97 | - name: Import image
98 | run: docker load -i ~/mysync-base-img8.4.tgz
99 |
100 | - name: Run test
101 | run: ${{ matrix.command }}
102 |
103 | - uses: actions/upload-artifact@v4
104 | if: failure()
105 | with:
106 | name: logs
107 | path: tests/logs
108 |
--------------------------------------------------------------------------------
/.github/workflows/docker-tests.yml:
--------------------------------------------------------------------------------
1 | name: Docker tests (5.7)
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | env:
10 | GO_VERSION: 1.22.4
11 | DOCKER_API_VERSION: 1.43
12 |
13 | jobs:
14 | buildimages:
15 | name: Build images
16 | runs-on: ubuntu-22.04
17 | steps:
18 | - name: Check out code into the Go module directory
19 | uses: actions/checkout@v4
20 |
21 | - name: Docker images caching
22 | id: cache-images
23 | uses: actions/cache@v4
24 | with:
25 | path: ~/mysync-base-img.tgz
26 | key: mysync-base-img-${{ hashFiles('tests/images/base/*') }}
27 |
28 | - name: Build images
29 | if: steps.cache-images.outputs.cache-hit != 'true'
30 | run: make base_img
31 |
32 | - name: Export image
33 | if: steps.cache-images.outputs.cache-hit != 'true'
34 | run: docker save mysync-test-base | gzip -c > ~/mysync-base-img.tgz
35 |
36 | test:
37 | name: test
38 | runs-on: ubuntu-22.04
39 | needs: [ buildimages ]
40 | strategy:
41 | matrix:
42 | command:
43 | - 'GODOG_FEATURE=active_nodes.feature make test'
44 | - 'GODOG_FEATURE=async.feature make test'
45 | - 'GODOG_FEATURE=cascade_replicas.feature make test'
46 | - 'GODOG_FEATURE=CLI.feature make test'
47 | - 'GODOG_FEATURE=crash_recovery.feature make test'
48 | - 'GODOG_FEATURE=events_reenable.feature make test'
49 | - 'GODOG_FEATURE=failover.feature make test'
50 | - 'GODOG_FEATURE=free_space.feature make test'
51 | - 'GODOG_FEATURE=host_discovery.feature make test'
52 | - 'GODOG_FEATURE=host_management.feature make test'
53 | - 'GODOG_FEATURE=maintenance.feature make test'
54 | - 'GODOG_FEATURE=offline_mode.feature make test'
55 | - 'GODOG_FEATURE=priority.feature make test'
56 | - 'GODOG_FEATURE=readonly_filesystem.feature make test'
57 | - 'GODOG_FEATURE=recovery.feature make test'
58 | - 'GODOG_FEATURE=repair.feature make test'
59 | - 'GODOG_FEATURE=repl_mon.feature make test'
60 | - 'GODOG_FEATURE=statefile.feature make test'
61 | - 'GODOG_FEATURE=switchover_from.feature make test'
62 | - 'GODOG_FEATURE=switchover_to.feature make test'
63 | - 'GODOG_FEATURE=zk_failure.feature make test'
64 | - 'GODOG_FEATURE=zk_maintenance.feature make test'
65 | - 'GODOG_FEATURE=manager_switchover.feature make test'
66 | fail-fast: false
67 |
68 | steps:
69 | - name: Set up Go 1.x
70 | uses: actions/setup-go@v5
71 | with:
72 | go-version: ${{ env.GO_VERSION }}
73 | id: go
74 |
75 | - name: Check out code into the Go module directory
76 | uses: actions/checkout@v4
77 |
78 | - name: Get dependencies
79 | run: |
80 | go get -v -t -d ./...
81 |
82 | - name: Load docker images
83 | id: cache-images
84 | uses: actions/cache@v4
85 | with:
86 | path: ~/mysync-base-img.tgz
87 | key: mysync-base-img-${{ hashFiles('tests/images/base/*') }}
88 |
89 | - name: Fail if no cached images
90 | if: steps.cache-images.outputs.cache-hit != 'true'
91 | run: |
92 | echo "Failed to fetch cached docker images. Will now exit..."
93 | exit 1
94 |
95 | - name: Import image
96 | run: docker load -i ~/mysync-base-img.tgz
97 |
98 | - name: Run test
99 | run: ${{ matrix.command }}
100 |
101 | - uses: actions/upload-artifact@v4
102 | if: failure()
103 | with:
104 | name: logs
105 | path: tests/logs
106 |
--------------------------------------------------------------------------------
/.github/workflows/golangci-lint.yml:
--------------------------------------------------------------------------------
1 | name: Linters
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | permissions:
10 | contents: read
11 |
12 | jobs:
13 | golangci:
14 | name: lint
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/setup-go@v5
18 | with:
19 | go-version: 1.24.1
20 | - uses: actions/checkout@v4
21 | - name: golangci-lint
22 | uses: golangci/golangci-lint-action@v8.0.0
23 | with:
24 | version: v2.1
25 |
--------------------------------------------------------------------------------
/.github/workflows/unit-tests.yml:
--------------------------------------------------------------------------------
1 | name: Unit tests
2 |
3 | on:
4 | workflow_dispatch:
5 | push:
6 | branches: [ master ]
7 | pull_request:
8 | branches: [ master ]
9 |
10 | env:
11 | GO_VERSION: 1.22.4
12 |
13 | jobs:
14 | unittest:
15 | name: all_unittests
16 | runs-on: ubuntu-22.04
17 | steps:
18 | - name: Set up Go 1.x
19 | uses: actions/setup-go@v5
20 | with:
21 | go-version: ${{ env.GO_VERSION }}
22 | id: go
23 |
24 | - name: Check out code into the Go module directory
25 | uses: actions/checkout@v4
26 |
27 | - name: Get dependencies
28 | run: |
29 | go get -v -t -d ./...
30 |
31 | - name: Test
32 | run: make unittests
33 | env:
34 | TEST_MODIFIER: -race
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # ide
2 | .DS_Store
3 | .idea/
4 | .vscode/
5 | *.vsix
6 | *.swp
7 | *.swo
8 |
9 |
10 | # ext code
11 | vendor/
12 | buildtools/
13 |
14 | # binaries
15 | cmd/mysync/mysync
16 | tests/images/mysql/mysync
17 | tests/images/mysql_jepsen/mysync
18 |
19 | # tests
20 | tests/logs/
21 |
--------------------------------------------------------------------------------
/.golangci.yml:
--------------------------------------------------------------------------------
1 | version: "2"
2 | run:
3 | go: "1.22"
4 | modules-download-mode: mod
5 | linters:
6 | default: none
7 | enable:
8 | - bodyclose
9 | - copyloopvar
10 | - dupl
11 | - errcheck
12 | - funlen
13 | - gocritic
14 | - gocyclo
15 | - govet
16 | - ineffassign
17 | - misspell
18 | - nakedret
19 | - revive
20 | - staticcheck
21 | - unconvert
22 | - unparam
23 | - unused
24 | - whitespace
25 | settings:
26 | dupl:
27 | threshold: 400
28 | funlen:
29 | lines: 150
30 | statements: 100
31 | gocritic:
32 | enabled-tags:
33 | - performance
34 | disabled-tags:
35 | - diagnostic
36 | - experimental
37 | - opinionated
38 | - style
39 | gocyclo:
40 | min-complexity: 25
41 | lll:
42 | line-length: 140
43 | misspell:
44 | locale: US
45 | revive:
46 | rules:
47 | - name: blank-imports
48 | - name: context-as-argument
49 | - name: context-keys-type
50 | - name: dot-imports
51 | - name: error-return
52 | - name: error-naming
53 | - name: exported
54 | - name: var-naming
55 | - name: var-declaration
56 | - name: package-comments
57 | - name: range
58 | - name: receiver-naming
59 | - name: time-naming
60 | - name: unexported-return
61 | - name: errorf
62 | - name: empty-block
63 | - name: unreachable-code
64 | - name: redefines-builtin-id
65 | exclusions:
66 | generated: lax
67 | presets:
68 | - comments
69 | - common-false-positives
70 | - legacy
71 | - std-error-handling
72 | paths:
73 | - third_party$
74 | - builtin$
75 | - examples$
76 | severity:
77 | default: error
78 | formatters:
79 | enable:
80 | - gofmt
81 | - goimports
82 | exclusions:
83 | generated: lax
84 | paths:
85 | - third_party$
86 | - builtin$
87 | - examples$
88 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | The following authors have created the source code of "Yandex Mysync"
2 | published and distributed by YANDEX LLC as the owner:
3 |
4 | Dmitry Smal mialinx@yandex-team.ru
5 | Kirill Reshke reshke@yandex-team.ru
6 | Aleksandr Shevchuk teem0n@yandex-team.ru
7 | Nikolay Antonov ostinru@yandex-team.ru
8 | Evgeniy Dyukov secwall@yandex-team.ru
9 | Bulat Ahmetzyanov bularond@yandex-team.ru
10 | Andrey Krasichkov buglloc@yandex-team.ru
11 | Andrey Borodin x4mmm@yandex-team.ru
12 | Ilya Sinelnikov sidh@yandex-team.ru
13 | Sergey Bevzenko sabevzenko@yandex-team.ru
14 | Svyatoslav Ermilin munakoiso@yandex-team.ru
15 | Georgiy Zujkov gzuykov@yandex-team.ru
16 | Georgiy Rylov godjan@yandex-team.ru
17 | Igor Suetin suetin@yandex-team.ru
18 | Pavel Khattu khattu@yandex-team.ru
19 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Notice to external contributors
2 |
3 |
4 | ## General info
5 |
6 | Hello! In order for us (YANDEX LLC) to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the “**CLA**â€). The current version of the CLA can be found here:
7 | 1) https://yandex.ru/legal/cla/?lang=en (in English) and
8 | 2) https://yandex.ru/legal/cla/?lang=ru (in Russian).
9 |
10 | By adopting the CLA, you state the following:
11 |
12 | * You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA,
13 | * You have read the terms and conditions of the CLA and agree with them in full,
14 | * You are legally able to provide and license your contributions as stated,
15 | * We may use your contributions for our open source projects and for any other our project too,
16 | * We rely on your assurances concerning the rights of third parties in relation to your contributions.
17 |
18 | If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you have already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA.
19 |
20 | ## Provide contributions
21 |
22 | If you have already adopted terms and conditions of the CLA, you are able to provide your contributions. When you submit your pull request, please add the following information into it:
23 |
24 | ```
25 | I hereby agree to the terms of the CLA available at: [link].
26 | ```
27 |
28 | Replace the bracketed text as follows:
29 | * [link] is the link to the current version of the CLA: https://yandex.ru/legal/cla/?lang=en (in English) or https://yandex.ru/legal/cla/?lang=ru (in Russian).
30 |
31 | It is enough to provide us such notification once.
32 |
33 | ## Other questions
34 |
35 | If you have any questions, please mail us at opensource@yandex-team.ru.
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2025 YANDEX LLC
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | build:
2 | go build -o ./cmd/mysync/mysync ./cmd/mysync/...
3 |
4 | format:
5 | gofmt -s -w `find . -name '*.go'`
6 | goimports -w `find . -name '*.go'`
7 |
8 | lint:
9 | docker run --rm -v ${CURDIR}:/app -w /app golangci/golangci-lint:v2.1-alpine golangci-lint run -v
10 |
11 | unittests:
12 | go test ./cmd/... ./internal/...
13 | go test ./cmd/... ./tests/testutil/matchers/
14 |
15 | base_img:
16 | docker build --tag=mysync-test-base tests/images/base --build-arg MYSQL_VERSION=5.7
17 |
18 | base_img_8.0:
19 | docker build --tag=mysync-test-base8.0 tests/images/base --build-arg MYSQL_VERSION=8.0
20 |
21 | base_img_8.4:
22 | docker build --tag=mysync-test-base8.4 tests/images/base --build-arg MYSQL_VERSION=8.4
23 |
24 | jepsen_base_img:
25 | docker build --tag=mysync-jepsen-test-base tests/images/jepsen_common
26 |
27 | test:
28 | GOOS=linux go build -tags netgo,osusergo -o ./cmd/mysync/mysync ./cmd/mysync/...
29 | go build ./tests/...
30 | rm -fr ./tests/images/mysql/mysync && cp ./cmd/mysync/mysync ./tests/images/mysql/mysync
31 | rm -rf ./tests/logs
32 | mkdir ./tests/logs
33 | (cd tests; go test -timeout 150m)
34 |
35 | jepsen_test:
36 | GOOS=linux go build -tags netgo,osusergo -o ./cmd/mysync/mysync ./cmd/mysync/...
37 | go build ./tests/...
38 | rm -fr ./tests/images/mysql_jepsen/mysync && cp ./cmd/mysync/mysync ./tests/images/mysql_jepsen/mysync
39 | docker compose -p mysync -f ./tests/images/jepsen-compose.yml up -d --force-recreate --build
40 | timeout 600 docker exec mysync_zoo1_1 /usr/local/bin/generate_certs_with_restart.sh mysync_zookeeper1_1.mysync_mysql_net
41 | timeout 600 docker exec mysync_zoo2_1 /usr/local/bin/generate_certs_with_restart.sh mysync_zookeeper2_1.mysync_mysql_net
42 | timeout 600 docker exec mysync_zoo3_1 /usr/local/bin/generate_certs_with_restart.sh mysync_zookeeper3_1.mysync_mysql_net
43 | timeout 600 docker exec mysync_zoo1_1 retriable_path_create.sh /test
44 | timeout 600 docker exec mysync_zoo1_1 retriable_path_create.sh /test/ha_nodes
45 | timeout 600 docker exec mysync_zoo1_1 retriable_path_create.sh /test/ha_nodes/mysync_mysql1_1
46 | timeout 600 docker exec mysync_zoo1_1 retriable_path_create.sh /test/ha_nodes/mysync_mysql2_1
47 | timeout 600 docker exec mysync_zoo1_1 retriable_path_create.sh /test/ha_nodes/mysync_mysql3_1
48 | timeout 600 docker exec mysync_mysql1_1 sh -c "/var/lib/dist/base/generate_certs.sh mysync_mysql1_1.mysync_mysql_net && supervisorctl restart mysync && supervisorctl start mysqld"
49 | timeout 600 docker exec mysync_mysql2_1 sh -c "/var/lib/dist/base/generate_certs.sh mysync_mysql2_1.mysync_mysql_net && supervisorctl restart mysync && supervisorctl start mysqld"
50 | timeout 600 docker exec mysync_mysql3_1 sh -c "/var/lib/dist/base/generate_certs.sh mysync_mysql3_1.mysync_mysql_net && supervisorctl restart mysync && supervisorctl start mysqld"
51 | timeout 600 docker exec mysync_mysql1_1 setup.sh
52 | timeout 600 bash ./tests/images/copy_keys.sh
53 | mkdir -p ./tests/logs
54 | (docker exec mysync_jepsen_1 /root/jepsen/run.sh > ./tests/logs/jepsen.log 2>&1 && tail -n 50 ./tests/logs/jepsen.log) || ./tests/images/jepsen_main/save_logs.sh
55 | docker compose -p mysync -f ./tests/images/jepsen-compose.yml down --rmi all
56 |
57 | clean:
58 | docker ps | grep mysync | awk '{print $$1}' | xargs docker rm -f || true
59 | docker network ls | grep mysync | awk '{print $$1}' | xargs docker network rm || true
60 | docker image ls | grep mysync | awk '{print $$3}' | xargs docker image rm --force || true
61 | rm -rf ./tests/logs
62 |
63 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | /badge.svg)
4 | /badge.svg)
5 | /badge.svg)
6 |
7 | ## MySync
8 |
9 | MySync is mysql high-availability and cluster configuration tool.
10 | MySync is designed to switch master in homogeneous MySQL cluster in manual and automatic mode without data loss.
11 |
12 | #### Project status
13 |
14 | MySync is production-ready, it is being used in large production setups.
15 | We appreciate any kind of feedback and contribution to the project.
16 |
17 | ### Architecture
18 |
19 |