Re: Existing queue can't be accessed on client node

2017-09-12 Thread Edward S.
Hi Mikhail,
 I prepared small example to illustrate the problem.

 I start Ignite server node on local computer(Win 7), then run this example.
 Servrer's output is

 Ignite Command Line Startup, ver. 2.1.0#20170720-sha1:a6ca5c8a
 2017 Copyright(C) Apache Software Foundation
 
 >!
 >>Queue is created. Queue name is 558de1d5-a737-47fe-b836-2167ad7deaf9

 On the client:
 ver. 2.1.0#20170720-sha1:a6ca5c8a
 2017 Copyright(C) Apache Software Foundation

 Try to get queue. Queue name is 558de1d5-a737-47fe-b836-2167ad7deaf9
 Queue is null on client.

 Source code is:

 import java.util.UUID;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.lang.IgniteRunnable;

 import static org.apache.ignite.cache.CacheMode.PARTITIONED;

 public class IgniteQueueExample {

 public static void main(String[] args) throws Exception {
 Ignition.setClientMode(true);
 try (Ignite ignite =
Ignition.start("examples/config/example-ignite.xml")) {
 System.out.println();
 System.out.println(">>> Ignite queue example started.");

 // Make queue name.
 String queueName = UUID.randomUUID().toString();

 initializeQueue(ignite, queueName);
 System.out.println("Try to get queue. Queue name is " + 
queueName);
 IgniteQueue queue = ignite.queue(queueName, 0, null);

 if(queue==null){
 System.out.println("Queue is null on client.");
 }
 }

 System.out.println("Cache queue example finished.");
 }


 private static void initializeQueue(Ignite ignite, String queueName)
throws IgniteException {

 ignite.compute(ignite.cluster().forServers()).broadcast(new
QueueCreateClosure(queueName));

 }

 @SuppressWarnings("serial")
 private static class QueueCreateClosure implements IgniteRunnable {
 /** Queue name. */
 private final String queueName;

 QueueCreateClosure(String queueName) {
 this.queueName = queueName;
 }

 @Override public void run() {
 System.out.println(">!");
 CollectionConfiguration colCfg = new
CollectionConfiguration();
 colCfg.setCacheMode(PARTITIONED);
 IgniteQueue queue = Ignition.ignite().queue(queueName,
0, colCfg);
 if(queue==null){
 System.out.println(">>Queue is null.");
 }else{
 System.out.println(">>Queue is created. Queue name is " +
queue.name());
 }
 }
 }
 }

 
 Hi Edward,

 I can't reproduce the problem, could you please share a working code
snippet
 that will show the problem?

 Thanks,
 Mikhail.




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


Re: REST API qryexe saying Argument cannot be null: sql.

2017-09-12 Thread Roman Shtykh
Hi Anji,
The error says that you don't provide sql query.You might miss "&" before "qry".

-- Roman
 

On Wednesday, September 13, 2017, 2:42:12 AM GMT+9, ANJANEYA PRASAD 
NIDUBROLU  wrote:  
 
 Thanks Evgenii...
Actually i have included "Type" and "CacheName" also. But i pasted wrong url by 
mistakenly. The result is still the same. Here in the query/ REST url nowhere i 
am using "sql". May be "qry" from the REST url/command will be parsed to "sql". 
Not sure how and where this parsing is happening and what is wrong with the url 
I am trying.
Any thoughts please?
Thanks,Anji.
On Tuesday, September 12, 2017, ezhuravlev  wrote:

Hi,

I don't see in your query defined cacheName and type parameters. If cache
name not provided, default cache will be used.

You can find all this information in the documentation:
https://apacheignite.readme.io /docs/rest-api#section-sql-que ry-execute

Also, have you checked logs from Ignite node?

Evgenii



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



Re: Java-level locks on cache entries

2017-09-12 Thread John Wilson
That one is for locking pages while a check point process is going on.

Thanks,

On Tue, Sep 12, 2017 at 6:57 AM, Konstantin Dudkov  wrote:

> Hi,
>
> Ignite uses page-level locks, see
> https://github.com/apache/ignite/blob/43be051cd33f0e35a5bf05fa3dbe73
> 660d2dcdd2/modules/core/src/main/java/org/apache/ignite/
> internal/processors/cache/persistence/tree/util/PageHandler.java#L245
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re:Re: Fetched result set too large

2017-09-12 Thread Lucky
Thanks.
When will the 2.3 be released?





At 2017-09-12 22:58:34, "slava.koptilin"  wrote:
>Hi Lucky,
>
>It seems that this issue was resolved
>https://issues.apache.org/jira/browse/IGNITE-5991
>The fix will be available in Apache Ignite 2.3
>
>Thanks!
>
>
>
>
>--
>Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Cannot start/stop cache within lock or transaction

2017-09-12 Thread vkulichenko
Naresh,

This is correct behavior. Creation of new cache triggers global exchange
process which can't be done concurrently with transactions, so if you create
a cache synchronously within a transaction, you would create a deadlock. You
should create all caches required for a transaction prior to this
transaction.

-Val



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


Apache Ignite talk Sept. 13 at SF Big Analytics Meetup

2017-09-12 Thread Dieds
Igniters living in the San Francisco Bay Area, Apache Ignite PMC Chair Denis
Magda will be speaking tomorrow evening at the SF Big Analytics Meetup. It
starts at 6 p.m. at 1172 Castro St, Mountain View, CA. 

Details/ (and to register here):/
https://www.meetup.com/SF-Big-Analytics/events/242368299/




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


Cannot start/stop cache within lock or transaction

2017-09-12 Thread naresh.goty
Hi All, 
We are encountering the below problem during application startup configured
with Ignite 2.1.0 
Error: "Cannot start/stop cache within lock or transaction" 

Use case: 
1. Thread 1 creates (getorcreate) Cache1
2. Thread 1 acquires a lock on item1 in Cache1
3. Thread 2 creates cache2
At this point we are seeing the error:
Error: "Cannot start/stop cache within lock or transaction" 

if you could please advise.

Thanks, 
Naresh



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


Re: REST API qryexe saying Argument cannot be null: sql.

2017-09-12 Thread ANJANEYA PRASAD NIDUBROLU
Thanks Evgenii...

Actually i have included "Type" and "CacheName" also. But i pasted wrong
url by mistakenly. The result is still the same. Here in the query/ REST
url nowhere i am using "sql". May be "qry" from the REST url/command will
be parsed to "sql". Not sure how and where this parsing is happening and
what is wrong with the url I am trying.

Any thoughts please?

Thanks,
Anji.

On Tuesday, September 12, 2017, ezhuravlev  wrote:

> Hi,
>
> I don't see in your query defined cacheName and type parameters. If cache
> name not provided, default cache will be used.
>
> You can find all this information in the documentation:
> https://apacheignite.readme.io/docs/rest-api#section-sql-query-execute
>
> Also, have you checked logs from Ignite node?
>
> Evgenii
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: Job Listeners

2017-09-12 Thread Alexey Kukushkin
Hi Chandrika,

You would need to make an assumption about your jobs duration to display
remaining time or percentage. For example, the below task predicts
remaining duration assuming remaining jobs will have duration equal to the
average of the completed ones :

@ComputeTaskSessionFullSupport
public class RandomSleepTask extends ComputeTaskSplitAdapter {

@TaskSessionResource private ComputeTaskSession ses;
private static final Random random = new Random();

@Override protected Collection split(int
gridSize, Integer total) throws IgniteException {
final AtomicInteger cntr = new AtomicInteger(0);
final AtomicInteger duration = new AtomicInteger(0);

ses.addAttributeListener((key, val) -> {
if ("COMPLETE".compareTo(key.toString()) == 0) {
int newCntr = cntr.incrementAndGet();
int newDuration = duration.addAndGet((int)val);

// Predict remaining duration assuming remaining jobs
will have duration equal to the average of the
// completed ones
int avgDuration = newDuration / newCntr;
int pendingTime = (total - newCntr) * avgDuration;

System.out.format(
"%s\tout of %s\ttasks complete, %.2f\tmore seconds
remaining\n",
newCntr,
total,
pendingTime / 1000.0);
}
}, false);

return IntStream.range(0, total).mapToObj(i -> new ComputeJobAdapter() {
@Override public Object execute() throws IgniteException {
int duration = 150 + random.nextInt(100);

try {
Thread.sleep(duration);
}
catch (InterruptedException e) {
throw new IgniteException(e);
}

ses.setAttribute("COMPLETE", duration);

return duration;
}
}).collect(Collectors.toList());
}

@Nullable @Override public Integer reduce(List
results) throws IgniteException {
return results.stream().mapToInt(ComputeJobResult::getData).sum();
}
}

Execute it with 10 jobs:

ignite.compute().execute(RandomSleepTask.class, 10);

And the output:

