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
INFO:partition:Table dogs planned SQL: ALTER TABLE `dogs` REORGANIZE PARTITION `p_20201204` INTO (PARTITION `p_20210422` VALUES LESS THAN (221), PARTITION `p_20210522` VALUES LESS THAN MAXVALUE);
39
+
40
+
dogs:
41
+
sql: ALTER TABLE `dogs` REORGANIZE PARTITION `p_20201204` INTO (PARTITION `p_20210422` VALUES LESS THAN (221), PARTITION `p_20210522` VALUES LESS THAN MAXVALUE);
@@ -28,7 +64,8 @@ ALTER TABLE `dbname`.`tablename` REORGANIZE PARTITION `p_20201204` INTO (PARTITI
28
64
29
65
```
30
66
31
-
You can also use a yaml configuration file with the `--config` parameter of the form:
67
+
# Configuration
68
+
You can use a yaml configuration file with the `--config` parameter of the form:
32
69
```yaml
33
70
partitionmanager:
34
71
dburl: sql://user:password@localhost/db-name
@@ -48,6 +85,7 @@ partitionmanager:
48
85
table3:
49
86
retention:
50
87
days: 14
88
+
table4: {}
51
89
```
52
90
53
91
For tables which are either partitioned but not yet using this tool's schema, or which have no empty partitions, the `bootstrap` command can be useful for proposing alterations to run manually. Note that `bootstrap` proposes commands that are likely to require partial copies of each table, so likely they will require a maintenance period.
@@ -66,7 +104,16 @@ orders:
66
104
67
105
```
68
106
69
-
# Algorithm
107
+
# Procedure
108
+
109
+
## Configuration Processing
110
+
111
+
- At start, if any configuration file specified as a CLI argument, read that configuration file to set all other values.
112
+
- Then, process all remaining command line arguments, overriding values loaded from the configuration file in case of conflicts.
113
+
- From those command-line arguments, determine whether to collect statistics `stats`, determine an initial partition layout `bootstrap`, or operate in the normal `add` mode.
114
+
- Use the configuration information as inputs to the required algorithm.
115
+
116
+
## "Add" Algorithm
70
117
71
118
The core algorithm is implemented in a method `plan_partition_changes` in `table_append_partition.py`. That algorithm is:
72
119
@@ -105,6 +152,14 @@ Procedure:
105
152
- Append the new partition to the intended empty partition list.
106
153
- Return the lists of non-empty partitions, the current empty partitions, and the post-algorithm intended empty partitions.
107
154
155
+
### "Add" Finalization
156
+
157
+
The results of the algorithm are converted into `ALTER` statements; if the user configured `--noop` they're emitted to console and the logs for each table. If not set to `--noop`, the application will execute the ALTERs at the database server and emit the results, including execution time as prometheus statistics if so configured.
158
+
159
+
## "Bootstrap" Algorithm
160
+
161
+
The bootstrap mode is a limited form of the "Add" Algorithm, using a temporary state file to determine rates-of-change. The bootstrap mode also does not limit itself to only affecting empty partitions, it can and will request changes that will prmopt row copies, in order to prepare a table for future use of the "Add" algorithm.
0 commit comments