Concurrent access of a primary record referenced by secondary database

Hello
We need to implement the trick :
get record from secondary database, then update it in primary database, so the key for secondary database will be modified
we are facing strange issue - when we are working in multi-threaded environment, several threads can access same record in secondary database and update it, while only one thread should be allowed to do this,
we are using LockMode.RMW in secondary cursor searches on secondary database (cursor.getSearchRange), we were assuming that will locks associated record in primary database - but it seems it doesn't.
Do we miss something?
Thank you in advance!

I have reproduced this and the fix is well underway but not completely done.
In the meantime, a work around is to use a transaction. If you read via a secondary with an explicit transaction, the secondary and primary will both be locked by the transaction.
Mark

Similar Messages

  • Concurrency questions, Secondary Databases, etc.

    Hi,
    i have the following requirements:
    - Multiple threads, every thread opens one ore more database
    - Databases have RefCounting if they are used in more than one thread
    - Every database has a SecondaryDatabase associated
    - All Threads are performing only put operations one the databases
    - Keys and SecondaryKeys are unique (no duplicates)
    I tested with normal Databases and SecondaryDatabases:
    - no Transactions used
    - deferredWrite is on true
    Everything worked and the performance is within our expectations.
    my Questions now:
    - Does this setup work as long as all threads are only writing (put)
    (i read in another post that SecondaryDatabases work only with transactions...
    i think thats true only if you read/write ??)
    - Is there anything i should take care of? I already checked my SecondaryKeyCreator
    for concurrency issues...
    - Does it help (in this setup) to disable the CheckpointerThread? The Databases are
    synced and closed after all writes are finished. We don't need recovery...
    - Are there any penalties if i increase the LogFileSize? We are writing around 80 to 150GB
    of data and with the default size (10MB) we get a lot of files...
    - Caching is a non-issue as long as we are only writing... is this correct?
    Sorry for the amount of questions & thanks in advance for any answers!
    Greets,
    Chris

    Hi Chris,
    - Does this setup work as long as all threads are only writing (put)(i read in another post that SecondaryDatabases work only with transactions...
    i think thats true only if you read/write ??)>
    When using secondaries, if you don't configure transactions and there is an exception during the write operation, corruption can result. If you are reading and writing, lock conflict exceptions are likely to occur -- with transactions you can simply retry, but without transactions you can't. Since you are not reading, it is unlikely that this type of exception will occur. See below for more.
    - Is there anything i should take care of? I already checked my SecondaryKeyCreatorfor concurrency issues...>
    Since your secondary keys are unique, you'll get an exception if you attempt to write a primary record containing a secondary key that already exists. To avoid corruption, you'll have to prevent this from happening. If you are assigning secondary keys from a sequence, or something similar, then you'll be fine. Another way is to check the keys for existence in the secondary before the write. To do this, open the secondary as a regular database (openDatabase not openSecondaryDatabase). You don't want to read the primary (that could cause lock conflicts), which is what happens when you use openSecondaryDatabase and read via the secondary.
    - Does it help (in this setup) to disable the CheckpointerThread? The Databases aresynced and closed after all writes are finished. We don't need recovery...>
    Yes, if you don't care about recovery time, then disabling the checkpointer during the write operations will reduce the amount of disk space used and overall overhead.
    When you say you don't need recovery, what do you mean? In general, this means that if there is a crash, you can either 1) revert to a backup or 2) recreate the data from scratch.
    - Are there any penalties if i increase the LogFileSize? We are writing around 80 to 150GBof data and with the default size (10MB) we get a lot of files...>
    The log cleaner may become inefficient if the log files are too large, so I don't recommend a file size larger than 50 MB.
    - Caching is a non-issue as long as we are only writing... is this correct?The JE cache is not just a cache, it's the memory space for internal information and the Btree. For good performance during the write operations you should configure the cache large enough to hold all internal Btree nodes. The DbCacheSize program (in com.sleepycat.je.util) can be used to calculate this size.
    An exception to this rule is when you are inserting keys sequentially. If both the primary keys and secondary keys are assigned and written sequentially, then the cache size can normally be much smaller, perhaps only 10 MB. But this is an unusual use case, especially with secondaries.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Accessing the very last record in a transparent table.

    Hi!
    There's any way to read the last record of a transparent table?
    My problem is:
    I have to access the very las record of a Z table because I need the maximun value of a numeric field (that is the first field of the primary key).
    I used a SELECT MAX, with no condition , but I was asked to find a more performance solution.
    There is any way to access the last record of a table? Something like we have for the internal tables with the READ TABLE INDEX N, but with a select statement?
    Thanks a lot for your help!

    Yes, that was my first thought, but I made a comparising between both options with SE30.
    Check this numbers:
    TIME:  11,377,702
    select * from t100 into table t_t100.
    sort t_t100 descending.
    read table t_t100 index 1.
    TIME: 954,218
    DATA: MAX_MSGNR type t100-msgnr.
    SELECT MAX( MSGNR ) FROM T100 INTO max_msgnr.
    Select MAX is better...
    I don't think there is a better solucion... Maybe a big brain here has an idea...
    Vasanth, thanks for your quick reply!

  • Flex and concurrent access

    I am going to work on a new project. This project is a real time scanning  processing monitor. The application would launch from an html wrapper. Also a few more processes will also start from there using JavaScript code:
    oReadfromScanner1 = new ActiveXObject("comportreader.classname");
    oReadfromScanner2 = new ActiveXObject("comportreader.classname");
    I am going to have up to 10 scanner readers which will update Flex client screen.
    There will be many times when readers try to update the client in exact same time. What is a design pattern to manage simultaneous access to Flex? Or there will be no problem at all?
    Thanks

    Thanks for the feedback. This is still bothering me,
    yes I could have a static RandomAccessFile and
    synchronise on this, but I really want concurrent
    access.
    I've implemented a locking mechanism to prevent
    different RandomAccessFile instances updating the
    same record - is this not a waste if only one
    RandomAccessFile can write to the file anyway?
    Or is there another Java class I can use to access
    the file in this way?
    Thanks for the help.Hi,
    if the intention of using multiple instanced of RandamAccessFile is concurrent access, then i feel your locking mechanism doesnt achieve the purpose..
    also, at any case, you may not plan for full concurrency in updating a file....
    it is more prone to malfunctions..
    probably, to enhance performance, you can lock only the part your code that actually writes to the file, like io.write() , in this way you can perform all business logic with respect to writing and serialize only the actual file writing...
    even in this case, you must be sure that writing to different part of the file, doesnt really impact other parts of the file which might be manipulated by other threads..
    i have one more thought on this,
    if updating different parts of the file doesnt affect content of other parts of the file,
    then can you think of having different files itself?
    if using different files is not a good idea, then
    probably think of using some buffering mechanism, like collect all data concurrently and periodically update the actual file from the buffer.. just a raw idea but all depends on your system needs & requirements.. ..

  • "Secondary is corrupt: the primary record ..."

    We're using 3.3.98. When attempting to delete all records from an EntityStore, we're getting the error "com.sleepycat.je.SecondaryIntegrityException: (JE 4.1.6) Secondary is corrupt: the primary record contains a key that is not present in the secondary".
    There's no additional detail about which key it is that isn't in the secondary, so not sure the source of the issue. The error happens on each of the last three records in the database. Each one has some null values in a MANY_TO_ONE secondary indexed field.
    We've tried deleting from secondary key index first, but still get the exception. The exceptions in each case occur when deleting from the primary index.
    Could having null values in a secondary index somehow be causing problems (even if the relationship type is MANY_TO_ONE)?
    -tyson

    It looks like you're using 4.1, thought you said 3.3 earlier. Although it's not printed as part of the exception message, you can call SecondaryIntegrityException.getPrimaryKey and getSecondaryKey and print them yourself when you catch the exception. To translate the DatabaseEntry to DPL syntax, use PrimaryIndex or SecondaryIndex.getKeyBinding.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to synchronize concurrent access to static data in ABAP Objects

    Hi,
    1) First of all I mwould like to know the scope of static (class-data) data of an ABAP Objects Class: If changing a static data variable is that change visible to all concurrent processes in the same Application Server?
    2) If that is the case. How can concurrent access to such data (that can be shared between many processes) be controlled. In C one could use semaphores and in Java Synchronized methods and the monitor concept. But what controls are available in ABAP for controlling concurrent access to in-memory data?
    Many thanks for your help!
    Regards,
    Christian

    Hello Christian
    Here is an example that shows that the static attributes of a class are not shared between two reports that are linked via SUBMIT statement.
    *& Report  ZUS_SDN_OO_STATIC_ATTRIBUTES
    REPORT  zus_sdn_oo_static_attributes.
    DATA:
      gt_list        TYPE STANDARD TABLE OF abaplist,
      go_static      TYPE REF TO zcl_sdn_static_attributes.
    <i>* CONSTRUCTOR method of class ZCL_SDN_STATIC_ATTRIBUTES:
    **METHOD constructor.
    *** define local data
    **  DATA:
    **    ld_msg    TYPE bapi_msg.
    **  ADD id_count TO md_count.
    **ENDMETHOD.
    * Static public attribute MD_COUNT (type i), initial value = 1</i>
    PARAMETERS:
      p_called(1)  TYPE c  DEFAULT ' ' NO-DISPLAY.
    START-OF-SELECTION.
    <b>* Initial state of static attribute:
    *    zcl_sdn_static_attributes=>md_count = 0</b>
      syst-index = 0.
      WRITE: / syst-index, '. object: static counter=',
               zcl_sdn_static_attributes=>md_count.
      DO 5 TIMES.
    <b>*   Every time sy-index is added to md_count</b>
        CREATE OBJECT go_static
          EXPORTING
            id_count = syst-index.
        WRITE: / syst-index, '. object: static counter=',
                 zcl_sdn_static_attributes=>md_count.
    <b>*   After the 3rd round we start the report again (via SUBMIT)
    *   and return the result via list memory.
    *   If the value of the static attribute is not reset we would
    *   start with initial value of md_count = 7 (1+1+2+3).</b>
        IF ( p_called = ' '  AND
             syst-index = 3 ).
          SUBMIT zus_sdn_oo_static_attributes EXPORTING LIST TO MEMORY
            WITH p_called = 'X'
          AND RETURN.
          CALL FUNCTION 'LIST_FROM_MEMORY'
            TABLES
              listobject = gt_list
            EXCEPTIONS
              not_found  = 1
              OTHERS     = 2.
          IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          CALL FUNCTION 'DISPLAY_LIST'
    *       EXPORTING
    *         FULLSCREEN                  =
    *         CALLER_HANDLES_EVENTS       =
    *         STARTING_X                  = 10
    *         STARTING_Y                  = 10
    *         ENDING_X                    = 60
    *         ENDING_Y                    = 20
    *       IMPORTING
    *         USER_COMMAND                =
            TABLES
              listobject                  = gt_list
            EXCEPTIONS
              empty_list                  = 1
              OTHERS                      = 2.
          IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        ENDIF.
      ENDDO.
    <b>* Result: in the 2nd run of the report (via SUBMIT) we get
    *         the same values for the static counter.</b>
    END-OF-SELECTION.
    Regards
      Uwe

  • HT5312 I no longer have access to my primary email for Apple ID and I want to use my rescue email as my primary email. How do I accomplish this?

    I no longer have access to my primary email address that is my Apple ID. I want to use my rescue email as my primary email. I have tried and tried and tried to, but Apple will not let me without accessing my old email account... which I cannot. How can I get my rescue email to be my primary on my Apple ID?

    Hello Heather_M_D,
    I found an article on how to change your Apple ID to another email account. 
    Apple ID: Changing the email address you use for your Apple ID
    http://support.apple.com/kb/HT5621
    You would have to verify a few conditions first :
    Ensure that the email address you enter:
    Is one that you regularly use since this will be the primary email for your account
    Is a valid email address
    Is not already associated with another Apple ID you have
    Is not an address that ends in @mac.com. @me.com, or @icloud.com
    If you meet all those conditions (you might have to dissociate the recovery email from your current Apple ID) and your current Apple ID does not end with @mac.com. @me.com, or @icloud.com, you would follow these steps from the article:
    Follow these steps to change the primary email address for your Apple ID:
    Go to My Apple ID (appleid.apple.com), click "Manage your Apple ID," and sign in.
    With the Name, ID, and Email Address drawer selected, click Edit next to Apple ID and Primary Email Address.
    Enter your new email address.
    Best,
    Sheila M.

  • My ipod touch has been disabled and it says connect to itunes, and I dont have any access to the primary computer that i used first , what do I do ?

    My ipod touch has been disabled and it says connect to itunes, and I dont have any access to the primary computer that i used first , what do I do ?

    put it into recovery mode
    See here
    http://www.apple.com/support/ipodtouch/assistant/restore/
    Then restore
    http://support.apple.com/kb/HT1414
    You'll probably lose all your data

  • How to access an attribute(this is referencing to another class) in a class

    Dear Gurus,
    I have to read an attribute of a class and that attributes type another class.
    I have intantiated the class and my question is how to read the attribute. I know I can not dirrectly read the attribute since this is another class. I think I have to first reference the attribute right? Please advise me.
    My code looks like below:
    data: lo_fpm                                 type ref to if_fpm.
    data: lo_msg_mgr                        type ref to if_fpm_message_manager.
    data: lo_component_manager    type ref to cl_fpm_component_manager.
    lo_fpm = cl_fpm_factory=>get_instance( ).    " cl_fpm_factory is a class which has a static method get_instance
    lo_msg_mgr = lo_fpm->mo_message_manager.
    lo_component_manager = lo_fpm->mo_component_manager.
    The above statement is giving syntax error. I do not know why.
    The basic difference b/n the two methods is if_fpm~mo_message_manager    type ref to if_fpm_message_manager    and
    mo_component_manager     type ref to cl_fpm_component_manager.
    Any help would be appreciated.
    Thanks,
    GSM

    Hello
    I cannot test the following coding because I do not get the singleton instance yet it should work:
    *& Report  ZUS_SDN_CL_FPM_FACTORY
    *& Thread: How to access an attribute(this is referencing to another class) in a class
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1398429"></a>
    REPORT  zus_sdn_cl_fpm_factory.
    DATA: go_fpm TYPE REF TO cl_fpm.  " class implements if_fpm.
    DATA: go_msg_mgr TYPE REF TO if_fpm_message_manager.
    DATA: go_component_manager TYPE REF TO cl_fpm_component_manager.
    START-OF-SELECTION.
      BREAK-POINT.
      go_fpm ?= cl_fpm_factory=>get_instance( ). " cl_fpm_factory is a class which has a static method get_instance
      CHECK ( go_fpm IS BOUND ).
      go_msg_mgr           = go_fpm->mo_message_manager.
      go_component_manager = go_fpm->mo_component_manager.
    END-OF-SELECTION.
    Regards
      Uwe

  • Concurrent access

    Hi all,
    I have created a BAPI which is working well.
    However, if I call it more than one times at the same times through RFC (php call), it doesn't work correctly.
    Can anyone help me about concurrent access like this ?
    Thanks,
    Smoltok

    Hello,
    Before the call to your BAPI, call the function module ENQUEUE_<name of the lock object> and pass the parameters to locjk the specific entry. Now all your BAPI amd once done unlock the entry by call the function module DEQUEUE_<name of the lock object>.
    Regards,
    Sachin

  • Database Adapter: cannot access table with complex record type as columns

    Hi all,
    I cannot perform any operations on a table that has columns with complex record type.
    I have created a table to store purchase order details.
    Sample script:
    CREATE type XX_CUST_INFO_TYP as object
    ssn VARCHAR2(20),
    rating NUMBER(15)
    CREATE type XX_ITEM_TYP as object
    item_name VARCHAR2(20),
    unit_price NUMBER(15),
    quantity NUMBER(15)
    CREATE table XX_PORDER (cust XX_CUST_INFO_TYP, porder XX_ITEM_TYP);
    When i try to access the table X_PORDER in jdev through a database Adapter, i receive the error as
    "some tables contains columns that are not recognized by the database adpter"
    1.) so in this case, how to include such tables that have complex types?
    Also, check out this scenario also..
    1. add a table through a database adapter
    2. drop the table in backend
    3. i can still see the table and its structure in the database adapter wizard even after restarting Jdeveloper.. How is it possible?
    These are some really interesting scenarios to experiment. Please suggest your ideas on this..
    Thanks All!

    Hi Hem,
    for a select you could select against a view. And for inserts you could create a stored procedure. They support complex types since 10.1.2. Complex types support in tables/views was added for 11 (next major release).
    You might be able to use PureSQL as a workaround too, i.e.
    insert into XX_PORDER values (XX_CUST_INFO_TYP(?,?), XX_ITEM_TYP(?, ?, ?))
    As for your other problem, in 10.1.2/10.1.3 the DBAdapter wizard sits on top of the Jdev Offline Tables and TopLink Mapping Workbench components. When you remove a table in the wizard it won't delete the Offline DB component. It was added by the wizard, but afterwards it is public to the entire Jdev project. You must remove it from Jdev yourself. This has been improved for the next major release too, no artifacts from underlying components are created.
    To remove it select:
    Offline DB Objects -> <schema> -> <table> and try File.. Erase From Disk.
    Thanks
    Steve

  • Access to account "Primary Email" is not permuted.  ???

    Can someone help me do whatever needs to be done to stop getting the following iCal error message that I have recently started to get frequently.  Step-by-step help (as if I was a moron) is what works best for me.
    The server responded with an error.
    Access to account 'Primary Email' is not permited.
    The server responded:
    "403"
    to operation
    CalDAVAccountRefreshQueableOperation.

    Please take each of the following steps that you haven't already tried. Stop when the problem is resolved. Back up all data before making any changes.
    Step 1
    Delete the calendar account and add it back. If it's an iCloud account, all you have to do is uncheck and recheck the box marked Calendars & Reminders in the iCloud preference pane.
    Step 2   
    You may be trying to access an invited event that you declined, or one that was rescheduled after you accepted it. The error message should give you a clue as to what it is. If the calendar is on iCloud, you can bring up the Calendar on the website and select
              Show Declined Events
    from the popup menu with the gear icon in the upper right corner of the page. The declined events will appear in gray, and one of them should match what's shown the error message. [Credit for this solution to ASC member Psi.]
    Step 3
    If you get the error when trying to accept an invitation in an email attachment, it's because the organizer didn't properly create the event.
    Step 4
    Follow the instructions in this support article. Modify as necessary for a calendar that's not on iCloud.

  • Concurrent access in Diadem

    How does Dia   dem manages concurrent access?
    If several network users each of them having a floating licence, want to access the same objects (datasets, reports, view layout), can they?
    What happens if they want to load/delete/modify datasets located in the same folder?
    And if they want to write on the same report?
    Thanks

    Hi condor31,
    The only thing which is concurrent is the license file.  The DIAdem installation is still local on the client computer, which means that client A's DIAdem is completely separate from client B's DIAdem, because the two DIAdems are running on completely different computers.  So you don't have to worry about collisions at the REPORT object level at all.  If DIAdem A and DIAdem B attempt to access or update the same external files (layout files, data files, etc.), then the usual file access rules apply.  Both DIAdem A and DIAdem B can load the same layout or data file from computer C, say, and play with them back on computers A and B, respectively.  If DIAdem A then overwrites the layout or data file on computer C with an updated version, DIAdem B doesn't notice, because DIAdem B has those files in memory on computer B.  If DIAdem B subsequently overwrites the layout or data file on computer C, then DIAdem B wins and its version of the file is now on computer C, though DIAdem A doesn't know this has happened.  If you want to protect a particular data or layout file, you can of course set its Windows read-write permissions to read-only, then neither DIAdem A nor DIAdem B will be able to change it, though they will be able to read it and use it and save the edited version to a new data or layout file.
    The one exception to this is if DIAdem A and DIAdem B happen to register-load the same data file, then they each have an implicit link back to the data file on computer C, and neither will be able to change that data file, since register-loading opens the data file read-only and puts a lock on it so that no one can change it while you have it open, but this is a special case.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How does the Concurrent Access License (CAL) work.

    Description from Google: How does the Concurrent Access License (CAL) work? Xcelsius Engage Server CALs allow for concurrent live data updates inside Xcelsius dashboards. Every time an end-user triggers a Web service inside an Xcelsius dashboard to retrieve live data, a CAL is consumed for a period of 5 minutes. For that period, in a five CAL deployment for example, there will be only four CALs left for consumption. A five CAL deployment could support up to 25 users and additional CALs can be added to support a larger deployment.
    My question is as follows:
    How a five CAL deployment could support up to 25 users and what does it mean. In the first line it is saying that each CAL for a web service is consumed for a period of 5 minutes and how come it can support 25 users concurrently. Did it mean 25 web service connections inside a swf flash file or 25 different users to access a single web service through swf flash.

    The "Set cost controls" concurrent program is used in R12 to mass update the cost control fields on item costs.
    The cost control region is found by going to Cost management >Item costs > Item Costs
    The concurrent program lets you specify which items /costs should be updated by using various parameters such as cost type, item range, category range etc.
    And you can specify the source for the new cost control data and the new value for the fields.
    Hope this answers your question,
    Sandeep Gandhi

  • I've forgotten the answers to my security questions, and for some reasons My rescue email is not active now, I can only access to my primary email, I have just redeemed a $25 gift card this morning, I was unable to use the money now. what should I do?

    I've forgotten the answers to my security questions, and for some reasons My rescue email is not active now, I can only access to my primary email, I have just redeemed a $25 gift card this morning, I was unable to use the money now. what should I do?

    You need to ask Apple to reset your security questions; this can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (110676)

