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
ba584b68
Commit
ba584b68
authored
9 years ago
by
Ashwin
Browse files
Options
Downloads
Patches
Plain Diff
change in logic for xid equality
parent
ffcb50d3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tools/merge/main
+0
-0
0 additions, 0 deletions
tools/merge/main
tools/merge/main.go
+7
-20
7 additions, 20 deletions
tools/merge/main.go
tools/merge/main_test.go
+2
-3
2 additions, 3 deletions
tools/merge/main_test.go
with
9 additions
and
23 deletions
tools/merge/main
0 → 100755
+
0
−
0
View file @
ba584b68
File added
This diff is collapsed.
Click to expand it.
tools/merge/
rocksmerge
.go
→
tools/merge/
main
.go
+
7
−
20
View file @
ba584b68
...
@@ -78,7 +78,7 @@ func equalValue(a, b interface{}) bool {
...
@@ -78,7 +78,7 @@ func equalValue(a, b interface{}) bool {
aUid
:=
x
.
Uid
()
aUid
:=
x
.
Uid
()
bUid
:=
y
.
Uid
()
bUid
:=
y
.
Uid
()
return
aUid
==
bUid
||
return
(
x
.
ValueBytes
()
==
nil
&&
y
.
ValueBytes
()
==
nil
&&
(
aUid
==
bUid
))
||
((
x
.
Uid
()
==
math
.
MaxUint64
&&
y
.
Uid
()
==
math
.
MaxUint64
)
&&
((
x
.
Uid
()
==
math
.
MaxUint64
&&
y
.
Uid
()
==
math
.
MaxUint64
)
&&
bytes
.
Compare
(
x
.
ValueBytes
(),
y
.
ValueBytes
())
==
0
)
bytes
.
Compare
(
x
.
ValueBytes
(),
y
.
ValueBytes
())
==
0
)
}
}
...
@@ -98,12 +98,8 @@ func MergeFolders(mergePath, destPath string) {
...
@@ -98,12 +98,8 @@ func MergeFolders(mergePath, destPath string) {
wopt
=
rocksdb
.
NewWriteOptions
()
wopt
=
rocksdb
.
NewWriteOptions
()
wopt
.
SetSync
(
true
)
wopt
.
SetSync
(
true
)
count
:=
0
pq
=
make
(
PriorityQueue
,
0
)
for
range
dirList
{
heap
.
Init
(
&
pq
)
count
++
}
pq
=
make
(
PriorityQueue
,
count
)
var
storeIters
[]
*
rocksdb
.
Iterator
var
storeIters
[]
*
rocksdb
.
Iterator
for
i
,
dir
:=
range
dirList
{
for
i
,
dir
:=
range
dirList
{
mPath
:=
path
.
Join
(
mergePath
,
dir
.
Name
())
mPath
:=
path
.
Join
(
mergePath
,
dir
.
Name
())
...
@@ -120,33 +116,24 @@ func MergeFolders(mergePath, destPath string) {
...
@@ -120,33 +116,24 @@ func MergeFolders(mergePath, destPath string) {
glog
.
WithField
(
"path"
,
mPath
)
.
Info
(
"Store empty"
)
glog
.
WithField
(
"path"
,
mPath
)
.
Info
(
"Store empty"
)
continue
continue
}
}
pq
[
i
]
=
&
Item
{
item
:
=
&
Item
{
key
:
it
.
Key
(),
key
:
it
.
Key
(),
value
:
it
.
Value
(),
value
:
it
.
Value
(),
storeIdx
:
i
,
storeIdx
:
i
,
}
}
heap
.
Push
(
&
pq
,
item
)
storeIters
=
append
(
storeIters
,
it
)
storeIters
=
append
(
storeIters
,
it
)
}
}
heap
.
Init
(
&
pq
)
mergeUsingHeap
(
destPath
,
storeIters
)
}
func
mergeUsingHeap
(
destPath
string
,
storeIters
[]
*
rocksdb
.
Iterator
)
{
var
opt
*
rocksdb
.
Options
var
wopt
*
rocksdb
.
WriteOptions
opt
=
rocksdb
.
NewOptions
()
opt
.
SetCreateIfMissing
(
true
)
wopt
=
rocksdb
.
NewWriteOptions
()
wopt
.
SetSync
(
true
)
var
db
*
rocksdb
.
DB
var
db
*
rocksdb
.
DB
db
,
err
:
=
rocksdb
.
Open
(
destPath
,
opt
)
db
,
err
=
rocksdb
.
Open
(
destPath
,
opt
)
defer
db
.
Close
()
defer
db
.
Close
()
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
WithField
(
"filepath"
,
destPath
)
.
glog
.
WithField
(
"filepath"
,
destPath
)
.
Fatal
(
"While opening store"
)
Fatal
(
"While opening store"
)
}
}
heap
.
Init
(
&
pq
)
var
lastKey
,
lastValue
[]
byte
var
lastKey
,
lastValue
[]
byte
for
pq
.
Len
()
>
0
{
for
pq
.
Len
()
>
0
{
top
:=
heap
.
Pop
(
&
pq
)
.
(
*
Item
)
top
:=
heap
.
Pop
(
&
pq
)
.
(
*
Item
)
...
...
This diff is collapsed.
Click to expand it.
tools/merge/
rocksmerge
_test.go
→
tools/merge/
main
_test.go
+
2
−
3
View file @
ba584b68
...
@@ -11,12 +11,11 @@ import (
...
@@ -11,12 +11,11 @@ import (
"github.com/dgraph-io/dgraph/posting"
"github.com/dgraph-io/dgraph/posting"
"github.com/dgraph-io/dgraph/store"
"github.com/dgraph-io/dgraph/store"
"github.com/dgraph-io/dgraph/store/rocksdb"
"github.com/dgraph-io/dgraph/store/rocksdb"
"github.com/dgraph-io/dgraph/tools/merge"
"github.com/dgraph-io/dgraph/uid"
"github.com/dgraph-io/dgraph/uid"
"github.com/dgryski/go-farm"
"github.com/dgryski/go-farm"
)
)
func
Test
Qu
er
y
(
t
*
testing
.
T
)
{
func
Test
MergeFold
er
s
(
t
*
testing
.
T
)
{
logrus
.
SetLevel
(
logrus
.
DebugLevel
)
logrus
.
SetLevel
(
logrus
.
DebugLevel
)
rootDir
,
err
:=
ioutil
.
TempDir
(
""
,
"storetest_"
)
rootDir
,
err
:=
ioutil
.
TempDir
(
""
,
"storetest_"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -82,7 +81,7 @@ func TestQuery(t *testing.T) {
...
@@ -82,7 +81,7 @@ func TestQuery(t *testing.T) {
ps1
.
Close
()
ps1
.
Close
()
ps2
.
Close
()
ps2
.
Close
()
main
.
MergeFolders
(
rootDir
,
destDir
)
MergeFolders
(
rootDir
,
destDir
)
var
opt
*
rocksdb
.
Options
var
opt
*
rocksdb
.
Options
var
ropt
*
rocksdb
.
ReadOptions
var
ropt
*
rocksdb
.
ReadOptions
...
...
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