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

feat!: [Spanner] Upgrade to V2 #7193

Open
wants to merge 80 commits into
base: main
Choose a base branch
from
Open

feat!: [Spanner] Upgrade to V2 #7193

wants to merge 80 commits into from

Conversation

ajupazhamayil
Copy link
Contributor

@ajupazhamayil ajupazhamayil commented Apr 1, 2024

Spanner V2:

Part 1:

  • Replacing Connection object with RequestHandler [Operation class]
  • Replacing Connection object with RequestHandler [Database class]
  • Replacing Connection object with RequestHandler [Session class]
  • Replacing Connection object with RequestHandler [CacheSessionPool class]
  • Introduce LongRunningOperationsManager [Replacing Connection object with RequestHandler in Core's LongRunningOperation]

Part 2:

  • Replacing Connection object with RequestHandler [Backup class]
  • Replacing Connection object with RequestHandler [Instance class]
  • Replacing Connection object with RequestHandler [InstanceConfiguration class]
  • Replacing Connection object with RequestHandler [SpannerClient]
  • Remove Connection Classes and Directory 🎉

Tests:

  • System tests
  • Unit tests
  • Snippet tests
  • System tests
  • Unit tests
  • Snippet tests

Related work:

  • Migration.md file
  • Update Admin Clients to Use V2 OperationsClient [GAPIC generator change] [See @todo in Spanner/src/Admin/Database/V1/Client/DatabaseAdminClient.php] : This is replaced with the migration status changes.

BREAKING_CHANGE_REASON=RC-1 for the version 2 of the Spanner library.

@ajupazhamayil ajupazhamayil force-pushed the spanner-v2 branch 2 times, most recently from 843be5e to 55a81e9 Compare April 1, 2024 18:01
Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

I see this is in draft mode, but the design is confusing to me. Do you have a document or anything to describe this approach?

Core/src/LongRunning/LROTraitV2.php Outdated Show resolved Hide resolved
Core/src/LongRunning/LROTraitV2.php Outdated Show resolved Hide resolved
@ajupazhamayil
Copy link
Contributor Author

I see this is in draft mode, but the design is confusing to me. Do you have a document or anything to describe this approach?

We did not create any design document for these changes. We are following a V2 parent doc drafted by @saranshdhingra. Basically we are trying to remove usage of connection class objects and replace the usage with RequestHandler

Please let me know if you would like me to create a doc for this purpose.

@ajupazhamayil ajupazhamayil changed the title feat!: [Spanner] Upgrade to PHP V2 feat!: [Spanner] Upgrade to PHP V2 [Database + Operation] May 16, 2024
@ajupazhamayil ajupazhamayil changed the title feat!: [Spanner] Upgrade to PHP V2 [Database + Operation] feat!: [Spanner] Upgrade to PHP V2 May 16, 2024
@bshaffer bshaffer changed the title feat!: [Spanner] Upgrade to PHP V2 feat!: [Spanner] Upgrade to V2 May 23, 2024
@ajupazhamayil ajupazhamayil changed the title feat!: [Spanner] Upgrade to V2 feat!: [Spanner] Upgrade to V2 (Part 1/2) May 23, 2024
@ajupazhamayil ajupazhamayil changed the title feat!: [Spanner] Upgrade to V2 (Part 1/2) feat!: [Spanner] Upgrade to V2 Jun 12, 2024
@bshaffer
Copy link
Contributor

The "Prefer Lowest" tests are failing because you've added a new Trait to google/cloud-core, you need to upgrade the minimum version of cloud core specified in Spanner/composer.json

@ajupazhamayil
Copy link
Contributor Author

ajupazhamayil commented Jun 13, 2024

The "Prefer Lowest" tests are failing because you've added a new Trait to google/cloud-core, you need to upgrade the minimum version of cloud core specified in Spanner/composer.json

Great, the test is passing now..

*
* @return array
*/
private function getLROResponseMappers()
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing duplicate data in the handwritten layer that's already being generated and handled by GAPIC is the whole reason we are making the V2 changes, so having all this metadata defined in an array like this is not acceptable.

We can consume the generated data in the GAPIC layer, or use the GAPIC clients directly.

* @param $clientName The class name of the client.
* @param $clientObject The client object to be added.
*/
public function addClientObject(string $clientName, mixed $clientObject)
Copy link
Contributor

@bshaffer bshaffer Jun 26, 2024

Choose a reason for hiding this comment

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

Having public getters and setters for the client objects is hacky and could have unexpected results. This points to a flaw in the design.

array $info = [],
$databaseRole = ''
string $databaseRole = '',
array $config = []
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not like extending our already bloated constructor with another parameter, especially one as generic as $config.

If anything , we should name this $options and combine it with all the other optional parameters.

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.

2 participants