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 2022/07/07 08:01:04 UTC

[GitHub] [pulsar] momo-jun opened a new pull request, #16434: [feature][doc] Admin API for Transactions

momo-jun opened a new pull request, #16434:
URL: https://github.com/apache/pulsar/pull/16434

   ### Modifications
   
   Add a new topic to outline the frequently used admin APIs for transactions.
   
   After the new REST API doc for transactions is generated, this doc page can be published.
   
   The preview looks good. 
   <img width="1796" alt="image" src="https://user-images.githubusercontent.com/60642177/177722788-f6813ec8-9d57-42f0-85f0-7ed51c41a56a.png">
   
   
   ### Documentation
     
   - [ ] `doc` 
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] liangyepianzhou commented on a diff in pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on code in PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#discussion_r922962734


##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.
+* **producedPartitions:** The partitions or topics that messages have been sent to with this transaction.
+* **ackedPartitions:** The partitions or topics where messages have been acknowledged with this transaction.
+
+Use one of the following ways to get your transaction metadata.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-metadata\
+ -m 1 -l 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionMetadata/:mostSigBits/:leastSigBits|operation/getTransactionMetadata?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transactions().getTransactionMetadata(txnID);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "txnId" : "(1,18)",
+ "status" : "ABORTING",
+ "openTimestamp" : 1656592983374,
+ "timeoutAt" : 5000,
+ "producedPartitions" : {
+   "my-topic" : {
+     "startPosition" : null,
+     "aborted" : true
+   }
+ },
+ "ackedPartitions" : {
+   "my-topic" : {
+     "mysubName" : {
+       "cumulativeAckPosition" : null

Review Comment:
   This is the actual production data, but this `"startPosition" : null` is really strange.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] momo-jun commented on a diff in pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
momo-jun commented on code in PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#discussion_r922939852


##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,710 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+> **Important**

Review Comment:
   Yep, I thought it could be batch fixed and aligned in this issue #15892. Didn't notice it has been addressed for other pages :)
   I will align the change on this new page as well.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] congbobo184 commented on a diff in pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
congbobo184 commented on code in PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#discussion_r922948083


##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.
+* **producedPartitions:** The partitions or topics that messages have been sent to with this transaction.
+* **ackedPartitions:** The partitions or topics where messages have been acknowledged with this transaction.
+
+Use one of the following ways to get your transaction metadata.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-metadata\
+ -m 1 -l 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionMetadata/:mostSigBits/:leastSigBits|operation/getTransactionMetadata?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transactions().getTransactionMetadata(txnID);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "txnId" : "(1,18)",
+ "status" : "ABORTING",
+ "openTimestamp" : 1656592983374,
+ "timeoutAt" : 5000,
+ "producedPartitions" : {
+   "my-topic" : {
+     "startPosition" : null,
+     "aborted" : true
+   }
+ },
+ "ackedPartitions" : {
+   "my-topic" : {
+     "mysubName" : {
+       "cumulativeAckPosition" : null

Review Comment:
   is this correct?



##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.

Review Comment:
   ```suggestion
   * **timeoutAt:** The timeout time of this transaction.
   ```



##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,710 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+> **Important**
+>
+> This page only shows **some frequently used operations**.
+>
+> - For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+>
+> - For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+>
+> - For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````

Review Comment:
   We should show the values of return



##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.
+* **producedPartitions:** The partitions or topics that messages have been sent to with this transaction.
+* **ackedPartitions:** The partitions or topics where messages have been acknowledged with this transaction.
+
+Use one of the following ways to get your transaction metadata.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-metadata\
+ -m 1 -l 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionMetadata/:mostSigBits/:leastSigBits|operation/getTransactionMetadata?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transactions().getTransactionMetadata(txnID);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "txnId" : "(1,18)",
+ "status" : "ABORTING",
+ "openTimestamp" : 1656592983374,
+ "timeoutAt" : 5000,
+ "producedPartitions" : {
+   "my-topic" : {
+     "startPosition" : null,
+     "aborted" : true
+   }
+ },
+ "ackedPartitions" : {
+   "my-topic" : {
+     "mysubName" : {
+       "cumulativeAckPosition" : null
+     }
+   }
+ }
+}
+
+```
+
+### Get transaction stats in transaction pending ack
+
+The transaction stats in transaction pending ack that can be retrieved include:
+* **cumulativeAckPosition:** The position that this transaction cumulatively acknowledges in this subscription.
+
+Use one of the following ways to get transaction in pending ack stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-pending-ack-stats \
+ -m 1 -l 1 -t my-topic -s mysubname
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInPendingAckStats/:tenant/:namespace/:topic/:subName/:mostSigBits/:leastSigBits|operation/getTransactionInPendingAckStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInPendingAckStats(txnID, topic, subname);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned value.
+
+```shell
+
+{
+ "cumulativeAckPosition" : "137:49959"
+ }
+
+```
+
+### Get transaction stats in transaction buffer
+
+The transaction stats in the transaction buffer that can be retrieved include:
+* **startPosition:** The start position of this transaction in the transaction buffer.
+* **aborted:** The flag of whether this transaction has been aborted.
+
+Use one of the following ways to get transaction stats in transaction buffer:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-buffer-stats \
+ -m 1 -l 1 -t my-topic
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInBufferStats/:tenant/:namespace/:topic/:mostSigBits/:leastSigBits|operation/getTransactionInBufferStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInBufferStatsAsync(txnID, topic);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "startPosition" : "137:49759",
+ "aborted" : false
+}
+
+```
+
+## Transaction coordinator stats
+
+The transaction coordinator (TC) is a module inside a Pulsar broker. It maintains the entire life cycle of transactions and handles transaction timeout.
+
+### Get coordinator stats
+The transaction coordinator stats that can be retrieved include:
+* **state:**  The state of this transaction coordinator.
+* **leastSigBit:s** The sequence ID of this transaction coordinator.
+* **lowWaterMark:** The low watermark of this transaction coordinator.
+* **ongoingTxnSize:** The total number of ongoing transactions in this transaction coordinator.
+* **recoverStartTime:** The start timestamp of transaction coordinator recovery. `0L` means no startup.
+* **recoverEndTime:** The end timestamp of transaction coordinator recovery. `0L` means no startup.
+
+Use one of the following ways to get transaction coordinator stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions coordinator-stats \
+ -c 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/coordinatorStats|operation/getCoordinatorStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getCoordinatorStatsById(coordinatorId);
+//Or get all coordinator stats.
+admin.transaction().getCoordinatorStats();
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+  "state" : "Ready",
+  "leastSigBits" : 1,
+  "lowWaterMark" : 0,
+  "ongoingTxnSize" : 0,
+  "recoverStartTime" : 1657021892377,
+  "recoverEndTime" : 1657021892378
+}
+
+```
+
+### Get coordinator internal stats
+
+The coordinator's internal stats that can be retrieved include:
+* **transactionLogStats:** The stats of the transaction coordinator log.
+* **managedLedgerName:** The name of the managed ledger where the transaction coordinator log is stored. 
+* **managedLedgerInternalStats:** The internal stats of the managed ledger where the transaction coordinator log is stored.

Review Comment:
   should link https://pulsar.apache.org/docs/admin-api-topics#get-internal-stats



##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.
+* **producedPartitions:** The partitions or topics that messages have been sent to with this transaction.
+* **ackedPartitions:** The partitions or topics where messages have been acknowledged with this transaction.
+
+Use one of the following ways to get your transaction metadata.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-metadata\
+ -m 1 -l 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionMetadata/:mostSigBits/:leastSigBits|operation/getTransactionMetadata?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transactions().getTransactionMetadata(txnID);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "txnId" : "(1,18)",
+ "status" : "ABORTING",
+ "openTimestamp" : 1656592983374,
+ "timeoutAt" : 5000,
+ "producedPartitions" : {
+   "my-topic" : {
+     "startPosition" : null,
+     "aborted" : true
+   }
+ },
+ "ackedPartitions" : {
+   "my-topic" : {
+     "mysubName" : {
+       "cumulativeAckPosition" : null
+     }
+   }
+ }
+}
+
+```
+
+### Get transaction stats in transaction pending ack
+
+The transaction stats in transaction pending ack that can be retrieved include:
+* **cumulativeAckPosition:** The position that this transaction cumulatively acknowledges in this subscription.
+
+Use one of the following ways to get transaction in pending ack stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-pending-ack-stats \
+ -m 1 -l 1 -t my-topic -s mysubname
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInPendingAckStats/:tenant/:namespace/:topic/:subName/:mostSigBits/:leastSigBits|operation/getTransactionInPendingAckStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInPendingAckStats(txnID, topic, subname);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned value.
+
+```shell
+
+{
+ "cumulativeAckPosition" : "137:49959"
+ }
+
+```
+
+### Get transaction stats in transaction buffer
+
+The transaction stats in the transaction buffer that can be retrieved include:
+* **startPosition:** The start position of this transaction in the transaction buffer.
+* **aborted:** The flag of whether this transaction has been aborted.
+
+Use one of the following ways to get transaction stats in transaction buffer:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-buffer-stats \
+ -m 1 -l 1 -t my-topic
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInBufferStats/:tenant/:namespace/:topic/:mostSigBits/:leastSigBits|operation/getTransactionInBufferStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInBufferStatsAsync(txnID, topic);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "startPosition" : "137:49759",
+ "aborted" : false
+}
+
+```
+
+## Transaction coordinator stats
+
+The transaction coordinator (TC) is a module inside a Pulsar broker. It maintains the entire life cycle of transactions and handles transaction timeout.
+
+### Get coordinator stats
+The transaction coordinator stats that can be retrieved include:
+* **state:**  The state of this transaction coordinator.
+* **leastSigBit:s** The sequence ID of this transaction coordinator.
+* **lowWaterMark:** The low watermark of this transaction coordinator.
+* **ongoingTxnSize:** The total number of ongoing transactions in this transaction coordinator.
+* **recoverStartTime:** The start timestamp of transaction coordinator recovery. `0L` means no startup.
+* **recoverEndTime:** The end timestamp of transaction coordinator recovery. `0L` means no startup.
+
+Use one of the following ways to get transaction coordinator stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions coordinator-stats \
+ -c 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/coordinatorStats|operation/getCoordinatorStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getCoordinatorStatsById(coordinatorId);
+//Or get all coordinator stats.
+admin.transaction().getCoordinatorStats();
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+  "state" : "Ready",
+  "leastSigBits" : 1,
+  "lowWaterMark" : 0,
+  "ongoingTxnSize" : 0,
+  "recoverStartTime" : 1657021892377,
+  "recoverEndTime" : 1657021892378
+}
+
+```
+
+### Get coordinator internal stats
+
+The coordinator's internal stats that can be retrieved include:
+* **transactionLogStats:** The stats of the transaction coordinator log.
+* **managedLedgerName:** The name of the managed ledger where the transaction coordinator log is stored. 
+* **managedLedgerInternalStats:** The internal stats of the managed ledger where the transaction coordinator log is stored.
+
+Use one of the following ways to get coordinator’s internal stats:
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions coordinator-internal-stats \
+ -c 1 -m
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/coordinatorInternalStats/:coordinatorId|operation/getCoordinatorInternalStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getCoordinatorInternalStats(coordinatorId, metadata);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "transactionLogStats" : {
+   "managedLedgerName" : "pulsar/system/persistent/__transaction_log_1",
+   "managedLedgerInternalStats" : {
+     "entriesAddedCounter" : 3,
+     "numberOfEntries" : 3,
+     "totalSize" : 63,
+     "currentLedgerEntries" : 3,
+     "currentLedgerSize" : 63,
+     "lastLedgerCreatedTimestamp" : "2022-06-30T18:18:05.88+08:00",
+     "waitingCursorsCount" : 0,
+     "pendingAddEntriesCount" : 0,
+     "lastConfirmedEntry" : "13:2",
+     "state" : "LedgerOpened",
+     "ledgers" : [ {
+       "ledgerId" : 13,
+       "entries" : 0,
+       "size" : 0,
+       "offloaded" : false,
+       "metadata" : "LedgerMetadata{formatVersion=3, ensembleSize=1, writeQuorumSize=1, ackQuorumSize=1, state=CLOSED, length=63, lastEntryId=2, digestType=CRC32C, password=OMITTED, ensembles={0=[10.20.240.119:3181]}, customMetadata={component=base64:bWFuYWdlZC1sZWRnZXI=, pulsar/managed-ledger=base64:cHVsc2FyL3N5c3RlbS9wZXJzaXN0ZW50L19fdHJhbnNhY3Rpb25fbG9nXzE=, application=base64:cHVsc2Fy}}",
+       "underReplicated" : false
+     } ],
+     "cursors" : {
+       "transaction.subscription" : {
+         "markDeletePosition" : "13:2",
+         "readPosition" : "13:3",
+         "waitingReadOp" : false,
+         "pendingReadOps" : 0,
+         "messagesConsumedCounter" : 3,
+         "cursorLedger" : 22,
+         "cursorLedgerLastEntry" : 1,
+         "individuallyDeletedMessages" : "[]",
+         "lastLedgerSwitchTimestamp" : "2022-06-30T18:18:05.932+08:00",
+         "state" : "Open",
+         "numberOfEntriesSinceFirstNotAckedMessage" : 1,
+         "totalNonContiguousDeletedMessagesRange" : 0,
+         "subscriptionHavePendingRead" : false,
+         "subscriptionHavePendingReplayRead" : false,
+         "properties" : { }
+       }
+     }
+   }
+ }
+}
+
+```
+
+## Transaction pending ack stats
+
+Pending ack maintains message acknowledgments within a transaction before a transaction completes. If a message is in the pending acknowledge state, the message cannot be acknowledged by other transactions until the message is removed from the pending acknowledge state.
+
+### Get transaction pending ack stats
+
+The transaction pending ack state stats that can be retrieved include:
+* **state:** The state of this transaction coordinator.
+* **lowWaterMark:** The low watermark of this transaction coordinator.
+* **ongoingTxnSize:** The total number of ongoing transactions in this transaction coordinator.
+* **recoverStartTime:** The start timestamp of transaction pendingAck recovery. `0L` means no startup.
+* **recoverEndTime:** The end timestamp of transaction pendingAck recovery. `0L` means no startup.
+
+Use one of the following ways to get transaction pending ack stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions pending-ack-stats \
+ -t my-topic -s  mysubName -l
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/pendingAckStats/:tenant/:namespace:/:topic:/:subName|operation/getPendingAckStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getPendingAckStats(topic, subName, lowWaterMarks)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+  "state" : "Ready",
+  "lowWaterMarks" : {
+    "1" : 0
+  },
+  "ongoingTxnSize" : 1,
+  "recoverStartTime" : 1657021899202,
+  "recoverEndTime" : 1657021899203
+}
+
+```
+
+### Get transaction pending ack internal stats
+
+The transaction pending ack internal stats that can be retrieved include:
+* **transactionLogStats:** The stats of the transaction pending ack log.
+* **managedLedgerName:** The name of the managed ledger where the transaction pending ack log is stored. 
+* **managedLedgerInternalStats:** The internal stats of the transaction log managerLedger.
+
+Use one of the following ways to get transaction pending ack internal stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions pending-ack-internal-stats \
+ -t my-topic -s  mysubName -m
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/pendingAckInternalStats/:tenant/:namespace:/:topic:/:subName|operation/getPendingAckInternalStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getPendingAckInternalStats(topic, subName, boolean metadata);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "pendingAckLogStats" : {
+   "managedLedgerName" : "public/default/persistent/my-topic-mysubName__transaction_pending_ack",
+   "managedLedgerInternalStats" : {
+     "entriesAddedCounter" : 2247,
+     "numberOfEntries" : 2247,
+     "totalSize" : 37212,
+     "currentLedgerEntries" : 104,
+     "currentLedgerSize" : 1732,
+     "lastLedgerCreatedTimestamp" : "2022-06-30T19:02:09.746+08:00",
+     "waitingCursorsCount" : 0,
+     "pendingAddEntriesCount" : 52,
+     "lastConfirmedEntry" : "64:51",
+     "state" : "LedgerOpened",
+     "ledgers" : [ {
+       "ledgerId" : 56,
+       "entries" : 2195,
+       "size" : 36346,
+       "offloaded" : false,
+       "metadata" : "LedgerMetadata{formatVersion=3, ensembleSize=1, writeQuorumSize=1, ackQuorumSize=1, state=CLOSED, length=36346, lastEntryId=2194, digestType=CRC32C, password=OMITTED, ensembles={0=[10.20.240.119:3181]}, customMetadata={component=base64:bWFuYWdlZC1sZWRnZXI=, pulsar/managed-ledger=base64:cHVibGljL2RlZmF1bHQvcGVyc2lzdGVudC9teS10b3BpYy1teXN1Yk5hbWVfX3RyYW5zYWN0aW9uX3BlbmRpbmdfYWNr, application=base64:cHVsc2Fy}}",
+       "underReplicated" : false
+     }, {
+       "ledgerId" : 64,
+       "entries" : 0,
+       "size" : 0,
+       "offloaded" : false,
+       "metadata" : "LedgerMetadata{formatVersion=3, ensembleSize=1, writeQuorumSize=1, ackQuorumSize=1, state=CLOSED, length=866, lastEntryId=51, digestType=CRC32C, password=OMITTED, ensembles={0=[10.20.240.119:3181]}, customMetadata={component=base64:bWFuYWdlZC1sZWRnZXI=, pulsar/managed-ledger=base64:cHVibGljL2RlZmF1bHQvcGVyc2lzdGVudC9teS10b3BpYy1teXN1Yk5hbWVfX3RyYW5zYWN0aW9uX3BlbmRpbmdfYWNr, application=base64:cHVsc2Fy}}",
+       "underReplicated" : false
+     } ],
+     "cursors" : {
+       "__pending_ack_state" : {
+         "markDeletePosition" : "56:-1",
+         "readPosition" : "56:0",
+         "waitingReadOp" : false,
+         "pendingReadOps" : 0,
+         "messagesConsumedCounter" : 0,
+         "cursorLedger" : 57,
+         "cursorLedgerLastEntry" : 0,
+         "individuallyDeletedMessages" : "[]",
+         "lastLedgerSwitchTimestamp" : "2022-06-30T18:55:26.842+08:00",
+         "state" : "Open",
+         "numberOfEntriesSinceFirstNotAckedMessage" : 1,
+         "totalNonContiguousDeletedMessagesRange" : 0,
+         "subscriptionHavePendingRead" : false,
+         "subscriptionHavePendingReplayRead" : false,
+         "properties" : { }
+       }
+     }
+   }
+ }
+}
+
+```
+
+### Get position stats in  pending ack
+
+The position stats in pending ack include:
+* **PendingAck** Another transaction is acknowledging the position.

Review Comment:
   ```suggestion
   * **PendingAck** Position is in pending ack stats
   ```



##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.
+* **producedPartitions:** The partitions or topics that messages have been sent to with this transaction.
+* **ackedPartitions:** The partitions or topics where messages have been acknowledged with this transaction.
+
+Use one of the following ways to get your transaction metadata.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-metadata\
+ -m 1 -l 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionMetadata/:mostSigBits/:leastSigBits|operation/getTransactionMetadata?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transactions().getTransactionMetadata(txnID);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "txnId" : "(1,18)",
+ "status" : "ABORTING",
+ "openTimestamp" : 1656592983374,
+ "timeoutAt" : 5000,
+ "producedPartitions" : {
+   "my-topic" : {
+     "startPosition" : null,
+     "aborted" : true
+   }
+ },
+ "ackedPartitions" : {
+   "my-topic" : {
+     "mysubName" : {
+       "cumulativeAckPosition" : null
+     }
+   }
+ }
+}
+
+```
+
+### Get transaction stats in transaction pending ack
+
+The transaction stats in transaction pending ack that can be retrieved include:
+* **cumulativeAckPosition:** The position that this transaction cumulatively acknowledges in this subscription.
+
+Use one of the following ways to get transaction in pending ack stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-pending-ack-stats \
+ -m 1 -l 1 -t my-topic -s mysubname
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInPendingAckStats/:tenant/:namespace/:topic/:subName/:mostSigBits/:leastSigBits|operation/getTransactionInPendingAckStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInPendingAckStats(txnID, topic, subname);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned value.
+
+```shell
+
+{
+ "cumulativeAckPosition" : "137:49959"
+ }
+
+```
+
+### Get transaction stats in transaction buffer
+
+The transaction stats in the transaction buffer that can be retrieved include:
+* **startPosition:** The start position of this transaction in the transaction buffer.
+* **aborted:** The flag of whether this transaction has been aborted.
+
+Use one of the following ways to get transaction stats in transaction buffer:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-buffer-stats \
+ -m 1 -l 1 -t my-topic
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInBufferStats/:tenant/:namespace/:topic/:mostSigBits/:leastSigBits|operation/getTransactionInBufferStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInBufferStatsAsync(txnID, topic);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "startPosition" : "137:49759",
+ "aborted" : false
+}
+
+```
+
+## Transaction coordinator stats
+
+The transaction coordinator (TC) is a module inside a Pulsar broker. It maintains the entire life cycle of transactions and handles transaction timeout.
+
+### Get coordinator stats
+The transaction coordinator stats that can be retrieved include:
+* **state:**  The state of this transaction coordinator.
+* **leastSigBit:s** The sequence ID of this transaction coordinator.
+* **lowWaterMark:** The low watermark of this transaction coordinator.
+* **ongoingTxnSize:** The total number of ongoing transactions in this transaction coordinator.
+* **recoverStartTime:** The start timestamp of transaction coordinator recovery. `0L` means no startup.
+* **recoverEndTime:** The end timestamp of transaction coordinator recovery. `0L` means no startup.
+
+Use one of the following ways to get transaction coordinator stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions coordinator-stats \
+ -c 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/coordinatorStats|operation/getCoordinatorStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getCoordinatorStatsById(coordinatorId);
+//Or get all coordinator stats.
+admin.transaction().getCoordinatorStats();
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+  "state" : "Ready",
+  "leastSigBits" : 1,
+  "lowWaterMark" : 0,
+  "ongoingTxnSize" : 0,
+  "recoverStartTime" : 1657021892377,
+  "recoverEndTime" : 1657021892378
+}
+
+```
+
+### Get coordinator internal stats
+
+The coordinator's internal stats that can be retrieved include:
+* **transactionLogStats:** The stats of the transaction coordinator log.
+* **managedLedgerName:** The name of the managed ledger where the transaction coordinator log is stored. 
+* **managedLedgerInternalStats:** The internal stats of the managed ledger where the transaction coordinator log is stored.
+
+Use one of the following ways to get coordinator’s internal stats:
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions coordinator-internal-stats \
+ -c 1 -m
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/coordinatorInternalStats/:coordinatorId|operation/getCoordinatorInternalStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getCoordinatorInternalStats(coordinatorId, metadata);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "transactionLogStats" : {
+   "managedLedgerName" : "pulsar/system/persistent/__transaction_log_1",
+   "managedLedgerInternalStats" : {
+     "entriesAddedCounter" : 3,
+     "numberOfEntries" : 3,
+     "totalSize" : 63,
+     "currentLedgerEntries" : 3,
+     "currentLedgerSize" : 63,
+     "lastLedgerCreatedTimestamp" : "2022-06-30T18:18:05.88+08:00",
+     "waitingCursorsCount" : 0,
+     "pendingAddEntriesCount" : 0,
+     "lastConfirmedEntry" : "13:2",
+     "state" : "LedgerOpened",
+     "ledgers" : [ {
+       "ledgerId" : 13,
+       "entries" : 0,
+       "size" : 0,
+       "offloaded" : false,
+       "metadata" : "LedgerMetadata{formatVersion=3, ensembleSize=1, writeQuorumSize=1, ackQuorumSize=1, state=CLOSED, length=63, lastEntryId=2, digestType=CRC32C, password=OMITTED, ensembles={0=[10.20.240.119:3181]}, customMetadata={component=base64:bWFuYWdlZC1sZWRnZXI=, pulsar/managed-ledger=base64:cHVsc2FyL3N5c3RlbS9wZXJzaXN0ZW50L19fdHJhbnNhY3Rpb25fbG9nXzE=, application=base64:cHVsc2Fy}}",
+       "underReplicated" : false
+     } ],
+     "cursors" : {
+       "transaction.subscription" : {
+         "markDeletePosition" : "13:2",
+         "readPosition" : "13:3",
+         "waitingReadOp" : false,
+         "pendingReadOps" : 0,
+         "messagesConsumedCounter" : 3,
+         "cursorLedger" : 22,
+         "cursorLedgerLastEntry" : 1,
+         "individuallyDeletedMessages" : "[]",
+         "lastLedgerSwitchTimestamp" : "2022-06-30T18:18:05.932+08:00",
+         "state" : "Open",
+         "numberOfEntriesSinceFirstNotAckedMessage" : 1,
+         "totalNonContiguousDeletedMessagesRange" : 0,
+         "subscriptionHavePendingRead" : false,
+         "subscriptionHavePendingReplayRead" : false,
+         "properties" : { }
+       }
+     }
+   }
+ }
+}
+
+```
+
+## Transaction pending ack stats
+
+Pending ack maintains message acknowledgments within a transaction before a transaction completes. If a message is in the pending acknowledge state, the message cannot be acknowledged by other transactions until the message is removed from the pending acknowledge state.
+
+### Get transaction pending ack stats
+
+The transaction pending ack state stats that can be retrieved include:
+* **state:** The state of this transaction coordinator.
+* **lowWaterMark:** The low watermark of this transaction coordinator.
+* **ongoingTxnSize:** The total number of ongoing transactions in this transaction coordinator.
+* **recoverStartTime:** The start timestamp of transaction pendingAck recovery. `0L` means no startup.
+* **recoverEndTime:** The end timestamp of transaction pendingAck recovery. `0L` means no startup.
+
+Use one of the following ways to get transaction pending ack stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions pending-ack-stats \
+ -t my-topic -s  mysubName -l
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/pendingAckStats/:tenant/:namespace:/:topic:/:subName|operation/getPendingAckStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getPendingAckStats(topic, subName, lowWaterMarks)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+  "state" : "Ready",
+  "lowWaterMarks" : {
+    "1" : 0
+  },
+  "ongoingTxnSize" : 1,
+  "recoverStartTime" : 1657021899202,
+  "recoverEndTime" : 1657021899203
+}
+
+```
+
+### Get transaction pending ack internal stats
+
+The transaction pending ack internal stats that can be retrieved include:
+* **transactionLogStats:** The stats of the transaction pending ack log.
+* **managedLedgerName:** The name of the managed ledger where the transaction pending ack log is stored. 
+* **managedLedgerInternalStats:** The internal stats of the transaction log managerLedger.

Review Comment:
   should link https://pulsar.apache.org/docs/admin-api-topics#get-internal-stats



##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.
+* **producedPartitions:** The partitions or topics that messages have been sent to with this transaction.
+* **ackedPartitions:** The partitions or topics where messages have been acknowledged with this transaction.
+
+Use one of the following ways to get your transaction metadata.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-metadata\
+ -m 1 -l 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionMetadata/:mostSigBits/:leastSigBits|operation/getTransactionMetadata?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transactions().getTransactionMetadata(txnID);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "txnId" : "(1,18)",
+ "status" : "ABORTING",
+ "openTimestamp" : 1656592983374,
+ "timeoutAt" : 5000,
+ "producedPartitions" : {
+   "my-topic" : {
+     "startPosition" : null,
+     "aborted" : true
+   }
+ },
+ "ackedPartitions" : {
+   "my-topic" : {
+     "mysubName" : {
+       "cumulativeAckPosition" : null
+     }
+   }
+ }
+}
+
+```
+
+### Get transaction stats in transaction pending ack
+
+The transaction stats in transaction pending ack that can be retrieved include:
+* **cumulativeAckPosition:** The position that this transaction cumulatively acknowledges in this subscription.
+
+Use one of the following ways to get transaction in pending ack stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-pending-ack-stats \
+ -m 1 -l 1 -t my-topic -s mysubname
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInPendingAckStats/:tenant/:namespace/:topic/:subName/:mostSigBits/:leastSigBits|operation/getTransactionInPendingAckStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInPendingAckStats(txnID, topic, subname);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned value.
+
+```shell
+
+{
+ "cumulativeAckPosition" : "137:49959"
+ }
+
+```
+
+### Get transaction stats in transaction buffer
+
+The transaction stats in the transaction buffer that can be retrieved include:
+* **startPosition:** The start position of this transaction in the transaction buffer.
+* **aborted:** The flag of whether this transaction has been aborted.
+
+Use one of the following ways to get transaction stats in transaction buffer:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-in-buffer-stats \
+ -m 1 -l 1 -t my-topic
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionInBufferStats/:tenant/:namespace/:topic/:mostSigBits/:leastSigBits|operation/getTransactionInBufferStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getTransactionInBufferStatsAsync(txnID, topic);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "startPosition" : "137:49759",
+ "aborted" : false
+}
+
+```
+
+## Transaction coordinator stats
+
+The transaction coordinator (TC) is a module inside a Pulsar broker. It maintains the entire life cycle of transactions and handles transaction timeout.
+
+### Get coordinator stats
+The transaction coordinator stats that can be retrieved include:
+* **state:**  The state of this transaction coordinator.
+* **leastSigBit:s** The sequence ID of this transaction coordinator.
+* **lowWaterMark:** The low watermark of this transaction coordinator.
+* **ongoingTxnSize:** The total number of ongoing transactions in this transaction coordinator.
+* **recoverStartTime:** The start timestamp of transaction coordinator recovery. `0L` means no startup.
+* **recoverEndTime:** The end timestamp of transaction coordinator recovery. `0L` means no startup.
+
+Use one of the following ways to get transaction coordinator stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions coordinator-stats \
+ -c 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/coordinatorStats|operation/getCoordinatorStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getCoordinatorStatsById(coordinatorId);
+//Or get all coordinator stats.
+admin.transaction().getCoordinatorStats();
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+  "state" : "Ready",
+  "leastSigBits" : 1,
+  "lowWaterMark" : 0,
+  "ongoingTxnSize" : 0,
+  "recoverStartTime" : 1657021892377,
+  "recoverEndTime" : 1657021892378
+}
+
+```
+
+### Get coordinator internal stats
+
+The coordinator's internal stats that can be retrieved include:
+* **transactionLogStats:** The stats of the transaction coordinator log.
+* **managedLedgerName:** The name of the managed ledger where the transaction coordinator log is stored. 
+* **managedLedgerInternalStats:** The internal stats of the managed ledger where the transaction coordinator log is stored.
+
+Use one of the following ways to get coordinator’s internal stats:
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions coordinator-internal-stats \
+ -c 1 -m
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/coordinatorInternalStats/:coordinatorId|operation/getCoordinatorInternalStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getCoordinatorInternalStats(coordinatorId, metadata);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "transactionLogStats" : {
+   "managedLedgerName" : "pulsar/system/persistent/__transaction_log_1",
+   "managedLedgerInternalStats" : {
+     "entriesAddedCounter" : 3,
+     "numberOfEntries" : 3,
+     "totalSize" : 63,
+     "currentLedgerEntries" : 3,
+     "currentLedgerSize" : 63,
+     "lastLedgerCreatedTimestamp" : "2022-06-30T18:18:05.88+08:00",
+     "waitingCursorsCount" : 0,
+     "pendingAddEntriesCount" : 0,
+     "lastConfirmedEntry" : "13:2",
+     "state" : "LedgerOpened",
+     "ledgers" : [ {
+       "ledgerId" : 13,
+       "entries" : 0,
+       "size" : 0,
+       "offloaded" : false,
+       "metadata" : "LedgerMetadata{formatVersion=3, ensembleSize=1, writeQuorumSize=1, ackQuorumSize=1, state=CLOSED, length=63, lastEntryId=2, digestType=CRC32C, password=OMITTED, ensembles={0=[10.20.240.119:3181]}, customMetadata={component=base64:bWFuYWdlZC1sZWRnZXI=, pulsar/managed-ledger=base64:cHVsc2FyL3N5c3RlbS9wZXJzaXN0ZW50L19fdHJhbnNhY3Rpb25fbG9nXzE=, application=base64:cHVsc2Fy}}",
+       "underReplicated" : false
+     } ],
+     "cursors" : {
+       "transaction.subscription" : {
+         "markDeletePosition" : "13:2",
+         "readPosition" : "13:3",
+         "waitingReadOp" : false,
+         "pendingReadOps" : 0,
+         "messagesConsumedCounter" : 3,
+         "cursorLedger" : 22,
+         "cursorLedgerLastEntry" : 1,
+         "individuallyDeletedMessages" : "[]",
+         "lastLedgerSwitchTimestamp" : "2022-06-30T18:18:05.932+08:00",
+         "state" : "Open",
+         "numberOfEntriesSinceFirstNotAckedMessage" : 1,
+         "totalNonContiguousDeletedMessagesRange" : 0,
+         "subscriptionHavePendingRead" : false,
+         "subscriptionHavePendingReplayRead" : false,
+         "properties" : { }
+       }
+     }
+   }
+ }
+}
+
+```
+
+## Transaction pending ack stats
+
+Pending ack maintains message acknowledgments within a transaction before a transaction completes. If a message is in the pending acknowledge state, the message cannot be acknowledged by other transactions until the message is removed from the pending acknowledge state.
+
+### Get transaction pending ack stats
+
+The transaction pending ack state stats that can be retrieved include:
+* **state:** The state of this transaction coordinator.
+* **lowWaterMark:** The low watermark of this transaction coordinator.
+* **ongoingTxnSize:** The total number of ongoing transactions in this transaction coordinator.
+* **recoverStartTime:** The start timestamp of transaction pendingAck recovery. `0L` means no startup.
+* **recoverEndTime:** The end timestamp of transaction pendingAck recovery. `0L` means no startup.
+
+Use one of the following ways to get transaction pending ack stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions pending-ack-stats \
+ -t my-topic -s  mysubName -l
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/pendingAckStats/:tenant/:namespace:/:topic:/:subName|operation/getPendingAckStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getPendingAckStats(topic, subName, lowWaterMarks)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+  "state" : "Ready",
+  "lowWaterMarks" : {
+    "1" : 0
+  },
+  "ongoingTxnSize" : 1,
+  "recoverStartTime" : 1657021899202,
+  "recoverEndTime" : 1657021899203
+}
+
+```
+
+### Get transaction pending ack internal stats
+
+The transaction pending ack internal stats that can be retrieved include:
+* **transactionLogStats:** The stats of the transaction pending ack log.
+* **managedLedgerName:** The name of the managed ledger where the transaction pending ack log is stored. 
+* **managedLedgerInternalStats:** The internal stats of the transaction log managerLedger.
+
+Use one of the following ways to get transaction pending ack internal stats:
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions pending-ack-internal-stats \
+ -t my-topic -s  mysubName -m
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/pendingAckInternalStats/:tenant/:namespace:/:topic:/:subName|operation/getPendingAckInternalStats?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getPendingAckInternalStats(topic, subName, boolean metadata);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "pendingAckLogStats" : {
+   "managedLedgerName" : "public/default/persistent/my-topic-mysubName__transaction_pending_ack",
+   "managedLedgerInternalStats" : {
+     "entriesAddedCounter" : 2247,
+     "numberOfEntries" : 2247,
+     "totalSize" : 37212,
+     "currentLedgerEntries" : 104,
+     "currentLedgerSize" : 1732,
+     "lastLedgerCreatedTimestamp" : "2022-06-30T19:02:09.746+08:00",
+     "waitingCursorsCount" : 0,
+     "pendingAddEntriesCount" : 52,
+     "lastConfirmedEntry" : "64:51",
+     "state" : "LedgerOpened",
+     "ledgers" : [ {
+       "ledgerId" : 56,
+       "entries" : 2195,
+       "size" : 36346,
+       "offloaded" : false,
+       "metadata" : "LedgerMetadata{formatVersion=3, ensembleSize=1, writeQuorumSize=1, ackQuorumSize=1, state=CLOSED, length=36346, lastEntryId=2194, digestType=CRC32C, password=OMITTED, ensembles={0=[10.20.240.119:3181]}, customMetadata={component=base64:bWFuYWdlZC1sZWRnZXI=, pulsar/managed-ledger=base64:cHVibGljL2RlZmF1bHQvcGVyc2lzdGVudC9teS10b3BpYy1teXN1Yk5hbWVfX3RyYW5zYWN0aW9uX3BlbmRpbmdfYWNr, application=base64:cHVsc2Fy}}",
+       "underReplicated" : false
+     }, {
+       "ledgerId" : 64,
+       "entries" : 0,
+       "size" : 0,
+       "offloaded" : false,
+       "metadata" : "LedgerMetadata{formatVersion=3, ensembleSize=1, writeQuorumSize=1, ackQuorumSize=1, state=CLOSED, length=866, lastEntryId=51, digestType=CRC32C, password=OMITTED, ensembles={0=[10.20.240.119:3181]}, customMetadata={component=base64:bWFuYWdlZC1sZWRnZXI=, pulsar/managed-ledger=base64:cHVibGljL2RlZmF1bHQvcGVyc2lzdGVudC9teS10b3BpYy1teXN1Yk5hbWVfX3RyYW5zYWN0aW9uX3BlbmRpbmdfYWNr, application=base64:cHVsc2Fy}}",
+       "underReplicated" : false
+     } ],
+     "cursors" : {
+       "__pending_ack_state" : {
+         "markDeletePosition" : "56:-1",
+         "readPosition" : "56:0",
+         "waitingReadOp" : false,
+         "pendingReadOps" : 0,
+         "messagesConsumedCounter" : 0,
+         "cursorLedger" : 57,
+         "cursorLedgerLastEntry" : 0,
+         "individuallyDeletedMessages" : "[]",
+         "lastLedgerSwitchTimestamp" : "2022-06-30T18:55:26.842+08:00",
+         "state" : "Open",
+         "numberOfEntriesSinceFirstNotAckedMessage" : 1,
+         "totalNonContiguousDeletedMessagesRange" : 0,
+         "subscriptionHavePendingRead" : false,
+         "subscriptionHavePendingReplayRead" : false,
+         "properties" : { }
+       }
+     }
+   }
+ }
+}
+
+```
+
+### Get position stats in  pending ack
+
+The position stats in pending ack include:
+* **PendingAck** Another transaction is acknowledging the position.
+* **MarkDelete** The position is already acknowledged.
+* **NotInPendingAck** The position is not acknowledged.

