line / centraldogma

Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2
https://line.github.io/centraldogma/
Apache License 2.0
588 stars 116 forks source link

Mirrored repository doesn't overwrite changes pushed by users during mirroring #920

Open minwoox opened 4 months ago

minwoox commented 4 months ago

When a commit is pushed to a mirrored repository, the expectation is that any changes made by users are overwritten during the next mirroring process. However, this is not happening as expected. The root cause lies in Central Dogma's limited check, which solely examines the stored local revision—unchanged by the user's commit—against the remote head. https://github.com/line/centraldogma/blob/03540a1aee5ac7ee24c4b78ae04336706190ed74/server-mirror-git/src/main/java/com/linecorp/centraldogma/server/internal/mirror/AbstractGitMirror.java#L356

thachlp commented 4 months ago

Hello @minwoox, I would like to take this issue, but still confused. Could you give me an example of what is expected and the current status, so I can try to reproduce it?

ikhoon commented 4 months ago

Say, there is Git repository A mirrored to Central Dogma repository B. The content of A and B should be the same except for mirror_state.json. If some content is pushed to B repository, it should be overwritten by the content of A.

Currently, the changes pushed to B do not update mirror_state.json so the head revision comparison can't detect new commits in B.

We may solve the problem by storing the latest revision of B mirrored to mirror_state.json.

thachlp commented 4 months ago

Thanks @ikhoon, I will try