[elastic/elasticsearch]将文件设置健康信息传播到健康节点

2025-10-29 935 views
3
抽象的

文件设置在主节点上处理,但健康状况由健康节点报告。为了确保状态报告正确,我们必须将健康信息从主节点转发到健康节点。

请参阅 ES-10965。

设计

文件设置健康信息的记录系统是主节点的FileSettingsHealthIndicatorService.currentInfo字段,但健康信息实际上是由HealthInfoCache健康节点上报的。因此,每当健康信息发生currentInfo更改时,我们都会UpdateHealthInfoCacheAction向健康节点发送请求,以更新其缓存,使其与主节点上的实际值保持一致。

数据表示

该HealthInfo记录由健康 API 返回。我已添加FileSettingsHealthInfo到此结构中,并INDETERMINATE在没有可用信息时使用该值(而不是 null),以解决一些极端情况。为了确保一致性,我使用相同的记录作为其内部表示FileSettingsHealthIndicatorService;在此 PR 之前,我们一直使用多个单独的易失性字段来表示健康状态的各个部分。

相反,该UpdateHealthInfoCacheAction.Request记录用于将信息传播到健康节点。这由各个健康报告组件触发,每个组件应该只设置自己的健康信息,而其他组件则保持不变。因此,对于此记录,如果缺少文件设置健康信息,则用 null 表示。

传播步骤 文件设置已更改。在主节点上,FileSettingsService.completeProcessing记录成功或失败情况,将更新后的信息记录为一个FileSettingsHealthInfo对象,然后在代码块FileSettingsHealthIndicatorService.publish中调用finally。 FileSettingsHealthIndicatorPublisherImpl.publish查找健康节点,并向其发送UpdateHealthInfoCacheAction包含新健康信息的请求,所有其他字段为空以表明我们不会更改这些字段。 在健康节点上,HealthInfoCache已使用新的进行更新FileSettingsHealthInfo。

回答

6

正在 ping @elastic/es-core-infra (Team:Core/Infra)

8

出现故障:

REPRODUCE WITH: ./gradlew ":server:internalClusterTest" --tests "org.elasticsearch.reservedstate.service.FileSettingsServiceIT.testHealthIndicator" -Dtests.seed=CD596C989260970B -Dtests.locale=xh -Dtests.timezone=US/Hawaii -Druntime.java=24 FileSettingsServiceIT > testHealthIndicator FAILED java.lang.AssertionError: expected:<1> but was:<0> at __randomizedtesting.SeedInfo.seed([CD596C989260970B:CBC260190393BCD7]:0) at org.junit.Assert.fail(Assert.java:89) at org.junit.Assert.failNotEquals(Assert.java:835) at org.junit.Assert.assertEquals(Assert.java:647) at org.junit.Assert.assertEquals(Assert.java:633) at org.elasticsearch.reservedstate.service.FileSettingsServiceIT.lambda$testHealthIndicator$13(FileSettingsServiceIT.java:528) at org.elasticsearch.test.ESTestCase.assertBusy(ESTestCase.java:1481) at org.elasticsearch.test.ESTestCase.assertBusy(ESTestCase.java:1453) at org.elasticsearch.reservedstate.service.FileSettingsServiceIT.testHealthIndicator(FileSettingsServiceIT.java:528)

我觉得这样就行了。🤔

7

我跑了50次,50次都成功了。

我不明白它怎么会间歇性地失败,除非健康传播花费的时间太长以致于超时。

1

正在 ping @elastic/es-data-management(团队:数据管理)

6

@nielsbauman - 抱歉强行推送。历史搞乱了,所以我只能用大锤来理顺了。

我认为你实际上已经审查了 936813b 之前的提交,所以之后的提交对你来说应该是新的。

4

相关的无服务器 PR:https://github.com/elastic/elasticsearch-serverless/pull/3838