git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: fact-import: failed to apply delta

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 11, 2009, 18:15 UTC
Message-ID
<20090211181530.GO30949@spearce.org>
In-Reply-To
<alpine.LNX.1.00.0902111247300.19665@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> wrote:
Show 7 quoted lines
> 
> I think free_pack_by_name() also needs to drop the entries that are from 
> the freed pack, to avoid having repack able to get the same problem, 
> although I wouldn't be surprised if repack happened to never allocate a 
> new pack after freeing an old pack with stale delta cache entries, or 
> never used the delta cache after that, simply because it does one thing 
> and then exits.
Oy.  I missed that we added this function.  Patch follows.

--8<-- Clear the delta base cache if a pack is rebuilt

There is some risk that re-opening a regenerated pack file with different offsets could leave stale entries within the delta base cache that could be matched up against other objects using the same "struct packed_git*" and pack offset.

Throwing away the entire delta base cache in this case is safer, as we don't have to worry about a recycled "struct packed_git*" matching to the wrong base object, resulting in delta apply errors while unpacking an object.

Suggested-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 sha1_file.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 7459a9c..5b6e0f6 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -689,6 +689,7 @@ void free_pack_by_name(const char *pack_name)
 	while (*pp) {
 		p = *pp;
 		if (strcmp(pack_name, p->pack_name) == 0) {
+			clear_delta_base_cache();
 			close_pack_windows(p);
 			if (p->pack_fd != -1)
 				close(p->pack_fd);
-- 
1.6.2.rc0.186.g417c
Previous: Daniel BarkalowNext: Junio C Hamano
Message 22 of 24 in “fact-import: failed to apply delta”
  1. Daniel BarkalowFeb 10, 2009
  2. Johannes SchindelinFeb 10, 2009
  3. Shawn O. PearceFeb 10, 2009
  4. Daniel BarkalowFeb 10, 2009
  5. Shawn O. PearceFeb 10, 2009
  6. Daniel BarkalowFeb 10, 2009
  7. Shawn O. PearceFeb 10, 2009
  8. Daniel BarkalowFeb 10, 2009
  9. Shawn O. PearceFeb 10, 2009
  10. Daniel BarkalowFeb 10, 2009
  11. Shawn O. PearceFeb 10, 2009
  12. Daniel BarkalowFeb 10, 2009
  13. Shawn O. PearceFeb 10, 2009
  14. Daniel BarkalowFeb 10, 2009
  15. Junio C HamanoFeb 10, 2009
  16. Junio C HamanoFeb 10, 2009
  17. Shawn O. PearceFeb 10, 2009
  18. Junio C HamanoFeb 10, 2009
  19. Shawn O. PearceFeb 10, 2009
  20. Junio C HamanoFeb 10, 2009
  21. Daniel BarkalowFeb 11, 2009
  22. Shawn O. PearceFeb 11, 2009
  23. Junio C HamanoFeb 11, 2009
  24. Daniel BarkalowFeb 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.