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
`<json_config_file>` is a path to a JSON configuration file (described below),
159
161
`<timestamp>` is a valid timestamp in ISO format (e.g. `2026-02-10T14:30:00`),
160
-
`<gtid_set>` is a valid gtid set (e.g. `11111111-aaaa-1111-aaaa-111111111111:1:3, 22222222-bbbb-2222-bbbb-222222222222:1-6`).
162
+
`<gtid_set>` is a valid gtid set (e.g. `11111111-aaaa-1111-aaaa-111111111111:1:3, 22222222-bbbb-2222-bbbb-222222222222:1-6`),
163
+
`<binlog_name>` is a valid binlog file name without path (e.g. `binlog.000001`).
161
164
162
165
### Operation modes
163
166
164
167
Percona Binary Log Server utility can operate in five modes:
165
168
- 'version'
169
+
- 'list'
166
170
- 'search_by_timestamp'
167
171
- 'search_by_gtid_set'
168
172
- 'fetch'
169
173
- 'pull'
174
+
- 'purge_binlogs'
170
175
171
176
#### 'version' operation mode
172
177
@@ -180,6 +185,49 @@ may print
180
185
0.3.0
181
186
```
182
187
188
+
#### 'list' operation mode
189
+
190
+
In this mode the utility requires no extra parameters apart from the config file name and will print to the standard output the complete list of binlog files stored in the Binary Log Server data directory in their creation order.
191
+
Along with the file name the output will also return its current size in bytes, timestamps, URI and optional initial / added GTIDs (when the replication is configured to use GTID mode).
Unlike the `search_by_timestamp` and `search_by_gtid_set` subcommands, instead of reporting an error when the storage is empty, the `list` returns '"status": "success"' with an empty 'result' array.
230
+
183
231
#### 'search_by_timestamp' operation mode
184
232
185
233
In this mode the utility requires one additional command line parameter `<iso_timestamp>` and will print to the standard output the list of binlog files stored in the Binary Log Server data directory that have at least one event whose timestamp is less or equal to the provided `<iso_timestamp>`.
@@ -305,6 +353,99 @@ Any error (network issues, server down, out of space, etc) encountered in this m
305
353
In this mode the utility continuously tries to connect to a remote MySQL server / switch to replication mode and read binary log events. After reading the very last one, the utility does not close the connection immediately but instead waits for `<connection.read_timeout>` seconds for the server to generate more events. If this period of time elapses, the utility closes the MySQL connection and enters the `idle` mode. In this mode it just waits for `<replication.idle_time>` seconds in disconnected state. After that another reconnection attempt is made and everything starts from the beginning.
306
354
Any network-related error (network issues, server down, etc) encountered in this mode does not result in immediate termination of the program. Instead, another reconnection attempt is made. More serious errors (like out of space, etc.) cause program termination.
307
355
356
+
#### 'purge_binlogs' operation mode
357
+
358
+
In this mode the utility requires one additional command line parameter `<binlog_name>` and will remove every binlog file with sequence number less than or equal to the one extracted from the `<binlog_name>`. Specifying binlog name which is currently being written to (the most recent one) is not allowed.
The `<reason>` may be one of the following (but not limited to):
414
+
-`binlog composite name is too short`
415
+
-`cannot purge: target binlog name has a different base name than the binlog records in the storage`
416
+
-`cannot purge: target binlog name is not present in the storage`
417
+
-`cannot purge: target is the current tail binlog file; at least one binlog file must remain in the storage to preserve the resume position`
418
+
419
+
The logic of the `purge_binlogs` will try to do its best and delete all the files in the range. However, if an error occurs in the middle of this group delete operation, already deleted files cannot be restored. In this case we will return a result with the `status` key equal to `warning`, the `result` key that includes all the records of the files we were trying to delete and `message` key set to a description of what went wrong during this group delete operation.
0 commit comments