Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
668addac
Commit
668addac
authored
Mar 04, 2020
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3649: Table-level Imports: Deleting Tables Differing By Requests Fails
parent
371f967f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
TableReplicationRequestProcessor.java
...s/repository/impexp/TableReplicationRequestProcessor.java
+13
-5
No files found.
repository/src/main/java/org/apache/atlas/repository/impexp/TableReplicationRequestProcessor.java
View file @
668addac
...
...
@@ -45,7 +45,7 @@ import java.util.HashSet;
public
class
TableReplicationRequestProcessor
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
TableReplicationRequestProcessor
.
class
);
private
static
final
String
QUERY_DB_NAME_EQUALS
=
"where db.name=
'%s'"
;
private
static
final
String
QUERY_DB_NAME_EQUALS
=
"qualifiedName startsWith
'%s'"
;
private
static
final
String
ATTR_NAME_KEY
=
"name"
;
private
static
final
String
TYPE_HIVE_TABLE
=
"hive_table"
;
private
static
final
String
ATTR_QUALIFIED_NAME_KEY
=
"qualifiedName"
;
...
...
@@ -83,7 +83,7 @@ public class TableReplicationRequestProcessor {
deleteTables
(
sourceCluster
,
guidsToDelete
);
}
private
List
<
String
>
getQualifiedNamesFromRequest
(
AtlasExportRequest
exportRequest
){
private
List
<
String
>
getQualifiedNamesFromRequest
(
AtlasExportRequest
exportRequest
)
{
List
<
String
>
qualifiedNames
=
new
ArrayList
<>();
for
(
AtlasObjectId
objectId
:
exportRequest
.
getItemsToExport
())
{
...
...
@@ -95,7 +95,7 @@ public class TableReplicationRequestProcessor {
private
List
<
String
>
getEntitiesFromQualifiedNames
(
List
<
String
>
qualifiedNames
)
throws
AtlasBaseException
{
List
<
String
>
safeGUIDs
=
new
ArrayList
<>();
for
(
String
qualifiedName
:
qualifiedNames
)
{
for
(
String
qualifiedName
:
qualifiedNames
)
{
String
guid
=
getGuidByUniqueAttributes
(
Collections
.
singletonMap
(
ATTR_QUALIFIED_NAME_KEY
,
qualifiedName
));
safeGUIDs
.
add
(
guid
);
}
...
...
@@ -133,9 +133,18 @@ public class TableReplicationRequestProcessor {
if
(
CollectionUtils
.
isEmpty
(
searchResult
.
getEntities
()))
{
break
;
}
else
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"getGuidsToDelete: {}"
,
searchResult
.
getApproximateCount
());
}
}
String
classificationName
=
String
.
format
(
REPLICATED_TAG_NAME
,
sourceCluster
);
for
(
AtlasEntityHeader
entityHeader
:
searchResult
.
getEntities
())
{
if
(!
entityHeader
.
getClassificationNames
().
contains
(
classificationName
))
{
continue
;
}
String
guid
=
entityHeader
.
getGuid
();
if
(!
excludeGUIDs
.
contains
(
guid
))
{
unsafeGUIDs
.
add
(
guid
);
...
...
@@ -155,8 +164,7 @@ public class TableReplicationRequestProcessor {
parameters
.
setTypeName
(
TYPE_HIVE_TABLE
);
parameters
.
setExcludeDeletedEntities
(
true
);
parameters
.
setClassification
(
String
.
format
(
REPLICATED_TAG_NAME
,
sourceCluster
));
parameters
.
setAttributes
(
new
HashSet
<
String
>(){{
add
(
AtlasImportRequest
.
OPTION_KEY_REPLICATED_FROM
);
}});
parameters
.
setAttributes
(
new
HashSet
<
String
>()
{{
add
(
AtlasImportRequest
.
OPTION_KEY_REPLICATED_FROM
);
}});
parameters
.
setQuery
(
query
);
return
parameters
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment