From 0ff6bc5b13026157cd11ba0cd67f425df9500051 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Thu, 28 Mar 2024 22:11:08 +0530 Subject: [PATCH] feat: block tag propagation if maintenance mode is turned on --- .../main/java/org/apache/atlas/tasks/TaskQueueWatcher.java | 5 +++++ .../org/apache/atlas/web/filters/ActiveServerFilter.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/tasks/TaskQueueWatcher.java b/repository/src/main/java/org/apache/atlas/tasks/TaskQueueWatcher.java index 25478e9a5a..9214cbfbf9 100644 --- a/repository/src/main/java/org/apache/atlas/tasks/TaskQueueWatcher.java +++ b/repository/src/main/java/org/apache/atlas/tasks/TaskQueueWatcher.java @@ -76,6 +76,11 @@ public void shutdown() { @Override public void run() { + boolean isMaintenanceMode = AtlasConfiguration.ATLAS_MAINTENANCE_MODE.getBoolean(); + if (isMaintenanceMode) { + LOG.info("TaskQueueWatcher: Maintenance mode is enabled, new tasks will not be loaded into the queue until next restart"); + return; + } shouldRun.set(true); if (LOG.isDebugEnabled()) { diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java index bb0b82a417..c3353f19c4 100644 --- a/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java @@ -88,7 +88,8 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo // Block all the POST, PUT, DELETE operations HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; - if (isBlockedMethod(request.getMethod()) && !request.getRequestURI().contains("indexsearch")) { + if (isBlockedMethod(request.getMethod()) && !request.getRequestURI().contains("search") && + !request.getRequestURI().contains("lineage")) { LOG.error("Maintenance mode enabled. Blocking request: {}", request.getRequestURI()); sendMaintenanceModeResponse(response); return; // Stop further processing