[ 
https://issues.apache.org/jira/browse/IGNITE-22975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Pereslegin updated IGNITE-22975:
--------------------------------------
    Description: 
Currently minimum begin time among all transactions started locally computes 
under write lock.

{code:java}
    @Override
    public HybridTimestamp minimumBeginTime(Supplier<HybridTimestamp> 
defaultBeginTime) {
        readWriteLock.writeLock().lock();

        try {
            return txCatalogVersionByBeginTxTs.keySet().stream()
                    .min(HybridTimestamp::compareTo)
                    .orElse(defaultBeginTime.get());
        } finally {
            readWriteLock.writeLock().unlock();
        }
    }
{code}

This code blocks the start of transactions and can be optimized.
Need to investigate possible ways to optimize it.

* may be we can somehow use existing ordered map {{txCountByCatalogVersion}} to 
provide minimum require catalog version instead of tx begin time and 
rework/remove {{ActiveLocalTxMinimumBeginTimeProvider}}.
* may be we can ignore defaultBeginTime supplier and not update this timestamp 
when there are no active RW transactions.

p.s. original discussion link 
https://github.com/apache/ignite-3/pull/4137#discussion_r1705728506

  was:
Currently minimum begin time among all transactions started locally computes 
under write lock.

{code:java}
    @Override
    public HybridTimestamp minimumBeginTime(Supplier<HybridTimestamp> 
defaultBeginTime) {
        readWriteLock.writeLock().lock();

        try {
            return txCatalogVersionByBeginTxTs.keySet().stream()
                    .min(HybridTimestamp::compareTo)
                    .orElse(defaultBeginTime.get());
        } finally {
            readWriteLock.writeLock().unlock();
        }
    }
{code}

This code blocks the start of transactions and can be optimized.
Need to investigate possible ways to optimize it.

* may be we can somehow use existing ordered map {{txCountByCatalogVersion}} to 
provide minimum require catalog version instead of tx begin time and 
rework/remove {{ActiveLocalTxMinimumBeginTimeProvider}}.
* may be we can ignore defaultBeginTime supplier and not update this timestamp 
when there are no active RW transactions.


> Catalog compaction. Improve minimum tx begin time local determination
> ---------------------------------------------------------------------
>
>                 Key: IGNITE-22975
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22975
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> Currently minimum begin time among all transactions started locally computes 
> under write lock.
> {code:java}
>     @Override
>     public HybridTimestamp minimumBeginTime(Supplier<HybridTimestamp> 
> defaultBeginTime) {
>         readWriteLock.writeLock().lock();
>         try {
>             return txCatalogVersionByBeginTxTs.keySet().stream()
>                     .min(HybridTimestamp::compareTo)
>                     .orElse(defaultBeginTime.get());
>         } finally {
>             readWriteLock.writeLock().unlock();
>         }
>     }
> {code}
> This code blocks the start of transactions and can be optimized.
> Need to investigate possible ways to optimize it.
> * may be we can somehow use existing ordered map {{txCountByCatalogVersion}} 
> to provide minimum require catalog version instead of tx begin time and 
> rework/remove {{ActiveLocalTxMinimumBeginTimeProvider}}.
> * may be we can ignore defaultBeginTime supplier and not update this 
> timestamp when there are no active RW transactions.
> p.s. original discussion link 
> https://github.com/apache/ignite-3/pull/4137#discussion_r1705728506



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to