9 Replies Latest reply on Feb 17, 2014 10:52 AM by Charles Lamb

    Detailed transaction process documentation?

    Sascha D.

      Hello,

       

      I am working currently on a project based on "Oracle NoSQL" as the head storage unit. I am a bit curious, how ONDB handles their transactions. I have scoured the attached documentation but without success. The only thing I could find were headlines or marketing sentences (like "Flexible ACID transactions, a la Berkley DB")

       

      Oracle NoSQL Database transactions

      Oracle NoSQL Database (Version: 12cR1.2.1.57 Enterprise Edition, 2014-01-10 06:21:46 UTC

      Oracle Berkeley DB Java Edition | Oracle Berkeley DB

      http://indico.cern.ch/getFile.py/access?resId=0&materialId=slides&confId=159716

       

      In the documentation of Berkley DB I have found a section claiming that BDB handles their transactions through JTA. Since ONDB is based on Berkley DB I've assumed that the transactions will be handled the same way. Please correct me if i am wrong.
      However, this is not the result I would like to hear. Are there any detailed documentation for the transaction processing?


      If anyone of you have an idea or a tip where I could find such a thing?


      greeting

      Sascha

        • 1. Re: Detailed transaction process documentation?
          Charles Lamb

          Hi Sascha,


          The short answer is that you can perform KVStore.execute operations:

           

          execute(List<Operation> operations) (see execute)


          Operations on records with the same major key, but different minor keys will be wrapped in an ACID transaction. All other single-record operations are in effect "auto-commit" transactions. You can perform CAS/RMW style operations using putIfVersion and deleteIfVersion.


          Charles



          1 person found this helpful
          • 2. Re: Detailed transaction process documentation?
            Sascha D.

            Hi Charles,

             

            thank you for the answer. This has brought me a little closer.

            Now I know that there is such a method, however it is not clear to me how this is implemented internally. I speculate on JTA but I'm not sure and thats why I would like to know more.

            Is there maybe an additional documentation that is something profound?

             

             

            I noticed the following after I´ve looked at the API in more detail (the Link you´ve send me).

            This next sentence caused me some headaches. Maybe it´s only my way of thinking (*couch* relational databases *couch*):

            Operations are not executed in the sequence they appear the operations list, but are rather executed in an internally defined sequence that prevents deadlocks. Additionally, if there are two operations for the same key, their relative order of execution is arbitrary; this should be avoided.

            Does this mean if i have a list of operations (lets say two operations delete/update) which I run on an record. It is possible that:

            • The fact that the record is deleted before the update was performed
            • The fact that the record is updated and then deleted.

             

             

            Sascha

            • 3. Re: Detailed transaction process documentation?
              Charles Lamb

              exec only accepts a single major key. All records with the same major key live on the same node (actually the same shard). That means that we don't need 2-phase commit to do an atomic transaction because the underlying storage engine (Berkeley DB) provides that for us (i.e. without JTA). If we allowed ACID across major keys, then those records could (and probably would) reside on multiple shards. That would require 2PC and we don't want to do that (even though BDB JE provides that capability).

               

              Sascha D. wrote:

              Operations are not executed in the sequence they appear the operations list, but are rather executed in an internally defined sequence that prevents deadlocks. Additionally, if there are two operations for the same key, their relative order of execution is arbitrary; this should be avoided.

              Does this mean if i have a list of operations (lets say two operations delete/update) which I run on an record. It is possible that:

              • The fact that the record is deleted before the update was performed
              • The fact that the record is updated and then deleted.

               

              Yes, that is exactly what it means.

               

              Charles

              1 person found this helpful
              • 4. Re: Detailed transaction process documentation?
                Sascha D.

                Charles Lamb wrote:

                 

                exec only accepts a single major key. All records with the same major key live on the same node (actually the same shard). That means that we don't need 2-phase commit to do an atomic transaction because the underlying storage engine (Berkeley DB) provides that for us (i.e. without JTA). If we allowed ACID across major keys, then those records could (and probably would) reside on multiple shards. That would require 2PC and we don't want to do that (even though BDB JE provides that capability).

                Thanks for the reply, but a written version (detailed) would be very pretty. Nothing against you, but I'd like a document that I can show certain people.

                 

                Sascha

                • 6. Re: Detailed transaction process documentation?
                  Sascha D.

                  Hi greybird,

                   

                  greybird wrote:

                   

                  This is the documentation that's available:

                  Chapter 13. Executing a Sequence of Operations

                  KVStore (Oracle NoSQL Database API)

                   

                  --mark

                  I have already read this chapter after charles told me about the "execute" method. The problem is that I wanted to know someting more about the transaction process. Since the database is based on "Berkeley DB", I was not sure if I should just read the documentation of Berkeley DB (see Storage Engine) or rather ask for a specific documentation for the ONDB.

                  I thought that there might be a detailed documentation what happens during the execution of the "execute" method:

                   

                  • Building the transaction
                  • ... certain points which must also be made
                  • I am also aware that each operation must have the same Major Key (see API which you and charles have sent)
                  • Rollback in case of error
                  • Correct processing
                  • Closing the transaction

                   

                  Sorry that I am so eager for an answer on this topic.

                   

                  Sascha

                  • 7. Re: Detailed transaction process documentation?
                    Charles Lamb

                    I think the best thing may be for you to read the source code (available in the CE version).

                     

                    In src/oracle/kv/impl/api/RequestHandlerImpl.java's executeInternal you'll see the beginTransaction and commit() calls.

                     

                    Then, in src/oracle/kv/impl/api/ops/Execute.java's execute() you'll see how it sorts the operators by key and then executes each one.

                     

                    IHTH.

                     

                    Charles

                    • 8. Re: Detailed transaction process documentation?
                      Sascha D.

                      Hi Charles,

                       

                      thanks for the advice. I don´t know why I haven´t thought of it at the time.

                      The only problem that I see here is that when the source code changes.

                       

                      But thanks so far for your help. I really hope that I find what I'm looking for.

                       

                      Sascha

                      • 9. Re: Detailed transaction process documentation?
                        Charles Lamb

                        The ACID semantics of that operation are unlikely to change in the future. if they did we would write about it in the release noes.

                         

                        Charles