Skip to content

Commit c706ad0

Browse files
committed
Style guide fixitday
1 parent 02817c1 commit c706ad0

37 files changed

+328
-145
lines changed

v2.1/cluster-setup-troubleshooting.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ Proceed through the following steps until you locate the source of the issue wit
119119

120120
**Next step**: If you successfully completed these steps, try [securing your deployment](manual-deployment.html) (*troubleshooting docs for this coming soon*) or reviewing our other [support resources](support-resources.html).
121121

122-
## Troubleshooting Information
122+
## Troubleshooting information
123123

124124
Use the information below to resolve issues you encounter when trying to start or scale your cluster.
125125

126-
### Networking Troubleshooting
126+
### Networking troubleshooting
127127

128128
Most networking-related issues are caused by one of two issues:
129129

@@ -145,7 +145,7 @@ However, to efficiently troubleshoot the issue, it's important to understand whe
145145
146146
Again, firewalls or hostname issues can cause any of these steps to fail.
147147
148-
### Node Won't Join Cluster
148+
### Node won't join cluster
149149
150150
When joining a node to a cluster, you might receive one of the following errors:
151151
@@ -183,7 +183,7 @@ node belongs to cluster {"cluster hash"} but is attempting to connect to a gossi
183183
184184
**Explanation**: When starting a node, the directory you choose to store the data in also contains metadata identifying the cluster the data came from. This causes conflicts when you've already started a node on the server, have quit `cockroach`, and then tried to join another cluster. Because the existing directory's cluster ID doesn't match the new cluster ID, the node cannot join it.
185185
186-
### Replication Error in a Multi-Node Cluster
186+
### Replication error in a multi-node cluster
187187
188188
If data is not being replicated to some nodes in the cluster, we recommend checking out the following:
189189

v2.1/collate.md

+9
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Collated strings are used as normal strings in SQL, but have a `COLLATE` clause
3131

3232
- **Column syntax**: `STRING COLLATE <collation>`. For example:
3333

34+
{% include copy-clipboard.html %}
3435
~~~ sql
3536
> CREATE TABLE foo (a STRING COLLATE en PRIMARY KEY);
3637
~~~
@@ -39,6 +40,7 @@ Collated strings are used as normal strings in SQL, but have a `COLLATE` clause
3940

4041
- **Value syntax**: `<STRING value> COLLATE <collation>`. For example:
4142

43+
{% include copy-clipboard.html %}
4244
~~~ sql
4345
> INSERT INTO foo VALUES ('dog' COLLATE en);
4446
~~~
@@ -51,18 +53,21 @@ You can set a default collation for all values in a `STRING` column.
5153

5254
For example, you can set a column's default collation to German (`de`):
5355
56+
{% include copy-clipboard.html %}
5457
~~~ sql
5558
> CREATE TABLE de_names (name STRING COLLATE de PRIMARY KEY);
5659
~~~
5760
5861
When inserting values into this column, you must specify the collation for every value:
5962
63+
{% include copy-clipboard.html %}
6064
~~~ sql
6165
> INSERT INTO de_names VALUES ('Backhaus' COLLATE de), ('Bär' COLLATE de), ('Baz' COLLATE de);
6266
~~~
6367
6468
The sort will now honor the `de` collation that treats *ä* as *a* in alphabetic sorting:
6569
70+
{% include copy-clipboard.html %}
6671
~~~ sql
6772
> SELECT * FROM de_names ORDER BY name;
6873
~~~
@@ -82,6 +87,7 @@ You can sort a column using a specific collation instead of its default.
8287
8388
For example, you receive different results if you order results by German (`de`) and Swedish (`sv`) collations:
8489
90+
{% include copy-clipboard.html %}
8591
~~~ sql
8692
> SELECT * FROM de_names ORDER BY name COLLATE sv;
8793
~~~
@@ -99,6 +105,7 @@ For example, you receive different results if you order results by German (`de`)
99105
100106
You can cast any string into a collation on the fly.
101107
108+
{% include copy-clipboard.html %}
102109
~~~ sql
103110
> SELECT 'A' COLLATE de < 'Ä' COLLATE de;
104111
~~~
@@ -108,6 +115,7 @@ true
108115
109116
However, you cannot compare values with different collations:
110117
118+
{% include copy-clipboard.html %}
111119
~~~ sql
112120
SELECT 'Ä' COLLATE sv < 'Ä' COLLATE de;
113121
~~~
@@ -117,6 +125,7 @@ pq: unsupported comparison operator: <collatedstring{sv}> < <collatedstring{de}>
117125
118126
You can also use casting to remove collations from values.
119127
128+
{% include copy-clipboard.html %}
120129
~~~ sql
121130
> SELECT CAST(name AS STRING) FROM de_names ORDER BY name;
122131
~~~

