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

Re: LMDB and HP-UX Itanium



This took some time, but I've finally been able to make a reproducible
test case. The attached test case fails on HP-UX on Itanium every time,
but passes on Linux. As far as I can tell, it is a minimal test case, I
cannot remove anything and still have it fail, yet I don't see any wrong
API usage in it. The database should be removed before each run.

How is it best to proceed? Should I submit ticket in the bug tracker?

-- 
Kristian
#define HAVE_MEMALIGN 1

#include "mdb.c"
#include "midl.c"

#define NEXT_PUT_VALUE(x, y) mkey.mv_data = (x); mkey.mv_size = strlen(x) + 1; data.mv_data = (y); data.mv_size = strlen(y) + 1

int main() {
    MDB_env *env;
    MDB_dbi dbi;
    MDB_txn *txn;

    const char *dbpath = "test.lmdb";

    MDB_val mkey, data;

    mdb_env_create(&env);
    mdb_env_open(env, dbpath, MDB_NOSUBDIR|MDB_NOSYNC, 0644);
    mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
    mdb_open(txn, NULL, 0, &dbi);
    mdb_txn_commit(txn);
    mdb_txn_begin(env, NULL, 0, &txn);
    NEXT_PUT_VALUE("key", "value1");
    mdb_put(txn, dbi, &mkey, &data, 0);
    mdb_txn_commit(txn);
    mdb_env_close(env);
    mdb_env_create(&env);
    mdb_env_open(env, dbpath, MDB_NOSUBDIR|MDB_NOSYNC, 0644);
    mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
    mdb_open(txn, NULL, 0, &dbi);
    mdb_txn_commit(txn);
    mdb_txn_begin(env, NULL, 0, &txn);
    NEXT_PUT_VALUE("key", "value2");
    mdb_put(txn, dbi, &mkey, &data, 0);
    mdb_txn_commit(txn);
    mdb_env_close(env);
    mdb_env_create(&env);
    mdb_env_open(env, dbpath, MDB_NOSUBDIR|MDB_NOSYNC, 0644);
    mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
    mdb_open(txn, NULL, 0, &dbi);
    mdb_txn_commit(txn);
    mdb_env_close(env);
    mdb_env_create(&env);
    mdb_env_open(env, dbpath, MDB_NOSUBDIR|MDB_NOSYNC, 0644);
    mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
    mdb_open(txn, NULL, 0, &dbi);
    mdb_txn_commit(txn);
    mdb_txn_begin(env, NULL, 0, &txn);
    NEXT_PUT_VALUE("key", "value3");
    mdb_put(txn, dbi, &mkey, &data, 0);
    mdb_txn_commit(txn);
    mdb_txn_begin(env, NULL, 0, &txn);
    NEXT_PUT_VALUE("key", "value4");
    mdb_put(txn, dbi, &mkey, &data, 0);
    mdb_txn_commit(txn);
    mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
    mdb_get(txn, dbi, &mkey, &data);

    printf("data should be 'value4', on HP-UX it is 'value1'\n");
    printf("mkey = '%s', data = '%s'\n", mkey.mv_data, data.mv_data);

    return 0;
}