Bug 14146 - mipsel/ppc64el:Failure during prepare_write): Corrupt database -> Operations error
Summary: mipsel/ppc64el:Failure during prepare_write): Corrupt database -> Operations ...
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: AD: LDB/DSDB/SAMDB (show other bugs)
Version: 4.11.0
Hardware: Other Linux
: P5 major (vote)
Target Milestone: ---
Assignee: Andrew Bartlett
QA Contact: Samba QA Contact
URL: https://buildd.debian.org/status/fetc...
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-28 09:10 UTC by Mathieu Parent
Modified: 2020-05-07 14:53 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Parent 2019-09-28 09:10:21 UTC
During the build of ldb 2.0.7 in Debian mipsel, ppc64el, ia64, powerpc and ppc64 (riscv64 fails for another reason, and can be ignored),  [1], the tests fail with:

Could not open environment for bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v1 to v2 format (first record OU=GUIDPFTEST10,DC=SAMBA,DC=ORG)
Could not open environment for bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v2 to v1 format (first record OU=GUIDPFTEST9,DC=SAMBA,DC=ORG)
Could not open environment for bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v1 to v2 format (first record OU=GUIDPFTEST10,DC=SAMBA,DC=ORG)
ltdb: tdb(bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb): tdb_transaction_setup_recovery: transaction data over new region boundary

ltdb: tdb(bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb): tdb_transaction_prepare_commit: failed to setup recovery data

Failure during prepare_write): Corrupt database -> Operations error
ltdb: tdb(bin/st/tmp/tmp0n0e2arg/guidindexpackv1.ldb): tdb_transaction_cancel: no transaction

ECould not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v2 to v1 format (first record OU=GUIDPFTEST0,DC=SAMBA,DC=ORG)
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v1 to v2 format (first record OU=GUIDPFTEST2,DC=SAMBA,DC=ORG)
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v2 to v1 format (first record OU=GUIDPFTEST1,DC=SAMBA,DC=ORG)
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v1 to v2 format (first record OU=GUIDPFTEST4,DC=SAMBA,DC=ORG)
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Repacking database from v2 to v1 format (first record OU=GUIDPFTEST5,DC=SAMBA,DC=ORG)
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
Could not open environment for bin/st/tmp/tmpvbu_3y3p/guidpackformattest.ldb: (-30793)  MDB_INVALID: File is not an LMDB file
.
======================================================================
ERROR: test_guid_indexed_v1_db (__main__.GUIDIndexAndPackFormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/python/repack.py", line 197, in test_guid_indexed_v1_db
    self.toggle_guidindex_check_pack()
  File "tests/python/repack.py", line 123, in toggle_guidindex_check_pack
    self.set_guid_indexing(enable=enable)
  File "tests/python/repack.py", line 76, in set_guid_indexing
    self.l.modify(modmsg)
_ldb.LdbError: (1, 'Failure during prepare_write): Corrupt database -> Operations error')

https://buildd.debian.org/status/fetch.php?pkg=ldb&arch=mipsel&ver=2%3A2.0.7-1&stamp=1569296738&raw=0
https://buildd.debian.org/status/fetch.php?pkg=ldb&arch=ppc64el&ver=2%3A2.0.7-1&stamp=1569273968&raw=0



[1]: https://buildd.debian.org/status/package.php?p=ldb&suite=experimental
Comment 1 Mathieu Parent 2019-09-28 09:24:14 UTC
It seems that lib/ldb/tests/guidindexpackv1.ldb is arch-specific.

What to do?
- Having different ldb depending on the arch (or endianness, or something else)?
- Building the ldb with a python script?
- Ensure that the ldb format is arch-independent (harder)?
Comment 2 Mathieu Parent 2019-10-01 20:45:36 UTC
I've tested:

ldbsearch -d0 -H tests/guidindexpackv1.ldb '(|(objectClass=*)(distinguishedName=*))' > debian/guidindexpackv1.ldif

Then, during build:
bin/ldbadd -H tests/guidindexpackv1-debian.ldb < debian/guidindexpackv1.ldif
make test

But this failed with:

======================================================================
FAIL: test_guid_indexed_v1_db (__main__.GUIDIndexAndPackFormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/python/repack.py", line 185, in test_guid_indexed_v1_db
    self.assertEqual(len(guid_keys), self.num_recs_added)
AssertionError: 0 != 10


It seems that the DB created with ldbadd is already packed with v2. How can I force v2 with ldbadd?
Comment 3 Mathieu Parent 2019-10-01 20:48:58 UTC
(In reply to Mathieu Parent from comment #2)

I've also patched tests/python/repack.py to use tests/guidindexpackv1-debian.ldb, of course.