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

[fix][build] Fix potential insufficient protostuff-related configs #21629

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

equanz
Copy link
Contributor

@equanz equanz commented Nov 28, 2023

Motivation

Currently, protobuf messages are built by lightproto. Lightproto uses protostuff in build. Protostuff can be configured using system property as follows:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>proto_path</name>
<value>${project.parent.basedir}</value>
</property>
<property>
<name>proto_search_strategy</name>
<value>2</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>proto_path</name>
<value>${project.parent.parent.basedir}</value>
</property>
<property>
<name>proto_search_strategy</name>
<value>2</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>

These configs are held as a static field, so it is impossible to separate each module's settings in a single build phase.
https://github.com/protostuff/protostuff/blob/protostuff-1.7.2/protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java#L38-L39
https://github.com/protostuff/protostuff/blob/protostuff-1.7.2/protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java#L49

For example, if we build as follows, pulsar-transaction/coordinator-specific configs are not used because maven builds pulsar-common first.

$ mvn package -pl pulsar-common,pulsar-transaction/coordinator -am -DskipTests=true

In the first place, there is no need to separate protostuff-related configs for each module, at least at present.

Modifications

  • Add protostuff-related configs to the pulsar parent

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: equanz#4

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Thank you!

One of other approach is to add protostuff-related configs to the pulsar parent

Yes. I wonder if in this way we can remove other configs. Duplicate this config three times seems brittle ..

@Technoboy- Technoboy- added this to the 3.2.0 milestone Dec 6, 2023
@Technoboy- Technoboy- modified the milestones: 3.2.0, 3.3.0 Dec 22, 2023
@equanz equanz force-pushed the modify_protostuff_related_properties branch from 245c42a to c5f5694 Compare January 25, 2024 02:15
@equanz
Copy link
Contributor Author

equanz commented Jan 25, 2024

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4198ed2) 73.61% compared to head (c5f5694) 73.61%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #21629      +/-   ##
============================================
- Coverage     73.61%   73.61%   -0.01%     
- Complexity    32424    32431       +7     
============================================
  Files          1861     1861              
  Lines        138678   138678              
  Branches      15184    15184              
============================================
- Hits         102089   102085       -4     
- Misses        28690    28698       +8     
+ Partials       7899     7895       -4     
Flag Coverage Δ
inttests 24.09% <ø> (-0.01%) ⬇️
systests 23.74% <ø> (-0.02%) ⬇️
unittests 72.90% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 76 files with indirect coverage changes

@equanz
Copy link
Contributor Author

equanz commented Jan 25, 2024

@tisonkun
sorry for the late reply.

Yes. I wonder if in this way we can remove other configs. Duplicate this config three times seems brittle ..

Ok. I've addressed your comment. PTAL

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Thank you!

@tisonkun tisonkun merged commit de4edd0 into apache:master Jan 25, 2024
48 of 49 checks passed
@equanz equanz deleted the modify_protostuff_related_properties branch January 25, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants