Skip to content

Commit b4da7a2

Browse files
author
Janardhan Reddy
committed
Merge bug/rdf_type
1 parent 1d88417 commit b4da7a2

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed

rdf/parse.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -249,25 +249,25 @@ func Parse(line string) (rnq graphp.NQuad, rerr error) {
249249
return rnq, x.Errorf("itemObject can't be *")
250250
}
251251
// Lets find out the storage type from the type map.
252-
if t, ok := typeMap[val]; ok {
253-
if oval == "_nil_" && t != types.StringID {
254-
return rnq, x.Errorf("Invalid ObjectValue")
255-
}
256-
rnq.ObjectType = int32(t)
257-
src := types.ValueForType(types.StringID)
258-
src.Value = []byte(oval)
259-
p, err := types.Convert(src, t)
260-
if err != nil {
261-
return rnq, err
262-
}
263-
264-
if rnq.ObjectValue, err = types.ObjectValue(t, p.Value); err != nil {
265-
return rnq, err
266-
}
267-
oval = ""
268-
} else {
269-
oval += "@@" + val
252+
t, ok := typeMap[val]
253+
if !ok {
254+
return rnq, x.Errorf("Unrecognized rdf type %s", val)
255+
}
256+
if oval == "_nil_" && t != types.StringID {
257+
return rnq, x.Errorf("Invalid ObjectValue")
258+
}
259+
rnq.ObjectType = int32(t)
260+
src := types.ValueForType(types.StringID)
261+
src.Value = []byte(oval)
262+
p, err := types.Convert(src, t)
263+
if err != nil {
264+
return rnq, err
265+
}
266+
267+
if rnq.ObjectValue, err = types.ObjectValue(t, p.Value); err != nil {
268+
return rnq, err
270269
}
270+
oval = ""
271271

272272
case lex.ItemError:
273273
return rnq, x.Errorf(item.Val)
@@ -411,6 +411,7 @@ var typeMap = map[string]types.TypeID{
411411
"http://www.w3.org/2001/XMLSchema#dateTime": types.DateTimeID,
412412
"http://www.w3.org/2001/XMLSchema#date": types.DateID,
413413
"http://www.w3.org/2001/XMLSchema#int": types.IntID,
414+
"http://www.w3.org/2001/XMLSchema#integer": types.IntID,
414415
"http://www.w3.org/2001/XMLSchema#boolean": types.BoolID,
415416
"http://www.w3.org/2001/XMLSchema#double": types.FloatID,
416417
"http://www.w3.org/2001/XMLSchema#float": types.FloatID,

rdf/parse_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ var testNQuads = []struct {
438438
input: `_:gabe <name> "Gabe' .`,
439439
expectedErr: true,
440440
},
441+
{
442+
input: `_:gabe <name> "Gabe'^^<xs:yo> .`,
443+
expectedErr: true,
444+
},
441445
{
442446
input: `_:0 <name> <good> .`,
443447
nq: graphp.NQuad{

worker/draft.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ func (n *node) processApplyCh() {
520520
n.applied.Ch <- mark
521521
posting.SyncMarkFor(n.gid).Ch <- mark
522522
n.props.Done(proposal.Id, err)
523+
continue
523524
}
524525
}
525526

@@ -724,6 +725,12 @@ func (n *node) snapshotPeriodically() {
724725
}
725726

726727
func (n *node) snapshot(skip uint64) {
728+
if n.gid == 0 {
729+
// Group zero is dedicated for membership information, whose state we don't persist.
730+
// So, taking snapshots would end up deleting the RAFT entries that we need to
731+
// regenerate the state on a crash. Therefore, don't take snapshots.
732+
return
733+
}
727734
water := posting.SyncMarkFor(n.gid)
728735
le := water.DoneUntil()
729736

0 commit comments

Comments
 (0)