Git Product home page Git Product logo

php-client's Introduction

PHP version

Aerospike PHP 8+ Client (v1.0.0)

An Aerospike client library for PHP 8+.

PHP-Client Introduction

This is the documentation for the Aerospike PHP Client. The PHP client comprises of two essential components. Firstly, we have a robust PHP client written in Rust and a connection manager written in Go, serving as a shared resource among PHP processes. The connection manager daemon efficiently handles all requests and responses between the PHP processes and the Aerospike server.

Requirements

Setup

  • Clone the PHP-Client repository
cd php-client

Setting up the Aerospike client connection manager:

Installing up the dependencies and Running the Aerospike Connection manager

  1. Make sure the go toolchain has been installed. Download the package from The Go Programming Language. Follow the steps to correctly install Go. NOTE: Ensure that the PATH variable has been updated with the GOBIN path.
  2. Install protobuf compiler:
   go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
  1. Change directory into php-client/aerospike-connection-manager
cd php-client/aerospike-connection-manager 
  1. Build and run the aerospike-connection-manager
sudo make

NOTE: Please view the README.md in the php-client/aerospike-connection-manager directory for more information about the setting up the aerospike-connection-manager and configuring the client policy.

Build and Install the PHP-Client

  • Check the php version
php -v
  • Install and setup the Aerospike Aerospike server
  • To build and install the PHP-Client in the default paths run the makefile
cd php-client
sudo make
  • To build and install the PHP-Client in manually, run the following commands:
cd php-client
cargo clean && cargo build --release
  • Once the build is successful copy the file from target/release/libaerospike$(EXTENSION) [$EXTENSION = .so for Linux and .dylib for Mac and Windows] to the PHP extension directory path.
  • Add extension=libaerospike$(EXTENSION) to your php.ini file.
  • Run phpunit tests/ to ensure the setup and build was successful.

NOTE: The Aerospike server must be running for the tests to run successfully.

Running your PHP Project

  1. Running your PHP script:
  • Before running your script pre-requisites are Aerospike connection manager and Aerospike Server must be running.
  • Once the build is successful and all the pre-requisites are met, import the Aerospike namespace to your PHP script.
  • To connect to the Aerospike connection manager add:
	$socket = "/tmp/asld_grpc.sock";
	$client = Client::connect($socket); 
  • Run the php script If there are no Errors then you have successfully connected to the Aerospike DB.

NOTE: If the connection manager daemon crashes, you will have to manually remove the file /tmp/asld_grpc.sock from its path.

sudo rm -r /tmp/asld_grpc.soc
  • Configuring policies: Configuring Policies (Read, Write, Batch and Info) - These policies can be set via getters and setter in the php code. On creating an object of that policy class, the default values are initialized for that policy. For example:
	// Instantiate the WritePolicy object
	$writePolicy = new WritePolicy();

	$writePolicy->setRecordExistsAction(RecordExistsAction::Update);
	$writePolicy->setGenerationPolicy(GenerationPolicy::ExpectGenEqual);
	$writePolicy->setExpiration(Expiration::seconds(3600)); // Expiring in 1 hour
	$writePolicy->setMaxRetries(3);
	$writePolicy->setSocketTimeout(5000);

Documentation

Issues

If there are any bugs, feature requests or feedback -> please create an issue on GitHub. Issues will be regularly reviewed by the Aerospike Client Engineering Team.

Usage

The following is a very simple example of CRUD operations in an Aerospike database.

<?php
namespace Aerospike;

try{
  $socket = "/tmp/asld_grpc.sock";
  $client = Client::connect($socket);
  var_dump($client->socket);
}catch(AerospikeException $e){
  var_dump($e);
}


$key = new Key("namespace", "set_name", 1);

//PUT on differnet types of values
$wp = new WritePolicy();
$bin1 = new Bin("bin1", 111);
$bin2 = new Bin("bin2", "string");
$bin3 = new Bin("bin3", 333.333);
$bin4 = new Bin("bin4", [
	"str", 
	1984, 
	333.333, 
	[1, "string", 5.1], 
	[
		"integer" => 1984, 
		"float" => 333.333, 
		"list" => [1, "string", 5.1]
	] 
]);

