Skip to content

getMany empty records reference #7

Description

@spikobg

Hello there, I am trying to run the example code for getMany and I bump into a problem,
The reference seems to be null, altho I am quite confident I have such records inside aerospike (proof below)

[Mon Nov  2 08:09:55 2015] [hphp] [18495:7fbe5e3ff700:1:000001] [] \nNotice: Undefined variable: records in getmany.php on line 14
<?php
$config = array("hosts"=>array(array("addr"=>"xxx.xxx.xxx.xxx", "port"=>3000)));
$db = new Aerospike($config);
if (!$db->isConnected()) {
   echo "Aerospike failed to connect[{$db->errorno()}]: {$db->error()}\n";
   exit(1);
}

$key1 = $db->initKey("devspace", "mysql_cache", 1234);
$key2 = $db->initKey("devspace", "mysql_cache", 1235); // this key does not exist
$key3 = $db->initKey("devspace", "mysql_cache", 1236);
$keys = array($key1, $key2, $key3);
$status = $db->getMany($keys, $records);
if ($status == Aerospike::OK) {
    var_dump($records);
} else {
    echo "[{$db->errorno()}] ".$db->error();
}

As you guess the var dump result is NULL
In Aerospike, however data seems to be there (just to be double sure I have data in both string and int:

aql> select * from devspace.mysql_cache where PK = '1236'
+-------------------------------+
| data                          |
+-------------------------------+
| "t":42,"several":"success"}]" |
+-------------------------------+
1 row in set (0.000 secs)

aql> select * from devspace.mysql_cache where PK = 1236
+-------------------------------+
| data                          |
+-------------------------------+
| "t":42,"several":"success"}]" |
+-------------------------------+
1 row in set (0.001 secs)

aql> select * from devspace.mysql_cache where PK = 1234
+------------------------------------+-----+------------------------------------+
| data                               | SEG | CRC                                |
+------------------------------------+-----+------------------------------------+
| "[{"alpha":1,"beta":"gamma","spli" | 2   | "dc142fc150e11576cd39b467b77e1d22" |
+------------------------------------+-----+------------------------------------+
1 row in set (0.000 secs)

aql> select * from devspace.mysql_cache where PK = '1234'
+------------------------------------+-----+------------------------------------+
| data                               | SEG | CRC                                |
+------------------------------------+-----+------------------------------------+
| "[{"alpha":1,"beta":"gamma","spli" | 2   | "dc142fc150e11576cd39b467b77e1d22" |
+------------------------------------+-----+------------------------------------+
1 row in set (0.001 secs)

PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
HipHop VM 3.9.1 (rel)
Aerospike- C Client: 3.1.16
HHVM API version 20150212

So yes, I am wondering anyone actually manage to get getMany to work or is it a general issue?
Thanks!

UPDATE
We got as far as understanding that this ONLY happens when HHVM is being prebuilt/cached/pre-anaylized ( http://hhvm.com/blog/4061/go-faster )
Also, running files through CLI causes no problems, but when you try from web (through fastcgi) and u 're using the hhvm pre-analyze approach (compiled *.hhbc file) , result is always NULL. Interesting is taht this problem is not happening to other functions, but it does happen to multiple (batch) functions -- getMany and existMany.

Extension is being loaded through config file as README required.

Any tips are welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions