strange failure with LCA merge

Bug #232113 reported by Elliot Murphy
4
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
High
Unassigned

Bug Description

reported to me via email by Guilhem, who was trying to merge mysql-maria into mysql-6.0

So I did this in 6.0:
 bzr merge ..\mysql-maria
 bzr conflicts #says 143 conflicts
 bzr remerge --lca
The latter command printed:

 Warning: criss-cross merge encountered. See bzr help criss-cross.
 Exception exceptions.AttributeError: "'WorkingTree4' object has no attribute 'repository'" in <generator object at 0x04E9B0F8> ignored
 bzr: ERROR: The file id "sp1f-genericmsvc.h-20080110122110-bnn2j7c6jhbiw4scjarkxgxk2w5xoh22" is not present in the tree <Inventory object at 4d97cd0, contents={'sp1f-have_log_bin.require-20070514123848-glb7sh4lf7vnfqt4l77gwhguyc2k2cw4': InventoryFile('sp1f-have_log_bin.require-20070514123848-glb7sh4lf7vnfqt4l77gwhguyc2k2cw4', u'have_log_bin.require', parent_id='sp1d-mysqltest_r-x5knzvhqj2dl73uerge4e24flx5aupsc', sha1='566d3ad4d03fb568d20dd5fde481e10e0fb38018', len=31), 'sp1f-clientcert.der-20060503111055-belh4pjgfofrfv4ss6krjapskeho2uk6': InventoryFile('sp1f-clientcert.der-20060503111055-belh4pjgfofrfv4ss6krjapskeho2uk6', u'client-cert.der', parent_id='sp1d-extra_yassl_certs-qlzltwwnxf7xxgjup7s37vagnqovtril', sha1='04927567dc3010224979a839c16261dbbc40347e', len=699), 'sp1f-be_default.h
<cut the end of the error message, which is a dump of the above
python structure and takes 2MB>

After that,
 bzr conflicts
printed nothing (and there were no BASE/OTHER/THIS files anymore in
the tree). Some changes made into the Maria tree and which should have
been merged by the merge, were lost. For example some changes in
sql/sql_parse.cc,mysqld.cc,sql_select.cc: all 3 files were their 6.0
version, no Maria changes. My impression is that for all files which
had conflicts in "bzr merge", "bzr remerge --lca" retained their 6.0
version and no single Maria change.

Looks like a bug.
(John was able to repro this)

Elliot Murphy (statik)
Changed in bzr:
importance: Undecided → High
Revision history for this message
John A Meinel (jameinel) wrote :

Any chance you could try to reproduce this with bzr 1.6?

Changed in bzr:
status: New → Incomplete
Revision history for this message
John A Meinel (jameinel) wrote :

So... 'remerge' first resolves the tree as clean, before it then re-applies a merge. So when remerge had an exception in the middle, you were left in a semi-resolved state.

The second bit...

It sounds like the "--format=lca" merge code is failing because a file is missing in one of the ancestors. If we had a traceback it would be easier to localize what code is expecting it to exist when it doesn't.

Poking my head through the code, the function I would suspect on the "WT has not attribute repository" is this one:

    def _iter_parent_trees(self):
        """Iterate through parent trees, defaulting to Tree.revision_tree."""
        for revision_id in self.get_parent_ids():
            try:
                yield self.revision_tree(revision_id)
            except errors.NoSuchRevisionInTree:
                yield self.repository.revision_tree(revision_id)

It is defined on "Tree._iter_parent_trees()" however it should only be defined that way for RevisionTree, as WT and Mutable tree only have self.branch.repository not a direct self.repository.

And "_iter_parent_trees" is only being called as part of Tree._get_file_revision(), which is called by "_get_plan_merge_data", which is called by both plan_file_merge and plan_file_lca_merge.

My first guess is that we don't typically run into this, because for the parent_ids of a WorkingTreeFormat4 (dirstate+) we always cache the parents, so "self.revision_tree()" is typically not raising an error.

Oh, I also just noticed that _get_file_revision() seems to have an explicit check for "getattr(self, '_repository', None) is not None" before it calls _iter_parent_trees. So it shouldn't actually call it. Without an actual traceback, I'm sort of poking around blind.

Revision history for this message
John A Meinel (jameinel) wrote :

Scratch the last comment. The code actually uses the getattr() check to decide that it *does* need to use _iter_parent_trees. Which means that the try/catch is always wrong.

I'll also note that it is doing:

  tree.inventory[file_id].revision for tree in self._iter_parent_trees()

which means that if the file is deleted in one of the merge parents, it will raise the NoSuchId error. I haven't been able to put together a simple test case yet, but it looks like I've at least isolated the portion of code.

Revision history for this message
GuilhemBichot (guilhem-bichot) wrote :

Hi. This shouldn't be marked expired or incomplete: I'm just still waiting for this bug to be fixed.
Here's how to repeat:
- get mysql-6.0 from launchpad at revision sp1r-rafal@quant.(none)-20080415091413-23308
- get mysql-maria from launchpad at revision <email address hidden>
cd mysql-6.0
bzr merge ../mysql-maria
bzr remerge --lca
then you should get the error:
bzr: ERROR: The file id "sp1f-genericmsvc.h-20080110122110-bnn2j7c6jhbiw4scjarkxgxk2w5xoh22" is not present in the tree <Inventory object at bc17e4c, etc

John A Meinel (jameinel)
Changed in bzr:
status: Incomplete → Triaged
Vincent Ladeuil (vila)
Changed in bzr:
assignee: nobody → vila
Revision history for this message
Vincent Ladeuil (vila) wrote :
Download full text (5.8 KiB)

I can reproduce this bug with a recent bzr (which generate only 114 conflicts instead of 143 thanks
to some other bug fixes :-/), traceback:
BZR_PDB=1 bzr remerge --lca
Warning: criss-cross merge encountered. See bzr help criss-cross.
bzr: ERROR: The file id "sp1f-genericmsvc.h-20080110122110-bnn2j7c6jhbiw4scjarkxgxk2w5xoh22" is not present in the tree <Inventory object at e21abd0, contents="{'sp1f-have_log_bin.require-20070514123848-glb7sh4lf7vnfqt4l77gwhguyc2k2cw4': InventoryFile('sp1f-have_log_bin.require-20070514123848-glb7sh4lf7vnfqt4l77gwhguyc2k2cw4', u'have_log_bin.require', parent_id='sp1d-mysqltest_r-x5knzvhqj2dl73uerge4e24flx5aupsc', sha1='566d3ad4d03fb568d20dd5fde481e10e0fb38018', len=31, <email address hidden>), 'sp1f-clientcert.der-20060503111055-belh4pjgfofrfv4ss6krjapskeho2uk6': InventoryFile('sp1f-clientcert.der-20060503111055-belh4pjgfofrfv4ss6krjapskeho2uk6', u'client-cert.der', parent_id='sp1d-extra_yassl_certs-qlzltwwnxf7xxgjup7s37vagnqovtril', sha1='04927567dc3010224979a839c16261dbbc40347e', len=699, revision=sp1r-msvensson@shellback.(none)-20060503112051-37118), 'sp1f-be_default.h-20071106183210-mnvzyvwpym77uxcwsvgfb3y5bnvorew2': InventoryFile('sp1f-be_default.h-20071106183210-mnvzyvwpym77uxcwsvgfb3y5bnvorew2', u'be_default.h', parent_id='sp1d-sql_backup-kssn2h2a5l2cqskksbk7dvts6pbym5j6', sha1='cda092bd4d88c2b8d5bb5b0aa06db849b022790a', len=8950, revision=sp1r-cbell/Chuck@mysql_cab_desk.-20071203202832-61394), 'sp1f-rpl_ndb_innodb_trans-20060905145203-mopikf2kqymact2krb45jf2j3ss7kegk': InventoryFile('sp1f-rpl_ndb_innodb_trans-20060905145203-mopikf2kqymact2krb45jf2j3ss7kegk', u'rpl_ndb_innodb_trans.test', parent_id='sp1d-mysqltest_suite_rpl_ndb_t-5daypjzb3gdodf7j5dgrrwfq2wbjs3jh', sha1='e5a6462ce1f5e59b55e0673c30fab9c1a5bdd97b', len=1521, <email address hidden>), 'sp1f-myisam_tb3.inc-20070206175435-46ozmsyoeusi6vqkhzhowmiyzh7iqxd5': InventoryFile('sp1f-myisam_tb3.inc-20070206175435-46ozmsyoeusi6vqkhzhowmiyzh7iqxd5', u'myisam_tb3.inc', parent_id='sp1d-mysqltest_suite_funcs_1_include-lku56dwgrx62ghafw3tek3oa5qnapu7d', sha1='cbba7f7455f9bdd558902bcca3dc962ea471976f', len=2267, revision=sp1r-joerg@debian.(none)-20070727113232-19339), 'sp1f-falcon_bug_22179.tes-20070920154325-xkh5yfl7opoxsxhc7euxjeqli2gh6yn5': InventoryFile('sp1f-falcon_bug_22179.tes-20070920154325-xkh5yfl7opoxsxhc7euxjeqli2gh6yn5', u'fa...}">.
**** entering debugger
 /home/vila/src/bzr/trunk/bzrlib/inventory.py(1264)__getitem__()
-> raise errors.NoSuchId(self, file_id)
(Pdb) bt
  /home/vila/src/bzr/trunk/bzrlib/commands.py(835)exception_to_return_code()
-> return the_callable(*args, **kwargs)
  /home/vila/src/bzr/trunk/bzrlib/commands.py(1039)run_bzr()
-> ret = run(*run_argv)
  /home/vila/src/bzr/trunk/bzrlib/commands.py(643)run_argv_aliases()
-> return self.run_direct(**all_cmd_args)
  /home/vila/src/bzr/trunk/bzrlib/commands.py(647)run_direct()
-> return self._operation.run_simple(*args, **kwargs)
  /home/vila/src/bzr/trunk/bzrlib/cleanup.py(122)run_simple()
-> self.cleanups, self.func, *args, **kwargs)
  /home/vila/src/bzr/trunk/bzrlib/cleanup.py(156)_do_with...

Read more...

Changed in bzr:
status: Triaged → Confirmed
tags: added: conflicts
Changed in bzr:
assignee: Vincent Ladeuil (vila) → nobody
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.