Skip to content

Commit

Permalink
fix: use slaveof force when a pika server recovered and delete CentOS…
Browse files Browse the repository at this point in the history
… github CI workflow config (OpenAtomFoundation#2789)

* updateMasterToNewOneForcefully

* remove centos CI

---------

Co-authored-by: liuyuecai <[email protected]>
  • Loading branch information
luky116 and liuyuecai authored Jul 9, 2024
1 parent 5b13e40 commit 3c27689
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 142 deletions.
140 changes: 0 additions & 140 deletions .github/workflows/pika.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,146 +78,6 @@ jobs:
chmod +x integrate_test.sh
sh integrate_test.sh
build_on_centos:
runs-on: ubuntu-latest
container:
image: centos:7

steps:
- name: set up mirror
run: |
rm -rf /etc/yum.repos.d/CentOS-Base.repo
cat > /etc/yum.repos.d/CentOS-Base.repo << EOL
[base]
name=CentOS-\$releasever - Base
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-\$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/updates/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-\$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/extras/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-\$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/centosplus/\$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOL
cat > /etc/yum.repos.d/CentOS-SCLo-scl.repo << EOL
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Source
baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOL
cat > /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo << EOL
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Source
baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOL
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-SCLo
yum clean all
yum makecache
- name: Install deps
run: |
yum install -y wget git autoconf centos-release-scl gcc
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make devtoolset-10-bin-util
yum install -y llvm-toolset-7 llvm-toolset-7-clang tcl which
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Install cmake
run: |
wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
bash ./cmake-3.26.4-linux-x86_64.sh --skip-license --prefix=/usr
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure CMake
run: |
source /opt/rh/devtoolset-10/enable
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/deps
key: ${{ runner.os }}-centos-deps-${{ hashFiles('**/CMakeLists.txt') }}

- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/buildtrees
key: ${{ runner.os }}-centos-buildtrees-${{ hashFiles('**/CMakeLists.txt') }}

- name: Build
run: |
source /opt/rh/devtoolset-10/enable
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ env.BUILD_TYPE }}

- name: Unit Test
working-directory: ${{ github.workspace }}
run: ./pikatests.sh all

- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}/build
run: |
chmod +x ../tests/integration/start_master_and_slave.sh
../tests/integration/start_master_and_slave.sh
chmod +x ../tests/integration/start_codis.sh
../tests/integration/start_codis.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
cd ../tools/pika_keys_analysis/
go test -v ./...
cd ../../tests/integration/
chmod +x integrate_test.sh
sh integrate_test.sh
build_on_macos:
runs-on: macos-12

Expand Down
4 changes: 2 additions & 2 deletions codis/pkg/topom/topom_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ func (s *Topom) tryFixReplicationRelationship(group *models.Group, groupServer *
return nil
}

// current server is slave, execute the command `slaveof [new master ip] [new master port]`
if err = updateMasterToNewOne(groupServer.Addr, curMasterAddr, s.config.ProductAuth); err != nil {
// current server is slave, execute the command `slaveof [new master ip] [new master port] force`
if err = updateMasterToNewOneForcefully(groupServer.Addr, curMasterAddr, s.config.ProductAuth); err != nil {
return err
}
}
Expand Down

0 comments on commit 3c27689

Please sign in to comment.