SQLServer Persistence Store Error

classic Classic list List threaded Threaded
19 messages Options
ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

SQLServer Persistence Store Error

Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.
ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.

Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.


ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.



Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.




ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.





Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.






ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.







Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.








ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.









Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.










ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Oh ok...will try that option. Sure, will send you the zipped copy of my solution for you to investigate further. Thanks much for your help.

Satya,

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.











ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

In reply to this post by Pavel Tupitsyn
Hi Pavel,
   I am not able to send the solution zip in gmail. It is blocking as the zip file contains executables. Can you please check if you can download the solution from the below location:


Thanks,
Murthy.

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.











ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Hi Pavel,
   I was playing around with different options and once I specified [Serializable] annotation at the entity class level, I was able to successfully insert into cache. With this setting LoadCache() method is working as well. Not sure if this is the right approach. I will not prefer this as this needs an update to a auto-generated class and any subsequent updates might overide the manual settings.

On a separate note, is there a way I can query the cache using sql console. In java, I can set IGNITE_H2_DEBUG_CONSOLE to query the cache. Wondering if there is an equivalent on .NET side.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 8:08 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I am not able to send the solution zip in gmail. It is blocking as the zip file contains executables. Can you please check if you can download the solution from the below location:


Thanks,
Murthy.

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.












Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Satya, zip file downloaded fine, I'll investigate it and get to you later.

Regarding [Serializable]: cached objects in Ignite are serialized and sent over the network. 
So your entities should be set up for serialization, one way or another, see details: https://apacheignite-net.readme.io/docs/serialization
It is possible to serialize auto-generated classes without modifying them, by providing them in BinaryConfiguration. I'll check attached code and see if it works.

IGNITE_H2_DEBUG_CONSOLE: just add the following line anywhere before Ignition.Start: Environment.SetEnvironmentVariable("IGNITE_H2_DEBUG_CONSOLE""true");

Pavel.

On Tue, Apr 5, 2016 at 7:16 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I was playing around with different options and once I specified [Serializable] annotation at the entity class level, I was able to successfully insert into cache. With this setting LoadCache() method is working as well. Not sure if this is the right approach. I will not prefer this as this needs an update to a auto-generated class and any subsequent updates might overide the manual settings.

On a separate note, is there a way I can query the cache using sql console. In java, I can set IGNITE_H2_DEBUG_CONSOLE to query the cache. Wondering if there is an equivalent on .NET side.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 8:08 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I am not able to send the solution zip in gmail. It is blocking as the zip file contains executables. Can you please check if you can download the solution from the below location:


Thanks,
Murthy.

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.













Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

I have tested the attached solution. Everything works fine.
You just have to add BusinessUnit to the BinaryConfiguration:
var cfg = new IgniteConfiguration
{
    SpringConfigUrl = @"config\ignite.xml",
    JvmOptions = new List<string> {"-Xms512m""-Xmx1024m"},
    BinaryConfiguration =
        new BinaryConfiguration
        {
            TypeConfigurations = new[] {new BinaryTypeConfiguration(typeof (BusinessUnit))}
        }
};
Let me know if this works for you.
Pavel.

On Tue, Apr 5, 2016 at 10:30 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, zip file downloaded fine, I'll investigate it and get to you later.

Regarding [Serializable]: cached objects in Ignite are serialized and sent over the network. 
So your entities should be set up for serialization, one way or another, see details: https://apacheignite-net.readme.io/docs/serialization
It is possible to serialize auto-generated classes without modifying them, by providing them in BinaryConfiguration. I'll check attached code and see if it works.

IGNITE_H2_DEBUG_CONSOLE: just add the following line anywhere before Ignition.Start: Environment.SetEnvironmentVariable("IGNITE_H2_DEBUG_CONSOLE""true");

Pavel.

On Tue, Apr 5, 2016 at 7:16 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I was playing around with different options and once I specified [Serializable] annotation at the entity class level, I was able to successfully insert into cache. With this setting LoadCache() method is working as well. Not sure if this is the right approach. I will not prefer this as this needs an update to a auto-generated class and any subsequent updates might overide the manual settings.

On a separate note, is there a way I can query the cache using sql console. In java, I can set IGNITE_H2_DEBUG_CONSOLE to query the cache. Wondering if there is an equivalent on .NET side.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 8:08 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I am not able to send the solution zip in gmail. It is blocking as the zip file contains executables. Can you please check if you can download the solution from the below location:


Thanks,
Murthy.

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.














ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Hi Pavel...Yes the solution you suggested is working. Thanks so much for your help.

Regarding my other question, is there a way to query the cache other than writing a client node? Something similar to IGNITE_H2_DEBUG_CONSOLE on java side?



On Tue, Apr 5, 2016 at 4:53 AM, Pavel Tupitsyn <[hidden email]> wrote:
I have tested the attached solution. Everything works fine.
You just have to add BusinessUnit to the BinaryConfiguration:
var cfg = new IgniteConfiguration
{
    SpringConfigUrl = @"config\ignite.xml",
    JvmOptions = new List<string> {"-Xms512m""-Xmx1024m"},
    BinaryConfiguration =
        new BinaryConfiguration
        {
            TypeConfigurations = new[] {new BinaryTypeConfiguration(typeof (BusinessUnit))}
        }
};
Let me know if this works for you.
Pavel.

On Tue, Apr 5, 2016 at 10:30 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, zip file downloaded fine, I'll investigate it and get to you later.

Regarding [Serializable]: cached objects in Ignite are serialized and sent over the network. 
So your entities should be set up for serialization, one way or another, see details: https://apacheignite-net.readme.io/docs/serialization
It is possible to serialize auto-generated classes without modifying them, by providing them in BinaryConfiguration. I'll check attached code and see if it works.

IGNITE_H2_DEBUG_CONSOLE: just add the following line anywhere before Ignition.Start: Environment.SetEnvironmentVariable("IGNITE_H2_DEBUG_CONSOLE""true");

Pavel.

On Tue, Apr 5, 2016 at 7:16 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I was playing around with different options and once I specified [Serializable] annotation at the entity class level, I was able to successfully insert into cache. With this setting LoadCache() method is working as well. Not sure if this is the right approach. I will not prefer this as this needs an update to a auto-generated class and any subsequent updates might overide the manual settings.

On a separate note, is there a way I can query the cache using sql console. In java, I can set IGNITE_H2_DEBUG_CONSOLE to query the cache. Wondering if there is an equivalent on .NET side.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 8:08 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I am not able to send the solution zip in gmail. It is blocking as the zip file contains executables. Can you please check if you can download the solution from the below location:


Thanks,
Murthy.

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.















Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Please see my reply above. Yes, you can set IGNITE_H2_DEBUG_CONSOLE environment variable to open the console from .NET.

On Tue, Apr 5, 2016 at 1:32 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Yes the solution you suggested is working. Thanks so much for your help.

Regarding my other question, is there a way to query the cache other than writing a client node? Something similar to IGNITE_H2_DEBUG_CONSOLE on java side?



On Tue, Apr 5, 2016 at 4:53 AM, Pavel Tupitsyn <[hidden email]> wrote:
I have tested the attached solution. Everything works fine.
You just have to add BusinessUnit to the BinaryConfiguration:
var cfg = new IgniteConfiguration
{
    SpringConfigUrl = @"config\ignite.xml",
    JvmOptions = new List<string> {"-Xms512m""-Xmx1024m"},
    BinaryConfiguration =
        new BinaryConfiguration
        {
            TypeConfigurations = new[] {new BinaryTypeConfiguration(typeof (BusinessUnit))}
        }
};
Let me know if this works for you.
Pavel.

On Tue, Apr 5, 2016 at 10:30 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, zip file downloaded fine, I'll investigate it and get to you later.

Regarding [Serializable]: cached objects in Ignite are serialized and sent over the network. 
So your entities should be set up for serialization, one way or another, see details: https://apacheignite-net.readme.io/docs/serialization
It is possible to serialize auto-generated classes without modifying them, by providing them in BinaryConfiguration. I'll check attached code and see if it works.

IGNITE_H2_DEBUG_CONSOLE: just add the following line anywhere before Ignition.Start: Environment.SetEnvironmentVariable("IGNITE_H2_DEBUG_CONSOLE""true");

Pavel.

On Tue, Apr 5, 2016 at 7:16 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I was playing around with different options and once I specified [Serializable] annotation at the entity class level, I was able to successfully insert into cache. With this setting LoadCache() method is working as well. Not sure if this is the right approach. I will not prefer this as this needs an update to a auto-generated class and any subsequent updates might overide the manual settings.

