-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unack message count for transaction Ack while disabled batch inde…
…x ack (#14071) * Fix unack message count for transaction Ack while disabled batch index ack. ### Motivation Fix unack message count for transaction Ack while disabled batch index ack. Transaction Ack is different with normal message ack for a batch message. For normal message, we are using a bitset to carry the batch index state, for example ``` 1. Ack with `00111111` means acks batch index 0 and 1 2. For ack batch index 2 and 3, the client will send `00001111` to broker 3. After all the batch been acked, send `00000000` to broker ``` The following is for transaction ack: ``` 1. `00111111` means acks batch index 0 and 1 1. `11001111` means acks batch index 2 and 3 ``` ### Verification Enabled transaction e2e test for batch index ack disabled
- Loading branch information
1 parent
025509c
commit a640146
Showing
8 changed files
with
167 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.../test/java/org/apache/pulsar/client/impl/TransactionEndToEndWithoutBatchIndexAckTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.client.impl; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.pulsar.client.api.SubscriptionType; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* End to end transaction test. | ||
*/ | ||
@Slf4j | ||
@Test(groups = "flaky") | ||
public class TransactionEndToEndWithoutBatchIndexAckTest extends TransactionEndToEndTest { | ||
|
||
@BeforeMethod | ||
protected void setup() throws Exception { | ||
conf.setAcknowledgmentAtBatchIndexLevelEnabled(false); | ||
setUpBase(1, NUM_PARTITIONS, TOPIC_OUTPUT, TOPIC_PARTITION); | ||
admin.topics().createPartitionedTopic(TOPIC_MESSAGE_ACK_TEST, 1); | ||
} | ||
|
||
// TODO need to fix which using transaction with individual ack for failover subscription | ||
@Test | ||
public void txnIndividualAckTestBatchAndFailoverSub() throws Exception { | ||
conf.setAcknowledgmentAtBatchIndexLevelEnabled(true); | ||
txnAckTest(true, 200, SubscriptionType.Failover); | ||
} | ||
} |