Skip to content

Commit

Permalink
Fixes github issues #1002 #1074 #1025
Browse files Browse the repository at this point in the history
  • Loading branch information
Janardhan Reddy committed Jul 11, 2017
1 parent 07abc9a commit 1d80ddd
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
12 changes: 12 additions & 0 deletions 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 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

0 comments on commit 1d80ddd

Please sign in to comment.