1   out of 10   tasks complete, 1.36more seconds remaining
2   out of 10   tasks complete, 1.29more seconds remaining
3   out of 10   tasks complete, 1.18more seconds remaining
4   out of 10   tasks complete, 1.03more seconds remaining
5   out of 10   tasks complete, 0.90more seconds remaining
6   out of 10   tasks complete, 0.74more seconds remaining
7   out of 10   tasks complete, 0.56more seconds remaining
8   out of 10   tasks complete, 0.38more seconds remaining
9   out of 10   tasks complete, 0.19more seconds remaining
10  out of 10   tasks complete, 0.00more seconds remaining


Re: Fetched result set too large

2017-09-12 Thread slava.koptilin
Hi Lucky,

It seems that this issue was resolved
https://issues.apache.org/jira/browse/IGNITE-5991
The fix will be available in Apache Ignite 2.3

Thanks!




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


Re: Possibility of default SQL functions to query 'Map' or 'List' based attributes

2017-09-12 Thread Konstantin Dudkov
Hi,

I think the best way is to discuss this topic on devlist
(d...@ignite.apache.org) and to make a pull request if community agrees with
your opinion.

Regards,
Konstantin





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


Re: REST API qryexe saying Argument cannot be null: sql.

2017-09-12 Thread ezhuravlev
Hi,

I don't see in your query defined cacheName and type parameters. If cache
name not provided, default cache will be used.

You can find all this information in the documentation:
https://apacheignite.readme.io/docs/rest-api#section-sql-query-execute

Also, have you checked logs from Ignite node?

Evgenii



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


Re: Java-level locks on cache entries

2017-09-12 Thread Konstantin Dudkov
Hi,

Ignite uses page-level locks, see
https://github.com/apache/ignite/blob/43be051cd33f0e35a5bf05fa3dbe73660d2dcdd2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java#L245




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


UPDATE query with JOIN

2017-09-12 Thread iostream
Hi,

Does ignite v2.1 support UPDATE queries with JOINS?

I tried a SELECT query as follows and it worked fine -

select count(*) from fulfill_order fo join table(id bigint = ?) t on
fo.fulfill_order_status_code = t.id";
SqlFieldsQuery enhanceQuery = new SqlFieldsQuery(cacheQuery);
ArrayList list = new ArrayList<>();
list.add(7);
list.add(1);
list.add(9);
Integer [] arr = list.toArray(new Integer[list.size()]);
Object [] obj = new Object[]{arr};
enhanceQuery.setArgs(obj);
IgniteCache fulfillOrderCache =
Ignition.ignite()
   
.cache(CacheNameConstants.FULFILL_ORDER_CACHE_NAME);
QueryCursor> cursor = fulfillOrderCache.query(enhanceQuery);

However, I tried running UPDATE query as follows but none of the queries
worked.

1. String updateQuery = "UPDATE fo SET fo.fulfill_order_status_code =? "
+ "FROM fulfill_order fo join table(id bigint = ?) t
on fo.fulfill_order_status_code = t.id "
+ "where fo.fulfill_order_id=?";
SqlFieldsQuery enhanceQuery = new SqlFieldsQuery(updateQuery);
ArrayList list = new ArrayList<>();
list.add(7);
list.add(1);
list.add(9);
Integer [] arr = list.toArray(new Integer[list.size()]);
Object [] obj = new Object[]{arr};
enhanceQuery.setArgs(3,obj, 347427284695L);
IgniteCache fulfillOrderCache =
Ignition.ignite()
   
.cache(CacheNameConstants.FULFILL_ORDER_CACHE_NAME);
fulfillOrderCache.query(enhanceQuery);   

2. update fulfill_order fo join table(id bigint = ?) t on
fo.fulfill_order_status_code = t.id
set fo.fulfill_order_status_code =?, fo.last_update_userid =?,
fo.order_due_ts =?,
fo.last_update_ts =? where fo.fulfill_order_id=?

Can someone help with the correct way of running UPDATE query with JOIN?

Thanks!



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


Re: Job Listeners

2017-09-12 Thread chandrika
Hello Alexey,

Thanks a lot for the information it was pretty useful to us,also wanted to
know if we could know the percentage of the JobSibling Completed or task
Completed, as in 70% of it is finished its execution and 30% more is left to
finish the execution or the duration of time taken for executing the job.
Please guide us through in this aspect.

thanks and regards,
chandrika




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


Possibility of default SQL functions to query 'Map' or 'List' based attributes

2017-09-12 Thread saikiran939
Hi Members,

We are using Ignite cache to store and querying data from the cache. The
POJO object for cache has Map of Maps e.g Map> based attribute values. 

