MCPcopy
hub / github.com/dgraph-io/dgraph / TestAddMutation_mrjn2

Function TestAddMutation_mrjn2

posting/list_test.go:627–702  ·  view source on GitHub ↗

Test the various mutate, commit and abort sequences.

(t *testing.T)

Source from the content-addressed store, hash-verified

625
626// Test the various mutate, commit and abort sequences.
627func TestAddMutation_mrjn2(t *testing.T) {
628 t.Skip()
629 ctx := context.Background()
630 key := x.DataKey(x.AttrInRootNamespace("bal"), 1001)
631 ol, err := readPostingListFromDisk(key, ps, math.MaxUint64)
632 require.NoError(t, err)
633 var readTs uint64
634 for readTs = 1; readTs < 10; readTs++ {
635 edge := &pb.DirectedEdge{
636 ValueId: readTs,
637 ValueType: pb.Posting_INT,
638 }
639 txn := &Txn{StartTs: readTs}
640 addMutationHelper(t, ol, edge, Set, txn)
641 }
642 for i := 1; i < 10; i++ {
643 // Each of these txns see their own write.
644 opt := ListOptions{ReadTs: uint64(i)}
645 list, err := ol.Uids(opt)
646 require.NoError(t, err)
647 require.EqualValues(t, 1, len(list.Uids))
648 require.EqualValues(t, uint64(i), list.Uids[0])
649 }
650 require.EqualValues(t, 0, ol.Length(readTs, 0))
651 require.NoError(t, ol.commitMutation(1, 0))
652 require.NoError(t, ol.commitMutation(3, 4))
653 require.NoError(t, ol.commitMutation(6, 10))
654 require.NoError(t, ol.commitMutation(9, 14))
655 require.EqualValues(t, 3, ol.Length(15, 0)) // The three commits.
656
657 {
658 edge := &pb.DirectedEdge{
659 Value: []byte(x.Star),
660 Op: pb.DirectedEdge_DEL,
661 }
662 txn := &Txn{StartTs: 7}
663 require.NoError(t, ol.addMutation(ctx, txn, edge))
664
665 // Add edge just to test that the deletion still happens.
666 edge = &pb.DirectedEdge{
667 ValueId: 7,
668 ValueType: pb.Posting_INT,
669 }
670 require.NoError(t, ol.addMutation(ctx, txn, edge))
671
672 require.EqualValues(t, 3, ol.Length(15, 0)) // The three commits should still be found.
673 require.NoError(t, ol.commitMutation(7, 11))
674
675 require.EqualValues(t, 2, ol.Length(10, 0)) // Two commits should be found.
676 require.EqualValues(t, 1, ol.Length(12, 0)) // Only one commit should be found.
677 require.EqualValues(t, 2, ol.Length(15, 0)) // Only one commit should be found.
678 }
679 {
680 edge := &pb.DirectedEdge{
681 Value: []byte(x.Star),
682 Op: pb.DirectedEdge_DEL,
683 }
684 txn := &Txn{StartTs: 5}

Callers

nothing calls this directly

Calls 9

DataKeyFunction · 0.92
AttrInRootNamespaceFunction · 0.92
addMutationHelperFunction · 0.85
commitMutationMethod · 0.80
addMutationMethod · 0.80
readPostingListFromDiskFunction · 0.70
SkipMethod · 0.65
UidsMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected