ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Murthy Kakarlamudi <ksa...@gmail.com>
Subject Re: SQLServer Persistence Store Error
Date Mon, 04 Apr 2016 14:53:10 GMT
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 <ptupitsyn@gridgain.com>
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 <ksatya@gmail.com>
> 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 <ptupitsyn@gridgain.com>
>> 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 <ksatya@gmail.com>
>>> 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 <ptupitsyn@gridgain.com>
>>>> 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 <ksatya@gmail.com>
>>>>> 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 <
>>>>>> ptupitsyn@gridgain.com> 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 <ksatya@gmail.com
>>>>>>> > 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 <
>>>>>>>> ksatya@gmail.com> 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=-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.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Mime
View raw message