-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(search): treat stale parentOf as warning during time-series reindex (#27417) #27800
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 3 commits
50f1406
91bbdc1
007670f
23578b0
82d5aa4
856fd2d
38b4ec9
bd34de1
fcfbb39
9a2d801
6ec614e
d67704d
bfb575a
a53abfc
fb60d37
b4cc517
0601641
eac76b6
4e5b10d
e16d327
b12c923
861aa2d
9bfe79b
75f704a
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 |
|---|---|---|
|
|
@@ -65,6 +65,52 @@ public static void getUpdatedStats( | |
| (stats.getWarningRecords() != null ? stats.getWarningRecords() : 0) + currentWarnings); | ||
| } | ||
|
|
||
| /** | ||
| * Returns true when an EntityError represents a stale relationship to a missing entity. These | ||
| * are expected during reindexing — for example when a time-series record | ||
| * (testCaseResolutionStatus, testCaseResult) was migrated without a corresponding | ||
| * entity_relationship row, or when an entity was hard-deleted out-of-band leaving its | ||
| * relationship rows behind. Such records cannot be meaningfully indexed and are reported as | ||
| * warnings rather than failing the entire batch. | ||
| * | ||
| * <p>The patterns match the canonical message shapes from {@code CatalogExceptionMessage} and | ||
| * {@code EntityNotFoundException} — bare {@code "not found"} is intentionally NOT matched | ||
| * because it would misclassify unrelated errors like {@code "Column 'foo' not found in result | ||
| * set"} or {@code "SSL certificate not found"}. | ||
| */ | ||
| public static boolean isEntityNotFoundError(EntityError error) { | ||
| if (error == null || error.getMessage() == null) { | ||
| return false; | ||
| } | ||
| String message = error.getMessage().toLowerCase(); | ||
| return message.contains("instance for") | ||
|
mohityadav766 marked this conversation as resolved.
Outdated
|
||
| || message.contains("entity not found") | ||
| || message.contains("does not exist") | ||
| || message.contains("entitynotfoundexception") | ||
|
mohityadav766 marked this conversation as resolved.
Outdated
|
||
| || message.contains("expected relationship"); | ||
| } | ||
|
mohityadav766 marked this conversation as resolved.
Outdated
mohityadav766 marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Splits {@code errors} into stale-relationship warnings (appended to {@code warningsOut}) and | ||
| * real failures (returned). Both lists must be mutable; {@code warningsOut} must be non-null. | ||
| */ | ||
| public static List<EntityError> partitionErrors( | ||
| List<EntityError> errors, List<EntityError> warningsOut) { | ||
| java.util.Objects.requireNonNull(warningsOut, "warningsOut must not be null"); | ||
| if (CommonUtil.nullOrEmpty(errors)) { | ||
| return new ArrayList<>(); | ||
| } | ||
| List<EntityError> realErrors = new ArrayList<>(errors.size()); | ||
| for (EntityError error : errors) { | ||
| if (isEntityNotFoundError(error)) { | ||
| warningsOut.add(error); | ||
| } else { | ||
|
Comment on lines
+105
to
+115
|
||
| realErrors.add(error); | ||
| } | ||
| } | ||
| return realErrors; | ||
| } | ||
|
|
||
| public static boolean isDataInsightIndex(String entityType) { | ||
| return Entity.getSearchRepository().getDataInsightReports().contains(entityType); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.