From 45c9b8be9ca4bfb6f61af31308741cf2dba6864e Mon Sep 17 00:00:00 2001 From: Harshil Goel Date: Fri, 27 Dec 2024 14:17:22 +0530 Subject: [PATCH] fixed some stuff --- posting/mvcc.go | 1 - posting/mvcc_test.go | 6 +++--- systest/21million/bulk/run_test.go | 21 ++++++++++++++++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/posting/mvcc.go b/posting/mvcc.go index 6dec339ac90..412004915d2 100644 --- a/posting/mvcc.go +++ b/posting/mvcc.go @@ -380,7 +380,6 @@ func RemoveCacheFor(key []byte) { type MemoryLayer struct { cache *ristretto.Cache[[]byte, *CachePL] - insert int numCacheRead int numCacheReadFails int numDisksRead int diff --git a/posting/mvcc_test.go b/posting/mvcc_test.go index 9d630f4dabd..2ff683b0345 100644 --- a/posting/mvcc_test.go +++ b/posting/mvcc_test.go @@ -113,10 +113,10 @@ func BenchmarkTestCache(b *testing.B) { attr := x.GalaxyAttr("cache") keys := make([][]byte, 0) - N := 10000 + N := uint64(10000) txn := Oracle().RegisterStartTs(1) - for i := uint64(1); i < uint64(N); i++ { + for i := uint64(1); i < N; i++ { key := x.DataKey(attr, i) keys = append(keys, key) edge := &pb.DirectedEdge{ @@ -143,7 +143,7 @@ func BenchmarkTestCache(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { - key := keys[rand.Intn(N-1)] + key := keys[rand.Intn(int(N)-1)] _, err = getNew(key, pstore, math.MaxUint64) if err != nil { panic(err) diff --git a/systest/21million/bulk/run_test.go b/systest/21million/bulk/run_test.go index 8e34e48485c..9a9c0995a06 100644 --- a/systest/21million/bulk/run_test.go +++ b/systest/21million/bulk/run_test.go @@ -39,7 +39,6 @@ func TestQueries(t *testing.T) { } func BenchmarkQueries(b *testing.B) { - _, thisFile, _, _ := runtime.Caller(0) queryDir := filepath.Join(filepath.Dir(thisFile), "../queries") @@ -54,8 +53,6 @@ func BenchmarkQueries(b *testing.B) { panic(fmt.Sprintf("Error reading directory: %s", err.Error())) } - //savepath := "" - //diffs := 0 for _, file := range files { if !strings.HasPrefix(file.Name(), "query-") { continue @@ -83,6 +80,24 @@ func BenchmarkQueries(b *testing.B) { } func TestMain(m *testing.M) { + schemaFile := filepath.Join(testutil.TestDataDirectory, "21million.schema") + rdfFile := filepath.Join(testutil.TestDataDirectory, "21million.rdf.gz") + if err := testutil.MakeDirEmpty([]string{"out/0", "out/1", "out/2"}); err != nil { + os.Exit(1) + } + + if err := testutil.BulkLoad(testutil.BulkOpts{ + Zero: testutil.SockAddrZero, + Shards: 1, + RdfFile: rdfFile, + SchemaFile: schemaFile, + }); err != nil { + cleanupAndExit(1) + } + + if err := testutil.StartAlphas("./alpha.yml"); err != nil { + cleanupAndExit(1) + } exitCode := m.Run() cleanupAndExit(exitCode) }