Maybe you are looking for

  • Iphone as remote for ipad?

    we download movies onto our ipad and then connect it to the TV so all can watch.  Is there an app that i could use to control the ipad from my iphone (like a remote)? (really so I can be lazy and not get out of my seat).

  • Backup cd wont restore or be recognized by itunes

    Old desktop was crashing and i normally used media player to back up all my music but took a chance and used itunes and it worked to the tune of 22cds.. I bought a new laptop and installed itunes and no prompt came up for restoring library or importi

  • AIA should be part of SOA domain OR OER Domain

    Hi, We are setting up a Clustered environment with 2 Nodes with WebLogic 11g, Oracle SOA suite 11g and AIA for the Customer. In this, I have a question. We are creating two domains soa_domain (with Managed Server soa_server1 in the Node 1 and soa_ser

  • Possible memory leak in forms api 6i

    There appears to be a bug in forms 6i. I am getting an error at the following snippet of code. The Name prints fine and the whole code runs great if i comment out free(v_value), but obviously i would not want to do that. I am using MS VC++ 6.0 compil

  • Budget  Exemption

    Hi , In our Purchase oder we have a net amount for material on which excise duty.cenvat,E cess are paid during the budget check system makes check for the whole amount I want it shuld check only for the net value as the customer is getting modvat aga