Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Indexer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Indexer
Commits
144ad090
Commit
144ad090
authored
3 years ago
by
Neelesh Thakur
Browse files
Options
Downloads
Patches
Plain Diff
retry entire batch if all record indexing is failing
parent
30c15b32
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!346
Merge branch 'aws-integration' into 'master'
,
!292
Fix record retry for deleted events on deleted index
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexer-core/src/main/java/org/opengroup/osdu/indexer/service/IndexerServiceImpl.java
+9
-0
9 additions, 0 deletions
...rg/opengroup/osdu/indexer/service/IndexerServiceImpl.java
with
9 additions
and
0 deletions
indexer-core/src/main/java/org/opengroup/osdu/indexer/service/IndexerServiceImpl.java
+
9
−
0
View file @
144ad090
...
...
@@ -430,6 +430,8 @@ public class IndexerServiceImpl implements IndexerService {
List
<
String
>
failureRecordIds
=
new
LinkedList
<>();
if
(
bulkRequest
.
numberOfActions
()
==
0
)
return
failureRecordIds
;
int
failedRequestStatus
=
200
;
String
failedRequestMessage
=
""
;
try
{
BulkResponse
bulkResponse
=
restClient
.
bulk
(
bulkRequest
,
RequestOptions
.
DEFAULT
);
...
...
@@ -447,6 +449,10 @@ public class IndexerServiceImpl implements IndexerService {
if
(
RETRY_ELASTIC_EXCEPTION
.
contains
(
bulkItemResponse
.
status
()))
{
failureRecordIds
.
add
(
bulkItemResponse
.
getId
());
}
if
(
Strings
.
isNullOrEmpty
(
failedRequestMessage
))
{
failedRequestMessage
=
failure
.
getMessage
();
failedRequestStatus
=
failure
.
getStatus
().
getStatus
();
}
failedResponses
++;
}
else
{
succeededResponses
++;
...
...
@@ -456,6 +462,9 @@ public class IndexerServiceImpl implements IndexerService {
if
(!
bulkFailures
.
isEmpty
())
this
.
jaxRsDpsLog
.
warning
(
bulkFailures
);
jaxRsDpsLog
.
info
(
String
.
format
(
"records in elasticsearch service bulk request: %s | successful: %s | failed: %s"
,
bulkRequest
.
numberOfActions
(),
succeededResponses
,
failedResponses
));
// retry entire message if all records are failing
if
(
bulkRequest
.
numberOfActions
()
==
failedResponses
)
throw
new
AppException
(
failedRequestStatus
,
"Elastic error"
,
failedRequestMessage
);
}
catch
(
IOException
e
)
{
// throw explicit 504 for IOException
throw
new
AppException
(
HttpStatus
.
SC_GATEWAY_TIMEOUT
,
"Elastic error"
,
"Request cannot be completed in specified time."
,
e
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment