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
d727cef7
Commit
d727cef7
authored
Mar 30, 2020
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3674: ZipFileMigationImporter: Migration status display fix. Part 2
parent
9e2a49bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
DataMigrationStatusService.java
...tlas/repository/migration/DataMigrationStatusService.java
+13
-3
EntityConsumer.java
...pository/store/graph/v2/bulkimport/pc/EntityConsumer.java
+3
-3
DataMigrationStatusServiceTest.java
...las/repository/impexp/DataMigrationStatusServiceTest.java
+8
-1
No files found.
repository/src/main/java/org/apache/atlas/repository/migration/DataMigrationStatusService.java
View file @
d727cef7
...
...
@@ -101,12 +101,12 @@ public class DataMigrationStatusService {
public
void
savePosition
(
Long
position
)
{
this
.
status
.
setCurrentIndex
(
position
);
this
.
migrationStatusVertexManagement
.
updateVertexPartial
(
this
.
status
);
this
.
migrationStatusVertexManagement
.
updateVertexPartial
Position
(
this
.
status
);
}
public
void
setStatus
(
String
status
)
{
this
.
status
.
setOperationStatus
(
status
);
this
.
migrationStatusVertexManagement
.
updateVertexPartial
(
this
.
status
);
this
.
migrationStatusVertexManagement
.
updateVertexPartial
Status
(
this
.
status
);
}
private
static
class
MigrationStatusVertexManagement
{
...
...
@@ -184,7 +184,7 @@ public class DataMigrationStatusService {
return
null
;
}
public
void
updateVertexPartial
(
MigrationImportStatus
status
)
{
public
void
updateVertexPartial
Position
(
MigrationImportStatus
status
)
{
try
{
setEncodedProperty
(
vertex
,
PROPERTY_KEY_POSITION
,
status
.
getCurrentIndex
());
}
catch
(
Exception
e
)
{
...
...
@@ -194,6 +194,16 @@ public class DataMigrationStatusService {
}
}
public
void
updateVertexPartialStatus
(
MigrationImportStatus
status
)
{
try
{
setEncodedProperty
(
vertex
,
PROPERTY_KEY_STATUS
,
status
.
getOperationStatus
());
}
catch
(
Exception
e
)
{
LOG
.
warn
(
"Error updating status. Please rely on log messages."
,
e
);
}
finally
{
atlasGraph
.
commit
();
}
}
private
void
updateVertex
(
AtlasVertex
vertex
,
MigrationImportStatus
status
)
{
try
{
setEncodedProperty
(
vertex
,
Constants
.
GUID_PROPERTY_KEY
,
status
.
getName
());
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/bulkimport/pc/EntityConsumer.java
View file @
d727cef7
...
...
@@ -71,9 +71,9 @@ public class EntityConsumer extends WorkItemConsumer<AtlasEntity.AtlasEntityWith
@Override
protected
void
processItem
(
AtlasEntity
.
AtlasEntityWithExtInfo
entityWithExtInfo
)
{
int
delta
=
(
MapUtils
.
isEmpty
(
entityWithExtInfo
.
getReferredEntities
())
int
delta
=
MapUtils
.
isEmpty
(
entityWithExtInfo
.
getReferredEntities
())
?
1
:
entityWithExtInfo
.
getReferredEntities
().
size
()
)
+
1
;
:
entityWithExtInfo
.
getReferredEntities
().
size
()
+
1
;
long
currentCount
=
counter
.
addAndGet
(
delta
);
currentBatch
.
addAndGet
(
delta
);
...
...
@@ -83,7 +83,7 @@ public class EntityConsumer extends WorkItemConsumer<AtlasEntity.AtlasEntityWith
processEntity
(
entityWithExtInfo
,
currentCount
);
attemptCommit
();
}
catch
(
Exception
e
)
{
LOG
.
info
(
"
Data loss: Please
re-submit!"
,
e
);
LOG
.
info
(
"
Invalid entities. Possible data loss: Please correct and
re-submit!"
,
e
);
}
}
...
...
repository/src/test/java/org/apache/atlas/repository/impexp/DataMigrationStatusServiceTest.java
View file @
d727cef7
...
...
@@ -38,7 +38,9 @@ public class DataMigrationStatusServiceTest {
AtlasGraph
atlasGraph
;
@Test
public
void
createUpdateDelete
()
throws
AtlasBaseException
{
public
void
createUpdateDelete
()
{
final
String
STATUS_DONE
=
"DONE"
;
DataMigrationStatusService
dataMigrationStatusService
=
new
DataMigrationStatusService
(
atlasGraph
);
MigrationImportStatus
expected
=
new
MigrationImportStatus
(
"/tmp/defg.zip"
);
...
...
@@ -59,6 +61,11 @@ public class DataMigrationStatusServiceTest {
assertNotNull
(
dataMigrationStatusService
.
getStatus
().
getCurrentIndex
(),
"100"
);
assertNotNull
(
dataMigrationStatusService
.
getCreate
(
expected
).
getCurrentIndex
(),
"100"
);
dataMigrationStatusService
.
setStatus
(
STATUS_DONE
);
assertNotNull
(
dataMigrationStatusService
.
getCreate
(
expected
).
getOperationStatus
());
assertEquals
(
dataMigrationStatusService
.
getCreate
(
expected
).
getOperationStatus
(),
STATUS_DONE
);
dataMigrationStatusService
.
delete
();
assertNull
(
dataMigrationStatusService
.
getStatus
());
assertNull
(
dataMigrationStatusService
.
getByName
(
ret
.
getName
()));
...
...
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