(t *testing.T)
| 324 | } |
| 325 | |
| 326 | func TestAddMutation_DelRead(t *testing.T) { |
| 327 | key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 1543) |
| 328 | ol, err := GetNoStore(key, math.MaxUint64) |
| 329 | ol.mutationMap.setTs(1) |
| 330 | require.NoError(t, err) |
| 331 | |
| 332 | // Set value to newcars, and commit it |
| 333 | edge := &pb.DirectedEdge{ |
| 334 | Value: []byte("newcars"), |
| 335 | } |
| 336 | txn := &Txn{StartTs: 1} |
| 337 | addMutationHelper(t, ol, edge, Set, txn) |
| 338 | require.NoError(t, ol.commitMutation(1, uint64(2))) |
| 339 | require.EqualValues(t, 1, ol.Length(2, 0)) |
| 340 | checkValue(t, ol, "newcars", 2) |
| 341 | |
| 342 | // DO sp*, don't commit |
| 343 | // Del a value cars and but don't merge. |
| 344 | edge = &pb.DirectedEdge{ |
| 345 | Value: []byte(x.Star), |
| 346 | Op: pb.DirectedEdge_DEL, |
| 347 | } |
| 348 | txn = &Txn{StartTs: 3} |
| 349 | require.NoError(t, ol.addMutation(context.Background(), txn, edge)) |
| 350 | |
| 351 | // Part of same transaction as sp*, so should see zero length even |
| 352 | // if not committed yet. |
| 353 | require.EqualValues(t, 0, ol.Length(3, 0)) |
| 354 | |
| 355 | // Commit sp* only in oracle, don't apply to pl yet |
| 356 | require.NoError(t, ol.commitMutation(3, 5)) |
| 357 | |
| 358 | // This read should ignore sp*, since readts is 4 and it was committed at 5 |
| 359 | require.EqualValues(t, 1, ol.Length(4, 0)) |
| 360 | checkValue(t, ol, "newcars", 4) |
| 361 | |
| 362 | require.EqualValues(t, 0, ol.Length(6, 0)) |
| 363 | } |
| 364 | |
| 365 | func TestAddMutation_jchiu2(t *testing.T) { |
| 366 | key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 15) |
nothing calls this directly
no test coverage detected
searching dependent graphs…