Skip to content

Comments

feat: allow human-readable IDs#57

Merged
jason-lynch merged 1 commit intomainfrom
feat/PLAT-86/human-readable-ids
Jun 17, 2025
Merged

feat: allow human-readable IDs#57
jason-lynch merged 1 commit intomainfrom
feat/PLAT-86/human-readable-ids

Conversation

@jason-lynch
Copy link
Member

@jason-lynch jason-lynch commented Jun 14, 2025

This modifies our API contract to allow human-readable IDs, as opposed to UUIDs, in each user-specified ID field:

  • Cluster ID
  • Host ID
  • Database ID
  • Tenant ID
  • pgBackRest repo IDs

Instance IDs are still deterministically generated from the host ID, database ID, and node name, but are designed to be more readable. For example, given these inputs:

  • Host ID: "us-east-1"
  • Database ID: "my-app"
  • Node name: "n1"

We will generate the instance ID "my-app-n1-n5fe2mcy". We're using a short hash of the host ID rather than the host ID itself to enhance readability when the host IDs are long, such as those used by Cloud. For example, when both the host ID and database ID are UUIDs:

  • Host ID: "dbf5779c-492a-11f0-b11a-1b8cb15693a8"
  • Database ID: "ed2362ea-492a-11f0-956c-9f2171e8b9ab"
  • Node name: "n1"

The instance ID is "ed2362ea-492a-11f0-956c-9f2171e8b9ab-n1-io5979nh"

This commit contains breaking changes for the development environment, so it's recommended to do the following before updating to this commit:

  • Delete all databases via the API
  • Remove existing data directories: rm -rf docker/control-plane-dev/data

This will reset your environment, so you'll need to reinitialize the cluster.

get-database response example with new IDs

{
  "created_at": "2025-06-15T13:20:40Z",
  "id": "my-app2",
  "instances": [
    {
      // ...
      "host_id": "host-1",
      "id": "my-app2-n1-689qacsi",
      "node_name": "n1",
      // ...
    },
    // ...
  ],
  "spec": {
    // ...
    "nodes": [
      {
        "host_ids": [
          "host-1"
        ],
        "name": "n1"
      },
      {
        "host_ids": [
          "host-2"
        ],
        "name": "n2"
      },
      {
        "host_ids": [
          "host-3"
        ],
        "name": "n3"
      }
    ],
    // ...
  },
  // ...
}

PLAT-86

@jason-lynch jason-lynch force-pushed the feat/PLAT-86/human-readable-ids branch 3 times, most recently from 208a3da to fde0f2c Compare June 15, 2025 12:47
@jason-lynch jason-lynch force-pushed the chore/PLAT-86/api-docs-for-development branch 2 times, most recently from ec4cc92 to d026649 Compare June 15, 2025 19:41
@jason-lynch jason-lynch force-pushed the feat/PLAT-86/human-readable-ids branch 2 times, most recently from 87f64ba to 1293ea0 Compare June 16, 2025 11:30
@jason-lynch jason-lynch requested review from mmols and tsivaprasad June 16, 2025 11:40
@jason-lynch jason-lynch force-pushed the feat/PLAT-86/human-readable-ids branch from 1293ea0 to 8511659 Compare June 16, 2025 17:42
@jason-lynch jason-lynch force-pushed the chore/PLAT-86/api-docs-for-development branch from d026649 to f1d628a Compare June 16, 2025 19:05
Base automatically changed from chore/PLAT-86/api-docs-for-development to main June 16, 2025 19:10
@jason-lynch jason-lynch force-pushed the feat/PLAT-86/human-readable-ids branch from 8511659 to ed23079 Compare June 16, 2025 19:12
This modifies our API contract to allow human-readable IDs, as opposed
to UUIDs, in each user-specified ID field:

- Cluster ID
- Host ID
- Database ID
- Tenant ID

Instance IDs are still deterministically generated from the host ID,
database ID, and node name, but are designed to be more readable. For
example, given these inputs:

- Host ID: "us-east-1"
- Database ID: "my-app"
- Node name: "n1"

We will generate the instance ID "my-app-n1-n5fe2mcy". We're using a
short hash of the host ID rather than the host ID itself to enhance
readability when the host IDs are long, such as those used by Cloud.
For example, when both the host ID and database ID are UUIDs:

- Host ID: "dbf5779c-492a-11f0-b11a-1b8cb15693a8"
- Database ID: "ed2362ea-492a-11f0-956c-9f2171e8b9ab"
- Node name: "n1"

The instance ID is "ed2362ea-492a-11f0-956c-9f2171e8b9ab-n1-io5979nh"

This commit contains breaking changes for the development environment,
so it's recommended to do the following before updating to this commit:

- Delete all databases via the API
- Remove existing data directories:
  `rm -rf docker/control-plane-dev/data`

This will reset your environment, so you'll need to reinitialize the
cluster.

PLAT-86
@jason-lynch jason-lynch force-pushed the feat/PLAT-86/human-readable-ids branch from ed23079 to 8647b1a Compare June 17, 2025 11:48
@jason-lynch jason-lynch requested a review from tsivaprasad June 17, 2025 11:55
Copy link
Contributor

@tsivaprasad tsivaprasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jason-lynch jason-lynch merged commit 20aa970 into main Jun 17, 2025
2 checks passed
@jason-lynch jason-lynch deleted the feat/PLAT-86/human-readable-ids branch June 17, 2025 12:07
jason-lynch added a commit that referenced this pull request Jul 21, 2025
We made the node name part of the instance ID in #57. Since the instance
ID is included in the service name and the instance's hostname, it's
unnecessary to also include the node name.

This diff illustrates the change to both the host and service names:

```diff
1c1
< postgres-n1-storefront-n1-689qacsi
---
> postgres-storefront-n1-689qacsi
````

PLAT-188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants