-
-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Enable auto-purge and set defaults #1068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| remote: origin | ||
| target-branch: main | ||
| chart-dirs: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| = Data directory | ||
| :description: How ZooKeeper manages its data directory and which zoo.cfg properties control it. | ||
| :zk-admin-advanced: https://zookeeper.apache.org/doc/r3.9.5/zookeeperAdmin.html#sc_advancedConfiguration | ||
|
|
||
| This page is meant as a general explanation of how ZooKeeper manages the files in its data directory over time. | ||
| To see a simple list of the properties the operator sets in relation to that and their defaults, see xref:reference/zoo_cfg_properties.adoc#data-dir-props[`zoo.cfg` properties reference]. | ||
|
|
||
| == Data directory files | ||
|
|
||
| The data directory is located at the path specified by `dataDir` in `zoo.cfg`. | ||
| The operator sets this to `/stackable/data` by default. | ||
| This directory contains two types of files, which together persist the ZNode data: | ||
|
|
||
| * Transaction log files: An append-only write-ahead log. Every change to the ZNodes is appended here first. | ||
| * Snapshot files: A full dump of the current state of all ZNodes. Snapshots let ZooKeeper recover quickly after a restart. | ||
|
|
||
| ZooKeeper can write the transaction logs to a separate directory, configured with `dataLogDir`. | ||
| The operator does not set this property, so both file types share `dataDir` and therefore the same volume. | ||
|
|
||
| ZooKeeper pre-allocates its transaction log file in fixed-size blocks of a certain size (`preAllocSize`) so it does not have to grow the file with every write, which keeps writes fast. | ||
|
|
||
| == Snapshot creation and auto-purge | ||
|
|
||
| A snapshot is written and the transaction log rolled to a fresh file when either of two independent limits is reached: | ||
|
|
||
| `snapCount`:: Create snapshot after roughly this many transactions. The operator does not set this property, consult the {zk-admin-advanced}[ZooKeeper Administrator's Guide{external-link-icon}^] for its default. | ||
| `snapSizeLimitInKb`:: Create snapshot after the transaction log reaches roughly this size. | ||
|
|
||
| Snapshots and their logs accumulate indefinitely unless the auto-purge feature is enabled. | ||
| The operator enables this feature by default. | ||
|
|
||
| There are two settings to control auto-purge: | ||
|
|
||
| `autopurge.purgeInterval`:: Time between cleanup runs, in hours. | ||
| `autopurge.snapRetainCount`:: How many of the most recent snapshots to keep, together with the transaction logs belonging to them. The rest are deleted during the cleanup. | ||
|
|
||
| Together these two settings control how large the data directory can grow. | ||
| `autopurge.snapRetainCount` sets how much history a cleanup keeps, while `autopurge.purgeInterval` sets how long it takes until the next cleanup, during which new snapshots and logs keep accumulating. | ||
| The volume needs to be sized accordingly, see xref:usage_guide/resource_configuration.adoc[]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
docs/modules/zookeeper/pages/reference/zoo_cfg_properties.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| = `zoo.cfg` properties | ||
| :description: Reference for the zoo.cfg properties set by the Stackable Operator for Apache ZooKeeper. | ||
|
|
||
| This is a reference page for `zoo.cfg` properties set by the operator. | ||
|
|
||
| [[data-dir-props]] | ||
| == Data directory properties | ||
|
|
||
| The following `zoo.cfg` properties control how ZooKeeper manages the files in its data directory. | ||
| You can override them using xref:usage_guide/overrides.adoc[configOverrides]. | ||
|
|
||
| [cols="2,1,2,3",options="header"] | ||
| |=== | ||
| | Property | Unit | Default set by the operator | Description | ||
|
|
||
| | `dataDir` | ||
| | path | ||
| | `/stackable/data` | ||
| | The location where ZooKeeper stores the snapshots of its in-memory database and the transaction log of updates to that database. | ||
|
|
||
| | `autopurge.purgeInterval` | ||
| | hours | ||
| | `6` | ||
| | Time between cleanup runs. `0` disables auto-purge. | ||
|
|
||
| | `autopurge.snapRetainCount` | ||
| | count | ||
| | `3` | ||
| | Number of recent snapshots (and their transaction logs) to keep. Minimum `3`. | ||
|
|
||
| | `snapSizeLimitInKb` | ||
| | KiB | ||
| | `102400` (= 100 MiB) | ||
| | Take a snapshot after the log reaches roughly this size. A non-positive value disables this trigger. | ||
|
|
||
| | `preAllocSize` | ||
| | KiB | ||
| | `16384` (= 16 MiB) | ||
| | Block size in which the transaction log file is pre-allocated. | ||
| |=== | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.