aerospike-client-csharp icon indicating copy to clipboard operation
aerospike-client-csharp copied to clipboard

Limiting records returned by a query does not work

Open devIonutApostol opened this issue 2 years ago • 3 comments

We are trying to limit the records returned by a query using statement max records or policy short query but it does not work. In the example bellow we expect ~10 records, but for some cases we get 100k. At this point we are using C# client version 5.3.2 but upgrading to 5.4.x or even 6.x does not change this behavior.

        var queryPolicy = new QueryPolicy
        {
            shortQuery = true,
            totalTimeout = 10000,
            readModeSC = ReadModeSC.ALLOW_REPLICA,
            includeBinData = false,
            maxRetries = 0,
        };
        
        var stmt = new Statement();
        stmt.SetNamespace("namespace");
        stmt.SetSetName("setname");
        stmt.MaxRecords = 10;
        stmt.SetFilter(Filter.Equal("binname", "binvalue"));

        
        var result = client.Query(queryPolicy, stmt);
        
        int count = 0;
        while (result.Next())
        {
            count++;
        }
        
        Console.WriteLine(count);`

devIonutApostol avatar Nov 02 '23 10:11 devIonutApostol

Can you tell me what server version you were using? I ran a test using server EE 7.0.0 and C# client version 7.0.1 and I am unable to replicate the issue you are seeing.

shannonklaus avatar Feb 02 '24 18:02 shannonklaus

@shannonklaus we are using EE 5.7

devIonutApostol avatar Feb 05 '24 07:02 devIonutApostol

MaxRecords is supported by the server starting in EE 6.0.0. I tested with EE 6.0.0 and C# client 5.3.2 and MaxRecords is working for me, so I recommend upgrading to at least EE 6.0.0.

shannonklaus avatar Feb 14 '24 20:02 shannonklaus