You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ra...@apache.org on 2026/04/23 15:51:19 UTC
(atlas) branch atlas-2.5 updated (3216461a6 -> 234608315)
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a change to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git
from 3216461a6 ATLAS-5269: Atlas entity - schema tab not showing any data. (#603)
new ee3259b14 ATLAS-4764: CuratorFrameWork should work only when HA mode (#587)
new f758e7268 ATLAS-5227: Support disabling composite index (#559)
new a34de5b5d ATLAS-5189: Decrypt postgres password (#499)
new 234608315 ATLAS-5242: Bump GitHub action versions (#571)
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/ci.yml | 10 +--
.../java/org/apache/atlas/ha/HAConfiguration.java | 2 +-
.../org/apache/atlas/ha/HAConfigurationTest.java | 22 +++++
.../repository/graphdb/AtlasGraphManagement.java | 8 ++
.../graphdb/janus/AtlasJanusGraphManagement.java | 95 ++++++++++++++--------
.../janus/AtlasJanusGraphManagementTest.java | 24 ------
graphdb/janusgraph-rdbms/pom.xml | 4 +
.../diskstorage/rdbms/dao/DaoManager.java | 13 +++
.../org/apache/atlas/ApplicationProperties.java | 20 ++++-
.../apache/atlas/model/typedef/AtlasStructDef.java | 1 +
.../bootstrap/AtlasTypeDefStoreInitializer.java | 33 ++++++--
.../AtlasTypeDefStoreInitializerTest.java | 22 ++---
.../apache/atlas/web/service/CuratorFactory.java | 4 +-
.../atlas/web/service/CuratorFactoryTest.java | 62 ++++++++++++++
14 files changed, 232 insertions(+), 88 deletions(-)
(atlas) 04/04: ATLAS-5242: Bump GitHub action versions (#571)
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 234608315f29b643c2dd7632cad0e8ef2a15c696
Author: Abhishek Kumar <ab...@apache.org>
AuthorDate: Tue Apr 21 13:05:34 2026 -0700
ATLAS-5242: Bump GitHub action versions (#571)
(cherry picked from commit 69a75f0915a1fb2d9841539ea77646da895c5c25)
---
.github/workflows/ci.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 647de3f58..a7e48683c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -37,11 +37,11 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 180
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Cache for maven dependencies
- uses: actions/cache@v4
+ uses: actions/cache@v5
with:
path: |
~/.m2/repository/*/*/*
@@ -57,7 +57,7 @@ jobs:
chmod -R 777 ./
- name: Set up JDK 8
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: '8'
distribution: 'temurin'
@@ -88,14 +88,14 @@ jobs:
mv -f target/coverage dev-support/atlas-docker/dist/
- name: Upload Code Coverage Results
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v7
with:
name: coverage
path: dev-support/atlas-docker/dist/coverage/*
- name: Cache downloaded archives
if: success()
- uses: actions/cache@v4
+ uses: actions/cache@v5
with:
path: dev-support/atlas-docker/downloads
key: ${{ runner.os }}-atlas-downloads-${{ hashFiles('dev-support/atlas-docker/.env') }}
(atlas) 02/04: ATLAS-5227: Support disabling composite index (#559)
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit f758e7268a4af37d39203dbbc33195b69a2bfab4
Author: Pinal Shah <pi...@freestoneinfotech.com>
AuthorDate: Tue Apr 14 15:34:06 2026 +0530
ATLAS-5227: Support disabling composite index (#559)
(cherry picked from commit 8ce12aa3d2938f27ce00566ce5213dc915a784b9)
---
.../repository/graphdb/AtlasGraphManagement.java | 8 ++
.../graphdb/janus/AtlasJanusGraphManagement.java | 95 ++++++++++++++--------
.../janus/AtlasJanusGraphManagementTest.java | 24 ------
.../apache/atlas/model/typedef/AtlasStructDef.java | 1 +
.../bootstrap/AtlasTypeDefStoreInitializer.java | 33 ++++++--
.../AtlasTypeDefStoreInitializerTest.java | 22 ++---
6 files changed, 105 insertions(+), 78 deletions(-)
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java
index ba0abf464..7a3ca74c2 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java
@@ -166,6 +166,14 @@ public interface AtlasGraphManagement extends AutoCloseable {
*/
void updateSchemaStatus();
+ /**
+ * Disable the index with the given name.
+ *
+ * @param indexName
+ * @throws Exception
+ */
+ void disableIndex(String indexName) throws Exception;
+
/***
* Re-index elements.
* @param indexName: Name of the index that needs to be operated on.
diff --git a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagement.java b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagement.java
index 9148051b9..bc3b25cdb 100644
--- a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagement.java
+++ b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagement.java
@@ -44,6 +44,7 @@ import org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder;
import org.janusgraph.core.schema.Mapping;
import org.janusgraph.core.schema.Parameter;
import org.janusgraph.core.schema.PropertyKeyMaker;
+import org.janusgraph.core.schema.SchemaAction;
import org.janusgraph.core.schema.SchemaStatus;
import org.janusgraph.diskstorage.BackendTransaction;
import org.janusgraph.diskstorage.indexing.IndexEntry;
@@ -68,9 +69,10 @@ import java.util.Set;
import java.util.concurrent.ExecutionException;
import static com.google.common.base.Preconditions.checkArgument;
+import static org.janusgraph.core.schema.SchemaAction.DISABLE_INDEX;
import static org.janusgraph.core.schema.SchemaAction.ENABLE_INDEX;
+import static org.janusgraph.core.schema.SchemaStatus.DISABLED;
import static org.janusgraph.core.schema.SchemaStatus.ENABLED;
-import static org.janusgraph.core.schema.SchemaStatus.INSTALLED;
import static org.janusgraph.core.schema.SchemaStatus.REGISTERED;
/**
@@ -94,55 +96,76 @@ public class AtlasJanusGraphManagement implements AtlasGraphManagement {
this.graph = graph;
}
- public static void updateSchemaStatus(JanusGraphManagement mgmt, JanusGraph graph, Class<? extends Element> elementType) {
+ public void updateSchemaStatus(JanusGraphManagement mgmt, JanusGraph graph, Class<? extends Element> elementType) {
LOG.info("updating SchemaStatus for {}: Starting...", elementType.getSimpleName());
+ int count = 0;
- int count = 0;
Iterable<JanusGraphIndex> iterable = mgmt.getGraphIndexes(elementType);
for (JanusGraphIndex index : iterable) {
- if (index.isCompositeIndex()) {
- PropertyKey[] propertyKeys = index.getFieldKeys();
- SchemaStatus status = index.getIndexStatus(propertyKeys[0]);
- String indexName = index.name();
-
- try {
- if (status == REGISTERED) {
- JanusGraphManagement management = null;
+ enableIndex(index.name());
+ count++;
+ }
- try {
- management = graph.openManagement();
+ LOG.info("updating SchemaStatus for {}: {}: Done!", elementType.getSimpleName(), count);
+ }
- JanusGraphIndex indexToUpdate = management.getGraphIndex(indexName);
+ public void disableIndex(String propertyName) {
+ updateIndex(propertyName, DISABLE_INDEX);
+ }
- management.updateIndex(indexToUpdate, ENABLE_INDEX).get();
- } finally {
- if (management != null) {
- management.commit();
- }
- }
+ public void enableIndex(String propertyName) {
+ updateIndex(propertyName, ENABLE_INDEX);
+ }
- GraphIndexStatusReport report = ManagementSystem.awaitGraphIndexStatus(graph, indexName).status(ENABLED).call();
+ private void updateIndex(String indexName, SchemaAction action) {
+ try {
+ JanusGraphManagement management = null;
+ JanusGraph janusGraph = this.graph.getGraph();
+ SchemaStatus waitForStatus = null;
+ SchemaStatus currentStatus = null;
+
+ try {
+ management = janusGraph.openManagement();
+ JanusGraphIndex indexToUpdate = management.getGraphIndex(indexName);
+
+ if (indexToUpdate != null && indexToUpdate.isCompositeIndex()) {
+ PropertyKey[] propertyKeys = indexToUpdate.getFieldKeys();
+ currentStatus = indexToUpdate.getIndexStatus(propertyKeys[0]);
+
+ if (action == ENABLE_INDEX && currentStatus == REGISTERED) {
+ waitForStatus = ENABLED;
+ management.updateIndex(indexToUpdate, action).get();
+ } else if (action == DISABLE_INDEX && (currentStatus == ENABLED || currentStatus == REGISTERED)) {
+ waitForStatus = DISABLED;
+ management.updateIndex(indexToUpdate, action).get();
+ } else {
+ LOG.warn("SchemaStatus {} found for index: {}, cannot {}", currentStatus, indexToUpdate.name(), action);
+ return;
+ }
+ } else {
+ LOG.warn("Index: {} not found or not a composite index, cannot {} for index: {}", indexName, action, indexToUpdate != null ? indexToUpdate : "null");
+ }
+ } finally {
+ if (management != null) {
+ management.commit();
+ }
+ }
- if (!report.getConvergedKeys().isEmpty() && report.getConvergedKeys().containsKey(indexName)) {
- LOG.info("SchemaStatus updated for index: {}, from {} to {}.", index.name(), REGISTERED, ENABLED);
+ if (currentStatus != null && waitForStatus != null) {
+ GraphIndexStatusReport report = ManagementSystem.awaitGraphIndexStatus(janusGraph, indexName).status(waitForStatus).call();
- count++;
- } else if (!report.getNotConvergedKeys().isEmpty() && report.getNotConvergedKeys().containsKey(indexName)) {
- LOG.error("SchemaStatus failed to update index: {}, from {} to {}.", index.name(), REGISTERED, ENABLED);
- }
- } else if (status == INSTALLED) {
- LOG.warn("SchemaStatus {} found for index: {}", INSTALLED, indexName);
- }
- } catch (InterruptedException e) {
- LOG.error("IllegalStateException for indexName : {}, Exception: ", indexName, e);
- } catch (ExecutionException e) {
- LOG.error("ExecutionException for indexName : {}, Exception: ", indexName, e);
+ if (!report.getConvergedKeys().isEmpty() && report.getConvergedKeys().containsKey(indexName)) {
+ LOG.info("SchemaStatus updated for index: {}, from {} to {}.", indexName, currentStatus, waitForStatus);
+ } else if (!report.getNotConvergedKeys().isEmpty() && report.getNotConvergedKeys().containsKey(indexName)) {
+ LOG.error("SchemaStatus failed to update index: {}, from {} to {}.", indexName, currentStatus, waitForStatus);
}
}
+ } catch (InterruptedException e) {
+ LOG.error("InterruptedException for indexName : {}, Exception: ", indexName, e);
+ } catch (ExecutionException e) {
+ LOG.error("ExecutionException for indexName : {}, Exception: ", indexName, e);
}
-
- LOG.info("updating SchemaStatus for {}: {}: Done!", elementType.getSimpleName(), count);
}
@Override
diff --git a/graphdb/janus/src/test/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagementTest.java b/graphdb/janus/src/test/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagementTest.java
index 0c9d1dc69..0b186afbc 100644
--- a/graphdb/janus/src/test/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagementTest.java
+++ b/graphdb/janus/src/test/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphManagementTest.java
@@ -607,13 +607,6 @@ public class AtlasJanusGraphManagementTest {
management.printIndexRecoveryStats(null);
}
- @Test
- public void testUpdateSchemaStatusStaticMethod() {
- // Test the static method
- AtlasJanusGraphManagement.updateSchemaStatus(mockJanusManagement, mockJanusGraph, Vertex.class);
- AtlasJanusGraphManagement.updateSchemaStatus(mockJanusManagement, mockJanusGraph, org.apache.tinkerpop.gremlin.structure.Edge.class);
- }
-
@Test
public void testStaticUpdateSchemaStatusWithRegisteredIndex() {
JanusGraphIndex mockIndex = mock(JanusGraphIndex.class);
@@ -635,23 +628,6 @@ public class AtlasJanusGraphManagementTest {
}
}
- @Test
- public void testStaticUpdateSchemaStatusWithInstalledIndex() {
- JanusGraphIndex mockIndex = mock(JanusGraphIndex.class);
- PropertyKey mockFieldKey = mock(PropertyKey.class);
- when(mockIndex.isCompositeIndex()).thenReturn(true);
- when(mockIndex.getFieldKeys()).thenReturn(new PropertyKey[] {mockFieldKey});
- when(mockIndex.getIndexStatus(mockFieldKey)).thenReturn(SchemaStatus.INSTALLED);
- when(mockIndex.name()).thenReturn("installedIndex");
- when(mockJanusManagement.getGraphIndexes(Vertex.class)).thenReturn(Collections.singletonList(mockIndex));
-
- // Should handle INSTALLED status without attempting to update
- AtlasJanusGraphManagement.updateSchemaStatus(mockJanusManagement, mockJanusGraph, Vertex.class);
-
- // Verify no inner management was opened for INSTALLED status
- verify(mockJanusGraph, never()).openManagement();
- }
-
@Test
public void testSetConsistencyStaticMethod() throws Exception {
// Using reflection to test private static method
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java
index bd69a6461..1d17bffe9 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java
@@ -268,6 +268,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
public static final int DEFAULT_SEARCHWEIGHT = -1;
public static final String SEARCH_WEIGHT_ATTR_NAME = "searchWeight";
public static final String INDEX_TYPE_ATTR_NAME = "indexType";
+ public static final String IS_INDEXABLE_ATTR_NAME = "isIndexable";
public static final String ATTRDEF_OPTION_SOFT_REFERENCE = "isSoftReference";
public static final String ATTRDEF_OPTION_APPEND_ON_PARTIAL_UPDATE = "isAppendOnPartialUpdate";
public static final int COUNT_NOT_SET = -1;
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
index 8ce7ca706..a7c78b135 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
@@ -44,6 +44,7 @@ import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
import org.apache.atlas.repository.graphdb.AtlasGraph;
+import org.apache.atlas.repository.graphdb.AtlasGraphManagement;
import org.apache.atlas.repository.patches.AddMandatoryAttributesPatch;
import org.apache.atlas.repository.patches.AtlasPatchManager;
import org.apache.atlas.repository.patches.AtlasPatchRegistry;
@@ -461,7 +462,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
new RemoveLegacyRefAttributesPatchHandler(typeDefStore, typeRegistry),
new UpdateTypeDefOptionsPatchHandler(typeDefStore, typeRegistry),
new SetServiceTypePatchHandler(typeDefStore, typeRegistry),
- new UpdateAttributeMetadataHandler(typeDefStore, typeRegistry),
+ new UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph),
new AddSuperTypePatchHandler(typeDefStore, typeRegistry),
new AddMandatoryAttributePatchHandler(typeDefStore, typeRegistry)
};
@@ -1179,8 +1180,11 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
}
static class UpdateAttributeMetadataHandler extends PatchHandler {
- public UpdateAttributeMetadataHandler(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry) {
+ public final AtlasGraph graph;
+
+ public UpdateAttributeMetadataHandler(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, AtlasGraph graph) {
super(typeDefStore, typeRegistry, new String[] {"UPDATE_ATTRIBUTE_METADATA"});
+ this.graph = graph;
}
@Override
@@ -1198,7 +1202,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
if (typeDef.getClass().equals(AtlasEntityDef.class)) {
AtlasEntityDef entityDef = new AtlasEntityDef((AtlasEntityDef) typeDef);
- updateAttributeMetadata(patch, entityDef.getAttributeDefs());
+ updateAttributeMetadata(patch.getTypeName(), patch, entityDef.getAttributeDefs());
entityDef.setTypeVersion(patch.getUpdateToVersion());
@@ -1208,7 +1212,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
} else if (typeDef.getClass().equals(AtlasStructDef.class)) {
AtlasStructDef updatedDef = new AtlasStructDef((AtlasStructDef) typeDef);
- updateAttributeMetadata(patch, updatedDef.getAttributeDefs());
+ updateAttributeMetadata(patch.getTypeName(), patch, updatedDef.getAttributeDefs());
updatedDef.setTypeVersion(patch.getUpdateToVersion());
@@ -1227,15 +1231,15 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
return ret;
}
- private void updateAttributeMetadata(TypeDefPatch patch, List<AtlasAttributeDef> attributeDefsFromEntity) {
+ private void updateAttributeMetadata(String typeName, TypeDefPatch patch, List<AtlasAttributeDef> attributeDefsFromEntity) {
for (AtlasAttributeDef attributeDef : attributeDefsFromEntity) {
if (attributeDef.getName().equalsIgnoreCase(patch.getAttributeName())) {
- updateAttribute(attributeDef, patch.getParams());
+ updateAttribute(typeName, attributeDef, patch.getParams());
}
}
}
- private void updateAttribute(AtlasAttributeDef atlasAttributeDef, Map<String, Object> params) {
+ private void updateAttribute(String typeName, AtlasAttributeDef atlasAttributeDef, Map<String, Object> params) {
if (!params.isEmpty()) {
for (Map.Entry<String, Object> entry : params.entrySet()) {
try {
@@ -1270,6 +1274,21 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
throw new RuntimeException(msg);
}
}
+ } else if (AtlasAttributeDef.IS_INDEXABLE_ATTR_NAME.equalsIgnoreCase(entry.getKey())) {
+ boolean isIndexable = (Boolean) entry.getValue();
+
+ if (!isIndexable && atlasAttributeDef.getIsIndexable()) {
+ AtlasEntityType type = typeRegistry.getEntityTypeByName(typeName);
+ String propertyName = type.getVertexPropertyName(atlasAttributeDef.getName());
+
+ LOG.info("Updating Model attribute {}'s property {} to {}.", propertyName, entry.getKey(), entry.getValue());
+ try (AtlasGraphManagement mgmt = graph.getManagementSystem()) {
+ mgmt.disableIndex(propertyName);
+ }
+ atlasAttributeDef.setIsIndexable(isIndexable);
+ } else {
+ LOG.info("Model attribute {}'s property {} is already set to {}. No update needed.", atlasAttributeDef.getName(), entry.getKey(), entry.getValue());
+ }
} else {
//sanity exception
//more attributes can be added as needed.
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializerTest.java b/repository/src/test/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializerTest.java
index 626025d8f..99cab83ab 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializerTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializerTest.java
@@ -929,7 +929,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerComprehensive() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
@@ -954,7 +954,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerForStructDef() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestStruct", "1.0", "2.0");
@@ -976,7 +976,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerWithInvalidType() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEnum", "1.0", "2.0");
@@ -1140,7 +1140,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerSearchWeightValidation() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
@@ -1166,7 +1166,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerSearchWeightSuccess() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
@@ -1192,7 +1192,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerIndexTypeValidation() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
@@ -1213,7 +1213,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerIndexTypeSuccess() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
@@ -1235,7 +1235,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerEmptyIndexType() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
@@ -1258,7 +1258,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerUnknownProperty() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
@@ -1280,7 +1280,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerExceptionHandling() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
AtlasEntityDef entityDef = new AtlasEntityDef("TestEntity", "desc", "1.0");
@@ -1301,7 +1301,7 @@ public class AtlasTypeDefStoreInitializerTest {
@Test
public void testUpdateAttributeMetadataHandlerEmptyParams() throws Exception {
- AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry);
+ AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler handler = new AtlasTypeDefStoreInitializer.UpdateAttributeMetadataHandler(typeDefStore, typeRegistry, graph);
Object patch = createMockTypeDefPatch("UPDATE_ATTRIBUTE_METADATA", "TestEntity", "1.0", "2.0");
(atlas) 01/04: ATLAS-4764: CuratorFrameWork should work only when HA mode (#587)
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit ee3259b1483123b3f919906f966ad2a3960d0dbd
Author: pareshd <pa...@freestoneinfotech.com>
AuthorDate: Tue Apr 7 12:59:30 2026 +0530
ATLAS-4764: CuratorFrameWork should work only when HA mode (#587)
(cherry picked from commit 2be84e3523d0d5dfd75087f511051e2c46175f05)
---
.../java/org/apache/atlas/ha/HAConfiguration.java | 2 +-
.../org/apache/atlas/ha/HAConfigurationTest.java | 22 ++++++++
.../apache/atlas/web/service/CuratorFactory.java | 4 +-
.../atlas/web/service/CuratorFactoryTest.java | 62 ++++++++++++++++++++++
4 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/common/src/main/java/org/apache/atlas/ha/HAConfiguration.java b/common/src/main/java/org/apache/atlas/ha/HAConfiguration.java
index 4382d429e..896aa3732 100644
--- a/common/src/main/java/org/apache/atlas/ha/HAConfiguration.java
+++ b/common/src/main/java/org/apache/atlas/ha/HAConfiguration.java
@@ -105,7 +105,7 @@ public final class HAConfiguration {
if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) {
zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT);
} else {
- zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect");
+ zkServers = new String[0];
}
String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT);
diff --git a/common/src/test/java/org/apache/atlas/ha/HAConfigurationTest.java b/common/src/test/java/org/apache/atlas/ha/HAConfigurationTest.java
index 66bd2bb34..86d0a50d6 100644
--- a/common/src/test/java/org/apache/atlas/ha/HAConfigurationTest.java
+++ b/common/src/test/java/org/apache/atlas/ha/HAConfigurationTest.java
@@ -28,6 +28,8 @@ import org.testng.annotations.Test;
import java.util.List;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -110,4 +112,24 @@ public class HAConfigurationTest {
HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration);
assertTrue(zookeeperProperties.hasAuth());
}
+
+ @Test
+ public void testShouldGetZookeeperConnectStringFromHAConfig() {
+ when(configuration.containsKey(HAConfiguration.HA_ZOOKEEPER_CONNECT)).thenReturn(true);
+ when(configuration.getStringArray(HAConfiguration.HA_ZOOKEEPER_CONNECT)).thenReturn(new String[] {"zk1:2181", "zk2:2181"});
+
+ HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration);
+
+ assertEquals(zookeeperProperties.getConnectString(), "zk1:2181,zk2:2181");
+ }
+
+ @Test
+ public void testShouldReturnEmptyZookeeperConnectStringWhenMissing() {
+ when(configuration.containsKey(HAConfiguration.HA_ZOOKEEPER_CONNECT)).thenReturn(false);
+
+ HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration);
+
+ assertEquals(zookeeperProperties.getConnectString(), "");
+ verify(configuration, never()).getStringArray("atlas.kafka." + HAConfiguration.ZOOKEEPER_PREFIX + "connect");
+ }
}
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java b/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
index 515333ef3..7a390f498 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
@@ -75,7 +75,9 @@ public class CuratorFactory {
public CuratorFactory(Configuration configuration) {
this.configuration = configuration;
- initializeCuratorFramework();
+ if (configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY) && configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, true)) {
+ initializeCuratorFramework();
+ }
}
/**
diff --git a/webapp/src/test/java/org/apache/atlas/web/service/CuratorFactoryTest.java b/webapp/src/test/java/org/apache/atlas/web/service/CuratorFactoryTest.java
index 396db2f68..58aef3e0c 100644
--- a/webapp/src/test/java/org/apache/atlas/web/service/CuratorFactoryTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/service/CuratorFactoryTest.java
@@ -135,6 +135,9 @@ public class CuratorFactoryTest {
@Test
public void testClientInstance() {
+ when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
+ when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, true)).thenReturn(true);
+
CuratorFactory curatorFactory = new CuratorFactory(configuration) {
@Override
protected void initializeCuratorFramework() {
@@ -154,6 +157,9 @@ public class CuratorFactoryTest {
@Test
public void testLeaderLatchInstance() {
+ when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
+ when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, true)).thenReturn(true);
+
CuratorFactory curatorFactory = new CuratorFactory(configuration) {
@Override
protected void initializeCuratorFramework() {
@@ -176,6 +182,9 @@ public class CuratorFactoryTest {
@Test
public void testLockInstance() {
+ when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
+ when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, true)).thenReturn(true);
+
CuratorFactory curatorFactory = new CuratorFactory(configuration) {
@Override
protected void initializeCuratorFramework() {
@@ -197,6 +206,9 @@ public class CuratorFactoryTest {
@Test
public void testClose() {
+ when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
+ when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, true)).thenReturn(true);
+
CuratorFactory curatorFactory = new CuratorFactory(configuration) {
@Override
protected void initializeCuratorFramework() {
@@ -215,6 +227,56 @@ public class CuratorFactoryTest {
verify(curatorFramework).close();
}
+ @Test
+ public void testConstructorDoesNotInitializeWhenHAKeyIsMissing() {
+ when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(false);
+
+ CuratorFactory curatorFactory = new CuratorFactory(configuration) {
+ @Override
+ protected void initializeCuratorFramework() {
+ throw new AssertionError("initializeCuratorFramework() should not be called when HA key is missing");
+ }
+ };
+
+ assertNull(curatorFactory.clientInstance());
+ }
+
+ @Test
+ public void testConstructorDoesNotInitializeWhenHAIsDisabled() {
+ when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
+ when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, true)).thenReturn(false);
+
+ CuratorFactory curatorFactory = new CuratorFactory(configuration) {
+ @Override
+ protected void initializeCuratorFramework() {
+ throw new AssertionError("initializeCuratorFramework() should not be called when HA is disabled");
+ }
+ };
+
+ assertNull(curatorFactory.clientInstance());
+ }
+
+ @Test
+ public void testConstructorInitializesWhenHAIsEnabled() {
+ when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
+ when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, true)).thenReturn(true);
+
+ CuratorFactory curatorFactory = new CuratorFactory(configuration) {
+ @Override
+ protected void initializeCuratorFramework() {
+ try {
+ Field field = CuratorFactory.class.getDeclaredField("curatorFramework");
+ field.setAccessible(true);
+ field.set(this, curatorFramework);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+
+ assertEquals(curatorFactory.clientInstance(), curatorFramework);
+ }
+
@Test
public void testGetIdForLoggingSaslScheme() throws Exception {
CuratorFactory curatorFactory = new CuratorFactory(configuration) {
(atlas) 03/04: ATLAS-5189: Decrypt postgres password (#499)
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit a34de5b5d33b8c2c03d0d4edb8832d032700e2e6
Author: chaitalicod <36...@users.noreply.github.com>
AuthorDate: Tue Apr 21 18:29:20 2026 +0530
ATLAS-5189: Decrypt postgres password (#499)
Co-authored-by: chaitali.borole <ch...@cloudera.com>
(cherry picked from commit ea52e9e479142600491f85aa4c060e1ea79dd580)
---
graphdb/janusgraph-rdbms/pom.xml | 4 ++++
.../janusgraph/diskstorage/rdbms/dao/DaoManager.java | 13 +++++++++++++
.../java/org/apache/atlas/ApplicationProperties.java | 20 +++++++++++++++++---
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/graphdb/janusgraph-rdbms/pom.xml b/graphdb/janusgraph-rdbms/pom.xml
index 53a9ad522..78ea1f36e 100644
--- a/graphdb/janusgraph-rdbms/pom.xml
+++ b/graphdb/janusgraph-rdbms/pom.xml
@@ -38,6 +38,10 @@
<artifactId>HikariCP</artifactId>
<version>${HikariCP.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.atlas</groupId>
+ <artifactId>atlas-intg</artifactId>
+ </dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
diff --git a/graphdb/janusgraph-rdbms/src/main/java/org/janusgraph/diskstorage/rdbms/dao/DaoManager.java b/graphdb/janusgraph-rdbms/src/main/java/org/janusgraph/diskstorage/rdbms/dao/DaoManager.java
index ae434c657..525645261 100644
--- a/graphdb/janusgraph-rdbms/src/main/java/org/janusgraph/diskstorage/rdbms/dao/DaoManager.java
+++ b/graphdb/janusgraph-rdbms/src/main/java/org/janusgraph/diskstorage/rdbms/dao/DaoManager.java
@@ -20,6 +20,8 @@ package org.janusgraph.diskstorage.rdbms.dao;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasException;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,6 +64,7 @@ public class DaoManager {
private static final Logger LOG = LoggerFactory.getLogger(DaoManager.class);
private final EntityManagerFactory emFactory;
+ private static final String HIKARI_PASSWORD_KEY = "atlas.graph.storage.rdbms.jpa.hikari.password";
/**
*
@@ -78,6 +81,16 @@ public class DaoManager {
if (value != null) {
if (key.startsWith("hikari.")) {
+ if ("hikari.password".equals(key)) {
+ try {
+ String decrypted = ApplicationProperties.getDecryptedPassword(ApplicationProperties.get(), HIKARI_PASSWORD_KEY);
+ if (decrypted != null) {
+ value = decrypted;
+ }
+ } catch (AtlasException e) {
+ LOG.error("Error in getting secure password ", e);
+ }
+ }
hikariConfig.put(key.substring("hikari".length() + 1), value.toString());
} else {
config.put(key, value.toString());
diff --git a/intg/src/main/java/org/apache/atlas/ApplicationProperties.java b/intg/src/main/java/org/apache/atlas/ApplicationProperties.java
index 986213b6a..40a6de05a 100644
--- a/intg/src/main/java/org/apache/atlas/ApplicationProperties.java
+++ b/intg/src/main/java/org/apache/atlas/ApplicationProperties.java
@@ -67,7 +67,7 @@ public final class ApplicationProperties extends PropertiesConfiguration {
public static final String AD = "AD";
public static final String LDAP_AD_BIND_PASSWORD = "atlas.authentication.method.ldap.ad.bind.password";
public static final String LDAP_BIND_PASSWORD = "atlas.authentication.method.ldap.bind.password";
- public static final String MASK_LDAP_PASSWORD = "********";
+ public static final String MASK_PASSWORD = "********";
public static final String DEFAULT_GRAPHDB_BACKEND = GRAPHBD_BACKEND_JANUS;
public static final boolean DEFAULT_SOLR_WAIT_SEARCHER = false;
public static final boolean DEFAULT_INDEX_MAP_NAME = false;
@@ -342,7 +342,7 @@ public final class ApplicationProperties extends PropertiesConfiguration {
if (ldapType.equalsIgnoreCase(LDAP)) {
String maskPasssword = configuration.getString(LDAP_BIND_PASSWORD);
- if (MASK_LDAP_PASSWORD.equals(maskPasssword)) {
+ if (MASK_PASSWORD.equals(maskPasssword)) {
String password = SecurityUtil.getPassword(configuration, LDAP_BIND_PASSWORD, HADOOP_SECURITY_CREDENTIAL_PROVIDER_PATH);
configuration.clearProperty(LDAP_BIND_PASSWORD);
@@ -351,7 +351,7 @@ public final class ApplicationProperties extends PropertiesConfiguration {
} else if (ldapType.equalsIgnoreCase(AD)) {
String maskPasssword = configuration.getString(LDAP_AD_BIND_PASSWORD);
- if (MASK_LDAP_PASSWORD.equals(maskPasssword)) {
+ if (MASK_PASSWORD.equals(maskPasssword)) {
String password = SecurityUtil.getPassword(configuration, LDAP_AD_BIND_PASSWORD, HADOOP_SECURITY_CREDENTIAL_PROVIDER_PATH);
configuration.clearProperty(LDAP_AD_BIND_PASSWORD);
@@ -364,6 +364,20 @@ public final class ApplicationProperties extends PropertiesConfiguration {
}
}
+ public static String getDecryptedPassword(Configuration configuration, String propertyKey) {
+ String configuredValue = configuration != null ? configuration.getString(propertyKey) : null;
+
+ if (configuredValue != null && MASK_PASSWORD.equals(configuredValue)) {
+ try {
+ return SecurityUtil.getPassword(configuration, propertyKey, HADOOP_SECURITY_CREDENTIAL_PROVIDER_PATH);
+ } catch (Exception e) {
+ LOG.error("Error in getting secure password ", e);
+ }
+ }
+
+ return configuredValue;
+ }
+
private void setDefaults() {
AtlasRunMode runMode = AtlasRunMode.valueOf(getString(ATLAS_RUN_MODE, DEFAULT_ATLAS_RUN_MODE.name()));