feat(persist): accept concurrent matching updates

As an optimisation, allow a persist task to progress if it observes a
concurrent catalog sort key update that exactly matches the sort key it
was committing.
pull/24376/head
Dom Dwyer 2022-12-20 15:13:58 +01:00
parent f64ffbe035
commit e083f3276c
No known key found for this signature in database
GPG Key ID: E4C40DBD9157879A
1 changed files with 25 additions and 0 deletions

View File

@ -340,6 +340,31 @@ impl Context {
{
Ok(_) => ControlFlow::Break(Ok(())),
Err(CasFailure::QueryError(e)) => ControlFlow::Continue(e),
Err(CasFailure::ValueMismatch(observed))
if observed == new_sort_key_str =>
{
// A CAS failure occurred because of a concurrent
// sort key update, however the new catalog sort key
// exactly matches the sort key this node wants to
// commit.
//
// This is the sad-happy path, and this task can
// continue.
info!(
%object_store_id,
namespace_id = %self.namespace_id,
namespace_name = %self.namespace_name,
table_id = %self.table_id,
table_name = %self.table_name,
partition_id = %self.partition_id,
partition_key = %self.partition_key,
expected=?old_sort_key,
?observed,
update=?new_sort_key_str,
"detected matching concurrent sort key update"
);
ControlFlow::Break(Ok(()))
}
Err(CasFailure::ValueMismatch(observed)) => {
// Another ingester concurrently updated the sort
// key.