-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Transaction] Transaction admin api get transaction metadata #10690
[Transaction] Transaction admin api get transaction metadata #10690
Conversation
…_admin_api # Conflicts: # pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java
…nto congbobo184_transaction_admin_api_transaction_in_pendingack_stats
…nto congbobo184_transaction_admin_api_transaction_in_pendingack_stats
…ion_in_pendingack_stats
…ion_in_pendingack_stats # Conflicts: # pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/TransactionsBase.java # pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v3/Transactions.java # pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java # pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/v3/AdminApiTransactionTest.java # pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Transactions.java # pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TransactionsImpl.java # pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java # pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTransactions.java
…ongbobo184_transaction_admin_api_get_transaction_status
…saction_status # Conflicts: # pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v3/Transactions.java # pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/v3/AdminApiTransactionTest.java # pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Transactions.java # pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TransactionsImpl.java # pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java # pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTransactions.java
Transactions transactions = pulsar().getAdminClient().transactions(); | ||
TxnMeta txnMeta = pulsar().getTransactionMetadataStoreService() | ||
.getTxnMeta(new TxnID(coordinatorId, sequenceID)).get(); | ||
TxnID txnID = txnMeta.id(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will introduce NPE here.
public CmdTransactions(Supplier<PulsarAdmin> admin) { | ||
super("transactions", admin); | ||
jcommander.addCommand("coordinator-status", new GetCoordinatorStatus()); | ||
jcommander.addCommand("transaction-in-buffer-stats", new GetTransactionInBufferStats()); | ||
jcommander.addCommand("transaction-in-pending-ack-stats", new GetTransactionInPendingAckStats()); | ||
jcommander.addCommand("transaction-status", new GetTransactionStatus()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use transaction-metadata
here since we are using a transaction ID to fetch all transaction metadata through this command.
@@ -117,7 +117,7 @@ public synchronized void registerSendOp(CompletableFuture<MessageId> sendFuture) | |||
return checkIfOpen().thenCompose(value -> { | |||
synchronized (TransactionImpl.this) { | |||
// we need to issue the request to TC to register the acked topic | |||
return registerSubscriptionMap.compute(topic, (key, future) -> { | |||
return registerSubscriptionMap.compute(topic + "-" + subscription, (key, future) -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems not related to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test will use
…ongbobo184_transaction_admin_api_get_transaction_status
…ongbobo184_transaction_admin_api_get_transaction_status
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Transactions.java
Outdated
Show resolved
Hide resolved
…/admin/Transactions.java Co-authored-by: Yu Liu <50226895+Anonymitaet@users.noreply.github.com>
…10690) ## Motivation Transaction add admin api `getTransactionMetadata` ## implement ``` @DaTa public class TransactionMetadata { /** The txnId of this transaction. */ public String txnId; /** The status of this transaction. */ public String status; /** The open time of this transaction. */ public long openTimestamp; /** The timeout of this transaction. */ public long timeoutAt; /** The producedPartitions of this transaction. */ public Map<String, TransactionInBufferStats> producedPartitions; /** The ackedPartitions of this transaction. */ public Map<String, Map<String, TransactionInPendingAckStats>> ackedPartitions; } ```
…10690) ## Motivation Transaction add admin api `getTransactionMetadata` ## implement ``` @DaTa public class TransactionMetadata { /** The txnId of this transaction. */ public String txnId; /** The status of this transaction. */ public String status; /** The open time of this transaction. */ public long openTimestamp; /** The timeout of this transaction. */ public long timeoutAt; /** The producedPartitions of this transaction. */ public Map<String, TransactionInBufferStats> producedPartitions; /** The ackedPartitions of this transaction. */ public Map<String, Map<String, TransactionInPendingAckStats>> ackedPartitions; } ```
Motivation
Transaction add admin api
getTransactionMetadata
implement
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: (yes)
Anything that affects deployment: (no)