mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 09:21:47 +01:00
334cd92a6c
### Describe Your Changes fsync() ensures that the data is written to disk. In production this is needed for data durability. However, during the development, when the unit tests are run, this level of durability is not needed. Therefore fsync() can be disabled which will makes test runs two times faster. The disabling is done by setting the `DISABLE_FSYNC_FOR_TESTING` environment variable. The valid values for this variable are the same as the values of the arg of `go doc strconv.ParseBool`: ``` 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. ``` Any other value means `false`. The variable is set for all test build targets. Compare running times: Build Target | DISABLE_FSYNC_FOR_TESTING=0 | DISABLE_FSYNC_FOR_TESTING=1 ----------------- | ------------------------------------------------ | ------------------------------------------------- make test | 1m5s | 0m22s make test-race | 3m1s | 1m42s make test-pure | 1m7s | 0m20s make test-full | 1m21s | 0m32s make test-full-386 | 1m42s | 0m36s When running tests for a given package, fsync can be disabled as follows: ```shell DISABLE_FSYNC_FOR_TESTING=1 go test ./lib/storage ``` Disabling fsync() is intended for testing purposes only and the name of the variables reflects that. What could also have been done but haven't: - lib/filestream/filestream.go: `Writer.MustFlush()` also uses f.Sync() but nothing has been done to it, because the Writer.MustFlush() is not used anywhere in the VM codebase. A side question: what is the general policy for the unused code? - lib/filestream/filestream.go: Writer.Write() calls `adviceDontNeed()` which calls unix.Fdatasync(). Disabling it could potentially improve running time, but running tests with this code disabled has shown otherwise. ### Checklist The following checks are **mandatory**: - [ x] My change adheres [VictoriaMetrics contributing guidelines](https://docs.victoriametrics.com/contributing/). --------- Signed-off-by: Artem Fetishev <wwctrsrx@gmail.com>
30 lines
348 B
Plaintext
30 lines
348 B
Plaintext
/tmp
|
|
/tags
|
|
/pkg
|
|
*.pprof
|
|
/bin
|
|
.idea
|
|
.vscode
|
|
*.test
|
|
*.swp
|
|
/vmdocs
|
|
/gocache-for-docker
|
|
/victoria-logs-data
|
|
/victoria-metrics-data
|
|
/vmagent-remotewrite-data
|
|
/vmstorage-data
|
|
/vmselect-cache
|
|
/package/temp-deb-*
|
|
/package/temp-rpm-*
|
|
/package/*.deb
|
|
/package/*.rpm
|
|
.DS_store
|
|
Gemfile.lock
|
|
/_site
|
|
_site
|
|
*.tmp
|
|
/docs/.jekyll-metadata
|
|
coverage.txt
|
|
cspell.json
|
|
*~
|