Home Bug Reports

Freeze :createConnection

uclaskyuclasky Member tonnyOrganization: baosteel co.,Ltd.Project: iplature
these days our project use Freeze and its map, found multiprocess write map may occur data error, but when we use berkeley db directly it is ok( with Berkeley Environment), so we learn freeze code,we found all the example just use two arguments createConnection function:

Freeze::createConnection(const CommunicatorPtr& communicator,
const string& envName)

but we found another createConnection function has 3 arguments:
Freeze::createConnection(const CommunicatorPtr& communicator,
const string& envName,
DbEnv& dbEnv)

so we try to use these function:

string _envName="F:\\project\\BerkelyClient\\debug";
DbEnv myEnv(0);
myEnv->open(_envName.c_str(),DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL,0);
_connection = Freeze::createConnection(communicator, _envName,myEnv);

compile and link is ok ,but when run , an exception occur:
in sharedb.cpp
open(0, _mapKey.dbName.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE);
invalid arguments

when we try:

string _envName="F:\\project\\BerkelyClient\\debug";
DbEnv myEnv(0);
_connection = Freeze::createConnection(communicator, _envName,myEnv);

still exception

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    The createConnection function with a third DbEnv& parameter is there for applications that mix direct Berkeley DB calls and Freeze calls. You create a Berkeley DB DbEnv directly, open / read / write databases and at some point want to open a Freeze map in this environment: that's when this createConnection is handy.

    You can look at the source code of FreezeScript for an example; FreezeScript uses this function to open the Freeze catalog of a given DB environment.

    Concurrent access from multiple processes to the same Freeze map is currently not supported by Freeze, no matter which createConnection API you use.

    If you need such multi-process concurrent access, you could:
    • Sponsor this Freeze enhancement (please contact us at [email protected] if you're interested)
    • Use Berkeley DB directly, with a separate Freeze-free Berkeley DB environment (this is expected to work; for support, you'd need to contact Oracle)
    • Use another database system where multi-process access is typical, such as most relational database systems.

    Best regards,
    Bernard
  • uclaskyuclasky Member tonnyOrganization: baosteel co.,Ltd.Project: iplature
    thanks for your reply

    from your reply,we'd have to change our disign,thank you very much!
Sign In or Register to comment.