summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-12 14:20:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-12 14:21:35 +0000
commit39d45ef825694705daf6d7ab4ab3066b1b8e3aa2 (patch)
tree943715fc53fea03435336fd6927891fb65d341f8
parentec506ce22d7890e3c4e585beb30f9a50ffb88a6d (diff)
downloadpoky-39d45ef825694705daf6d7ab4ab3066b1b8e3aa2.tar.gz
bitbake: Revert "siggen: Fix hashequiv performance issues"
This reverts commit c4b8440f730c33eaf9f818b856ae81b2f1017fec. The logic in this change is flawed and needs to be re-thought. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/siggen.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index 517ec7b61a..dbf510238f 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -121,7 +121,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
121 else: 121 else:
122 self.checksum_cache = None 122 self.checksum_cache = None
123 123
124 self.unihash_cache = bb.cache.SimpleCache("2") 124 self.unihash_cache = bb.cache.SimpleCache("1")
125 self.unitaskhashes = self.unihash_cache.init_cache(data, "bb_unihashes.dat", {}) 125 self.unitaskhashes = self.unihash_cache.init_cache(data, "bb_unihashes.dat", {})
126 126
127 def init_rundepcheck(self, data): 127 def init_rundepcheck(self, data):
@@ -216,13 +216,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
216 continue 216 continue
217 if dep not in self.taskhash: 217 if dep not in self.taskhash:
218 bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?" % dep) 218 bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?" % dep)
219 # We bypass the fuction and go straight to the cache here 219 data = data + self.get_unihash(dep)
220 # as this was a performance bottleneck otherwise
221 if self.taskhash[dep] in self.unitaskhashes:
222 unihash = self.unitaskhashes[self.taskhash[dep]]
223 else:
224 unihash = self.get_unihash(dep)
225 data = data + unihash
226 self.runtaskdeps[tid].append(dep) 220 self.runtaskdeps[tid].append(dep)
227 221
228 if task in dataCache.file_checksums[fn]: 222 if task in dataCache.file_checksums[fn]:
@@ -393,19 +387,24 @@ class SignatureGeneratorUniHashMixIn(object):
393 self._client = hashserv.create_client(self.server) 387 self._client = hashserv.create_client(self.server)
394 return self._client 388 return self._client
395 389
390 def __get_task_unihash_key(self, tid):
391 # TODO: The key only *needs* to be the taskhash, the tid is just
392 # convenient
393 return '%s:%s' % (tid.rsplit("/", 1)[1], self.taskhash[tid])
394
396 def get_stampfile_hash(self, tid): 395 def get_stampfile_hash(self, tid):
397 if tid in self.taskhash: 396 if tid in self.taskhash:
398 # If a unique hash is reported, use it as the stampfile hash. This 397 # If a unique hash is reported, use it as the stampfile hash. This
399 # ensures that if a task won't be re-run if the taskhash changes, 398 # ensures that if a task won't be re-run if the taskhash changes,
400 # but it would result in the same output hash 399 # but it would result in the same output hash
401 unihash = self.unitaskhashes.get(self.taskhash[tid], None) 400 unihash = self.unitaskhashes.get(self.__get_task_unihash_key(tid), None)
402 if unihash is not None: 401 if unihash is not None:
403 return unihash 402 return unihash
404 403
405 return super().get_stampfile_hash(tid) 404 return super().get_stampfile_hash(tid)
406 405
407 def set_unihash(self, tid, unihash): 406 def set_unihash(self, tid, unihash):
408 self.unitaskhashes[self.taskhash[tid]] = unihash 407 self.unitaskhashes[self.__get_task_unihash_key(tid)] = unihash
409 408
410 def get_unihash(self, tid): 409 def get_unihash(self, tid):
411 taskhash = self.taskhash[tid] 410 taskhash = self.taskhash[tid]
@@ -414,9 +413,11 @@ class SignatureGeneratorUniHashMixIn(object):
414 if self.setscenetasks and tid not in self.setscenetasks: 413 if self.setscenetasks and tid not in self.setscenetasks:
415 return taskhash 414 return taskhash
416 415
416 key = self.__get_task_unihash_key(tid)
417
417 # TODO: This cache can grow unbounded. It probably only needs to keep 418 # TODO: This cache can grow unbounded. It probably only needs to keep
418 # for each task 419 # for each task
419 unihash = self.unitaskhashes.get(taskhash, None) 420 unihash = self.unitaskhashes.get(key, None)
420 if unihash is not None: 421 if unihash is not None:
421 return unihash 422 return unihash
422 423
@@ -448,7 +449,7 @@ class SignatureGeneratorUniHashMixIn(object):
448 except hashserv.client.HashConnectionError as e: 449 except hashserv.client.HashConnectionError as e:
449 bb.warn('Error contacting Hash Equivalence Server %s: %s' % (self.server, str(e))) 450 bb.warn('Error contacting Hash Equivalence Server %s: %s' % (self.server, str(e)))
450 451
451 self.unitaskhashes[taskhash] = unihash 452 self.unitaskhashes[key] = unihash
452 return unihash 453 return unihash
453 454
454 def report_unihash(self, path, task, d): 455 def report_unihash(self, path, task, d):
@@ -466,7 +467,7 @@ class SignatureGeneratorUniHashMixIn(object):
466 return 467 return
467 468
468 # Sanity checks 469 # Sanity checks
469 cache_unihash = self.unitaskhashes.get(taskhash, None) 470 cache_unihash = self.unitaskhashes.get(key, None)
470 if cache_unihash is None: 471 if cache_unihash is None:
471 bb.fatal('%s not in unihash cache. Please report this error' % key) 472 bb.fatal('%s not in unihash cache. Please report this error' % key)
472 473