(attr string, startTs uint64)
| 354 | } |
| 355 | |
| 356 | func hasEdges(attr string, startTs uint64) bool { |
| 357 | pk := x.ParsedKey{Attr: attr} |
| 358 | iterOpt := badger.DefaultIteratorOptions |
| 359 | iterOpt.PrefetchValues = false |
| 360 | iterOpt.Prefix = pk.DataPrefix() |
| 361 | |
| 362 | txn := pstore.NewTransactionAt(startTs, false) |
| 363 | defer txn.Discard() |
| 364 | |
| 365 | it := txn.NewIterator(iterOpt) |
| 366 | defer it.Close() |
| 367 | |
| 368 | for it.Rewind(); it.Valid(); it.Next() { |
| 369 | // NOTE: This is NOT correct. |
| 370 | // An incorrect, but efficient way to quickly check if we have at least one non-empty |
| 371 | // posting. This does NOT consider those posting lists which can have multiple deltas |
| 372 | // summing up to an empty posting list. I'm leaving it as it is for now. But, this could |
| 373 | // cause issues because of this inaccuracy. |
| 374 | if it.Item().UserMeta()&posting.BitEmptyPosting == 0 { |
| 375 | return true |
| 376 | } |
| 377 | } |
| 378 | return false |
| 379 | } |
| 380 | func checkSchema(s *pb.SchemaUpdate) error { |
| 381 | if s == nil { |
| 382 | return errors.Errorf("Nil schema") |
no test coverage detected