Skip to content

Conversation

@stephencompall-DA
Copy link
Contributor

@stephencompall-DA stephencompall-DA commented Jun 10, 2025

Fixes #1060. Tested by deploying scratchb with the new SV1_SCAN_BIGQUERY variable, manually removing the replication slot and publication from the CloudSQL instance (and disabling the variable), and reapplying.

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

Signed-off-by: Stephen Compall <[email protected]>
Signed-off-by: Stephen Compall <[email protected]>
Revocations still not enough:

 -  gcp:sql:User sv-1-user-bqdatastream deleting (1s) error:   sdk-v2/provider2.go:566: sdk.helper_schema: Error, failed to deleteuser bqdatastream in instance sv-1-cn-apps-pg-2964ec6: googleapi: Error 400: Invalid request: failed to delete user bqdatastream: . role "bqdatastream" cannot be dropped because some objects depend on it Details: 32 objects in database scan_sv_1., invalid: [email protected]

Signed-off-by: Stephen Compall <[email protected]>
Signed-off-by: Stephen Compall <[email protected]>
…are-devnet-bigquery

[ci]

Signed-off-by: Stephen Compall <[email protected]>
@stephencompall-DA stephencompall-DA marked this pull request as ready for review June 10, 2025 19:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prepares for conditional activation (and later deactivation) of BigQuery scanning for the SV1 service by adding an environment flag and refactoring SQL import commands.

  • Introduce SV1_SCAN_BIGQUERY env flag to toggle scanBigQuery config in svConfigs.ts
  • Add retainOnDelete to the Postgres replicator user and extract common shell command chunks into databaseCommandBracket in bigQuery.ts
  • Refactor createPublicationAndReplicationSlots to use the new header/footer helper

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cluster/pulumi/common-sv/src/svConfigs.ts Add SV1_SCAN_BIGQUERY flag and conditional scanBigQuery
cluster/pulumi/canton-network/src/bigQuery.ts Refactor SQL import commands into databaseCommandBracket, update replicator user creation
Comments suppressed due to low confidence (2)

cluster/pulumi/common-sv/src/svConfigs.ts:63

  • Consider adding unit or integration tests to verify that enabling or disabling SV1_SCAN_BIGQUERY correctly includes or omits the scanBigQuery configuration.
...(sv1ScanBigQuery
          ? { scanBigQuery: { dataset: 'mainnet_da2_scan', prefix: 'da2' } }

cluster/pulumi/canton-network/src/bigQuery.ts:314

  • [nitpick] The constant name is very generic. Rename it to something like resourceName or userResourceName for clearer intent.
const name = `${postgres.namespace.logicalName}-user-${replicatorUserName}`;

}
);
}

Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

[nitpick] Add a doc comment above databaseCommandBracket explaining its purpose and the structure of the header/footer shapes to improve readability and maintainability.

Suggested change
/**
* Generates a set of shell commands for managing temporary SQL files and importing them into a Cloud SQL database.
*
* @param postgres - The CloudPostgres instance containing database and service account details.
* @returns An object with `header` and `footer` properties:
* - `header`: A shell script segment that sets up a temporary GCS bucket, grants access, and prepares a SQL file.
* - `footer`: A shell script segment that uploads the SQL file to GCS, imports it into the database, and cleans up resources.
*/

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ray-roestenburg-da ray-roestenburg-da left a comment

Choose a reason for hiding this comment

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

Thanks!

@stephencompall-DA stephencompall-DA merged commit 5094952 into main Jun 11, 2025
60 checks passed
@stephencompall-DA stephencompall-DA deleted the s11/prepare-devnet-bigquery branch June 11, 2025 13:44
@stephencompall-DA stephencompall-DA changed the title prepare for DevNet BigQuery activation, then later deactivation SV1_SCAN_BIGQUERY deployment var; allow BQ-only cleanup Jun 11, 2025
stephencompall-DA added a commit that referenced this pull request Jun 11, 2025
* SV1_SCAN_BIGQUERY env option

* remove bqdatastream cleanup, just leave the user alive

Revocations still not enough:

 -  gcp:sql:User sv-1-user-bqdatastream deleting (1s) error:   sdk-v2/provider2.go:566: sdk.helper_schema: Error, failed to deleteuser bqdatastream in instance sv-1-cn-apps-pg-2964ec6: googleapi: Error 400: Invalid request: failed to delete user bqdatastream: . role "bqdatastream" cannot be dropped because some objects depend on it Details: 32 objects in database scan_sv_1., invalid: [email protected]

Signed-off-by: Stephen Compall <[email protected]>
stephencompall-DA added a commit that referenced this pull request Jun 11, 2025
* SV1_SCAN_BIGQUERY env option

* remove bqdatastream cleanup, just leave the user alive

Revocations still not enough:

 -  gcp:sql:User sv-1-user-bqdatastream deleting (1s) error:   sdk-v2/provider2.go:566: sdk.helper_schema: Error, failed to deleteuser bqdatastream in instance sv-1-cn-apps-pg-2964ec6: googleapi: Error 400: Invalid request: failed to delete user bqdatastream: . role "bqdatastream" cannot be dropped because some objects depend on it Details: 32 objects in database scan_sv_1., invalid: [email protected]

Signed-off-by: Stephen Compall <[email protected]>
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.

prepare for DevNet BigQuery activation, then later deactivation

3 participants