[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#7793) mdb_cursor_put(,,,MDB_CURRENT) should ignore key

Full_Name: Hallvard B Furuseth
Version: LMDB_0.9.11
OS: Linux x86_64
URL: ftp://ftp.openldap.org/incoming/Hallvard-Furuseth-140128.c
Submission from: (NULL) (
Submitted by: hallvard

The doc for mdb_cursor_put:MDB_CURRENT says "The key parameter is
ignored".  However:

- key==NULL gives EINVAL after a thinko in the assert cleanup.
  5bda3565a9bfaa6cd54053faeafcc06da15bc00c moved assert(key) from
  mdb_cursor_set() to the wrong place in the one relevant caller.

- A huge key.mv_size triggers mdb_page_spill().

- If data.mv_size==0, the record's key instead of data is
  modified (so you can modify e.g. key:"foo" to key:"bar").
  I expect the test should be (mc->mc_flags & C_SUB).

  Changing that has a side effect on a non-MDB_CURRENT case:
  With a cmp function like strncasecmp, changing "KEY" to "key"
  currently works with if old datasize = new datasize = 0.
  After this it won't, as with non-empty data of the same size.

Test program enclosed.