Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Larger Long/BIGINT values mangled when passed from server to client #12

Open
youurayy opened this issue Feb 19, 2014 · 7 comments
Open

Comments

@youurayy
Copy link

Okay, this is quite severe and a show-stopper for us. Resolution would be appreciated.

It only happens with a larger Long values, e.g. 2000000000L. Smaller values are fine, e.g 498498L, but this makes it even more dangerous.

Tested on Mac OS X and Linux, VoltDB 3.7.0.4-0 enterprise. Node.js v0.10.15 (Mac) and v0.10.24 (Linux).

Minimal test case follows.

Test.java

package yourpackage;
import org.voltdb.*;
public class Test extends VoltProcedure {
    public VoltTable[] run() {
        VoltTable test = new VoltTable(
           new VoltTable.ColumnInfo("test", VoltType.BIGINT));
        test.addRow(2000000000L);
        return new VoltTable[] { test };
    }
}

catalog.sql

create procedure from class yourpackage.Test;

test.js

var client = require('voltjs/lib/client');
var configuration = require('voltjs/lib/configuration');
var query = require('voltjs/lib/query');

var cfg = new configuration();
cfg.host = '127.0.0.1';
cfg.messageQueueSize = 0;
var client = new client([ cfg ]);

client.connect(function(err, event, results) {

    var test = new query('Test', []);
    var testQuery = test.getQuery();
    testQuery.setParameters([]);

    client.callProcedure(testQuery, function(err, event, results) {
        // EXPECTED: 2000000000   ACTUAL: 120951808
        console.dir(results.table[0][0].test);
        process.exit(0);
    });

});

(@jpiekos - John, I'm still intent on sending you that proposal, just haven't had time by now.)

@jpiekos
Copy link

jpiekos commented Feb 19, 2014

FYI - logged as https://issues.voltdb.com/browse/ENG-5545

John

On Tue, Feb 18, 2014 at 11:57 PM, Juraj Vitko notifications@github.comwrote:

Okay, this is quite severe and a show-stopper for us. Resolution would be
appreciated.

It only happens with a larger Long values, e.g. 2000000000L. Smaller
values are fine, e.g 498498L, but this makes it even more dangerous.

Tested on Mac OS X and Linux, VoltDB 3.7.0.4-0 enterprise. Node.js
v0.10.15 (Mac) and v0.10.24 (Linux).

Minimal test case follows.

Test.java

package yourpackage;import org.voltdb.*;public class Test extends VoltProcedure {
public VoltTable[] run() {
VoltTable test = new VoltTable(
new VoltTable.ColumnInfo("test", VoltType.BIGINT));
test.addRow(2000000000L);
return new VoltTable[] { test };
}}

catalog.sql

create procedure from class yourpackage.Test;

test.js

var client = require('voltjs/lib/client');var configuration = require('voltjs/lib/configuration');var query = require('voltjs/lib/query');
var cfg = new configuration();cfg.host = '127.0.0.1';cfg.messageQueueSize = 0;var client = new client([ cfg ]);
client.connect(function(err, event, results) {

var test = new query('Test', []);
var testQuery = test.getQuery();
testQuery.setParameters([]);

client.callProcedure(testQuery, function(err, event, results) {
    // EXPECTED: 2000000000   ACTUAL: 120951808
    console.dir(results.table[0][0].test);
    process.exit(0);
});

});

