Skip to content

Commit 3ce701f

Browse files
committed
max_1
1 parent e6a3301 commit 3ce701f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/bencher_schema/src/model/server/backup.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,14 @@ fn run_online_backup(src: &PathBuf, dest: &PathBuf) -> Result<(), ServerBackupEr
149149
error,
150150
})?
151151
.len();
152-
// Calculate the number of pages per step in order to complete the backup in a reasonable time
152+
// Calculate the number of pages per step in order to complete the backup in a reasonable time.
153+
// Ensure that the pages per step is a positive integer.
153154
#[expect(
154155
clippy::cast_possible_truncation,
155156
clippy::integer_division,
156157
reason = "precision is not needed"
157158
)]
158-
let pages_per_step = (src_size / PAGES_PER_STEP_COEFFICIENT as u64) as i32;
159+
let pages_per_step = std::cmp::max((src_size / PAGES_PER_STEP_COEFFICIENT as u64) as i32, 1);
159160

160161
let src_connection =
161162
rusqlite::Connection::open(src).map_err(|error| ServerBackupError::OpenSourceDatabase {

0 commit comments

Comments
 (0)