Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ours value does not exist when merging Key Sets #2464

Open
Chemin1 opened this Issue Mar 7, 2019 · 3 comments

Comments

2 participants
@Chemin1
Copy link
Contributor

Chemin1 commented Mar 7, 2019

When trying to figure out how the existing merge tool works, I stumbled upon behaviour that looks strange to me.

Steps to Reproduce the Problem

kdb set user/base a
#> Set string to "a"

kdb set user/thesame a
#> Set string to "a"

kdb set user/new b
#> Set string to "b"

kdb merge user/new user/thesame user/base user/result

kdb get user/result
#> Did not find key 'user/result'

kdb merge user/new user/thesame user/base user/result -i
#> Chose interactive merge
#>                                       
#> ======== CONFLICT ========
#> our operation: CONFLICT_DELETE
#> their operation: CONFLICT_SAME
#> 
#> ======== KEY VALUES ======== 
#> base value: a
#> ours: does not exist
#> theirs value: a
#> 
#> What do you want to do?
#> Take [o]urs, [t]eirs, [b]ase, [m]erge meta:     

Switching ours and theirs still has the problem that ours does not seem to have a key value. This then results in a instant conflict.

Expected Result

I expected the merge to recognize, that one version has b instead of a.

kdb get user/result
#> b

Actual Result

The merge failed, because the ours key set does not seem to have a value.

kdb get user/result
#> Did not find key 'user/result'

System Information

  • Elektra Version: master
  • Ubuntu 18.10

@Chemin1 Chemin1 added this to To do in Improve 3-way merge via automation Mar 7, 2019

@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Mar 9, 2019

Thank you for reporting this problem!

Maybe only the root key is not handled correctly? Or do you get the same conflict also with subkeys? (which have the same name and only differ in their value)

@Chemin1

This comment has been minimized.

Copy link
Contributor Author

Chemin1 commented Mar 10, 2019

Maybe only the root key is not handled correctly?

I think this is true.

After setting up

kdb set user/base a
kdb set user/base/l a
kdb set user/base/r a
kdb set user/staysSame a
kdb set user/staysSame/l a
kdb set user/staysSame/r a
kdb set user/new a
kdb set user/new/l b
kdb set user/new/r a

user/result is not created by the merge but the subkeys user/result/l and user/result/r are

kdb merge user/new user/staysSame user/base user/result
kdb ls user
#> user/base
#> user/base/l
#> user/base/r
#> user/new
#> user/new/l
#> user/new/r
#> user/result/l
#> user/result/r
#> user/staysSame
#> user/staysSame/l
#> user/staysSame/r

And after kdb rm -r user/result and now merging interactively the problem with the missing ours can be observed

kdb merge user/new user/staysSame user/base user/result -i
#> Chose interactive merge
#> merging key user/result
#>
#> ======== CONFLICT ========
#> our operation: CONFLICT_DELETE
#> their operation: CONFLICT_SAME
#>
#> ======== KEY VALUES ========
#> base value: a
#> ours: does not exist
#> theirs value: a
#>
#> What do you want to do?
#> Take [o]urs, [t]eirs, [b]ase, [m]erge meta: t
#> Choose their key
#>
#> Key merged...
#> merging key user/result/l
#>
#> ======== CONFLICT ========
#> our operation: CONFLICT_MODIFY
#> their operation: CONFLICT_SAME
#>
#> ======== KEY VALUES ========
#> base value: a
#> ours value: b
#> theirs value: a
#>
#> What do you want to do?
#> Take [o]urs, [t]eirs, [b]ase, [m]erge meta: t
#> Choose their key
#>
#> Key merged...
@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Mar 10, 2019

Good catch!

Please also add these shell recorder tests, I think they are a good demonstration how the merging works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.