MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / writeSchema

Method writeSchema

dgraph/cmd/bulk/loader.go:564–590  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

562}
563
564func (ld *loader) writeSchema() {
565 numDBs := uint32(len(ld.dbs))
566 preds := make([][]string, numDBs)
567
568 // Get all predicates that have data in some DB.
569 m := make(map[string]struct{})
570 for i, db := range ld.dbs {
571 preds[i] = ld.schema.getPredicates(db)
572 for _, p := range preds[i] {
573 m[p] = struct{}{}
574 }
575 }
576
577 // Find any predicates that don't have data in any DB
578 // and distribute them among all the DBs.
579 for p := range ld.schema.schemaMap {
580 if _, ok := m[p]; !ok {
581 i := adler32.Checksum([]byte(p)) % numDBs
582 preds[i] = append(preds[i], p)
583 }
584 }
585
586 // Write out each DB's final predicate list.
587 for i, db := range ld.dbs {
588 ld.schema.write(db, preds[i])
589 }
590}
591
592func (ld *loader) cleanup() {
593 for _, db := range ld.dbs {

Callers 1

RunBulkLoaderFunction · 0.80

Calls 2

getPredicatesMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected