You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ydb/docs/en/core/concepts/topic.md
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,18 +19,63 @@ Messages may contain user-defined attributes in "key-value" format. They are ret
19
19
20
20
## Partitioning {#partitioning}
21
21
22
-
To enable horizontal scaling, a topic is divided into `partitions` that are units of parallelism. Each partition has a limited bandwidth. The recommended write speed is 1 MBps.
22
+
To enable horizontal scaling, a topic is divided into `partitions` that are units of parallelism. Each partition has a limited throughput. The recommended write speed is 1 MBps.
23
23
24
24
{% note info %}
25
25
26
26
As for now, you can only reduce the number of partitions in a topic by deleting and recreating a topic with a smaller number of partitions.
27
27
28
28
{% endnote %}
29
29
30
+
Partitions can be:
31
+
32
+
-**Active.** By default, all partitions are active. Both read and write operations are allowed on an active partition.
33
+
-**Inactive.** An inactive partition is read-only. A partition becomes inactive after splitting for [autopartitioning](#autopartitioning). It is automatically deleted once all messages are removed due to the expiration of the retention period.
34
+
30
35
### Offset {#offset}
31
36
32
37
All messages within a partition have a unique sequence number called an `offset` An offset monotonically increases as new messages are written.
33
38
39
+
## Autopartitioning {#autopartitioning}
40
+
41
+
Total topic throughput is determined by the number of partitions in the topic and the throughput of each partition. The number of partitions and the throughput of each partition are set at the time of topic creation. If the maximum required write speed for a topic is unknown at the creation time, autopartitioning allows the topic to be scaled automatically. If autopartitioning is enabled for a topic, the number of partitions will increase automatically as the write speed increases (see [Autopartitioning strategies](#autopartitioning_strategies)).
42
+
43
+
### Guarantees {#autopartitioning_guarantee}
44
+
45
+
1. The SDK and server provide an exactly-once guarantee in the case of writing during a partition split. This means that any message will be written either to the parent partition or to one of the child partitions but never to both simultaneously. Additionally, a message cannot be written to the same partition multiple times.
46
+
2. The SDK and server maintain the reading order. Data is read from the parent partition first, followed by the child partitions.
47
+
3. As a result, the exactly-once writing guarantee and the reading order guarantee are preserved for a specific [producer identifier](#producer-id).
The following autopartitioning strategies are available for any topic:
52
+
53
+
#### DISABLED
54
+
55
+
Autopartitioning is disabled for this topic. The number of partitions remains constant, and there is no automatic scaling.
56
+
57
+
The initial number of partitions is set during topic creation. If the partition count is manually adjusted, new partitions are added. Both previously existing and new partitions are active.
58
+
59
+
#### UP
60
+
61
+
Upwards autopartitioning is enabled for this topic. This means that if the write speed to the topic increases, the number of partitions will automatically increase. However, if the write speed decreases, the number of partitions remains unchanged.
62
+
63
+
The partition count increase algorithm works as follows: if the write speed for a partition exceeds a defined threshold (as a percentage of the maximum write speed for that partition) during a specified period, the partition is split into two child partitions. The original partition becomes inactive, allowing only read operations. When the retention period expires, and all messages in the original partition are deleted, the partition itself is also deleted. The two new child partitions become active, allowing both read and write operations.
64
+
65
+
#### PAUSED
66
+
67
+
Autopartitioning is paused for this topic, meaning that the number of partitions does not increase automatically. If needed, you can re-enable autopartitioning for this topic.
68
+
69
+
Examples of YQL queries for switching between different autopartitioning strategies can be found [here](../yql/reference/syntax/alter-topic.md#autopartitioning).
The following constraints apply when using autopartitioning:
74
+
75
+
1. Once autopartitioning is enabled for a topic, it cannot be stopped, only paused.
76
+
2. When autopartitioning is enabled for a topic, it is impossible to read from or write to it using the [Kafka API](../reference/kafka-api/index.md).
77
+
3. Autopartitioning can only be enabled on topics that use the reserved capacity mode.
78
+
34
79
## Message sources and groups {#producer-id}
35
80
36
81
Messages are ordered using the `producer_id` and `message_group_id`. The order of written messages is maintained within pairs: `<producer ID, message group ID>`.
Copy file name to clipboardExpand all lines: ydb/docs/en/core/reference/kafka-api/constraints.md
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,4 +8,5 @@
8
8
4. Transactions are not supported.
9
9
5. DDL operations are not supported. Use the [{{ ydb-short-name }} SDK](../ydb-sdk/index.md) or [{{ ydb-short-name }} CLI](../ydb-cli/index.md) to perform them.
10
10
6. Data schema validation not supported.
11
-
7. Kafka Connect is only supported in standalone mode.
11
+
7. Kafka Connect is supported only in standalone mode.
12
+
8. Kafka API can't be used to read from or write to topics with enabled autopartitioning.
0 commit comments