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

[Bug]: LocalSpannerIO package namespace conflict with Beam's SpannerIO #1362

Open
Abacn opened this issue Mar 13, 2024 · 2 comments · May be fixed by #1429
Open

[Bug]: LocalSpannerIO package namespace conflict with Beam's SpannerIO #1362

Abacn opened this issue Mar 13, 2024 · 2 comments · May be fixed by #1429
Assignees
Labels
bug Something isn't working needs triage p2

Comments

@Abacn
Copy link
Contributor

Abacn commented Mar 13, 2024

Related Template(s)

V1

Template Version

N/A

What happened?

V1 templates use LocalSpannerIO under Beam's namespace: https://github.com/GoogleCloudPlatform/DataflowTemplates/tree/main/v1/src/main/java/org/apache/beam/sdk/io/gcp/spanner and depends on beam-sdks-java-io-google-cloud-platform as well, causing unpredictable class conflict.

It happens in the 2.55.0 release validation: #1361 SpannerIO V1 templates failed with error

Caused by: java.lang.NoSuchMethodError: 'org.apache.beam.sdk.options.ValueProvider org.apache.beam.sdk.io.gcp.spanner.SpannerConfig.getCredentials()'
	at org.apache.beam.sdk.io.gcp.spanner.SpannerAccessor.buildSpannerOptions(SpannerAccessor.java:228)
	at org.apache.beam.sdk.io.gcp.spanner.SpannerAccessor.createAndConnect(SpannerAccessor.java:237)
	at org.apache.beam.sdk.io.gcp.spanner.SpannerAccessor.getOrCreate(SpannerAccessor.java:94)
	at org.apache.beam.sdk.io.gcp.spanner.LocalSpannerAccessor.getOrCreate(LocalSpannerAccessor.java:57)
	at com.google.cloud.teleport.templates.common.SpannerConverters$CreateTransactionFnWithTimestamp.setup(SpannerConverters.java:766

because SpannerAccessor was picked from beam-io-gcp but SpannerConfig was picked from v1 at run time, causing NoSuchMethodError.

We should either relocate the namespace of LocalSpannerIO or migrate to Beam's SpannerIO

Relevant log output

No response

@Abacn Abacn added bug Something isn't working p2 needs triage labels Mar 13, 2024
@Abacn Abacn self-assigned this Mar 13, 2024
@Abacn
Copy link
Contributor Author

Abacn commented Mar 13, 2024

Even removed duplicate classes and only preserve Localxxxx srcs, there are still test failing. Found that compilation of v1/ still generates many AUtoValue_* classes:

image

Also uploaded a reproduce at https://github.com/Abacn/codesnippets/tree/master/AutoValueTest , this might be an auto value bug

@Abacn
Copy link
Contributor Author

Abacn commented Mar 13, 2024

As a result we cannot partially remove the duplicated sources. We either need to keep sync with Beam or remove them altogether. entered autovalue bug google/auto#1734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant