aerospike / aerospike-client-csharp

Aerospike C# Client Library
70 stars 47 forks source link

Limiting records returned by a query does not work #91

Open devIonutApostol opened 10 months ago

devIonutApostol commented 10 months ago

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);`
shannonklaus commented 7 months ago

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.

devIonutApostol commented 7 months ago

@shannonklaus we are using EE 5.7

shannonklaus commented 7 months ago

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.