diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-09 17:42:44 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-11 11:00:06 +0100 |
commit | 02bc1b422b82b7972686307acb69640a50553fb1 (patch) | |
tree | 68ee0ca81d4e2416b98f83d3af80762dc4ed8dd6 /bitbake | |
parent | c7c47bb0d2c2263c4668c4269c669b282d6168d9 (diff) | |
download | poky-02bc1b422b82b7972686307acb69640a50553fb1.tar.gz |
bitbake: hashserv: Improve behaviour for better determinism/sstate reuse
We have a choice of policy with hashequivalence - whether to reduce
sstate duplication in the sstate feed to a minimum or have maximal
sstate reuse from the user's perspective.
The challenge is that non-matching outhashes are generated due to
determinism issues, or due to differences in host gcc version,
architecture and so on and the question is how to reconcile then.
The approach before this patch is that any new match is added and
matches can update. This has the side effect that a queried value
from the server can change due to the replacement and you may not
always get the same value from the server. With the client side
caching bitbake has, this can be suboptimal and when using the
autobuilder sstate feed, it results in poor artefact reuse.
This patch switches to the other possible behaviour, once a hash is
assigned, it doesn't change. This means some sstate artefacts may be
duplicated but dependency chains aren't invalidated which I suspect
may give better overall performance.
Update the tests to match the new behaviour.
(Bitbake rev: 20d6ac753efa364349100cdc863e5eabec8e5b78)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/hashserv/server.py | 2 | ||||
-rw-r--r-- | bitbake/lib/hashserv/tests.py | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py index ef8227d430..d40a2ab8f8 100644 --- a/bitbake/lib/hashserv/server.py +++ b/bitbake/lib/hashserv/server.py | |||
@@ -413,7 +413,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): | |||
413 | # A matching output hash was found. Set our taskhash to the | 413 | # A matching output hash was found. Set our taskhash to the |
414 | # same unihash since they are equivalent | 414 | # same unihash since they are equivalent |
415 | unihash = row['unihash'] | 415 | unihash = row['unihash'] |
416 | resolve = Resolve.REPLACE | 416 | resolve = Resolve.IGNORE |
417 | else: | 417 | else: |
418 | # No matching output hash was found. This is probably the | 418 | # No matching output hash was found. This is probably the |
419 | # first outhash to be added. | 419 | # first outhash to be added. |
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index efaf3bdf42..f6b85aed85 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
@@ -392,15 +392,14 @@ class HashEquivalenceCommonTests(object): | |||
392 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash3, unihash2) | 392 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash3, unihash2) |
393 | self.assertEqual(result['unihash'], unihash2) | 393 | self.assertEqual(result['unihash'], unihash2) |
394 | 394 | ||
395 | # Report Task 2. This is equivalent to Task 1, so will pick up the | 395 | # Report Task 2. This is equivalent to Task 1 but there is already a mapping for |
396 | # unihash from that task | 396 | # taskhash2 so it will report unihash2 |
397 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash1, unihash2) | 397 | result = self.client.report_unihash(taskhash2, self.METHOD, outhash1, unihash2) |
398 | self.assertEqual(result['unihash'], unihash1) | 398 | self.assertEqual(result['unihash'], unihash2) |
399 | 399 | ||
400 | # The originally reported unihash for Task 3 should have been updated | 400 | # The originally reported unihash for Task 3 should be unchanged even if it |
401 | # with the second report to use the new unihash from Task 1 (because is | 401 | # shares a taskhash with Task 2 |
402 | # shares a taskhash with Task 2) | 402 | self.assertClientGetHash(self.client, taskhash2, unihash2) |
403 | self.assertClientGetHash(self.client, taskhash2, unihash1) | ||
404 | 403 | ||
405 | class TestHashEquivalenceUnixServer(HashEquivalenceTestSetup, HashEquivalenceCommonTests, unittest.TestCase): | 404 | class TestHashEquivalenceUnixServer(HashEquivalenceTestSetup, HashEquivalenceCommonTests, unittest.TestCase): |
406 | def get_server_addr(self, server_idx): | 405 | def get_server_addr(self, server_idx): |