database: don’t reindex between versions 5 and 6#25872
database: don’t reindex between versions 5 and 6#25872
Conversation
|
Hm, the db version is 6 for me already, am I supposed to downgrade spack, run reindex, and then come back to this pr and then try the environment again? |
🤔 |
|
Okay this tiime for sure. |
|
I don't understand the last commit 😅 since spack/lib/spack/spack/database.py Line 70 in 5fddd48 maybe it was not rebased on develop? I should have been more clear, if I checkout the commit before the So now that my database version is already at 6, I can't go back and see if this PR would actually solve my issue from #25867? TL;DR how can I test this PR now that I've already used spack on develop and it has upgraded the database to v6? |
It could be something weird on my end. I just rebased on develop again just in case.
and so on. |
|
@nhanford wrote:
It's still is weird on your end. The real misunderstanding is: Since your two commits on $ git log -n1 --oneline develop
5fddd48f80 (HEAD -> develop) Refactor unit-tests in test/architecture.py (#25848)
$ git log -n1 --oneline fix/nhanford/db-no-reindex-5-6
24a522417b (fix/nhanford/db-no-reindex-5-6) Merge branch 'develop' into fix/nhanford/db-no-reindex-5-6
$ git diff -s develop fix/nhanford/db-no-reindex-5-6
(no output)These are exactly the lines which were the two commits in your branch before the merge of develop into your "5-6" branch, because they are also in your merged pull request for PR #22845: git log -p d83f7110d5 -n1|grep Version..[56]
-_db_version = Version('5')
+_db_version = Version('6')
(Version('0.9.3'), Version('5')),
+ (Version('5'), Version('6'))
isn't a well-defined and repeatable regression test. Your merged PR 22845 seems to break spack uninstall -y --all bzip2
==> Error: '6bacc5jo5vnw4g7bfle2qqsmqgcvjcfg' |
|
If I do this: I'm still hitting that issue :( @bernhardkaindl can you share |
|
Thanks @bernhardkaindl and @haampie for the comments. We are narrowing it down right now and this helps. |
Yes it is because of dependent_environments! spack -d uninstall --all bzip2 2>&1|sed "s@$SPACK_ROOT@\$spack@;s/2021.*]/time]/"
==> [time] Imported uninstall from built-in commands
==> [time] Imported uninstall from built-in commands
==> [time] Reading config file $spack/etc/spack/defaults/config.yaml
==> [time] Reading config file $spack/etc/spack/defaults/bootstrap.yaml
==> [time] DATABASE LOCK TIMEOUT: 3s
==> [time] PACKAGE LOCK TIMEOUT: No timeout
==> [time] Reading config file $spack/etc/spack/defaults/repos.yaml
Traceback (most recent call last):
File "$spack/bin/spack", line 100, in <module>
sys.exit(spack.main.main())
File "$spack/lib/spack/spack/main.py", line 797, in main
return _invoke_command(command, parser, args, unknown)
File "$spack/lib/spack/spack/main.py", line 525, in _invoke_command
return_val = command(parser, args)
File "$spack/lib/spack/spack/cmd/uninstall.py", line 360, in uninstall
uninstall_specs(args, specs)
File "$spack/lib/spack/spack/cmd/uninstall.py", line 316, in uninstall_specs
uninstall_list, remove_list = get_uninstall_list(args, specs, env)
File "$spack/lib/spack/spack/cmd/uninstall.py", line 252, in get_uninstall_list
spec_envs = dependent_environments(uninstall_list)
File "$spack/lib/spack/spack/cmd/uninstall.py", line 163, in dependent_environments
hashes = set(env.all_hashes())
File "$spack/lib/spack/spack/environment.py", line 1550, in all_hashes
return list(set(s.dag_hash() for s in self.all_specs()))
File "$spack/lib/spack/spack/environment.py", line 1542, in all_specs
all_specs.update(self.specs_by_hash[h].traverse())
KeyError: '6bacc5jo5vnw4g7bfle2qqsmqgcvjcfg'I reproduced this Error again in an empty spack dir with an old env where I built only a few packages and then updated to HEAD. When environments exist, they causes trouble with PR #22845 (new json format): The other way around, when a new environment was created with today's spack, and then one switched back to yesterday's spack, one gets this for seemingly all spack commands (install, find, ...): Error: 'str' object has no attribute 'get' |
|
Thanks @bernhardkaindl! We (only just) found the same thing. I think we've narrowed this down and we are working on a fix. |
|
Just an update - my quickest reproducer so far: # cleanup (mostly?) everything I could find
spack env deactivate
spack env list | xargs --no-run-if-empty spack env remove -y
spack gc -y
spack uninstall -ay
git checkout edb1d7
spack clean -a
mv ~/.spack/ ~/.spack.old
git checkout edb1d7
spack find
# must be 0
spack env create oldenv && spack env activate oldenv && spack install bzip2 && spack find
git checkout 5fddd
spack -d find 2>&1|sed "s@$SPACK_ROOT@\$spack@;s/2021.*]/time]/"
==> [time] Imported find from built-in commands
==> [time] Imported find from built-in commands
==> [time] Reading config file $spack/var/spack/environments/oldenv2/spack.yaml
Traceback (most recent call last):
File "$spack/bin/spack", line 100, in <module>
sys.exit(spack.main.main())
File "$spack/lib/spack/spack/main.py", line 797, in main
return _invoke_command(command, parser, args, unknown)
File "$spack/lib/spack/spack/main.py", line 525, in _invoke_command
return_val = command(parser, args)
File "$spack/lib/spack/spack/cmd/find.py", line 215, in find
_find(parser, args)
File "$spack/lib/spack/spack/cmd/find.py", line 220, in _find
results = args.specs(**q_args)
File "$spack/lib/spack/spack/cmd/common/arguments.py", line 74, in _specs
kwargs['hashes'] = set(env.all_hashes())
File "$spack/lib/spack/spack/environment.py", line 1550, in all_hashes
return list(set(s.dag_hash() for s in self.all_specs()))
File "$spack/lib/spack/spack/environment.py", line 1542, in all_specs
all_specs.update(self.specs_by_hash[h].traverse())
KeyError: 'otca6ubpax7hocgh62j3pw44oxxanvil'
Kudos, all the best! |
PR #22845 was supposed to allow the Spack database to enter a "hybrid" state, since we maintained read-only backwards compatibility with the old spec format. This may fix #25867 with hash mismatch issues.