Reindex the project when zoekt sha unavailable
This MR fixes a potential problem when you force push new revision so that the revision that Zoekt has indexed is no longer accessible in Gitaly.
How to test
This is a bit tricky to test, I've used 2 scripts:
Click to expand
❯ cat tmp/index-a.sh
#!/bin/bash
curl -XPOST -d '{"GitalyConnectionInfo": {"Address": "unix:/Users/dgruzd/projects/gdk-ee/praefect.socket", "Storage": "default", "Path": "@hashed/94/00/9400f1b21cb527d7fa3d3eabba93557a18ebe7a2ca4e471cfe5e4c5b4ca7f767.git"}, "RepoId":19, "FileSizeLimit": 2097152, "Timeout": "1h"}' -H 'Content-Type: application/json' http://127.0.0.1:6080/indexer/index
❯ cat tmp/index-c.sh
#!/bin/bash
curl -XPOST -d '{"GitalyConnectionInfo": {"Address": "unix:/Users/dgruzd/projects/gdk-ee/praefect.socket", "Storage": "default", "Path": "@hashed/6f/4b/6f4b6612125fb3a0daecd2799dfd6c9c299424fd920f9b308110a2c1fbd8f443.git"}, "RepoId":19, "FileSizeLimit": 2097152, "Timeout": "1h"}' -H 'Content-Type: application/json' http://127.0.0.1:6080/indexer/index
They index 2 different projects to the same repoID simulating this case.
On main:
❯ ./tmp/index-c.sh
{"Success":true}
❯ ./tmp/index-a.sh
{"Success":false,"Error":"\u003cnil\u003e.GetRawChanges, rpc error: code = InvalidArgument desc = invalid 'from' revision: \"91271aba4a3b065dd1713c0485f1b774aa169b2e\""}
On 6-reindex-when-sha-unavailable
:
❯ ./tmp/index-c.sh
{"Success":true}
❯ ./tmp/index-a.sh
{"Success":true}
Closes #6 (closed)
Edited by Dmitry Gruzd