[
https://issues.apache.org/jira/browse/IGNITE-28897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vladislav Pyatkov updated IGNITE-28897:
---------------------------------------
Description:
The transactional lock API returns a single boolean and checks entry versions
on the initiating node after acquiring locks. This cannot represent partial
success and requires additional cleanup when a version has changed.
Extend the bulk API with per-entry results and an explicit {{skipLocked}} flag:
{code:java}
Map<CacheEntry<K, V>, Boolean> lockTxEntries(
Collection<CacheEntry<K, V>> entries,
long waitTimeout,
boolean skipLocked
);
IgniteInternalFuture<Map<CacheEntry<K, V>, Boolean>> lockTxEntriesAsync(
Collection<CacheEntry<K, V>> entries,
long waitTimeout,
boolean skipLocked
);
{code}
* Send expected data versions in batched requests to primary nodes and return
individual lock outcomes in the responses. Preserve the existing mapping and
lock acquisition order.
* Validate the version on the primary after acquiring transactional MVCC
ownership, under the entry mutex. The mutex protects the comparison; retained
MVCC ownership prevents another transactional writer from changing the version
before the lock is released.
* With {{skipLocked=true}}, continue after a lock conflict or a missing/changed
entry, report rejected entries as {{false}}, and retain successful locks.
* With {{skipLocked=false}}, stop on the first rejection, release locks
acquired by this call, and report all entries not locked before the call as
{{false}}.
* In both modes, reuse previously held locks, report them as {{true}}, and
preserve them on failure. Correctly mark near-cache transaction entries as
{{locked}}, including after a pessimistic repeatable-read get.
* Keep infrastructure errors exceptional and preserve the timeout semantics
established by IGNITE-29279. The flag controls partial success; {{waitTimeout}}
controls lock waiting.
* Keep the single-entry methods returning {{boolean}} /
{{IgniteInternalFuture<Boolean>}}. Adapt existing callers, including {{SELECT
FOR UPDATE}}, to the bulk result with {{skipLocked=false}}.
* Update lock message schemas and gate the new protocol fields through the
rolling-upgrade feature mechanism.
h3. Definition of done
* Cover partial success, all-or-nothing rejection, previously held locks, near
caches, version changes while waiting, version protection after acquisition,
timeouts, and batched requests.
* Existing {{SELECT FOR UPDATE}} and lock wait timeout tests pass.
SQL-level {{SELECT FOR UPDATE SKIP LOCKED}} support is tracked by IGNITE-28898.
was:
The transactional lock API returns a single boolean and checks entry versions
on the initiating node after acquiring locks. This cannot represent partial
success and requires additional cleanup when a version has changed.
Extend the bulk API with per-entry results and an explicit {{skipLocked}} flag:
{code:java}
Map<CacheEntry<K, V>, Boolean> lockTxEntries(
Collection<CacheEntry<K, V>> entries, long waitTimeout, boolean skipLocked);
IgniteInternalFuture<Map<CacheEntry<K, V>, Boolean>> lockTxEntriesAsync(
Collection<CacheEntry<K, V>> entries, long waitTimeout, boolean skipLocked);
{code}
* Send expected data versions in batched requests to primary nodes and return
individual lock outcomes in the responses. Preserve the existing mapping and
lock acquisition order.
* Validate the version on the primary after acquiring transactional MVCC
ownership, under the entry mutex. The mutex protects the comparison; retained
MVCC ownership prevents another transactional writer from changing the version
before the lock is released.
* With {{skipLocked=true}}, continue after a lock conflict or a missing/changed
entry, report rejected entries as {{false}}, and retain successful locks.
* With {{skipLocked=false}}, stop on the first rejection, release locks
acquired by this call, and report all entries not locked before the call as
{{false}}.
* In both modes, reuse previously held locks, report them as {{true}}, and
preserve them on failure. Correctly mark near-cache transaction entries as
{{locked}}, including after a pessimistic repeatable-read get.
* Keep infrastructure errors exceptional and preserve the timeout semantics
established by IGNITE-29279. The flag controls partial success; {{waitTimeout}}
controls lock waiting.
* Keep the single-entry methods returning {{boolean}} /
{{IgniteInternalFuture<Boolean>}}. Adapt existing callers, including {{SELECT
FOR UPDATE}}, to the bulk result with {{skipLocked=false}}.
* Update lock message schemas and gate the new protocol fields through the
rolling-upgrade feature mechanism.
h3. Definition of done
* Cover partial success, all-or-nothing rejection, previously held locks, near
caches, version changes while waiting, version protection after acquisition,
timeouts, and batched requests.
* Existing {{SELECT FOR UPDATE}} and lock wait timeout tests pass.
SQL-level {{SELECT FOR UPDATE SKIP LOCKED}} support is tracked by IGNITE-28898.
> Add primary-side version validation and skipLocked to transactional lock API
> ----------------------------------------------------------------------------
>
> Key: IGNITE-28897
> URL: https://issues.apache.org/jira/browse/IGNITE-28897
> Project: Ignite
> Issue Type: Improvement
> Reporter: Vladislav Pyatkov
> Assignee: Vladislav Pyatkov
> Priority: Major
> Labels: ignite-2
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> The transactional lock API returns a single boolean and checks entry versions
> on the initiating node after acquiring locks. This cannot represent partial
> success and requires additional cleanup when a version has changed.
> Extend the bulk API with per-entry results and an explicit {{skipLocked}}
> flag:
> {code:java}
> Map<CacheEntry<K, V>, Boolean> lockTxEntries(
> Collection<CacheEntry<K, V>> entries,
> long waitTimeout,
> boolean skipLocked
> );
> IgniteInternalFuture<Map<CacheEntry<K, V>, Boolean>> lockTxEntriesAsync(
> Collection<CacheEntry<K, V>> entries,
> long waitTimeout,
> boolean skipLocked
> );
> {code}
> * Send expected data versions in batched requests to primary nodes and return
> individual lock outcomes in the responses. Preserve the existing mapping and
> lock acquisition order.
> * Validate the version on the primary after acquiring transactional MVCC
> ownership, under the entry mutex. The mutex protects the comparison; retained
> MVCC ownership prevents another transactional writer from changing the
> version before the lock is released.
> * With {{skipLocked=true}}, continue after a lock conflict or a
> missing/changed entry, report rejected entries as {{false}}, and retain
> successful locks.
> * With {{skipLocked=false}}, stop on the first rejection, release locks
> acquired by this call, and report all entries not locked before the call as
> {{false}}.
> * In both modes, reuse previously held locks, report them as {{true}}, and
> preserve them on failure. Correctly mark near-cache transaction entries as
> {{locked}}, including after a pessimistic repeatable-read get.
> * Keep infrastructure errors exceptional and preserve the timeout semantics
> established by IGNITE-29279. The flag controls partial success;
> {{waitTimeout}} controls lock waiting.
> * Keep the single-entry methods returning {{boolean}} /
> {{IgniteInternalFuture<Boolean>}}. Adapt existing callers, including {{SELECT
> FOR UPDATE}}, to the bulk result with {{skipLocked=false}}.
> * Update lock message schemas and gate the new protocol fields through the
> rolling-upgrade feature mechanism.
> h3. Definition of done
> * Cover partial success, all-or-nothing rejection, previously held locks,
> near caches, version changes while waiting, version protection after
> acquisition, timeouts, and batched requests.
> * Existing {{SELECT FOR UPDATE}} and lock wait timeout tests pass.
> SQL-level {{SELECT FOR UPDATE SKIP LOCKED}} support is tracked by
> IGNITE-28898.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)