You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Marco Spinetti <m....@pisa.iol.it> on 2005/08/29 17:37:12 UTC
apr_dbm error
Hi all,
as Nick suggested me I tried to use apr_dbm for my purpose.
My target is to use apr_dbm to record some information and then get it
for serving to my clients.
I'm using two apr_dbm_t which I'm opening as
apr_dbm_open_ex(&db_timeout, dbtype, DBM_FILE_TIMEOUT, APR_DBM_RWCREATE,
APR_OS_DEFAULT, context);
apr_dbm_open_ex(&db, dbtype, DBM_FILE, APR_DBM_RWCREATE, APR_OS_DEFAULT,
context);
In the first I'd like to record couples (url, timeout).
In the second, (url, XML).
When a client send me an url, I'd like to get, if exists, its XML, if it
doesn't fall in timeout.
But when I try to write my xml:
...............
rv = apr_dbm_store(db, key, val);
if (rv != APR_SUCCESS) {
apr_size_t length;
char errbuf[200];
apr_strerror(rv, errbuf, sizeof(errbuf));
fprintf(stderr,"[ERRORE] Errore %d - %s\n", rv, errbuf);
if (db) {
apr_dbm_geterror(db, &rv, errbuf, sizeof(errbuf));
fprintf(stderr, "[ERRORE] APR_DB Error %d - %s\n", rv,
errbuf);
}
if (apr_dbm_exists(db_timeout, key))
apr_dbm_delete(db_timeout, key);
goto FINE;
}
I get this error:
[ERRORE] Errore 20014 - Internal error
[ERRORE] APR_DB Error 22 - I/O error occurred.
What does it mean?
Can I write a XML as content?
My content (key, val) is written using a subpool which is destroyed at
the end.
Thanks for the support
--Marco
Re: apr_dbm error
Posted by Marco Spinetti <m....@pisa.iol.it>.
Can someone tell me something please?
I have seen inside the source code and I find these lines in sdbm_private.h:
#if 0
/* if the block/page size is increased, it breaks perl apr_sdbm_t
compatibility */
#define DBLKSIZ 16384
#define PBLKSIZ 8192
#define PAIRMAX 8008 /* arbitrary on PBLKSIZ-N */
#else
#define DBLKSIZ 4096
#define PBLKSIZ 1024
#define PAIRMAX 1008 /* arbitrary on PBLKSIZ-N */
#endif
Meanwhile in apr_sdbm_store there is:
need = key.dsize + val.dsize;
/*
* is the pair too big (or too small) for this database ??
*/
if (need < 0 || need > PAIRMAX)
return APR_EINVAL;
The len of my key + xml is > 1008 bytes!
I open my dbm files with the default type: what is the default for the
default DBM type?
My system have in apr_apu.h:
#define APU_HAVE_SDBM 1
#define APU_HAVE_GDBM 1
#define APU_HAVE_NDBM 0
#define APU_HAVE_DB 1
Thanks
--Marco
Marco Spinetti wrote:
> Hi all,
> as Nick suggested me I tried to use apr_dbm for my purpose.
> My target is to use apr_dbm to record some information and then get it
> for serving to my clients.
> I'm using two apr_dbm_t which I'm opening as
>
> apr_dbm_open_ex(&db_timeout, dbtype, DBM_FILE_TIMEOUT,
> APR_DBM_RWCREATE, APR_OS_DEFAULT, context);
> apr_dbm_open_ex(&db, dbtype, DBM_FILE, APR_DBM_RWCREATE,
> APR_OS_DEFAULT, context);
>
> In the first I'd like to record couples (url, timeout).
> In the second, (url, XML).
>
> When a client send me an url, I'd like to get, if exists, its XML, if
> it doesn't fall in timeout.
> But when I try to write my xml:
>
> ...............
>
> rv = apr_dbm_store(db, key, val);
> if (rv != APR_SUCCESS) {
> apr_size_t length;
> char errbuf[200]; apr_strerror(rv, errbuf,
> sizeof(errbuf));
> fprintf(stderr,"[ERRORE] Errore %d - %s\n", rv, errbuf);
> if (db) {
> apr_dbm_geterror(db, &rv, errbuf, sizeof(errbuf));
> fprintf(stderr, "[ERRORE] APR_DB Error %d - %s\n", rv,
> errbuf);
> }
> if (apr_dbm_exists(db_timeout, key))
> apr_dbm_delete(db_timeout, key);
> goto FINE;
> }
>
> I get this error:
>
> [ERRORE] Errore 20014 - Internal error
> [ERRORE] APR_DB Error 22 - I/O error occurred.
>
> What does it mean?
> Can I write a XML as content?
>
> My content (key, val) is written using a subpool which is destroyed at
> the end.
>
> Thanks for the support
>
> --Marco
>
>
>