vkey

vkey

Provides verification for keys.

Syntax

Request syntax:

cbstats host:11210 [common options] vkey keyname vbid

Description

The following key information is available.

Stat Description K/V
key_cas The key’s current cas value, as a decimal integer. KV
key_exptime Expiration time from the epoch, as a decimal integer. KV
key_flags Flags for this key, as a decimal integer. KV
key_is_dirty If the value is not yet persisted. KV
key_is_resident If the value is resident in memory. KV
key_valid See description below. * V
key_vb_state The vBucket state of this key. KV

* key_valid can have the following responses:

this_is_a_bug
Some case we didn’t take care of.
dirty
The value in memory has not been persisted yet.
length_mismatch
The key length in memory doesn’t match the length on the disk.
data_mismatch
The data in memory doesn’t match the data on disk.
flags_mismatch
The flags in memory don’t match the flags on disk.
valid
The key is both on disk and in memory.
ram_but_not_disk
The value doesn’t exist yet on disk.
item_deleted
The item has been deleted.

Options

Table 1. vkey options
Option Description
keyname Name of the key.
vbid vBucket ID.

To find the vBucket ID associated with a given key, you can use the cbc-hash command, which is available as part of the Couchbase C SDK (libcouchbase).

For common cbstats options, see cbstats.

Example 1: Find the vBucket ID associated with a given key

Request

cbc-hash 21st_amendment_brewery_cafe -U couchbase://localhost/beer-sample -u Administrator -P password

Response

21st_amendment_brewery_cafe: [vBucket=553, Index=1] Server: 10.142.180.102:11210, CouchAPI: http://10.142.180.102:8092/beer-sample
Replica #0: Index=0, Host=10.142.180.101:11210

Example 2: Get vkey information

Request

cbstats localhost:11210 -u Administrator -p password -b beer-sample vkey 21st_amendment_brewery_cafe 553

Response

verification for key 21st_amendment_brewery_cafe
 key_cas:         1532081261254082560
 key_exptime:     0
 key_flags:       2
 key_is_dirty:    false
 key_is_resident: true
 key_valid:       data_mismatch
 key_vb_state:    replica