Jonathan Tan <jonathantanmy@xxxxxxxxxx> writes: > But I guess clearing a linked list and hashmap can be a bit cumbersome > in C, so maybe it would be reasonable to assume that this behavior > would not change. I think the original reason why we did not clear was because we never knew (and we do not know) what is still in use. Can anybody explain why it would be a safe thing to do to rebuild the alt-odb list from scratch? Surely we can have a big central lock to do the "list manipulation" part safely, but is it safe to access the objects we obtained from one of the odb's that no longer is listed on the alt-odb list, for example? The code that this patch touches clears the loose object cache after updating the odb list, so loose object cache of any odb that goes away will not be cleared here, which means that the code that reconstruts alt-odb list would need to clear the loose object cache automatically? What should we do to packfiles that are mmaped from these alt-odbs that goes away? Etc. etc. > In any case, maybe a comment should be added to prepare_alt_odb() > saying that if an update of the alternates is needed, one can do > so by clearing loaded_alternates and re- invoking > prepare_alt_odb() (at least so that a developer changing > prepare_alt_odb() can see the comment and understand what > behaviors this function needs to preserve). Sounds good. Thanks.