pcal43 / fastback

Fast, incremental Minecraft world backups. Powered by Git.
https://pcal43.github.io/fastback/
GNU General Public License v2.0
127 stars 19 forks source link

"Cannot commit on a repo with state: MERGING" #267

Closed christenlanger closed 1 year ago

christenlanger commented 1 year ago

I'm currently encountering this issue on all of my server instances with regards to fast backup. This error message appears after issuing the "/backup local" command. A "/backup full" command does not return an error but still fails.


[11:29:22] [pool-3-thread-1/INFO]: Creating backup snapshot 2023-09-04_11-29-22
[11:29:24] [pool-3-thread-1/INFO]: Backup failed.  See log for details.
[11:29:24] [pool-3-thread-1/ERROR]: org.eclipse.jgit.api.errors.WrongRepositoryStateException: Cannot commit on a repo with state: MERGING
java.io.IOException: org.eclipse.jgit.api.errors.WrongRepositoryStateException: Cannot commit on a repo with state: MERGING
        at net.pcal.fastback.repo.CommitUtils.doCommitSnapshot(CommitUtils.java:85) ~[fastback-0.15.2+1.20.1.jar:?]
        at net.pcal.fastback.repo.RepoImpl.doCommitSnapshot(RepoImpl.java:121) ~[fastback-0.15.2+1.20.1.jar:?]
        at net.pcal.fastback.commands.LocalCommand.lambda$run$1(LocalCommand.java:67) ~[fastback-0.15.2+1.20.1.jar:?]
        at net.pcal.fastback.commands.Commands.lambda$gitOp$0(Commands.java:125) ~[fastback-0.15.2+1.20.1.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:831) ~[?:?]
Caused by: org.eclipse.jgit.api.errors.WrongRepositoryStateException: Cannot commit on a repo with state: MERGING
        at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:179) ~[org_eclipse_jgit_org_eclipse_jgi305301015-r-a4b8fa7941f24c83.jar:?]
        at net.pcal.fastback.repo.CommitUtils.jgit_commit(CommitUtils.java:199) ~[fastback-0.15.2+1.20.1.jar:?]
        at net.pcal.fastback.repo.CommitUtils.doCommitSnapshot(CommitUtils.java:82) ~[fastback-0.15.2+1.20.1.jar:?]
pcal43 commented 1 year ago

Mmm. The only way I can think that you could get into that state is if you interrupted an earlier push operation (i.e. a 'full'. Like killed the server or something. (?)

ATM, the only fix I can think of would be to go into the server directory with an run git merge --abort. Assuming you have that access and the server had git installed.

Alternatively, you could delete the myserver/.git directory and start over. But this will delete all of your local backups.

pcal43 commented 1 year ago

I think I'm going to disable the optimization that does a merge on push by default, FWIW. But that doesn't really help you right now.

christenlanger commented 1 year ago

It does seem like the error was the result of a crash. I have already reset the backups by starting over since it wasn't a big deal yet. I'll take note of the other solution (git command) since I do have access to the server. Thanks for your hard work.

pcal43 commented 1 year ago

Cool. FWIW, the latest version (0.15.3) disables the behavior that I suspect could leave you in a bad state if the server crashes. So you might want to upgrade.

pcal43 commented 1 year ago

...but also I highly recommend git/git-lfs if at all possible. You'll have a much better time with it.

https://pcal43.github.io/fastback/native-git.html