You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: v2.1/cluster-setup-troubleshooting.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -119,11 +119,11 @@ Proceed through the following steps until you locate the source of the issue wit
119
119
120
120
**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).
121
121
122
-
## Troubleshooting Information
122
+
## Troubleshooting information
123
123
124
124
Use the information below to resolve issues you encounter when trying to start or scale your cluster.
125
125
126
-
### Networking Troubleshooting
126
+
### Networking troubleshooting
127
127
128
128
Most networking-related issues are caused by one of two issues:
129
129
@@ -145,7 +145,7 @@ However, to efficiently troubleshoot the issue, it's important to understand whe
145
145
146
146
Again, firewalls or hostname issues can cause any of these steps to fail.
147
147
148
-
### Node Won't Join Cluster
148
+
### Node won't join cluster
149
149
150
150
When joining a node to a cluster, you might receive one of the following errors:
151
151
@@ -183,7 +183,7 @@ node belongs to cluster {"cluster hash"} but is attempting to connect to a gossi
183
183
184
184
**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.
185
185
186
-
### Replication Error in a Multi-Node Cluster
186
+
### Replication error in a multi-node cluster
187
187
188
188
If data is not being replicated to some nodes in the cluster, we recommend checking out the following:
Copy file name to clipboardExpand all lines: v2.1/column-families.md
+7
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ To manually assign a column family on [table creation](create-table.html), use t
24
24
25
25
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:
26
26
27
+
{% include copy-clipboard.html %}
27
28
~~~sql
28
29
> CREATE TABLE test (
29
30
id INTPRIMARY KEY,
@@ -32,7 +33,10 @@ For example, let's say we want to create a table to store an immutable blob of d
32
33
FAMILY f1 (id, last_accessed),
33
34
FAMILY f2 (data)
34
35
);
36
+
~~~
35
37
38
+
{% include copy-clipboard.html %}
39
+
~~~sql
36
40
> SHOW CREATE TABLE users;
37
41
~~~
38
42
@@ -60,18 +64,21 @@ When using the [`ALTER TABLE .. ADD COLUMN`](add-column.html) statement to add a
60
64
61
65
- 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:
62
66
67
+
{% include copy-clipboard.html %}
63
68
~~~sql
64
69
> ALTER TABLE test ADD COLUMN data2 BYTES CREATE FAMILY f3;
65
70
~~~
66
71
67
72
- 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`:
68
73
74
+
{% include copy-clipboard.html %}
69
75
~~~sql
70
76
> ALTER TABLE test ADD COLUMN name STRING FAMILY f1;
71
77
~~~
72
78
73
79
- 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:
74
80
81
+
{% include copy-clipboard.html %}
75
82
~~~sql
76
83
> ALTER TABLE test ADD COLUMN name STRING CREATE IF NOT EXISTS FAMILY f1;
Copy file name to clipboardExpand all lines: v2.1/commit-transaction.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ For non-retryable transactions, if statements in the transaction [generated any
14
14
15
15
## Synopsis
16
16
17
-
{% include sql/{{ page.version.version }}/diagrams/commit_transaction.html %}
17
+
<section> {% include sql/{{ page.version.version }}/diagrams/commit_transaction.html %} </section>
18
18
19
19
## Required privileges
20
20
@@ -34,6 +34,7 @@ How you commit transactions depends on how your application handles [transaction
34
34
35
35
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.
36
36
37
+
{% include copy-clipboard.html %}
37
38
~~~sql
38
39
>BEGIN;
39
40
@@ -54,6 +55,7 @@ When using [client-side transaction retries](transactions.html#client-side-trans
54
55
55
56
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`.
56
57
58
+
{% include copy-clipboard.html %}
57
59
~~~sql
58
60
>BEGIN; UPDATE products SET inventory =100WHERE='8675309'; UPDATE products SET inventory =100WHERE='8675310'; COMMIT;
Copy file name to clipboardExpand all lines: v2.1/configure-replication-zones.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -355,7 +355,7 @@ Zone Name | Description
355
355
----------|-----------------|------------
356
356
`.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.
357
357
`.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.
359
359
`.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.
360
360
361
361
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:
Copy file name to clipboardExpand all lines: v2.1/constraints.md
+14-6
Original file line number
Diff line number
Diff line change
@@ -29,26 +29,30 @@ How you add constraints depends on the number of columns you want to constrain,
29
29
30
30
-**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`:
31
31
32
-
```sql
32
+
{% include copy-clipboard.html %}
33
+
~~~sql
33
34
> CREATE TABLE foo (a INTPRIMARY KEY);
34
-
```
35
+
~~~
35
36
-**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`:
36
37
37
-
``` sql
38
+
{% include copy-clipboard.html %}
39
+
~~~ sql
38
40
> CREATE TABLE bar (a INT, b INT, PRIMARY KEY (a,b));
39
-
```
41
+
~~~
40
42
41
43
{{site.data.alerts.callout_info}}The Default Value andNot Null constraints cannot be applied to multiple columns.{{site.data.alerts.end}}
42
44
43
45
-**Existing tables** can have the following constraints added:
44
46
-**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`:
45
47
48
+
{% include copy-clipboard.html %}
46
49
~~~ sql
47
50
> ALTER TABLE baz ADD CONSTRAINT id_unique UNIQUE (id);
48
51
~~~
49
52
50
53
-**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`:
51
54
55
+
{% include copy-clipboard.html %}
52
56
~~~ sql
53
57
> ALTER TABLE baz ALTER COLUMN bool SET DEFAULT true;
54
58
~~~
@@ -63,11 +67,15 @@ The order in which you list constraints is not important because constraints are
63
67
64
68
You can name constraints applied to new tables using the `CONSTRAINT` clause before defining the constraint:
65
69
66
-
``` sql
70
+
{% include copy-clipboard.html %}
71
+
~~~ sql
67
72
> CREATE TABLE foo (a INTCONSTRAINT another_name PRIMARY KEY);
73
+
~~~
68
74
75
+
{% include copy-clipboard.html %}
76
+
~~~sql
69
77
> CREATE TABLE bar (a INT, b INT, CONSTRAINT yet_another_name PRIMARY KEY (a,b));
Copy file name to clipboardExpand all lines: v2.1/create-index.md
+11
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@ To create the most efficient indexes, we recommend reviewing:
54
54
55
55
Single-column indexes sort the values of a single column.
56
56
57
+
{% include copy-clipboard.html %}
57
58
~~~sql
58
59
> CREATE INDEX ON products (price);
59
60
~~~
@@ -64,6 +65,7 @@ Because each query can only use one index, single-column indexes are not typical
64
65
65
66
Multiple-column indexes sort columns in the order you list them.
66
67
68
+
{% include copy-clipboard.html %}
67
69
~~~sql
68
70
> CREATE INDEX ON products (price, stock);
69
71
~~~
@@ -74,12 +76,14 @@ To create the most useful multiple-column indexes, we recommend reviewing our [b
74
76
75
77
Unique indexes do not allow duplicate values among their columns.
76
78
79
+
{% include copy-clipboard.html %}
77
80
~~~sql
78
81
> CREATE UNIQUE INDEX ON products (name, manufacturer_id);
79
82
~~~
80
83
81
84
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:
82
85
86
+
{% include copy-clipboard.html %}
83
87
~~~sql
84
88
> ALTER TABLE products ADD CONSTRAINT products_name_manufacturer_id_key UNIQUE (name, manufacturer_id);
85
89
~~~
@@ -88,12 +92,14 @@ This also applies the [Unique constraint](unique.html) at the table level, simil
88
92
89
93
[Inverted indexes](inverted-indexes.html) can be created on schemaless data in a [`JSONB`](jsonb.html) column.
90
94
95
+
{% include copy-clipboard.html %}
91
96
~~~sql
92
97
> CREATE INVERTED INDEX ON users (profile);
93
98
~~~
94
99
95
100
The above example is equivalent to the following PostgreSQL-compatible syntax:
96
101
102
+
{% include copy-clipboard.html %}
97
103
~~~sql
98
104
> CREATE INDEX ON users USING GIN (profile);
99
105
~~~
@@ -102,6 +108,7 @@ The above example is equivalent to the following PostgreSQL-compatible syntax:
102
108
103
109
Storing a column improves the performance of queries that retrieve (but don’t filter) its values.
104
110
111
+
{% include copy-clipboard.html %}
105
112
~~~sql
106
113
> CREATE INDEX ON products (price) STORING (name);
107
114
~~~
@@ -112,6 +119,7 @@ However, to use stored columns, queries must filter another column in the same i
112
119
113
120
To sort columns in descending order, you must explicitly set the option when creating the index. (Ascending order is the default.)
114
121
122
+
{% include copy-clipboard.html %}
115
123
~~~sql
116
124
> CREATE INDEX ON products (price DESC, stock);
117
125
~~~
@@ -122,6 +130,7 @@ How columns are sorted impacts the order of rows returned by queries using the i
122
130
123
131
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).
124
132
133
+
{% include copy-clipboard.html %}
125
134
~~~sql
126
135
> SHOW INDEX FROM products;
127
136
~~~
@@ -135,6 +144,8 @@ Normally, CockroachDB selects the index that it calculates will scan the fewest
0 commit comments