You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by nidhinms <ni...@gmail.com> on 2020/04/17 06:22:46 UTC

CPP: ScanQuery return partial set

I tried to execute a ScanQuery against a thick client cache of <string,
string>using CPP ignite. 
Size() functions returns 9. 
But I am getting only 3 results while looping over the cursor. 

Code used was like this
        auto cursor = t_Cache->Query(ScanQuery());
	while (cursor.HasNext())
	{
		auto entry = cursor.GetNext();
		std::cout << entry.GetKey() << "->" << entry.GetValue() << std::endl;
	}

What am I doing wrong here??





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

Re: CPP: ScanQuery return partial set

Posted by akorensh <al...@gmail.com>.
Hi,
    currently the Size() method is defined as 
              int32_t Size()
            {
                return Size(ignite::cache::CachePeekMode::ALL);
            }

   It is collecting all instances of the key across all nodes.

   therefore if you have a cache defined w/1 backup and you put 1 key into
that cache then startup 2 nodes.
   Cache.size() will return 2. (1 for the primary + 1 for backup)

  If you would like it to return 1(count only primary) the call would be: 
   Size(ignite::cache::CachePeekMode::PRIMARY);


 Cache Peek Mode definition:
https://www.gridgain.com/sdk/ce/8.7.14/cppdoc/structignite_1_1cache_1_1CachePeekMode.html

Thanks, Alex
     




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