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

Support compress in forward plugin #1179

Merged
merged 12 commits into from
Sep 13, 2016

Conversation

ganmacs
Copy link
Member

@ganmacs ganmacs commented Aug 24, 2016

Because this PR depends on #1172, please merge this after merging #1172.

This PR closes #504.

@ganmacs ganmacs force-pushed the support-compress-in-forward-plugin branch 2 times, most recently from 44edf57 to 38fc6ac Compare August 26, 2016 05:11
@ganmacs ganmacs changed the title [WIP] Support compress in forward plugin Support compress in forward plugin Aug 26, 2016
@compressed_data = data
end

def dup
Copy link
Member

Choose a reason for hiding this comment

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

This re-implementation looks no need.

Copy link
Member

Choose a reason for hiding this comment

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

Ah... It's better to fix original implementation MessagePackEventStream#dup to use self.class instead of re-implementing this method in subclass.

@tagomoris
Copy link
Member

I added review comments on code.

@ganmacs
Copy link
Member Author

ganmacs commented Aug 29, 2016

@tagomoris
I updated.

@ganmacs ganmacs force-pushed the support-compress-in-forward-plugin branch 5 times, most recently from 9e387f2 to 04d1366 Compare August 31, 2016 09:25
@ganmacs
Copy link
Member Author

ganmacs commented Aug 31, 2016

@tagomoris

I rebased and updated code.

@ganmacs ganmacs force-pushed the support-compress-in-forward-plugin branch 2 times, most recently from 956676f to 18e530f Compare September 1, 2016 02:13
end

def each(&block)
ensure_decompressed! unless @unpacked_times
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary unless

@tagomoris
Copy link
Member

@ganmacs could you rebase/update your change?

@ganmacs
Copy link
Member Author

ganmacs commented Sep 8, 2016

@tagomoris
Rebased 👌

entries = ''
events.each do |_tag, _time, record|
v = ''
[_time, record].to_msgpack(v)
Copy link
Member

Choose a reason for hiding this comment

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

It's already deprecated feature to assign String objects as an argument of #to_msgpack.
Please update the code as v << [_time, record].to_msgpack.

and use event_time
@ganmacs ganmacs force-pushed the support-compress-in-forward-plugin branch 2 times, most recently from b766cb7 to e1bc305 Compare September 12, 2016 06:39
@ganmacs
Copy link
Member Author

ganmacs commented Sep 12, 2016

@tagomoris
Updated. Could you re-review this change?

@times.zip(@records).each do |_time, record|
v = ''
v << [_time, record].to_msgpack
@packed_record += v
Copy link
Member

Choose a reason for hiding this comment

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

@packed_record << [_time, record].to_msgpack looks to work well, and it's simple.

Copy link
Member Author

Choose a reason for hiding this comment

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

oops😨
Thanks. Fixed it.

@ganmacs ganmacs force-pushed the support-compress-in-forward-plugin branch from e1bc305 to 6535ef9 Compare September 12, 2016 07:41
@tagomoris
Copy link
Member

I removed my LGTM, because I found the bug and missing tests, from warning of test results.

/home/travis/build/fluent/fluentd/lib/fluent/plugin/out_forward.rb:444: warning: instance variable @compress not initialized
/home/travis/build/fluent/fluentd/lib/fluent/plugin/out_forward.rb:452: warning: instance variable @compress not initialized

This warning shows that Node instances doesn't have instance variable named as @compress.
Your patch doesn't feed @compress of output plugin into ForwardOutput::Node objects.
So compression transferring is always false in this code.
And there are no tests about it.

@ganmacs
Copy link
Member Author

ganmacs commented Sep 12, 2016

@tagomoris
I fixed a bug that compress option is always :text and added some tests.

@ganmacs ganmacs force-pushed the support-compress-in-forward-plugin branch from f1ed8a8 to 80addd2 Compare September 12, 2016 08:59
@tagomoris
Copy link
Member

@ganmacs It's ok, but not enough. It's needed to check whether in_forward (instance of target_input_driver) creates CompressedMessagePackEventStream or not.

@ganmacs
Copy link
Member Author

ganmacs commented Sep 13, 2016

@tagomoris I added a test that in_forward creates CompressedMessagePackEventStream or not.

@ganmacs ganmacs force-pushed the support-compress-in-forward-plugin branch from 4642699 to 60381fa Compare September 13, 2016 03:14
@tagomoris
Copy link
Member

LGTM. Thank you for great patch!

@tagomoris tagomoris merged commit 335d3b2 into fluent:master Sep 13, 2016
ganmacs added a commit to ganmacs/fluentd that referenced this pull request Sep 26, 2016
* Add CompressedMessagePackEventStream class

it contain compressd message pack

* Use CompressedMessagePackEventStream to handle compressed data

* Add compress config_params to out_forward

* Change compressed to ensure_compress!

* Not to enable compress forcedly

* `compress` -> `compressed`

* Fix failed test

and use event_time

* Remove deprecated methods

* Change test description

and add test to ensure call log.info

* Add tests to check `ensure_decompressed` is called

* Fix a bug that `Node` doesn't have compress type

* Add a test that `in_forward` creates CompressedMessagePackEventStream
@ganmacs ganmacs deleted the support-compress-in-forward-plugin branch November 28, 2019 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support the compressing stream in forward and secure forward
2 participants