According to the Shop by Brand code base, the extension checks the root categories on the Magento instance and makes them anchored. Due to some instance-specific factors, the process may fail resulting in the following error while running the bin setup:upgrade command:
Unable to apply data patch Amasty\ShopbyBase\Setup\Patch\Data\AnchorRootCategories for module Amasty_ShopbyBase. Original exception message: Rolled back transaction has not been completed correctly 2
If you face the issue in your environment, the following steps may help you to eliminate the problem.
Step 1. Comment out the content of the 'try' block in the Amasty\ShopbyBase\Setup\Patch\Data\AnchorRootCategories
file:
Step 2. After that, proceed to the Catalog → Categories and make sure the Root Category has Anchor parameter enabled.
Step 3. Run the bin setup:upgrade command, it should complete smoothly this time.
Step 4. Once done, make sure to remove the comments from the lines you edited during Step 1.
Should the issue persist in your environment, please, feel free to contact our support team for further investigation.