-
Notifications
You must be signed in to change notification settings - Fork 76
Comparing changes
Open a pull request
base repository: apache/pulsar-client-cpp
base: f337eff
head repository: apache/pulsar-client-cpp
compare: 1c725b4
- 9 commits
- 31 files changed
- 2 contributors
Commits on Nov 17, 2023
-
Use absolute path to find credential files in unit tests (#340)
Fixes #339 ### Motivation Currently the relative path is used in unit tests to specify the token file (`.test-token.txt`) and the credential directory (`./test-conf`). If we don't run the `pulsar-tests` binary in a subdirectory, it won't be able to read these files. ### Modifications Add the macro `-DTOKEN_PATH="..." -DTEST_CONF_DIR="..."` to specify absolute paths according to the `PROJECT_SOURCE_DIR`, which is defined by CMake as the absolute path of the project directory. ### Verifications ```bash cmake -B build cmake --build build -j8 # Run the test in project directory ./build/tests/pulsar-tests --gtest_filter='AuthPlugin*:*testRSAEncryption:*testEncryptionFailure:*DecryptionFailedMessages' # Run the test in a subdirectory cd build ./tests/pulsar-tests --gtest_filter='AuthPlugin*:*testRSAEncryption:*testEncryptionFailure:*DecryptionFailedMessages' ``` (cherry picked from commit 47fb809)
Configuration menu - View commit details
-
Copy full SHA for 39d39a9 - Browse repository at this point
Copy the full SHA 39d39a9View commit details -
Fix close() returns ResultAlreadyClosed after unsubscribe or close (#338
) Fixes #88 ### Motivation When `close` is called if the consumer has already called `unsubscribe` or `close`, it should not fail. See https://github.com/apache/pulsar/blob/428c18c8d0c3d135189920740192982e11ffb2bf/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1034 ### Modifications Use the same close logic with Java client. Add `testCloseAgainBeforeCloseDone` and `testCloseAfterUnsubscribe` to verify the new behaviors of `Consumer::close`. (cherry picked from commit a8402da)
Configuration menu - View commit details
-
Copy full SHA for 1674a08 - Browse repository at this point
Copy the full SHA 1674a08View commit details -
Fix lazy partitioned producer might send duplicated messages (#342)
Fixes #341 ### Motivation When a lazy partitioned producer sends two messages, the flow is: 1. `start` is called to grab the connection via `grab()`. 2. Generate 0 as the sequence id of the 1st message. 3. Add the 1st message into the queuea. 4. The connection is established, `msgSequenceGenerator_` is reset from 1 to 0. 5. When sending the 2nd message, 0 is also generated as the sequence id. Then two messages have the same sequence id. ### Modifications For lazy partitioned producers, if the internal producer is not started, sending the message in the callback of its future. Add `ChunkDedupTest#testLazyPartitionedProducer` to verify it since only the `tests/chunkdedup/docker-compose.yml` enables the deduplication. (cherry picked from commit bb16f24)
Configuration menu - View commit details
-
Copy full SHA for 8408e65 - Browse repository at this point
Copy the full SHA 8408e65View commit details -
Fix crash when removing connection from the pool (#347)
Fixes #346 ### Motivation #336 changes the key of the `ClientConnection` in `ConnectionPool`, while in `ClientConnection::close`, it still passes the old key (logical address) to `ConnectionPool::remove`, which results in the connection could never be removed and destroyed until being deleted as a stale connection. What's worse, if the key does not exist, the iterator returned by `std::map::find` will still be dereferenced, which might cause crash in some platforms. See https://github.com/apache/pulsar-client-cpp/blob/8d32fd254e294d1fabba73aed70115a434b341ef/lib/ConnectionPool.cc#L122-L123 ### Modifications - Avoid dereferencing the iterator if it's invalid in `ConnectionPool::remove`. - Store the key suffix in `ClientConnection` and pass the correct key to `ConnectionPool::remove` in `ClientConnection::close` - Add `ClientTest.testConnectionClose` to verify `ClientConnection::close` can remove itself from the pool and the connection will be destroyed eventually. (cherry picked from commit 6d47e94)
Configuration menu - View commit details
-
Copy full SHA for aee12e2 - Browse repository at this point
Copy the full SHA aee12e2View commit details -
Log topic lookup result (#351)
(cherry picked from commit c771b12)
Configuration menu - View commit details
-
Copy full SHA for 806698e - Browse repository at this point
Copy the full SHA 806698eView commit details -
Fix bad_weak_ptr when close a ClientConnection during construction (#350
) Fixes #348 Fixes #349 ### Motivation When `close` is called in `ClientConnection`'s constructor, `shared_from_this()` will be called, which results in a `std::bad_weak_ptr` error. This error does not happen before #317 because `shared_from_this()` could only be called when the `producers` or `consumers` field is not empty. ### Modifications Throw `ResultAuthenticationError` when there is anything wrong with authentication in `ClientConnection`'s constructor. Then catch the result in `ConnectionPool::getConnectionAsync` and returned the failed future. In addition, check `authentication_` even for non-TLS URLs. Otherwise, the null authentication will be used to construct `CommandConnect`. Add `testInvalidPlugin` and `testTlsConfigError` to verify the changes. (cherry picked from commit 7bb94f4)
Configuration menu - View commit details
-
Copy full SHA for fa8decd - Browse repository at this point
Copy the full SHA fa8decdView commit details -
Configuration menu - View commit details
-
Copy full SHA for e6ec207 - Browse repository at this point
Copy the full SHA e6ec207View commit details
Commits on Nov 21, 2023
-
Fix the flush callback might be called repeatedly (#353)
Fixes #352 ### Motivation #303 adds the flush callback to the last `OpSendMsg` instead of adding to the batch message container. However, `batchMessageAndSend` will create an `OpSendMsg` and add it to the `pendingMessagesQueue_`. https://github.com/apache/pulsar-client-cpp/blob/7bb94f45b917ed30b5302ac93ffa1f1942fc6313/lib/ProducerImpl.cc#L384-L389 In the code above, `pendingMessagesQueue_` could never be empty and the callback will be added again by `opSendMsg->addTrackerCallback`. The 1st time it's added in `createOpSendMsg` or `createOpSendMsgs` called by `batchMessageAndSend`. ### Motivation Add the callback to the last `OpSendMsg only when the batch message container is empty. In `testFlushBatch`, replace the `flush` call with the `flushAsync` call and verify the callback is only called once after it's completed. (cherry picked from commit 37ea769)
Configuration menu - View commit details
-
Copy full SHA for 4d087b5 - Browse repository at this point
Copy the full SHA 4d087b5View commit details -
Fix Protobuf symbols not found in libpulsarwithdeps.a when building o…
…n macOS (#354) ### Motivation #290 brings a regression that on macOS, Protobuf is always found with CMake Config mode, which does not set the `Protobuf_LIBRARIES` variable so that the libpulsarwithdeps.a misses the symbols of Protobuf. ### Modifications When `LINK_STATIC` is ON, use CMake Module mode to find the Protobuf. Add `build-static-library.sh` to build libraries with static dependencies and verify these libraries in PR workflow. Upload the pre-built binaries in the build workflow. (cherry picked from commit f75b39b)
Configuration menu - View commit details
-
Copy full SHA for 1c725b4 - Browse repository at this point
Copy the full SHA 1c725b4View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff f337eff...1c725b4