> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Branch locks

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[old doc.lw link]: https//doc.lucidworks.com/fusion/5.9/srm7fz

[localhost link]: http://localhost:3000/docs/5/fusion/operations/config-sync/locks

[mintlify link]: https://doc.lucidworks.com/docs/5/fusion/operations/config-sync/locks

ConfigSync uses locks to prevent concurrent access to the same repository from multiple ConfigSync instances.
The lock is a file named `.lock` in the root of the repository.
The lock file contains a UUID that is generated when the lock is acquired.

Each time on startup, ConfigSync checks if the lock file exists in the repository and the file contents match the UUID
in the `config-sync.branch-lock` Fusion configuration property (stored in ZooKeeper).

* If the lock file does not exist, ConfigSync creates it and writes the UUID to the file.
* If the Fusion configuration property is not set, ConfigSync sets the UUID in the `config-sync.branch-lock` property to the UUID in the lock file.
* If the lock file exists and the UUID in the file matches the UUID in the `config-sync.branch-lock` Fusion configuration, ConfigSync continues to work with the repository; otherwise it fails to start.

If you encounter an error like `App lock <SOME-UUID> doesn’t match git lock <SOME-OTHER-UUID>`, see **Delete the ConfigSync lock file**.

<LwTemplate />

<Accordion title="Delete the ConfigSync lock file">
  If you recreate a Fusion cluster, the lock file remains in the repository and prevents ConfigSync from starting.
  You might see the following error in the logs:

  ```log theme={"dark"}
  Caused by: java.lang.IllegalStateException: App lock <some-uuid> doesn't match git lock <some-other-uuid>
  at com.lucidworks.cloud.config.repo.AbstractSubscriberGitRepo.checkLock(AbstractSubscri
  ```

  To resolve this issue:

  1. Delete the lock file.

     The lock is a file named `.lock` in the root of the repository.
  2. Restart the `config-sync` service.
</Accordion>

## Learn more

<Accordion title="Lock ConfigSync to one commit">
  ConfigSync can lock the configuration to a specific commit.

  This means that ConfigSync :

  * Does not apply any commits that are newer than the locked commit
  * Does not update changes from the Fusion cluster to the Git repository

  You can set `locked-commit` using the API:

  ```http request theme={"dark"}
  PUT /api/properties/locked-commit
  Content-Type: text/plain

  COMMIT_SHA1
  ```

  Replace `COMMIT_SHA1` with the commit SHA1 to which you want to lock ConfigSync.

  <Note>If `locked-commit` precedes `latest-synced-commit`, ConfigSync reverts all changes to the `locked-commit` and sets `latest-synced-commit` to `locked-commit`.</Note>
</Accordion>
