RE: [bdbxml] disappearing default index

"Vries, Willem de (ELS)" <W.Vries-dUsxN/C1/[email protected]> Mon, 26 Sep 2005 13:18:48 +0100
Newsgroups gmane.comp.db.dbxml.general
Message-ID <D3E7986165D790478082E01DAD5DC3690780C061@elsamss31748.elsevier.com>
Thanks John,
I tried both your examples, but they generate the following error:
First a lot of these lines: 
"Indexer    - test0 - add edge-element-substring-string, key={Size=c
Hex=8b61000000090000006d6531}, data={Size=2 Hex=0008}"

and finally (error):
"Container  - test0 - container closed.
Error: DbTxn::abort: DB_RUNRECOVERY: Fatal error, run database recovery in
setDefaultIndex.pl, line 9"

BTW: there is no difference whether I do use "$containerTxn->commit();" or
not use it.

------------------script
use strict;
use warnings;
use Sleepycat::DbXml;
use IO::File ;
    eval {
my $env = new DbEnv(0);
$env->set_cachesize(0, 64 * 1024, 1);
$env->open("/usr/local/dbxml-2.1.8/data",
 
Db::DB_INIT_MPOOL|Db::DB_CREATE|Db::DB_INIT_LOCK|Db::DB_INIT_LOG|Db::DB_INIT
_TXN);
my $mgr = new XmlManager($env);
DbXml::setLogLevel(DbXml::LEVEL_ALL, 1);
DbXml::setLogCategory(DbXml::CATEGORY_ALL, 1);
my $containerTxn = $mgr->createTransaction();
my $container = $mgr->openContainer($containerTxn,"test0");
my $ix = $container->getIndexSpecification($containerTxn);
$ix->addDefaultIndex("edge-element-substring-string");
my $uc = $mgr->createUpdateContext();
$container->setIndexSpecification($containerTxn, $ix,$uc);
$containerTxn->commit();
} ;
    if (my $e = catch std::exception)
    {
        warn $e->what() . "\n";
        exit( -1 );
    }
    elsif ($@)
    {
        warn $@;
        exit( -1 );
    }
    exit 0 ;
/---------------------script


With kind regards, 

W(im) S. de Vries LL M
Information Structure Technologist
Electronic Production Department
Elsevier Science NL
tel. (+31) 20 4852733
fax  (+31) 20 4852812

Radarweg 29
1043 NX Amsterdam
The Netherlands 



-----Original Message-----
From: John Snelson [mailto:[email protected]]
Sent: 26 September 2005 12:13
To: Vries, Willem de (ELS)
Cc: '[email protected]'
Subject: Re: [bdbxml] disappearing default index


Vries, Willem de (ELS) wrote:
> my $ix = $container->getIndexSpecification($containerTxn);
> $ix->addDefaultIndex("edge-element-substring-string");
> my $uc = $mgr->createUpdateContext();
> $container->addDefaultIndex($containerTxn, $ix,$uc);

This is your problem. You either need to use 
XmlContainer::setIndexSpecification() or XmlContainer::addDefaultIndex() 
- not both! Try this:

my $ix = $container->getIndexSpecification($containerTxn);
$ix->addDefaultIndex("edge-element-substring-string");
my $uc = $mgr->createUpdateContext();
$container->setIndexSpecification($containerTxn, $ix,$uc);

or this:

my $uc = $mgr->createUpdateContext();
$container->addDefaultIndex($containerTxn, 
"edge-element-substring-string", $uc);

John

-- 
John Snelson, Berkeley DB XML Engineer
Sleepycat Software, Inc
http://www.sleepycat.com

Contracted to Sleepycat through Parthenon Computing Ltd
http://blog.parthcomp.com/dbxml


------------------------------------------
To remove yourself from this list, send an
email to [email protected]