Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
759f717
Added ‘assetsCountToPropagate’ and ‘assetsCountPropagated’ to the tas…
jnkrmg Jan 23, 2025
65d920d
review comment fixes
abhijeet-atlan Jan 29, 2025
61d58dd
fixing dry for task vertex updation
abhijeet-atlan Jan 30, 2025
dfddb79
fixing dry for task vertex updation
abhijeet-atlan Jan 30, 2025
b4ce7af
removed redundant code for 'add prop', 'text update', 'delete prop', …
abhijeet-atlan Jan 30, 2025
ed847c1
reverted taskregistry
abhijeet-atlan Feb 2, 2025
c257421
removed all repeating code for 6 prop types
abhijeet-atlan Feb 2, 2025
adc6ed1
more fixes based on review comments
abhijeet-atlan Feb 2, 2025
fdca703
refactored 'updateTaskVertexProperty'
abhijeet-atlan Feb 4, 2025
164ec29
updated maven.yaml
abhijeet-atlan Feb 4, 2025
4e8c6df
added docstring to explain functionality to 'updateTaskVertexProperty'
abhijeet-atlan Feb 5, 2025
d046141
Init script
hr2904 Jan 15, 2025
288062c
PR Fixes #1
hr2904 Jan 19, 2025
ae9dec1
added code to send kafka message to topic 'TAG_PROP_EVENTS'
abhijeet-atlan Feb 4, 2025
a13f17e
added abstract method to send kafka message to a partition
abhijeet-atlan Feb 4, 2025
d364c8e
Update maven.yml
abhijeet-atlan Feb 4, 2025
b9b6887
corrected delete handler
abhijeet-atlan Feb 4, 2025
317322e
Merge with master
abhijeet-atlan Feb 5, 2025
7cf3072
Review comments fixes
abhijeet-atlan Feb 5, 2025
ba5d144
Removed dup dependency
abhijeet-atlan Feb 5, 2025
14db31d
changed signature and usage for 'updateTaskVertexProperty'
abhijeet-atlan Feb 5, 2025
102ae40
deleted not used function 'updateTaskVertexProperty'
abhijeet-atlan Feb 5, 2025
64775b4
experiment to check if everything works
abhijeet-atlan Feb 5, 2025
42540a0
removed commented out code
abhijeet-atlan Feb 5, 2025
97bbbaf
fixes for review comment
abhijeet-atlan Feb 13, 2025
42b074a
Merge branch 'master' into tagpropv1master
abhijeet-atlan Feb 13, 2025
c7c8c4e
payload change for kafka message
abhijeet-atlan Feb 24, 2025
6eaf1eb
changed code for prop relationship update
abhijeet-atlan Feb 24, 2025
5caa581
changed topic name
abhijeet-atlan Mar 3, 2025
6d176e7
updated code to add three params to the task vertex:
abhijeet-atlan Mar 3, 2025
6451bfd
Merge branch 'master' into tagpropv1master
abhijeet-atlan Mar 3, 2025
e51846d
updated maven to use cacheV3
abhijeet-atlan Mar 3, 2025
48e07f4
error fix for missing params
abhijeet-atlan Mar 3, 2025
547d561
Merge branch 'tagpropv1master' into tagpropv1.5master
abhijeet-atlan Mar 3, 2025
616dcef
changed obj prop topic partition count to be 10
abhijeet-atlan Mar 3, 2025
06fb81c
Merge pull request #4085 from atlanhq/tagpropv1.5master
abhijeet-atlan Mar 3, 2025
cab6deb
opted for round robin approach for oartition selection
abhijeet-atlan Mar 4, 2025
157e2db
maven update
abhijeet-atlan Mar 4, 2025
06e406a
changes related to kafka
abhijeet-atlan Mar 4, 2025
3936029
changes related to kafka
abhijeet-atlan Mar 4, 2025
de81019
cleanup
suraj5077 Mar 5, 2025
720cda0
cleanup
suraj5077 Mar 5, 2025
1b4dbee
changes related to kafka
abhijeet-atlan Mar 5, 2025
e66c636
fixed build
suraj5077 Mar 5, 2025
0f6af6d
Merge remote-tracking branch 'origin/tagpropv1master' into tagpropv1m…
suraj5077 Mar 5, 2025
73c7cd8
changes related to kafka
abhijeet-atlan Mar 5, 2025
edebe8c
reverting last change
abhijeet-atlan Mar 5, 2025
6961d65
added property 'assetGuid'.
abhijeet-atlan Mar 5, 2025
5f31f32
fixed errors
abhijeet-atlan Mar 5, 2025
8063ff0
fixed a comment typo
hr2904 Mar 5, 2025
b0aadc1
fixed an infinite loop error
hr2904 Mar 6, 2025
5d31524
updated kafka message
abhijeet-atlan Mar 7, 2025
08fa364
Added new bg thread for task updation
suraj5077 Mar 12, 2025
77dd858
Added redis methods for tag-prop
suraj5077 Mar 12, 2025
817418b
added logs for kafka messages
abhijeet-atlan Mar 12, 2025
613db6c
Kafka topic creation for tag-prop topic
suraj5077 Mar 12, 2025
18ccd0f
Merge remote-tracking branch 'origin/tagpropv1master' into tagpropv1m…
suraj5077 Mar 12, 2025
d7f5e47
Added new watcher thread for tag-prop v2
suraj5077 Mar 12, 2025
4e6eb48
updated kafka message
abhijeet-atlan Mar 12, 2025
0d8bdf9
Merge remote-tracking branch 'origin/tagpropv1master' into tagpropv1m…
abhijeet-atlan Mar 12, 2025
386b92c
updated kafka message
abhijeet-atlan Mar 12, 2025
850fffe
TaskExecutor new thread
suraj5077 Mar 12, 2025
65cb0fb
Merge remote-tracking branch 'origin/tagpropv1master' into tagpropv1m…
suraj5077 Mar 12, 2025
6aede5c
Pushed new TagPropagator class, reverted EntityGrahMapper
suraj5077 Mar 12, 2025
22e973a
Merge branch 'master' into tagpropv1master
suraj5077 Mar 12, 2025
2991b78
Refactored TagPropagator class
suraj5077 Mar 12, 2025
75a8e14
Refactored
suraj5077 Mar 12, 2025
bc27ce9
fixed tagprop code
suraj5077 Mar 13, 2025
0b8dcd0
Made DeleteHandler backward compatiple
suraj5077 Mar 13, 2025
754ceb0
fix NPE
suraj5077 Mar 13, 2025
e297cae
added code to update taskvertex with data on redis
abhijeet-atlan Mar 13, 2025
c1de532
Fixed task updater
suraj5077 Mar 14, 2025
c1fa864
Adds redis dlock
suraj5077 Mar 14, 2025
6abecbb
Added dlocking to kafka code
suraj5077 Mar 14, 2025
a4b9046
updated kafka object for delete prop to send classification id
abhijeet-atlan Mar 17, 2025
050c1f3
Fixed race condition in-progress issue and complete status not commit…
hr2904 Mar 18, 2025
c35fde8
redis cleanup
suraj5077 Mar 18, 2025
fda9378
Added post status COMPLETE handling
suraj5077 Mar 18, 2025
7c89b28
Added logs for latency and metric calculations for benchmarking
hr2904 Mar 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ on:
- lineageondemand
- cassandrapoliciesoptimisation
- ixop
- makerlogic
- tagpropv1master

jobs:
build:
Expand Down Expand Up @@ -120,4 +122,4 @@ jobs:
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/[email protected]
with:
sarif_file: 'trivy-image-results.sarif'
sarif_file: 'trivy-image-results.sarif'
2 changes: 2 additions & 0 deletions common/src/main/java/org/apache/atlas/AtlasConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ private AtlasConstants() {
public static final String DEFAULT_TYPE_VERSION = "1.0";
public static final int ATLAS_SHUTDOWN_HOOK_PRIORITY = 30;
public static final int TASK_WAIT_TIME_MS = 180_000;
public static final String ATLAS_KAFKA_TAG_TOPIC = "OBJECT_PROP_EVENTS";

}
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ public final class Constants {
public static final String TASK_CLASSIFICATION_ID = encodePropertyKey(TASK_PREFIX + "classificationId");
public static final String TASK_ENTITY_GUID = encodePropertyKey(TASK_PREFIX + "entityGuid");
public static final String TASK_CLASSIFICATION_TYPENAME = encodePropertyKey(TASK_PREFIX + "classificationTypeName");
public static final String TASK_ASSET_COUNT_TO_PROPAGATE = encodePropertyKey(TASK_PREFIX + "assetsCountToPropagate");
public static final String TASK_ASSET_COUNT_PROPAGATED = encodePropertyKey(TASK_PREFIX + "assetsCountPropagated");
public static final String TASK_ASSET_COUNT_FAILED = encodePropertyKey(TASK_PREFIX + "assetsFailedToPropagate");
public static final String TASK_CLEANUP_REQUIRED = encodePropertyKey(TASK_PREFIX + "cleanupRequired");
public static final String TASK_CLEANUP_STATUS = encodePropertyKey(TASK_PREFIX + "cleanupStatus");
public static final String ACTIVE_STATE_VALUE = "ACTIVE";
public static final String TASK_HEADER_ATLAN_AGENT = "x-atlan-agent";
public static final String TASK_HEADER_ATLAN_AGENT_ID = "x-atlan-agent-id";
Expand Down Expand Up @@ -490,6 +495,9 @@ public enum SupportedFileExtensions { XLSX, XLS, CSV }
public static final String REQUEST_HEADER_USER_AGENT = "User-Agent";
public static final String REQUEST_HEADER_HOST = "Host";

//kafka partition value for OBJ_PROP_EVENTS
public static final String OBJ_PROP_EVENTS_PARTITION_COUNT = "10";

public static final Set<String> SKIP_UPDATE_AUTH_CHECK_TYPES = new HashSet<String>() {{
add(README_ENTITY_TYPE);
add(LINK_ENTITY_TYPE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.annotation.PreDestroy;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.Duration;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -72,6 +73,26 @@ public void releaseDistributedLock(String key) {
}
}

@Override
public int getSetSize(String key) {
return redisCacheClient.getSet(convertToNamespace(key)).size();
}

@Override
public String getHashValue(String key, String field) {
return (String) redisCacheClient.getMap(convertToNamespace(key)).get(field);
}

@Override
public void expireKey(String key) {
redisCacheClient.getBucket(convertToNamespace(key)).expire(Duration.ofSeconds(60));
}

@Override
public void expireHash(String key) {
redisCacheClient.getMap(convertToNamespace(key)).expire(Duration.ofSeconds(60));
}

@Override
public String getValue(String key) {
// If value doesn't exist, return null else return the value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ public interface RedisService {

void releaseDistributedLock(String key);

int getSetSize(String key);

String getHashValue(String key, String field);

void expireHash(String key);

String getValue(String key);

String putValue(String key, String value);
Expand All @@ -18,4 +24,5 @@ public interface RedisService {

Logger getLogger();

void expireKey(String key);
}
32 changes: 32 additions & 0 deletions common/src/main/java/org/apache/atlas/utils/KafkaUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,38 @@ public void createTopics(List<String> topicNames, int numPartitions, int replica
}
}

public void createTopics(List<String[]> topicDetails, int replicationFactor)
throws TopicExistsException, ExecutionException, InterruptedException {

if (LOG.isDebugEnabled()) {
LOG.debug("==> createTopics()");
}

List<NewTopic> newTopicList = topicDetails.stream()
.map(details -> new NewTopic(details[0], Integer.parseInt(details[1]), (short) replicationFactor))
.collect(Collectors.toList());

CreateTopicsResult createTopicsResult = adminClient.createTopics(newTopicList);
Map<String, KafkaFuture<Void>> futureMap = createTopicsResult.values();

for (Map.Entry<String, KafkaFuture<Void>> futureEntry : futureMap.entrySet()) {
KafkaFuture<Void> future = futureEntry.getValue();

try {
future.get();
} catch (ExecutionException | InterruptedException e) {
LOG.error("Error while creating topic " + futureEntry.getKey(), e);
// Re-throw to handle these exceptions in the calling code.
throw e;
}
}

if (LOG.isDebugEnabled()) {
LOG.debug("<== createTopics()");
}
}


public List<String> listAllTopics() throws ExecutionException, InterruptedException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> KafkaUtils.listAllTopics() ");
Expand Down
2 changes: 1 addition & 1 deletion distro/src/bin/atlas_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def get_topics_to_create(confdir):
if topic_list is not None:
topics = topic_list.split(",")
else:
topics = [getConfigWithDefault("atlas.notification.hook.topic.name", "ATLAS_HOOK"), getConfigWithDefault("atlas.notification.entities.topic.name", "ATLAS_ENTITIES"), getConfigWithDefault("atlas.notification.relationships.topic.name", "ATLAS_RELATIONSHIPS")]
topics = [getConfigWithDefault("atlas.notification.hook.topic.name", "ATLAS_HOOK"), getConfigWithDefault("atlas.notification.entities.topic.name", "ATLAS_ENTITIES"), getConfigWithDefault("atlas.notification.relationships.topic.name", "ATLAS_RELATIONSHIPS"), getConfigWithDefault("atlas.notification.propagation.topic.name", "TAG_PROP_EVENTS")]
return topics

def get_atlas_url_port(confdir):
Expand Down
7 changes: 5 additions & 2 deletions intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public enum AtlasConfiguration {
NOTIFICATION_HOOK_TOPIC_NAME("atlas.notification.hook.topic.name", "ATLAS_HOOK"),
NOTIFICATION_ENTITIES_TOPIC_NAME("atlas.notification.entities.topic.name", "ATLAS_ENTITIES"),
NOTIFICATION_RELATIONSHIPS_TOPIC_NAME("atlas.notification.relationships.topic.name", "ATLAS_RELATIONSHIPS"),
NOTIFICATION_OBJ_PROPAGATION_TOPIC_NAME("atlas.notification.propagation.topic.name", "OBJECT_PROP_EVENTS"),
NOTIFICATION_ATLAS_DISTRIBUTED_TASKS_TOPIC_NAME("atlas.notification.distributed.tasks.topic.name", "ATLAS_DISTRIBUTED_TASKS"),

NOTIFICATION_HOOK_CONSUMER_TOPIC_NAMES("atlas.notification.hook.consumer.topic.names", "ATLAS_HOOK"), // a comma separated list of topic names
Expand Down Expand Up @@ -84,7 +85,7 @@ public enum AtlasConfiguration {
DSL_CACHED_TRANSLATOR("atlas.dsl.cached.translator", true),
DEBUG_METRICS_ENABLED("atlas.debug.metrics.enabled", false),
TASKS_USE_ENABLED("atlas.tasks.enabled", true),
ATLAS_DISTRIBUTED_TASK_ENABLED("atlas.distributed.task.enabled", false),
ATLAS_DISTRIBUTED_TASK_ENABLED("atlas.distributed.task.enabled", true),
TASKS_REQUEUE_GRAPH_QUERY("atlas.tasks.requeue.graph.query", false),
TASKS_IN_PROGRESS_GRAPH_QUERY("atlas.tasks.inprogress.graph.query", false),
TASKS_REQUEUE_POLL_INTERVAL("atlas.tasks.requeue.poll.interval.millis", 60000),
Expand Down Expand Up @@ -137,7 +138,9 @@ public enum AtlasConfiguration {
OTEL_RESOURCE_ATTRIBUTES("OTEL_RESOURCE_ATTRIBUTES", "service.name=atlas"),
OTEL_SERVICE_NAME(" OTEL_SERVICE_NAME", "atlas"),
OTEL_EXPORTER_OTLP_ENDPOINT("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4317"),
ATLAS_BULK_API_MAX_ENTITIES_ALLOWED("atlas.bulk.api.max.entities.allowed", 10000);
ATLAS_BULK_API_MAX_ENTITIES_ALLOWED("atlas.bulk.api.max.entities.allowed", 10000),
ATLAS_DISTRIBUTED_TASK_MANAGEMENT_ENABLED("atlas.distributed.task.management.enabled", true),
NOTIFICATION_OBJ_PROPAGATION_TOPIC_PARTITIONS("atlas.obj.prop.topic.partitions", 10);



Expand Down
82 changes: 82 additions & 0 deletions intg/src/main/java/org/apache/atlas/model/tasks/AtlasTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ public static Status from(String s) {
}
}

public enum CleanupStatus {
PENDING,
SUCCESS,
FAILED;

public static CleanupStatus from(String s) {
if(StringUtils.isEmpty(s)) {
return PENDING;
}

switch (s.toLowerCase()) {
case "pending":
return PENDING;

case "success":
return SUCCESS;

case "failed":
return FAILED;

default:
return PENDING;
}
}
}

private String type;
private String guid;
private String createdBy;
Expand All @@ -95,6 +121,11 @@ public static Status from(String s) {
private String classificationId;
private String entityGuid;
private String classificationTypeName;
private Long assetsCountToPropagate;
private Long assetsCountPropagated;
private Long assetsFailedToPropagate;
private boolean cleanupRequired;
private CleanupStatus cleanupStatus;

public AtlasTask() {
}
Expand All @@ -111,6 +142,11 @@ public AtlasTask(String type, String createdBy, Map<String, Object> parameters,
this.attemptCount = 0;
this.classificationId = classificationId;
this.entityGuid = entityGuid;
this.assetsCountToPropagate = 0L;
this.assetsCountPropagated = 0L;
this.assetsFailedToPropagate = 0L;
this.cleanupRequired = false;
this.cleanupStatus = CleanupStatus.PENDING;
}

public String getGuid() {
Expand Down Expand Up @@ -175,6 +211,22 @@ public Status getStatus() {
return this.status;
}

public void setCleanupRequired(boolean cleanupRequired) {
this.cleanupRequired = cleanupRequired;
}

public boolean getCleanupRequired() {
return cleanupRequired;
}

public CleanupStatus getCleanupStatus() {
return this.cleanupStatus;
}

public void setCleanupStatus(CleanupStatus cleanupStatus) {
this.cleanupStatus = cleanupStatus;
}

public int getAttemptCount() {
return attemptCount;
}
Expand Down Expand Up @@ -239,9 +291,34 @@ public String getEntityGuid() {
return entityGuid;
}

public void setAssetsCountToPropagate(Long assetsCount) {
this.assetsCountToPropagate = assetsCount;
}

public Long getAssetsCountToPropagate() {
return assetsCountToPropagate;
}

public void setAssetsCountPropagated(Long assetsCountPropagated) {
this.assetsCountPropagated = assetsCountPropagated;
}

public Long getAssetsCountPropagated(){
return assetsCountPropagated;
}

public void setAssetsFailedToPropagate(Long assetsFailedToPropagate) {
this.assetsFailedToPropagate = assetsFailedToPropagate;
}

public Long getAssetsFailedToPropagate() {
return assetsFailedToPropagate;
}

@JsonIgnore
public void start() {
this.setStatus(Status.IN_PROGRESS);
this.setCleanupStatus(CleanupStatus.PENDING);
this.setStartTime(new Date());
}

Expand Down Expand Up @@ -270,6 +347,11 @@ public String toString() {
", attemptCount=" + attemptCount +
", errorMessage='" + errorMessage + '\'' +
", status=" + status +
", assetsCountToPropagate=" + assetsCountToPropagate +
", assetsCountPropagated=" + assetsCountPropagated +
", assetsPropagationFailedCount=" + assetsFailedToPropagate +
", cleanupRequired=" + cleanupRequired +
", cleanupStatus=" + cleanupStatus +
'}';
}
}
5 changes: 4 additions & 1 deletion notification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-graphdb-api</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.apache.atlas.AtlasConfiguration;
import static org.apache.atlas.repository.Constants.OBJ_PROP_EVENTS_PARTITION_COUNT;

/**
* A class to create Kafka topics used by Atlas components.
Expand Down Expand Up @@ -61,19 +64,30 @@ public void createAtlasTopic(Configuration atlasProperties, String... topicNames
if (!handleSecurity(atlasProperties)) {
return;
}
try(KafkaUtils kafkaUtils = getKafkaUtils(atlasProperties)) {
int numPartitions = atlasProperties.getInt("atlas.notification.partitions", 1);
try (KafkaUtils kafkaUtils = getKafkaUtils(atlasProperties)) {
int numReplicas = atlasProperties.getInt("atlas.notification.replicas", 1);
kafkaUtils.createTopics(Arrays.asList(topicNames), numPartitions, numReplicas);
List<String[]> topicDetails = new ArrayList<>();

for (String topicName : topicNames) {
if (AtlasConfiguration.NOTIFICATION_OBJ_PROPAGATION_TOPIC_NAME.getString().equals(topicName)) {
topicDetails.add(new String[]{topicName, OBJ_PROP_EVENTS_PARTITION_COUNT}); // 5 partitions for 'TAG_PROP_EVENTS'
} else {
topicDetails.add(new String[]{topicName, String.valueOf(atlasProperties.getInt("atlas.notification.partitions", 1))}); // 1 partition for all others
}
}

kafkaUtils.createTopics(topicDetails, numReplicas);

} catch (Exception e) {
LOG.error("Error while creating topics e :" + e.getMessage(), e);
LOG.error("Error while creating topics: " + e.getMessage(), e);
}
} else {
LOG.info("Not creating topics {} as {} is false", StringUtils.join(topicNames, ","),
ATLAS_NOTIFICATION_CREATE_TOPICS_KEY);
}
}


@VisibleForTesting
protected boolean handleSecurity(Configuration atlasProperties) {
if (AuthenticationUtil.isKerberosAuthenticationEnabled(atlasProperties)) {
Expand Down
Loading
Loading