Database Files

#1

Hi.  According the docs, "Every transaction commit is first written to the recovery file and then to the database".  During my testing, every time I make a transaction the recovery file keeps growing, but the actual odb file never changes unless I restart the server.  The <transaction-id>.odr, also stays at the same number even after 100 transactions.

 

I don't use embedded server by the way, using latest version of Objectdb.  All my transactions go through this, where func.apply(em) will do stuff like persist, delete, etc.  I only have 1 instance of emf.

    private <T> T doTransaction(Function<EntityManager,T> func) {
        EntityManager em = emf.createEntityManager();
        try {
            em.getTransaction().begin();
            T t = func.apply(em);
            em.getTransaction().commit();
            return t;
        }finally {
            em.close();
            if (em.getTransaction().isActive()) {
                em.getTransaction().rollback();
            }
        }
    }

#2

The default behaviour is to delay writing to the odb file in order to improve the performance. As long as the data is written to the recovery file it can be considered as part of the database. When the recovery file is full and when the database is closed - the odb file is also updated.

To change this behaviour you can enable  <processing ... synchronized="true" />, but is is expected to decrease the performance.

The <transaction-id>.odr files are related to the recording feature, which is disabled by default.

ObjectDB Support
#3

Thanks for the help.  As for recording, I have it enabled, but for some reason the transaction ID for the file just remains the same after each transaction.

#4

Don't expect a new file for every transaction, or renaming the file.

ObjectDB Support
#5

I have put hundreds of transactions through(few megabytes of data)  but the file name is the same.  So it is the correct behavior that the file name never changes?  It only changes when restart the server?

#6

It is normal. ObjectDB may open a new recording file for new transactions. Currently this happens when the database is created/opened (in client-server mode, when it is opened by the server).

ObjectDB Support

Reply