(@jpiekos https://github.com/jpiekos - John, I'm still intent on
sending you that proposal, just haven't had time by now.)

Reply to this email directly or view it on GitHubhttps://github.com//issues/12
.

  • John Piekos_, VP of Engineering
    *VoltDB, Inc._

_E: *jpiekos@voltdb.com
O: 978.528.0576
M: 508.517.3218
www.voltdb.com
Follow VoltDB on Twitter http://twitter.com/voltdb,
Facebookhttps://www.facebook.com/VoltDB?sk=wall,
and LinkedInhttp://www.linkedin.com/company/857257?goback=.fcs_GLHD_volt+db_false__2__2__2__2__2__2__2__2__2__2__2_*2&trk=ncsrch_hits
http://www.voltdb.com/

@jpiekos
Copy link

jpiekos commented Feb 19, 2014

Cut/paste error, the ticket is https://issues.voltdb.com/browse/ENG-5893

On Wed, Feb 19, 2014 at 8:51 AM, John Piekos jpiekos@voltdb.com wrote:

FYI - logged as https://issues.voltdb.com/browse/ENG-5545

John

On Tue, Feb 18, 2014 at 11:57 PM, Juraj Vitko notifications@github.comwrote:

Okay, this is quite severe and a show-stopper for us. Resolution would be
appreciated.

It only happens with a larger Long values, e.g. 2000000000L. Smaller
values are fine, e.g 498498L, but this makes it even more dangerous.

Tested on Mac OS X and Linux, VoltDB 3.7.0.4-0 enterprise. Node.js
v0.10.15 (Mac) and v0.10.24 (Linux).

Minimal test case follows.

Test.java

package yourpackage;import org.voltdb.*;public class Test extends VoltProcedure {
public VoltTable[] run() {
VoltTable test = new VoltTable(
new VoltTable.ColumnInfo("test", VoltType.BIGINT));
test.addRow(2000000000L);
return new VoltTable[] { test };
}}

catalog.sql

create procedure from class yourpackage.Test;

test.js

var client = require('voltjs/lib/client');var configuration = require('voltjs/lib/configuration');var query = require('voltjs/lib/query');
var cfg = new configuration();cfg.host = '127.0.0.1';cfg.messageQueueSize = 0;var client = new client([ cfg ]);
client.connect(function(err, event, results) {

var test = new query('Test', []);
var testQuery = test.getQuery();
testQuery.setParameters([]);

client.callProcedure(testQuery, function(err, event, results) {
    // EXPECTED: 2000000000   ACTUAL: 120951808
    console.dir(results.table[0][0].test);
    process.exit(0);
});

});

(@jpiekos https://github.com/jpiekos - John, I'm still intent on
sending you that proposal, just haven't had time by now.)

Reply to this email directly or view it on GitHubhttps://github.com//issues/12
.

  • John Piekos_, VP of Engineering
    *VoltDB, Inc._

_E: *jpiekos@voltdb.com
O: 978.528.0576
M: 508.517.3218
www.voltdb.com
Follow VoltDB on Twitter http://twitter.com/voltdb, Facebookhttps://www.facebook.com/VoltDB?sk=wall,
and LinkedInhttp://www.linkedin.com/company/857257?goback=.fcs_GLHD_volt+db_false__2__2__2__2__2__2__2__2__2__2__2_*2&trk=ncsrch_hits
http://www.voltdb.com/

  • John Piekos_, VP of Engineering
    *VoltDB, Inc._

_E: *jpiekos@voltdb.com
O: 978.528.0576
M: 508.517.3218
www.voltdb.com
Follow VoltDB on Twitter http://twitter.com/voltdb,
Facebookhttps://www.facebook.com/VoltDB?sk=wall,
and LinkedInhttp://www.linkedin.com/company/857257?goback=.fcs_GLHD_volt+db_false__2__2__2__2__2__2__2__2__2__2__2_*2&trk=ncsrch_hits
http://www.voltdb.com/

@youurayy
Copy link
Author

John, any news on how is the fix progressing, or ETA? Thanks much..

@jpiekos
Copy link

jpiekos commented Feb 27, 2014

Hi Juraj,

We haven't scheduled work on this ticket yet. I'll let you know when it
gets into our iteration.

John

On Thu, Feb 27, 2014 at 12:50 PM, Juraj Vitko notifications@github.comwrote:

John, any news on how is the fix progressing, or ETA? Thanks much..

Reply to this email directly or view it on GitHubhttps://github.com//issues/12#issuecomment-36269995
.

  • John Piekos_, VP of Engineering
    *VoltDB, Inc._

_E: *jpiekos@voltdb.com
O: 978.528.0576
M: 508.517.3218
www.voltdb.com
Follow VoltDB on Twitter http://twitter.com/voltdb,
Facebookhttps://www.facebook.com/VoltDB?sk=wall,
and LinkedInhttp://www.linkedin.com/company/857257?goback=.fcs_GLHD_volt+db_false__2__2__2__2__2__2__2__2__2__2__2_*2&trk=ncsrch_hits
http://www.voltdb.com/

@youurayy
Copy link
Author

youurayy commented Mar 1, 2014

John, I have looked at it and it seems like changing

Parser.prototype.readLong = function() {
  return this.readLongBytes()[0];
};

to

Parser.prototype.readLong = function() {
  return this.readLongBytes().intValue();
};

in lib/parser.js:84 does the trick.

@x4base
Copy link
Contributor

x4base commented Mar 26, 2015

Thanks @youurayy , your trick works perfectly!!!! I think this is an important change. Could you please commit this change?

@x4base
Copy link
Contributor

x4base commented Mar 26, 2015

Hi @youurayy . After some tests, I found out when the value is 2518472322, your solution make the value negative. parseInt(this.readLongBytes().toString()) seems to be a better solution for me so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants