Repository navigation
Report locked indexes and index rebuilds at start-up #6036
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -34,6 +34,8 @@ public static async Task CreateIndexesAsync(IEnumerable<AbstractIndexCreationTas | |||||
| var databaseDefault = await GetDatabaseSearchEngineType(store, cancellationToken); | ||||||
| var databaseDefaultIsLucene = string.Equals(databaseDefault, nameof(SearchEngineType.Lucene), StringComparison.OrdinalIgnoreCase); | ||||||
|
|
||||||
| Logger.LogInformation("Database {DatabaseName} static index search engine setting: {DatabaseDefault}", store.Database, databaseDefault ?? "not set, the server default applies"); | ||||||
|
|
||||||
| foreach (var index in indexList) | ||||||
| { | ||||||
| var replacementName = Constants.Documents.Indexing.SideBySideIndexNamePrefix + index.IndexName; | ||||||
|
|
@@ -43,6 +45,18 @@ public static async Task CreateIndexesAsync(IEnumerable<AbstractIndexCreationTas | |||||
| var changes = existing == null ? IndexDefinitionCompareDifferences.None : RebuildChanges(existing, index, store); | ||||||
| var changed = changes != IndexDefinitionCompareDifferences.None; | ||||||
|
|
||||||
| if (existing?.LockMode is IndexLockMode.LockedIgnore or IndexLockMode.LockedError) | ||||||
| { | ||||||
| if (changed) | ||||||
| { | ||||||
| Logger.LogError("Index {IndexName} is locked ({LockMode}) and its definition changed ({Changes}). The change is not applied until the index is unlocked", index.IndexName, existing.LockMode, changes); | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| Logger.LogWarning("Index {IndexName} is locked ({LockMode}). Definition changes from new versions are not applied until the index is unlocked", index.IndexName, existing.LockMode); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As is, this message could raise support questions for no good reason. What about:
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, however, I would try to make it shorter... Something like "Index XX is locked but definition is full compatible"? |
||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // 1. A search engine set in our index definition always wins. It can be set through SearchEngineType or Configuration. | ||||||
| if (index.SearchEngineType.HasValue) | ||||||
| { | ||||||
|
|
@@ -75,14 +89,17 @@ public static async Task CreateIndexesAsync(IEnumerable<AbstractIndexCreationTas | |||||
| { | ||||||
| var reason = existing == null ? "is created" : $"is rebuilt because its definition changed ({changes})"; | ||||||
|
|
||||||
| // A rebuild of a large index takes long and degrades ingestion, see docs.particular.net/servicecontrol/upgrades/#upgrades-that-rebuild-indexes | ||||||
| var level = changed ? LogLevel.Warning : LogLevel.Information; | ||||||
|
|
||||||
| if (databaseDefaultIsLucene) | ||||||
| { | ||||||
| Logger.LogInformation("Index {IndexName} {Reason} and inherits the Lucene search engine from the database", index.IndexName, reason); | ||||||
| Logger.Log(level, "Index {IndexName} {Reason} and inherits the Lucene search engine from the database", index.IndexName, reason); | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| index.Configuration[StaticSearchEngineTypeKey] = nameof(SearchEngineType.Lucene); | ||||||
| Logger.LogInformation("Index {IndexName} {Reason} with the Lucene search engine set on the index, the database setting is {DatabaseDefault}", index.IndexName, reason, databaseDefault ?? "not set"); | ||||||
| Logger.Log(level, "Index {IndexName} {Reason} with the Lucene search engine set on the index, the database setting is {DatabaseDefault}", index.IndexName, reason, databaseDefault ?? "not set"); | ||||||
| } | ||||||
|
|
||||||
| continue; | ||||||
|
|
||||||
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.
@mauroservienti and I have discussed that maybe it is even better to throw an exception here as some part of application depends on this change. If this part is not critical then maybe its not that important to throw but we align on that we should throw here.