File: 03-Close_DB.patch

package info (click to toggle)
golang-github-prometheus-tsdb 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,756 kB
  • sloc: makefile: 28
file content (52 lines) | stat: -rw-r--r-- 1,300 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Description: Add fix for tests not yet merged.
Author: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
Date:   Sun Dec 10 12:02:01 2017 -0600

    Close db so that file space is reclaimed immediately after delete.
    
    Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>

--- a/db_test.go
+++ b/db_test.go
@@ -236,6 +236,7 @@
 		// Compare the result.
 		q, err := db.Querier(0, numSamples)
 		testutil.Ok(t, err)
+		defer q.Close()
 
 		res, err := q.Select(labels.NewEqualMatcher("a", "b"))
 		testutil.Ok(t, err)
--- a/wal_test.go
+++ b/wal_test.go
@@ -51,6 +51,7 @@
 	for _, of := range w.files {
 		f, err := os.Open(of.Name())
 		testutil.Ok(t, err)
+		defer f.Close()
 
 		// Verify header data.
 		metab := make([]byte, 8)
@@ -142,6 +143,7 @@
 	}, nil, nil)
 
 	testutil.Equals(t, expected, readSeries)
+	testutil.Ok(t, w.Close())
 }
 
 // Symmetrical test of reading and writing to the WAL via its main interface.
@@ -291,6 +293,7 @@
 	fns, err := fileutil.ReadDir(dir)
 	testutil.Ok(t, err)
 	testutil.Equals(t, []string{"000000"}, fns)
+	testutil.Ok(t, wal.Close())
 }
 
 // Test reading from a WAL that has been corrupted through various means.
@@ -428,6 +431,7 @@
 
 			i = 0
 			testutil.Ok(t, r.Read(serf, samplf, nil))
+			testutil.Ok(t, w3.Close())
 		})
 	}
 }