Skip to content

Commit 594765e

Browse files
Chandra Kanth PeravelliChandra Kanth Peravelli
Chandra Kanth Peravelli
authored and
Chandra Kanth Peravelli
committed
ATLAS-4922: Add new urls to notFilterd list for HA fix concurrent modification of consumers and return 404 in case of import id not found
1 parent a65a5f8 commit 594765e

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

intg/src/main/java/org/apache/atlas/AtlasErrorCode.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public enum AtlasErrorCode {
205205
FILE_NAME_NOT_FOUND(404, "ATLAS-404-00-014", "File name should not be blank"),
206206
NO_TYPE_NAME_ON_VERTEX(404, "ATLAS-404-00-015", "No typename found for given entity with guid: {0}"),
207207
NO_LINEAGE_CONSTRAINTS_FOR_GUID(404, "ATLAS-404-00-016", "No lineage constraints found for requested entity with guid : {0}"),
208-
IMPORT_NOT_FOUND(404, "ATLAS-404-00-017", "Import id={0} is not found"),
208+
IMPORT_NOT_FOUND(404, "ATLAS-404-00-017", "Import id {0} is not found"),
209209

210210
METHOD_NOT_ALLOWED(405, "ATLAS-405-00-001", "Error 405 - The request method {0} is inappropriate for the URL: {1}"),
211211

@@ -224,7 +224,7 @@ public enum AtlasErrorCode {
224224
GLOSSARY_IMPORT_FAILED(409, "ATLAS-409-00-011", "Glossary import failed"),
225225
METRICSSTAT_ALREADY_EXISTS(409, "ATLAS-409-00-012", "Metric Statistics already collected at {0}"),
226226
PENDING_TASKS_ALREADY_IN_PROGRESS(409, "ATLAS-409-00-013", "There are already {0} pending tasks in queue"),
227-
IMPORT_ABORT_NOT_ALLOWED(409, "ATLAS-409-00-016", "Import id={0} is currently in state {1}, cannot be aborted"),
227+
IMPORT_ABORT_NOT_ALLOWED(409, "ATLAS-409-00-016", "Import id {0} is currently in state {1}, cannot be aborted"),
228228

229229
// All internal errors go here
230230
INTERNAL_ERROR(500, "ATLAS-500-00-001", "Internal server error {0}"),
@@ -252,9 +252,9 @@ public enum AtlasErrorCode {
252252
NOTIFICATION_EXCEPTION(500, "ATLAS-500-00-018", "{0}"),
253253
IMPORT_UPDATE_FAILED(500, "ATLAS-500-00-019", "Failed to update import with id={0}"),
254254
IMPORT_REGISTRATION_FAILED(500, "ATLAS-500-00-020", "Failed to register import request"),
255-
IMPORT_FAILED(500, "ATLAS-500-00-021", "Import with id={0} failed"),
256-
ABORT_IMPORT_FAILED(500, "ATLAS-500-00-022", "Failed to abort import with id={0}"),
257-
IMPORT_QUEUEING_FAILED(500, "ATLAS-500-00-023", "Failed to add import with id={0} to request queue, please try again later");
255+
IMPORT_FAILED(500, "ATLAS-500-00-021", "Import with id {0} failed"),
256+
ABORT_IMPORT_FAILED(500, "ATLAS-500-00-022", "Failed to abort import with id {0}"),
257+
IMPORT_QUEUEING_FAILED(500, "ATLAS-500-00-023", "Failed to add import with id {0} to request queue, please try again later");
258258

259259
private static final Logger LOG = LoggerFactory.getLogger(AtlasErrorCode.class);
260260
private final String errorCode;

repository/src/main/java/org/apache/atlas/repository/impexp/AsyncImportService.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,16 @@ public PList<AsyncImportStatus> getAsyncImportsStatus(int offset, int limit) thr
168168
public AtlasAsyncImportRequest getAsyncImportRequest(String importId) throws AtlasBaseException {
169169
LOG.debug("==> AsyncImportService.getImportStatusById(importId={})", importId);
170170

171-
AtlasAsyncImportRequest atlasAsyncImportRequest = new AtlasAsyncImportRequest();
172-
173-
atlasAsyncImportRequest.setImportId(importId);
174-
175-
AtlasAsyncImportRequest importRequest = dataAccess.load(atlasAsyncImportRequest);
171+
try {
172+
AtlasAsyncImportRequest importRequest = fetchImportRequestByImportId(importId);
176173

177-
LOG.debug("<== AsyncImportService.getImportStatusById(importId={})", importId);
174+
if (importRequest == null) {
175+
throw new AtlasBaseException(AtlasErrorCode.IMPORT_NOT_FOUND, importId);
176+
}
178177

179-
return importRequest;
178+
return importRequest;
179+
} finally {
180+
LOG.debug("<== AsyncImportService.getImportStatusById(importId={})", importId);
181+
}
180182
}
181183
}

webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,6 @@ private void stopConsumerThreads() {
599599
LOG.info("<== stopConsumerThreads()");
600600
}
601601

602-
private void stopConsumerThread(HookConsumer consumer) {
603-
consumer.shutdown();
604-
consumers.remove(consumer);
605-
}
606-
607602
private List<String> trimAndPurge(String[] values, String defaultValue) {
608603
final List<String> ret;
609604

webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class ActiveServerFilter implements Filter {
5555

5656
private final String[] adminUriNotFiltered = {"/admin/export", "/admin/import", "/admin/importfile", "/admin/audits",
5757
"/admin/purge", "/admin/expimp/audit", "/admin/metrics", "/admin/server", "/admin/audit/", "admin/tasks",
58-
"/admin/debug/metrics", "/admin/audits/ageout"};
58+
"/admin/debug/metrics", "/admin/audits/ageout", "admin/async/import", "admin/async/import/status"};
5959
private final ActiveInstanceState activeInstanceState;
6060
private final ServiceState serviceState;
6161

0 commit comments

Comments
 (0)