Hi all!
I`m use Community Edition 7.0.0 build 5302 on Docker.
Couchbase Server image: couchbase:community-7.0.2 (sha256:45604b674bf5b0ae801b518454aa6086c6075a2a923060f05db894a113476296).
Couchbase C-lib version: 3.2.3
Couchbase PHP-SDK version: 3.2.1
PHP version: 8.0.9
Reproducing the problem
I am running the server via docker compose:
# file docker-compose.yml
version: '3.0'
services:
couchbase:
restart: unless-stopped
image: couchbase:community-7.0.2
volumes:
- couchbase_data:/opt/couchbase
ports:
- "8091-8096:8091-8096"
- "11210-11211:11210-11211"
volumes:
couchbase_data:
driver: local
My test script contains code like this:
# file test-couchbase.php
<?php
include 'vendor/autoload.php';
use Couchbase\Cluster;
use Couchbase\ClusterOptions;
use Couchbase\UpsertOptions;
$clusterOptions = new ClusterOptions();
$clusterOptions->credentials('user', 'password');
$cluster = new Cluster('couchbase://localhost:8091', $clusterOptions);
$bucket = $cluster->bucket('test-bucket');
$scope = $bucket->defaultScope();
$collection = $scope->collection('test-collection');
$options = new UpsertOptions();
## All this durability does not work
$options->durabilityLevel(Couchbase\DurabilityLevel::MAJORITY_AND_PERSIST_TO_ACTIVE);
// $options->durabilityLevel(Couchbase\DurabilityLevel::PERSIST_TO_MAJORITY);
// $options->durabilityLevel(Couchbase\DurabilityLevel::MAJORITY);
## Only this works fine
//$options->durabilityLevel(Couchbase\DurabilityLevel::NONE);
$collection->upsert('id-document', ['field' => 'value'], $options);
and I am getting the following error
/app $ php test-couchbase.php
[cb,WARN] (server L:386 I:151288749) <10.110.3.17:11210> (CTX=0x7ffaef5077a0,memcached,SRV=0x7ffaef261aa0,IX=0) Received server error EINVAL (0x4) on packet: OP=0x1, RC=0x4, SEQ=1
PHP Fatal error: Uncaught Couchbase\BindingsException: LCB_ERR_KVENGINE_INVALID_PACKET (1031) in /app/test-couchbase.php:22
Stack trace:
#0 /app/test-couchbase.php(22): Couchbase\Collection->upsert('id-document', Array, Object(Couchbase\UpsertOptions))
#1 {main}
thrown in /app/test-couchbase.php on line 22
Fatal error: Uncaught Couchbase\BindingsException: LCB_ERR_KVENGINE_INVALID_PACKET (1031) in /app/test-couchbase.php:22
Stack trace:
#0 /app/test-couchbase.php(22): Couchbase\Collection->upsert('id-document', Array, Object(Couchbase\UpsertOptions))
#1 {main}
thrown in /app/test-couchbase.php on line 22
All this durability does not work:
- MAJORITY_AND_PERSIST_TO_ACTIVE
- PERSIST_TO_MAJORITY
- MAJORITY
Only this works fine:
- NONE
Choosing the SDK version I followed this article https://www.couchbase.com/products/developer-sdk/compatibility. But I did not find which version of the C library I need to install for PHP-SDK 3.2.1, so I installed the last one I found on this page Tags · couchbase/libcouchbase · GitHub — 3.2.3.
Any thoughts?