Review Comment:
   ```suggestion
   * **NotInPendingAck** The position is not acknowledged with a transaction.
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] momo-jun commented on pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
momo-jun commented on PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#issuecomment-1182721095

   Ping @liangyepianzhou @congbobo184 for review.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] momo-jun commented on a diff in pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
momo-jun commented on code in PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#discussion_r923017432


##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.

Review Comment:
   The term `[timeout](https://en.wikipedia.org/wiki/Timeout_(computing))` self-contains the meaning of a period of time.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] liangyepianzhou merged pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
liangyepianzhou merged PR #16434:
URL: https://github.com/apache/pulsar/pull/16434


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Anonymitaet commented on a diff in pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on code in PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#discussion_r922934617


##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,710 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+> **Important**

Review Comment:
   To enhance readability, is it better to update it to a `Tip` as Tip will be highlighted while `Important` not?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] momo-jun commented on a diff in pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
momo-jun commented on code in PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#discussion_r923017432


##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.

Review Comment:
   The term `timeout` self-contains the meaning of a period of time. Refer to [wiki](https://en.wikipedia.org/wiki/Timeout_(computing)).



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] liangyepianzhou commented on a diff in pull request #16434: [feature][doc] Admin API for Transactions

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on code in PR #16434:
URL: https://github.com/apache/pulsar/pull/16434#discussion_r922971693


