Skip to content

Commit 03d68fb

Browse files
macintuxpyrrho
authored andcommitted
Document coverage queries in KV
1 parent ddb54f6 commit 03d68fb

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: "PBC Coverage Queries"
3+
description: ""
4+
project: "riak_kv"
5+
project_version: "2.1.4"
6+
menu:
7+
riak_kv-2.1.4:
8+
name: "Coverage Queries"
9+
identifier: "pbc_coverage_queries"
10+
weight: 108
11+
parent: "apis_pbc"
12+
toc: true
13+
aliases:
14+
- /riak/2.1.4/dev/references/protocol-buffers/coverage-queries
15+
- /riak/kv/2.1.4/dev/references/protocol-buffers/coverage-queries
16+
canonical_link: "https://docs.basho.com/riak/kv/latest/developing/api/protocol-buffers/coverage-queries"
17+
---
18+
19+
Prepare for parallelizable
20+
[secondary index queries][../secondary-indexes/] by requesting a
21+
coverage plan. The response will be multiple slices of the cluster, as
22+
identified by a TCP endpoint and an opaque binary to be included with
23+
each 2i query.
24+
25+
## Request
26+
27+
```protobuf
28+
message RpbCoverageReq {
29+
optional bytes type = 1;
30+
required bytes bucket = 2;
31+
optional uint32 min_partitions = 3;
32+
optional bytes replace_cover = 4;
33+
repeated bytes unavailable_cover = 5;
34+
}
35+
```
36+
37+
#### Required Parameters
38+
39+
Parameter | Description
40+
:---------|:-----------
41+
`bucket` | The name of the bucket in which the data is stored
42+
43+
#### Optional Parameters
44+
45+
Parameter | Description
46+
:---------|:-----------
47+
`type` | The name of the bucket type, if this bucket is not in the default (pre-2.0) bucket type.
48+
`min_partitions` | The minimum number of cluster slices. `undefined` results in a direct map of the internal coverage plan, which targets the minimum number of nodes necessary to retrieve all data. An integer will be rounded up to the nearest power of 2 greater than or equal to the ring size.
49+
`replace_cover` | If a client cannot reach the server designated by a previous coverage response, the opaque binary can be sent with a new coverage request via this parameter and a new plan component will be calculated and returned.
50+
`unavailable_cover` | List of opaque binaries representing other unreachable endpoints to help Riak determine what servers the client cannot currently use.
51+
52+
## Response
53+
54+
The results of a coverage query are returned as a list of endpoints
55+
with opaque binaries to be included with secondary index queries.
56+
57+
```protobuf
58+
message RpbCoverageResp {
59+
repeated RpbCoverageEntry entries = 1;
60+
}
61+
62+
message RpbCoverageEntry {
63+
required bytes ip = 1;
64+
required uint32 port = 2;
65+
optional bytes keyspace_desc = 3;
66+
required bytes cover_context = 4;
67+
}
68+
```
69+
70+
#### Values
71+
72+
Parameter | Description
73+
:---------|:-----------
74+
`ip` | The IP address of the server containing a subset of the data. Depending on the environment, this address may require local translation to deal with routing or firewall constraints.
75+
`port` | The port to contact on the server.
76+
`keyspace_desc` | A human-readable description of the keyspace. Not intended to be used programmatically except potentially for logging.
77+
`cover_context` | The opaque binary to be used in secondary index queries (and possibly future coverage queries to indicate that this server appears offline or otherwise non-functional to the client).

content/riak/kv/2.1.4/developing/api/protocol-buffers/secondary-indexes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ message RpbIndexReq {
3939
optional bytes type = 12;
4040
optional bytes term_regex = 13;
4141
optional bool pagination_sort = 14;
42+
optional bytes cover_context = 15;
43+
optional bool return_body = 16;
4244
}
4345
```
4446

@@ -64,6 +66,8 @@ Parameter | Description
6466
`type` | The bucket type of the bucket that is being queried. If not set, the bucket type `default` will be used. Learn more about [using bucket types](/riak/kv/2.1.4/developing/usage/bucket-types).
6567
`term_regex` | If set to a regular expression (as a binary), a term filter will be applied to the index query
6668
`pagination_sort` | If set to `true`, paginated results will be sorted, first by index value, then by key
69+
`cover_context` | Opaque binary used to target a vnode. Requested via [a coverage query][../coverage-queries/]
70+
`return_body` | Return values with keys. Only worked when using the system indexes `$bucket` or `$key`
6771

6872
## Response
6973

0 commit comments

Comments
 (0)