Flags in CouchbaseMetaDoc Object

I’ve spent a lot of time to trying to track down how to decipher the flags being sent back in the ‘flags’ property in said CouchbaseMetaDoc object. Can someone point me in the right direction and/or just explain what’s happening with these? I’m assuming they’re being OR’ed together from some internal process, but I don’t know for sure.

Any help in this regard would be much appreciated!

Thank you

Hey Erutan409,

The flags values are primarily used internally to provide support for encoding/decoding the data that is stored/retrieved from the server. You can view a list of constants which are used to compose the flags here: https://github.com/brett19/php-couchbase/blob/master/stub/constants.php.

Cheers, Brett

This is great, Brett.

Thank you, sir!

Follow-up question:

If I grab a document that has a NULL value and I get back the flag: 33554438, what exactly is that denoting from the constants you referred me to?

Thanks!

Well for anyone who would like a quick list of the potential error “codes” you might receive from the CouchbaseException (exception) object, I’ve compiled them into the following:

src: http://bit.ly/1yZsf1d
2 - Failure to connect to server/bucket resource
3 - Trying to increment an existing document that is not a number
4 - Data value exceeds constraints of size allowed on the server (150 bytes for key | 20 MB for value)
5 - Server is busy, try again
6 - Internal libcouchbase error
7 - Invalid parameters supplied to Couchbase function
8 - No more memory available to the server
9 - Invalid range
10 - Generic/ambiguous error
11 - Document is locked and/or incorrect CAS supplied
12 - Trying to add a document with a pre-existing key or provided the wrong CAS from another mutex operation
13 - Non-existing key
14 - I/O plug-in could not be located
15 - I/O plug-in didn't contain proper initialization routine
16 - Socket error
17 - Command forwarded to wrong server during rebalancing
18 - Trying to increment a non-existing document
19 - Unsupported functionality between server and client SDK (version mismatch)
20 - Unknown command
21 - DNS/Hostname lookup failed
22 - Data received on socket was not in expected format
23 - Client exceeded timeout limit
24 - Error while establishing TCP connection
25 - Bucket doesn't exist
26 - Memory allocation on client to do work (libcouchbase), failed
27 - Temporary failure on client side
28 - Bad handle type for operation
29 - Server bug
30 - Current version of libcouchbase can't load plug-in
31 - Invalid format for hostname in URI
32 - Illegal character
33 - Durability constraints requires more nodes/replicas than the cluster configuration allows
34 - Duplicate key in command list
35 - Possible fail-over occurring
36 - Environment variable incorrectly formatted
37 - Busy/internal error
38 - Username must match bucket name (or be NULL) for data access
39 - Contents of configuration cache were invalid, now fetching from network
40 - Server doesn't support specific SASL mechanism
41 - Maximum number of HTTP redirects reached
42 - Cluster map changed, operation couldn't be completed, try again
43 - Incomplete packet was passed
44 - Remote host refused connection
45 - Remote host closed connection
46 - Connection forcibly reset by remote host
47 - Couldn't assign local port for socket (for clients - too many TCP sockets open)
48 - System or process has reached its maximum number of file descriptors
49 - Remote host unreachable
50 - Control code passed was unrecognized
51 - Invalid modified for cntl operation
52 - Argument passed to cntl was badly formatted
53 - An empty key was passed to an operation
54 - Generic error in SSL subsystem was encountered
55 - Client couldn't verify server's certificate
56 - Internal error used for destroying unscheduled command data
57 - Feature not support by client because configuration in instance of options disabled when library compiled
58 - Operation structure contains conflicting options
59 - HTTP operation failed
60 - Item does not have synctoken object associated with it
61 - Server replied with unrecognized status code
62 - Mutation permanently lost due to node failing before replication

If any Couchbase dev would like to review my list and/or make corrections where necessary, please feel free. I summarized a couple of them. I will say that I find it somewhat annoying that I had to go looking for this, myself. I hope this helps someone else.

That’s great Erutan and Brett.
Thank you

1 Like

You’re welcome. Glad it’s still useful a year later.

Yes it is. :slight_smile: .

@Erutan409
Regarding public error variable from CouchbaseMetaDoc object returned by CouchbaseBucket::get() , Do you know what is the meaning of this variable or what values can take it ?

It’s been a while since I’ve played with the code, but if memory serves…it’s all about the exceptions that are thrown by the php library. Those codes correlate to the error id from the exceptions. I hope that helps.

Thank you, indeed.
I figure out on Couchbase PHP SDK 2.1 when is doing bulk insert or get is returning an array of CouchbaseMetaDoc and if one of the element has a problem the value from CouchbaseMetaDoc::error is a CouchbaseException object .

Thank you once again for the error codes :slight_smile: helps a lot .

1 Like