Skip to content

Commit

Permalink
lightningd/options.c: Add --sqlite3-busy-timeout option.
Browse files Browse the repository at this point in the history
ChangeLog-Added: lightningd: New `--sqlite3-busy-timeout` option to change the SQLITE3 timeout; use this to prevent crashes when using `litestream` on slow media.
  • Loading branch information
ZmnSCPxj committed Oct 15, 2021
1 parent 3a7c586 commit 1300a6c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/lightning-listconfigs.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ On success, an object is returned, containing:
- **force-feerates** (string, optional): force-feerate configuration setting, if any
- **subdaemon** (string, optional): `subdaemon` fields from config or cmdline if any (can be more than one)
- **tor-service-password** (string, optional): `tor-service-password` field from config or cmdline, if any
- **sqlite3-busy-timeout** (u32, optional): seconds to wait for a separate process to unlock database

[comment]: # (GENERATE-FROM-SCHEMA-END)

Expand Down Expand Up @@ -205,4 +206,4 @@ RESOURCES
---------

Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:7bb40fc8fac201b32d9701b02596d0fa59eb14a3baf606439cbf96dc11548ed4)
[comment]: # ( SHA256STAMP:20f9624e55fffc401e5d366fdfe5a3d34e7d2364c4367665caf78bd569f07151)
9 changes: 9 additions & 0 deletions doc/lightningd-config.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,15 @@ if C-lightning terminates.
Built-in plugins, which are installed with lightningd(8), are automatically
considered important.

### Database Options

**sqlite3-busy-timeout**=*SECONDS*
Indicate a maximum number of seconds to wait for a separate process to
unlock the database, if using the `sqlite3` backend.
For example, the `litestream` tool can be used to replicate the database,
but on slow media, or at high load conditions, could cause C-lightning to
crash with a "database is locked" message unless you increase the timeout.

### Experimental Options

Experimental options are subject to breakage between releases: they
Expand Down
4 changes: 4 additions & 0 deletions doc/schemas/listconfigs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@
"tor-service-password": {
"type": "string",
"description": "`tor-service-password` field from config or cmdline, if any"
},
"sqlite3-busy-timeout": {
"type": "u32",
"description": "seconds to wait for a separate process to unlock database"
}
}
}
7 changes: 7 additions & 0 deletions lightningd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,13 @@ static void register_opts(struct lightningd *ld)
"--subdaemon=hsmd:remote_signer "
"would use a hypothetical remote signing subdaemon.");

opt_register_arg("--sqlite3-busy-timeout",
&opt_set_uintval, &opt_show_uintval,
&ld->db_options->sqlite3_busy_timeout,
"Specifies the maximum number of seconds to wait for a "
"separate process (e.g. litestream) to unlock the database, "
"before failing.");

opt_register_logging(ld);
opt_register_version();

Expand Down

0 comments on commit 1300a6c

Please sign in to comment.