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
d39b2aa5
Commit
d39b2aa5
authored
3 years ago
by
Neelesh Thakur
Browse files
Options
Downloads
Patches
Plain Diff
don't wrap exception
parent
1c8c179c
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
+8
-5
8 additions, 5 deletions
...rg/opengroup/osdu/indexer/service/IndexerServiceImpl.java
with
8 additions
and
5 deletions
indexer-core/src/main/java/org/opengroup/osdu/indexer/service/IndexerServiceImpl.java
+
8
−
5
View file @
d39b2aa5
...
...
@@ -431,7 +431,7 @@ public class IndexerServiceImpl implements IndexerService {
List
<
String
>
failureRecordIds
=
new
LinkedList
<>();
if
(
bulkRequest
.
numberOfActions
()
==
0
)
return
failureRecordIds
;
int
failedRequestStatus
=
500
;
String
failedRequest
Message
=
""
;
Exception
failedRequest
Cause
=
null
;
try
{
BulkResponse
bulkResponse
=
restClient
.
bulk
(
bulkRequest
,
RequestOptions
.
DEFAULT
);
...
...
@@ -444,13 +444,13 @@ public class IndexerServiceImpl implements IndexerService {
for
(
BulkItemResponse
bulkItemResponse
:
bulkResponse
.
getItems
())
{
if
(
bulkItemResponse
.
isFailed
())
{
BulkItemResponse
.
Failure
failure
=
bulkItemResponse
.
getFailure
();
bulkFailures
.
add
(
String
.
format
(
"elasticsearch bulk service status: %s id: %s message: %s"
,
failure
.
getStatus
(),
failure
.
getId
(),
failure
.
getMessage
()));
bulkFailures
.
add
(
String
.
format
(
"elasticsearch bulk service status: %s
|
id: %s
|
message: %s"
,
failure
.
getStatus
(),
failure
.
getId
(),
failure
.
getMessage
()));
this
.
jobStatus
.
addOrUpdateRecordStatus
(
bulkItemResponse
.
getId
(),
IndexingStatus
.
FAIL
,
failure
.
getStatus
().
getStatus
(),
bulkItemResponse
.
getFailureMessage
());
if
(
RETRY_ELASTIC_EXCEPTION
.
contains
(
bulkItemResponse
.
status
()))
{
failureRecordIds
.
add
(
bulkItemResponse
.
getId
());
}
if
(
Strings
.
isNullOrEmpty
(
failedRequestMessage
)
)
{
failedRequest
Messag
e
=
failure
.
get
Messag
e
();
if
(
failedRequestCause
==
null
)
{
failedRequest
Caus
e
=
failure
.
get
Caus
e
();
failedRequestStatus
=
failure
.
getStatus
().
getStatus
();
}
failedResponses
++;
...
...
@@ -464,13 +464,16 @@ public class IndexerServiceImpl implements IndexerService {
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"
,
failedRequest
Messag
e
);
if
(
bulkRequest
.
numberOfActions
()
==
failedResponses
)
throw
new
AppException
(
failedRequestStatus
,
"Elastic error"
,
failedRequest
Cause
.
getMessage
(),
failedRequestCaus
e
);
}
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
);
}
catch
(
ElasticsearchStatusException
e
)
{
throw
new
AppException
(
e
.
status
().
getStatus
(),
"Elastic error"
,
e
.
getMessage
(),
e
);
}
catch
(
Exception
e
)
{
if
(
e
instanceof
AppException
)
{
throw
e
;
}
throw
new
AppException
(
HttpStatus
.
SC_INTERNAL_SERVER_ERROR
,
"Elastic error"
,
"Error indexing records."
,
e
);
}
return
failureRecordIds
;
...
...
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