Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c2c: introduce SHOW TENANT to surface information about a tenant record #91261

Closed
1 of 2 tasks
adityamaru opened this issue Nov 4, 2022 · 2 comments · Fixed by #92628
Closed
1 of 2 tasks

c2c: introduce SHOW TENANT to surface information about a tenant record #91261

adityamaru opened this issue Nov 4, 2022 · 2 comments · Fixed by #92628
Assignees
Labels
A-disaster-recovery C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-disaster-recovery

Comments

@adityamaru
Copy link
Contributor

adityamaru commented Nov 4, 2022

  • SHOW TENANT <name> to begin with, surface a single column indicating the state of the tenant i.e. active, offline, replicating etc.

  • SHOW TENANT <name> WITH REPLICATION STATUS - if the tenant is being streamed into, then we surface more information pertaining to the stream such as:

  1. Source tenant name
  2. Source cluster URI
  3. Ingestion Job ID
  4. Latest fully ingested time (newest time available to complete to)
  5. Protected time (oldest time available to complete to)
  6. Total replicated bytes (we decided to have the replicated bytes as a metric, at least for now)

Jira issue: CRDB-21177

Epic CRDB-18749

@adityamaru adityamaru added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-disaster-recovery labels Nov 4, 2022
@blathers-crl
Copy link

blathers-crl bot commented Nov 4, 2022

cc @cockroachdb/disaster-recovery

@lidorcarmel lidorcarmel self-assigned this Nov 8, 2022
lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Nov 17, 2022
This change adds:

`SHOW TENANT <name>`

To show the id, name and status of the tenant. The status can be
ACTIVE/ADD/DROP.

The next step is to extend this to show replication status (more details
in cockroachdb#91261).

For example:
```
root@localhost:26257/defaultdb> show tenant my_tenant;
  id |   name    | status
-----+-----------+---------
   6 | my_tenant | ACTIVE
(1 row)

Time: 2ms total (execution 2ms / network 0ms)

root@localhost:26257/defaultdb> show tenant not_my_tenant;
ERROR: tenant "not_my_tenant" does not exist
SQLSTATE: 42704
```

Informs: cockroachdb#91261

Release note: None

Epic CRDB-18749
lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Nov 17, 2022
This change adds:

`SHOW TENANT <name>`

To show the id, name and status of the tenant. The status can be
ACTIVE/ADD/DROP.

The next step is to extend this to show replication status (more details
in cockroachdb#91261).

For example:
```
root@localhost:26257/defaultdb> show tenant my_tenant;
  id |   name    | status
-----+-----------+---------
   6 | my_tenant | ACTIVE
(1 row)

Time: 2ms total (execution 2ms / network 0ms)

root@localhost:26257/defaultdb> show tenant not_my_tenant;
ERROR: tenant "not_my_tenant" does not exist
SQLSTATE: 42704
```

Informs: cockroachdb#91261

Release note: None

Epic CRDB-18749
craig bot pushed a commit that referenced this issue Nov 18, 2022
91939: sql: introduce SHOW TENANT <name> r=lidorcarmel a=lidorcarmel

This change adds:

`SHOW TENANT <name>`

To show the id, name and status of the tenant. The status can be ACTIVE/ADD/DROP.

The next step is to extend this to show replication status (more details
in #91261).

For example:
```
root@localhost:26257/defaultdb> show tenant my_tenant;
  id |   name    | status
-----+-----------+---------
   6 | my_tenant | ACTIVE
(1 row)


Time: 2ms total (execution 2ms / network 0ms)

root@localhost:26257/defaultdb> show tenant not_my_tenant;
ERROR: tenant "not_my_tenant" does not exist
SQLSTATE: 42704
```

Informs: #91261

Release note: None

Epic CRDB-18749

Co-authored-by: Lidor Carmel <[email protected]>
lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Nov 29, 2022
Extending SHOW TENANT to also allow showing replication status which
contains info such as the protected timestamp on the destination cluster
and the source cluster name.

Informs: cockroachdb#91261

Epic: CRDB-18749

Release note: None
lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Dec 2, 2022
Extending SHOW TENANT to also allow showing replication status which
contains info such as the protected timestamp on the destination cluster
and the source cluster name.

Informs: cockroachdb#91261

Epic: CRDB-18749

Release note: None
@adityamaru
Copy link
Contributor Author

Noting some more things we want in SHOW TENANT FROM REPLICATION STATUS that can be implemented as a follow up:

  1. Error string if the replication job is paused in a failed state.
  2. Add a timestamp that tracks the maximum flushed time. This gives a sense of how much “time” we have to revert if we are to cutover to the frontier timestamp.
  3. Potentially, the revert range progress.

lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Dec 6, 2022
Extending SHOW TENANT to also allow showing replication status which
contains info such as the protected timestamp on the destination cluster
and the source cluster name.

Command output right after the destination cluster is created:

```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri | replication_job_id | replicated_time | retained_time
-----+-------+--------+--------------------+--------------------+--------------------+-----------------+----------------
   7 | dest5 | ADD    | NULL               | NULL               | 819890711267737601 | NULL            | NULL
(1 row)
```

A bit later we have most stats:
```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri                                    | replication_job_id | replicated_time |       retained_time
-----+-------+--------+--------------------+-------------------------------------------------------+--------------------+-----------------+-----------------------------
   7 | dest5 | ADD    | src                | postgresql://[email protected]:26257/defaultdb?ssl...crt | 819890711267737601 | NULL            | 2022-12-05 23:00:04.516331
(1 row)
```

And a moment later the replication time is populated.

Informs: cockroachdb#91261

Epic: CRDB-18749

Release note: None
lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Dec 6, 2022
Extending SHOW TENANT to also allow showing replication status which
contains info such as the protected timestamp on the destination cluster
and the source cluster name.

Command output right after the destination cluster is created:

```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri | replication_job_id | replicated_time | retained_time
-----+-------+--------+--------------------+--------------------+--------------------+-----------------+----------------
   7 | dest5 | ADD    | NULL               | NULL               | 819890711267737601 | NULL            | NULL
(1 row)
```

A bit later we have most stats (manually adjusting the source_cluster_uri):
```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri                                    | replication_job_id | replicated_time |       retained_time
-----+-------+--------+--------------------+-------------------------------------------------------+--------------------+-----------------+-----------------------------
   7 | dest5 | ADD    | src                | postgresql://[email protected]:26257/defaultdb?ssl...crt | 819890711267737601 | NULL            | 2022-12-05 23:00:04.516331
(1 row)
```

And a moment later the replication time is populated.

Informs: cockroachdb#91261

Epic: CRDB-18749

Release note: None
lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Dec 7, 2022
Extending SHOW TENANT to also allow showing replication status which
contains info such as the protected timestamp on the destination cluster
and the source cluster name.

Command output right after the destination cluster is created:

```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri | replication_job_id | replicated_time | retained_time
-----+-------+--------+--------------------+--------------------+--------------------+-----------------+----------------
   7 | dest5 | ADD    | NULL               | NULL               | 819890711267737601 | NULL            | NULL
(1 row)
```

A bit later we have most stats (manually adjusting the source_cluster_uri):
```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri                                    | replication_job_id | replicated_time |       retained_time
-----+-------+--------+--------------------+-------------------------------------------------------+--------------------+-----------------+-----------------------------
   7 | dest5 | ADD    | src                | postgresql://[email protected]:26257/defaultdb?ssl...crt | 819890711267737601 | NULL            | 2022-12-05 23:00:04.516331
(1 row)
```

And a moment later the replication time is populated.

Informs: cockroachdb#91261

Epic: CRDB-18749

Release note: None
lidorcarmel added a commit to lidorcarmel/cockroach that referenced this issue Dec 8, 2022
Extending SHOW TENANT to also allow showing replication status which
contains info such as the protected timestamp on the destination cluster
and the source cluster name.

Command output right after the destination cluster is created:

```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri | replication_job_id | replicated_time | retained_time
-----+-------+--------+--------------------+--------------------+--------------------+-----------------+----------------
   7 | dest5 | ADD    | NULL               | NULL               | 819890711267737601 | NULL            | NULL
(1 row)
```

A bit later we have most stats (manually adjusting the source_cluster_uri):
```
[email protected]:26257/defaultdb> show tenant dest5 with replication status;
  id | name  | status | source_tenant_name | source_cluster_uri                                    | replication_job_id | replicated_time |       retained_time
-----+-------+--------+--------------------+-------------------------------------------------------+--------------------+-----------------+-----------------------------
   7 | dest5 | ADD    | src                | postgresql://[email protected]:26257/defaultdb?ssl...crt | 819890711267737601 | NULL            | 2022-12-05 23:00:04.516331
(1 row)
```

And a moment later the replication time is populated.

Informs: cockroachdb#91261

Epic: CRDB-18749

Release note: None
@craig craig bot closed this as completed in fe683e3 Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-disaster-recovery C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-disaster-recovery
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants