Skip to content

Commit 7922c1d

Browse files
committed
Make marina bootstrap retry interval configurable
When marina_pool_server's bootstrap can't reach any bootstrap_ip (transient network outage, slow DNS, container still spinning up), it retries every 500ms. That interval was hardcoded: timer_ref = erlang:send_after(500, self(), ?MSG_BOOTSTRAP) Replaced with a bootstrap_retry_ms application env, defaulted to 500 to preserve existing behaviour. Deployments that want a gentler retry rhythm (e.g. behind flaky DNS) can now set it without forking marina. B2's other two items resolved on inspection: - The 'fuse skip pipeline' recommendation in the plan is misguided. marina_body.erl's skip_tracing / skip_warnings / skip_custom_payload each peel a small fixed-or-counted prefix off the head of the binary; they do not re-scan the body. Fusing them produces no measurable win and would add branching complexity for no reason. - 'Property-based ring tests' is deferred with A4, the umbrella property-test task. Changelog notes the inspection findings so the next reader doesn't re-litigate the same questions.
1 parent 6415660 commit 7922c1d

5 files changed

Lines changed: 29 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## 0.4.6
4+
5+
### Added
6+
7+
- `bootstrap_retry_ms` application env option (default: `500`). When
8+
`marina_pool_server` fails to reach any `bootstrap_ips` host on
9+
startup, it retries on this interval. Previously hardcoded to
10+
500ms; deployments behind slow-DNS or transient network outages
11+
can now back the retry off without forking marina.
12+
13+
### Plan-time notes
14+
15+
- B2's "fuse the body-skip pipeline" recommendation was checked on
16+
inspection and not acted on: `skip_tracing`, `skip_warnings`, and
17+
`skip_custom_payload` in `marina_body.erl` each peel a small
18+
fixed-or-counted prefix off the head of the binary -- they don't
19+
re-scan the body. The recommended fusion produces no measurable
20+
win and adds branching complexity, so it stays as three small
21+
passes.
22+
- B2's "property-based ring tests" item is deferred with A4 (the
23+
property-test umbrella task).
24+
325
## 0.4.5
426

527
### Changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ All settings are read from the `marina` application env.
4545
| -------------------- | ----------------------------- | -------------------------- | ------------------------------------------------------------------------- |
4646
| `backlog_size` | `pos_integer()` | `1024` | Per-connection [shackle](https://github.com/lpgauth/shackle) backlog. |
4747
| `bootstrap_ips` | `[string()]` | `["127.0.0.1"]` | IPs tried in order until one responds with `system.peers`. |
48+
| `bootstrap_retry_ms` | `pos_integer()` | `500` | Delay before re-attempting bootstrap when no IP responded. |
4849
| `compression` | `boolean()` | `false` | Negotiate LZ4 compression on every connection. |
4950
| `keyspace` | `undefined` \| `binary()` | `undefined` | Default keyspace; issued as `USE …` after startup. |
5051
| `password` | `binary()` | `undefined` | Password for `PasswordAuthenticator`. |

include/marina_internal.hrl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
%% defaults
1111
-define(DEFAULT_BACKLOG_SIZE, 1024).
1212
-define(DEFAULT_BOOTSTRAP_IPS, [?GET_ENV(ip, ?DEFAULT_IP)]).
13+
-define(DEFAULT_BOOTSTRAP_RETRY_MS, 500).
1314
-define(DEFAULT_CONNECT_RETRY, 500).
1415
-define(DEFAULT_CONSISTENCY_LEVEL, ?CONSISTENCY_ONE).
1516
-define(DEFAULT_FLAGS, []).

src/marina.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{application, marina, [
22
{description, "High-Performance Erlang Cassandra / Scylla CQL Client"},
3-
{vsn, "0.4.5"},
3+
{vsn, "0.4.6"},
44
{registered, []},
55
{applications, [
66
kernel,

src/marina_pool_server.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ handle_msg(?MSG_BOOTSTRAP, #state {
7070
}};
7171
{error, _Reason} ->
7272
logger:warning("[~p] bootstrap failed~n", [?MODULE]),
73+
RetryMs = ?GET_ENV(bootstrap_retry_ms,
74+
?DEFAULT_BOOTSTRAP_RETRY_MS),
7375
{ok, State#state {
74-
timer_ref = erlang:send_after(500, self(), ?MSG_BOOTSTRAP)
76+
timer_ref = erlang:send_after(RetryMs, self(),
77+
?MSG_BOOTSTRAP)
7578
}}
7679
end;
7780
handle_msg({topology_full_sync, NewNodes}, #state {

0 commit comments

Comments
 (0)