Giter Site home page Giter Site logo

Comments (5)

tzaeschke avatar tzaeschke commented on June 13, 2024

Thanks a lot. I'm a bit busy at the moment, I'll have a look next week.

from zoodb.

tzaeschke avatar tzaeschke commented on June 13, 2024

Hi, if I understand correctly, this is a fix for the test that you provided.
Or are you seeing a problem with ZooDB? If yes, could you describe the error and tell me which branch you tested? At the moment the test runs just fine for me.

from zoodb.

slavap avatar slavap commented on June 13, 2024

Hi,
No, it's not a fix for the test.
If you change code to the first version, test won't work, and just hangs up.
The second version (currently in the code) works just fine, that's why test works for you.
Both versions are semantically equal of course.
I'm using master branch, let me know if you need additional info.

from zoodb.

tzaeschke avatar tzaeschke commented on June 13, 2024

The problem is that ZooDB currently uses one write-lock to lock the whole server. That means that there can be only one open transaction at any time. I had the same problem in some of the Concurrent-Schema tests. As a workaround, I implemented a function DiskAccessOneFile.allowReadConcurrency(true); (place it before tx.begin()). This causes the server to use only a read-lock, but it is not threadsafe and should only be used if no more than one thread is controlling the different transactions.
Thanks for reporting this and for the fix to the concurrency test.

from zoodb.

tzaeschke avatar tzaeschke commented on June 13, 2024

Fixed. In ConcurrencyTest I had to change the startConcurrentTransfer method to deal with OptimisticVerification Exceptions:

           public void run()
            {
                LOG.debug(">> Starting thread " + transferId + " in pm=" + pm);
                synchronized (lock)
                {
                    lock.notifyAll();
                }

                boolean success = false;
                do {
	                try {
	                    pm.currentTransaction().begin();
	                    Transfer t = (Transfer) pm.getObjectById(transferId, true);
	                	performTransfer(t);
	                	success = true;
	                } catch (JDOOptimisticVerificationException e) {
	                	success = false;
	                	System.out.println("Transaction failed, retrying...");
	                } finally {
	                	if (success) {
	                        closePm(pm);
	                	}
	                }
                } while (!success);
                LOG.debug(">> Completed thread " + transferId + " in pm=" + pm);
            }

from zoodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.