vahmed-hamdy commented on a change in pull request #18669:
URL: https://github.com/apache/flink/pull/18669#discussion_r802815599
##########
File path:
flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriter.java
##########
@@ -406,11 +403,30 @@ private void addEntryToBuffer(RequestEntryT entry,
boolean insertAtHead) {
* a failure/restart of the application.
*/
@Override
- public List<Collection<RequestEntryT>> snapshotState() {
- return Arrays.asList(
- bufferedRequestEntries.stream()
- .map(RequestEntryWrapper::getRequestEntry)
- .collect(Collectors.toList()));
+ public List<BufferedRequestState<RequestEntryT>> snapshotState() {
+ return Collections.singletonList(
+ new BufferedRequestState<>(
+
Collections.unmodifiableCollection(bufferedRequestEntries)));
+ }
+
+ protected void initialize(BufferedRequestState<RequestEntryT> state) {
+ this.bufferedRequestEntries.clear();
+ this.bufferedRequestEntries.addAll(state.getBufferedRequestEntries());
+
+ long sum = 0L;
+ for (RequestEntryWrapper<RequestEntryT> wrapper :
bufferedRequestEntries) {
+ if (wrapper.getSize() > maxRecordSizeInBytes) {
+ throw new IllegalStateException(
Review comment:
We allowed `maxBufferedRequests` to flush at the end of initialisation.
It is agreed not to validate and to drop the flush logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]