Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dgraph
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
dgraph
Commits
a1371d55
Commit
a1371d55
authored
9 years ago
by
Manish R Jain
Browse files
Options
Downloads
Patches
Plain Diff
Change function names to make their purpose clear
parent
235c62c7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
loader/loader.go
+6
-4
6 additions, 4 deletions
loader/loader.go
server/uidassigner/main.go
+1
-2
1 addition, 2 deletions
server/uidassigner/main.go
with
7 additions
and
6 deletions
loader/loader.go
+
6
−
4
View file @
a1371d55
...
...
@@ -175,7 +175,7 @@ func (s *state) getUidForString(str string) {
}
}
func
(
s
*
state
)
handleNQuadsWhileAssign
(
wg
*
sync
.
WaitGroup
)
{
func
(
s
*
state
)
assignUidsOnly
(
wg
*
sync
.
WaitGroup
)
{
for
nq
:=
range
s
.
cnq
{
if
farm
.
Fingerprint64
([]
byte
(
nq
.
Subject
))
%
s
.
numInstances
!=
s
.
instanceIdx
{
// This instance shouldnt assign UID to this string
...
...
@@ -240,8 +240,10 @@ func HandleRdfReader(reader io.Reader, instanceIdx uint64,
return
atomic
.
LoadUint64
(
&
s
.
ctr
.
processed
),
nil
}
// Blocking function.
func
HandleRdfReaderWhileAssign
(
reader
io
.
Reader
,
instanceIdx
uint64
,
// AssignUids would pick up all the external ids in RDFs read,
// and assign unique integer ids for them. This function would
// not load the edges, only assign UIDs.
func
AssignUids
(
reader
io
.
Reader
,
instanceIdx
uint64
,
numInstances
uint64
)
(
uint64
,
error
)
{
s
:=
new
(
state
)
s
.
ctr
=
new
(
counters
)
...
...
@@ -264,7 +266,7 @@ func HandleRdfReaderWhileAssign(reader io.Reader, instanceIdx uint64,
wg
:=
new
(
sync
.
WaitGroup
)
for
i
:=
0
;
i
<
3000
;
i
++
{
wg
.
Add
(
1
)
go
s
.
handleNQuadsWhileAssign
(
wg
)
//Different compared to HandleRdfReader
go
s
.
assignUidsOnly
(
wg
)
}
// Block until all parseStream goroutines are finished.
...
...
This diff is collapsed.
Click to expand it.
server/uidassigner/main.go
+
1
−
2
View file @
a1371d55
...
...
@@ -83,8 +83,7 @@ func main() {
glog
.
WithError
(
err
)
.
Fatal
(
"Unable to create gzip reader."
)
}
count
,
err
:=
loader
.
HandleRdfReaderWhileAssign
(
r
,
*
instanceIdx
,
*
numInstances
)
count
,
err
:=
loader
.
AssignUids
(
r
,
*
instanceIdx
,
*
numInstances
)
if
err
!=
nil
{
glog
.
WithError
(
err
)
.
Fatal
(
"While handling rdf reader."
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment