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

Dmitry Werner updated IGNITE-29327:
-----------------------------------
    Description: 
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. For the same reason the tests keep their own copy of the 
data page payload formula.
 * 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, and the sizing of a batch of rows 
({{{}AbstractFreeList#batchSize{}}} becomes 
{{{}PageEvictionTracker#reserve(Collection, boolean){}}}). 
{{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.
 # Let the tracker answer whether the reservation is engaged: 
{{PageEvictionTracker#reserveEnabled()}} is {{false}} for 
{{{}NoOpPageEvictionTracker{}}}, and 
{{IgniteCacheDatabaseSharedManager#isReserveEnabled}} asks the tracker instead 
of repeating the configuration check.
 # Move the trackers to 
{{{}org.apache.ignite.internal.processors.cache.eviction.paged{}}}, a package 
that is not tied to persistence and that they share with their tests. The page 
eviction tests are already there.
 # Make the test-only accessors package-private, and let the tests read the 
data page payload from the tracker 
({{{}PageAbstractEvictionTracker#pagePayload(){}}}) instead of their own 
constant. {{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: the reservation algorithm and its callers are unchanged.
h3. Compatibility

Moving the trackers to another package does not break compatibility.

Visible changes:
 * Logger names. "Too many attempts to choose data page" and "Too many failed 
attempts to evict page" keep their tracker classes, whose package changes. 
"Page-based evictions started" and "Page eviction made no progress" move from 
the {{PagesList}} logger to the tracker class.
 * {{IGNITE_PAGE_EVICTION_NO_PROGRESS_TIMEOUT_MILLIS}} is read when a data 
region is created (node start) instead of when its free list is created 
(cluster activation).

  was:
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. For the same reason the tests keep their own copy of the 
data page payload formula.
 * 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, and the sizing of a batch of rows 
({{{}AbstractFreeList#batchSize{}}} becomes 
{{{}PageEvictionTracker#reserve(Collection, boolean){}}}). 
{{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.
 # Let the tracker answer whether the reservation is engaged: 
{{PageEvictionTracker#reserveEnabled()}} is {{false}} for 
{{{}NoOpPageEvictionTracker{}}}, and 
{{IgniteCacheDatabaseSharedManager#isReserveEnabled}} asks the tracker instead 
of repeating the configuration check.
 # Move the trackers to 
{{{}org.apache.ignite.internal.processors.cache.eviction.paged{}}}, a package 
that is not tied to persistence and that they share with their tests. The page 
eviction tests are already there.
 # Make the test-only accessors package-private, and let the tests read the 
data page payload from the tracker 
({{{}PageAbstractEvictionTracker#pagePayload(){}}}) instead of their own 
constant. {{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: the reservation algorithm and its callers are unchanged.
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.
 * ignite-extensions does not use the trackers.
 * {{IGNITE_PAGE_EVICTION_NO_PROGRESS_TIMEOUT_MILLIS}} keeps its name and 
default.

Visible changes:
 * Logger names. "Too many attempts to choose data page" and "Too many failed 
attempts to evict page" keep their tracker classes, whose package changes. 
"Page-based evictions started" and "Page eviction made no progress" move from 
the {{PagesList}} logger to the tracker class.
 * {{IGNITE_PAGE_EVICTION_NO_PROGRESS_TIMEOUT_MILLIS}} is read when a data 
region is created (node start) instead of when its free list is created 
(cluster activation).


> 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
>            Priority: Minor
>             Fix For: 2.20
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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. For the same reason the tests keep their own copy 
> of the data page payload formula.
>  * 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, and the sizing of a batch of rows 
> ({{{}AbstractFreeList#batchSize{}}} becomes 
> {{{}PageEvictionTracker#reserve(Collection, boolean){}}}). 
> {{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.
>  # Let the tracker answer whether the reservation is engaged: 
> {{PageEvictionTracker#reserveEnabled()}} is {{false}} for 
> {{{}NoOpPageEvictionTracker{}}}, and 
> {{IgniteCacheDatabaseSharedManager#isReserveEnabled}} asks the tracker 
> instead of repeating the configuration check.
>  # Move the trackers to 
> {{{}org.apache.ignite.internal.processors.cache.eviction.paged{}}}, a package 
> that is not tied to persistence and that they share with their tests. The 
> page eviction tests are already there.
>  # Make the test-only accessors package-private, and let the tests read the 
> data page payload from the tracker 
> ({{{}PageAbstractEvictionTracker#pagePayload(){}}}) instead of their own 
> constant. {{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: the reservation algorithm and its callers are 
> unchanged.
> h3. Compatibility
> Moving the trackers to another package does not break compatibility.
> Visible changes:
>  * Logger names. "Too many attempts to choose data page" and "Too many failed 
> attempts to evict page" keep their tracker classes, whose package changes. 
> "Page-based evictions started" and "Page eviction made no progress" move from 
> the {{PagesList}} logger to the tracker class.
>  * {{IGNITE_PAGE_EVICTION_NO_PROGRESS_TIMEOUT_MILLIS}} is read when a data 
> region is created (node start) instead of when its free list is created 
> (cluster activation).



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

Reply via email to