Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes github issues #1002 #1074 #1025 #1170

Merged
merged 2 commits into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/mutations.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ func (d *Dgraph) NodeXid(xid string, storeXid bool) (Node, error) {
}
n := Node{uid: uid}
if storeXid && isNew {
e := n.Edge("_xid_")
e := n.Edge("xid")
x.Check(e.SetValueString(xid))
d.BatchSet(e)
}
Expand Down
14 changes: 13 additions & 1 deletion cmd/dgraphloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import (
"google.golang.org/grpc/credentials"

"github.com/dgraph-io/dgraph/client"
"github.com/dgraph-io/dgraph/protos"
"github.com/dgraph-io/dgraph/rdf"
"github.com/dgraph-io/dgraph/schema"
"github.com/dgraph-io/dgraph/types"
"github.com/dgraph-io/dgraph/x"

"github.com/pkg/profile"
Expand All @@ -40,7 +42,7 @@ var (
dgraph = flag.String("d", "127.0.0.1:9080", "Dgraph gRPC server address")
concurrent = flag.Int("c", 100, "Number of concurrent requests to make to Dgraph")
numRdf = flag.Int("m", 1000, "Number of RDF N-Quads to send as part of a mutation.")
storeXid = flag.Bool("x", false, "Store xids by adding corresponding _xid_ edges")
storeXid = flag.Bool("x", false, "Store xids by adding corresponding xid edges")
mode = flag.String("profile.mode", "", "enable profiling mode, one of [cpu, mem, mutex, block]")
clientDir = flag.String("cd", "c", "Directory to store xid to uid mapping")
blockRate = flag.Int("block", 0, "Block profiling rate")
Expand Down Expand Up @@ -242,6 +244,16 @@ func main() {

filesList := strings.Split(*files, ",")
x.AssertTrue(len(filesList) > 0)
if *storeXid {
if err := dgraphClient.AddSchema(protos.SchemaUpdate{
Predicate: "xid",
ValueType: uint32(types.StringID),
Tokenizer: []string{"hash"},
Directive: protos.SchemaUpdate_INDEX,
}); err != nil {
log.Fatal("While adding schema to batch ", err)
}
}
if len(*schemaFile) > 0 {
processSchemaFile(*schemaFile, dgraphClient)
}
Expand Down
42 changes: 22 additions & 20 deletions rdf/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,24 +321,26 @@ func isNewline(r rune) bool {
}

var typeMap = map[string]types.TypeID{
"xs:string": types.StringID,
"xs:date": types.DateTimeID,
"xs:dateTime": types.DateTimeID,
"xs:int": types.IntID,
"xs:boolean": types.BoolID,
"xs:double": types.FloatID,
"xs:float": types.FloatID,
"xs:base64Binary": types.BinaryID,
"geo:geojson": types.GeoID,
"pwd:password": types.PasswordID,
"http://www.w3.org/2001/XMLSchema#string": types.StringID,
"http://www.w3.org/2001/XMLSchema#dateTime": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#date": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#int": types.IntID,
"http://www.w3.org/2001/XMLSchema#integer": types.IntID,
"http://www.w3.org/2001/XMLSchema#boolean": types.BoolID,
"http://www.w3.org/2001/XMLSchema#double": types.FloatID,
"http://www.w3.org/2001/XMLSchema#float": types.FloatID,
"http://www.w3.org/2001/XMLSchema#gYear": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#gYearMonth": types.DateTimeID,
"xs:string": types.StringID,
"xs:date": types.DateTimeID,
"xs:dateTime": types.DateTimeID,
"xs:int": types.IntID,
"xs:positiveInteger": types.IntID,
"xs:boolean": types.BoolID,
"xs:double": types.FloatID,
"xs:float": types.FloatID,
"xs:base64Binary": types.BinaryID,
"geo:geojson": types.GeoID,
"pwd:password": types.PasswordID,
"http://www.w3.org/2001/XMLSchema#string": types.StringID,
"http://www.w3.org/2001/XMLSchema#dateTime": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#date": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#int": types.IntID,
"http://www.w3.org/2001/XMLSchema#positiveInteger": types.IntID,
"http://www.w3.org/2001/XMLSchema#integer": types.IntID,
"http://www.w3.org/2001/XMLSchema#boolean": types.BoolID,
"http://www.w3.org/2001/XMLSchema#double": types.FloatID,
"http://www.w3.org/2001/XMLSchema#float": types.FloatID,
"http://www.w3.org/2001/XMLSchema#gYear": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#gYearMonth": types.DateTimeID,
}
9 changes: 2 additions & 7 deletions worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ import (
)

const (
proposalMutation = 0
proposalReindex = 1
proposalMembership = 2
ErrorNodeIDExists = "Error Node ID already exists in the cluster"
ErrorNodeIDExists = "Error Node ID already exists in the cluster"
)

// peerPool stores the peers per node and the addresses corresponding to them.
Expand Down Expand Up @@ -562,9 +559,7 @@ func (n *node) processApplyCh() {
// schema here without any locking
proposal := &protos.Proposal{}
if err := proposal.Unmarshal(e.Data); err != nil {
fmt.Printf("Unable to unmarshal proposal: %v %q\n", e.Data)
log.Fatal("Remove me later")
// continue
log.Fatalf("Unable to unmarshal proposal: %v %q\n", err, e.Data)
}

if proposal.Mutations != nil {
Expand Down
2 changes: 2 additions & 0 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ func RunServer(bindall bool) {
laddr := "localhost"
if bindall {
laddr = "0.0.0.0"
} else if len(*myAddr) > 0 {
fmt.Printf("--my flag is provided without bindall, Did you forget to specify bindall?\n")
}
var err error
ln, err := net.Listen("tcp", fmt.Sprintf("%s:%d", laddr, workerPort()))
Expand Down