Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-10038

Console counters unable to correctly display all long values

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

      Currently the console is unable to display all possible counter values, as the max integer that can be represented by javascript is (2^53)-1, whereas Java is (2^63)-1. Normally the workaround for this would be to simply store the number as a String, however the counter value is returned as a number in the returned JSON, so it is automatically parsed as a number by the console and the exact value is lost.

            [ISPN-10038] Console counters unable to correctly display all long values

            This can easily be reproduced by configuring a counter on the server with an initial-value greater than (2^53)-1. The below server configuration on 14.0.1-SNAPSHOT was used to produce the attached screenshot:

            <infinispan
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:infinispan:config:14.0 https://infinispan.org/schemas/infinispan-config-14.0.xsd
                                        urn:infinispan:server:14.0 https://infinispan.org/schemas/infinispan-server-14.0.xsd"
                  xmlns="urn:infinispan:config:14.0"
                  xmlns:server="urn:infinispan:server:14.0">
            
               <cache-container name="default" statistics="true">
                  <transport cluster="${infinispan.cluster.name:cluster}" stack="${infinispan.cluster.stack:tcp}" node-name="${infinispan.node.name:}"/>
                  <security>
                     <authorization/>
                  </security>
                  <counters xmlns="urn:infinispan:config:counters:14.0">
                     <strong-counter name="c1" initial-value="2147483647" storage="PERSISTENT"/>
                     <strong-counter name="c2" initial-value="5" storage="PERSISTENT"/>
                 </counters>
               </cache-container>
            
               <server xmlns="urn:infinispan:server:14.0">
                  <interfaces>
                     <interface name="public">
                        <inet-address value="${infinispan.bind.address:127.0.0.1}"/>
                     </interface>
                  </interfaces>
            
                  <socket-bindings default-interface="public" port-offset="${infinispan.socket.binding.port-offset:0}">
                     <socket-binding name="default" port="${infinispan.bind.port:11222}"/>
                     <socket-binding name="memcached" port="11221"/>
                  </socket-bindings>
            
                  <security>
                     <credential-stores>
                        <credential-store name="credentials" path="credentials.pfx">
                           <clear-text-credential clear-text="secret"/>
                        </credential-store>
                     </credential-stores>
                     <security-realms>
                        <security-realm name="default">
                           <properties-realm groups-attribute="Roles">
                              <user-properties path="users.properties"/>
                              <group-properties path="groups.properties"/>
                           </properties-realm>
                        </security-realm>
                     </security-realms>
                  </security>
            
                  <endpoints socket-binding="default" security-realm="default" />
               </server>
            </infinispan>
            
            

            Ryan Emerson added a comment - This can easily be reproduced by configuring a counter on the server with an initial-value greater than (2^53)-1 . The below server configuration on 14.0.1-SNAPSHOT was used to produce the attached screenshot: <infinispan xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:14.0 https://infinispan.org/schemas/infinispan-config-14.0.xsd urn:infinispan:server:14.0 https://infinispan.org/schemas/infinispan-server-14.0.xsd" xmlns= "urn:infinispan:config:14.0" xmlns:server = "urn:infinispan:server:14.0" > <cache-container name= "default" statistics= "true" > <transport cluster= "${infinispan.cluster.name:cluster}" stack= "${infinispan.cluster.stack:tcp}" node-name= "${infinispan.node.name:}" /> <security> <authorization/> </security> <counters xmlns= "urn:infinispan:config:counters:14.0" > <strong-counter name= "c1" initial-value= "2147483647" storage= "PERSISTENT" /> <strong-counter name= "c2" initial-value= "5" storage= "PERSISTENT" /> </counters> </cache-container> <server xmlns= "urn:infinispan:server:14.0" > <interfaces> <interface name= "public" > <inet-address value= "${infinispan.bind.address:127.0.0.1}" /> </interface> </interfaces> <socket-bindings default-interface= "public" port-offset= "${infinispan.socket.binding.port-offset:0}" > <socket-binding name= "default" port= "${infinispan.bind.port:11222}" /> <socket-binding name= "memcached" port= "11221" /> </socket-bindings> <security> <credential-stores> <credential-store name= "credentials" path= "credentials.pfx" > <clear-text-credential clear-text= "secret" /> </credential-store> </credential-stores> <security-realms> <security-realm name= "default" > <properties-realm groups-attribute= "Roles" > <user-properties path= "users.properties" /> <group-properties path= "groups.properties" /> </properties-realm> </security-realm> </security-realms> </security> <endpoints socket-binding= "default" security-realm= "default" /> </server> </infinispan>

              dipgupta@redhat.com Dipanshu Gupta
              remerson@redhat.com Ryan Emerson
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: