SOLR-18364: Remove deprecated SolrCore.isWriterLocked(Directory) - #4784
Open
serhiy-bzhezytskyy wants to merge 1 commit into
Open
SOLR-18364: Remove deprecated SolrCore.isWriterLocked(Directory)#4784serhiy-bzhezytskyy wants to merge 1 commit into
serhiy-bzhezytskyy wants to merge 1 commit into
Conversation
Internal, private, single call site. Inlined its check-then-release logic directly into initIndex() and removed the wrapper method.
epugh
reviewed
Aug 21, 2026
| final String lockType = getSolrConfig().indexConfig.lockType; | ||
| Directory dir = directoryFactory.get(indexDir, DirContext.DEFAULT, lockType); | ||
| try { | ||
| if (isWriterLocked(dir)) { |
Contributor
There was a problem hiding this comment.
I am not quite seeing how this is different? I think this just inlines the isWriterLocked method? I guess I'm looking for some different method on dir.objectLock?
Contributor
|
I think we need to figure out hwo to duplicate this logic in modern Lucene...? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/SOLR-18364
isWriterLocked(Directory)has been@Deprecated(since = "7.0")since Robert Muir's 2016 removal of Lucene's ownIndexWriter.isLocked(), with its own javadoc noting "use of this method can only lead to race conditions." It'sprivatewith a single internal call site, inSolrCore.initIndex().Removed the wrapper and inlined its check-then-release body directly at that one call site — same behavior, one less indirection:
No changelog entry — internal/private method, nothing externally visible changes.
Tests:
SolrCoreCheckLockOnStartupTest(exercises this exact path) green.AI-assisted (Claude Sonnet 5)