$bin5 = new Bin("bin5", [
	"integer" => 1984, 
	"float" => 333.333, 
	"list" => [1, "string", 5.1], 
	null => [
		"integer" => 1984, 
		"float" => 333.333, 
		"list" => [1, "string", 5.1]
	],
	"" => [ 1, 2, 3 ],
]);

$client->put($wp, $key, [$bin1, $bin2, $bin3, $bin4, $bin5]);

//GET
$rp = new ReadPolicy();
$record = $client->get($rp, $key);
var_dump($record->bins);

//UPDATE
$client->prepend($wp, $key, [new Bin("bin2", "prefix_")]);
$client->append($wp, $key, [new Bin("bin2", "_suffix")]);

//DELETE
$deleted = $client->delete($wp, $key);
var_dump($deleted);

$client->close()

Batch Operations Examples:

<?php

namespace Aerospike;

$namespace = "test";
$set = "test";
$socket = "/tmp/asld_grpc.sock";

$client = Client::connect($socket);
echo "* Connected to the local daemon: $client->hosts \n";

$key = new Key($namespace, $set, 1);

$wp = new WritePolicy();
$client->put($wp, $key, [new Bin("bini", 1), new Bin("bins", "b"), new Bin("bin1", [1, 2, 3, 4])]);

$bwp = new BatchWritePolicy();
$exp = Expression::lt(Expression::intBin("bin1"), Expression::intVal(1));
$batchWritePolicy->setFilterExpression($exp);
$ops = [Operation::put(new Bin("put_op", "put_val"))];
$bw = new BatchWrite($bwp, $key, $ops);

$brp = new BatchReadPolicy();
$br = new BatchRead($brp, $key, []);

$bdp = new BatchDeletePolicy();
$bd = new BatchDelete($bdp, $key);

$bp = new BatchPolicy();
$recs = $client->batch($bp, [$bw, $br, $bd]);
var_dump($recs);

For more detailed examples you can see the examples direcotry php-client/examples

php-client's People

Contributors

abide-security avatar khaf avatar mcoberly2 avatar thias avatar vmsachin avatar

Stargazers

 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

Forkers

thias fbriois

php-client's Issues

Can not delete a key after upgrading to version 1.0

Hi,

I just updated from v0.4.0-alpha to version 1.0. I tried to run my previous test but I got an error "attempt to use an Enterprise feature on a Community server or a server without the applicable feature key". It turns out that that exception is thrown if I call delete method. I tried with examples you provided - and I can confirm it that it is not working and I am getting that error. I am using this image as server aerospike/aerospike-server:6.3.0.16_1. In the example you provided you are also using method close on client and that method is removed with latest update.

I managed to make it work upgrading my docker setup - but I needed some time. It would be nice if you provide these instructions as well.

Thanks,
Milan

Aerospike client 3 time slower than legacy client

Hi,

When I run a benchmark, it appears the php-client is more than 3 time slower than the legacy client.

I am using php8.2 with php-client v1.0.2 and on other hand php7.3 with the legacy client https://github.com/aerospike-community/aerospike-client-php.

Clients and server are also in the same server and I use this unmodified configuration for the connection manager: https://github.com/aerospike/php-client/blob/main/aerospike-connection-manager/asld.toml

I use the same configuration between both php, so the main difference is the php version, the aerospike client and the connector (which is written in Rust vs C, I presume).

