-
Notifications
You must be signed in to change notification settings - Fork 336
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
[BUG] The producer flush opertion is not guarantee to flush all messages #1057
Comments
@RobertIndie @Gleiphir2769 I have reported a bug in #1042 about this, and @zengguan is prepareing a PR to fix it.
And I have reported a issue in #1043 about how to improve the message enqueue logic. I don't know if there is a performance issue in JAVA client, if no, we implement this Go client like the JAVA client did will be fine, if yes, a dynamic length of pendingItem queue may be an alternate solution, we don't care if the pendingItem is full, just use the semaphore to keep track of how many messages are pending, when semaphore is available, send it, when not, block it. If a message has to be chunked, we treat it as ONE message, but more than one pending items. When close, flush them into the pending queue and wait for them done. |
Hi @RobertIndie, good cache! It seems a new problem introduced in #1029. Before #1029 , Now we should clear If you have no time on this thread, I think I can fix it. |
@Gleiphir2769 @RobertIndie Flush() just flush the message in the pending queue..., I thought we intentionally designed it this way, so in #1042 I just mentioned that Close() should consume the message int dataChan... |
@gunli Yes, you're right. Because in the original design there is only one channel |
Thank all of you for figuring out the issue. @gunli @Gleiphir2769 So looks like it's a regression bug introduced in #1029 |
…to flush all messages (#1058) Fixes #1057 ### Motivation `dataChan` is introduced by #1029 to fix the problem of reconnectToBroker. But it missed that if a flush operation excuted, there may still be some messages in `dataChan`. And these messages can't be flushed. ### Modifications - Fix the producer flush opertion is not guarantee to flush all messages
…to flush all messages (#1058) Fixes #1057 ### Motivation `dataChan` is introduced by #1029 to fix the problem of reconnectToBroker. But it missed that if a flush operation excuted, there may still be some messages in `dataChan`. And these messages can't be flushed. ### Modifications - Fix the producer flush opertion is not guarantee to flush all messages (cherry picked from commit 9867c29)
Expected behavior
The
producer.Flush
should guarantee that all the messages should be flushed to the broker.Actual behavior
The flush operation may skip some messages in the producer.
Steps to reproduce
Currently, the Flush cannot guarantee that the message
hello
is actually flushed to the broker.The root cause is that when calling the SendAsync, the producer will create another go routine to put the message to the queue.
Therefore, when flush is called, the message may not have entered the queue yet.
System configuration
Pulsar Go version: master
The text was updated successfully, but these errors were encountered: