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

[SPARK-44370][CONNECT] Migrate Buf remote generation alpha to remote plugins #41933

Closed
wants to merge 1 commit into from

Conversation

Hisoka-X
Copy link
Member

@Hisoka-X Hisoka-X commented Jul 11, 2023

What changes were proposed in this pull request?

Buf unsupported remote generation alpha at now. Please refer https://buf.build/docs/migration-guides/migrate-remote-generation-alpha/ . We should migrate Buf remote generation alpha to remote plugins by follow the guide.

The CI also broken by this reason.

Why are the changes needed?

Migrate Buf remote generation alpha to remote plugins because remote generation alpha features have been sunset.

Does this PR introduce any user-facing change?

No

How was this patch tested?

exist test

@Hisoka-X
Copy link
Member Author

cc @HyukjinKwon @grundprinzip

@@ -16,18 +16,18 @@
#
version: v1
plugins:
- remote: buf.build/protocolbuffers/plugins/cpp:v3.20.0-1
- plugin: buf.build/protocolbuffers/cpp:v21.7
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure the version should be updated to this, but this (and v3.14.0) is the most older version maintained by the Buf team.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe as follow:

  • plugin: buf.build/grpc/cpp:v1.56.0
    out: gen/proto/cpp
  • plugin: buf.build/protoco
    out: gen/proto/cpp

Its writing is consistent with the original plugin's Ruby.

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

Thanks for taking a look.

Copy link
Contributor

@LuciferYang LuciferYang left a comment

Choose a reason for hiding this comment

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

+1, LGTM

out: gen/proto/cpp
- remote: buf.build/protocolbuffers/plugins/csharp:v3.20.0-1
- plugin: buf.build/protocolbuffers/csharp:v21.7
Copy link
Contributor

Choose a reason for hiding this comment

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

@zhengruifeng
Copy link
Contributor

@LuciferYang @panbingkun @Hisoka-X @HyukjinKwon

do you know what cause this large changes in generated codes? the upgrade to v1.23.1? or this migration?

@LuciferYang
Copy link
Contributor

Can we try revert the version of buf 1.23.1 and only updating the remote-plugins? If don't need to change so much code, I think we can revert buf version before code freeze

@zhengruifeng
Copy link
Contributor

Can we try revert the version of buf 1.23.1 and only updating the remote-plugins? If don't need to change so much code, I think we can revert buf version before code freeze

+1, I prefer avoiding such big change just before code freeze

@Hisoka-X
Copy link
Member Author

Can we try revert the version of buf 1.23.1 and only updating the remote-plugins? If don't need to change so much code, I think we can revert buf version before code freeze

+1 for me. Let's hold this PR until code freeze.

@panbingkun
Copy link
Contributor

panbingkun commented Jul 11, 2023

Let's try revert buf.
Revert pr: #41936

@Hisoka-X
Copy link
Member Author

Let's try revert buf.

I'm not sure it will work or not, because buf version is 1.17.0 in my local. Also will return error.

@zhengruifeng
Copy link
Contributor

@Hisoka-X now the buf version is v1.20.0, would you mind help checking whether this migration still cause codegen changes?

@Hisoka-X
Copy link
Member Author

@LuciferYang @panbingkun @Hisoka-X @HyukjinKwon

do you know what cause this large changes in generated codes? the upgrade to v1.23.1? or this migration?

Seem like come from this PR protocolbuffers/protobuf@ab4585a, this PR first add BuildMessageAndEnumDescriptors method. But don't have enough information. cc @zhengruifeng

@Hisoka-X
Copy link
Member Author

Hisoka-X commented Jul 11, 2023

@Hisoka-X now the buf version is v1.20.0, would you mind help checking whether this migration still cause codegen changes?

I think the main reason are updated protobuf version, not related with buf version. After checked, still will make codegen change.

@zhengruifeng
Copy link
Contributor

but i think we have pinned the version of protobuf

python3.9 -m pip install 'protobuf==3.19.5' 'mypy-protobuf==3.3.0'

@panbingkun
Copy link
Contributor

From the test results, it is not a problem with the Buf version.
image

@Hisoka-X
Copy link
Member Author

but i think we have pinned the version of protobuf

python3.9 -m pip install 'protobuf==3.19.5' 'mypy-protobuf==3.3.0'

If use buf remote plugin, the local pb version will not affected. https://buf.build/docs/generate/usage/#4.-use-remote-plugins

@zhengruifeng
Copy link
Contributor

zhengruifeng commented Jul 11, 2023

