After synchronous write is enabled for the materialized view, if a replica of the corresponding materialized view fails to be written during the alternator put_item, will put_item fail?
From the code, I can see that even if an exception occurs in function mutate_MV
, it will not be handled in function generate_and_propagate_view_updates
.
future<> view_update_generator::mutate_MV(
schema_ptr base,
dht::token base_token,
utils::chunked_vector<frozen_mutation_and_schema> view_updates,
db::view::stats& stats,
replica::cf_stats& cf_stats,
tracing::trace_state_ptr tr_state,
db::timeout_semaphore_units pending_view_updates,
service::allow_hints allow_hints,
wait_for_all_updates wait_for_all)
{
xxx
if (target_endpoint) {
xxxx
if (apply_update_synchronously) {
co_return co_await when_all_succeed(
std::move(local_view_update), std::move(remote_view_update)).discard_result();
} else {
// The update is sent to background in order to preserve availability,
// its parallelism is limited by view_update_concurrency_semaphore
(void)remote_view_update;
}
}
co_return co_await std::move(local_view_update);
});
}
future<> view_update_generator::generate_and_propagate_view_updates(const replica::table& table,
const schema_ptr& base,
reader_permit permit,
std::vector<view_and_base>&& views,
mutation&& m,
mutation_reader_opt existings,
tracing::trace_state_ptr tr_state,
gc_clock::time_point now,
db::timeout_clock::time_point timeout) {
xxx
try {
co_await mutate_MV(base, base_token, std::move(*updates), table.view_stats(), *table.cf_stats(), tr_state,
std::move(units), service::allow_hints::yes, wait_for_all_updates::no);
} catch (...) {
// Ignore exceptions: any individual failure to propagate a view update will be reported
// by a separate mechanism in mutate_MV() function. Moreover, we should continue trying
// to generate updates even if some of them fail, in order to minimize the potential
// inconsistencies caused by not being able to propagate an update
}
}
xxx
}