Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Janusupgrade to 1.0.0 with a smart marker logic to reduce Cassandra Calls #3849

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
364c4aa
PLT-2568 optimise vertex fetch from janusgraph
sriram-atlan Nov 13, 2024
8c7ca54
remove method
aarshi0301 Nov 19, 2024
3df42f5
Fix property name
aarshi0301 Nov 18, 2024
0bb62fc
add null cehck
aarshi0301 Nov 18, 2024
9b966a6
remove submit call
aarshi0301 Nov 18, 2024
b0530b3
handle cocurrent modification exception
aarshi0301 Nov 18, 2024
52e645d
update libraries
aarshi0301 Nov 18, 2024
c323ad7
remove scrub results
aarshi0301 Nov 18, 2024
9741f59
fix results
aarshi0301 Nov 19, 2024
1545164
add dummy commit
aarshi0301 Nov 19, 2024
8259f67
Merge pull request #3767 from atlanhq/dummy
aarshi0301 Nov 19, 2024
953bce5
add branch
aarshi0301 Nov 19, 2024
c6c284b
add janus branch
aarshi0301 Nov 19, 2024
d27ea4d
scrub results
aarshi0301 Nov 19, 2024
0015ef7
add flag for janusgraph optimisation
aarshi0301 Nov 19, 2024
54103c8
add flag while retrieving from cassandra
aarshi0301 Nov 19, 2024
b903c7b
log ES query error
aarshi0301 Nov 19, 2024
dc77657
fix map vertex method
aarshi0301 Nov 20, 2024
ec4a32d
add configuration in flag
aarshi0301 Nov 20, 2024
f51f8f6
fix return type
aarshi0301 Nov 20, 2024
391e510
add flag for collapsed result
aarshi0301 Nov 20, 2024
8751387
fix updated by and createdby field
aarshi0301 Nov 20, 2024
6f1549d
fix if condition
aarshi0301 Nov 21, 2024
7feef65
remove branch deployment
aarshi0301 Nov 21, 2024
bd1ddb0
use multi query to improve response time of post elastic query lookups
sriram-atlan Nov 21, 2024
0bc01d6
Merge remote-tracking branch 'origin/janusoptimisation' into janusopt…
sriram-atlan Nov 21, 2024
650cfd1
import function
aarshi0301 Nov 21, 2024
f20e859
remove the mapVertex method that uses valueMap
sriram-atlan Nov 21, 2024
0022dae
build this branch as docker image
sriram-atlan Nov 21, 2024
1be3658
close thread bound janusgraph transaction
sriram-atlan Nov 21, 2024
d73d858
revert entity audit listener
sriram-atlan Nov 21, 2024
0af18e1
multi query with janusgraph 1.0.0
sriram-atlan Nov 22, 2024
4e39d43
add attributes part of multi query
sriram-atlan Nov 23, 2024
9c5a643
include janusoptimisation-multiQuery-1.0.0 in ecr build push
sriram-atlan Nov 23, 2024
01e5b3b
include janusoptimisation-1.0.0 in ecr build push
sriram-atlan Nov 23, 2024
ee86e6e
include janusupgrade in ecr build push
sriram-atlan Nov 23, 2024
e042b4f
bulk fetch with auto batching
sriram-atlan Nov 25, 2024
9ee5645
use properties method with janusgraph than gremlin
sriram-atlan Dec 7, 2024
c8578e4
use edge fetch always
sriram-atlan Dec 7, 2024
a47bdee
log edge and edge properties
sriram-atlan Dec 7, 2024
4dd2743
lookup only when marker exists or when attribute relationship is inwards
sriram-atlan Dec 7, 2024
76fe1c8
include all policy attributes in prefetch exclude
sriram-atlan Dec 7, 2024
358a7bc
revert using prefetch in mapSystemAttributes and toAtlasToObjectId
sriram-atlan Dec 7, 2024
5c6ad1b
remove logs. update comments
sriram-atlan Dec 7, 2024
b95c0e6
fix business attribute
aarshi0301 Dec 9, 2024
4cb985a
add check for business attributes
aarshi0301 Dec 10, 2024
8eef377
code cleanup
aarshi0301 Dec 11, 2024
3b009cd
add upgrade changes
aarshi0301 Dec 11, 2024
d97603d
fix build
aarshi0301 Dec 11, 2024
a6a7b92
fix build
aarshi0301 Dec 11, 2024
2692ae2
fetch only active edges
aarshi0301 Dec 12, 2024
b4caf2b
Minor refactoring
aarshi0301 Dec 13, 2024
9de9e60
replace in and out with both
aarshi0301 Dec 13, 2024
aa040f6
remove guid
aarshi0301 Dec 13, 2024
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
37 changes: 24 additions & 13 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -26,6 +27,8 @@ on:
- development
- master
- lineageondemand
- janusoptimisation
- janusupgrade

jobs:
build:
Expand All @@ -34,12 +37,12 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Cache Maven packages
uses: actions/cache@v2
with:
Expand All @@ -48,8 +51,9 @@ jobs:
restore-keys: ${{ runner.os }}-m2

- name: Get branch name
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch
run: |
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo BRANCH_NAME=${GITHUB_REF#refs/heads/}

- name: Create Maven Settings
uses: s4u/[email protected]
Expand All @@ -63,7 +67,7 @@ jobs:

- name: Build with Maven
run: |
branch_name=${{ steps.get_branch.outputs.branch }}
branch_name=${{ env.BRANCH_NAME }}
if [[ $branch_name == 'main' || $branch_name == 'master' || $branch_name == 'lineageondemand' ]]
then
echo "build without dashboard"
Expand All @@ -73,19 +77,26 @@ jobs:
chmod +x ./build.sh && ./build.sh
fi

- run: echo "REPOSITORY_NAME=`echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"`" >> $GITHUB_ENV
- name: Get Repository Name
run: echo "REPOSITORY_NAME=`echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"`" >> $GITHUB_ENV
shell: bash

- name: Get version tag
run: echo "##[set-output name=version;]$(echo `git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ steps.get_branch.outputs.branch }} | awk '{ print $1}' | cut -c1-7`)abcd"
id: get_version
# run: echo "##[set-output name=version;]$(echo `git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7`)abcd"
run: |
echo "VERSION=$(git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7 | head -n 1)abcd"
echo "VERSION=$(git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7 | tr -d '[:space:]')abcd"
echo "VERSION=$(git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7 | tr -d '[:space:]')abcd" >> $GITHUB_ENV

- name: Get commit ID
run: echo "COMMIT_ID=$(echo ${GITHUB_SHA} | cut -c1-7)abcd" >> $GITHUB_ENV

- name: Set up Buildx
- name: Set up Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Registry
uses: docker/login-action@v1
uses: docker/login-action@v1
with:
registry: ghcr.io
username: $GITHUB_ACTOR
Expand All @@ -102,8 +113,8 @@ jobs:
provenance: true
push: true
tags: |
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:latest
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:${{ steps.get_version.outputs.version }}
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ env.BRANCH_NAME }}:latest
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ env.BRANCH_NAME }}:${{ env.COMMIT_ID }}

- name: Scan Image
uses: aquasecurity/trivy-action@master
Expand All @@ -116,4 +127,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'
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ unzip -o keycloak-15.0.2.1.zip -d ~/.m2/repository/org
echo "Maven Building"

if [ "$1" == "build_without_dashboard" ]; then
mvn -pl '!test-tools,!addons/hdfs-model,!addons/hive-bridge,!addons/hive-bridge-shim,!addons/falcon-bridge-shim,!addons/falcon-bridge,!addons/sqoop-bridge,!addons/sqoop-bridge-shim,!addons/hbase-bridge,!addons/hbase-bridge-shim,!addons/hbase-testing-util,!addons/kafka-bridge,!addons/impala-hook-api,!addons/impala-bridge-shim,!addons/impala-bridge,!dashboardv2,!dashboardv3' -Dmaven.test.skip -DskipTests -Drat.skip=true -DskipOverlay -DskipEnunciate=true package -Pdist
mvn -pl '!addons/hdfs-model,!addons/hive-bridge,!addons/hive-bridge-shim,!addons/falcon-bridge-shim,!addons/falcon-bridge,!addons/sqoop-bridge,!addons/sqoop-bridge-shim,!addons/hbase-bridge,!addons/hbase-bridge-shim,!addons/hbase-testing-util,!addons/kafka-bridge,!addons/impala-hook-api,!addons/impala-bridge-shim,!addons/impala-bridge,!dashboardv2,!dashboardv3' -Dmaven.test.skip -DskipTests -Drat.skip=true -DskipOverlay -DskipEnunciate=true package -Pdist
else
mvn -pl '!test-tools,!addons/hdfs-model,!addons/hive-bridge,!addons/hive-bridge-shim,!addons/falcon-bridge-shim,!addons/falcon-bridge,!addons/sqoop-bridge,!addons/sqoop-bridge-shim,!addons/hbase-bridge,!addons/hbase-bridge-shim,!addons/hbase-testing-util,!addons/kafka-bridge,!addons/impala-hook-api,!addons/impala-bridge-shim,!addons/impala-bridge' -Dmaven.test.skip -DskipTests -Drat.skip=true -DskipEnunciate=true package -Pdist
mvn -pl '!addons/hdfs-model,!addons/hive-bridge,!addons/hive-bridge-shim,!addons/falcon-bridge-shim,!addons/falcon-bridge,!addons/sqoop-bridge,!addons/sqoop-bridge-shim,!addons/hbase-bridge,!addons/hbase-bridge-shim,!addons/hbase-testing-util,!addons/kafka-bridge,!addons/impala-hook-api,!addons/impala-bridge-shim,!addons/impala-bridge' -Dmaven.test.skip -DskipTests -Drat.skip=true -DskipEnunciate=true package -Pdist
fi

echo "[DEBUG listing distro/target"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,4 @@ public interface AtlasGraph<V, E> {
*/
AtlasGraphIndexClient getGraphIndexClient()throws AtlasException;


void setEnableCache(boolean enableCache);

Boolean isCacheEnabled();
}
4 changes: 4 additions & 0 deletions graphdb/janus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-driver</artifactId>
</exclusion>
<exclusion>
<groupId>cassandra-hadoop-util</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ private String performDirectIndexQuery(String query, boolean source) throws Atla
LOG.warn(String.format("ES index with name %s not found", index));
throw new AtlasBaseException(INDEX_NOT_FOUND, index);
} else {
throw new AtlasBaseException(rex);
throw new AtlasBaseException(String.format("Error in executing elastic query: %s", EntityUtils.toString(entity)), rex);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.janusgraph.core.Cardinality;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphIndexQuery;
import org.janusgraph.core.PropertyKey;
import org.janusgraph.core.SchemaViolationException;
import org.janusgraph.core.*;
import org.janusgraph.core.schema.JanusGraphIndex;
import org.janusgraph.core.schema.JanusGraphManagement;
import org.janusgraph.core.schema.Parameter;
Expand Down Expand Up @@ -689,11 +684,7 @@ private Edge getFirstActiveEdge(GraphTraversal gt) {
return null;
}

public void setEnableCache(boolean enableCache) {
this.janusGraph.setEnableCache(enableCache);
}

public Boolean isCacheEnabled() {
return this.janusGraph.isCacheEnabled();
public JanusGraphTransaction getTransaction() {
return this.janusGraph.newThreadBoundTransaction();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,

public AtlasJanusGraphDatabase() {
//update registry
GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()).create();
GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.instance()).create();
}

public static Configuration getConfiguration() throws AtlasException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Map<String, Object> directIndexQuery(String query) throws AtlasBaseExcept

@Override
public Iterator<Result<AtlasJanusVertex, AtlasJanusEdge>> vertices() {
Iterator<JanusGraphIndexQuery.Result<JanusGraphVertex>> results = query.vertices().iterator();
Iterator<JanusGraphIndexQuery.Result<JanusGraphVertex>> results = query.vertexStream().iterator();

Function<JanusGraphIndexQuery.Result<JanusGraphVertex>, Result<AtlasJanusVertex, AtlasJanusEdge>> function =
new Function<JanusGraphIndexQuery.Result<JanusGraphVertex>, Result<AtlasJanusVertex, AtlasJanusEdge>>() {
Expand All @@ -77,7 +77,7 @@ public Iterator<Result<AtlasJanusVertex, AtlasJanusEdge>> vertices(int offset, i
Iterator<JanusGraphIndexQuery.Result<JanusGraphVertex>> results = query
.offset(offset)
.limit(limit)
.vertices().iterator();
.vertexStream().iterator();

Function<JanusGraphIndexQuery.Result<JanusGraphVertex>, Result<AtlasJanusVertex, AtlasJanusEdge>> function =
new Function<JanusGraphIndexQuery.Result<JanusGraphVertex>, Result<AtlasJanusVertex, AtlasJanusEdge>>() {
Expand All @@ -100,7 +100,7 @@ public Iterator<Result<AtlasJanusVertex, AtlasJanusEdge>> vertices(int offset, i
.orderBy(sortBy, sortOrder)
.offset(offset)
.limit(limit)
.vertices().iterator();
.vertexStream().iterator();

Function<JanusGraphIndexQuery.Result<JanusGraphVertex>, Result<AtlasJanusVertex, AtlasJanusEdge>> function =
new Function<JanusGraphIndexQuery.Result<JanusGraphVertex>, Result<AtlasJanusVertex, AtlasJanusEdge>>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
import org.janusgraph.graphdb.query.condition.Not;
import org.janusgraph.graphdb.query.condition.Or;
import org.janusgraph.graphdb.query.condition.PredicateCondition;
import org.janusgraph.graphdb.tinkerpop.optimize.step.Aggregation;
import org.janusgraph.graphdb.types.ParameterType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -672,7 +673,7 @@ public Stream<String> query(IndexQuery query, KeyInformation.IndexRetriever info
doc -> doc.getFieldValue(keyIdField).toString());
}

@Override
//@Override
public Long queryCount(IndexQuery query, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException {
try {
String collection = query.getStore();
Expand Down Expand Up @@ -1178,6 +1179,16 @@ public boolean exists() throws BackendException {
}
}

@Override
public Number queryAggregation(IndexQuery indexQuery, KeyInformation.IndexRetriever indexRetriever, BaseTransaction baseTransaction, Aggregation aggregation) throws BackendException {
return null;
}

@Override
public void clearStore(String s) throws BackendException {

}

/*
################# UTILITY METHODS #######################
*/
Expand Down
5 changes: 5 additions & 0 deletions intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public enum AtlasConfiguration {
ATLAS_INDEXSEARCH_QUERY_SIZE_MAX_LIMIT("atlas.indexsearch.query.size.max.limit", 100000),
ATLAS_INDEXSEARCH_LIMIT_UTM_TAGS("atlas.indexsearch.limit.ignore.utm.tags", ""),
ATLAS_INDEXSEARCH_ENABLE_API_LIMIT("atlas.indexsearch.enable.api.limit", false),
ATLAS_INDEXSEARCH_ENABLE_JANUS_OPTIMISATION("atlas.indexsearch.enable.janus.optimization", true),
/***
* This configuration is used to enable fetching non primitive attributes in index search
*/
ATLAS_INDEXSEARCH_ENABLE_FETCHING_NON_PRIMITIVE_ATTRIBUTES("atlas.indexsearch.enable.fetching.non.primitive.attributes", true),

ATLAS_MAINTENANCE_MODE("atlas.maintenance.mode", false),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.LinkedHashMap;
import java.util.*;

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
Expand Down
18 changes: 4 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@
<curator.version>4.3.0</curator.version>
<doxia.version>1.8</doxia.version>
<dropwizard-metrics>3.2.2</dropwizard-metrics>
<elasticsearch.version>7.16.2</elasticsearch.version>
<elasticsearch.version>7.17.4</elasticsearch.version>
<entity.repository.impl>org.apache.atlas.repository.audit.InMemoryEntityAuditRepository</entity.repository.impl>
<enunciate-maven-plugin.version>2.13.2</enunciate-maven-plugin.version>
<failsafe.version>2.18.1</failsafe.version>
Expand All @@ -717,7 +717,7 @@
<httpcomponents-httpcore.version>4.4.13</httpcomponents-httpcore.version>
<jackson.databind.version>2.12.4</jackson.databind.version>
<jackson.version>2.12.4</jackson.version>
<janusgraph.version>0.6.03</janusgraph.version>
<janusgraph.version>1.0.0</janusgraph.version>
<janusgraph.cassandra.version>0.5.3</janusgraph.cassandra.version>
<javax-inject.version>1</javax-inject.version>
<javax.servlet.version>3.1.0</javax.servlet.version>
Expand Down Expand Up @@ -773,7 +773,7 @@
<surefire.forkCount>2C</surefire.forkCount>
<surefire.version>3.0.0-M5</surefire.version>
<testng.version>6.9.4</testng.version>
<tinkerpop.version>3.5.1</tinkerpop.version>
<tinkerpop.version>3.7.0</tinkerpop.version>
<woodstox-core.version>5.0.3</woodstox-core.version>
<zookeeper.version>3.5.5</zookeeper.version>
<redis.client.version>3.20.1</redis.client.version>
Expand Down Expand Up @@ -836,16 +836,6 @@
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/atlanhq/atlan-janusgraph</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>hortonworks.repo</id>
<url>https://repo.hortonworks.com/content/repositories/releases</url>
Expand Down Expand Up @@ -1806,7 +1796,7 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.4</version>
<version>1.11.0</version>
</plugin>

<plugin>
Expand Down
14 changes: 13 additions & 1 deletion repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
<artifactId>atlas-graphdb-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-util</artifactId>
<version>${tinkerpop.version}</version>
</dependency>

<dependency>
<groupId>org.jctools</groupId>
<artifactId>jctools-core</artifactId>
<version>4.0.1</version>
</dependency>

<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
Expand Down Expand Up @@ -111,7 +123,7 @@
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>*</artifactId>
<artifactId>netty-handler</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
Expand Down
Loading
Loading