-
Notifications
You must be signed in to change notification settings - Fork 102
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
delete query index only if put mappings throws an exception #1685
Changes from 3 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 |
---|---|---|
|
@@ -358,7 +358,8 @@ class DocLevelMonitorQueries(private val client: Client, private val clusterServ | |
monitorMetadata, | ||
updatedIndexName, | ||
sourceIndexFieldLimit, | ||
updatedProperties | ||
updatedProperties, | ||
indexTimeout | ||
) | ||
|
||
if (updateMappingResponse.isAcknowledged) { | ||
|
@@ -487,7 +488,8 @@ class DocLevelMonitorQueries(private val client: Client, private val clusterServ | |
monitorMetadata: MonitorMetadata, | ||
sourceIndex: String, | ||
sourceIndexFieldLimit: Long, | ||
updatedProperties: MutableMap<String, Any> | ||
updatedProperties: MutableMap<String, Any>, | ||
indexTimeout: TimeValue | ||
): Pair<AcknowledgedResponse, String> { | ||
var targetQueryIndex = monitorMetadata.sourceToQueryIndexMapping[sourceIndex + monitor.id] | ||
if ( | ||
|
@@ -551,9 +553,37 @@ class DocLevelMonitorQueries(private val client: Client, private val clusterServ | |
} | ||
} | ||
} else { | ||
log.debug("unknown exception during PUT mapping on queryIndex: $targetQueryIndex") | ||
val unwrappedException = ExceptionsHelper.unwrapCause(e) as Exception | ||
throw AlertingException.wrap(unwrappedException) | ||
// retry with deleting query index | ||
if (monitor.deleteQueryIndexInEveryRun == true && docLevelQueryIndexExists(monitor.dataSources)) { | ||
try { | ||
log.info( | ||
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. split into error log and plz log exception 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. added error log. |
||
"unknown exception during PUT mapping on queryIndex: $targetQueryIndex, " + | ||
"retrying with deletion of query index" | ||
) | ||
val ack = monitorCtx.docLevelMonitorQueries!!.deleteDocLevelQueryIndex(monitor.dataSources) | ||
if (!ack) { | ||
log.error( | ||
"Deletion of concrete queryIndex:${monitor.dataSources.queryIndex} is not ack'd! " + | ||
"for monitor ${monitor.id}" | ||
) | ||
} | ||
initDocLevelQueryIndex(monitor.dataSources) | ||
indexDocLevelQueries( | ||
monitor = monitor, | ||
monitorId = monitor.id, | ||
monitorMetadata, | ||
indexTimeout = indexTimeout | ||
) | ||
} catch (e: Exception) { | ||
log.debug("unknown exception during PUT mapping on queryIndex: $targetQueryIndex") | ||
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. always log the exception log.debug("Doc level monitor $monitorId: unknown exception during PUT mapping on queryIndex: $targetQueryIndex", e) 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. in AlertingException class plz add first line logging error so that if we miss here we wont eat up stacktrace..right now debugging is tough as stacktrace and message is not descriptive due to lack of logging 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.
|
||
val unwrappedException = ExceptionsHelper.unwrapCause(e) as Exception | ||
throw AlertingException.wrap(unwrappedException) | ||
} | ||
} else { | ||
log.debug("unknown exception during PUT mapping on queryIndex: $targetQueryIndex") | ||
val unwrappedException = ExceptionsHelper.unwrapCause(e) as Exception | ||
throw AlertingException.wrap(unwrappedException) | ||
} | ||
} | ||
} | ||
// We did rollover, so try to apply mappings again on new targetQueryIndex | ||
|
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.
we should check doc level query exsits or not only for deletion not for creation of new index
can we remove index exists check here and add only before trying
deleteDocLevelQueryIndex(..)
what if query doesnt exist and exception was index not found
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.
changed this.