Skip to content

Commit

Permalink
Merge master (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
ariesdevil authored May 26, 2020
1 parent 83bff37 commit 777a859
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 60 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on: [push, pull_request]
name: GoBeansDB Test
jobs:
test:
strategy:
matrix:
compiler: [gcc]
go-version: [1.12.x, 1.13.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: Checkout code
uses: actions/checkout@v1

- name: Get test tools
run: go get -u -v golang.org/x/tools/cmd/goimports

- name: Test
env:
CC: ${{ matrix.compiler }}
run: |
export PATH=${PATH}:`go env GOPATH`/bin
diff <(goimports -d .) <(printf "")
go mod vendor
make test
- name: Install
run: make install
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ pytest:install
./tests/run_test.sh

install:
GO111MODULE=on go mod vendor
go install ./
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# GoBeansDB [![Build Status](https://travis-ci.org/douban/gobeansdb.svg?branch=master)](https://travis-ci.org/douban/gobeansdb) [![Release](https://img.shields.io/github/v/release/douban/gobeansdb)](https://github.com/douban/gobeansdb/releases)

# GoBeansDB ![](https://github.com/douban/gobeansdb/workflows/GoBeansDB%20Test/badge.svg) [![Release](https://img.shields.io/github/v/release/douban/gobeansdb)](https://github.com/douban/gobeansdb/releases)

Yet anonther distributed key-value storage system from Douban Inc.

Expand All @@ -20,6 +21,7 @@ GoBeansDB use `go mod` manage dependencies, please make sure your Go version >=
```shell
$ git clone http://github.com/douban/gobeansdb.git
$ cd gobeansdb
$ go mod vendor
$ make
```

Expand Down Expand Up @@ -98,7 +100,7 @@ mc_client --- cache
缺点/注意

1. 一致性支持较弱,时间戳目前是秒级(受限于数据文件格式)。
2. 全内存索引,有一定内存开销,在启动载入索引略慢(约十几秒到半分钟, 决定于key 数量)。
2. 全内存索引,有一定内存开销,在启动时载入索引略慢(约十几秒到半分钟, 决定于key 数量)。
3. 数据文件格式的 padding 对小 value 有一定浪费。


Expand Down
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module github.com/douban/gobeansdb

require (
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72
golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e // indirect
gopkg.in/yaml.v2 v2.2.1
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da
github.com/spaolacci/murmur3 v1.1.0
gopkg.in/yaml.v2 v2.2.7
)

go 1.13
20 changes: 6 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec h1:6ncX5ko6B9LntYM0YBRXkiSaZMmLYeZ/NWcmeB43mMY=
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e h1:1o2bDs9pCd2xFhdwqJTrCIswAeEsn4h/PCNelWpfcsI=
golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da h1:p3Vo3i64TCLY7gIfzeQaUJ+kppEO5WQG3cL8iE8tGHU=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
8 changes: 4 additions & 4 deletions loghub/analysislog.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ type AnalysisLogHub struct {
}

func init() {
logger := openLogWithFd(os.Stderr, AnalysisLogFlag)
hub := &AnalysisLogHub{logger: logger}
hub.InitBuffer(200)
AnalysisLogger = NewLogger("", hub, DEBUG)
//logger := openLogWithFd(os.Stderr, AnalysisLogFlag)
//hub := &AnalysisLogHub{logger: logger}
//hub.InitBuffer(200)
AnalysisLogger = NewLogger("", nil, DEBUG)
}

func InitAnalysisLog(path string, level int, bufferSize int) (err error) {
Expand Down
4 changes: 2 additions & 2 deletions memcache/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,13 @@ func (s *Server) HandleSignals(errorlog string, accesslog string, analysislog st
// logger.Hub is always inited, so we call Reopen without check it.
logger.Hub.Reopen(errorlog)

if accessLogger.Hub != nil {
if accessLogger != nil && accessLogger.Hub != nil {
if err := accessLogger.Hub.Reopen(accesslog); err != nil {
logger.Warnf("open %s failed: %s", accesslog, err.Error())
}
}

if analysisLogger.Hub != nil {
if analysisLogger != nil && analysisLogger.Hub != nil {
if err := analysisLogger.Hub.Reopen(analysislog); err != nil {
logger.Warnf("open %s failed: %s", analysislog, err.Error())
}
Expand Down
8 changes: 5 additions & 3 deletions store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,11 @@ func (bkt *Bucket) get(ki *KeyInfo, memOnly bool) (payload *Payload, pos Positio
} else if bytes.Compare(rec.Key, ki.Key) == 0 {
payload = rec.Payload
payload.Ver = meta.Ver
analysisLogger.Infof("%s %d %f BKT_%02x %d %d %d %v %s",
config.AnalysisLogVersion, rec.Payload.TS, getRecordTimeCost, bkt.ID,
pos.ChunkID, pos.Offset, rec.Payload.RecSize, inbuffer, ki.StringKey)
if analysisLogger != nil && analysisLogger.Hub != nil {
analysisLogger.Infof("%s %d %f BKT_%02x %d %d %d %v %s",
config.AnalysisLogVersion, rec.Payload.TS, getRecordTimeCost, bkt.ID,
pos.ChunkID, pos.Offset, rec.Payload.RecSize, inbuffer, ki.StringKey)
}
return
}
defer func() {
Expand Down

0 comments on commit 777a859

Please sign in to comment.