Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 8 additions & 78 deletions docs/api-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ DistributedTransaction transaction = transactionManager.start();
Alternatively, you can use the `begin` method for a transaction by specifying a transaction ID as follows:

```java
// Begin a transaction by specifying a transaction ID.
// Begin a transaction with specifying a transaction ID.
DistributedTransaction transaction = transactionManager.begin("<TRANSACTION_ID>");
```

Or, you can use the `start` method for a transaction by specifying a transaction ID as follows:

```java
// Start a transaction by specifying a transaction ID.
// Start a transaction with specifying a transaction ID.
DistributedTransaction transaction = transactionManager.start("<TRANSACTION_ID>");
```

Expand All @@ -389,48 +389,6 @@ When you specify a transaction ID, make sure you specify a unique ID (for exampl

:::

##### Begin or start a transaction in read-only mode

You can also begin or start a transaction in read-only mode. In this case, the transaction will not allow any write operations, and it will be optimized for read operations.

:::note

Using read-only transactions for read-only operations is strongly recommended to improve performance and reduce resource usage.

:::

You can begin or start a transaction in read-only mode as follows:

```java
// Begin a transaction in read-only mode.
DistributedTransaction transaction = transactionManager.beginReadOnly();
```

```java
// Start a transaction in read-only mode.
DistributedTransaction transaction = transactionManager.startReadOnly();
```

Alternatively, you can use the `beginReadOnly` and `startReadOnly` methods by specifying a transaction ID as follows:

```java
// Begin a transaction in read-only mode by specifying a transaction ID.
DistributedTransaction transaction = transactionManager.beginReadOnly("<TRANSACTION_ID>");
```

```java
// Start a transaction in read-only mode by specifying a transaction ID.
DistributedTransaction transaction = transactionManager.startReadOnly("<TRANSACTION_ID>");
```

:::note

Specifying a transaction ID is useful when you want to link external systems to ScalarDB. Otherwise, you should use the `beginReadOnly()` method or the `startReadOnly()` method.

When you specify a transaction ID, make sure you specify a unique ID (for example, UUID v4) throughout the system since ScalarDB depends on the uniqueness of transaction IDs for correctness.

:::

#### Join a transaction

Joining a transaction is particularly useful in a stateful application where a transaction spans multiple client requests. In such a scenario, the application can start a transaction during the first client request. Then, in subsequent client requests, the application can join the ongoing transaction by using the `join()` method.
Expand Down Expand Up @@ -671,14 +629,9 @@ If the result has more than one record, `transaction.get()` will throw an except

##### `Scan` operation

`Scan` is an operation to retrieve multiple records within a partition. You can specify clustering-key boundaries and orderings for clustering-key columns in `Scan` operations. To execute a `Scan` operation, you can use the `transaction.scan()` method or the `transaction.getScanner()` method:

- `transaction.scan()`:
- This method immediately executes the given `Scan` operation and returns a list of all matching records. It is suitable when the result set is expected to be small enough to fit in memory.
- `transaction.getScanner()`:
- This method returns a `Scanner` object that allows you to iterate over the result set lazily. It is useful when the result set may be large, as it avoids loading all records into memory at once.
`Scan` is an operation to retrieve multiple records within a partition. You can specify clustering-key boundaries and orderings for clustering-key columns in `Scan` operations.

You need to create a `Scan` object first, and then you can execute the object by using the `transaction.scan()` method or the `transaction.getScanner()` method as follows:
You need to create a `Scan` object first, and then you can execute the object by using the `transaction.scan()` method as follows:

```java
// Create a `Scan` operation.
Expand All @@ -699,17 +652,8 @@ Scan scan =
.limit(10)
.build();

// Execute the `Scan` operation by using the `transaction.scan()` method.
// Execute the `Scan` operation.
List<Result> results = transaction.scan(scan);

// Or, execute the `Scan` operation by using the `transaction.getScanner()` method.
try (TransactionCrudOperable.Scanner scanner = transaction.getScanner(scan)) {
// Fetch the next result from the scanner
Optional<Result> result = scanner.one();

// Fetch all remaining results from the scanner
List<Result> allResults = scanner.all();
}
```

You can omit the clustering-key boundaries or specify either a `start` boundary or an `end` boundary. If you don't specify `orderings`, you will get results ordered by the clustering order that you defined when creating the table.
Expand Down Expand Up @@ -1348,14 +1292,9 @@ For details about the `Get` operation, see [`Get` operation](#get-operation).

#### Execute `Scan` operation

`Scan` is an operation to retrieve multiple records within a partition. You can specify clustering-key boundaries and orderings for clustering-key columns in `Scan` operations. To execute a `Scan` operation, you can use the `transactionManager.scan()` method or the `transactionManager.getScanner()` method:

- `transactionManager.scan()`:
- This method immediately executes the given `Scan` operation and returns a list of all matching records. It is suitable when the result set is expected to be small enough to fit in memory.
- `transactionManager.getScanner()`:
- This method returns a `Scanner` object that allows you to iterate over the result set lazily. It is useful when the result set may be large, as it avoids loading all records into memory at once.
`Scan` is an operation to retrieve multiple records within a partition. You can specify clustering-key boundaries and orderings for clustering-key columns in `Scan` operations.

You need to create a `Scan` object first, and then you can execute the object by using the `transactionManager.scan()` method or the `transactionManager.getScanner()` method as follows:
You need to create a `Scan` object first, and then you can execute the object by using the `transactionManager.scan()` method as follows:

```java
// Create a `Scan` operation.
Expand All @@ -1375,17 +1314,8 @@ Scan scan =
.limit(10)
.build();

// Execute the `Scan` operation by using the `transactionManager.scan()` method.
// Execute the `Scan` operation.
List<Result> results = transactionManager.scan(scan);

// Or, execute the `Scan` operation by using the `transactionManager.getScanner()` method.
try (TransactionManagerCrudOperable.Scanner scanner = transactionManager.getScanner(scan)) {
// Fetch the next result from the scanner
Optional<Result> result = scanner.one();

// Fetch all remaining results from the scanner
List<Result> allResults = scanner.all();
}
```

For details about the `Scan` operation, see [`Scan` operation](#scan-operation).
Expand Down
6 changes: 0 additions & 6 deletions docs/backup-restore.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ The backup methods by database listed below are just examples of some of the dat
<TabItem value="YugabyteDB_Managed" label="YugabyteDB Managed">
Clusters are backed up automatically based on the backup policy, and these backups are retained for a specific duration. You can also perform on-demand backups. For details on performing backups, see [YugabyteDB Managed: Back up and restore clusters](https://docs.yugabyte.com/preview/yugabyte-cloud/cloud-clusters/backup-clusters/).
</TabItem>
<TabItem value="Db2" label="Db2">
Use the `backup` command. For details, on performing backups, see [Db2: Backup overview](https://www.ibm.com/docs/en/db2/12.1.0?topic=recovery-backup).
</TabItem>
</Tabs>

### Back up with explicit pausing
Expand Down Expand Up @@ -178,7 +175,4 @@ The restore methods by database listed below are just examples of some of the da
<TabItem value="YugabyteDB_Managed" label="YugabyteDB Managed">
You can restore from the scheduled or on-demand backup within the backup retention period. For details on performing backups, see [YugabyteDB Managed: Back up and restore clusters](https://docs.yugabyte.com/preview/yugabyte-cloud/cloud-clusters/backup-clusters/).
</TabItem>
<TabItem value="Db2" label="Db2">
Use the `restore` command. For details, on restoring the database, see [Db2: Restore overview](https://www.ibm.com/docs/en/db2/12.1.0?topic=recovery-restore).
</TabItem>
</Tabs>
Loading