From f425dd9e8c18e83689170b693877d989f453f508 Mon Sep 17 00:00:00 2001 From: Yijun Zhao Date: Mon, 23 Dec 2019 15:22:07 +0800 Subject: [PATCH] fix goroutine leak (#14) * fix mem leak (#8) * set conn deadline * modify balance log level (#11) * Use github actions for test (#13) Co-authored-by: Yang Xiufeng --- .github/workflows/go.yml | 40 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 25 ------------------------- Makefile | 1 - README.md | 3 ++- dstore/bucket.go | 2 +- 5 files changed, 43 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/go.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..40f3895 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,40 @@ +on: [push, pull_request] +name: GoBeansProxy Test +jobs: + test: + strategy: + matrix: + go-version: [1.12.x, 1.13.x] + python-version: [2.x] + platform: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + + - name: Install Python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Checkout code + uses: actions/checkout@v1 + + - name: Get test tools + run: go get -u -v golang.org/x/tools/cmd/goimports + + - name: Prepare Test + run: pip install --user -r tests/pip-req.txt + + - name: Test + run: | + export PATH=${PATH}:`go env GOPATH`/bin + diff <(goimports -d .) <(printf "") + go mod vendor + go get -u -v github.com/douban/gobeansdb + make test + + - name: Install + run: make install diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 088d336..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: go - -os: - - linux - - osx - -go: - - "1.11.x" - - "1.12.x" - - "1.13.x" - -env: - - GO111MODULE=on - -before_install: - - pip install --user -r tests/pip-req.txt - -install: - - go get -u golang.org/x/tools/cmd/goimports - -script: - - diff <(goimports -d .) <(printf "") - - make install - - go get -u github.com/douban/gobeansdb - - make test diff --git a/Makefile b/Makefile index 4fb8891..95771e0 100644 --- a/Makefile +++ b/Makefile @@ -17,5 +17,4 @@ pytest:install ./tests/run_test.sh install: - GO111MODULE=on go mod vendor go install ./ diff --git a/README.md b/README.md index 813d5ec..8fb4dd3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GoBeansproxy [![Build Status](https://travis-ci.org/douban/gobeansproxy.svg?branch=master)](https://travis-ci.org/douban/gobeansproxy) +# GoBeansProxy ![](https://github.com/douban/gobeansproxy/workflows/GoBeansProxy%20Test/badge.svg) A proxy for [Gobeansdb](https://github.com/douban/gobeansdb). @@ -11,6 +11,7 @@ Supported Go version: > 1.11.0 ``` $ git clone http://github.com/douban/gobeansproxy.git $ cd gobeansproxy +$ go mod vendor $ make ``` diff --git a/dstore/bucket.go b/dstore/bucket.go index 2a9a7fe..2dd6330 100644 --- a/dstore/bucket.go +++ b/dstore/bucket.go @@ -104,7 +104,7 @@ func (bucket *Bucket) balance() { offsetOld = bucket.partition.offsets bucket.partition.reBalance(fromHost, toHost, 1) offsetNew = bucket.partition.offsets - logger.Errorf("bucket %d BALANCE: from host-%s-%d to host-%s-%d, make offsets %v to %v ", bucket.ID, bucket.hostsList[fromHost].host.Addr, fromHost, bucket.hostsList[toHost].host.Addr, toHost, offsetOld, offsetNew) + logger.Debugf("bucket %d BALANCE: from host-%s-%d to host-%s-%d, make offsets %v to %v ", bucket.ID, bucket.hostsList[fromHost].host.Addr, fromHost, bucket.hostsList[toHost].host.Addr, toHost, offsetOld, offsetNew) } }