Coder Social home page Coder Social logo

yongman / tidis Goto Github PK

View Code? Open in Web Editor NEW
1.4K 55.0 139.0 6.83 MB

Distributed transactional NoSQL database, Redis protocol compatible using tikv as backend

Home Page: https://github.com/tidb-incubator/tidis

License: MIT License

Makefile 0.10% Go 83.05% Shell 0.02% Python 16.68% Dockerfile 0.15%
redis nosql database tikv 2pc raft distributed-nosql-database transaction-storage transaction rocksdb

tidis's People

Contributors

1995parham avatar aronfan avatar mythz avatar qhsong avatar stutiredboy avatar xmikus01 avatar yongman avatar zac-garby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tidis's Issues

del command bug

删除string 类型的key值时,不存在key的情况下也会返回1

can keys be stored in memory ?

I wander if keys can be stored in memory, and have 2 or 3 replicas across nodes.
i don't need data persistence, i don't have expensive ssd disk. i just need speed and survive one node crash.
if could, how ?

Build Error: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)

I am getting below error

make
go build -o bin/tidis-server cmd/server/*
# github.com/yongman/go/log
../../go/src/github.com/yongman/go/log/log.go:36:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:39:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:42:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:45:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:48:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:51:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
make: *** [build] Error 2

建议测试换成ssd

测试性能数据太难看了,建议用换成ssd,真实环境肯定会用ssd,这样能够提高产品认同度。

sort set withscores bug

当执行时

zrangebyscore dss 0 0 withscores limit 0 2999

返回空值,可是空值的返回码和redis的不一致
redis的为:
image
而tidis中为
image

Lazy delete ttl=0

懒删除没有生效,ttl=0时,在轮询删除没有轮询到时,还是可以查到值

172.16.1.32:0>set dssvalue1 dsada EX 1
"OK"

172.16.1.32:0>set dssvalue1 dsada EX 1
"OK"

172.16.1.32:0>ttl dssvalue1
"0"

172.16.1.32:0>get dssvalue1
"dsada"

sort set bug

sort set 在redis中的score值为浮点型,而在tidis中该值被限定为长整型

suggestion

to author :
Big God, this project is very niubility, hope you bring more test and enhancement, keep it stable and niubihonghong.
I will deploy your niubi program for production use in my future projects.
Hope you happy, wealthy and healthy.
thanks.

Question: Multi/exec transaction behavior

See the below example where I initiated a transaction with setting two hash values. First one successful and 2nd failed. I thought a transaction would roll back 1st operation because 2nd failed.
but that's not the case.

127.0.0.1:5379> multi
OK
127.0.0.1:5379> hsetnx key1 field3 val3
QUEUED
127.0.0.1:5379> hsetnx key1 field1 val2
QUEUED
127.0.0.1:5379> exec
1) (integer) 1
2) (integer) 0
127.0.0.1:5379> hget key1 field3
"val3"
127.0.0.1:5379>

大神求助

测试发现 为什么 tidis 服务运行一段时间会自动结束呢

Any documentation on transaction support

I have a use-case where two key-val should be inserted atomically (if not exist)and either insert fails should roll back. The 2nd key is a secondary index.

Key1= Hash1
Value1= Token1

Key2= Token1
Value2= json payload

How can I insert both atomically? Now if Key1 or Key2 (Token1) already exists, it should roll back the operation.

I see HmsetWithTxn but would like to see support for HmsetnxWithTxn which allows insertion of multiple keys if don't exist in a transaction.

[Proposal] Any plan to use RawKV apis?

TiKV provides atomic Get/Put/Scan/Delete APIs at RawAPI layer with a higher performance than Transactional API.
Maybe some scenarios people just want a high performance KV database with scan API (just like dynamoDB & HBase), using RawAPI in these scenarios seems a good idea.

Hello from TiKV

Hi @yongman

I am very glad to see this project, do you meet any problem? If yes, please tell me.
It is very appreciated that you can give me your Wechat or email, and we can have a deep discussion later.

Thank you!

ERRO[0005] [pd] create tso stream error: rpc error: code = Unavailable desc = grpc: the connection is unavailable

I created a TiDB cluster using docker-compose file as below. When I use tidis-server using one or more pd addresses, it gives below error. I tried replacing 127.0.0.1 with 0.0.0.0. I am able to connect using MySQL connect.

./bin/tidis-server -backend "127.0.0.1:32768,127.0.0.1:32769,127.0.0.1:32770"
\INFO[0000] server started
INFO[0000] [pd] create pd client with endpoints [127.0.0.1:32768 127.0.0.1:32769 127.0.0.1:32770]
INFO[0000] [pd] leader switches to: http://pd2:2379, previous:
INFO[0000] [pd] init cluster id 6574888069347456351
ERRO[0005] [pd] create tso stream error: rpc error: code = Unavailable desc = grpc: the connection is unavailable
FATA[0005] rpc error: code = Unavailable desc = grpc: the connection is unavailable
ERRO[0005] updateTS error: rpc error: code = Unavailable desc = grpc: the connection is unavailable

docket ps :

CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                               NAMES
3f118e56f9ec        pingcap/tispark:latest       "/opt/spark/sbin/sta…"   About an hour ago   Up About an hour    0.0.0.0:38081->38081/tcp                            tidb-docker-compose_tispark-slave0_1
dea5c36bcafe        pingcap/tispark:latest       "/opt/spark/sbin/sta…"   About an hour ago   Up About an hour    0.0.0.0:7077->7077/tcp, 0.0.0.0:8080->8080/tcp      tidb-docker-compose_tispark-master_1
e544f04fe431        pingcap/tidb:latest          "/tidb-server --stor…"   About an hour ago   Up About an hour    0.0.0.0:4000->4000/tcp, 0.0.0.0:10080->10080/tcp    tidb-docker-compose_tidb_1
2e7c32ebf66f        pingcap/tikv:latest          "/tikv-server --addr…"   About an hour ago   Up About an hour    20160/tcp                                           tidb-docker-compose_tikv2_1
0a5852beec59        pingcap/tikv:latest          "/tikv-server --addr…"   About an hour ago   Up About an hour    20160/tcp                                           tidb-docker-compose_tikv1_1
fe457ad77c3c        pingcap/tikv:latest          "/tikv-server --addr…"   About an hour ago   Up About an hour    20160/tcp                                           tidb-docker-compose_tikv0_1
f3f88f3b9ba3        pingcap/pd:latest            "/pd-server --name=p…"   About an hour ago   Up About an hour    2380/tcp, 0.0.0.0:32770->2379/tcp                   tidb-docker-compose_pd0_1
f766338f652c        pingcap/pd:latest            "/pd-server --name=p…"   About an hour ago   Up About an hour    2380/tcp, 0.0.0.0:32769->2379/tcp                   tidb-docker-compose_pd2_1
1f5203fedbf1        pingcap/pd:latest            "/pd-server --name=p…"   About an hour ago   Up About an hour    2380/tcp, 0.0.0.0:32768->2379/tcp                   tidb-docker-compose_pd1_1
572eb8f2ef2e        pingcap/tidb-vision:latest   "/bin/sh -c 'sed -i …"   About an hour ago   Up About an hour    80/tcp, 443/tcp, 2015/tcp, 0.0.0.0:8010->8010/tcp   tidb-docker-compose_tidb-vision_1

I am able to connect using MySQL client as below

mysql -h 127.0.0.1 -P 4000 -u root -D test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.10-TiDB-v2.1.0-beta-21-g73dc86c MySQL Community Server (Apache License 2.0)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

please grant me to pull request

I add setbit function (just for setbit command) for tidis, but cannot pull request to you.
please grant me to pull request.

runtest failed 4 test cases

`

FAIL: test_expire (test_string.StringTest)

Traceback (most recent call last):
File "/disk/ssd/tidis/tests/test_string.py", line 165, in test_expire
self.assertIsNone(self.r.get(self.k1))
AssertionError: 'value1' is not None

======================================================================
FAIL: test_expireat (test_string.StringTest)

Traceback (most recent call last):
File "/disk/ssd/tidis/tests/test_string.py", line 175, in test_expireat
self.assertIsNone(self.r.get(self.k1))
AssertionError: 'value1' is not None

======================================================================
FAIL: test_pexpire (test_string.StringTest)

Traceback (most recent call last):
File "/disk/ssd/tidis/tests/test_string.py", line 146, in test_pexpire
self.assertIsNone(self.r.get(self.k1))
AssertionError: 'value1' is not None

======================================================================
FAIL: test_pexpireat (test_string.StringTest)

Traceback (most recent call last):
File "/disk/ssd/tidis/tests/test_string.py", line 156, in test_pexpireat
self.assertIsNone(self.r.get(self.k1))
AssertionError: 'value1' is not None


Ran 82 tests in 137.529s

FAILED (failures=4)
`

Hi, I just built tidis from latest source, and ran the runtest script, however, got 4 test cases failed as above, what might be the reason? Could be due to pd/tikv? Thanks.

discard bug

discard命令在redis协议中,发送完成后并不会关闭连接,而在tidis中会关闭连接。这样的话在pipeline中无法做到取消事务操作。

Big key deletion failed if items changed all the time

Big list\set\zset\hash keys deletion will be last for a few second, if some changed to this big key during the deletion, delete operation will commit failed because of transaction conflict.

So some meta control mechanism must be added to avoid this scenario.

Build Error: cannot find package

Hi,
I am trying to build tidis with the make command. I get the following error. Can you give me some help?

CGO_ENABLED=0 go build -o bin/tidis-server cmd/server/*
cmd/server/main.go:16:2: cannot find package "github.com/yongman/go/log" in any of:
/usr/local/Cellar/go/1.11.2/libexec/src/github.com/yongman/go/log (from $GOROOT)
/Users/lei.gu/go/src/github.com/yongman/go/log (from $GOPATH)
cmd/server/main.go:17:2: cannot find package "github.com/yongman/tidis/config" in any of:
/usr/local/Cellar/go/1.11.2/libexec/src/github.com/yongman/tidis/config (from $GOROOT)
/Users/lei.gu/go/src/github.com/yongman/tidis/config (from $GOPATH)
cmd/server/main.go:18:2: cannot find package "github.com/yongman/tidis/server" in any of:
/usr/local/Cellar/go/1.11.2/libexec/src/github.com/yongman/tidis/server (from $GOROOT)
/Users/lei.gu/go/src/github.com/yongman/tidis/server (from $GOPATH)
make: *** [build] Error 1

I saw three imports in cmd/server/main.go
"github.com/yongman/go/log"
"github.com/yongman/tidis/config"
"github.com/yongman/tidis/server"

where can I find these three dependencies?

panic: interface conversion: interface {} is nil, not int

WARN[0810] ttl checker hashkey failed, [tikv:9001]PD server timeout[try again later]
WARN[0810] BatchInTxn execute failed
panic: interface conversion: interface {} is nil, not int

goroutine 135 [running]:
github.com/yongman/tidis/tidis.(*ttlChecker).Run(0xc42015c4c0)
	/Users/xxxx/projects/go/src/github.com/yongman/tidis/tidis/ttl.go:169 +0x1350
created by github.com/yongman/tidis/server.(*App).Run
	/Users/xxxx/projects/go/src/github.com/yongman/tidis/server/app.go:83 +0x197

CPU 占用太高

我开了2个tikv 节点。
在set了1000个key之后客户端就退出了。 每个key的过期时间是10秒。
然后其中一个节点上的tikv-server CPU占用 >80%,长时间居高不下,另一个节点tikv-server 几乎不耗CPU。

哪里出问题了?

tikv client connect

如何配置tidis请求tikv的grpc 连接数,暂时发现tidis无法把cpu吃满,压测效果不佳

Does tidis support pipeline operation?

Hi,
I want to know whether tidis support pipeline operation?

I use the following command and encountered the problem.

cat redis_command_zset_310100.log | redis-cli -h 10.125.233.215 -p 5379 --pipe
Error reading from the server: Connection reset by peer

hi, what's problem of this sence

$ ./tidis-server -backend :32768
INFO[0000] server started                               
INFO[0000] [pd] create pd client with endpoints [:32768] 
INFO[0000] [pd] leader switches to: http://pd1:2379, previous:  
INFO[0000] [pd] init cluster id 6537956209576529350     
ERRO[0000] [pd] create tso stream error: rpc error: code = Unavailable desc = grpc: the connection is unavailable 
FATA[0000] rpc error: code = Unavailable desc = grpc: the connection is unavailable 

HdelWithTxn: panic: interface conversion: interface {} is nil, not uint64

127.0.0.1:5379> hdel hash2 token3
Error: Connection reset by peer
panic: interface conversion: interface {} is nil, not uint64

goroutine 259 [running]:
github.com/yongman/tidis/tidis.(*Tidis).HdelWithTxn(0xc4200a2a80, 0x1880160, 0xc420466b00, 0xc4200c0b60, 0x5, 0x5, 0xc4208bdb60, 0x1, 0x1, 0x1689134, ...)
	/Users/user/projects/go/src/github.com/yongman/tidis/tidis/t_hash.go:205 +0x2e8
github.com/yongman/tidis/tidis.(*Tidis).Hdel.func1(0x1880160, 0xc420466b00, 0xc420466b00, 0x0, 0x0, 0x1819d20)
	/Users/user/projects/go/src/github.com/yongman/tidis/tidis/t_hash.go:124 +0x81
github.com/yongman/tidis/store/tikv.(*Tikv).BatchInTxn(0xc4201a03a0, 0xc420401580, 0x18f3eb0, 0xc420991cb0, 0xc4207e4000, 0xc420991ca0)
	/Users/user/projects/go/src/github.com/yongman/tidis/store/tikv/tikv.go:536 +0xcf
github.com/yongman/tidis/tidis.(*Tidis).Hdel(0xc4200a2a80, 0xc4200c0b60, 0x5, 0x5, 0xc4208bdb60, 0x1, 0x1, 0x10, 0x1, 0xc420344768)
	/Users/user/projects/go/src/github.com/yongman/tidis/tidis/t_hash.go:128 +0xcc
github.com/yongman/tidis/server.hdelCommand(0xc4201a2c60, 0xc42028fb00, 0xc4200c0b6c)
	/Users/user/projects/go/src/github.com/yongman/tidis/server/command_hash.go:119 +0x193
github.com/yongman/tidis/server.(*Client).execute(0xc4201a2c60, 0x4, 0x18a712f)
	/Users/user/projects/go/src/github.com/yongman/tidis/server/client.go:350 +0x1fd
github.com/yongman/tidis/server.(*Client).handleRequest(0xc4201a2c60, 0xc4208bdb30, 0x3, 0x3, 0x0, 0x0)
	/Users/user/projects/go/src/github.com/yongman/tidis/server/client.go:335 +0x5a0
github.com/yongman/tidis/server.(*Client).connHandler(0xc4201a2c60)
	/Users/user/projects/go/src/github.com/yongman/tidis/server/client.go:211 +0x190
created by github.com/yongman/tidis/server.ClientHandler
	/Users/user/projects/go/src/github.com/yongman/tidis/server/client.go:86 +0x254

zrangebyscore bug

当limit值为-1时会抛错

172.16.1.32:0>zrangebyscore dss 0 100 LIMIT 0 -1
Connection error:Execution timeout

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.