jack-tristan opened a new issue #9341: URL: https://github.com/apache/pulsar/issues/9341
**Describe the bug** 1 non-partitioned topic stats 1.1 Primary cluster non-partitioned topic stats # bin/pulsar-admin topics stats test-replicate/test-sub/str-dev-v4 { "msgRateIn" : 12.300029496700736, "msgThroughputIn" : 1303.803126650278, "msgRateOut" : 21.63338472525488, "msgThroughputOut" : 1320.6364483139644, "bytesInCounter" : 338342, "msgInCounter" : 3206, "bytesOutCounter" : 157506, "msgOutCounter" : 1500, "averageMsgSize" : 106.0, "msgChunkPublished" : false, "storageSize" : 347443, "backlogSize" : 249132, "publishers" : [ { "msgRateIn" : 12.300029496700736, "msgThroughputIn" : 1303.803126650278, "averageMsgSize" : 106.0, "chunkedMessageRate" : 0.0, "producerId" : 0, "metadata" : { }, "producerName" : "pulsar-cluster-a-16-16", "connectedSince" : "2021-01-27T17:33:26.762+08:00", "clientVersion" : "2.6.1", "address" : "/10.100.129.175:51920" } ], "subscriptions" : { "sub-cluster-a-test-replicate-str-dev-v4-failover-1" : { "msgRateOut" : 8.3333528249067, "msgThroughputOut" : 883.3353994401103, "bytesOutCounter" : 157506, "msgOutCounter" : 1500, "msgRateRedeliver" : 0.0, "chuckedMessageRate" : 0, "msgBacklog" : 2363, "msgBacklogNoDelayed" : 2363, "blockedSubscriptionOnUnackedMsgs" : false, "msgDelayed" : 0, "unackedMessages" : 0, "type" : "Failover", "activeConsumerName" : "4a530", "msgRateExpired" : 0.0, "lastExpireTimestamp" : 0, "lastConsumedFlowTimestamp" : 1611740223284, "lastConsumedTimestamp" : 1611740223365, "lastAckedTimestamp" : 1611740268700, "consumers" : [ { "msgRateOut" : 8.3333528249067, "msgThroughputOut" : 883.3353994401103, "bytesOutCounter" : 157506, "msgOutCounter" : 1500, "msgRateRedeliver" : 0.0, "chuckedMessageRate" : 0.0, "consumerName" : "4a530", "availablePermits" : 0, "unackedMessages" : 0, "avgMessagesPerEntry" : 207, "blockedConsumerOnUnackedMsgs" : false, "lastAckedTimestamp" : 1611740268700, "lastConsumedTimestamp" : 1611740223365, "metadata" : { }, "connectedSince" : "2021-01-27T17:36:10.555+08:00", "clientVersion" : "2.6.1", "address" : "/10.100.129.175:52353" } ], "isDurable" : true, "isReplicated" : true } }, "replication" : { "pulsar-cluster-b" : { "msgRateIn" : 0.0, "msgThroughputIn" : 0.0, "msgRateOut" : 13.30003190034818, "msgThroughputOut" : 437.3010488738541, "msgRateExpired" : 0.0, "replicationBacklog" : 0, "connected" : true, "replicationDelayInSeconds" : 0, "outboundConnection" : "[id: 0x2fddb1ca, L:/10.200.12.162:49994 - R:10.200.19.33/10.200.19.33:6650]", "outboundConnectedSince" : "2021-01-27T17:19:44.269+08:00" } }, "deduplicationStatus" : "Disabled" } 1.2 Standby cluster non-partitioned topic stats # bin/pulsar-admin topics stats test-replicate/test-sub/str-dev-v4 { "msgRateIn" : 12.716640339618115, "msgThroughputIn" : 1474.0636149373324, "msgRateOut" : 0.0, "msgThroughputOut" : 0.0, "bytesInCounter" : 368714, "msgInCounter" : 3193, "bytesOutCounter" : 0, "msgOutCounter" : 0, "averageMsgSize" : 115.91612057667105, "msgChunkPublished" : false, "storageSize" : 368714, "backlogSize" : 0, "publishers" : [ ], "subscriptions" : { }, "replication" : { }, "deduplicationStatus" : "Disabled" } 2 partitioned topic stats 2.1 Primary cluster partitioned topic stats # bin/pulsar-admin topics partitioned-stats persistent://test-replicate/test-sub/pt-str-dev-v3 { "msgRateIn" : 12.65025778768415, "msgThroughputIn" : 1345.093994509174, "msgRateOut" : 40.650860585326946, "msgThroughputOut" : 3218.5522431318986, "bytesInCounter" : 886443, "msgInCounter" : 8379, "bytesOutCounter" : 580476, "msgOutCounter" : 5500, "averageMsgSize" : 106.33333333333333, "msgChunkPublished" : false, "storageSize" : 924002, "backlogSize" : 660758, "publishers" : [ { "msgRateIn" : 12.65025778768415, "msgThroughputIn" : 1345.093994509174, "averageMsgSize" : 106.33333333333333, "chunkedMessageRate" : 0.0, "producerId" : 0 } ], "subscriptions" : { "sub-cluster-a-test-replicate-pt-str-dev-v3-keyshared-1" : { "msgRateOut" : 25.00054285762629, "msgThroughputOut" : 2658.3908801582493, "bytesOutCounter" : 580476, "msgOutCounter" : 5500, "msgRateRedeliver" : 0.0, "chuckedMessageRate" : 0, "msgBacklog" : 6265, "msgBacklogNoDelayed" : 6265, "blockedSubscriptionOnUnackedMsgs" : false, "msgDelayed" : 0, "unackedMessages" : 2982, "msgRateExpired" : 0.0, "lastExpireTimestamp" : 0, "lastConsumedFlowTimestamp" : 0, "lastConsumedTimestamp" : 0, "lastAckedTimestamp" : 0, "consumers" : [ { "msgRateOut" : 25.00054285762629, "msgThroughputOut" : 2658.3908801582493, "bytesOutCounter" : 580476, "msgOutCounter" : 5500, "msgRateRedeliver" : 0.0, "chuckedMessageRate" : 0.0, "availablePermits" : 0, "unackedMessages" : 2982, "avgMessagesPerEntry" : 0, "blockedConsumerOnUnackedMsgs" : false, "lastAckedTimestamp" : 0, "lastConsumedTimestamp" : 0 } ], "isDurable" : true, "isReplicated" : true } }, "replication" : { "pulsar-cluster-b" : { "msgRateIn" : 0.0, "msgThroughputIn" : 0.0, "msgRateOut" : 15.65031772770066, "msgThroughputOut" : 560.1613629736488, "msgRateExpired" : 0.0, "replicationBacklog" : 0, "connected" : false, "replicationDelayInSeconds" : 0 } }, "metadata" : { "partitions" : 3 }, "partitions" : { } } 2.2 Standby cluster partitioned topic stats # bin/pulsar-admin topics partitioned-stats persistent://test-replicate/test-sub/pt-str-dev-v3 { "msgRateIn" : 3.049997735262238, "msgThroughputIn" : 340.3664139312856, "msgRateOut" : 0.0, "msgThroughputOut" : 0.0, "bytesInCounter" : 48216, "msgInCounter" : 429, "bytesOutCounter" : 0, "msgOutCounter" : 0, "averageMsgSize" : 74.39711737537824, "msgChunkPublished" : false, "storageSize" : 48216, "backlogSize" : 0, "publishers" : [ ], "subscriptions" : { }, "replication" : { }, "metadata" : { "partitions" : 3 }, "partitions" : { } } **To Reproduce** Steps to reproduce the behavior: 1. Set failover cluster; 2. In primary cluster produce and consume data by replicate subscription; 3. check topic stats; Failover cluster mode setting: ## Primary cluster pulsar-cluster-a ```shell # add standby cluster pulsar-cluster-b into primary cluster pulsar-cluster-a bin/pulsar-admin clusters create pulsar-cluster-b \ --url http://10.200.19.33:8080,10.200.19.34:8080,10.200.19.35:8080 \ --broker-url pulsar://10.200.19.33:6650,10.200.19.34:6650,10.200.19.35:6650 # create tenant bin/pulsar-admin tenants create test-replicate \ -c pulsar-cluster-a,pulsar-cluster-b # create namespace bin/pulsar-admin namespaces create test-replicate/test-sub \ -c pulsar-cluster-a,pulsar-cluster-b # set retention bin/pulsar-admin namespaces set-retention test-replicate/test-sub \ --size -1 \ --time -1 # create partitioned-topic bin/pulsar-admin topics create-partitioned-topic \ persistent://test-replicate/test-sub/pt-str-dev-v1 \ --partitions 3 ``` ## Standby cluster pulsar-cluster-b setting ```shell # Standby cluster pulsar-cluster-b # create tenant bin/pulsar-admin tenants create test-replicate \ -c pulsar-cluster-b # create namespace bin/pulsar-admin namespaces create test-replicate/test-sub \ -c pulsar-cluster-b # set retention bin/pulsar-admin namespaces set-retention test-replicate/test-sub \ --size -1 \ --time -1 # create partitioned-topic bin/pulsar-admin topics create-partitioned-topic \ persistent://test-replicate/test-sub/pt-str-dev-v1 \ --partitions 3 ``` ## java producer setting ``` producer = client.newProducer(Schema.STRING) .topic("persistent://test-replicate/test-sub/pt-str-dev-v3") .compressionType(CompressionType.LZ4) .create(); ``` ## java consumer setting ```java consumer = client .newConsumer(Schema.STRING) .topic("persistent://test-replicate/test-sub/pt-str-dev-v3") .subscriptionName("sub-cluster-a-test-replicate-pt-str-dev-v3-keyshared-1") .subscriptionType(SubscriptionType.Key_Shared) .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) .replicateSubscriptionState(true) //replicate subscription state .subscribe(); ``` **Expected behavior** When consumers switch from the primary cluster to the standby cluster, they can continue to consume from the consumption location of the primary cluster. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: centos7.2 ; pulsar2.6.1 on bare metal ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org