nessie icon indicating copy to clipboard operation
nessie copied to clipboard

While merging a forked branch into the main branch, getting error "No common ancestor"

Open mthirani2021 opened this issue 1 year ago • 7 comments

What happened: While trying to merge the child branch (dev) into main branch, which is forked when there is no commit in main branch, did some commits in main branch and then did some commits in dev branch. After doing certain commits (simple commit like creating a table in each of the branch - different table name), trying to merge the dev into main branch, got the below error:

VALIDATION ERROR: Merge branch branch72511 into branch main failed due to missing branch on source dataPlane_Test.

Caused By (org.projectnessie.error.NessieReferenceNotFoundException) No common ancestor in parents of a9b8305ac6e70648cbe2e63d3992aa08ebce07cede4706bb29cd474d24a8cb36 and 5c355e854311687aa40a8399b8205ae644498480d7cd098d2911cdd743ac71a6
    org.projectnessie.error.ErrorCode.lambda$asException$1():61
    java.util.Optional.map():265
    org.projectnessie.error.ErrorCode.asException():61
    org.projectnessie.client.rest.ResponseCheckFilter.checkResponse():56
    org.projectnessie.client.rest.NessieHttpResponseFilter.filter():34
    org.projectnessie.client.http.impl.jdk11.JavaRequest.lambda$executeRequest$1():121
    java.util.Collections$SingletonList.forEach():4856
    org.projectnessie.client.http.impl.jdk11.JavaRequest.executeRequest():121
    org.projectnessie.client.http.HttpRequest.post():85

What you expected to happen: Merge should be done successfully with no errors

How to reproduce it (as minimally and precisely as possible): Already described in statement

Details:

  • Nessie server type (docker/built from source) and version: 0.53.1
  • Client type (Ex: UI/Spark/pynessie ...) and version:

mthirani2021 avatar Mar 30 '23 20:03 mthirani2021

@dimas-b FYI

mthirani2021 avatar Mar 30 '23 20:03 mthirani2021

Thanks for bringing this matter up, @mthirani2021 !

The error is technically correct, because dev was created when main did not have any commits, so the two branches, indeed, do not have a common commit.

Nessie started enforcing this kind of validation only recently, when the "new data model" was introduced. Note: recent servers run the new model by default.

We'll see how user experience can be improved.

dimas-b avatar Mar 30 '23 21:03 dimas-b

@dimas-b Even there is no common commit, dev branch should be merged to main branch with no error. That's the expectation I think.

mthirani2021 avatar Mar 31 '23 00:03 mthirani2021

For reference: git does not allow merging unrelated branches by default... e.g.

$ git merge dev1
fatal: refusing to merge unrelated histories

dimas-b avatar Mar 31 '23 03:03 dimas-b

Those are related branches. I forked the branch from the main branch (I did at very first time after Nessie spins up). But yes, common commit is not there as there were no commits made at very beginning. But that does not sounds that those are unrelated to me?

mthirani2021 avatar Mar 31 '23 11:03 mthirani2021

Re: "related" - please check the Nessie commit log. Branches are "related" only when they have at least one common commit in their respective commit logs.

dimas-b avatar Mar 31 '23 13:03 dimas-b

I propose adding an option similar to git's --allow-unrelated-histories to the merge parameters in REST API v2.

dimas-b avatar Mar 31 '23 22:03 dimas-b