Dmitry Werner created IGNITE-29327:
--------------------------------------

             Summary: Move page reservation to the page eviction tracker and 
the trackers out of the persistence package
                 Key: IGNITE-29327
                 URL: https://issues.apache.org/jira/browse/IGNITE-29327
             Project: Ignite
          Issue Type: Improvement
            Reporter: Dmitry Werner
            Assignee: Dmitry Werner
             Fix For: 2.20


Follow-up of the IGNITE-29032 review (PR #13554).

h3. Motivation
* IGNITE-29032 put the size-aware page reservation into \{{AbstractFreeList}} 
(\{{FreeList#reserve}}, \{{FreeList#releaseReserved}}). It belongs to page 
eviction rather than to the free list. It is used only for in-memory regions 
with page eviction enabled 
(\{{IgniteCacheDatabaseSharedManager#isReserveEnabled}}), and it calls 
\{{PageEvictionTracker#evictDataPage()}}. The only thing it needs from the free 
list is the number of empty data pages; everything else comes from the data 
region and its page memory.
* The test-only accessors \{{AbstractFreeList#reservedPages()}} and 
\{{AbstractFreeList#stalled()}} are \{{public}} only because the tests 
(\{{org.apache.ignite.internal.processors.cache.eviction.paged}}) and the free 
list (\{{org.apache.ignite.internal.processors.cache.persistence.freelist}}) 
are in different packages.
* The eviction trackers are in 
\{{org.apache.ignite.internal.processors.cache.persistence.evict}}, but they 
are not related to persistence. Persistent regions always get 
\{{NoOpPageEvictionTracker}}, and the other trackers work only with 
\{{PageMemoryNoStoreImpl}}. The package name is historical: the trackers were 
added to \{{cache.database.evict}} (IGNITE-4534) and ended up in 
\{{cache.persistence}} when IGNITE-5267 renamed \{{cache.database}} to 
\{{cache.persistence}}.

h3. Proposed changes
# Move the reservation state and logic from \{{AbstractFreeList}} to the page 
eviction tracker. This covers the reserved pages counter, the stall flag, the 
no-progress timeout and its backoff, \{{reserve}}/\{{releaseReserved}} and 
their helpers. \{{NoOpPageEvictionTracker}} reserves nothing. 
\{{IgniteCacheDatabaseSharedManager#reserveInRegion}}, 
\{{IgniteCacheDatabaseSharedManager#releaseInRegion}} and 
\{{AbstractFreeList#insertDataRows}} call the data region's tracker instead of 
the free list. The tracker takes the number of empty data pages from its 
region's free list, as \{{PageAbstractEvictionTracker#evictionRequired()}} did 
before IGNITE-29032.
# Move the trackers to a package that is not tied to persistence and that they 
share with their tests, e.g. 
\{{org.apache.ignite.internal.processors.cache.eviction.paged}}. The page 
eviction tests are already there, and no main code package has this name.
# Make the test-only accessors package-private. 
\{{DFLT_EVICTION_NO_PROGRESS_TIMEOUT_MILLIS}} moves with the logic but stays 
\{{public}}, because \{{IgniteSystemProperties}} uses it as the documented 
default of \{{IGNITE_PAGE_EVICTION_NO_PROGRESS_TIMEOUT_MILLIS}}.

This is a refactoring with no behavior change. The page eviction tests in 
\{{IgniteCacheEvictionSelfTestSuite}} and \{{IgniteCacheTestSuite7}} cover it.

h3. Compatibility
Moving the trackers to another package does not break compatibility:
* The package is internal and not part of the public API.
* Users choose a tracker with the \{{DataPageEvictionMode}} value of 
\{{DataRegionConfiguration#pageEvictionMode}}. No Spring XML, .NET, C++, 
logging or resource file (\{{classnames.properties}}, \{{META-INF/services}}) 
refers to the tracker classes or their package.
* The trackers are not serializable, are not messages and are never persisted, 
so nothing changes on the wire, in WAL or in PDS.
* The OSGi bundle exports all local packages, so the new package needs no build 
changes.
* ignite-extensions does not use the trackers.
* \{{IGNITE_PAGE_EVICTION_NO_PROGRESS_TIMEOUT_MILLIS}} keeps its name and 
default.

The only visible change is in logger names: the eviction warnings ("Page-based 
evictions started", "Too many attempts to choose data page" and others) will be 
logged under the trackers' new class names.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to