Creating TxPageFile lower than 64MB

24 views
Skip to first unread message

rodolfo

unread,
Sep 28, 2010, 12:28:00 PM9/28/10
to hawtdb
Hi

I have an implementation where I 'm partitioning my data within 27
files but noticed each TxPageFile has an initial size of 64MB. Is
there a way to create a TxPageFile with less than the default 64 MB ?
In case of yes, is there any consideration I should be aware ?

Thanks,
Rodolfo

Hiram Chirino

unread,
Sep 28, 2010, 12:35:09 PM9/28/10
to haw...@googlegroups.com
Not sure I understand the need for 27 files,

Yes you can change that initial size. Use the setMappingSegementSize()
method of the page file factory. This is how much of the file gets
memory mapped at a time. It defaults to 64*1024*1024.


Regards,
Hiram

Blog: http://hiramchirino.com

Open Source SOA
http://fusesource.com/

rodolfo

unread,
Sep 28, 2010, 5:49:29 PM9/28/10
to hawtdb
Thanks Hiram

I'm using bellow code to open (or create it, if necessary) a file. But
I noticed the file is recreated on every restart.

Thereafter, I lose my data. An important details is: eventually I'm
not able to call TxPageFile.close() (when the user can kill the java
process) .

Do you have any suggestion ?

Regards,
Rodolfo


final File db = new File(filePath);

final boolean dbAlreadyExists = db.exists();

log.info(filePath + (dbAlreadyExists ? " ja existe." : " nao existe.
Criando novo arquivo..."));

// Opening a transactional page file.
this.factory = new TxPageFileFactory();
if (!dbAlreadyExists) {
this.factory.setMappingSegementSize(8*1024*1024) ;
}
this.factory.setFile(new File(filePath));
this.factory.open();

this.pageFile = factory.getTxPageFile();

this.indexFactory = new BTreeIndexFactory<String, T>();

Transaction tx = pageFile.tx();
if (!dbAlreadyExists) {
this.root = indexFactory.create(tx);
} else {
this.root = indexFactory.open(tx);
}
tx.commit();
pageFile.flush() ;


Reply all
Reply to author
Forward
0 new messages