From the test results, it is not a problem with the Buf version. image

yeah, this failure actually started before we upgrade buf

@LuciferYang
Copy link
Contributor

From the test results, it is not a problem with the Buf version. image

So even using buf 1.20 cannot avoid a lot of code changes, right? @panbingkun

@zhengruifeng
Copy link
Contributor

if we can not avoid codegen change, then i am fine to upgrade buf to latest

@panbingkun
Copy link
Contributor

From the test results, it is not a problem with the Buf version. image

So even using buf 1.20 cannot avoid a lot of code changes, right? @panbingkun

Yeah.
image

@Hisoka-X
Copy link
Member Author

Hi @zhengruifeng @HyukjinKwon @LuciferYang , the CI passed. I think if we don't have another way to fix CI, maybe we can merge this PR, by the way the change only will affect 3.5.0. If don't want too many codegen changed before code freeze, disable this CI check temporary also will be an option.

@zhengruifeng
Copy link
Contributor

cc @grundprinzip would you mind also taking a look? It seems that we need this PR to enable the python codegen

@grundprinzip
Copy link
Contributor

We have to be careful that the remotely generated protobuf code matches our protobuf version locally because otherwise we will run into compatibility issues. Protobuf had some changes which might cause the large diff in this PR.

What is the diff if we use the 3.14 version of protobuf?

@grundprinzip
Copy link
Contributor

Do we know what the changes in the generated code are?

@grundprinzip
Copy link
Contributor

I think using the 21.7 version might not be very risky, but we should make sure that we stay consistent in our protobuf usage and we need to check if this should apply as well to upgrading the java version.

@Hisoka-X
Copy link
Member Author

Hisoka-X commented Jul 11, 2023

What is the diff if we use the 3.14 version of protobuf?

It will bring more conflict. And this is a downgrade, it will bring more compatibility issue than v21.7
image

Do we know what the changes in the generated code are?

At now. no

we need to check if this should apply as well to upgrading the java version.

After I check, seem unnecessary. In https://github.com/apache/spark/blob/master/pom.xml#L127 , protobuf version in java already are 3.23.2.

@LuciferYang
Copy link
Contributor

Yeah, Java use sbt-protoc or protobuf-maven-plugin, not buf

@panbingkun
Copy link
Contributor

I guess it might be related to this:
https://buf.build/blog/breaking-change-governance/
image

@grundprinzip
Copy link
Contributor

TBH I don't know how exactly to fix this problem. The buf remote plugins don't offer the protobuf version we need, so maybe the fix is to switch from remote to local plugins.

@Hisoka-X
Copy link
Member Author

TBH I don't know how exactly to fix this problem. The buf remote plugins don't offer the protobuf version we need, so maybe the fix is to switch from remote to local plugins.

I'm not sure what the downsides are, but it certainly makes packaging and testing more cumbersome for developers. But it is indeed a feasible solution to the current problem. @HyukjinKwon @zhengruifeng @LuciferYang @panbingkun WDYT?

@grundprinzip
Copy link
Contributor

My suggestion would be to merge the proposed version with v21.7 and assuming that the integration test pass should be still compatible.

This should unblock any new proto changes.

@panbingkun
Copy link
Contributor

@Hisoka-X Local plugins:
https://buf.build/docs/generate/usage/#3.-use-local-plugins

@Hisoka-X
Copy link
Member Author

My suggestion would be to merge the proposed version with v21.7 and assuming that the integration test pass should be still compatible.

This should unblock any new proto changes.

As you said. The CI passed, I think we can use remote plugin for v21.7 now. cc @panbingkun

@HyukjinKwon
Copy link
Member

Merged to master.

@Hisoka-X
Copy link
Member Author

@Hisoka-X Hisoka-X deleted the SPARK-44370_buf_migrate branch July 13, 2023 02:41
ragnarok56 pushed a commit to ragnarok56/spark that referenced this pull request Mar 2, 2024
…plugins

### What changes were proposed in this pull request?
Buf unsupported remote generation alpha at now. Please refer https://buf.build/docs/migration-guides/migrate-remote-generation-alpha/ . We should migrate Buf remote generation alpha to remote plugins by follow the guide.

The CI also broken by this reason.

### Why are the changes needed?
Migrate Buf remote generation alpha to remote plugins because remote generation alpha features have been sunset.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
exist test

Closes apache#41933 from Hisoka-X/SPARK-44370_buf_migrate.

Authored-by: Jia Fan <fanjiaeminem@qq.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants