one-many relation not synced in L2 cache cluster environement

12 posts, 0 answers
  1. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 23 Apr 2010 Link to this post

    Dear guys,

    this is problem:
    with L2 cache enabled;
    in one application add an orderline to an order;
    in the other application if I read the order, the Lines collection is empty. Why? Where am I wrong?

    I've got this DAL class model:

        [Telerik.OpenAccess.Persistent()] 
        public class Order 
        { 
            IList<OrderLine> lines; 
     
            public IList<OrderLine> Lines { get { return lines; } } 
        } 
     
        [Telerik.OpenAccess.Persistent()] 
        public class OrderLine 
        { 
            Order aggregatedOrder; 
     
            public Order AggregatedOrder { get { return aggregatedOrder; } set { aggregatedOrder = value; } } 
        } 

    Application instance A executes the following code:

     
            private void button1_Click(object sender, EventArgs e) 
            { 
                //add the order 
                using (var scope = ObjectScopeProvider1.GetNewObjectScope()) 
                { 
                    try 
                    { 
                        scope.Transaction.Begin(); 
                        var order = new Order(); 
                        scope.Add(order); 
                        scope.Transaction.Commit(); 
                    } 
                    catch (Exception ex) 
                    { 
                        scope.Transaction.Rollback(); 
                        MessageBox.Show(ex.ToString()); 
                    } 
                } 
            } 
     
            private void button2_Click(object sender, EventArgs e) 
            { 
                //add the orderline to the order 
                using (var scope = ObjectScopeProvider1.GetNewObjectScope()) 
                { 
                    try 
                    { 
                        scope.Transaction.Begin(); 
                        var order = scope.Extent<Order>().FirstOrDefault(); 
                        var orderline = new OrderLine(); 
                        order.Lines.Add(orderline); 
                        scope.Transaction.Commit(); 
                    } 
                    catch (Exception ex) 
                    { 
                        scope.Transaction.Rollback(); 
                        MessageBox.Show(ex.ToString()); 
                    } 
                } 
            } 
     

    Application instance B executes the following code:

     
            private void button4_Click(object sender, EventArgs e) 
            { 
                //read and check data 
                using (var scope = ObjectScopeProvider1.GetNewObjectScope()) 
                { 
                    try 
                    { 
                       Order order = null
                       OrderLine orderline = null
     
                        order = scope.Extent<Order>().FirstOrDefault(); 
                        if (order != null
                            orderline = order.Lines.FirstOrDefault(); 
                        //!!!ordeline results to be NULL, why??? 
     
                    } 
                    catch (Exception ex) 
                    { 
                        MessageBox.Show(ex.ToString());                     
                    } 
                } 
            } 
     






  2. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 24 Apr 2010 Link to this post

    new update:

    if I mark the orderlines field with "defaultfetchgroup" attribute, changes made on one application are reflected to the other one.

    I hope it could help you on helping me to solve this issue.

    regards, stefano.
  3. DevCraft banner
  4. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 24 Apr 2010 Link to this post

    Hi Stefano,

    I guess you are mapping the lines in the Order not as a managed collection. Problem is, that the inverse reference from the detail (OrderLine) to the master (Order) is only maintained, if this setting is given. You can fix that in the forward mapping dialog. 

    Greetings,
    Thomas
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 24 Apr 2010 Link to this post

    Hi Thomas,

    I set the "managed one-many flag' to "true" in the backend configuration. Is that correct?
  6. Serge
    Admin
    Serge avatar
    375 posts

    Posted 26 Apr 2010 Link to this post

    Hello Stefano Cadò,

    If you set the "Managed one-to-many" option in the background configuration, this value will be considered as default for all collections. If you however want only this collection to be managed, or a subset of collections for that matter, you can do so by opening up the Forward Mapping Wizard, selecting the desired collection and checking the Manage Collection checkbox. You can see the option on the attached screenshot.

    Hope this helps.

    All the best,
    Serge
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 27 Apr 2010 Link to this post

    Ok thank you Serge.

    So, coming back to the L2 sync problem.

    I enable performance counters. The in-process L2 cache work correctly, but in case of several processes cache is cleared only in the process that commits the changes, the others not.

    Maybe there is something wrong on configuring the cluster, so I post my config:
    <?xml version="1.0"?> 
    <configuration> 
      <configSections> 
        <section name="openaccess" type="Telerik.OpenAccess.Config.ConfigSectionHandler, Telerik.OpenAccess.Config, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342" requirePermission="false" /> 
      </configSections> 
      <openaccess xmlns="http://www.telerik.com/OpenAccess"
        <references /> 
        <connections> 
          <connection id="DatabaseConnection1"
            <databasename>L2Test</databasename> 
            <servername>(local)\SQLEXPRESS</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname> 
          </connection> 
        </connections> 
        <backendconfigurations> 
          <backendconfiguration id="mssqlConfiguration" backend="mssql"
            <mappingname>mssqlMapping</mappingname> 
            <managedOneToMany>True</managedOneToMany> 
            <l2CacheEnabled>True</l2CacheEnabled> 
            <l2QueryCacheEnabled>True</l2QueryCacheEnabled> 
            <l2CacheClusterTransport>MSMQ</l2CacheClusterTransport> 
            <l2CacheClusterTransport.multicastaddr>224.1.1.2:666</l2CacheClusterTransport.multicastaddr> 
            <l2CacheClusterTransport.localpath>l2test</l2CacheClusterTransport.localpath> 
            <performanceCounter>true</performanceCounter> 
          </backendconfiguration> 
        </backendconfigurations> 
        <mappings current="mssqlMapping"
          <mapping id="mssqlMapping"
            <namespace name="L2Test"
              <class name="Order"
                <extension key="db-table-name" value="order" /> 
                <extension key="db-key-generator" value="AUTOINC" /> 
                <field name="orderLines"
                  <collection> 
                    <extension key="inverse" value="aggregatedOrder" /> 
                  </collection> 
                </field> 
              </class> 
              <class name="OrderLine"
                <extension key="db-key-generator" value="AUTOINC" /> 
              </class> 
            </namespace> 
          </mapping> 
        </mappings> 
      </openaccess> 
    </configuration> 

    I also install MSMQ components as indicated in the guide; I also change the registry too. Windows Firewall is completely disabled.
    I'm testing L2 Cluster on the same PC with two instances of the same application.

    Best Regards, Stefano.
  8. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 27 Apr 2010 Link to this post

    I look into MMC MSMQ snap-in.
    A private queue "l2test" has been created and when changes are commited a new message appear in the private queue, so it seems to be working but the other process (a new instance of the same exe) seems to be not notified of that.
    The message remains in the queue: this means that is not read?
  9. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 28 Apr 2010 Link to this post

    Hello Stefano,

    I think you will need to have separate name for the localpath in both instances. We tried to use names that included the process id, but you will end up with lots of queues... therefore a fixed name schema was choosen and you must make the name unique for each database instance. The same logical database used by two processes requires then two different names. 

    Greetings,
    Thomas
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 28 Apr 2010 Link to this post

    Hello Thomas,

    I remove
    <l2CacheClusterTransport.localpath>l2test</l2CacheClusterTransport.localpath> 
     
    settings from the app.config.

    This makes OA to generate two different queues as you say. That's right. Looking into MMC, now I'll see the message replicated correctly between sides but, the L2 cache is not cleared, the evict mechanism is still not working.

    Any other suggestion that could help me to solve this issue?
    I need to solve it because it is very important in a project that I am deploying.

    Best regards, Stefano.
  11. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 29 Apr 2010 Link to this post

    I post you some debug info from the debug output if it could help.

    Telerik.OpenAccess Information: 45 : driver.stat.execUpdate     46104728 UPDATE [order] SET [numbr]=?, [voa_version]=? WHERE [order_id] = ? AND [voa_version]=?
    Telerik.OpenAccess Information: 46 : driver.con.commit          46104728
    Telerik.OpenAccess Information: 47 : driver.pool.release        active=0/10 idle=2/10 con=46104728
    Telerik.OpenAccess Verbose: 0 : ClusterSend id=c0d3000c-7ffa-4d11-adbb-c33a1a154f33\6198 df2293c8-38a9-49ca-b8e9-55ff39bdcf1a

    As you see the application correctly send the message but in the log I never see something like "cluster receive"



  12. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 29 Apr 2010 Link to this post

    Hello Stefano,

    ok, that indicates the server was sending. Where is the multicast message? Did you see some message in the two queues that you should have now? And yes, you should see a ClusterReceive on the other side if it configured for the same amount of logging. Did you use now an empty setting for the local path? Can you use two fixed settings for that so it becomes easier to diagnose things?

    Best wishes,
    Thomas
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  13. codicezerouno
    codicezerouno avatar
    22 posts
    Member since:
    Feb 2009

    Posted 08 May 2010 Link to this post

    Hi Thomas,

    sorry for late response. I found and solve the problem.

    The problem is solved by the latest internal build "Telerik.OpenAccess_2010_1_0414_3_dev": L2 Cache Synchronization failure - The L2 cache synchronization using MSMQ fails immediately due to a timeout exception.

    Infact lookin into the source code, the code failed on timeout when there are no message in the queue. The latest internal build solve this inconvenient.

    Thanks and best regards.
Back to Top
DevCraft banner