Presently we are using custom SQL function to query these map based
attribute. Code would look something like below:

@QuerySqlFunction
public static String getAttribute(Object param, String aName , String
aAttributeName ) {
HashMap attributeMap = 
(HashMap)((HashMap)param).get(aCategoryName);
   
if(attributeMap==null)
return null;

return (String)attributeMap.get(aAttributeName);
}

The query makes use of this function as:
SELECT * FROM AttributesCache WHERE hash = ? AND (
getAttribute(attributeMap,?,?) LIKE ? )

Here attributeMap is the variable name of Map> attribute.

By making use of such Map based representation we were able to avoid more
than one cache and therefore we could avoid inner joins during querying and
transactions during update operation.

But the usage of this function warrants us to have this SQL function on
Ignite server node but we are aiming to remove classes not to be present at
ignite server node. 

My question is - is it possible for Ignite team to have such useful/common
Custom SQL functions (like querying Map or List or Collection) shipped
out-of-the-box ignite core jar ? This can help us in avoiding deploying such
basic sql functions class files at server node and everyone can benefit from
such sql functions. 



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


Re: Re: When cache node switch between primary and backup any notification be received?

2017-09-12 Thread aa...@tophold.com
Thanks Dimitriy!

We try use this node predicate :  
ignite.affinity("CacheNM").isPrimary(clusterNode, "Key1")

To located the Primary service of the a specific key;  when call 
ignite#services();   not verified,  but should can work. 


Regards
Aaron


aa...@tophold.com
 
From: Dmitriy Setrakyan
Date: 2017-09-12 13:41
To: user
CC: aaron
Subject: Re: Re: When cache node switch between primary and backup any 
notification be received?


On Mon, Sep 11, 2017 at 6:54 PM, aa...@tophold.com  wrote:
Thanks Alexey!   what we real want, we deploy service on each Cache Node.  
those service will use data from its' local cache.  

Client will call those remote service, Client should only call  the service on 
primary node,  this make those nodes work like master-slave mode automatically. 

In Ignite, a node is a primary node for a certain partition. A key belongs to a 
partition and a partition belongs to a node. A node may be primary for key1 
(partition N)  and the same node may be a back up for key 2 (partition M). 

I think you simply should invoke your service on each node and only check or 
iterate through primary keys stored on that node. You can get a list of primary 
keys by using org.apache.ignite.cache.affinity.Affinity API, for example 
Affinty.primaryPartitions(ClusterNode) method.

int[] primaryPartitions = 
Ignite.affinity("cacheName").primaryPartitions(Ignite.cluster().localNode()); 
for (int primaryPartition : primaryPartitions) {
// Cursor over local entries for the given partition.
QueryCursor> cur = cache.query(new ScanQuery(primaryPartition)); 
 for (Entry entry : cur) {
// Do something on local entries.
}
}

Does this make sense?



Fetched result set too large

2017-09-12 Thread Lucky
Hi
I use jdbc to fetch result from cache.
Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
Connection conn =DriverManager.getConnection("jdbc:ignite:thin://IP");
ResultSet rs = conn.createStatement().executeQuery(sql);


And the sql is like this:
select v.id,v.name,v.seq from (selet a.id as id,b.name as name,c.seq as seq 
from a inner join b on a.id= b.id left outer join c on a.id=c.id) v left outer 
join (select did from d where cid in(Ids) group by did having count(did)>=3000) 
w on v.id = d.did where d.did is null


when 'select did from d where cid in(Ids) group by did having count(did)>=3000' 
return few records ,this sql is work,but if it return 20,000 records(actually 
it's often return 10 million records),it got this wrong message:Fetched result 
set war too large.


And the whole sql is expected 30,000 records.
Any suggestion? Thanks.
Lucky.

RE: integration of Apache ISIS and Ignite

2017-09-12 Thread Nikhil Dhamapurkar
Hi Mikhail,

I am still getting the problem still after the new dependencies have been 
added, here is a project on git : 
https://bitbucket.org/dhamapurkar/isisignitesample

When we try to compile the application with mvn clean install we get the error.

My intention is to connect to ignite and later configure Postgres as 
persistence DB, in the project I am currently just trying to connect with 
Ignite default / out of the box instance.

Regards
Nikhil

From: Mikhail
Sent: 11 September 2017 23:35
To: user@ignite.apache.org
Subject: RE: integration of Apache ISIS and Ignite

Hi,

with new dependencies, you have the same exception, don't you? if so, could
you please share a pom based project that shows the problem?

Thanks,
Mikhail.



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