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

logstash testing #927

Merged
merged 23 commits into from Feb 9, 2016

Conversation

Projects
None yet
2 participants
@urso
Copy link
Collaborator

commented Feb 4, 2016

add more tests + potential fixes to logstash output mode

@urso

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 6, 2016

Sorry for big PR. changes in this PR are mostly focused on adding unit tests to output modes and logstash client. All other changes are due to fixes and and refactorings to create unit tests.

  • refactor (splitting up) internal functionality into specialised types for adding unit tests:
    • backoff behavior
    • window sizing
    • logstash transport mode (TCP/TLS)
    • logstash protocol vs. client with connection
    • have more logstash client tests running on actual TCP connections instead of fake connection objects (helps with reproducibility)
  • fixes
    • logstash client entering infinite loop on too many timeout errors
    • do not retry events that are not json-encodable
    • large timeouts on backoff blocking output plugin shutdown (only for load balancer, single mode still suffers problem)
    • set default window size (bulk_max_size) to 2048 in logstash client (for some reason it was set back to 1024 in code)
    • raise an error if invalid sequence number in ACK message is received (bigger than max expected)
  • other improvements:
    • more detailed debug output in logstash client
    • client unit tests based on test-driver, so unit tests can be re-used with alternative client implementations (e.g. pipelining, new protocol)
    • re-use backoff implementation for balanced and single output mode + add backoff to fail-over mode
    • simplify connection mode initialization based on config
    • simplify load-balancer worker loop
    • load balancer worker forces reconnect/ping if error in send-loop

@urso urso added review and removed in progress labels Feb 6, 2016

@urso

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 6, 2016

for comparison:

if err != nil {
return nil, err
}
// dataBuf.ReadFrom(streambuf.NewFixed(tmp))

This comment has been minimized.

Copy link
@andrewkroh

andrewkroh Feb 8, 2016

Member

Do you want to remove this commented out code?

This comment has been minimized.

Copy link
@urso

urso Feb 8, 2016

Author Collaborator

Yes, can be removed. thanks

@@ -128,8 +86,8 @@ func (m *mockTransport) IsConnected() bool {
}

func (m *mockTransport) Close() error {
close(m.ch)
close(m.control)
// close(m.ch)

This comment has been minimized.

Copy link
@andrewkroh

andrewkroh Feb 8, 2016

Member

Same here. Do you want to remove this?

This comment has been minimized.

Copy link
@urso

urso Feb 8, 2016

Author Collaborator

👍

@andrewkroh

This comment has been minimized.

Copy link
Member

commented Feb 8, 2016

Looks good!

@urso urso force-pushed the urso:enh/ls-testing branch 2 times, most recently from c1384f1 to 676d1bd Feb 8, 2016

urso added some commits Feb 3, 2016

Simplify balance mode worker loop
- simplify worker loop only reconnecting on failure
- re-use backoff state between multiple calls/messages
- Enforce reconnect if sendloop returned
On LS io timeout return timeout error to output mode
By returning the io error to the output mode, the mode can apply some backoff
between multiple failures + number of send attempts gets increased more
correctly. This way, even if timeout is 'transient', error handling strategy
implemented by output modes is still in place.
Simplify logstash client error handling
simplify error handling in logstash client and always enforce a reconnect
on failure

@urso urso force-pushed the urso:enh/ls-testing branch from 676d1bd to d6936ee Feb 8, 2016

andrewkroh added a commit that referenced this pull request Feb 9, 2016

@andrewkroh andrewkroh merged commit 67a30b8 into elastic:master Feb 9, 2016

4 checks passed

CLA Commit author is a member of Elasticsearch
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
default Merged build finished.
Details

@urso urso deleted the urso:enh/ls-testing branch Feb 11, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.