)]}'
{
  "commit": "9f96eb98ff52cebc8b4360de5e6d44b42b89c6e9",
  "tree": "1ac79c971e25cc7fdc1710720016b809a7e5ba29",
  "parents": [
    "543e51c7ecd842056f93859defd23b851bfe842e"
  ],
  "author": {
    "name": "Yunze Xu",
    "email": "xyzinfernity@163.com",
    "time": "Thu Feb 29 10:56:20 2024 +0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Feb 29 10:56:20 2024 +0800"
  },
  "message": "Fix blue-green migration might be stuck due to an existing reconnection (#406)\n\nFixes https://github.com/apache/pulsar-client-cpp/issues/405\r\n\r\n### Motivation\r\n\r\nAfter triggering a blue-green migration, the socket will be disconnected\r\nand then schedule a reconnection to the blue cluster. However, the blue\r\ncluster could never respond with a response for Producer or Subscribe\r\ncommands. Take producer as example, it means `connectionOpened` will not\r\ncomplete and `reconnectionPending_` will not become false.\r\n\r\nThen, after receiving a `CommandProducerClose` command from the blue\r\ncluster, a new reconnection will be scheduled to the green cluster but\r\nit will be skipped because `reconnectionPending_` is true, which means\r\nthe previous `connectionOpened` future is not completed until the 30s\r\ntimeout is reached.\r\n\r\n```\r\n2024-02-26 06:09:30.251 INFO  [139737465607744] HandlerBase:101 | [persistent://public/unload-test/topic-1708927732, sub, 0] Ignoring reconnection attempt since there\u0027s already a pending reconnection\r\n2024-02-26 06:10:00.035 WARN  [139737859880512] ProducerImpl:291 | [persistent://public/unload-test/topic-1708927732, cluster-a-0-0] Failed to reconnect producer: TimeOut\r\n```\r\n\r\n### Modifications\r\n\r\nWhen receiving the `TOPIC_MIGRATED` command, cancel the pending\r\n`Producer` and `Subscribe` commands so that `connectionOpened` will fail\r\nwith a retryable error. In the next time of reconnection, the green\r\ncluster will be connected.\r\n\r\nFix the `ExtensibleLoadManagerTest` with a more strict timeout check.\r\nAfter this change, it will pass in about 3 seconds locally, while in CI\r\neven if it passed, it takes about 70 seconds before.\r\n\r\nBesides, fix the possible crash on macOS when closing the client, see\r\nhttps://github.com/apache/pulsar-client-cpp/issues/405#issuecomment-1963969215",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0beb739c8ae2a512677ba33973852690e9914d59",
      "old_mode": 33188,
      "old_path": "lib/ClientConnection.cc",
      "new_id": "abd38b4602b605987982d1ec40f7d38bcf5e5243",
      "new_mode": 33188,
      "new_path": "lib/ClientConnection.cc"
    },
    {
      "type": "modify",
      "old_id": "3c83b4dbef353fd2ad574f1786316203a97b6f49",
      "old_mode": 33188,
      "old_path": "lib/ClientConnection.h",
      "new_id": "418cb2f9ceda67e4079232b784ceb01c4f144296",
      "new_mode": 33188,
      "new_path": "lib/ClientConnection.h"
    },
    {
      "type": "modify",
      "old_id": "4181f05c88647f03663a5b24f82c791445d4edd9",
      "old_mode": 33188,
      "old_path": "lib/ConsumerImpl.cc",
      "new_id": "fa33e28003be2b40e8faadd60d72fd3cf27de5ed",
      "new_mode": 33188,
      "new_path": "lib/ConsumerImpl.cc"
    },
    {
      "type": "modify",
      "old_id": "415e234cfecae5044446fc4c2156cdcd933b7656",
      "old_mode": 33188,
      "old_path": "lib/HandlerBase.h",
      "new_id": "b68dce3290ccb56607a31f510ffdb59a86486db2",
      "new_mode": 33188,
      "new_path": "lib/HandlerBase.h"
    },
    {
      "type": "modify",
      "old_id": "f84c255e748b5d36594c02c3fadbafaf0d501eb2",
      "old_mode": 33188,
      "old_path": "lib/ProducerImpl.cc",
      "new_id": "4399ce5fc69813d128ed7fa2255fc629aec2071b",
      "new_mode": 33188,
      "new_path": "lib/ProducerImpl.cc"
    },
    {
      "type": "modify",
      "old_id": "6e2e71b8ff6186f3874ddc4cb7e2d67dd2692176",
      "old_mode": 33188,
      "old_path": "lib/stats/ConsumerStatsBase.h",
      "new_id": "e8e17c7821734f26e74351f26599acff986002f3",
      "new_mode": 33188,
      "new_path": "lib/stats/ConsumerStatsBase.h"
    },
    {
      "type": "modify",
      "old_id": "03f3a474886b9d14c42099b0c59d145ee0abd1ae",
      "old_mode": 33188,
      "old_path": "lib/stats/ConsumerStatsImpl.h",
      "new_id": "3333ea85fb013d40e5b969fb23901ccd7d4af9ab",
      "new_mode": 33188,
      "new_path": "lib/stats/ConsumerStatsImpl.h"
    },
    {
      "type": "modify",
      "old_id": "bfa11ef14962d0d1d483ce3b1a827d791bff63cb",
      "old_mode": 33188,
      "old_path": "tests/PulsarFriend.h",
      "new_id": "e7084050f98065ebdcbf5890efed0987ed90dc99",
      "new_mode": 33188,
      "new_path": "tests/PulsarFriend.h"
    },
    {
      "type": "modify",
      "old_id": "f4e2c81c1f2382b474e80941fd34dc0daf89f776",
      "old_mode": 33188,
      "old_path": "tests/extensibleLM/ExtensibleLoadManagerTest.cc",
      "new_id": "c7e5aa0f8cc058c24ff813ca5e256081596fe86c",
      "new_mode": 33188,
      "new_path": "tests/extensibleLM/ExtensibleLoadManagerTest.cc"
    }
  ]
}
