From ab5dc68dfa827bde0178287c97809af3a672c03d Mon Sep 17 00:00:00 2001 From: Simon Dew <39966290+simon-dew@users.noreply.github.com> Date: Wed, 1 Aug 2018 16:05:40 +0100 Subject: [PATCH] DOC-1885: providing the vbucket id (#2778) Updated cbstats-key and cbstats-vkey: * Request syntax formatting * Updated key information * Add note and example on cbc-hash * Update response examples --- content/cli/cbstats/cbstats-key.dita | 121 ++++++++++++++++++------- content/cli/cbstats/cbstats-vkey.dita | 122 +++++++++++++++++++------- 2 files changed, 179 insertions(+), 64 deletions(-) diff --git a/content/cli/cbstats/cbstats-key.dita b/content/cli/cbstats/cbstats-key.dita index 64fe1bb76b..0aa4da19e0 100644 --- a/content/cli/cbstats/cbstats-key.dita +++ b/content/cli/cbstats/cbstats-key.dita @@ -6,7 +6,7 @@
Syntax

Request syntax:

- cbstats [hostname]:11210 key [keyname] [vbid] + cbstats host:11210 [common options] key keyname vbid
Description

The following key information is available.

@@ -25,22 +25,17 @@ key_cas - The keys current cas value. - KV - - - key_data_age - How long the key has waited for its value to be persisted (0 if clean). + The key’s current cas value, as a decimal integer. KV key_exptime - Expiration time from the epoch. + Expiration time from the epoch, as a decimal integer. KV key_flags - Flags for this key. + Flags for this key, as a decimal integer. KV @@ -48,30 +43,59 @@ If the value is not yet persisted. KV + + key_is_resident + If the value is resident in memory. + KV + key_valid - See description below*. + See description below. * V key_vb_state - The vbucket state of this key. + The vBucket state of this key. KV -

*key_valid= can have the following responses:

- +

* 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.
+
+
@@ -88,27 +112,58 @@ - KEYNAME + keyname Name of the key. - VBID - vBucket ID. + 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 .

-
Example + +
+ 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 key information +

Request

- cbstats 10.5.2.54:11210 key foo 115 -

Response

-

Example response for the key foo:

- key_cas: 41206791218746 - key_exptime: 0 - key_flags: 0 - key_is_dirty: 0 + cbstats localhost:11210 -u Administrator -p password -b beer-sample key 21st_amendment_brewery_cafe 553 + +

Response

+ stats for key 21st_amendment_brewery_cafe + key_cas: 1532081261254082560 + key_exptime: 0 + key_flags: 2 + key_is_dirty: false + key_is_resident: true + key_vb_state: replica
+ diff --git a/content/cli/cbstats/cbstats-vkey.dita b/content/cli/cbstats/cbstats-vkey.dita index 9119e53853..658041869b 100644 --- a/content/cli/cbstats/cbstats-vkey.dita +++ b/content/cli/cbstats/cbstats-vkey.dita @@ -2,16 +2,16 @@ <cmdname>vkey</cmdname> - Provides information on keys. + Provides verification for keys.
Syntax

Request syntax:

- cbstats [hostname]:11210 vkey [keyname] [vbid] + cbstats host:11210 [common options] vkey keyname vbid
Description

The following key information is available.

- + @@ -25,54 +25,77 @@ key_cas - The keys current cas value - KV - - - key_data_age - How long the key has waited for its value to be persisted (0 if - clean) + The key’s current cas value, as a decimal integer. KV key_exptime - Expiration time from the epoch + Expiration time from the epoch, as a decimal integer. KV key_flags - Flags for this key + Flags for this key, as a decimal integer. KV key_is_dirty - If the value is not yet persisted + If the value is not yet persisted. + KV + + + key_is_resident + If the value is resident in memory. KV key_valid - See description below + See description below. * V key_vb_state - The vbucket state of this key + 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.
  • -
+

* 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 @@ -88,22 +111,59 @@ - KEYNAME + keyname Name of the key. - VBID - vBucket ID. + 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 more information on the Couchbase C SDK, see .
  • +
  • For more information on the cbc-hash command, see + Couchbase C Client: + cbc(1) - Couchbase Client Commandline Utility.
  • +
+
+ +

For common cbstats options, see .

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

Request

- cbstats 10.5.2.54:11210 vkey foo 115 + 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
+