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

[BEAM-13402] Simplify PubsubLiteSink #16215

Merged
merged 1 commit into from Dec 28, 2021

Conversation

dpcollins-google
Copy link
Contributor

This also makes it not afflicted by futures never terminating by avoiding indefinite waits


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status Build Status Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status ---
XLang Build Status Build Status Build Status Build Status Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

This also makes it not afflicted by futures never terminating by avoiding indefinite waits
@dpcollins-google
Copy link
Contributor Author

R: @TheNeuralBit

@TheNeuralBit TheNeuralBit self-requested a review December 13, 2021 17:30

/** A map of working publishers by PublisherOptions. */
class PublisherCache implements AutoCloseable {
private final Logger logger = LoggerFactory.getLogger(PublisherCache.class);
Copy link
Member

Choose a reason for hiding this comment

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

nit: we usually make loggers static and call them LOG:

Suggested change
private final Logger logger = LoggerFactory.getLogger(PublisherCache.class);
private static final Logger LOG = LoggerFactory.getLogger(PublisherCache.class);
❯ grep -iIrn LoggerFactory\.getLogger sdks/java | grep private | cut -d' ' -f2- |  cut -d = -f-1 | awk '{$1=$1};1' | sort | uniq -c | sort -n
      1 private final Logger log
      1 private static final org.slf4j.Logger LOG
    263 private static final Logger LOG

}
},
SystemExecutors.getFuturesExecutor());
runState.publish(message);
}

// Intentionally don't flush on bundle finish to allow multi-sink client reuse.
Copy link
Member

Choose a reason for hiding this comment

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

Is this comment accurate? It looks like both the old and new implementation are flushing on bundle finish

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Neither is explicitly calling flush() on the client since that would also block on the completion of other SDF instances' messages.

listener.failed(null, new CheckedApiException(Code.INTERNAL).underlying);
future.set(MessageMetadata.of(Partition.of(1), Offset.of(2)));
executorFuture.get();
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this testing a case that we need to be concerned about? Why don't we need the Publisher.addListener logic in PubsubLiteSink anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the publisher is managed by PublisherCache. When the publisher is failed, the publish() call will just throw, causing the bundle to be retried.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the publisher is managed by PublisherCache. When the publisher is failed, the publish() call will just throw, causing the bundle to be retried.

Can we modify the test to mock PublisherCache etc. and check that behavior then, instead of deleting it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, this behavior is already tested elsewhere.

futures.add(publisher.publish(Message.fromProto(message)));
}

void waitForDone() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

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

You might consider adding some logging or wrapping the exceptions thrown here with more helpful messages, rather than bubbling up all exceptions, e.g. "timeout waiting for PubsubLite messages to be published".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is important that if any exception is thrown, the bundle closure fails, since the publishes need to be retried. I could add logging, but the exception still needs to be rethrown.

@ibzib
Copy link
Contributor

ibzib commented Dec 28, 2021

run java postcommit

Copy link
Contributor

@ibzib ibzib left a comment

Choose a reason for hiding this comment

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

LGTM

listener.failed(null, new CheckedApiException(Code.INTERNAL).underlying);
future.set(MessageMetadata.of(Partition.of(1), Offset.of(2)));
executorFuture.get();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, this behavior is already tested elsewhere.

@ibzib ibzib merged commit b33bebc into apache:master Dec 28, 2021
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.

None yet

3 participants