Giter Site home page Giter Site logo

phpssdb's Introduction

phpssdb's People

Contributors

ixqbar avatar

Stargazers

 avatar  avatar Silas Ribas Martins avatar Panda avatar Torow avatar Shaowei Pu avatar  avatar aysenli avatar  avatar Roger Yang avatar  avatar  avatar Guodong Chen avatar  avatar  avatar sum avatar  avatar jesse avatar  avatar ForthXu avatar  avatar Z.X.PING avatar Wm Swaniawski avatar ruanxianhuo avatar Jack Li avatar  avatar 陈佳 avatar mickelfeng avatar  avatar  avatar  avatar wida avatar wxg avatar hackingangle avatar Chang Long Xu avatar  avatar  avatar bman avatar  avatar zhanglei avatar

Watchers

bman avatar James Cloos avatar  avatar wxg avatar mickelfeng avatar  avatar 疯魔慕薇 avatar Waichun Ho avatar  avatar  avatar

phpssdb's Issues

执行安装命令后的Error

现在执行命令
./configure --with-php-config=/usr/local/php/bin/php-config
make
出现问题
make: *** [ssdb_geo.lo] Error 1
不清楚什么情况,希望作者帮忙解答下,谢谢

countbit 函数是否没有兼容 2 个参数的情况?

重现代码:

<?php
$host = '127.0.0.1';
$port = 8888;
$ssdb = new SimpleSSDB($host, $port);
$ssdb->countbit('a', 0);

报错:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1366923971 bytes) in xxx/phpssdb/a.php on line 14

常驻内存的php程序

常驻内存的程序,一般connect放一个放那,如果执行的时候发现链接断开就会,重新在链接一次. 但是这个库并没有提供在执行命令的时候 到底是不是链接断开的提示.

出现 segmentation fault

代码大概如下:

$xx = array(
'abc',
'abc',
'abc',
'abc',
);

$data = $db->multi_hset('test', $xx);

测试环境
mac 10.10
PHP 5.5.20

[1] 77119 segmentation fault php kk.php

Cannot Install on PHP 5.x TS (Thead Safe)

Installing on PHP TS version always get error :

make && make install :
error /usr/include/php-zts/php/Zend/../TSRM/TSRM.h:167:18: error: 'tsrm_ls' undeclared (first use in this function).

hset返回值问题

hset一个不存在的key时成功返回true
hset一个存在的key时成功总返回false
到底要如何界定操作成功还是失败?

不支持php7

/Users/yuyi/Code/tools/phpssdb/ssdb_library.c:21:10: fatal error: 'ext/standard/php_smart_str.h' file not found
#include "ext/standard/php_smart_str.h"

php7 已经变成php_smart_string

PHP 7.0 build fail.

/bin/bash /opt/phpssdb/libtool --mode=compile cc -I. -I/opt/phpssdb -DPHP_ATOM_INC -I/opt/phpssdb/include -I/opt/phpssdb/main -I/opt/phpssdb -I/usr/local/swoole/include/php -I/usr/local/swoole/include/php/main -I/usr/local/swoole/include/php/TSRM -I/usr/local/swoole/include/php/Zend -I/usr/local/swoole/include/php/ext -I/usr/local/swoole/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /opt/phpssdb/ssdb_library.c -o ssdb_library.lo
cc -I. -I/opt/phpssdb -DPHP_ATOM_INC -I/opt/phpssdb/include -I/opt/phpssdb/main -I/opt/phpssdb -I/usr/local/swoole/include/php -I/usr/local/swoole/include/php/main -I/usr/local/swoole/include/php/TSRM -I/usr/local/swoole/include/php/Zend -I/usr/local/swoole/include/php/ext -I/usr/local/swoole/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /opt/phpssdb/ssdb_library.c -fPIC -DPIC -o .libs/ssdb_library.o
/opt/phpssdb/ssdb_library.c:21:40: fatal error: ext/standard/php_smart_str.h: 没有那个文件或目录
compilation terminated.
Makefile:193: recipe for target 'ssdb_library.lo' failed
make: *** [ssdb_library.lo] Error 1

hset如果key已存在,永远返回false

echo "hset" . PHP_EOL;
$result = $ssdb_handle->hset("blog_list", "1", "1");
var_dump($result);
$result = $ssdb_handle->hset("blog_list", "1", "2");
var_dump($result);

运行第一次
true
false

运行第二次
false
false

运行第三次
false
false

....

如题!

php7 multi_get Segmentation fault (core dumped)

