diff --git a/.github/workflows/pika.yml b/.github/workflows/pika.yml index 429f32dcf3..49756598ad 100644 --- a/.github/workflows/pika.yml +++ b/.github/workflows/pika.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d281b2e33a..23145491ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,53 +47,9 @@ jobs: name: ${{ matrix.name }}.sha256sum path: build/${{ matrix.name }}.sha256sum - centos: - runs-on: ubuntu-latest - container: - image: centos:7 - env: - name: ${{ github.event.repository.name }}-${{ github.ref_name }}-centos-amd64.tar.gz - steps: - - name: Install deps - run: | - yum install -y wget git autoconf centos-release-scl gcc perl-Digest-SHA - 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: 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 sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Release build os - centos - run: | - chmod +x ci/release-build.sh - ./ci/release-build.sh install centos ${{ env.BUILD_TYPE }} -xe - - - name: Calculate checksum and rename binary - shell: bash - run: ./ci/release-build.sh checksum ${{ github.event.repository.name }} ${{ env.name }} - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.name }} - path: build/${{ env.name }} - - - name: Upload checksum of artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.name }}.sha256sum - path: build/${{ env.name }}.sha256sum - release: name: Release artifacts - needs: [ build,centos ] + needs: [ build ] runs-on: ubuntu-latest steps: - name: Download artifacts diff --git a/ci/release-build.sh b/ci/release-build.sh index a707fbc775..df8262aad9 100644 --- a/ci/release-build.sh +++ b/ci/release-build.sh @@ -22,9 +22,6 @@ function configure_cmake() { cmake -B build -DCMAKE_C_COMPILER=/usr/local/opt/gcc@10/bin/gcc-10 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE elif [[ $OS == *"ubuntu"* ]]; then cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS="-s" -DCMAKE_EXE_LINKER_FLAGS="-s" - elif [[ $OS == *"centos"* ]]; then - source /opt/rh/devtoolset-10/enable - cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address fi echo "configure cmake after ..." } diff --git a/codis/pkg/topom/topom_group.go b/codis/pkg/topom/topom_group.go index 53cc2b8fdd..98f2d3c537 100644 --- a/codis/pkg/topom/topom_group.go +++ b/codis/pkg/topom/topom_group.go @@ -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 } } diff --git a/src/net/src/dispatch_thread.cc b/src/net/src/dispatch_thread.cc index 922688c178..647d254d10 100644 --- a/src/net/src/dispatch_thread.cc +++ b/src/net/src/dispatch_thread.cc @@ -64,10 +64,10 @@ int DispatchThread::StartThread() { } // Adding timer tasks and run timertaskThread - timerTaskThread_.AddTimerTask("blrpop_blocking_info_scan", 250, true, + timer_task_thread_.AddTimerTask("blrpop_blocking_info_scan", 250, true, [this] { this->ScanExpiredBlockedConnsOfBlrpop(); }); - timerTaskThread_.set_thread_name("TimerTaskThread"); - timerTaskThread_.StartThread(); + timer_task_thread_.set_thread_name("TimerTaskThread"); + timer_task_thread_.StartThread(); return ServerThread::StartThread(); } @@ -88,7 +88,7 @@ int DispatchThread::StopThread() { worker_thread_[i]->private_data_ = nullptr; } } - timerTaskThread_.StopThread(); + timer_task_thread_.StopThread(); return ServerThread::StopThread(); } diff --git a/src/net/src/dispatch_thread.h b/src/net/src/dispatch_thread.h index 0fb1b5c89c..6d6543d3a9 100644 --- a/src/net/src/dispatch_thread.h +++ b/src/net/src/dispatch_thread.h @@ -161,7 +161,7 @@ class DispatchThread : public ServerThread { */ std::shared_mutex block_mtx_; - TimerTaskThread timerTaskThread_; + TimerTaskThread timer_task_thread_; }; // class DispatchThread } // namespace net diff --git a/src/net/src/net_util.h b/src/net/src/net_util.h index fe96e0a950..7b8cd364f3 100644 --- a/src/net/src/net_util.h +++ b/src/net/src/net_util.h @@ -47,6 +47,12 @@ struct ExecTsWithId { } }; +/* + * For simplicity, current version of TimerTaskThread has no lock inside and all task should be registered before TimerTaskThread started, + * but if you have the needs of dynamically add/remove timer task after TimerTaskThread started, you can simply add a mutex to protect + * the timer_task_manager_ and also a pipe to wake up the maybe being endless-wait epoll(if all task consumed, epoll will sink into + * endless wait) to implement the feature. + */ class TimerTaskManager { public: TimerTaskManager() = default;