Here you can find a benchmark result (based from https://github.com/aerospike/php-client/tree/main/benchmark):

$ ./vendor/bin/phpbench run benchmark/ --report=default

PHPBench (1.2.15) running benchmarks... #standwithukraine
with configuration file: /home/ubuntu/php-client/phpbench.json
with PHP version 8.2.18, xdebug ❌, opcache ✔

\Aerospike\AerospikeBenchmark

    benchGetString1.........................I4 - Mo862.710μs (±9.69%)
    benchGetString10........................I4 - Mo752.187μs (±8.31%)
    benchGetString100.......................I4 - Mo723.415μs (±15.13%)
    benchGetString1000......................I4 - Mo572.461μs (±8.73%)
    benchGetString10000.....................I4 - Mo582.190μs (±15.57%)
    benchGetInteger32.......................I4 - Mo611.328μs (±13.72%)
    benchGetInteger64.......................I4 - Mo607.967μs (±16.52%)
    benchPutBins............................I4 - Mo1.559ms (±8.24%)
    benchPutInt64...........................I4 - Mo657.701μs (±11.34%)
    benchPutString1.........................I4 - Mo672.597μs (±12.83%)
    benchPutString10........................I4 - Mo627.837μs (±10.70%)
    benchPutString100.......................I4 - Mo673.821μs (±23.65%)
    benchPutString1000......................I4 - Mo767.200μs (±15.60%)
    benchPutString10000.....................I4 - Mo882.097μs (±14.35%)
    benchPutString100000....................I4 - Mo1.967ms (±7.51%)

Subjects: 15, Assertions: 0, Failures: 0, Errors: 0

+------+--------------------+----------------------+-----+-------+-------------+-------------+--------------+----------------+
| iter | benchmark          | subject              | set | revs  | mem_peak    | time_avg    | comp_z_value | comp_deviation |
+------+--------------------+----------------------+-----+-------+-------------+-------------+--------------+----------------+
| 0    | AerospikeBenchmark | benchGetString1      |     | 10000 | 1,572,256b  | 888.811μs   | -0.28σ       | -2.66%         |
| 1    | AerospikeBenchmark | benchGetString1      |     | 10000 | 1,572,256b  | 981.865μs   | +0.78σ       | +7.53%         |
| 2    | AerospikeBenchmark | benchGetString1      |     | 10000 | 1,572,256b  | 807.754μs   | -1.19σ       | -11.54%        |
| 3    | AerospikeBenchmark | benchGetString1      |     | 10000 | 1,572,256b  | 841.558μs   | -0.81σ       | -7.84%         |
| 4    | AerospikeBenchmark | benchGetString1      |     | 10000 | 1,572,256b  | 1,045.741μs | +1.50σ       | +14.52%        |
| 0    | AerospikeBenchmark | benchGetString10     |     | 10000 | 1,572,816b  | 767.065μs   | -0.25σ       | -2.07%         |
| 1    | AerospikeBenchmark | benchGetString10     |     | 10000 | 1,572,816b  | 803.641μs   | +0.31σ       | +2.60%         |
| 2    | AerospikeBenchmark | benchGetString10     |     | 10000 | 1,572,816b  | 722.532μs   | -0.93σ       | -7.75%         |
| 3    | AerospikeBenchmark | benchGetString10     |     | 10000 | 1,572,816b  | 898.738μs   | +1.77σ       | +14.74%        |
| 4    | AerospikeBenchmark | benchGetString10     |     | 10000 | 1,572,816b  | 724.344μs   | -0.91σ       | -7.52%         |
| 0    | AerospikeBenchmark | benchGetString100    |     | 10000 | 1,572,816b  | 766.442μs   | +0.40σ       | +6.07%         |
| 1    | AerospikeBenchmark | benchGetString100    |     | 10000 | 1,572,816b  | 719.840μs   | -0.03σ       | -0.38%         |
| 2    | AerospikeBenchmark | benchGetString100    |     | 10000 | 1,572,816b  | 683.218μs   | -0.36σ       | -5.45%         |
| 3    | AerospikeBenchmark | benchGetString100    |     | 10000 | 1,572,816b  | 889.547μs   | +1.53σ       | +23.10%        |
| 4    | AerospikeBenchmark | benchGetString100    |     | 10000 | 1,572,816b  | 553.999μs   | -1.54σ       | -23.33%        |
| 0    | AerospikeBenchmark | benchGetString1000   |     | 10000 | 1,572,816b  | 565.938μs   | -0.82σ       | -7.13%         |
| 1    | AerospikeBenchmark | benchGetString1000   |     | 10000 | 1,572,816b  | 556.251μs   | -1.00σ       | -8.72%         |
| 2    | AerospikeBenchmark | benchGetString1000   |     | 10000 | 1,572,816b  | 658.085μs   | +0.92σ       | +7.99%         |
| 3    | AerospikeBenchmark | benchGetString1000   |     | 10000 | 1,572,816b  | 687.733μs   | +1.47σ       | +12.85%        |
| 4    | AerospikeBenchmark | benchGetString1000   |     | 10000 | 1,572,816b  | 578.972μs   | -0.57σ       | -4.99%         |
| 0    | AerospikeBenchmark | benchGetString10000  |     | 10000 | 1,572,816b  | 581.950μs   | -0.49σ       | -7.71%         |
| 1    | AerospikeBenchmark | benchGetString10000  |     | 10000 | 1,572,816b  | 570.012μs   | -0.62σ       | -9.60%         |
| 2    | AerospikeBenchmark | benchGetString10000  |     | 10000 | 1,572,816b  | 614.925μs   | -0.16σ       | -2.48%         |
| 3    | AerospikeBenchmark | benchGetString10000  |     | 10000 | 1,572,816b  | 823.551μs   | +1.97σ       | +30.61%        |
| 4    | AerospikeBenchmark | benchGetString10000  |     | 10000 | 1,572,816b  | 562.247μs   | -0.70σ       | -10.83%        |
| 0    | AerospikeBenchmark | benchGetInteger32    |     | 10000 | 1,572,816b  | 606.482μs   | -0.54σ       | -7.42%         |
| 1    | AerospikeBenchmark | benchGetInteger32    |     | 10000 | 1,572,816b  | 588.429μs   | -0.74σ       | -10.17%        |
| 2    | AerospikeBenchmark | benchGetInteger32    |     | 10000 | 1,572,816b  | 636.399μs   | -0.21σ       | -2.85%         |
| 3    | AerospikeBenchmark | benchGetInteger32    |     | 10000 | 1,572,816b  | 832.208μs   | +1.97σ       | +27.04%        |
| 4    | AerospikeBenchmark | benchGetInteger32    |     | 10000 | 1,572,816b  | 611.879μs   | -0.48σ       | -6.59%         |
| 0    | AerospikeBenchmark | benchGetInteger64    |     | 10000 | 1,572,816b  | 605.118μs   | -0.53σ       | -8.75%         |
| 1    | AerospikeBenchmark | benchGetInteger64    |     | 10000 | 1,572,816b  | 595.550μs   | -0.62σ       | -10.20%        |
| 2    | AerospikeBenchmark | benchGetInteger64    |     | 10000 | 1,572,816b  | 690.887μs   | +0.25σ       | +4.18%         |
| 3    | AerospikeBenchmark | benchGetInteger64    |     | 10000 | 1,572,816b  | 864.656μs   | +1.84σ       | +30.38%        |
| 4    | AerospikeBenchmark | benchGetInteger64    |     | 10000 | 1,572,816b  | 559.615μs   | -0.95σ       | -15.61%        |
| 0    | AerospikeBenchmark | benchPutBins         |     | 10000 | 18,402,376b | 1,385.265μs | -1.47σ       | -12.15%        |
| 1    | AerospikeBenchmark | benchPutBins         |     | 10000 | 18,402,376b | 1,709.142μs | +1.02σ       | +8.39%         |
| 2    | AerospikeBenchmark | benchPutBins         |     | 10000 | 18,402,376b | 1,504.803μs | -0.55σ       | -4.57%         |
| 3    | AerospikeBenchmark | benchPutBins         |     | 10000 | 18,402,376b | 1,733.074μs | +1.20σ       | +9.90%         |
| 4    | AerospikeBenchmark | benchPutBins         |     | 10000 | 18,402,376b | 1,552.211μs | -0.19σ       | -1.57%         |
| 0    | AerospikeBenchmark | benchPutInt64        |     | 10000 | 18,367,256b | 696.816μs   | +0.04σ       | +0.51%         |
| 1    | AerospikeBenchmark | benchPutInt64        |     | 10000 | 18,367,256b | 613.566μs   | -1.01σ       | -11.50%        |
| 2    | AerospikeBenchmark | benchPutInt64        |     | 10000 | 18,367,256b | 841.371μs   | +1.88σ       | +21.36%        |
| 3    | AerospikeBenchmark | benchPutInt64        |     | 10000 | 18,367,256b | 656.512μs   | -0.47σ       | -5.30%         |
| 4    | AerospikeBenchmark | benchPutInt64        |     | 10000 | 18,367,256b | 658.174μs   | -0.45σ       | -5.06%         |
| 0    | AerospikeBenchmark | benchPutString1      |     | 10000 | 18,367,296b | 626.856μs   | -0.98σ       | -12.62%        |
| 1    | AerospikeBenchmark | benchPutString1      |     | 10000 | 18,367,296b | 658.842μs   | -0.64σ       | -8.16%         |
| 2    | AerospikeBenchmark | benchPutString1      |     | 10000 | 18,367,296b | 886.561μs   | +1.84σ       | +23.59%        |
| 3    | AerospikeBenchmark | benchPutString1      |     | 10000 | 18,367,296b | 738.296μs   | +0.23σ       | +2.92%         |
| 4    | AerospikeBenchmark | benchPutString1      |     | 10000 | 18,367,296b | 676.230μs   | -0.45σ       | -5.73%         |
| 0    | AerospikeBenchmark | benchPutString10     |     | 10000 | 18,367,352b | 627.949μs   | -0.70σ       | -7.50%         |
| 1    | AerospikeBenchmark | benchPutString10     |     | 10000 | 18,367,352b | 617.066μs   | -0.85σ       | -9.10%         |
| 2    | AerospikeBenchmark | benchPutString10     |     | 10000 | 18,367,352b | 789.066μs   | +1.52σ       | +16.23%        |
| 3    | AerospikeBenchmark | benchPutString10     |     | 10000 | 18,367,352b | 742.627μs   | +0.88σ       | +9.39%         |
| 4    | AerospikeBenchmark | benchPutString10     |     | 10000 | 18,367,352b | 617.633μs   | -0.84σ       | -9.02%         |
| 0    | AerospikeBenchmark | benchPutString100    |     | 10000 | 18,367,464b | 669.673μs   | -0.53σ       | -12.45%        |
| 1    | AerospikeBenchmark | benchPutString100    |     | 10000 | 18,367,464b | 618.623μs   | -0.81σ       | -19.13%        |
| 2    | AerospikeBenchmark | benchPutString100    |     | 10000 | 18,367,464b | 1,104.944μs | +1.88σ       | +44.45%        |
| 3    | AerospikeBenchmark | benchPutString100    |     | 10000 | 18,367,464b | 795.396μs   | +0.17σ       | +3.98%         |
| 4    | AerospikeBenchmark | benchPutString100    |     | 10000 | 18,367,464b | 636.082μs   | -0.71σ       | -16.85%        |
| 0    | AerospikeBenchmark | benchPutString1000   |     | 10000 | 18,368,584b | 680.349μs   | -0.88σ       | -13.73%        |
| 1    | AerospikeBenchmark | benchPutString1000   |     | 10000 | 18,368,584b | 633.816μs   | -1.26σ       | -19.63%        |
| 2    | AerospikeBenchmark | benchPutString1000   |     | 10000 | 18,368,584b | 979.801μs   | +1.55σ       | +24.24%        |
| 3    | AerospikeBenchmark | benchPutString1000   |     | 10000 | 18,368,584b | 845.254μs   | +0.46σ       | +7.18%         |
| 4    | AerospikeBenchmark | benchPutString1000   |     | 10000 | 18,368,584b | 804.099μs   | +0.13σ       | +1.96%         |
| 0    | AerospikeBenchmark | benchPutString10000  |     | 10000 | 18,379,592b | 923.073μs   | -0.16σ       | -2.31%         |
| 1    | AerospikeBenchmark | benchPutString10000  |     | 10000 | 18,379,592b | 1,206.134μs | +1.93σ       | +27.65%        |
| 2    | AerospikeBenchmark | benchPutString10000  |     | 10000 | 18,379,592b | 821.057μs   | -0.91σ       | -13.11%        |
| 3    | AerospikeBenchmark | benchPutString10000  |     | 10000 | 18,379,592b | 863.174μs   | -0.60σ       | -8.65%         |
| 4    | AerospikeBenchmark | benchPutString10000  |     | 10000 | 18,379,592b | 911.098μs   | -0.25σ       | -3.58%         |
| 0    | AerospikeBenchmark | benchPutString100000 |     | 10000 | 18,469,704b | 1,977.155μs | +0.81σ       | +6.07%         |
| 1    | AerospikeBenchmark | benchPutString100000 |     | 10000 | 18,469,704b | 1,706.905μs | -1.12σ       | -8.43%         |
| 2    | AerospikeBenchmark | benchPutString100000 |     | 10000 | 18,469,704b | 1,997.532μs | +0.95σ       | +7.16%         |
| 3    | AerospikeBenchmark | benchPutString100000 |     | 10000 | 18,469,704b | 1,680.399μs | -1.31σ       | -9.85%         |
| 4    | AerospikeBenchmark | benchPutString100000 |     | 10000 | 18,469,704b | 1,958.178μs | +0.67σ       | +5.05%         |
+------+--------------------+----------------------+-----+-------+-------------+-------------+--------------+----------------+

And here you can find the benchmark result (from https://github.com/aerospike-community/aerospike-client-php/tree/master/examples/performance):

$ php7.3 write.php --host=127.0.0.1 --num-ops=10000 --write-every=10
Connecting to the host ≻ [✓] 
Write 10000 records ≻ [✓] 
10000 sequential writes
Failed writes: 0
Total time: 2.1376039981842s TPS:4678.6027760499

$ php7.3 read.php --host=127.0.0.1 --num-ops=10000 --write-every=10
Connecting to the host ≻ [✓] 
Assuming that write.php was run before to create 10000 records in test.performance
Read 10000 records ≻ [✓] 
10000 sequential reads
Failed reads: 0
Total time: 1.8172008991241s TPS:5503.5191787657

So ~ 182μs to read operation and ~ 214μs to write operation

Some 0.5.0-beta building feedback

Hi,
I've packaged 0.5.0-beta in rpm for our Enterprise Linux 9 environment, and just wanted to provide a bit of early feedback, mostly focused on the new local-daemon.

Feedback for building:

  • The "daemon" directory could actually be a separate project/codebase, since AFAIK nothing makes it PHP specific and other programming languages could have the same production deployment limitations as php-fpm and benefit from using it.
  • The daemon/asld_kvs.proto is weirdly required/included from the PHP extension build (possibly the reason why everything is a single codebase?).
  • There are confusing inconsistencies in the naming "daemon" (dir), "aerospike-local-daemon" (in some places) and "asld" (in others). See the daemon/Dockerfile for instance.
  • The daemon/Makefile is quite messy. Targets that require building don't even use the "build" target. The "build" target doesn't even work on its own since it requires "proto" first. And the default is "run" which tries to do waaaay too much: installing with sudo, and enabling and starting the service. I would have expected the default to result in getting the binary built (so probably proto & build), and the install to be in its own "install" target to be run as "sudo make install" for anyone wanting to leverage it.
  • The systemd file install seems broken (no file where it's expected) and the pkg/build/usr/lib/systemd/system/ one has a leftover name of aerospike-prometheus-exporter.service. For us an example file with instructions to copy/paste would be better. Or this done as part of the install target, and supporting a DESTDIR prefix.
  • The golang version requirement is 1.21.3 while el9 currently ships with 1.20, so we had to rebuild 1.22 for el9. This raises the entry bar for building from sources, but isn't really an issue if the project is expected to be provided in binary releases in the future.
  • The make proto requires protoc-gen-go-grpc and protoc-gen-go programs to be available, which is really not straightforward on el9 (these are part of Google golang projects). For now, we are running that on Fedora when preparing the tarball to use in our source rpm as a workaround. If the project implements in the future some sort of make dist that runs this in order to bundle the output files in a release tarball, that would fix this issue.

Feedback for running:

  • The local-daemon doesn't allow for specifying the listening socket file mode. This would be useful to control access to a certain degree (though we will probably place the socket inside a directory with ACLs for finer grained access control).
  • The local-daemon's socket file doesn't seem to get unlinked when shutting down, and it doesn't seem to try and unlink or reuse the existing socket file at startup. If it could do both, cleanup at exit and cleanup at start, it would be a lot more reliable for us.

Our rpm build spec file and source prep script are available here: https://github.com/exogroup/rpms/tree/master/php-aerospike

Thanks for taking this one big step further towards being usable in production php-fpm environments!
Matthias

Add capability to execute UDF on a single record

Hi,

Please enhance the client by adding the capability to execute User Defined Functions (UDF) on a single record. The corresponding feature, 'Client::execute_udf,' already exists in the underlying Rust client.

Not able to Access sock file from apache user and asld service is also not created

Hi Team

I'm reaching out to bring to your attention two issues I'm encountering with the Aerospike connection manager:

Socket File Access: After executing the make file within the aerospike-connection-manager directory, the socket file created through this is unable to access by the Apache user, transport error throws
Missing asld.service: The make daemonize command executed under aerospike-connection-manager is not creating the asld.service file at given path. following is the output of the command

rm -f asld
rm -f memprofile.out profile.out
rm -rf proto asld_kvs.pb.go asld_kvs_grpc.pb.go
find . -name "*.coverprofile" -exec rm {} +
protoc --go-grpc_out=. --go_out=. asld_kvs.proto --experimental_allow_proto3_optional
go build -ldflags="-X 'main.version=1.0.1'" -o  asld -o asld -v .
sudo cp asld /usr/local/bin/asld
sudo cp asld.toml /etc/asld.toml
sudo cp asld.service /lib/systemd/system/asld.service
cp: cannot stat 'asld.service': No such file or directory
make: *** [Makefile:34: daemonize] Error 1

Frequent Error - Transport Error (Status Unknown)

Hi Team

I'm writing to seek your assistance with a frequent error I'm encountering:

status: Unknown, message: "transport error", details: [], metadata: MetadataMap { headers: {} }

This error occurs frequently, and I'm unsure what might be missing to resolve it.
Could you please provide some insights on what this error message might indicate and any troubleshooting steps I can take to address it?

Incorrect ARM binary packaged in x86_64 deb

Hello,

I have encountered a significant issue with the aerospike-php-client-1.0.2-x86_64.deb package. It appears that the package, which is intended for x86_64 systems, mistakenly contains a binary built for the ARM architecture. This error prevents the library from loading properly on x86_64 systems.

# uname -a
Linux 2d8d78c51834 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan  9 22:39:36 UTC 2024 x86_64 GNU/Linux

Error encountered after install:

PHP Warning:  PHP Startup: Unable to load dynamic library 'libaerospike_php.so' (tried: /usr/lib/php/20220829/libaerospike_php.so (/usr/lib/php/20220829/libaerospike_php.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/libaerospike_php.so.so (/usr/lib/php/20220829/libaerospike_php.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Verification:

# file /usr/lib/php/20220829/libaerospike_php.so
/usr/lib/php/20220829/libaerospike_php.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=a5ac0b4ccf183361086bd8014fa6ffef81a901d4, not stripped

Redundant sudo usage in postinst script of deb package

Hello,

I've encountered an issue with the postinst script of the aerospike-php-client-1.0.2 package. During the installation process on Debian, the script attempts to execute commands using sudo. However, since the installation of .deb packages is typically performed with root privileges, the use of sudo is redundant and can lead to errors if sudo is not installed on the system.

Error encountered:

# dpkg -i aerospike-php-client-1.0.2-x86_64.deb
(Reading database ... 23503 files and directories currently installed.)
Preparing to unpack aerospike-php-client-1.0.2-x86_64.deb ...
Unpacking aerospike-php-client-1.0.2 (1.0.2) over (1.0.2) ...
Setting up aerospike-php-client-1.0.2 (1.0.2) ...
Copying Aerospike PHP extension to PHP extension directory...
/var/lib/dpkg/info/aerospike-php-client-1.0.2.postinst: line 38: sudo: command not found
Error: Failed to copy the .so file to PHP extension directory.
dpkg: error processing package aerospike-php-client-1.0.2 (--install):
 installed aerospike-php-client-1.0.2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 aerospike-php-client-1.0.2

Aerospike php8 client return null if data inserted through old client

Hi Team

I'm encountering a data discrepancy with a new client. Data saved through the old client isn't being retrieved correctly by the new client. Specifically, the new client returns a null value for the key (Primary Key), where the old client successfully stores a value.

I also found some data save format discrepancy in old have found format like below. In new client data saving as json string.
format through old client
4F 3A 32 39 3A 22 43 6F 6D 70 6F 6E 65 6E 74 73 5C 54 69 6F 5C 54 65 73 74 44 65 74 61 69 6C 73 54 69 6F 22 3A 35 30 3A 7B 73 3A 37 3A 22 61 6D 63 61 74 49 64 22 3B 73 3A 31 34 3A 22 31 31 32 36 30 30 30 35 32 35 33 36 30 35 22 3B 73 3A 36 3A 22 74 65 73

Build failure with 0.2.0 on aarch64

Hi,

I've updated our x86_64 build to 0.2.0 with no issues, but when trying to rebuild for aarch64, I got the following failure:

   [...]
   Compiling ext-php-rs v0.10.3
   Compiling aerospike-sync v0.1.0 (https://github.com/aerospike/aerospike-client-rust.git?branch=php-rs#56a13d54)
error[E0308]: mismatched types
   --> /builddir/build/BUILD/php-client-0.2.0-vendor/vendor/ext-php-rs/src/types/object.rs:149:17
    |
147 |             let res = zend_hash_str_find_ptr_lc(
    |                       ------------------------- arguments to this function are incorrect
148 |                 &(*self.ce).function_table,
149 |                 name.as_ptr() as *const i8,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: function defined here
   --> /builddir/build/BUILD/php-client-0.2.0-vendor/NTS/target/debug/build/ext-php-rs-522d80dcff97b12d/out/bindings.rs:3:12213
    |
3   | ...estroy (ht : * mut HashTable) ; } extern "C" { pub fn zend_hash_str_find_ptr_lc (ht : * const HashTable , str_ : * const :: std :: os ...
    |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/vendor/ext-php-rs/src/zend/function.rs:55:47
   |
55 |             let res = zend_fetch_function_str(name.as_ptr() as *const i8, name.len());
   |                       ----------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
   |                       |
   |                       arguments to this function are incorrect
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
note: function defined here
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/NTS/target/debug/build/ext-php-rs-522d80dcff97b12d/out/bindings.rs:3:41473
   |
3  | ...val , pub prev : zend_vm_stack , } extern "C" { pub fn zend_fetch_function_str (name : * const :: std :: os :: raw :: c_char , len : u...
   |                                                           ^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/vendor/ext-php-rs/src/zend/function.rs:68:21
   |
66 |                 let res = zend_hash_str_find_ptr_lc(
   |                           ------------------------- arguments to this function are incorrect
67 |                     &ce.function_table,
68 |                     name.as_ptr() as *const i8,
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
note: function defined here
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/NTS/target/debug/build/ext-php-rs-522d80dcff97b12d/out/bindings.rs:3:12213
   |
3  | ...estroy (ht : * mut HashTable) ; } extern "C" { pub fn zend_hash_str_find_ptr_lc (ht : * const HashTable , str_ : * const :: std :: os ...
   |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.

I just tried recompiling 0.1.0 and it worked:

   [...]
   Compiling ext-php-rs v0.10.1
   Compiling aerospike-sync v0.1.0 (https://github.com/aerospike/aerospike-client-rust.git?branch=php-rs#787140a1)
   Compiling aerospike v0.1.0 (/builddir/build/BUILD/php-client-e37a8a1c404f516d5261da5cb8c7108b79561a4e-vendor/NTS)
warning: unused import: `std::collections::BTreeMap`
  --> src/lib.rs:22:5
[...]
warning: `aerospike` (lib) generated 17 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 3m 43s

It does look like it could be related to the newer ext-php-rs, though. This is with PHP 8.1.24 on Red Hat Enterprise Linux 9.

PHPUnit mock Aerospike\Client

When I try to mock Client:
TestCase::createMock(\Aerospike\Client::class)
get error:
thread '<unnamed>' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ext-php-rs-0.12.0/src/types/class_object.rs:248:14: Attempted to access uninitialized class object note: run with RUST_BACKTRACE=1environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5

Don't autorestart PHPFPM on Makefile

HI,

IMO, you shouldn't apply auto restart of FPM (or apache) for multiple reasons :

  • To fetch your PHP version, you use php -v, it assumes default CLI version is the same of FPM
  • You write extension=libaerospike directly on php.ini, usually, we prefer splitting it into subfiles
  • And above all, we don't want to restart in an unexpected way our FPM process.

I suggest you to write a message in the user terminal saying aerospike lib isn't enabled until a restart is done

Best,

Jérémy

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.