v2.1/column-families.md

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ To manually assign a column family on [table creation](create-table.html), use t
2424

2525
For example, let's say we want to create a table to store an immutable blob of data (`data BYTES`) with a last accessed timestamp (`last_accessed TIMESTAMP`). Because we know that the blob of data will never get updated, we use the `FAMILY` keyword to break it into a separate column family:
2626

27+
{% include copy-clipboard.html %}
2728
~~~ sql
2829
> CREATE TABLE test (
2930
id INT PRIMARY KEY,
@@ -32,7 +33,10 @@ For example, let's say we want to create a table to store an immutable blob of d
3233
FAMILY f1 (id, last_accessed),
3334
FAMILY f2 (data)
3435
);
36+
~~~
3537

38+
{% include copy-clipboard.html %}
39+
~~~ sql
3640
> SHOW CREATE TABLE users;
3741
~~~
3842

@@ -60,18 +64,21 @@ When using the [`ALTER TABLE .. ADD COLUMN`](add-column.html) statement to add a
6064

6165
- Use the `CREATE FAMILY` keyword to assign a new column to a **new family**. For example, the following would add a `data2 BYTES` column to the `test` table above and assign it to a new column family:
6266

67+
{% include copy-clipboard.html %}
6368
~~~ sql
6469
> ALTER TABLE test ADD COLUMN data2 BYTES CREATE FAMILY f3;
6570
~~~
6671

6772
- Use the `FAMILY` keyword to assign a new column to an **existing family**. For example, the following would add a `name STRING` column to the `test` table above and assign it to family `f1`:
6873

74+
{% include copy-clipboard.html %}
6975
~~~ sql
7076
> ALTER TABLE test ADD COLUMN name STRING FAMILY f1;
7177
~~~
7278

7379
- Use the `CREATE IF NOT EXISTS FAMILY` keyword to assign a new column to an **existing family or, if the family doesn't exist, to a new family**. For example, the following would assign the new column to the existing `f1` family; if that family didn't exist, it would create a new family and assign the column to it:
7480

81+
{% include copy-clipboard.html %}
7582
~~~ sql
7683
> ALTER TABLE test ADD COLUMN name STRING CREATE IF NOT EXISTS FAMILY f1;
7784
~~~

