Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-51629

Negative integer in the 64bit range causes rounding

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Yes

    Description

      Add the document key "f01"  value {"c1":-5106534569952410475 } via UI
       
      select d.c1 from default d USE KEYS "f01" ; 

      int64 range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

      negative range length is 20  

      https://github.com/couchbase/go_json/blob/master/simple.go#L339  negative account for sign

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-51629
          # Subject Branch Project Status CR V

          Activity

            Build couchbase-server-7.2.0-1035 contains go_json commit 4473a21 with commit message:
            MB-51629 Account for minus sign in int64 accumulation

            build-team Couchbase Build Team added a comment - Build couchbase-server-7.2.0-1035 contains go_json commit 4473a21 with commit message: MB-51629 Account for minus sign in int64 accumulation

            insert into default (key,value) values("f05",{"c1":-9223372036854775807,"c2":9223372036854775807 });
             
            select * from default use keys["f05"]; 

            Donald.haggart Donald Haggart added a comment - insert into default (key,value) values( "f05" ,{ "c1" :- 9223372036854775807 , "c2" : 9223372036854775807 });   select * from default use keys[ "f05" ];
            ajay.bhullar Ajay Bhullar added a comment - - edited

            via donald's repro in 7.04-2737
            insert into default (key,value) values("f05",

            {"c1":-9223372036854775807,"c2":9223372036854775807 }

            );

            select * from default use keys["f05"];

            via cbq: gives 808 instead of 807
            {
            "requestID": "b4ffed10-32cd-4e39-8a39-54483449ea49",
            "signature":

            { "*": "*" }

            ,
            "results": [
            {
            "default":

            { "c1": -9223372036854775808, "c2": 9223372036854775807 }

            }
            ],
            "status": "success",
            "metrics":

            { "elapsedTime": "2.549821ms", "executionTime": "2.330875ms", "resultCount": 1, "resultSize": 116, "serviceLoad": 6, "usedMemory": 59 }

            }

            via UI: rounds
            [
            {
            "default":

            { "c1": -9223372036854776000, "c2": 9223372036854776000 }

            }
            ]

            via REST: gives correct result

            ajaybhullar@SCML0613 ~ % curl http://172.23.104.110:8093/query/service \
            -u Administrator:password \
            -d 'statement=select * from default use keys["f05"]'
            {
            "requestID": "59b223e9-b4bb-43f5-be5e-0dafaf2873e4",
            "signature":

            {"*":"*"}

            ,
            "results": [
            {"default":{"c1":-9223372036854775807,"c2":9223372036854775807}}
            ],
            "status": "success",
            "metrics":

            {"elapsedTime": "3.104939ms","executionTime": "2.923806ms","resultCount": 1,"resultSize": 64,"serviceLoad": 6}

            }

            as we can see only REST gives the correct result out of these three

            ajay.bhullar Ajay Bhullar added a comment - - edited via donald's repro in 7.04-2737 insert into default (key,value) values("f05", {"c1":-9223372036854775807,"c2":9223372036854775807 } ); select * from default use keys ["f05"] ; via cbq: gives 808 instead of 807 { "requestID": "b4ffed10-32cd-4e39-8a39-54483449ea49", "signature": { "*": "*" } , "results": [ { "default": { "c1": -9223372036854775808, "c2": 9223372036854775807 } } ], "status": "success", "metrics": { "elapsedTime": "2.549821ms", "executionTime": "2.330875ms", "resultCount": 1, "resultSize": 116, "serviceLoad": 6, "usedMemory": 59 } } via UI: rounds [ { "default": { "c1": -9223372036854776000, "c2": 9223372036854776000 } } ] via REST: gives correct result ajaybhullar@SCML0613 ~ % curl http://172.23.104.110:8093/query/service \ -u Administrator:password \ -d 'statement=select * from default use keys ["f05"] ' { "requestID": "59b223e9-b4bb-43f5-be5e-0dafaf2873e4", "signature": {"*":"*"} , "results": [ {"default":{"c1":-9223372036854775807,"c2":9223372036854775807}} ], "status": "success", "metrics": {"elapsedTime": "3.104939ms","executionTime": "2.923806ms","resultCount": 1,"resultSize": 64,"serviceLoad": 6} } as we can see only REST gives the correct result out of these three
            Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited

            Ajay Bhullar  this only fixed in 7.2.0-1035. It works in cbq/curl in 7.2.0. Not sure if UI/client side able to handle these. It is upto there implementation. 

            It is candidate for 7.1.1, 7.0.4 and it is not approved and no code change. Kamini Jagtiani 

            Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - - edited Ajay Bhullar   this only fixed in 7.2.0-1035. It works in cbq/curl in 7.2.0. Not sure if UI/client side able to handle these. It is upto there implementation.  It is candidate for 7.1.1, 7.0.4 and it is not approved and no code change. Kamini Jagtiani  
            Donald.haggart Donald Haggart added a comment - - edited

            Description for release notes:

            Summary: Large negative integers with 19 significant digits but still below the limits of 64-bit int storage were treated as floating point and thus were subject to precision loss. 

            Workaround: Store large negative integers in strings, noting the limits on processing as strings.

            Donald.haggart Donald Haggart added a comment - - edited Description for release notes: Summary: Large negative integers with 19 significant digits but still below the limits of 64-bit int storage were treated as floating point and thus were subject to precision loss.  Workaround : Store large negative integers in strings, noting the limits on processing as strings.
            tony.hillman Tony Hillman added a comment -

            PR for revised 7.0.4 release notes at https://github.com/couchbase/docs-server/pull/2750

            tony.hillman Tony Hillman added a comment - PR for revised 7.0.4 release notes at https://github.com/couchbase/docs-server/pull/2750

            People

              ajay.bhullar Ajay Bhullar
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty