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
c2be0646
Commit
c2be0646
authored
7 years ago
by
apoorvnaik
Committed by
Madhan Neethiraj
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2444: fix for IT failures
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
4152bc6d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
9 deletions
+22
-9
HiveMetaStoreBridge.java
...ava/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+6
-1
HiveITBase.java
...ridge/src/test/java/org/apache/atlas/hive/HiveITBase.java
+10
-2
HiveHookIT.java
.../src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+2
-3
HdfsNameServiceResolver.java
.../java/org/apache/atlas/utils/HdfsNameServiceResolver.java
+4
-3
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
View file @
c2be0646
...
...
@@ -615,7 +615,12 @@ public class HiveMetaStoreBridge {
ref
.
set
(
"nameServiceId"
,
nameServiceID
);
}
else
{
ref
.
set
(
"path"
,
pathUri
);
ref
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
getHdfsPathQualifiedName
(
clusterName
,
pathUri
));
// Only append clusterName for the HDFS path
if
(
pathUri
.
startsWith
(
HdfsNameServiceResolver
.
HDFS_SCHEME
))
{
ref
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
getHdfsPathQualifiedName
(
clusterName
,
pathUri
));
}
else
{
ref
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
pathUri
);
}
}
ref
.
set
(
AtlasConstants
.
CLUSTER_NAME_ATTRIBUTE
,
clusterName
);
return
ref
;
...
...
This diff is collapsed.
Click to expand it.
addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java
View file @
c2be0646
...
...
@@ -231,13 +231,21 @@ public class HiveITBase {
Referenceable
hdfsPathRef
=
atlasClient
.
getEntity
(
hdfsPathId
);
Assert
.
assertEquals
(
hdfsPathRef
.
get
(
"path"
),
testPathNormed
);
Assert
.
assertEquals
(
hdfsPathRef
.
get
(
NAME
),
Path
.
getPathWithoutSchemeAndAuthority
(
path
).
toString
().
toLowerCase
());
Assert
.
assertEquals
(
hdfsPathRef
.
get
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
),
testPathNormed
);
if
(
testPathNormed
!=
null
)
{
Assert
.
assertTrue
(((
String
)
hdfsPathRef
.
get
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
)).
startsWith
(
testPathNormed
));
}
}
}
private
String
assertHDFSPathIsRegistered
(
String
path
)
throws
Exception
{
LOG
.
debug
(
"Searching for hdfs path {}"
,
path
);
return
assertEntityIsRegistered
(
HiveMetaStoreBridge
.
HDFS_PATH
,
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
path
,
null
);
// ATLAS-2444 HDFS name node federation adds the cluster name to the qualifiedName
if
(
path
.
startsWith
(
"hdfs://"
))
{
String
pathWithCluster
=
path
+
"@"
+
CLUSTER_NAME
;
return
assertEntityIsRegistered
(
HiveMetaStoreBridge
.
HDFS_PATH
,
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
pathWithCluster
,
null
);
}
else
{
return
assertEntityIsRegistered
(
HiveMetaStoreBridge
.
HDFS_PATH
,
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
path
,
null
);
}
}
protected
String
assertDatabaseIsRegistered
(
String
dbName
)
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
View file @
c2be0646
...
...
@@ -263,11 +263,10 @@ public class HiveHookIT extends HiveITBase {
Iterator
<?
extends
Entity
>
iterator
=
expectedTables
.
iterator
();
for
(
int
i
=
0
;
i
<
expectedTables
.
size
();
i
++)
{
Entity
hiveEntity
=
iterator
.
next
();
if
(
Entity
.
Type
.
TABLE
.
equals
(
hiveEntity
.
getType
())
||
Entity
.
Type
.
DFS_DIR
.
equals
(
hiveEntity
.
getType
()))
{
if
(
Entity
.
Type
.
TABLE
.
equals
(
hiveEntity
.
getType
())
||
Entity
.
Type
.
DFS_DIR
.
equals
(
hiveEntity
.
getType
()))
{
Referenceable
entity
=
atlasClient
.
getEntity
(
tableRef
.
get
(
i
).
_getId
());
LOG
.
debug
(
"Validating output {} {} "
,
i
,
entity
);
Assert
.
assertEquals
(
entity
.
get
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
),
hiveEntity
.
getName
(
));
assertTrue
(((
String
)
entity
.
get
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
)).
startsWith
(
hiveEntity
.
getName
()
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
common/src/main/java/org/apache/atlas/utils/HdfsNameServiceResolver.java
View file @
c2be0646
...
...
@@ -32,8 +32,9 @@ import java.util.Objects;
public
class
HdfsNameServiceResolver
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
HdfsNameServiceResolver
.
class
);
public
static
final
String
HDFS_SCHEME
=
"hdfs://"
;
private
static
final
int
DEFAULT_PORT
=
8020
;
private
static
final
String
HDFS_SCHEME
=
"hdfs://"
;
private
static
final
String
HDFS_NAMESERVICE_PROPERTY_KEY
=
"dfs.nameservices"
;
private
static
final
String
HDFS_INTERNAL_NAMESERVICE_PROPERTY_KEY
=
"dfs.internal.nameservices"
;
private
static
final
String
HDFS_NAMENODES_HA_NODES_PREFIX
=
"dfs.ha.namenodes."
;
...
...
@@ -83,7 +84,7 @@ public class HdfsNameServiceResolver {
String
ret
=
path
;
// Only handle URLs that begin with hdfs://
if
(
path
.
indexOf
(
HDFS_SCHEME
)
==
0
)
{
if
(
path
!=
null
&&
path
.
indexOf
(
HDFS_SCHEME
)
==
0
)
{
URI
uri
=
new
Path
(
path
).
toUri
();
String
nsId
;
...
...
@@ -114,7 +115,7 @@ public class HdfsNameServiceResolver {
String
ret
=
""
;
// Only handle path URLs that begin with hdfs://
if
(
path
.
indexOf
(
HDFS_SCHEME
)
==
0
)
{
if
(
path
!=
null
&&
path
.
indexOf
(
HDFS_SCHEME
)
==
0
)
{
try
{
URI
uri
=
new
Path
(
path
).
toUri
();
...
...
This diff is collapsed.
Click to expand it.
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