Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb/mapreduce: remove the data generated after pass each TestCase? #315

Open
longfangsong opened this issue Jan 13, 2020 · 0 comments
Open

Comments

@longfangsong
Copy link

longfangsong commented Jan 13, 2020

When doing this homework, I found make test_example drained my disk space, and then panicked due to no space left on device.

After understanding the test code, I found the test code never cleanup the data generated after each testcase.

In my opinion, since the size of the data each test case generated is not ignorable, the test should remove them after each case.

Something like that:

// tidb/mapreduce/urltop10_test.go
func testURLTop(t *testing.T, rounds RoundsArgs) {
	// ......
	for k := range dataSize {
		for i, gen := range gens {
			// generate data
			prefix := dataPrefix(i, dataSize[k], nMapFiles[k])
			// ......
                        // added code here: clean up, or cleanup only when the case has passed
			os.RemoveAll(prefix)
		}
	}
}

Is there any good reason not doing this?

Or is the cleanup part of the homework?


在做这个作业的时候,我在运行 make test_example 发现生成的mr_homework占了大量磁盘空间,并且测试由于no space left on device panic了。
在理解了测试代码后,我发现测试代码并不在每个testcase之后清理生成的文件。(也许是希望随后由用户手动make cleanup?但这样就容易出现我上面的问题。)
在我看来,每个testcase生成的文件的大小并不小到可以忽略,是否考虑在每个testcase执行完(或者执行完且为pass)后立即清理掉这部分文件?(还是说在某处手动清理是作业的一部分?)
像这样:

// tidb/mapreduce/urltop10_test.go
func testURLTop(t *testing.T, rounds RoundsArgs) {
	// ......
	for k := range dataSize {
		for i, gen := range gens {
			// generate data
			prefix := dataPrefix(i, dataSize[k], nMapFiles[k])
			// ......
                        // 新增代码: clean up, 或者也可以放在测试pass的分支中
			os.RemoveAll(prefix)
		}
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants