Add cache support in TransportGetAllocationStatsAction#124898
Add cache support in TransportGetAllocationStatsAction#124898JeremyDahlgren merged 9 commits intoelastic:mainfrom
TransportGetAllocationStatsAction#124898Conversation
|
Hi @JeremyDahlgren, I've created a changelog YAML for you. |
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
DaveCTurner
left a comment
There was a problem hiding this comment.
Great stuff. I've left some suggestions.
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
6403432 to
53f307c
Compare
...ava/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java
Outdated
Show resolved
Hide resolved
84ec448 to
9b87c4b
Compare
|
Hi @JeremyDahlgren, I've created a changelog YAML for you. |
2c040be to
94be786
Compare
| public static final Setting<TimeValue> CACHE_TTL_SETTING = Setting.timeSetting( | ||
| "cluster.routing.allocation.stats.cache.ttl", |
There was a problem hiding this comment.
What visibility/exposure should this setting have? I saw other cluster.routing.allocation.* settings in docs in cluster-level-shard-allocation-routing-settings.md. Should it be documented there?
There was a problem hiding this comment.
Yes, we need to add documentation, either in this PR or in follow up. Both are fine.
There was a problem hiding this comment.
++ would prefer to add the docs in the same PR, otherwise it tends to get forgotten
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
|
Hi @JeremyDahlgren, I've created a changelog YAML for you. |
mhl-b
left a comment
There was a problem hiding this comment.
LGTM. Docs update can be a follow up
| public static final Setting<TimeValue> CACHE_TTL_SETTING = Setting.timeSetting( | ||
| "cluster.routing.allocation.stats.cache.ttl", |
There was a problem hiding this comment.
Yes, we need to add documentation, either in this PR or in follow up. Both are fine.
| Map<String, NodeAllocationStats> get() { | ||
|
|
||
| if (ttlMillis == 0L) { | ||
| return null; | ||
| } | ||
|
|
||
| final var stats = cachedStats.get(); | ||
|
|
||
| if (stats == null || threadPool.relativeTimeInMillis() - stats.timestampMillis > ttlMillis) { | ||
| return null; | ||
| } | ||
|
|
||
| return stats.stats; | ||
| } |
There was a problem hiding this comment.
nit: maybe remove empty lines
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Show resolved
Hide resolved
DaveCTurner
left a comment
There was a problem hiding this comment.
Tiny comments only, otherwise LGTM2
| public static final Setting<TimeValue> CACHE_TTL_SETTING = Setting.timeSetting( | ||
| "cluster.routing.allocation.stats.cache.ttl", |
There was a problem hiding this comment.
++ would prefer to add the docs in the same PR, otherwise it tends to get forgotten
| final var stats = cachedStats.get(); | ||
|
|
||
| if (stats == null || threadPool.relativeTimeInMillis() - stats.timestampMillis > ttlMillis) { | ||
| return null; |
There was a problem hiding this comment.
Should we clear cachedStats here if it's expired? I guess we're just about to overwrite it with a fresh copy so doesn't really matter? If so, could we have a comment just noting this decision for the next person?
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
...rg/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsActionTests.java
Outdated
Show resolved
Hide resolved
Adds a new setting TransportGetAllocationStatsAction.CACHE_MAX_AGE_SETTING to configure the max age for cached AllocationStats on the master. The default value is currently 1 minute per the suggestion in issue 110716. Closes elastic#110716
d41aa7f to
2e6e6ad
Compare
mhl-b
left a comment
There was a problem hiding this comment.
Documentation update LGTM too
|
Hi @JeremyDahlgren, I've created a changelog YAML for you. |
💔 Backport failedThe backport operation could not be completed due to the following error: You can use sqren/backport to manually backport by running |
Adds a new cache and setting TransportGetAllocationStatsAction.CACHE_TTL_SETTING "cluster.routing.allocation.stats.cache.ttl" to configure the max age for cached NodeAllocationStats on the master. The default value is currently 1 minute per the suggestion in issue 110716. Closes elastic#110716
Adds a new cache and setting TransportGetAllocationStatsAction.CACHE_TTL_SETTING "cluster.routing.allocation.stats.cache.ttl" to configure the max age for cached NodeAllocationStats on the master. The default value is currently 1 minute per the suggestion in issue 110716. Closes elastic#110716
Adds a new cache and setting TransportGetAllocationStatsAction.CACHE_TTL_SETTING "cluster.routing.allocation.stats.cache.ttl" to configure the max age for cached NodeAllocationStats on the master. The default value is currently 1 minute per the suggestion in issue 110716. Closes elastic#110716
Adds a new dynamic setting
TransportGetAllocationStatsAction.CACHE_TTL_SETTING"cluster.routing.allocation.stats.cache.ttl"to configure the time to live for cachedNodeAllocationStatson the master. The default value is currently 1 minute per the suggestion in issue #110716.Closes #110716