PHP flush() isn't doing anything


#1

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);

#2

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


#3

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.


#4

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


#5

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.


#6

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:


#7

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


#8

Bump. Anyone please?


#9

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


#10

@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. https://issues.couchbase.com/browse/PCBC-331


#11

Hey,

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

Cheers, Brett


#12

@brett19 Thank you :smile: