mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 00:13:52 +01:00
add ZREPL_DESTROY_MAX_BATCH_SIZE env var to control max batch destroy size
fixes #508 closes https://github.com/zrepl/zrepl/pull/604
This commit is contained in:
parent
53f9bd6d88
commit
e4112d888c
@ -21,6 +21,7 @@ Developers should consult the git commit log or GitHub issue tracker.
|
||||
|
||||
* `Feature Wishlist on GitHub <https://github.com/zrepl/zrepl/discussions/547>`_
|
||||
|
||||
* |feature| Add ``ZREPL_DESTROY_MAX_BATCH_SIZE`` env var (default 0=unlimited).
|
||||
* |break| |feature| convert Prometheus metric ``zrepl_version_daemon`` to ``zrepl_start_time`` metric
|
||||
|
||||
* The metric still reports the zrepl version in a label.
|
||||
|
@ -115,9 +115,10 @@ func buildBatches(reqs []*DestroySnapOp) [][]*DestroySnapOp {
|
||||
// group by fs
|
||||
var perFS [][]*DestroySnapOp
|
||||
consumed := 0
|
||||
maxBatchSize := envconst.Int("ZREPL_DESTROY_MAX_BATCH_SIZE", 0)
|
||||
for consumed < len(sorted) {
|
||||
batchConsumedUntil := consumed
|
||||
for ; batchConsumedUntil < len(sorted) && sorted[batchConsumedUntil].Filesystem == sorted[consumed].Filesystem; batchConsumedUntil++ {
|
||||
for ; batchConsumedUntil < len(sorted) && (maxBatchSize < 1 || batchConsumedUntil-consumed < maxBatchSize) && sorted[batchConsumedUntil].Filesystem == sorted[consumed].Filesystem; batchConsumedUntil++ {
|
||||
}
|
||||
perFS = append(perFS, sorted[consumed:batchConsumedUntil])
|
||||
consumed = batchConsumedUntil
|
||||
|
Loading…
Reference in New Issue
Block a user