pradeepa *nix forums beginner
Joined: 07 Apr 2005
Posts: 3
|
Posted: Mon Apr 11, 2005 12:02 pm Post subject:
RPC server secondary indices problem
|
|
|
In the application, it creates serveral indices for each bdb file.
and application uses RPC.
As documentation says, " Although a client cannot specify a callback,
Berkeley DB does support the DB->associate call in a limited manner. A
client program wishing to use a secondary index may do so only in a
read-only fashion. The primary and secondary databases must have been
created locally on the server machine. Client programs must then open
both the primary and secondary databases with the DB_RDONLY flag set.
The client must also specify a NULL callback for the DB->associate
call." , I set my codes.
When creating db in rpc server locally, at the RPC server, addition to
db open functions, set_bt_compare function also called.
but it gives errors "Inavlid argument" for DB->cursor and DBcursor->get
methods.
env open flags are DB_CREATE | DB_INIT_LOG | DB_INIT_LOCK |
DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER
at the rpc server, db open flags are DB_CREATE | DB_AUTO_COMMIT |
DB_THREAD
............ at the rpc server db open
if ((ret =
(dbh->tbl_name##_##indx_name##_indx)->open((dbh->tbl_name##_##indx_name##_indx),
NULL, \
#tbl_name"_"#indx_name"_indx.db", NULL, DB_BTREE, DB_CREATE |
DB_AUTO_COMMIT | DB_THREAD, 0644)) != 0) \
......................
..................... at the client, cursor operations
if ((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_begin");
goto error;
}
if ((ret = db->cursor(db,
tid, &dbcp, 0)) != 0) {
db->err(db, ret, "DB->cursor");
goto error;
}
................ it always goes to error
How can I solve the problem and update database correctly?
Regards,
pradeepag |
|