##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+

Review Comment:
   ```suggestion
   The following is an example of the returned values.
   
   ```shell
   {
     "(0,3)": {
       "txnId": "(0,3)",
       "status": "OPEN",
       "openTimestamp": 1658120122474,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,2)": {
       "txnId": "(0,2)",
       "status": "OPEN",
       "openTimestamp": 1658120122471,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,5)": {
       "txnId": "(0,5)",
       "status": "OPEN",
       "openTimestamp": 1658120122478,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,4)": {
       "txnId": "(0,4)",
       "status": "OPEN",
       "openTimestamp": 1658120122476,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,7)": {
       "txnId": "(0,7)",
       "status": "OPEN",
       "openTimestamp": 1658120122482,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,10)": {
       "txnId": "(0,10)",
       "status": "OPEN",
       "openTimestamp": 1658120122488,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,6)": {
       "txnId": "(0,6)",
       "status": "OPEN",
       "openTimestamp": 1658120122480,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,9)": {
       "txnId": "(0,9)",
       "status": "OPEN",
       "openTimestamp": 1658120122486,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,8)": {
       "txnId": "(0,8)",
       "status": "OPEN",
       "openTimestamp": 1658120122484,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     },
     "(0,11)": {
       "txnId": "(0,11)",
       "status": "OPEN",
       "openTimestamp": 1658120122490,
       "timeoutAt": 300000,
       "producedPartitions": {},
       "ackedPartitions": {}
     }
   }
   
   ```
   
   ```



