Skip to content

Commit

Permalink
DOC-1885: providing the vbucket id (#2778)
Browse files Browse the repository at this point in the history
Updated cbstats-key and cbstats-vkey:

* Request syntax formatting
* Updated key information
* Add note and example on cbc-hash
* Update response examples
  • Loading branch information
simon-dew authored Aug 1, 2018
1 parent 1a086ce commit ab5dc68
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 64 deletions.
121 changes: 88 additions & 33 deletions content/cli/cbstats/cbstats-key.dita
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<refbody>
<section><title>Syntax</title>
<p>Request syntax:</p>
<codeblock>cbstats [hostname]:11210 key [keyname] [vbid] </codeblock>
<codeblock>cbstats <varname>host</varname>:11210 [common options] key <varname>keyname</varname> <varname>vbid</varname></codeblock>
</section>
<section><title>Description</title>
<p>The following key information is available.</p>
Expand All @@ -25,53 +25,77 @@
<tbody>
<row>
<entry><codeph>key_cas</codeph></entry>
<entry>The keys current cas value.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_data_age</codeph></entry>
<entry>How long the key has waited for its value to be persisted (0 if clean).</entry>
<entry>The key’s current cas value, as a decimal integer.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_exptime</codeph></entry>
<entry>Expiration time from the epoch.</entry>
<entry>Expiration time from the epoch, as a decimal integer.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_flags</codeph></entry>
<entry>Flags for this key.</entry>
<entry>Flags for this key, as a decimal integer.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_is_dirty</codeph></entry>
<entry>If the value is not yet persisted.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_is_resident</codeph></entry>
<entry>If the value is resident in memory.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_valid</codeph></entry>
<entry>See description below<b>*</b>.</entry>
<entry>See description below. <b>*</b></entry>
<entry>V</entry>
</row>
<row>
<entry><codeph>key_vb_state</codeph></entry>
<entry>The vbucket state of this key.</entry>
<entry>The vBucket state of this key.</entry>
<entry>KV</entry>
</row>
</tbody>
</tgroup>
</table>
<p><codeph><b>*</b>key_valid</codeph>= can have the following responses:</p>
<ul>
<li><codeph>this_is_a_bug</codeph>: Some case we didn’t take care of.</li>
<li><codeph>dirty</codeph>:The value in memory has not been persisted yet.</li>
<li><codeph>length_mismatch</codeph>: The key length in memory doesn’t match the length on the disk.</li>
<li><codeph>data_mismatch</codeph>: The data in memory doesn’t match the data on disk.</li>
<li><codeph>flags_mismatch</codeph>: The flags in memory don’t match the flags on disk.</li>
<li><codeph>valid</codeph>: The key is both on disk and in memory</li>
<li><codeph>ram_but_not_disk:</codeph> The value doesn’t exist yet on disk.</li>
<li><codeph>item_deleted</codeph>: The item has been deleted.</li>
</ul>
<p><b>*</b> <codeph>key_valid</codeph> can have the following responses:</p>
<dl>
<dlentry>
<dt><codeph>this_is_a_bug</codeph></dt>
<dd>Some case we didn’t take care of.</dd>
</dlentry>
<dlentry>
<dt><codeph>dirty</codeph></dt>
<dd>The value in memory has not been persisted yet.</dd>
</dlentry>
<dlentry>
<dt><codeph>length_mismatch</codeph></dt>
<dd>The key length in memory doesn’t match the length on the disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>data_mismatch</codeph></dt>
<dd>The data in memory doesn’t match the data on disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>flags_mismatch</codeph></dt>
<dd>The flags in memory don’t match the flags on disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>valid</codeph></dt>
<dd>The key is both on disk and in memory.</dd>
</dlentry>
<dlentry>
<dt><codeph>ram_but_not_disk</codeph></dt>
<dd>The value doesn’t exist yet on disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>item_deleted</codeph></dt>
<dd>The item has been deleted.</dd>
</dlentry>
</dl>
</section>


Expand All @@ -88,27 +112,58 @@
</thead>
<tbody>
<row>
<entry>KEYNAME</entry>
<entry><varname>keyname</varname></entry>
<entry>Name of the key.</entry>
</row>
<row>
<entry>VBID</entry>
<entry>vBucket ID.</entry>
<entry><varname>vbid</varname></entry>
<entry>vBucket ID. <b>†</b></entry>
</row>
</tbody>
</tgroup>
</table>

<sectiondiv>
<p><b>†</b> To find the vBucket ID associated with a given key, you can use the <cmdname>cbc-hash</cmdname>
command, which is available as part of the Couchbase C SDK (<apiname>libcouchbase</apiname>).</p>
<ul>
<li>For more information on the Couchbase C SDK, see <xref href="../../sdk/c/start-using-sdk.dita" />.</li>
<li>For more information on the <cmdname>cbc-hash</cmdname> command, see
<xref href="http://docs.couchbase.com/sdk-api/couchbase-c-client-2.8.5/md_doc_cbc.html">Couchbase C Client:
cbc(1) - Couchbase Client Commandline Utility</xref>.</li>
</ul>
</sectiondiv>

<p>For common <cmdname>cbstats</cmdname> options, see <xref href="../cbstats-intro.dita#cbstats-intro"/>.</p>

</section>
<section><title>Example</title>

<section>
<title>Example 1: Find the vBucket ID associated with a given key</title>

<p><b>Request</b></p>
<codeblock>cbc-hash 21st_amendment_brewery_cafe -U couchbase://localhost/beer-sample -u Administrator -P password</codeblock>

<p><b>Response</b></p>
<codeblock>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</codeblock>
</section>

<section>
<title>Example 2: Get key information</title>

<p><b>Request</b></p>
<codeblock>cbstats 10.5.2.54:11210 key foo 115</codeblock>
<p><b>Response</b></p>
<p>Example response for the key <codeph>foo</codeph>:</p>
<codeblock> key_cas: 41206791218746
key_exptime: 0
key_flags: 0
key_is_dirty: 0 </codeblock>
<codeblock>cbstats localhost:11210 -u Administrator -p password -b beer-sample key 21st_amendment_brewery_cafe 553</codeblock>

<p><b>Response</b></p>
<codeblock>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</codeblock>
</section>

</refbody>
</reference>
122 changes: 91 additions & 31 deletions content/cli/cbstats/cbstats-vkey.dita
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="reference_cyd_jql_ns">
<title><cmdname>vkey</cmdname></title>
<shortdesc>Provides information on keys.</shortdesc>
<shortdesc>Provides verification for keys.</shortdesc>
<refbody>
<section><title>Syntax</title>
<p>Request syntax:</p>
<codeblock>cbstats [hostname]:11210 vkey [keyname] [vbid] </codeblock>
<codeblock>cbstats <varname>host</varname>:11210 [common options] vkey <varname>keyname</varname> <varname>vbid</varname></codeblock>
</section>
<section><title>Description</title>
<p>The following key information is available.</p>
<table>
<tgroup cols="3">
<tgroup cols="3">
<colspec colname="col1" colwidth="1.5*"/>
<colspec colname="col2" colwidth="3*"/>
<colspec colname="col3" colwidth="1*"/>
Expand All @@ -25,54 +25,77 @@
<tbody>
<row>
<entry><codeph>key_cas</codeph></entry>
<entry>The keys current cas value</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_data_age</codeph></entry>
<entry>How long the key has waited for its value to be persisted (0 if
clean)</entry>
<entry>The key’s current cas value, as a decimal integer.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_exptime</codeph></entry>
<entry>Expiration time from the epoch</entry>
<entry>Expiration time from the epoch, as a decimal integer.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_flags</codeph></entry>
<entry>Flags for this key</entry>
<entry>Flags for this key, as a decimal integer.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_is_dirty</codeph></entry>
<entry>If the value is not yet persisted</entry>
<entry>If the value is not yet persisted.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_is_resident</codeph></entry>
<entry>If the value is resident in memory.</entry>
<entry>KV</entry>
</row>
<row>
<entry><codeph>key_valid</codeph></entry>
<entry>See description below</entry>
<entry>See description below. <b>*</b></entry>
<entry>V</entry>
</row>
<row>
<entry><codeph>key_vb_state</codeph></entry>
<entry>The vbucket state of this key</entry>
<entry>The vBucket state of this key.</entry>
<entry>KV</entry>
</row>
</tbody>
</tgroup>
</table>
<p><codeph>key_valid</codeph>= can have the following responses:</p>
<ul>
<li><codeph>this_is_a_bug</codeph>: Some case we didn’t take care of.</li>
<li><codeph>dirty</codeph>:The value in memory has not been persisted yet.</li>
<li><codeph>length_mismatch</codeph>: The key length in memory doesn’t match the length on the disk.</li>
<li><codeph>data_mismatch</codeph>: The data in memory doesn’t match the data on disk.</li>
<li><codeph>flags_mismatch</codeph>: The flags in memory don’t match the flags on disk.</li>
<li><codeph>valid</codeph>: The key is both on disk and in memory</li>
<li><codeph>ram_but_not_disk:</codeph> The value doesn’t exist yet on disk.</li>
<li><codeph>item_deleted</codeph>: The item has been deleted.</li>
</ul>
<p><b>*</b> <codeph>key_valid</codeph> can have the following responses:</p>
<dl>
<dlentry>
<dt><codeph>this_is_a_bug</codeph></dt>
<dd>Some case we didn’t take care of.</dd>
</dlentry>
<dlentry>
<dt><codeph>dirty</codeph></dt>
<dd>The value in memory has not been persisted yet.</dd>
</dlentry>
<dlentry>
<dt><codeph>length_mismatch</codeph></dt>
<dd>The key length in memory doesn’t match the length on the disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>data_mismatch</codeph></dt>
<dd>The data in memory doesn’t match the data on disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>flags_mismatch</codeph></dt>
<dd>The flags in memory don’t match the flags on disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>valid</codeph></dt>
<dd>The key is both on disk and in memory.</dd>
</dlentry>
<dlentry>
<dt><codeph>ram_but_not_disk</codeph></dt>
<dd>The value doesn’t exist yet on disk.</dd>
</dlentry>
<dlentry>
<dt><codeph>item_deleted</codeph></dt>
<dd>The item has been deleted.</dd>
</dlentry>
</dl>
</section>

<section><title>Options</title>
Expand All @@ -88,22 +111,59 @@
</thead>
<tbody>
<row>
<entry>KEYNAME</entry>
<entry><varname>keyname</varname></entry>
<entry>Name of the key.</entry>
</row>
<row>
<entry>VBID</entry>
<entry>vBucket ID.</entry>
<entry><varname>vbid</varname></entry>
<entry>vBucket ID. <b>†</b></entry>
</row>
</tbody>
</tgroup>
</table>

<sectiondiv>
<p><b>†</b> To find the vBucket ID associated with a given key, you can use the <cmdname>cbc-hash</cmdname>
command, which is available as part of the Couchbase C SDK (<apiname>libcouchbase</apiname>).</p>
<ul>
<li>For more information on the Couchbase C SDK, see <xref href="../../sdk/c/start-using-sdk.dita" />.</li>
<li>For more information on the <cmdname>cbc-hash</cmdname> command, see
<xref href="http://docs.couchbase.com/sdk-api/couchbase-c-client-2.8.5/md_doc_cbc.html">Couchbase C Client:
cbc(1) - Couchbase Client Commandline Utility</xref>.</li>
</ul>
</sectiondiv>

<p>For common <cmdname>cbstats</cmdname> options, see <xref href="../cbstats-intro.dita#cbstats-intro"/>.</p>

</section>
<section><title>Example</title>

<section>
<title>Example 1: Find the vBucket ID associated with a given key</title>

<p><b>Request</b></p>
<codeblock>cbstats 10.5.2.54:11210 vkey foo 115</codeblock>
<codeblock>cbc-hash 21st_amendment_brewery_cafe -U couchbase://localhost/beer-sample -u Administrator -P password</codeblock>

<p><b>Response</b></p>
<codeblock>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</codeblock>
</section>

<section>
<title>Example 2: Get vkey information</title>

<p><b>Request</b></p>
<codeblock>cbstats localhost:11210 -u Administrator -p password -b beer-sample vkey 21st_amendment_brewery_cafe 553</codeblock>

<p><b>Response</b></p>
<codeblock>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</codeblock>
</section>

</refbody>
</reference>

0 comments on commit ab5dc68

Please sign in to comment.