On a separate note, is there a way I can query the cache using sql console. In java, I can set IGNITE_H2_DEBUG_CONSOLE to query the cache. Wondering if there is an equivalent on .NET side.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 8:08 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I am not able to send the solution zip in gmail. It is blocking as the zip file contains executables. Can you please check if you can download the solution from the below location:


Thanks,
Murthy.

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.
















ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: SQLServer Persistence Store Error

Ohh..missed that..sorry...thanks for the clarification.

On Tue, Apr 5, 2016 at 7:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
Please see my reply above. Yes, you can set IGNITE_H2_DEBUG_CONSOLE environment variable to open the console from .NET.

On Tue, Apr 5, 2016 at 1:32 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Yes the solution you suggested is working. Thanks so much for your help.

Regarding my other question, is there a way to query the cache other than writing a client node? Something similar to IGNITE_H2_DEBUG_CONSOLE on java side?



On Tue, Apr 5, 2016 at 4:53 AM, Pavel Tupitsyn <[hidden email]> wrote:
I have tested the attached solution. Everything works fine.
You just have to add BusinessUnit to the BinaryConfiguration:
var cfg = new IgniteConfiguration
{
    SpringConfigUrl = @"config\ignite.xml",
    JvmOptions = new List<string> {"-Xms512m""-Xmx1024m"},
    BinaryConfiguration =
        new BinaryConfiguration
        {
            TypeConfigurations = new[] {new BinaryTypeConfiguration(typeof (BusinessUnit))}
        }
};
Let me know if this works for you.
Pavel.

On Tue, Apr 5, 2016 at 10:30 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, zip file downloaded fine, I'll investigate it and get to you later.

Regarding [Serializable]: cached objects in Ignite are serialized and sent over the network. 
So your entities should be set up for serialization, one way or another, see details: https://apacheignite-net.readme.io/docs/serialization
It is possible to serialize auto-generated classes without modifying them, by providing them in BinaryConfiguration. I'll check attached code and see if it works.

IGNITE_H2_DEBUG_CONSOLE: just add the following line anywhere before Ignition.Start: Environment.SetEnvironmentVariable("IGNITE_H2_DEBUG_CONSOLE""true");

Pavel.

On Tue, Apr 5, 2016 at 7:16 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I was playing around with different options and once I specified [Serializable] annotation at the entity class level, I was able to successfully insert into cache. With this setting LoadCache() method is working as well. Not sure if this is the right approach. I will not prefer this as this needs an update to a auto-generated class and any subsequent updates might overide the manual settings.

On a separate note, is there a way I can query the cache using sql console. In java, I can set IGNITE_H2_DEBUG_CONSOLE to query the cache. Wondering if there is an equivalent on .NET side.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 8:08 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   I am not able to send the solution zip in gmail. It is blocking as the zip file contains executables. Can you please check if you can download the solution from the below location:


Thanks,
Murthy.

On Mon, Apr 4, 2016 at 11:09 AM, Pavel Tupitsyn <[hidden email]> wrote:
LoadCache arguments are serialized and passed over network. Cache instance can't be used as a LoadCache argument.
Please try to do a cache put directly in the main method:
            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.Put(1, entities.CustomTransactionsDetails.First());
            }

I suspect there is an issue with serializing CustomTransactionsDetail instances.
Entity Framework POCO proxies can't be serialized by Ignite automatically.
You have to either disable proxies (https://msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx), or implement IBinarizable with manual serialization.

If you send me your whole solution in a zip file, I'll be able to investigate further.

Thanks,

Pavel.

On Mon, Apr 4, 2016 at 5:53 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    I was trying to do that before and ran into issues passing cache object to my CacheAdapter implementation which is in a different dll. Can you please help where I went wrong:

In my main program, I was passing cache in LoadCache method:
using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                cache.LoadCache(null,cache);
                Console.WriteLine(">> Organization Cache Size: " + cache.GetSize());
                Console.ReadLine();
            }

In my CacheStoreAdapter implementation, I tried to access Cache as below:

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                ICache cache = (ICache)args[0]; // Throwing an error here.
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0} {1}", entry.CustomTransDetailID, entry);
                    //act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

On Mon, Apr 4, 2016 at 8:26 AM, Pavel Tupitsyn <[hidden email]> wrote:
Instead of LoadCache, can you try a simple cache put and see what happens?

cache[1] = new CustomTransactionsDetail();

and with entity from EF:

cache[2] = entities.CustomTransactionsDetails.First();

Pavel.

On Mon, Apr 4, 2016 at 3:20 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Sorry....attached the wrong version. Below is the full entity class and the CacheStore implementation.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string InstrumentTypeName { get; set; }
        public string InstrumentTypeShortName { get; set; }
        public string DealType { get; set; }
        public string PutCall { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> Comodity1Month { get; set; }
        public Nullable<System.DateTime> Comodity2Month { get; set; }
        public Nullable<double> Asset1 { get; set; }
        public Nullable<double> Asset2 { get; set; }
        public Nullable<long> QtyAsset1 { get; set; }
        public Nullable<long> QtyAsset2 { get; set; }
        public Nullable<double> StrikePrice { get; set; }
        public Nullable<double> RiskFreeRate { get; set; }
        public Nullable<double> CostOfCarry1 { get; set; }
        public Nullable<double> CostOfCarry2 { get; set; }
        public Nullable<double> VolatilityAsset1 { get; set; }
        public Nullable<double> VolatilityAsset2 { get; set; }
        public Nullable<double> FixedPrice { get; set; }
        public Nullable<int> BUID { get; set; }
        public Nullable<int> PortfolioID { get; set; }
        public Nullable<int> StrategyID { get; set; }
        public Nullable<int> CPID { get; set; }
        public Nullable<int> TraderID { get; set; }
        public Nullable<int> InsTypeID { get; set; }
        public string ListOfAllIndexText { get; set; }
        public Nullable<System.DateTime> MvStartMonth { get; set; }
        public string SourceSysName { get; set; }
        public Nullable<System.DateTime> EndOfDayDate { get; set; }
        public Nullable<int> DealSideGPID { get; set; }
        public Nullable<int> ProfileID { get; set; }
        public Nullable<int> InstrumentSeqNo { get; set; }
        public Nullable<int> InstrumentSourceID { get; set; }
        public string EventSourceName { get; set; }
        public string CFlowTypeID { get; set; }
        public string RTStatName { get; set; }
        public string TranStatName { get; set; }
        public Nullable<long> SequenceNo { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public Nullable<double> LTD_PNL { get; set; }
    }
}

 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            try {
                var customTxnDetailsList = entities.CustomTransactionsDetails;
                // Iterate over whole underlying store and call act on each entry to load it into the cache.
                foreach (CustomTransactionsDetail entry in customTxnDetailsList)
                {
                    Console.WriteLine("Adding to cache: {0}", entry.CustomTransDetailID);
                    act(entry.CustomTransDetailID, entry);

                }
            }catch(Exception e)
            {
                Console.WriteLine("Exception is {0}", e);
            }
           
        }

static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\config\ignite.xml",
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            //Ignition.ClientMode = true;
            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, CustomTransactionsDetail>(null);
                
                cache.LoadCache(null);
                
                Console.ReadLine();
            }


            Console.ReadLine();
        }

There are no other parts to these files. These POCOs are generated by Entity Framework. Please let me know if you need additional information.

Satya.

On Mon, Apr 4, 2016 at 8:11 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

In your code above there is "act(entry.personDetailID, entry);",
but there is no personDetailID member in the CustomTransactionsDetail class. 
Are you sure this is the correct one? Also, it is a partial class - are there any parts in other files?

Can you attach full source code of your application?

Thanks,
Pavel.

On Mon, Apr 4, 2016 at 2:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Below is my entity. I am not doing any serialization currently while storing in the cache.

namespace MyIgnite
{
    using System;
    using System.Collections.Generic;
    
    public partial class CustomTransactionsDetail
    {
        public Nullable<int> TransactionID { get; set; }
        public string TypeName { get; set; }
        public Nullable<System.DateTime> Expiry { get; set; }
        public string Side { get; set; }
        public Nullable<System.DateTime> TimeStamp { get; set; }
        public Nullable<int> CustomTransHeaderID { get; set; }
        public int CustomTransDetailID { get; set; }

    }
}

Thanks,
Satya.

On Mon, Apr 4, 2016 at 7:50 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya,

Looks like exception comes from your entity member(s) during serialization.

Can you please attach your entity class code?
* Does it have any navigation properties that may cause SQL queries?
* How do you serialize it in Ignite? (Do you implement IBinarizable?)

Thanks,

Pavel.



On Mon, Apr 4, 2016 at 2:13 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Thanks for your response. I stepped through the LoadCache method in debug mode and noticed that it is failing at the act() method. Below is my code for LoacCache.

public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }

I can see the statement: "Adding to cache: " in the node output and the control hangs at the next line executing the "act" method and then it throws SQLException Timeout. Not sure why the "act" method is taking so much time to store the entries in cache.

For testing, I commented out "act" statement and the program completed looping through all the entries returned by Entity Framework without any errors.

Thanks,
Satya.

On Mon, Apr 4, 2016 at 4:40 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
This is an SQL exception. Please make sure that your entity connection works.
You can set a breakpoint on the first line of LoadCache method, step over your code and see what happens. Or wrap it in try-catch block.

Meanwhile, looks like cache store error messages are not very informative. 
I've added a Jira ticket, we'll fix it shortly: https://issues.apache.org/jira/browse/IGNITE-2943

Thank you,

Pavel

On Mon, Apr 4, 2016 at 7:07 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hello all,
   I was able to resolve the error I posted above. I had to basically add the relevant EntityFramwork references in the solution that runs my Ignite server node. After successfully creating the cache, however I am running into the below timeout issue:

[00:02:37] Ignite node started OK (id=cf8c5e00)
[00:02:37] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=0.89GB]
>>> Cache query example started
Adding to cache: 228505
[00:03:10,524][SEVERE][pub-#10%null%][GridJobWorker] Failed to execute job [jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, dep=LocalDeployment [super=GridDeployment [ts=1459742547098, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, clsLdrId=a9c9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, userVer=0, loc=true, sampleClsName=java.lang.String, pendingUndeploy=false, undeployed=false, usage=0]], taskClsName=o.a.i.i.processors.cache.GridCacheAdapter$LoadCacheClosure, sesId=acc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34, startTime=1459742557568, endTime=9223372036854775807, taskNodeId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=cf8c5e00-c86f-4e58-b0ad-6754896baf34, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1459742557584, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]], jobId=bcc9f6fd351-cf8c5e00-c86f-4e58-b0ad-6754896baf34]]
class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
        at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792

Apache.Ignite.Core.Cache.Store.CacheStoreException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=class org.apache.ignite.IgniteException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutLong(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
       at Apache.Ignite.Core.Impl.PlatformTarget.DoOutOp(Int32 type, Action`1 action)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

From my main program, I am making below call:
 cache.LoadCache(null);

In my store implementation I have the following overide method:
 public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.personDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                Console.WriteLine("Adding to cache: " + entry.personDetailID);
                act(entry.personDetailID, entry);
                
            }
           
        }


thanks in advance for your help...

Satya.


On Sat, Apr 2, 2016 at 11:49 AM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi,
   In my .NET application, I have an underlying SQL Server DB that I am planning to access using Ignite Persistence feature. I was following the StoreExample provided in the examples and created the ignite configuration accordingly. 

<property name="cacheConfiguration">
        <list>
          <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="writeThrough" value="true"/>
            <property name="readThrough" value="true"/>
            <property name="cacheStoreFactory">
              <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="typeName" value="MyIgnite.SQLServerStore, MyIgnite"/>
              </bean>
            </property>
          </bean>
        </list>
      </property>

My SQLServerStore which is part of MyIgnite dll is as below. I am using EntityFramework as ORM to access underlying SQLServer.

class SQLServerStore : CacheStoreAdapter
    {
        private TestEntities entities;
        public SQLServerStore()
        {
            entities = new TestEntities();
        }

        /// <summary>
        /// Loads all values from underlying persistent storage.
        /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
        /// </summary>
        /// <param name="act">Action that loads a cache entry.</param>
        /// <param name="args">Optional arguments.</param>
        public override void LoadCache(Action<object, object> act, params object[] args)
        {
            var personDetailsList = entities.PersonDetails;
            // Iterate over whole underlying store and call act on each entry to load it into the cache.
            foreach (personDetail entry in personDetailsList)
            {
                act(entry.personD, entry);
            }
           
        }
}

Whwn I try to run the above, I am getting the below error.

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Exception has been thrown by the target of an invocation.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
       at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
       at MyIgniteConsole.Program.Main(String[] args) in C:\Data\Professional\dotnet\workspace\MyIgnite\MyIgniteConsole\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Any help would be appreciated.

Thanks,
Satya.