v2.1/commit-transaction.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For non-retryable transactions, if statements in the transaction [generated any
1414

1515
## Synopsis
1616

17-
{% include sql/{{ page.version.version }}/diagrams/commit_transaction.html %}
17+
<section> {% include sql/{{ page.version.version }}/diagrams/commit_transaction.html %} </section>
1818

1919
## Required privileges
2020

@@ -34,6 +34,7 @@ How you commit transactions depends on how your application handles [transaction
3434

3535
When using [client-side transaction retries](transactions.html#client-side-transaction-retries), statements are committed by [`RELEASE SAVEPOINT cockroach_restart`](release-savepoint.html). `COMMIT` itself only clears the connection for the next transaction.
3636

37+
{% include copy-clipboard.html %}
3738
~~~ sql
3839
> BEGIN;
3940

@@ -54,6 +55,7 @@ When using [client-side transaction retries](transactions.html#client-side-trans
5455

5556
If you are using transactions that CockroachDB will [automatically retry](transactions.html#automatic-retries) (i.e., all statements sent in a single batch), commit the transaction with `COMMIT`.
5657

58+
{% include copy-clipboard.html %}
5759
~~~ sql
5860
> BEGIN; UPDATE products SET inventory = 100 WHERE = '8675309'; UPDATE products SET inventory = 100 WHERE = '8675310'; COMMIT;
5961
~~~

v2.1/common-errors.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ decide whether to retry or not based on whether it would be better for
185185
your application to apply the transaction twice or return an error to
186186
the user.
187187

188-
## Something Else?
188+
## Something else?
189189

190190
If we do not have a solution here, you can try using our other [support resources](support-resources.html), including:
191191

v2.1/configure-replication-zones.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Zone Name | Description
355355
----------|-----------------|------------
356356
`.meta` | The "meta" ranges contain the authoritative information about the location of all data in the cluster.<br><br>Because historical queries are never run on meta ranges and it is advantageous to keep these ranges smaller for reliable performance, CockroachDB comes with a **pre-configured** `.meta` replication zone giving these ranges a lower-than-default `ttlseconds`.<br><br>If your cluster is running in multiple datacenters, it's a best practice to configure the meta ranges to have a copy in each datacenter.
357357
`.liveness` | The "liveness" range contains the authoritative information about which nodes are live at any given time.<br><br>Just as for "meta" ranges, historical queries are never run on the liveness range, so CockroachDB comes with a **pre-configured** `.liveness` replication zone giving this range a lower-than-default `ttlseconds`.<br><br>If this range is unavailable, the entire cluster will be unavailable, so giving it a high replication factor is strongly recommended.
358-
`.timeseries` | The "timeseries" ranges contain monitoring data about the cluster that powers the graphs in CockroachDB's admin UI. If necessary, you can add a `.timeseries` replication zone to control the replication of this data.
358+
`.timeseries` | The "timeseries" ranges contain monitoring data about the cluster that powers the graphs in CockroachDB's Admin UI. If necessary, you can add a `.timeseries` replication zone to control the replication of this data.
359359
`.system` | There are system ranges for a variety of other important internal data, including information needed to allocate new table IDs and track the status of a cluster's nodes. If necessary, you can add a `.system` replication zone to control the replication of this data.
360360

361361
To control replication for one of the above sets of system ranges, create a YAML file defining only the values you want to change (other values will not be affected), and use the `cockroach zone set <zone-name> -f <file.yaml>` command with appropriate flags:

v2.1/constraints.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,30 @@ How you add constraints depends on the number of columns you want to constrain,
2929

3030
- **One column of a new table** has its constraints defined after the column's data type. For example, this statement applies the Primary Key constraint to `foo.a`:
3131

32-
``` sql
32+
{% include copy-clipboard.html %}
33+
~~~ sql
3334
> CREATE TABLE foo (a INT PRIMARY KEY);
34-
```
35+
~~~
3536
- **Multiple columns of a new table** have their constraints defined after the table's columns. For example, this statement applies the Primary Key constraint to `foo`'s columns `a` and `b`:
3637

37-
``` sql
38+
{% include copy-clipboard.html %}
39+
~~~ sql
3840
> CREATE TABLE bar (a INT, b INT, PRIMARY KEY (a,b));
39-
```
41+
~~~
4042

4143
{{site.data.alerts.callout_info}}The Default Value and Not Null constraints cannot be applied to multiple columns.{{site.data.alerts.end}}
4244

4345
- **Existing tables** can have the following constraints added:
4446
- **Check**, **Foreign Key**, and **Unique** constraints can be added through [`ALTER TABLE...ADD CONSTRAINT`](add-constraint.html). For example, this statement adds the Unique constraint to `baz.id`:
4547

48+
{% include copy-clipboard.html %}
4649
~~~ sql
4750
> ALTER TABLE baz ADD CONSTRAINT id_unique UNIQUE (id);
4851
~~~
4952

5053
- **Default Values** can be added through [`ALTER TABLE...ALTER COLUMN`](alter-column.html#set-or-change-a-default-value). For example, this statement adds the Default Value constraint to `baz.bool`:
5154

55+
{% include copy-clipboard.html %}
5256
~~~ sql
5357
> ALTER TABLE baz ALTER COLUMN bool SET DEFAULT true;
5458
~~~
@@ -63,11 +67,15 @@ The order in which you list constraints is not important because constraints are
6367

6468
You can name constraints applied to new tables using the `CONSTRAINT` clause before defining the constraint:
6569

66-
``` sql
70+
{% include copy-clipboard.html %}
71+
~~~ sql
6772
> CREATE TABLE foo (a INT CONSTRAINT another_name PRIMARY KEY);
73+
~~~
6874

75+
{% include copy-clipboard.html %}
76+
~~~ sql
6977
> CREATE TABLE bar (a INT, b INT, CONSTRAINT yet_another_name PRIMARY KEY (a,b));
70-
```
78+
~~~
7179

7280
### View constraints
7381

v2.1/create-index.md

+11
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ To create the most efficient indexes, we recommend reviewing:
5454

5555
Single-column indexes sort the values of a single column.
5656

57+
{% include copy-clipboard.html %}
5758
~~~ sql
5859
> CREATE INDEX ON products (price);
5960
~~~
@@ -64,6 +65,7 @@ Because each query can only use one index, single-column indexes are not typical
6465

6566
Multiple-column indexes sort columns in the order you list them.
6667

68+
{% include copy-clipboard.html %}
6769
~~~ sql
6870
> CREATE INDEX ON products (price, stock);
6971
~~~
@@ -74,12 +76,14 @@ To create the most useful multiple-column indexes, we recommend reviewing our [b
7476

7577
Unique indexes do not allow duplicate values among their columns.
7678

79+
{% include copy-clipboard.html %}
7780
~~~ sql
7881
> CREATE UNIQUE INDEX ON products (name, manufacturer_id);
7982
~~~
8083

8184
This also applies the [Unique constraint](unique.html) at the table level, similarly to [`ALTER TABLE`](alter-table.html). The above example is equivalent to:
8285

86+
{% include copy-clipboard.html %}
8387
~~~ sql
8488
> ALTER TABLE products ADD CONSTRAINT products_name_manufacturer_id_key UNIQUE (name, manufacturer_id);
8589
~~~
@@ -88,12 +92,14 @@ This also applies the [Unique constraint](unique.html) at the table level, simil
8892

8993
[Inverted indexes](inverted-indexes.html) can be created on schemaless data in a [`JSONB`](jsonb.html) column.
9094

95+
{% include copy-clipboard.html %}
9196
~~~ sql
9297
> CREATE INVERTED INDEX ON users (profile);
9398
~~~
9499

95100
The above example is equivalent to the following PostgreSQL-compatible syntax:
96101

102+
{% include copy-clipboard.html %}
97103
~~~ sql
98104
> CREATE INDEX ON users USING GIN (profile);
99105
~~~
@@ -102,6 +108,7 @@ The above example is equivalent to the following PostgreSQL-compatible syntax:
102108

103109
Storing a column improves the performance of queries that retrieve (but don’t filter) its values.
104110

111+
{% include copy-clipboard.html %}
105112
~~~ sql
106113
> CREATE INDEX ON products (price) STORING (name);
107114
~~~
@@ -112,6 +119,7 @@ However, to use stored columns, queries must filter another column in the same i
112119

113120
To sort columns in descending order, you must explicitly set the option when creating the index. (Ascending order is the default.)
114121

122+
{% include copy-clipboard.html %}
115123
~~~ sql
116124
> CREATE INDEX ON products (price DESC, stock);
117125
~~~
@@ -122,6 +130,7 @@ How columns are sorted impacts the order of rows returned by queries using the i
122130

123131
Normally, CockroachDB selects the index that it calculates will scan the fewest rows. However, you can override that selection and specify the name of the index you want to use. To find the name, use [`SHOW INDEX`](show-index.html).
124132

133+
{% include copy-clipboard.html %}
125134
~~~ sql
126135
> SHOW INDEX FROM products;
127136
~~~
@@ -135,6 +144,8 @@ Normally, CockroachDB selects the index that it calculates will scan the fewest
135144
+----------+--------------------+--------+-----+--------+-----------+---------+----------+
136145
(3 rows)
137146
~~~
147+
148+
{% include copy-clipboard.html %}
138149
~~~ sql
139150
> SELECT name FROM products@products_price_idx WHERE price > 10;
140151
~~~

v2.1/create-security-certificates.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ File name pattern | File usage
4343
`ca.crt` | CA certificate
4444
`node.crt` | Server certificate
4545
`node.key` | Key for server certificate
46-
`client.<user>.crt` | Client certificate for `<user>` (eg: `client.root.crt` for user `root`)
46+
`client.<user>.crt` | Client certificate for `<user>` (for example: `client.root.crt` for user `root`)
4747
`client.<user>.key` | Key for the client certificate
4848

4949
Note the following:

0 commit comments

Comments
 (0)