Re: Does equals method have relevance in Custom Key Class

2018-06-04 Thread the_palakkaran
The SQL queries are not getting me performance that I want. So I was trying
for alternative methods to handle the same using get. 

Like getting the data using cache.get() and filtering them with the sql
operations that I actually wanted to do.

Suppose I have an equals method which will have two return cases working
based on a field value "Y" or "N". So there are basically two cases in
equals which will get executed based on the field value. That way I can get
results differently, right?

for example in a customer key class, I have a customer id and a customer
number fields. In my equals method I have something like this:

if("Y".equals(field))
return (null != this.custNo && null != custNo &&
this.custNo.compareTo(CustomerMaster.custNo) == 0)
else
return (null != this.custId && null != custId &&
this.custId.compareTo(CustomerMaster.custId) == 0)

This would fetch me records differently, right?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Apache Flink Sink + Ignite: Ouch! Argument is invalid

2018-06-04 Thread Saikat Maitra
Hi,

When Ignite Sink Data Streamer start it checks if the cache name is already
present in the grid before the streaming process can begin.

Can you please confirm if cache got created before data sink process get
executed

Regards,
Saikat

On Mon, Jun 4, 2018 at 9:24 PM, Ray  wrote:

> I think it's a code bug in flink sink.
> I had this same problem some time ago.
> I think it's caused by compiler optimization of variable initialization in
> multi thread environment(flink cluster mode).
> In this case, the variable "cacheName" is not initialized when being used
> because compile will optimize the variable initialize order in multi thread
> environment.
>
> I have created the ticket in jira and assigned to the author of flink sink.
>
> https://issues.apache.org/jira/browse/IGNITE-8697
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Doubts regarding using externalizable in model classes

2018-06-04 Thread the_palakkaran
I have 3 doubts, 

1. My model classes are externalizable. Still they can be queried using
SQLFieldsQuery at server node without any problem right?

2. Externalizable items cannot be queried from a client node in remote,
right? Is there a way to make it happen at client ?

3. Are there any other limitations using externalizable or any performance
concerns?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: While using Externalizable, possible to do SQLFieldsQuery, but not cache.get()

2018-06-04 Thread the_palakkaran
Sorry, the problem was that I had a wrong hash code implementation. Now when
I implemented it correctly, this works fine.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Session.removeAttribute is not working as expected

2018-06-04 Thread Roman Guseinov
Hi,

Thanks for the sample project. I will take a look.

Best Regards,
Roman



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Session.removeAttribute is not working as expected

2018-06-04 Thread Dana Shaw
Thanks for the response!

Session.removeattibute is not removing the attributes, its just setting the 
value to null.  

Sample project: https://github.com/daynok/ignite-webapp

I've seen this behavior in both java 9 and 10.  

I will try java 8 and and see if that fixes things. 

Thanks again!

- Original Message -
From: Roman Guseinov 
To: user@ignite.apache.org
Sent: Sun, 03 Jun 2018 21:48:43 -0700 (PDT)
Subject: Re: Session.removeAttribute is not working as expected

Hi,

1. Could you please clarify what exactly doesn't work as expected? Does
session.attributeNames() result include removed attributes?

2. JAVA_HOME=/opt/java/jdk-10.0.1 - I'm not sure that Apache Ignite was
tested on Java 10. Could you try to reproduce the issue on JDK8?

3. Could you share a reproducer - simple project on GitHub?

Best Regards,
Roman



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/



Re: Apache Flink Sink + Ignite: Ouch! Argument is invalid

2018-06-04 Thread Ray
I think it's a code bug in flink sink.
I had this same problem some time ago.
I think it's caused by compiler optimization of variable initialization in
multi thread environment(flink cluster mode).
In this case, the variable "cacheName" is not initialized when being used
because compile will optimize the variable initialize order in multi thread
environment.

I have created the ticket in jira and assigned to the author of flink sink.

https://issues.apache.org/jira/browse/IGNITE-8697



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Affinity colocation and sql queries

2018-06-04 Thread Denis Magda
Hi Stephane,

Affinity collocation and affinity keys are crucial concepts/APIs to make
SQL JOINs work really fast. Similar concepts are adopted in other
distributed databases like Google Spanner, MemSQL, VoltDB, etc.

This page should shed more light on your question:
https://apacheignite-sql.readme.io/docs/distributed-joins#collocated-joins

This recording might be useful as well:
https://www.gridgain.com/resources/webinars/in-memory-computing-essentials-architects-and-developers-part-2

You can define the affinity key using CREATE TABLE command or
[SqlQueryField] annotation depending on a way you configure caches/tables.

--
Denis

On Sun, Jun 3, 2018 at 1:47 AM, Stéphane Gayet  wrote:

