Skip to content

Commit

Permalink
Merge pull request #3973 from atlanhq/FT-891
Browse files Browse the repository at this point in the history
FT-891 Incorrect response code given the error for Index search gateway timeout
  • Loading branch information
pavanmanishd authored Jan 13, 2025
2 parents 338c47e + af04695 commit d57d9ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ private DirectIndexQueryResult performAsyncDirectIndexQuery(SearchParams searchP
CompletableFuture.runAsync(() -> SearchContextCache.put(searchContextId, searchContextSequenceNo, esSearchId));
}
response = getAsyncSearchResponse(searchParams, esSearchId).get();
if (response == null) {
// Rather than null (if the response is null wil help returning @204 HTTP_NO_CONTENT to the user)
// return timeout exception to user
throw new AtlasBaseException(AtlasErrorCode.INDEX_SEARCH_FAILED_DUE_TO_TIMEOUT, KeepAliveTime);
if (response == null) {
// If the response is null, we want to return a timeout exception to the user
// This should correspond to a 504 Gateway Timeout since the issue is server-side (Elasticsearch timeout)
throw new AtlasBaseException(AtlasErrorCode.INDEX_SEARCH_GATEWAY_TIMEOUT, KeepAliveTime);
}

if(response.isTimedOut()) {
Expand Down
1 change: 1 addition & 0 deletions intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public enum AtlasErrorCode {
INDEX_SEARCH_FAILED(400, "ATLAS-400-00-102", "Error occurred while running direct index query on ES: {0}"),

INDEX_SEARCH_FAILED_DUE_TO_TIMEOUT(429, "ATLAS-400-00-502", "ES query exceeded timeout: {0}"),
INDEX_SEARCH_GATEWAY_TIMEOUT(504, "ATLAS-504-00-001", "ES query gateway timeout: {0}"),
DEPRECATED_API(400, "ATLAS-400-00-103", "Deprecated API. Use {0} instead"),
DISABLED_API(400, "ATLAS-400-00-104", "API temporarily disabled. Reason: {0}"),
HAS_LINEAGE_GET_EDGE_FAILED(500, "ATLAS-500-00-019", "Error occurred while getting edge between vertices for hasLineage migration: {0}"),
Expand Down

0 comments on commit d57d9ac

Please sign in to comment.