On 8/18/2020 7:51 PM, Jonathan Tan wrote: >> By using 'git commit-graph verify --shallow' we can ensure that >> the file we just wrote is valid. This is an extra safety precaution >> that is faster than our 'write' subcommand. In the rare situation >> that the newest layer of the commit-graph is corrupt, we can "fix" >> the corruption by deleting the commit-graph-chain file and rewrite >> the full commit-graph as a new one-layer commit graph. This does >> not completely prevent _that_ file from being corrupt, but it does >> recompute the commit-graph by parsing commits from the object >> database. In our use of this step in Scalar and VFS for Git, we >> have only seen this issue arise because our microsoft/git fork >> reverted 43d3561 ("commit-graph write: don't die if the existing >> graph is corrupt" 2019-03-25) for a while to keep commit-graph >> writes very fast. We dropped the revert when updating to v2.23.0. >> The verify still has potential for catching corrupt data across >> the layer boundary: if the new file has commit X with parent Y >> in an old file but the commit ID for Y in the old file had a >> bitswap, then we will notice that in the 'verify' command. > > I'm concerned about having this extra precaution, because it is never > tested (neither here or in a future patch). When you saw this issue > arise, was there ever an instance in which a valid set of commit graph > files turned invalid after this maintenance step? (It seems from your > description that the set was invalid to begin with, so the maintenance > step did not fix it but also did not make it worse. And it does not make > it worse, that seems not too bad to me.) The cases we've seen this happen were root-caused to hardware problems (disk or RAM), and the invalid data was present immediately after the "git commit-graph write" command. Since implementing the "verify" step after each write, we have not had any user reports of problems with these files. Are you suggesting one of these options? 1. Remove this validation and rewrite entirely. 2. Remove the rewrite and only delete the known-bad data. 3. Insert a way to cause the verify to return failure mid-process, so that this function can be covered by tests. Thanks, -Stolee