Skip to content

Commit 1877a19

Browse files
committed
Defer recovery restart until commit
Request host restart from post-commit hooks instead of from the JOINING transaction. Preserve trace-event-before-restart ordering in trace-enabled builds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46d56f8a-935f-4551-abe3-84bd4f951865
1 parent a4824c5 commit 1877a19

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [7.0.14]
9+
10+
[7.0.14]: https://github.com/microsoft/CCF/releases/tag/ccf-7.0.14
11+
12+
### Fixed
13+
14+
- Recovery-decision-protocol nodes now request host restart only after the `JOINING` state transaction commits, preventing restart for an aborted transaction. (#8241)
15+
816
## [7.0.13]
917

1018
[7.0.13]: https://github.com/microsoft/CCF/releases/tag/ccf-7.0.13

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ccf"
7-
version = "7.0.13"
7+
version = "7.0.14"
88
authors = [
99
{ name="CCF Team", email="CCF-Sec@microsoft.com" },
1010
]

src/node/recovery_decision_protocol.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ namespace ccf
6464
node_state(node_state_)
6565
{}
6666

67+
void RecoveryDecisionProtocolSubsystem::restart_after_commit()
68+
{
69+
RINGBUFFER_WRITE_MESSAGE(AdminMessage::restart, node_state->to_host);
70+
}
71+
6772
#ifdef CCF_RECOVERY_TRACE
6873
void RecoveryDecisionProtocolSubsystem::initialise_trace(ccf::kv::Tx& tx)
6974
{
@@ -106,8 +111,7 @@ namespace ccf
106111
emit_trace_event(event.value());
107112
if (event->kind == "join_restart")
108113
{
109-
RINGBUFFER_WRITE_MESSAGE(
110-
AdminMessage::restart, node_state->to_host);
114+
restart_after_commit();
111115
}
112116
}
113117
}
@@ -375,6 +379,16 @@ namespace ccf
375379
start_message_retry_timers();
376380
start_failover_timers();
377381
}
382+
else if (
383+
w.has_value() &&
384+
w.value() == recovery_decision_protocol::StateMachine::JOINING)
385+
{
386+
#ifndef CCF_RECOVERY_TRACE
387+
restart_after_commit();
388+
#else
389+
// The trace-event commit hook emits join_restart before restarting.
390+
#endif
391+
}
378392
}));
379393
}
380394

@@ -530,10 +544,6 @@ namespace ccf
530544
auto service_cert =
531545
ccf::crypto::cert_der_to_pem(node_config->service_cert_der);
532546
LOG_INFO_FMT("{}", service_cert.str());
533-
534-
#ifndef CCF_RECOVERY_TRACE
535-
RINGBUFFER_WRITE_MESSAGE(AdminMessage::restart, node_state->to_host);
536-
#endif
537547
}
538548
case recovery_decision_protocol::StateMachine::OPENING:
539549
{

src/node/recovery_decision_protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ namespace ccf
106106

107107
// Stop periodic tasks
108108
void stop_timers();
109+
void restart_after_commit();
109110

110111
// Steady state operations
111112
recovery_decision_protocol::RequestNodeInfo& get_node_info(

0 commit comments

Comments
 (0)