> Hi All,
>
>
> I'm not sure to have well-understood Ignite affinity colocation. I have
> several questions.
>
>
> 1/ Does sql queries benefit from affinity colocation?
>
>
> 2/ The use case is an sql query like :
>
> SELECT SUBSET1.KEY AS SET1_KEY, SUBSET2.KEY AS SET2_KEY
>
> FROM WHOLESET AS SUBSET1, WHOLESET AS SUBSET2
>
> WHERE SUBSET1.KEY = "key1" AND SUBSET2.KEY = "key2" AND (some other
> conditions)
>
>
> I know that items with keys "key1" and "key2" will be crossed together
> almost all the time and I plan to define an affinity key so:
>
> - items with "key1" and "key2" => affinity key 1
>
> - items with "key3" and "key4" => another affinity key
>
> and so on...
>
>
> Does this work and will speed up the request?
>
>
> 3/ If I define an affinity key on an object, should the field marked also
> as [SqlQueryField] although it will not be part of the sql query? If yes,
> should it be indexed?
>
> 4/ Or, this doesn't work but it will if I split each subset in different
> caches and define affinity key as above.
>
> cache1 = subset items with key "key1"
> cache2 = subset items with key "key2"
> ...
>
>
> 5/ Or, nope, there is no way to achieve that.
>
>
> Regards,
>
> Stéphane Gayet
>
>
>


Re: Does equals method have relevance in Custom Key Class

2018-06-04 Thread vkulichenko
Ignite stores data in binary form and has its own algorithms for
hashCode/equals that are based on binary representation to avoid
deserialization. Therefore overriding equals would not have any affect.

Actually, I'm not sure I understand why you want to override it in the first
place. The following example is confusing:

> For eg:  A custom key has an equals method that checks for a field to be
> equal to 0 and for another key has an equals method that checks for a
> field
> to be equal to 1. 

You should compare two different objects for equality rather than comparing
different objects' fields with particular values. Can you clarify this?

-Val



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: NPE from the native persistence enable node

2018-06-04 Thread ilya.kasnacheev
Hello!

Yes, you should be able to do that by specifying WITH "VALUE_TYPE=..."
Look it up on readme.io:
https://apacheignite-sql.readme.io/docs/create-table

Regards,



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: While using Externalizable, possible to do SQLFieldsQuery, but not cache.get()

2018-06-04 Thread Evgenii Zhuravlev
Hi,

Can you share the full reproducer?

Thanks,
Evgenii

2018-06-04 15:10 GMT+03:00 the_palakkaran :

> Hi,
>
> I have both my Key and Model classes implementing Externalizable. I am able
> to put data into it correctly and also to do SQLFieldsQuery on it
> successfully. But when I use the same cache object to get value by passing
> a
> Key, it always returns null.
>
> Why does this happen?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Ignore: Compilation error 2.5.0: class Not found Taglet @ ignite-tools =>Sorry

2018-06-04 Thread Carsten

Hi all,

it is an openjdk issue -> my fault


have a great day



Compilation error 2.5.0: class Not found Taglet @ ignite-tools

2018-06-04 Thread Carsten

Hello all,

I am trying to compile 2.5.0 from the source using jdk 1.8-172:

Using the command:

|mvn clean package -DskipTests

I get the following error while compiling the ignite-tools:
|

[ERROR] 
/opt/ignite/apache-ignite-2.5.0-src/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java:[100,9] 
cannot find symbol

  symbol:   class Taglet
  location: class org.apache.ignite.tools.javadoc.IgniteLinkTaglet
[ERROR] 
/opt/ignite/apache-ignite-2.5.0-src/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java:[119,5] 
method does not override or implement a method from a supertype
[ERROR] 
/opt/ignite/apache-ignite-2.5.0-src/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java:[161,5] 
method does not override or implement a method from a supertype

[INFO] 13 errors
[INFO] -
[INFO] 


[INFO] Reactor Summary:
[INFO]
[INFO] ignite-apache-license-gen .. SUCCESS [  
0.634 s]
[INFO] ignite-tools ... FAILURE [  
1.004 s]




Am I missing a library?

I'd appreciate your help.

Thanks,

Carsten



Re: code hangs up on cache().removeAll(set) operation

2018-06-04 Thread Mikael

Hi!

Any chance you might have other putAll/removeAll that have the same 
entries but in different order ? putAll not using some ordered set can 
cause deadlocks, not sure if this can happen for removeAll also, what 
kind of set are you using ?


Mikael


Den 2018-06-04 kl. 15:18, skrev akash shinde:

Hi,

My application hangs up when I execute following code. I tried to 
debug the ignite source code but no luck.  Complete thread dump is 
attached in this mail.


