Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nextchanges/bundles/duration-timestamp-diff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the direct engine silently ignoring edits to duration and timestamp fields, such as a Lakebase endpoint's `suspend_timeout_duration`. Such a change planned `0 to change` and was never applied.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bundle:
name: recreate-postgres-branch-fork-$UNIQUE_NAME

sync:
paths: []

resources:
postgres_projects:
my_project:
project_id: test-pg-proj-$UNIQUE_NAME
display_name: "Test Project for Branch Fork Point"
pg_version: 16

postgres_branches:
dev_branch:
parent: ${resources.postgres_projects.my_project.id}
branch_id: dev-branch
no_expiry: true
source_branch: ${resources.postgres_projects.my_project.id}/branches/production
source_branch_time: "2026-01-01T00:00:00Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"action": "recreate",
"changes": {
"no_expiry": {
"action": "skip",
"reason": "spec:input_only",
"old": true,
"new": true
},
"source_branch": {
"action": "skip",
"reason": "spec:input_only",
"old": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production",
"new": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production"
},
"source_branch_time": {
"action": "recreate",
"reason": "spec:immutable",
"old": "[FORK_TIME_BEFORE]",
"new": "[FORK_TIME_AFTER]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"action": "recreate",
"changes": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"method": "DELETE",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch"
}
{
"method": "POST",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches",
"q": {
"branch_id": "dev-branch"
},
"body": {
"spec": {
"no_expiry": true,
"source_branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production",
"source_branch_time": "[FORK_TIME_AFTER]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"method": "DELETE",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch"
}
{
"method": "POST",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches",
"q": {
"branch_id": "dev-branch"
},
"body": {
"parent": "projects/test-pg-proj-[UNIQUE_NAME]",
"spec": {
"no_expiry": true,
"source_branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production",
"source_branch_time": "[FORK_TIME_AFTER]"
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

=== Initial deployment
>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/recreate-postgres-branch-fork-[UNIQUE_NAME]/default/files...
Created postgres_branches.dev_branch
Created postgres_projects.my_project
Files: 0 uploaded, 0 deleted
Resources: 2 created, 0 changed, 0 deleted, 0 unchanged

=== Change the fork point: source_branch_time is immutable, so this recreates
>>> update_file.py databricks.yml [FORK_TIME_BEFORE] [FORK_TIME_AFTER]

>>> [CLI] bundle plan
recreate postgres_branches.dev_branch

Plan: 1 to add, 0 to change, 1 to delete, 1 unchanged

>>> [CLI] bundle plan -o json

>>> [CLI] bundle deploy --auto-approve
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/recreate-postgres-branch-fork-[UNIQUE_NAME]/default/files...

This action will result in the deletion or recreation of the following Lakebase branches.
All data stored in them will be permanently lost:
recreate resources.postgres_branches.dev_branch
Recreated postgres_branches.dev_branch
Files: 0 uploaded, 0 deleted
Resources: 1 created, 0 changed, 1 deleted, 1 unchanged

>>> print_requests.py --del-body project_id,branch_id --sort //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.postgres_branches.dev_branch
delete resources.postgres_projects.my_project

This action will result in the deletion of the following Lakebase projects along with
all their branches, databases, and endpoints. All data stored in them will be permanently lost:
delete resources.postgres_projects.my_project

This action will result in the deletion of the following Lakebase branches.
All data stored in them will be permanently lost:
delete resources.postgres_branches.dev_branch

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/recreate-postgres-branch-fork-[UNIQUE_NAME]/default

Destroy: 2 deleted
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

title "Initial deployment"
trace $CLI bundle deploy
rm -f out.requests.txt

title "Change the fork point: source_branch_time is immutable, so this recreates"
trace update_file.py databricks.yml "2026-01-01T00:00:00Z" "2026-02-01T00:00:00Z"
trace $CLI bundle plan
trace $CLI bundle plan -o json | jq '.plan."resources.postgres_branches.dev_branch" | {action, changes}' > out.plan.$DATABRICKS_BUNDLE_ENGINE.json
rm -f out.requests.txt
trace $CLI bundle deploy --auto-approve
trace print_requests.py --del-body project_id,branch_id --sort '//postgres' '^//workspace-files/' '^//workspace/' '^//telemetry-ext' '^//operations/' > out.requests.$DATABRICKS_BUNDLE_ENGINE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Distinct from the other duration/timestamp tests: source_branch_time is
# immutable, so a change recreates the branch rather than updating it. Before the
# diffing fix the change was invisible and the branch was silently left on its old
# fork point.
#
# Local only: the fork point has to be a real instant in the source branch's
# history, so the literal timestamps here are not valid against a live workspace.
Cloud = false

[[Repls]]
Old = '2026-01-01T00:00:00Z'
New = '[FORK_TIME_BEFORE]'
Order = 1

[[Repls]]
Old = '2026-02-01T00:00:00Z'
New = '[FORK_TIME_AFTER]'
Order = 1
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# branch but absent on the default branch, so the null-drop keeps the projection
# valid for both shapes.
branch_fields() {
jq '{branch_id, name, parent, status: (.status | {branch_id, current_state, default, is_protected, source_branch, source_branch_lsn, source_branch_time, state_change_time} | with_entries(select(.value != null))), uid}'
jq '{branch_id, name, parent, status: (.status | {branch_id, current_state, default, expire_time, is_protected, source_branch, source_branch_lsn, source_branch_time, state_change_time} | with_entries(select(.value != null))), uid}'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bundle:
name: update-postgres-branch-expire-$UNIQUE_NAME

sync:
paths: []

resources:
postgres_projects:
my_project:
project_id: test-pg-proj-$UNIQUE_NAME
display_name: "Test Project for Branch Expire Update"
pg_version: 16

postgres_branches:
dev_branch:
parent: ${resources.postgres_projects.my_project.id}
branch_id: dev-branch
expire_time: "2030-01-01T00:00:00Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"branch_id": "dev-branch",
"name": "projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch",
"parent": "projects/test-pg-proj-[UNIQUE_NAME]",
"status": {
"branch_id": "dev-branch",
"current_state": "READY",
"default": false,
"expire_time": "[EXPIRE_TIME_BEFORE]",
"is_protected": false,
"source_branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production",
"source_branch_lsn": "[LSN]",
"source_branch_time": "[TIMESTAMP]",
"state_change_time": "[TIMESTAMP]"
},
"uid": "[BRANCH_UID]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"branch_id": "dev-branch",
"name": "projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch",
"parent": "projects/test-pg-proj-[UNIQUE_NAME]",
"status": {
"branch_id": "dev-branch",
"current_state": "READY",
"default": false,
"expire_time": "[EXPIRE_TIME_AFTER]",
"is_protected": false,
"source_branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production",
"source_branch_lsn": "[LSN]",
"source_branch_time": "[TIMESTAMP]",
"state_change_time": "[TIMESTAMP]"
},
"uid": "[BRANCH_UID]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-postgres-branch-expire-[UNIQUE_NAME]/default/files...
Error: cannot update resources.postgres_branches.dev_branch: updating id=projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch: Unknown field path in update_mask: 'spec.expire_time' (400 INVALID_PARAMETER_VALUE)

Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch?update_mask=spec.expire_time
HTTP Status: 400 Bad Request
API error_code: INVALID_PARAMETER_VALUE
API message: Unknown field path in update_mask: 'spec.expire_time'

Files: 0 uploaded, 0 deleted

Exit code: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-postgres-branch-expire-[UNIQUE_NAME]/default/files...
Updated postgres_branches.dev_branch
Files: 0 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 1 unchanged
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"action": "update",
"changes": {
"expire_time": {
"action": "update",
"old": "[EXPIRE_TIME_BEFORE]",
"new": "[EXPIRE_TIME_AFTER]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"action": "update",
"changes": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"method": "PATCH",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch",
"q": {
"update_mask": "spec.expire_time"
},
"body": {
"spec": {
"expire_time": "[EXPIRE_TIME_AFTER]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"method": "PATCH",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch",
"q": {
"update_mask": "spec"
},
"body": {
"name": "projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch",
"parent": "projects/test-pg-proj-[UNIQUE_NAME]",
"spec": {
"expire_time": "[EXPIRE_TIME_AFTER]"
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

=== Initial deployment
>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-postgres-branch-expire-[UNIQUE_NAME]/default/files...
Created postgres_branches.dev_branch
Created postgres_projects.my_project
Files: 0 uploaded, 0 deleted
Resources: 2 created, 0 changed, 0 deleted, 0 unchanged

>>> [CLI] postgres get-branch projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch
{
"branch_id": "dev-branch",
"name": "projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch",
"parent": "projects/test-pg-proj-[UNIQUE_NAME]",
"status": {
"branch_id": "dev-branch",
"current_state": "READY",
"default": false,
"expire_time": "[EXPIRE_TIME_BEFORE]",
"is_protected": false,
"source_branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production",
"source_branch_lsn": "[LSN]",
"source_branch_time": "[TIMESTAMP]",
"state_change_time": "[TIMESTAMP]"
},
"uid": "[BRANCH_UID]"
}

=== Change expire_time: both engines plan it, only terraform applies it
>>> update_file.py databricks.yml [EXPIRE_TIME_BEFORE] [EXPIRE_TIME_AFTER]

>>> [CLI] bundle plan
update postgres_branches.dev_branch

Plan: 0 to add, 1 to change, 0 to delete, 1 unchanged

>>> [CLI] bundle plan -o json

>>> print_requests.py --del-body project_id,branch_id --sort //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/

>>> [CLI] postgres get-branch projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.postgres_branches.dev_branch
delete resources.postgres_projects.my_project

This action will result in the deletion of the following Lakebase projects along with
all their branches, databases, and endpoints. All data stored in them will be permanently lost:
delete resources.postgres_projects.my_project

This action will result in the deletion of the following Lakebase branches.
All data stored in them will be permanently lost:
delete resources.postgres_branches.dev_branch

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/update-postgres-branch-expire-[UNIQUE_NAME]/default

Destroy: 2 deleted
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

branch_name="projects/test-pg-proj-${UNIQUE_NAME}/branches/dev-branch"

title "Initial deployment"
trace $CLI bundle deploy
rm -f out.requests.txt
trace $CLI postgres get-branch "${branch_name}" | branch_fields

title "Change expire_time: both engines plan it, only terraform applies it"
trace update_file.py databricks.yml "2030-01-01T00:00:00Z" "2031-06-15T12:00:00Z"

# Only terraform applies it: expire_time is a member of the
# expiration oneof, and the direct engine masks it under its own name. See test.toml.
trace $CLI bundle plan
trace $CLI bundle plan -o json | jq '.plan."resources.postgres_branches.dev_branch" | {action, changes}' > out.plan.$DATABRICKS_BUNDLE_ENGINE.json
rm -f out.requests.txt
errcode $CLI bundle deploy &> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt
trace print_requests.py --del-body project_id,branch_id --sort '//postgres' '^//workspace-files/' '^//workspace/' '^//telemetry-ext' '^//operations/' > out.requests.$DATABRICKS_BUNDLE_ENGINE.json
trace $CLI postgres get-branch "${branch_name}" | branch_fields > out.branch.$DATABRICKS_BUNDLE_ENGINE.txt
Loading
Loading