Search code examples
phpaerospike

PHP get() and scan() methods for the aerospike driver won't return the full record


I've put some data in Aerospike, I can query it trough AQL or the C# driver without a problem. But when I try it trough the PHP driver I don't get the full record returned. I've observed the problem during a scan() method, after that I tried it with the get() method with the same result.

Here is the code part with the get() method:

$config = ["hosts" => [["addr" => "192.168.x.x", "port" => 3000]]];
$db = new Aerospike($config);
if (!$db->isConnected()) 
{
  echo "Failed to connect to the Aerospike server [{$db->errorno()}]: {$db->error()}\n";
  exit(1);
}

$key = $db->initKey("company", "Company", 2456223);
$status = $db->get($key, $record);
echo "key->".$key['key']."\r\n";
print_r($record['bins']['address']);

the output is the following:

key->2456223
Array
(
    [zip] => 12345
    [locality] => mytown
)

and the AQL output:

aql> select address from company.Company where pk=2456223
[
  {
    "address": {
      "zip": "12345",
      "locality": "mytown",
      "hidden": "00 01 00 00 00 FF FF FF FF 01 00 00 00 00 00 00 00 04 01 00 00 00 0E 53 79 73 74 65 6D 2E 42 6F 6F 6C 65 61 6E 01 00 00 00 07 6D 5F 76 61 6C 75 65 00 01 00 0B",
      "geoID": 1234,
      "streetAddress": "mystreet 4",
      "region": "here",
      "streetId": 5678
    }
  }
]

Any ideas what am I doing wrong?


Solution

  • Seems php is having some issue dealing with the c# blob type. Looks like the parsing/printing of the map is aborting midway. As the blob is written by c#, seems it is able to handle it well. But PHP seem to have issues with it.