Affected php versions (I've checked, maybe more): 7.0.4 , 7.0.5 , 7.0.6 (current)

$keys = array_map(function($key) { return md5('A') . md5($key); }, range(1, 20));
$ssdb = new SSDB ();
$ssdb->connect("127.0.0.1", 8888);
$ssdb->option(SSDB ::OPT_SERIALIZER, SSDB::SERIALIZER_PHP);

foreach ($keys as $key) {
   $ssdb->set($key, $key);
}
$result = $ssdb->multi_get($keys); // Segmentation fault (core dumped)
var_dump($result);

Bug fails only in case SSDB ::OPT_SERIALIZER is set to SSDB::SERIALIZER_PHP

Info command overrides keys in response

Here's a sample of $ssdb->info() output

$ssdb = new SSDB();
$ssdb->connect('127.0.0.1', 8888, 1);
var_dump($ssdb->info());
array(9) {
  ["version"]=>
  string(5) "1.9.3"
  ["links"]=>
  string(1) "2"
  ["total_calls"]=>
  string(2) "10"
  ["dbsize"]=>
  string(10) "1435004734"
  ["binlogs"]=>
  string(70) "    capacity : 20000000
    min_seq  : 4196359
    max_seq  : 11380832"
  ["replication"]=>
  string(183) "slaveof arbitr.internal:8888
    id         : arbitr
    type       : mirror
    status     : SYNC
    last_seq   : 4260722
    copy_count : 0
    sync_count : 0"
  ["serv_key_range"]=>
  string(71) "    kv  : "" - ""
    hash: "" - ""
    zset: "" - ""
    list: "" - """
  ["data_key_range"]=>
  string(137) "    kv  : "aa" - "zz"
    hash: "" - ""
    zset: "" - ""
    list: "" - """
  ["leveldb.stats"]=>
  string(298) "                               Compactions
Level  Files Size(MB) Time(sec) Read(MB) Write(MB)
--------------------------------------------------
  0        0        0         1        0        19
  1        7      155         6      150       150
  2       47     1451         0        0         0
"
}

But the real output of ./ssdb-cli contains multiple "replication" sections

version
    1.9.3
links
    1
total_calls
    8
dbsize
    1435004734
binlogs
        capacity : 20000000
        min_seq  : 4196359
        max_seq  : 11380832
replication
    client 172.30.1.1:49044
        type     : mirror
        status   : COPY
        last_seq : 11380832
replication
    client 172.30.1.2:55022
        type     : mirror
        status   : COPY
        last_seq : 11380832
replication
    client 172.30.1.3:55484
        type     : mirror
        status   : SYNC
        last_seq : 11380832
replication
    client 172.30.1.4:52716
        type     : mirror
        status   : SYNC
        last_seq : 11380832
replication
    slaveof node-0.ssdb.intenal:8888
        id         : node0
        type       : mirror
        status     : SYNC
        last_seq   : 12302239
        copy_count : 0
        sync_count : 0
replication
    slaveof node-1.ssdb.internal:8888
        id         : node1
        type       : mirror
        status     : INIT
        last_seq   : 3845251
        copy_count : 0
        sync_count : 0
replication
    slaveof node-2.ssdb.internal:8888
        id         : node2
        type       : mirror
        status     : SYNC
        last_seq   : 11380832
        copy_count : 0
        sync_count : 0
replication
    slaveof arbitr.internal:8888
        id         : arbitr
        type       : mirror
        status     : SYNC
        last_seq   : 4260722
        copy_count : 0
        sync_count : 0
serv_key_range
        kv  : "" - ""
        hash: "" - ""
        zset: "" - ""
        list: "" - ""
data_key_range
        kv  : "aa" - "zz"
        hash: "" - ""
        zset: "" - ""
        list: "" - ""
leveldb.stats
                                   Compactions
    Level  Files Size(MB) Time(sec) Read(MB) Write(MB)
    --------------------------------------------------
      0        0        0         1        0        19
      1        7      155         6      150       150
      2       47     1451         0        0         0

Bug in ssdb_map_response: https://github.com/jonnywang/phpssdb/blob/f2421da55dbfcf19fd0c1f89716820fd74b0c4c3/ssdb_library.c#L910
I suppose the best option will be duplicate ssdb_map_response function specially for info data. because this structure is unique.

hgetall truncates keys with binary values

Using hgetall will truncate values containing binary encoding presumably due to line break detection bug. When requesting using standard hget($key,'r') the bug does not occur.

$ssdb_simple = new SimpleSSDB('10.0.0.1',8888); // Native PHP class
$redis = new Redis();// Redis C extension
$ssdb = new SSDB();// phpssdb C extension
$ssdb->connect('10.0.0.1', 8888);
$redis->connect('10.0.0.1', 8888);
$response = $ssdb->hgetall($key);
print_r($response);

$response = $ssdb_simple->hgetall($key);
print_r($response);

$response = $redis->hgetall($key);
print_r($response);

Produces

Array
(
[r] => ??? alt2.gmail-smtp-in.l.google.com?!
[s] =>
)
Array
(
[r] => ??? alt2.gmail-smtp-in.l.google.com?!3~!4j!? z^1j=
[s] => A
)
Array
(
[r] => ??? alt2.gmail-smtp-in.l.google.com?!3~!4j!? z^1j=
[s] => A
)

php7.4 报错

/usr/local/src/phpssdb/ssdb_class.c: 在函数‘register_ssdb_class’中:
/usr/local/src/phpssdb/ssdb_class.c:3687:2: 错误:提供给函数‘zend_register_class_alias_ex’的实参太少
zend_register_class_alias_ex(ZEND_STRL("SimpleSSDB"), ssdb_ce TSRMLS_CC);
^
In file included from /usr/local/include/php/main/php.h:37:0,
from /usr/local/src/phpssdb/ssdb_class.c:19:
/usr/local/include/php/Zend/zend_API.h:287:14: 附注:在此声明
ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, int persistent);
^
make: *** [ssdb_class.lo] 错误 1

编译报错

/root/phpssdb/ssdb.c:42: error: ‘PHP_FE_END’ undeclared here (not in a function)
make: *** [ssdb.lo] Error 1

安装失败, 不知道缺少什么库

ssdb_library.c:93:3: error: use of undeclared identifier 'tsrm_ls' php_stream_close(ssdb_sock->stream);

nclude/php/main/php_streams.h:283:83: note: expanded from macro 'php_stream_close'

define php_stream_close(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE TSRMLS_CC)

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.