-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix InternalEngineTests.testMergeThreadLogging #102640
Conversation
The test has to wait for all merge thread log messages (include Lucene ones) to be seen before reset the log level and stop the appender.
Pinging @elastic/es-distributed (Team:Distributed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice finding!
[2023-07-17T11:33:12,562][TRACE][o.e.i.e.I.EngineMergeScheduler] [[index] [index][0] merge thread elasticsearch[[index][0]: Lucene Merge Thread #0] end
[2023-07-17T11:33:12,562][TRACE][o.e.i.e.E.MS ] [[index] [index][0] elasticsearch[[index][0]: Lucene Merge Thread #0] MS: merge thread elasticsearch[[index][0]: Lucene Merge Thread #0] end
For my knowledge, what's MS? And why are there two same messages? I guess the second one failed (because the logger was closed in the meantime)?
assertThat(mockAppender.mergeCompleted(), is(true)); | ||
}); | ||
|
||
Loggers.setLevel(rootLogger, savedLevel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit are these needed? Because I see the .setLevel also in the finally(), but I do not see the engine.close() there (but I assume it happens automatically somehow?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really needed, but wanted to reset the log level before closing the engine (which can also log more things that we are not interested in this test)
This is Lucene's MergeScheduler class which logs messages with a
The purpose of this test is to verify that Lucene's merge scheduler message are correctly logged in Elasticsearch logs. By setting the
Yes, the second one failed and that's why the test now waits for it. |
Thanks Iraklis! |
💚 Backport successful
|
The test has to wait for all merge thread log messages (include Lucene ones) to be seen before reset the log level and stop the appender. Previous attempt wasn't enough: the test failure in elastic#90071 (comment) shows that Lucene's merge scheduler thread can log after the Elasticsearch one, and if the appender has been closed in the meanwhile it can fail the test. This change ensure that the appender saw the Merge Scheduler end message before resetting the log level and close the engine. Closes elastic#90071
The test has to wait for all merge thread log messages (include Lucene ones) to be seen before reset the log level and stop the appender. Previous attempt wasn't enough: the test failure in #90071 (comment) shows that Lucene's merge scheduler thread can log after the Elasticsearch one, and if the appender has been closed in the meanwhile it can fail the test. This change ensure that the appender saw the Merge Scheduler end message before resetting the log level and close the engine. Closes #90071
The test has to wait for all merge thread log messages (include Lucene ones) to be seen before reset the log level and stop the appender. Previous attempt wasn't enough: the test failure in elastic#90071 (comment) shows that Lucene's merge scheduler thread can log after the Elasticsearch one, and if the appender has been closed in the meanwhile it can fail the test. This change ensure that the appender saw the Merge Scheduler end message before resetting the log level and close the engine. Closes elastic#90071
The test has to wait for all merge thread log messages (include Lucene ones) to be seen before reset the log level and stop the appender.
Previous attempt wasn't enough: the test failure in #90071 (comment) shows that Lucene's merge scheduler thread can log after the Elasticsearch one, and if the appender has been closed in the meanwhile it can fail the test.
This pull request ensure that the appender saw the Merge Scheduler
end
message before resetting the log level and close the engine.Closes #90071