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/09 10:57:26 UTC
[GitHub] [pulsar] eolivelli opened a new pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
eolivelli opened a new pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182
Fixes #10181
### Modifications
Prevent the NPE to bubble up
This change is a trivial rework / code cleanup without any test coverage.
--
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] sijie commented on pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
sijie commented on pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#issuecomment-823059999
/pulsarbot rerun-failure-checks
--
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 #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#discussion_r611325584
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1777,7 +1778,16 @@ protected void handleNewTxn(CommandNewTxn command) {
log.debug("Receive new txn request {} to transaction meta store {} from {}.",
requestId, tcId, remoteAddress);
}
- service.pulsar().getTransactionMetadataStoreService().newTransaction(tcId, command.getTxnTtlSeconds())
+ TransactionMetadataStoreService transactionMetadataStoreService =
+ service.pulsar().getTransactionMetadataStoreService();
+ if (transactionMetadataStoreService == null) {
+ ServiceUnitNotReadyException ex =
Review comment:
Yes.
I don't want to add a new error in the protocol.
This is not a permission error. So probably it is better to not report 'not allowed', maybe the coordinator was disabled in this broker by mistake?
I believe that 'service unit not available' is a good fit.
I reported the error on the client side, it looks to be very good
--
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 #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#discussion_r611325584
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1777,7 +1778,16 @@ protected void handleNewTxn(CommandNewTxn command) {
log.debug("Receive new txn request {} to transaction meta store {} from {}.",
requestId, tcId, remoteAddress);
}
- service.pulsar().getTransactionMetadataStoreService().newTransaction(tcId, command.getTxnTtlSeconds())
+ TransactionMetadataStoreService transactionMetadataStoreService =
+ service.pulsar().getTransactionMetadataStoreService();
+ if (transactionMetadataStoreService == null) {
+ ServiceUnitNotReadyException ex =
Review comment:
Yes.
I don't want to add a new error in the protocol.
This is not a permission error.
I believe that 'service unit not available' is a good fit.
I reported the error on the client side, it looks to be very good
--
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] codelipenghui commented on a change in pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#discussion_r611290690
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1777,7 +1778,16 @@ protected void handleNewTxn(CommandNewTxn command) {
log.debug("Receive new txn request {} to transaction meta store {} from {}.",
requestId, tcId, remoteAddress);
}
- service.pulsar().getTransactionMetadataStoreService().newTransaction(tcId, command.getTxnTtlSeconds())
+ TransactionMetadataStoreService transactionMetadataStoreService =
+ service.pulsar().getTransactionMetadataStoreService();
+ if (transactionMetadataStoreService == null) {
+ ServiceUnitNotReadyException ex =
Review comment:
We already have `NotAllowedError` in the PulsarApi.proto. We can add an exception on the broker side, but don't need to introduce a new error type in the PulsarApi.proto?
--
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] congbobo184 commented on a change in pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
congbobo184 commented on a change in pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#discussion_r611276924
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1777,7 +1778,16 @@ protected void handleNewTxn(CommandNewTxn command) {
log.debug("Receive new txn request {} to transaction meta store {} from {}.",
requestId, tcId, remoteAddress);
}
- service.pulsar().getTransactionMetadataStoreService().newTransaction(tcId, command.getTxnTtlSeconds())
+ TransactionMetadataStoreService transactionMetadataStoreService =
+ service.pulsar().getTransactionMetadataStoreService();
+ if (transactionMetadataStoreService == null) {
+ ServiceUnitNotReadyException ex =
Review comment:
may be add a ```TransactionNotAllowedException``` is better.
--
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] codelipenghui commented on pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#issuecomment-817412308
ping @congbobo184 Could you please help review this PR?
--
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 pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#issuecomment-819591821
/pulsarbot rerun-failure-checks
--
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 pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#issuecomment-816616713
for reference, this is the new error on the client side:
> org.apache.pulsar.client.api.transaction.TransactionCoordinatorClientException: Transaction manager is not started or not enabled
> [javatest.batch] at org.apache.pulsar.client.impl.TransactionMetaStoreHandler.getExceptionByServerError(TransactionMetaStoreHandler.java:385)
> [javatest.batch] at org.apache.pulsar.client.impl.TransactionMetaStoreHandler.handleNewTxnResponse(TransactionMetaStoreHandler.java:152)
> [javatest.batch] at org.apache.pulsar.client.impl.ClientCnx.handleNewTxnResponse(ClientCnx.java:853)
> [javatest.batch] at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:428)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
> [javatest.batch] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
> [javatest.batch] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
> [javatest.batch] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> [javatest.batch] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> [javatest.batch] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
> [javatest.batch] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
> [javatest.batch] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
> [javatest.batch] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
> [javatest.batch] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
> [javatest.batch] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
>
--
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 pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#issuecomment-819592079
@codelipenghui PTAL again
--
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] codelipenghui commented on a change in pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#discussion_r611273642
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1777,7 +1778,16 @@ protected void handleNewTxn(CommandNewTxn command) {
log.debug("Receive new txn request {} to transaction meta store {} from {}.",
requestId, tcId, remoteAddress);
}
- service.pulsar().getTransactionMetadataStoreService().newTransaction(tcId, command.getTxnTtlSeconds())
+ TransactionMetadataStoreService transactionMetadataStoreService =
+ service.pulsar().getTransactionMetadataStoreService();
+ if (transactionMetadataStoreService == null) {
+ ServiceUnitNotReadyException ex =
+ new ServiceUnitNotReadyException("Transaction manager is not started or not enabled");
Review comment:
return ServiceUnitNotReadyException here is not reasonable here. We have defined `NotAllowedError` and `TransactionCoordinatorNotFound` in the PulsarApi.proto. If the broker disabled the TC, we should return NotAllowedError to the client, so that the client should not to retry to open a transaction. And if in some cases the transactionMetadataStoreService is null(In principle this shouldn't happen), we can return `TransactionCoordinatorNotFound` to the client.
--
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 #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#discussion_r611326098
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1777,7 +1778,16 @@ protected void handleNewTxn(CommandNewTxn command) {
log.debug("Receive new txn request {} to transaction meta store {} from {}.",
requestId, tcId, remoteAddress);
}
- service.pulsar().getTransactionMetadataStoreService().newTransaction(tcId, command.getTxnTtlSeconds())
+ TransactionMetadataStoreService transactionMetadataStoreService =
+ service.pulsar().getTransactionMetadataStoreService();
+ if (transactionMetadataStoreService == null) {
+ ServiceUnitNotReadyException ex =
Review comment:
I will change to TransactionCoordinatorNotFound
OK?
--
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 #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli merged pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182
--
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 pull request #10182: Issue 10181: Transactions: broker side NullPointerException in case of enableTransactionCoordinator=false
Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10182:
URL: https://github.com/apache/pulsar/pull/10182#issuecomment-817533742
@codelipenghui @congbobo184
changed to CoordinatorException.CoordinatorNotFoundException
thanks for your suggestions
--
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