-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3380 from chakflying/experiment/incremental-vacuu…
…m-job Feat: Run incremental_vacuum and optimize
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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,21 @@ | ||
const { R } = require("redbean-node"); | ||
const { log } = require("../../src/util"); | ||
|
||
/** | ||
* Run incremental_vacuum and checkpoint the WAL. | ||
* @return {Promise<void>} A promise that resolves when the process is finished. | ||
*/ | ||
|
||
const incrementalVacuum = async () => { | ||
try { | ||
log.debug("incrementalVacuum", "Running incremental_vacuum and wal_checkpoint(PASSIVE)..."); | ||
await R.exec("PRAGMA incremental_vacuum(200)"); | ||
await R.exec("PRAGMA wal_checkpoint(PASSIVE)"); | ||
} catch (e) { | ||
log.error("incrementalVacuum", `Failed: ${e.message}`); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
incrementalVacuum, | ||
}; |