Skip to content

Commit

Permalink
Revisions based on feedback to backup and import
Browse files Browse the repository at this point in the history
  • Loading branch information
katmayb committed Apr 22, 2021
1 parent 0e4a6b8 commit ea66065
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion _includes/v20.2/backups/backup-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
-----------------------------------------------------------------+-------------------------+------------------------------
`revision_history`<a name="with-revision-history"></a> | N/A | Create a backup with full [revision history](take-backups-with-revision-history-and-restore-from-a-point-in-time.html), which records every change made to the cluster within the garbage collection period leading up to and including the given timestamp.
`encryption_passphrase`<a name="with-encryption-passphrase"></a> | [`STRING`](string.html) | The passphrase used to [encrypt the files](take-and-restore-encrypted-backups.html) (`BACKUP` manifest and data files) that the `BACKUP` statement generates. This same passphrase is needed to decrypt the file when it is used to [restore](take-and-restore-encrypted-backups.html) and to list the contents of the backup when using [`SHOW BACKUP`](show-backup.html). There is no practical limit on the length of the passphrase.
`detached` | N/A | <span class="version-tag">New in v20.2:</span> When a backup runs in `detached` mode, the backup job will execute asynchronously and the job ID will be returned immediately without waiting for the job to finish. Note that the job completion status will not be returned. To check on the job status, use the [`SHOW JOBS`](show-jobs.html) statement.
`DETACHED` | N/A | <span class="version-tag">New in v20.2:</span> When a backup runs in `DETACHED` mode, the backup job will execute asynchronously and the job ID will be returned immediately without waiting for the job to finish. Note that the job completion status will not be returned. To check on the job status, use the [`SHOW JOBS`](show-jobs.html) statement. <br><br>To run a backup within a [transaction](transactions.html), use the `DETACHED` option.
`kms` | [`STRING`](string.html) | <span class="version-tag">New in v20.2:</span> The [key management service (KMS) URI](take-and-restore-encrypted-backups.html#aws-kms-uri-format) (or a [comma-separated list of URIs](take-and-restore-encrypted-backups.html#take-a-backup-with-multi-region-encryption)) used to encrypt the files (`BACKUP` manifest and data files) that the `BACKUP` statement generates. This same KMS URI is needed to decrypt the file when it is used to [restore](take-and-restore-encrypted-backups.html#restore-from-an-encrypted-backup-with-aws-kms) and to list the contents of the backup when using [`SHOW BACKUP`](show-backup.html). <br/><br/>Currently, only AWS KMS is supported.
8 changes: 2 additions & 6 deletions v20.2/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ To view the contents of an enterprise backup created with the `BACKUP` statement
`incremental_backup_location` | Create an incremental backup that includes all backups listed at the provided URLs. <br/><br/>Lists of incremental backups must be sorted from oldest to newest. The newest incremental backup's timestamp must be within the table's garbage collection period. <br/><br/>For information about this URL structure, see [Backup File URLs](#backup-file-urls). <br/><br/>For more information about garbage collection, see [Configure Replication Zones](configure-replication-zones.html#replication-zone-variables).
`kv_option_list` | Control the backup behavior with a comma-separated list of [these options](#options).

{{site.data.alerts.callout_info}}
The `BACKUP` statement cannot be used within a [transaction](transactions.html).
{{site.data.alerts.end}}

### Options

{% include {{ page.version.version }}/backups/backup-options.md %}
Expand Down Expand Up @@ -218,14 +214,14 @@ This incremental backup syntax does not work for backups using HTTP storage; you

### Run a backup asynchronously

<span class="version-tag">New in v20.2:</span> Use the `detached` [option](#options) to execute the backup job asynchronously:
<span class="version-tag">New in v20.2:</span> Use the `DETACHED` [option](#options) to execute the backup job asynchronously:

{% include copy-clipboard.html %}
~~~ sql
> BACKUP TO \
'gs://acme-co-backup/test-cluster' \
AS OF SYSTEM TIME '-10s'
WITH detached;
WITH DETACHED;
~~~

The job ID is returned immediately without waiting for the job to finish:
Expand Down
4 changes: 2 additions & 2 deletions v21.1/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ AS OF SYSTEM TIME '-10s';

### Run a backup asynchronously

Use the `detached` [option](#options) to execute the backup [job](show-jobs.html) asynchronously:
Use the `DETACHED` [option](#options) to execute the backup [job](show-jobs.html) asynchronously:

{% include copy-clipboard.html %}
~~~ sql
> BACKUP INTO \
's3://{bucket_name}?AWS_ACCESS_KEY_ID={key_id}&AWS_SECRET_ACCESS_KEY={access_key}' \
AS OF SYSTEM TIME '-10s'
WITH detached;
WITH DETACHED;
~~~

The job ID is returned immediately without waiting for the job to finish:
Expand Down
17 changes: 7 additions & 10 deletions v21.1/import.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The `IMPORT` [statement](sql-statements.html) imports the following types of dat
{{site.data.alerts.end}}

{{site.data.alerts.callout_danger}}
`IMPORT` cannot be used within a [rolling upgrade](upgrade-cockroach-version.html). `IMPORT` can be used in a [transaction](transactions.html) only when the `detached` option is specified, see the [Examples](#examples) section below.
`IMPORT` cannot be used within a [rolling upgrade](upgrade-cockroach-version.html).
{{site.data.alerts.end}}

## Required privileges
Expand Down Expand Up @@ -106,10 +106,7 @@ Key | <div style="width:130px">Context</div> | Value
`data_as_json_records` | `AVRO DATA` | Use when [importing a JSON file containing Avro records](migrate-from-avro.html#import-binary-or-json-records). The schema is not included in the file, so you need to specify the schema with either the `schema` or `schema_uri` option.
`schema` | `AVRO DATA` | The schema of the Avro records included in the binary or JSON file. This is not needed for Avro OCF.
`schema_uri` | `AVRO DATA` | The URI of the file containing the schema of the Avro records include in the binary or JSON file. This is not needed for Avro OCF.
`detached` | N/A | <span class="version-tag">New in v21.1:</span> When running an import using the `detached` option, the import will run asynchronously and return the job ID immediately without waiting for the job to finish. To check on the job status, use the [`SHOW JOBS`](show-jobs.html) statement. <br><br>To run an import within a [transaction](transactions.html), use the `detached` option.

<!--
`experimental_save_rejected` | `CSV DATA` | Skip faulty rows during import and save them in a file called `<original_csv_file>.rejected`. Once the rows are fixed, use this file with [`IMPORT INTO`](import-into.html) to finish the import. **Default:** Off -->
`DETACHED` | N/A | <span class="version-tag">New in v21.1:</span> When running an import using the `DETACHED` option, the import will run asynchronously and return the job ID immediately without waiting for the job to finish. To check on the job status, use the [`SHOW JOBS`](show-jobs.html) statement. <br><br>To run an import within a [transaction](transactions.html), use the `DETACHED` option.

For examples showing how to use these options, see the [Examples](#examples) section below.

Expand Down Expand Up @@ -1035,9 +1032,9 @@ For more detailed information about importing data from Avro and examples, see [

### Run an import within a transaction

<span class="version-tag">New in v21.1:</span> The `detached` option allows an import to be run asynchronously, returning the job ID immediately once initiated. You can run imports within transactions by specifying the `detached` option.
<span class="version-tag">New in v21.1:</span> The `DETACHED` option allows an import to be run asynchronously, returning the job ID immediately once initiated. You can run imports within transactions by specifying the `DETACHED` option.

The following transactions use CSV data as an example. To use the `detached` option with `IMPORT` in a transaction:
The following transactions use CSV data as an example. To use the `DETACHED` option with `IMPORT` in a transaction:

Amazon S3:

Expand All @@ -1055,7 +1052,7 @@ IMPORT TABLE customers (
INDEX name_idx (name)
)
CSV DATA ('s3://acme-co/customers.csv?AWS_ACCESS_KEY_ID=[placeholder]&AWS_SECRET_ACCESS_KEY=[placeholder]&AWS_SESSION_TOKEN=[placeholder]')
WITH detached;
WITH DETACHED;

COMMIT;
~~~
Expand All @@ -1076,7 +1073,7 @@ IMPORT TABLE customers (
INDEX name_idx (name)
)
CSV DATA ('azure://acme-co/customer-import-data.csv?AZURE_ACCOUNT_KEY=hash&AZURE_ACCOUNT_NAME=acme-co')
WITH detached;
WITH DETACHED;

COMMIT;
~~~
Expand All @@ -1097,7 +1094,7 @@ IMPORT TABLE customers (
INDEX name_idx (name)
)
CSV DATA ('gs://acme-co/customers.csv')
WITH detached;
WITH DETACHED;

COMMIT;
~~~
Expand Down

0 comments on commit ea66065

Please sign in to comment.