From c91159b7e211c31db77e022256e41e1ccd708f49 Mon Sep 17 00:00:00 2001
From: Manish R Jain <manish@dgraph.io>
Date: Tue, 10 Jul 2018 19:14:14 -0700
Subject: [PATCH] Remove unnecessary function.

---
 posting/rollup.go  | 41 -----------------------------------------
 worker/mutation.go | 15 ++++++++-------
 2 files changed, 8 insertions(+), 48 deletions(-)

diff --git a/posting/rollup.go b/posting/rollup.go
index af3a65f0..464f0775 100644
--- a/posting/rollup.go
+++ b/posting/rollup.go
@@ -141,44 +141,3 @@ func (l *List) Rollup() (*intern.PostingList, error) {
 	// atomic.StoreInt32(&l.estimatedSize, l.calculateSize())
 	// return nil
 }
-
-func scanKeysToRoll(snapshotTs uint64, keyChan chan *intern.KVS) error {
-	txn := pstore.NewTransactionAt(snapshotTs, false)
-	defer txn.Discard()
-
-	opts := badger.DefaultIteratorOptions
-	opts.AllVersions = false
-	opts.PrefetchValues = false
-
-	itr := txn.NewIterator(opts)
-	defer itr.Close()
-
-	kvs := new(intern.KVS)
-	// We just pick up the first version of each key. If it is already complete, we skip.
-	// If it is a delta, we add that to KVS, to be rolled up.
-	for itr.Rewind(); itr.Valid(); itr.Next() {
-		item := itr.Item()
-		pk := x.Parse(item.Key())
-		if pk.IsSchema() {
-			// Skip schema.
-			continue
-		}
-		if item.UserMeta()&BitCompletePosting > 0 {
-			// First version is complete. Therefore, skip.
-
-		} else if item.UserMeta()&BitDeltaPosting > 0 {
-			kvs.Kv = append(kvs.Kv, &intern.KV{Key: item.KeyCopy(nil)})
-			if len(kvs.Kv) >= 100 {
-				keyChan <- kvs
-				kvs = new(intern.KVS)
-			}
-
-		} else {
-			x.Fatalf("unexpected meta: %d", item.UserMeta())
-		}
-	}
-	if len(kvs.Kv) > 0 {
-		keyChan <- kvs
-	}
-	return nil
-}
diff --git a/worker/mutation.go b/worker/mutation.go
index e77af843..5ad46cb5 100644
--- a/worker/mutation.go
+++ b/worker/mutation.go
@@ -85,13 +85,14 @@ func runSchemaMutation(ctx context.Context, update *intern.SchemaUpdate, startTs
 	}
 
 	// Flush to disk
-	posting.CommitLists(func(key []byte) bool {
-		pk := x.Parse(key)
-		if pk.Attr == update.Predicate {
-			return true
-		}
-		return false
-	})
+	// TODO: Figure out how to do this.
+	// posting.CommitLists(func(key []byte) bool {
+	// 	pk := x.Parse(key)
+	// 	if pk.Attr == update.Predicate {
+	// 		return true
+	// 	}
+	// 	return false
+	// })
 	updateSchema(update.Predicate, *update)
 	return nil
 }
-- 
GitLab