*/cache().removeAll(set)/*
*/
/*
*/Can someone please advise?
/*
*/
/*
*/Thread dump is as follows./*

Name: local-task-pool-0
State: WAITING
Total blocked: 0  Total waited: 1

Stack trace:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:304)
org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:177)
org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:140)
org.apache.ignite.internal.processors.cache.GridCacheAdapter$39.inOp(GridCacheAdapter.java:3011)
org.apache.ignite.internal.processors.cache.GridCacheAdapter$SyncInOp.op(GridCacheAdapter.java:5076)
org.apache.ignite.internal.processors.cache.GridCacheAdapter.syncOp(GridCacheAdapter.java:4088)
org.apache.ignite.internal.processors.cache.GridCacheAdapter.removeAll0(GridCacheAdapter.java:3004)
org.apache.ignite.internal.processors.cache.GridCacheAdapter.removeAll(GridCacheAdapter.java:2993)
org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.removeAll(IgniteCacheProxyImpl.java:1254)
org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.removeAll(GatewayProtectedCacheProxy.java:1166)
com.qualys.agms.grid.dao.AbstractDataGridDAO.removeAll(AbstractDataGridDAO.java:61)
com.qualys.agms.grid.dataservice.DefaultDataGridService.removeAll(DefaultDataGridService.java:47)
com.qualys.agms.task.local.RemoveIPsFromAssetGroupTaskV1.removeIpsFromAssetGroup(RemoveIPsFromAssetGroupTaskV1.java:70)
com.qualys.agms.task.local.RemoveIPsFromAssetGroupTaskV1.run(RemoveIPsFromAssetGroupTaskV1.java:48)
java.util.concurrent.Executors$RunnableAdapter.call$$$capture(Executors.java:511)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java)
java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
java.util.concurrent.FutureTask.run(FutureTask.java)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)


Thanks,
Akash




code hangs up on cache().removeAll(set) operation

2018-06-04 Thread akash shinde
Hi,

My application hangs up when I execute following code. I tried to debug the
ignite source code but no luck.  Complete thread dump is attached in this
mail.

*cache().removeAll(set)*


* Can someone please advise? *

*Thread dump is as follows.*

Name: local-task-pool-0
State: WAITING
Total blocked: 0  Total waited: 1

Stack trace:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:304)
org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:177)
org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:140)
org.apache.ignite.internal.processors.cache.GridCacheAdapter$39.inOp(GridCacheAdapter.java:3011)
org.apache.ignite.internal.processors.cache.GridCacheAdapter$SyncInOp.op(GridCacheAdapter.java:5076)
org.apache.ignite.internal.processors.cache.GridCacheAdapter.syncOp(GridCacheAdapter.java:4088)
org.apache.ignite.internal.processors.cache.GridCacheAdapter.removeAll0(GridCacheAdapter.java:3004)
org.apache.ignite.internal.processors.cache.GridCacheAdapter.removeAll(GridCacheAdapter.java:2993)
org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.removeAll(IgniteCacheProxyImpl.java:1254)
org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.removeAll(GatewayProtectedCacheProxy.java:1166)
com.qualys.agms.grid.dao.AbstractDataGridDAO.removeAll(AbstractDataGridDAO.java:61)
com.qualys.agms.grid.dataservice.DefaultDataGridService.removeAll(DefaultDataGridService.java:47)
com.qualys.agms.task.local.RemoveIPsFromAssetGroupTaskV1.removeIpsFromAssetGroup(RemoveIPsFromAssetGroupTaskV1.java:70)
com.qualys.agms.task.local.RemoveIPsFromAssetGroupTaskV1.run(RemoveIPsFromAssetGroupTaskV1.java:48)
java.util.concurrent.Executors$RunnableAdapter.call$$$capture(Executors.java:511)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java)
java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
java.util.concurrent.FutureTask.run(FutureTask.java)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)


Thanks,
Akash
"http-nio-8080-exec-9@8387" daemon prio=5 tid=0x59 nid=NA waiting
  java.lang.Thread.State: WAITING
  at sun.misc.Unsafe.park(Unsafe.java:-1)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:304)
  at 
org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:177)
  at 
org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:140)
  at 
org.apache.ignite.internal.AsyncSupportAdapter.saveOrGet(AsyncSupportAdapter.java:112)
  at 
org.apache.ignite.internal.IgniteComputeImpl.affinityRun(IgniteComputeImpl.java:144)
  at 
com.qualys.agms.grid.service.GridServiceImpl.submitAffinityTask(GridServiceImpl.java:29)
  at 
com.qualys.agms.service.AssetGroupManagementServiceImpl.editAssetToGroup(AssetGroupManagementServiceImpl.java:133)
  at 
com.qualys.agms.web.controller.AssetGroupManagementController.updateAssetGroup(AssetGroupManagementController.java:71)
  at 
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
  at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at 
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
  at 
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$$Lambda$413.1604032818.invoke(Unknown
 Source:-1)
  at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
  at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
  at 
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
  at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
  at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
  at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
  at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
  at 
org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
  at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
  at 

Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread the_palakkaran
I figured out the solution for this. 

Just implement Externalizable and you can override equals and hashcode
method.

//Key is unique for each cache entry. So, it is impossible to get entry by a
part of key.//

I understand that, I was checking for a way to do that.

Thanks a lot for the confirmation, Andrew.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Ignite Cluster getting stuck when new node Join or release

2018-06-04 Thread dkarachentsev
Hi,

It's hard to get what's going wrong from your question.
Please attach full logs and thread dumps from all server nodes.

Thanks!
-Dmitry



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread Andrey Mashenkov
Hi,

You are free to use any hashcode and equals in your classes.
Ignite will convert your POJO to BinaryObject before save to cache and use
it's own hashing anyway.

It still unclear what are trying to do.
Key is unique for each cache entry. So, it is impossible to get entry by a
part of key.
You should use SQL API for this instead.


On Mon, Jun 4, 2018 at 12:31 PM, the_palakkaran 
wrote:

> Hi Andrew,
>
> I need to somehow override the equals and hashcode method in my key class.
>
> ie;
>
> I have a CustomerKey and CustomerModel configured in a customerCache. I
> need
> to get results from the cache based on the key class that I am passing to
> the cache for query.
>
> like when I pass a key class to the cache that has an equals method in
> which
> I have something like customerNumber == obj.CustomerNo, I need to get
> results based on it. So basically during put to cache also, this equals
> method should have been executed.
>
> Is there any way I could achieve this using Binary Objects or Binarylizable
> or Externalizable ?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov


While using Externalizable, possible to do SQLFieldsQuery, but not cache.get()

2018-06-04 Thread the_palakkaran
Hi,

I have both my Key and Model classes implementing Externalizable. I am able
to put data into it correctly and also to do SQLFieldsQuery on it
successfully. But when I use the same cache object to get value by passing a
Key, it always returns null.

Why does this happen?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: BinaryStringArrayWriter / BinaryStringArrayReader

2018-06-04 Thread Igor Sapego
Hi,

Yes, you can use BinaryStringArrayWriter / BinaryStringArrayReader.

No, to get BinaryStringArrayReader, you should use method
BinaryReader::ReadStringArray(const char* fieldName);

Best Regards,
Igor

On Sun, Jun 3, 2018 at 1:31 AM, F.D.  wrote:

> Hi,
>
> I'm trying to develop a distributed closure in C++. The return type of my
> closure is a std::vector>, so I think that I have to implement
> a BinaryType to serialize it. The question is: in the Write and Read
> methods can I use the BinaryStringArrayWriter / BinaryStringArrayReader or
> I have to use my own solution?
>
> And If I can, the first argument (impl::binary::BinaryReaderImpl *impl)
> is the first argoment of my method Read (BinaryReader )?
>
> Thanks,
>F.D.
>


Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread the_palakkaran
Hi Andrew,

I need to somehow override the equals and hashcode method in my key class.

ie;

I have a CustomerKey and CustomerModel configured in a customerCache. I need
to get results from the cache based on the key class that I am passing to
the cache for query. 

like when I pass a key class to the cache that has an equals method in which
I have something like customerNumber == obj.CustomerNo, I need to get
results based on it. So basically during put to cache also, this equals
method should have been executed.

Is there any way I could achieve this using Binary Objects or Binarylizable
or Externalizable ?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread Andrey Mashenkov
Hi,

Would you please describe your scenario? Why you need to use binarylizable
or Externalizable?

Ignite allows overriding methods, but ignores object's hashcode and equals and
rely on its own implementation.
Ignite operates with BinaryObjects underneath and use BinaryObject hash
codes.
This allows to use BinaryObjects on server side and the requirement of
having user objects in classpath on server side is optional.

On Mon, Jun 4, 2018 at 9:38 AM, the_palakkaran  wrote:

> Hi,
>
> I understand that by default, ignite does not allow override hash code and
> equals method. I need it to handle my scenarios, so i came across
> Binarylizable interface.
>
> How to do this? Not so clear from documentation.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov


How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread the_palakkaran
Hi,

I understand that by default, ignite does not allow override hash code and
equals method. I need it to handle my scenarios, so i came across
Binarylizable interface.

How to do this? Not so clear from documentation.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/