##########
site2/docs/admin-api-transactions.md:
##########
@@ -0,0 +1,712 @@
+---
+id: admin-api-transactions
+title: Manage transactions
+sidebar_label: "Transactions"
+---
+
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
+
+:::tip
+
+This page only shows **some frequently used operations**.
+
+- For the latest and complete information about `Pulsar admin`, including commands, flags, descriptions, and more, see [Pulsar admin doc](/tools/pulsar-admin/)
+
+- For the latest and complete information about `REST API`, including parameters, responses, samples, and more, see {@inject: rest:REST:/} API doc.
+
+- For the latest and complete information about `Java admin API`, including classes, methods, descriptions, and more, see [Java admin API doc](/api/admin/).
+
+:::
+
+## Transaction resources
+
+### GetSlowTransactions
+
+In the production environment, there may be some long-lasting transactions that have never been completed. You can get these slow transactions that have survived over a certain time under a coordinator or all coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions slow-transactions \
+ -c 1 -t 1s
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/slowTransactions/:timeout|operation/getSlowTransactions?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().getSlowTransactionsByCoordinatorId(coordinatorId, timeout, timeUnit)
+//Or get slow transactions from all coordinators
+admin.transaction().getSlowTransactions(timeout, timeUnit)
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+### ScaleTransactionCoordinators
+
+When the performance of transactions reaches a bottleneck due to the insufficient number of transaction coordinators, you can scale the number of the transaction coordinators in the following ways.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions scale-transactionCoordinators \
+ -r 17
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionCoordinator/:replicas|operation/scaleTransactionCoordinators?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transaction().scaleTransactionCoordinators(replicas);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+## Transaction stats
+
+### Get transaction metadata
+
+The transaction metadata that can be retrieved include:
+* **txnId:** The ID of this transaction.
+* **status:** The status of this transaction.
+* **openTimestamp:** The open time of this transaction.
+* **timeoutAt:** The timeout of this transaction.
+* **producedPartitions:** The partitions or topics that messages have been sent to with this transaction.
+* **ackedPartitions:** The partitions or topics where messages have been acknowledged with this transaction.
+
+Use one of the following ways to get your transaction metadata.
+
+````mdx-code-block
+<Tabs groupId="api-choice"
+ defaultValue="pulsar-admin"
+ values={[{"label":"pulsar-admin","value":"pulsar-admin"},{"label":"REST API","value":"REST API"},{"label":"Java","value":"Java"}]}>
+<TabItem value="pulsar-admin">
+
+```shell
+
+$ pulsar-admin transactions transaction-metadata\
+ -m 1 -l 1
+
+```
+
+</TabItem>
+<TabItem value="REST API">
+
+{@inject: endpoint|GET|/admin/v3/transactions/transactionMetadata/:mostSigBits/:leastSigBits|operation/getTransactionMetadata?version=@pulsar:version_number@}
+
+</TabItem>
+<TabItem value="Java">
+
+```java
+
+admin.transactions().getTransactionMetadata(txnID);
+
+```
+
+</TabItem>
+
+</Tabs>
+````
+
+The following is an example of the returned values.
+
+```shell
+
+{
+ "txnId" : "(1,18)",
+ "status" : "ABORTING",
+ "openTimestamp" : 1656592983374,
+ "timeoutAt" : 5000,
+ "producedPartitions" : {
+   "my-topic" : {
+     "startPosition" : null,

Review Comment:
   ```suggestion
        "startPosition" : "127:4959",
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org