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

deprecate pipeline bus v1 #16643

Open
wants to merge 2 commits into
base: 8.x
Choose a base branch
from

Conversation

yaauie
Copy link
Member

@yaauie yaauie commented Nov 5, 2024

Release notes

  • Deprecates v1 of the pipeline bus; the v2 implementation has been the default since its introduction in Logstash 8.15.0

What does this PR do?

Adds a deprecation warning if Logstash is configured to use the legacy v1 pipeline bus. The legacy implementation was replaced with a more-performant one in 8.15.0, and v1 was only left in place as an "escape hatch".

The ability to select v1 implementation is set to be removed on main in advance of 9.0 via #16644

Why is it important/What is the impact to the user?

It guides users away from the original lock-heavy implementation, which was previously only available as an escape hatch and is no longer necessary.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

How to test this PR locally

  1. add -Dlogstash.pipelinebus.implementation=v1 to config/jvm.options
  2. start logstash
  3. observe relevant entry in the deprecation log

@yaauie yaauie mentioned this pull request Nov 5, 2024
2 tasks
@yaauie yaauie changed the title Deprecate pipeline bus v1 deprecate pipeline bus v1 Nov 5, 2024
@yaauie yaauie requested a review from donoghuc November 5, 2024 22:22
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

@donoghuc
Copy link
Member

donoghuc commented Nov 5, 2024

The addition of the logger commit makes sense. Im a bit confused about the retrofit test commit though c51a7d5 is that refactor a general update that is extending a pattern being applied elsewhere you could point me to?

After looking closer:

I see organizational improvements and some more formal coverage of the PipelineBus factory when different configurations are provided using the withSystemProperty helper. Seems reasonable and generally just an improvement to the existing coverage.


// This should unblock the listener thread
bus.unregisterSender(output, addresses);
TimeUnit.SECONDS.toMillis(30);
Copy link
Member

Choose a reason for hiding this comment

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

I think this was just moved around, not introduced but I think its unused.

@yaauie
Copy link
Member Author

yaauie commented Nov 6, 2024

Yeah, the first commit just retrofits tests onto the bit that selects which implementation to use, and needed to wrap the existing @Parameterized tests in a @RunWith(Enclosed.class) so that the new tests would run just once instead of for each possible value of the parameter. I made the change in a separate commit because it doesn't actually change anything.

As you saw, the star of the PR is the second commit, which adds the deprecation log and verifies that it is emitted in the right conditions. In retrospect, the other two tests should have a negative assertion.

I'll add those and bounce it back.

@yaauie yaauie force-pushed the deprecate-pipeline-bus-v1 branch from bf76848 to 93e9155 Compare December 17, 2024 10:18
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

@yaauie yaauie requested a review from donoghuc December 17, 2024 10:36
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@donoghuc donoghuc self-assigned this Dec 17, 2024
case "v1": return new PipelineBusV1();
case "v1":
DEPRECATION_LOGGER.deprecated("The legacy pipeline bus selected with `logstash.pipelinebus.implementation=v1` is deprecated, and will be removed in a future release of Logstash");
return new PipelineBusV1();
Copy link
Member

Choose a reason for hiding this comment

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

It looks like in the case we have an "unknown" configuration setting we "default" to v1 still. Maybe as part of calling out v1 is deprecated we can also change that fallback to also be v2.

diff --git a/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java b/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java
index 487793d62..b10fa6729 100644
--- a/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java
+++ b/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java
@@ -54,7 +54,7 @@ public interface PipelineBus {
             case "v2": return new PipelineBusV2();
             default:
                 LOGGER.warn("unknown pipeline-bus implementation: {}", pipelineBusImplementation);
-                return new PipelineBusV1();
+                return new PipelineBusV2();
         }
     }

@@ -45,7 +48,9 @@ public interface PipelineBus {
static PipelineBus create() {
final String pipelineBusImplementation = System.getProperty("logstash.pipelinebus.implementation", "v2");
switch (pipelineBusImplementation) {
case "v1": return new PipelineBusV1();
case "v1":
DEPRECATION_LOGGER.deprecated("The legacy pipeline bus selected with `logstash.pipelinebus.implementation=v1` is deprecated, and will be removed in a future release of Logstash");
Copy link
Member

Choose a reason for hiding this comment

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

It seems like configuring pipeline bus implementation setting itself is or should be deprecated. Maybe the deprecation should be focused on removing that setting rather than the value it is set to.

Copy link
Member

@donoghuc donoghuc left a comment

Choose a reason for hiding this comment

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

I think the default case for when an unknown setting is encountered should default to v2 https://github.com/elastic/logstash/pull/16643/files#r1889364653

If I understand the introduction of the configuration option for the pipeline bus implementation #16194 it was as a safety latch for any case where using the v2 implementation caused an issue. With the default being v2 and the stability we have observed I would imagine in LS v 9 we would be able to deprecate this configuration option all together (along with replacing v1 with v2). https://github.com/elastic/logstash/pull/16643/files#r1889381525

@donoghuc donoghuc removed their assignment Dec 17, 2024
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.

3 participants