Repository navigation
Make --data-dir move the cache with it - #143
Merged
Merged
Conversation
The reference has always said the cache dir follows the data dir when nothing names it, and the config file honoured that, but the flag did not. kit works out its default cache dir from its default data dir before any flag is parsed, so a run pointed at a fresh tree with --data-dir went on reading the old tree's cache. A command aimed at an empty directory answered out of a cache it should not have been able to see, which is how a measurement of an offline index server came back green. The cache dir now follows kit's resolved data dir unless somebody named it, and named is the same lookup the config file path already used, so CCRAWL_CACHE_DIR and a cache_dir line pin it whichever way the data dir moved. config show was reporting "default" for cache_dir and db_path even when both had moved with the data dir, which reads as nothing touched this. Both now say "derived from data_dir" when that is what happened, the way raw_dir and parquet_dir already did.
34 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #138.
cli.mdsayscache_dir"followsdata_dirwhen unset" and the config file honoured that, but--data-dirdid not. kit computes its default cache dir from its default data dir before any flag is parsed, so--data-dir /somewhere/freshmoved the downloads, the Parquet, and the DuckDB file, and left the cache pointing at the old tree.That is not only untidy. It came up while measuring #137: a run aimed at an empty directory to prove a command fails without a cache came back exit 0, because it was reading the ambient cache the whole time. A flag that looks like isolation and is not gives you the wrong answer with no sign anything was wrong.
The cache dir now follows kit's resolved data dir unless somebody named it, and "named" is the same
settings.value("cache_dir")lookup the config file path already used, soCCRAWL_CACHE_DIRand acache_dirline both pin it whichever way the data dir moved.While in there:
config showreporteddefaultas the source ofcache_diranddb_patheven when both had moved with the data dir. That column exists to end questions about where a value came from, anddefaultnext to a moved path starts one. Both now sayderived from data_dirwhen that is what happened, the same asraw_dirandparquet_dir.Measured live
Before, on the same binary with the index server down:
After:
config show, before and after:Done when
--data-dirmoves the cache dir with it, the way the reference says it doesconfig shownames the data dir as the source of a path that followed itChecks
gofmt -l .clean,go vet ./...clean,go test ./...passing,scripts/docs-drift.shmatches the binary,scripts/coverage.shabove every floor with cli at 53.1%,golangci-lint run ./...0 issues.New tests:
TestTheDataDirFlagMovesTheCachecovers the flag moving the cache, the flag not being given, and the two ways of pinning it, andTestConfigShowSaysWhichPathsFollowTheDataDirchecks the source column through the command line. Both sit below the command line for the pinning cases, because the test harness exportsCCRAWL_CACHE_DIRfor every run so tests cannot read each other's caches.