Skip to content

Add the upsert logic for updating the recent update timestamp for spanner Node table#513

Merged
shixiao-coder merged 7 commits into
datacommonsorg:masterfrom
shixiao-coder:update-timestamp-field-into-spanner
May 27, 2026
Merged

Add the upsert logic for updating the recent update timestamp for spanner Node table#513
shixiao-coder merged 7 commits into
datacommonsorg:masterfrom
shixiao-coder:update-timestamp-field-into-spanner

Conversation

@shixiao-coder
Copy link
Copy Markdown
Contributor

This PR added the mutation logic to update the timestamp based on the insert/update logic from spanner table instruction https://docs.cloud.google.com/spanner/docs/commit-timestamp-postgresql#update-row

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a last_update_timestamp column to the Node table schema and updates SpannerClient.java to populate this field with the commit timestamp during node mutations. The reviewer noted that existing databases will not automatically receive this new column, which could lead to runtime write failures, and suggested applying a manual migration or updating the initialization logic. Additionally, the reviewer recommended adding unit tests to verify the mutation builder logic.

Comment thread pipeline/spanner/src/main/resources/spanner_schema.sql
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 26, 2026

Not up to standards ⛔

🔴 Issues 2 minor

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
CodeStyle 2 minor

View in Codacy

🟢 Metrics 0 complexity · 2 duplication

Metric Results
Complexity 0
Duplication 2

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@shixiao-coder shixiao-coder requested review from gmechali and vish-cs May 26, 2026 18:17
Copy link
Copy Markdown
Contributor

@gmechali gmechali left a comment

Choose a reason for hiding this comment

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

Couple nits but LGTM otherwise.

I just want to be very careful with the rollout of this - if any instance trying to run this doesnt have the last_update_timestamp, I think it would fail.

So the question is.... is there any instance that doesnt have that column?
For DCP, we're fine to proceed. Any base DC spanner DBs without this column? @vish-cs @keyurva

@shixiao-coder shixiao-coder merged commit 91d2374 into datacommonsorg:master May 27, 2026
9 of 10 checks passed
@shixiao-coder shixiao-coder deleted the update-timestamp-field-into-spanner branch May 27, 2026 17:50
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