You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/22 08:01:31 UTC
[GitHub] [pulsar] congbobo184 opened a new pull request #10322: [Transaction] Fix transaction buffer op fail handle.
congbobo184 opened a new pull request #10322:
URL: https://github.com/apache/pulsar/pull/10322
## Motivation
fix transaction buffer op fail handle
## implement
add the error handle
### Verifying this change
Add the tests for it
Does this pull request potentially affect one of the following parts:
If yes was chosen, please highlight the changes
Dependencies (does it add or upgrade a dependency): (no)
The public API: (no)
The schema: (no)
The default values of configurations: (no)
The wire protocol: (no)
The rest endpoints: (no)
The admin cli options: (no)
Anything that affects deployment: (no)
--
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:
users@infra.apache.org
[GitHub] [pulsar] eolivelli merged pull request #10322: [Transaction] Fix transaction buffer op fail handle.
Posted by GitBox <gi...@apache.org>.
eolivelli merged pull request #10322:
URL: https://github.com/apache/pulsar/pull/10322
--
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:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on a change in pull request #10322: [Transaction] Fix transaction buffer op fail handle.
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10322:
URL: https://github.com/apache/pulsar/pull/10322#discussion_r618360367
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1859,26 +1860,39 @@ protected void handleEndTxnOnPartition(CommandEndTxnOnPartition command) {
final int txnAction = command.getTxnAction().getValue();
TxnID txnID = new TxnID(command.getTxnidMostBits(), command.getTxnidLeastBits());
- service.getTopics().get(TopicName.get(topic).toString()).whenComplete((optionalTopic, t) -> {
- if (!optionalTopic.isPresent()) {
- ctx.writeAndFlush(Commands.newEndTxnOnPartitionResponse(
- requestId, ServerError.TopicNotFound,
- "Topic " + topic + " is not found."));
- return;
- }
- optionalTopic.get().endTxn(txnID, txnAction, command.getTxnidLeastBitsOfLowWatermark())
- .whenComplete((ignored, throwable) -> {
- if (throwable != null) {
- log.error("Handle endTxnOnPartition {} failed.", topic, throwable);
- ctx.writeAndFlush(Commands.newEndTxnOnPartitionResponse(
- requestId, BrokerServiceException.getClientErrorCode(throwable),
- throwable.getMessage()));
- return;
- }
- ctx.writeAndFlush(Commands.newEndTxnOnPartitionResponse(requestId,
- txnID.getLeastSigBits(), txnID.getMostSigBits()));
- });
- });
+ if (log.isDebugEnabled()) {
+ log.debug("[{}] handleEndTxnOnPartition txnId: [{}], txnAction: [{}]", topic,
+ txnID, txnAction);
+ }
+ CompletableFuture<Optional<Topic>> topicFuture = service.getTopics().get(TopicName.get(topic).toString());
+ if (topicFuture != null) {
+ topicFuture.whenComplete((optionalTopic, t) -> {
+ if (!optionalTopic.isPresent()) {
+ ctx.writeAndFlush(Commands.newEndTxnOnPartitionResponse(
+ requestId, ServerError.ServiceNotReady,
+ "Topic " + topic + " is not found."));
+ return;
+ }
+ optionalTopic.get().endTxn(txnID, txnAction, command.getTxnidLeastBitsOfLowWatermark())
+ .whenComplete((ignored, throwable) -> {
+ if (throwable != null) {
+ log.error("Handle endTxnOnPartition {} failed.", topic, throwable);
+ ctx.writeAndFlush(Commands.newEndTxnOnPartitionResponse(
+ requestId, BrokerServiceException.getClientErrorCode(throwable),
+ throwable.getMessage()));
+ return;
+ }
+ ctx.writeAndFlush(Commands.newEndTxnOnPartitionResponse(requestId,
+ txnID.getLeastSigBits(), txnID.getMostSigBits()));
+ });
+ });
+ } else {
+ log.error("The topic {} is not exist in broker.", topic);
Review comment:
_The topic {} is not exist in broker."_ -> _The topic {} does not exist in broker."_
(here and below)
--
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:
users@infra.apache.org