ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilya Kasnacheev <ilya.kasnach...@gmail.com>
Subject Re: JDBC Thin Client Set Streaming On/Off in node.js app
Date Mon, 01 Apr 2019 12:37:38 GMT
Hello!

I think the problem is that you are running parallel operations on a single
connection. This is a no-no with Ignite's connection (and some other as
well, I would guess).You should be only use a JDBC connection sequentially,
but your insertRow() would do that in parallel.

Please see how I managed to sequentialize this operation and now have 15 in
table after running:
        function(callback) {
          const cities = [
            [16,'New York', 'USA', 'New York', 8008278],
            [17,'Los Angeles', 'USA', 'California', 3694820],
            [18,'Chicago', 'USA', 'Illinois', 2896016],
            [4,'Houston', 'USA', 'Texas', 1953631],
            [5,'Philadelphia', 'USA', 'Pennsylvania', 1517550],
            [6,'Moscow', 'RUS', 'Moscow (City)', 8389200],
            [7,'St Petersburg', 'RUS', 'Pietari', 4694000],
            [8,'Novosibirsk', 'RUS', 'Novosibirsk', 1398800],
            [9,'Nizni Novgorod', 'RUS', 'Nizni Novgorod', 1357000],
            [10,'Jekaterinburg', 'RUS', 'Sverdlovsk', 1266300],
            [11,'Shanghai', 'CHN', 'Shanghai', 9696300],
            [12,'Peking', 'CHN', 'Peking', 7472000],
            [13,'Chongqing', 'CHN', 'Chongqing', 6351600],
            [14,'Tianjin', 'CHN', 'Tianjin', 5286800],
            [15,'Wuhan', 'CHN', 'Hubei', 4344600]
          ];
          inserts = [];
          for (var city of cities) {
            var sql = "INSERT INTO BUTCH_city (id, name, countrycode,
district, population)
VALUES("+city[0]+",'"+city[1]+"','"+city[2]+"','"+city[3]+"',"+city[4]+");";
            inserts.push((function() {
              var s = sql;
              return function(callback) {
                console.log((new Date()) + " insert sql : " + s);
                insertRow(conn, s, callback);
              }
            })());
          }
          asyncjs.series(inserts, callback);

        },

Sorry for my awful Node code.

Regards,
-- 
Ilya Kasnacheev


пт, 29 мар. 2019 г. в 19:48, ilyn <iy4956@att.com>:

> Ilya,
>
> Please see attached code.
>
> jdbcStream.js
> <http://apache-ignite-users.70518.x6.nabble.com/file/t2367/jdbcStream.js>
>
>
> Thanks!
> Ilyn
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Mime
View raw message