PHP flush() isn't doing anything

I have enabled flush on on the bucket but my flush call returns null without removing anyhing

$cluster = new CouchbaseCluster('127.0.0.1:8091','Administrator','-');
$db = $cluster->openBucket('default');
$res = $db->flush();
print_r($res);

Are you sure you have flush enabled in the bucket settings?

Positive its checked, I have also run this command to be sure.

./couchbase-cli bucket-edit \
	-c 127.0.0.1 \
	-u Administrator -p pass \
	--bucket=default \
	--enable-flush=1

I have 2 servers in the cluster, I am not sure if doing it on one server in the cluster is fine.

It turned out that $db->flush() calls memcached-level flush which is disabled in modern couchbase servers, you can see it in wireshark for example (php client is not very verbose about “not supported” error code)

After a bit of research I’ve found that REST flush (which actually uses that API enabled by checkbox above) is not implemented in second generation of the PHP client, while it was accessible in older client

Are there plans to fix this is in a future version?

As far as I can tell I have the latest version installed, but the issue still exists.

I’m working on a testing framework for Couchbase and not having flush() work is quite limiting. So I too would like to voice the need for this. :slight_smile:

It’s been a few months already. Do we have any updates on this?

Bump. Anyone please?

Hey moon0326,

I have created a ticket to track this issue here: https://issues.couchbase.com/browse/PCBC-331. It will be resolved for our next release!

Cheers, Brett

@brett19

Hi brett19,

I’ve installed the latest libcouchbase and php couchbase sdk and tested flush(). It looks like the method has been removed from the Bucket class. Where is the flush() method now?

I see that the ticket has been marked as fixed. Loading...

Hey,

The flush method is now available via bucket->manager()->flush() as it is a management operation.

Cheers, Brett

@brett19 Thank you :smile: