Skip to content

Fix/dlq timestamp - #7

Open
robbavey wants to merge 1 commit into
logstash-plugins:mainfrom
robbavey:fix/dlq_timestamp
Open

Fix/dlq timestamp#7
robbavey wants to merge 1 commit into
logstash-plugins:mainfrom
robbavey:fix/dlq_timestamp

Conversation

@robbavey

@robbavey robbavey commented Jun 14, 2017

Copy link
Copy Markdown
Member

Stop timestamp overriding committed offsets

Change behavior to only respect the 'startTimestamp' flag when no offsets have been committed.
Adds more tests.

Fixes #6

@robbavey
robbavey force-pushed the fix/dlq_timestamp branch from 864add0 to 5d27419 Compare June 14, 2017 19:14
@@ -98,7 +101,6 @@ private void writeOffsets(Path segment, long offset) throws IOException {
}

public void close() throws IOException {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor - can you add the @Override annotation ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will do



public class DeadLetterQueueInputPlugin {
public class DeadLetterQueueInputPlugin implements AutoCloseable{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor/style - since close is throws IOException this can implement Closeable instead of AutoClosable, which (imo) is a bit more idiomatic

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't have strong feelings either way - I added the AutoCloseable interface to allow the use of try.. with resources to help avoid resource leaks/clean up tests. My understanding was the AutoCloseable was more used for code targeting JDK7+, but I guess you are right in that the existing close() throws IOException implies Closeable. (That also means that I need to fix up the method to make it idempotent, which it should have been anyway... ;))

@ph

ph commented Sep 20, 2017

Copy link
Copy Markdown
Contributor

Its this PR related to fix the CI test on master and the 6.x branch?

https://travis-ci.org/logstash-plugins/logstash-input-dead_letter_queue

dead_letter_queue/src/test/java/org/logstash/input/DeadLetterQueueInputPluginTests.java:109: error: cannot find symbol
                targetDateString = entry.getEntryTime().toIso8601();
                                                       ^
  symbol:   method toIso8601()
  location: class Timestamp
1 error
:compileTestJava FAILED
:compileTestJava (Thread[main,5,main]) completed. Took 1.579 secs.

Change behavior to only respect the 'startTimestamp' flag when
no offsets have been committed.
@robbavey

Copy link
Copy Markdown
Member Author

@ph - the reason the tests are failing on 6.x and master is elastic/logstash#8128 (elastic/logstash@d121c58), which removes the toIso8601 method from timestamp.

This PR does remove that method, but a less invasive PR should probably go in between. I'll put it up shortly

@ph

ph commented Sep 20, 2017

Copy link
Copy Markdown
Contributor

Thanks @robbavey !

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.

Dead letter queue input should only use timestamp as start date if no offset already stored.

3 participants