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

[feat] PIP-188 Support blue-green migration #402

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

heesung-sn
Copy link
Contributor

Master Issue: apache/pulsar#16551

Motivation

Support blue-green migration pip-188 for cpp client

Modifications

  • added blue-green client logic
  • register the producer instance in the producers map before sending produce creation command. This is required since broker could send topic migration command in the middle of creating the producer.

Verifying this change

  • Make sure that the change passes the CI checks.
    Updated the exisiting extensibleLB test to cover the migration logic.

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@heesung-sn heesung-sn self-assigned this Feb 12, 2024
@BewareMyPower BewareMyPower added this to the 3.5.0 milestone Feb 16, 2024
@BewareMyPower
Copy link
Contributor

Added the 3.5.0 milestone according to https://lists.apache.org/thread/fr4pv2p8yxhxcg2wc9sqdfzm89y8cnox

Copy link
Contributor

@BewareMyPower BewareMyPower left a comment

Choose a reason for hiding this comment

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

I changed the IO threads to 8 for ExtensibleLoadManagerTest and found segmentation fault when closing the client.

diff --git a/tests/extensibleLM/ExtensibleLoadManagerTest.cc b/tests/extensibleLM/ExtensibleLoadManagerTest.cc
index 7567569..f4e2c81 100644
--- a/tests/extensibleLM/ExtensibleLoadManagerTest.cc
+++ b/tests/extensibleLM/ExtensibleLoadManagerTest.cc
@@ -70,7 +70,9 @@ TEST(ExtensibleLoadManagerTest, testPubSubWhileUnloading) {
         return res == 204 || res == 409;
     }));
 
-    Client client{"pulsar://localhost:6650"};
+    ClientConfiguration conf;
+    conf.setIOThreads(8);
+    Client client{"pulsar://localhost:6650", conf};
     Producer producer;
     ProducerConfiguration producerConfiguration;
     Result producerResult = client.createProducer(topicName, producerConfiguration, producer);
2024-02-18 22:00:56.553 INFO  [0x16b7d3000] ExtensibleLoadManagerTest:138 | acked i:19
2024-02-18 22:00:56.553 INFO  [0x16b7d3000] ExtensibleLoadManagerTest:141 | consumer finished
2024-02-18 22:00:56.554 INFO  [0x1e3fea100] ClientImpl:666 | Closing Pulsar client with 1 producers and 1 consumers
2024-02-18 22:00:56.554 INFO  [0x1e3fea100] ProducerImpl:799 | [persistent://public/unload-test/topic-1708264824, cluster-a-1-0] Closing producer for topic persistent://public/unload-test/topic-1708264824
2024-02-18 22:00:56.554 INFO  [0x1e3fea100] ConsumerImpl:1267 | [persistent://public/unload-test/topic-1708264824, sub, 0] Closing consumer for topic persistent://public/unload-test/topic-1708264824
2024-02-18 22:00:56.561 INFO  [0x16b1cf000] ProducerImpl:763 | [persistent://public/unload-test/topic-1708264824, cluster-a-1-0] Closed producer 0
2024-02-18 22:00:56.561 INFO  [0x16b1cf000] ConsumerImpl:1251 | [persistent://public/unload-test/topic-1708264824, sub, 0] Closed consumer 0
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:1320 | [[::1]:53157 -> [::1]:6650] Connection disconnected (refCnt: 2)
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:1320 | [[::1]:53154 -> [::1]:6650] Connection disconnected (refCnt: 1)
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:1320 | [[::1]:53164 -> [::1]:6651] Connection disconnected (refCnt: 1)
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:1320 | [[::1]:53181 -> [::1]:6651] Connection disconnected (refCnt: 1)
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:1320 | [[::1]:53153 -> [::1]:6650] Connection disconnected (refCnt: 1)
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:1320 | [[::1]:53163 -> [::1]:6651] Connection disconnected (refCnt: 1)
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:275 | [[::1]:53157 -> [::1]:6650] Destroyed connection to pulsar://broker-1:6650-0
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:275 | [[::1]:53181 -> [::1]:6651] Destroyed connection to pulsar://green-broker-2:6650-0
2024-02-18 22:00:56.561 INFO  [0x16b143000] ClientConnection:275 | [[::1]:53164 -> [::1]:6651] Destroyed connection to pulsar://green-broker-1:6650-0
2024-02-18 22:00:56.562 INFO  [0x16b143000] ClientConnection:275 | [[::1]:53163 -> [::1]:6651] Destroyed connection to pulsar://localhost:6651-0
2024-02-18 22:00:56.562 INFO  [0x16b143000] ClientConnection:275 | [[::1]:53153 -> [::1]:6650] Destroyed connection to pulsar://localhost:6650-0
2024-02-18 22:00:56.562 INFO  [0x16b143000] ClientConnection:275 | [[::1]:53154 -> [::1]:6650] Destroyed connection to pulsar://broker-2:6650-0
./run-unit-tests.sh: line 40: 13856 Segmentation fault: 11  $CMAKE_BUILD_DIRECTORY/tests/ExtensibleLoadManagerTest

It appears to be something wrong with the thread safety.

@heesung-sn
Copy link
Contributor Author

I changed the IO threads to 8 for ExtensibleLoadManagerTest and found segmentation fault when closing the client.

Thanks for sharing this. I tried to reproduce this issue, but I couldn't. Updated the test config instead.

@BewareMyPower
Copy link
Contributor

Okay. I will debug it locally and see if it's a serious problem.

BewareMyPower added a commit to BewareMyPower/pulsar-client-cpp that referenced this pull request Feb 19, 2024
@BewareMyPower BewareMyPower dismissed their stale review February 19, 2024 14:22

The segfault is not related to this PR

lib/HandlerBase.h Show resolved Hide resolved
lib/ProducerImpl.cc Outdated Show resolved Hide resolved
lib/HandlerBase.h Outdated Show resolved Hide resolved
@BewareMyPower BewareMyPower merged commit 543e51c into apache:main Feb 21, 2024
14 checks passed
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.

2 participants