Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C973397B6 for ; Tue, 17 Jan 2012 16:38:56 +0000 (UTC) Received: (qmail 17139 invoked by uid 500); 17 Jan 2012 16:38:56 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 17096 invoked by uid 500); 17 Jan 2012 16:38:56 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Delivered-To: moderator for commits@cassandra.apache.org Received: (qmail 61246 invoked by uid 99); 16 Jan 2012 16:36:06 -0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,SUBJ_OBFU_PUNCT_FEW X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of 31VEUTyAMAEgmk22kxn1k-xyno.kzkmro-o731k2.y1qmyno2zy3.myw@codesite.bounces.google.com designates 209.85.160.76 as permitted sender) MIME-Version: 1.0 X-Generated-By: Google Code Message-ID: Date: Mon, 16 Jan 2012 16:35:33 +0000 Subject: [cassandra-node] 6 new revisions pushed by gdusbabek@gmail.com on 2012-01-16 16:34 GMT From: cassandra-node.apache-extras.org@codespot.com To: commits@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes X-Virus-Checked: Checked by ClamAV on apache.org 6 new revisions: Revision: 77ea752f341e Author: gdusbabek Date: Thu Jan 12 09:21:14 2012 Log: cassandra thrift version 19.10.0->19.19.0 http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=77ea752f341e Revision: fa928c4ff9a5 Author: gdusbabek Date: Mon Jan 16 08:00:22 2012 Log: * introduce ConnectionError for distinguishing pooling errors that sho... http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=fa928c4ff9a5 Revision: 32b3db04c0af Author: gdusbabek Date: Mon Jan 16 08:26:14 2012 Log: build thrift connection during connect. http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=32b3db04c0af Revision: d511ea5c1af3 Author: gdusbabek Date: Mon Jan 16 08:26:47 2012 Log: * add cassandra-env.sh so that JMX gets started (port 7199)... http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=d511ea5c1af3 Revision: 78b70294277c Author: gdusbabek Date: Mon Jan 16 08:31:48 2012 Log: PooledConnection2 -> PooledConnection http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=78b70294277c Revision: 2fbdab86e2f2 Author: Gary Dusbabek Date: Mon Jan 16 08:34:22 2012 Log: remove generic pool dep http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=2fbdab86e2f2 ============================================================================== Revision: 77ea752f341e Author: gdusbabek Date: Thu Jan 12 09:21:14 2012 Log: cassandra thrift version 19.10.0->19.19.0 http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=77ea752f341e Modified: /lib/gen-nodejs/Cassandra.js /lib/gen-nodejs/cassandra_types.js ======================================= --- /lib/gen-nodejs/Cassandra.js Thu Aug 25 16:20:07 2011 +++ /lib/gen-nodejs/Cassandra.js Thu Jan 12 09:21:14 2012 @@ -575,19 +575,19 @@ { case 0: if (ftype == Thrift.Type.LIST) { - var _size100 = 0; - var _rtmp3104; + var _size166 = 0; + var _rtmp3170; this.success = []; - var _etype103 = 0; - _rtmp3104 = input.readListBegin(); - _etype103 = _rtmp3104.etype; - _size100 = _rtmp3104.size; - for (var _i105 = 0; _i105 < _size100; ++_i105) - { - var elem106 = null; - elem106 = new ttypes.ColumnOrSuperColumn(); - elem106.read(input); - this.success.push(elem106); + var _etype169 = 0; + _rtmp3170 = input.readListBegin(); + _etype169 = _rtmp3170.etype; + _size166 = _rtmp3170.size; + for (var _i171 = 0; _i171 < _size166; ++_i171) + { + var elem172 = null; + elem172 = new ttypes.ColumnOrSuperColumn(); + elem172.read(input); + this.success.push(elem172); } input.readListEnd(); } else { @@ -632,12 +632,12 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.LIST, 0); output.writeListBegin(Thrift.Type.STRUCT, this.success.length); - for (var iter107 in this.success) - { - if (this.success.hasOwnProperty(iter107)) - { - iter107 = this.success[iter107]; - iter107.write(output); + for (var iter173 in this.success) + { + if (this.success.hasOwnProperty(iter173)) + { + iter173 = this.success[iter173]; + iter173.write(output); } } output.writeListEnd(); @@ -900,18 +900,18 @@ { case 1: if (ftype == Thrift.Type.LIST) { - var _size108 = 0; - var _rtmp3112; + var _size174 = 0; + var _rtmp3178; this.keys = []; - var _etype111 = 0; - _rtmp3112 = input.readListBegin(); - _etype111 = _rtmp3112.etype; - _size108 = _rtmp3112.size; - for (var _i113 = 0; _i113 < _size108; ++_i113) - { - var elem114 = null; - elem114 = input.readBinary(); - this.keys.push(elem114); + var _etype177 = 0; + _rtmp3178 = input.readListBegin(); + _etype177 = _rtmp3178.etype; + _size174 = _rtmp3178.size; + for (var _i179 = 0; _i179 < _size174; ++_i179) + { + var elem180 = null; + elem180 = input.readBinary(); + this.keys.push(elem180); } input.readListEnd(); } else { @@ -955,12 +955,12 @@ if (this.keys != null) { output.writeFieldBegin('keys', Thrift.Type.LIST, 1); output.writeListBegin(Thrift.Type.STRING, this.keys.length); - for (var iter115 in this.keys) - { - if (this.keys.hasOwnProperty(iter115)) - { - iter115 = this.keys[iter115]; - output.writeString(iter115); + for (var iter181 in this.keys) + { + if (this.keys.hasOwnProperty(iter181)) + { + iter181 = this.keys[iter181]; + output.writeString(iter181); } } output.writeListEnd(); @@ -1022,36 +1022,36 @@ { case 0: if (ftype == Thrift.Type.MAP) { - var _size116 = 0; - var _rtmp3120; + var _size182 = 0; + var _rtmp3186; this.success = {}; - var _ktype117 = 0; - var _vtype118 = 0; - _rtmp3120 = input.readMapBegin(); - _ktype117 = _rtmp3120.ktype; - _vtype118 = _rtmp3120.vtype; - _size116 = _rtmp3120.size; - for (var _i121 = 0; _i121 < _size116; ++_i121) - { - var key122 = null; - var val123 = null; - key122 = input.readBinary(); - var _size124 = 0; - var _rtmp3128; - val123 = []; - var _etype127 = 0; - _rtmp3128 = input.readListBegin(); - _etype127 = _rtmp3128.etype; - _size124 = _rtmp3128.size; - for (var _i129 = 0; _i129 < _size124; ++_i129) - { - var elem130 = null; - elem130 = new ttypes.ColumnOrSuperColumn(); - elem130.read(input); - val123.push(elem130); + var _ktype183 = 0; + var _vtype184 = 0; + _rtmp3186 = input.readMapBegin(); + _ktype183 = _rtmp3186.ktype; + _vtype184 = _rtmp3186.vtype; + _size182 = _rtmp3186.size; + for (var _i187 = 0; _i187 < _size182; ++_i187) + { + var key188 = null; + var val189 = null; + key188 = input.readBinary(); + var _size190 = 0; + var _rtmp3194; + val189 = []; + var _etype193 = 0; + _rtmp3194 = input.readListBegin(); + _etype193 = _rtmp3194.etype; + _size190 = _rtmp3194.size; + for (var _i195 = 0; _i195 < _size190; ++_i195) + { + var elem196 = null; + elem196 = new ttypes.ColumnOrSuperColumn(); + elem196.read(input); + val189.push(elem196); } input.readListEnd(); - this.success[key122] = val123; + this.success[key188] = val189; } input.readMapEnd(); } else { @@ -1096,19 +1096,19 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.MAP, 0); output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.LIST, Thrift.objectLength(this.success)); - for (var kiter131 in this.success) - { - if (this.success.hasOwnProperty(kiter131)) - { - var viter132 = this.success[kiter131]; - output.writeString(kiter131); - output.writeListBegin(Thrift.Type.STRUCT, viter132.length); - for (var iter133 in viter132) - { - if (viter132.hasOwnProperty(iter133)) - { - iter133 = viter132[iter133]; - iter133.write(output); + for (var kiter197 in this.success) + { + if (this.success.hasOwnProperty(kiter197)) + { + var viter198 = this.success[kiter197]; + output.writeString(kiter197); + output.writeListBegin(Thrift.Type.STRUCT, viter198.length); + for (var iter199 in viter198) + { + if (viter198.hasOwnProperty(iter199)) + { + iter199 = viter198[iter199]; + iter199.write(output); } } output.writeListEnd(); @@ -1173,18 +1173,18 @@ { case 1: if (ftype == Thrift.Type.LIST) { - var _size134 = 0; - var _rtmp3138; + var _size200 = 0; + var _rtmp3204; this.keys = []; - var _etype137 = 0; - _rtmp3138 = input.readListBegin(); - _etype137 = _rtmp3138.etype; - _size134 = _rtmp3138.size; - for (var _i139 = 0; _i139 < _size134; ++_i139) - { - var elem140 = null; - elem140 = input.readBinary(); - this.keys.push(elem140); + var _etype203 = 0; + _rtmp3204 = input.readListBegin(); + _etype203 = _rtmp3204.etype; + _size200 = _rtmp3204.size; + for (var _i205 = 0; _i205 < _size200; ++_i205) + { + var elem206 = null; + elem206 = input.readBinary(); + this.keys.push(elem206); } input.readListEnd(); } else { @@ -1228,12 +1228,12 @@ if (this.keys != null) { output.writeFieldBegin('keys', Thrift.Type.LIST, 1); output.writeListBegin(Thrift.Type.STRING, this.keys.length); - for (var iter141 in this.keys) - { - if (this.keys.hasOwnProperty(iter141)) - { - iter141 = this.keys[iter141]; - output.writeString(iter141); + for (var iter207 in this.keys) + { + if (this.keys.hasOwnProperty(iter207)) + { + iter207 = this.keys[iter207]; + output.writeString(iter207); } } output.writeListEnd(); @@ -1295,22 +1295,22 @@ { case 0: if (ftype == Thrift.Type.MAP) { - var _size142 = 0; - var _rtmp3146; + var _size208 = 0; + var _rtmp3212; this.success = {}; - var _ktype143 = 0; - var _vtype144 = 0; - _rtmp3146 = input.readMapBegin(); - _ktype143 = _rtmp3146.ktype; - _vtype144 = _rtmp3146.vtype; - _size142 = _rtmp3146.size; - for (var _i147 = 0; _i147 < _size142; ++_i147) - { - var key148 = null; - var val149 = null; - key148 = input.readBinary(); - val149 = input.readI32(); - this.success[key148] = val149; + var _ktype209 = 0; + var _vtype210 = 0; + _rtmp3212 = input.readMapBegin(); + _ktype209 = _rtmp3212.ktype; + _vtype210 = _rtmp3212.vtype; + _size208 = _rtmp3212.size; + for (var _i213 = 0; _i213 < _size208; ++_i213) + { + var key214 = null; + var val215 = null; + key214 = input.readBinary(); + val215 = input.readI32(); + this.success[key214] = val215; } input.readMapEnd(); } else { @@ -1355,13 +1355,13 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.MAP, 0); output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.I32, Thrift.objectLength(this.success)); - for (var kiter150 in this.success) - { - if (this.success.hasOwnProperty(kiter150)) - { - var viter151 = this.success[kiter150]; - output.writeString(kiter150); - output.writeI32(viter151); + for (var kiter216 in this.success) + { + if (this.success.hasOwnProperty(kiter216)) + { + var viter217 = this.success[kiter216]; + output.writeString(kiter216); + output.writeI32(viter217); } } output.writeMapEnd(); @@ -1524,19 +1524,19 @@ { case 0: if (ftype == Thrift.Type.LIST) { - var _size152 = 0; - var _rtmp3156; + var _size218 = 0; + var _rtmp3222; this.success = []; - var _etype155 = 0; - _rtmp3156 = input.readListBegin(); - _etype155 = _rtmp3156.etype; - _size152 = _rtmp3156.size; - for (var _i157 = 0; _i157 < _size152; ++_i157) - { - var elem158 = null; - elem158 = new ttypes.KeySlice(); - elem158.read(input); - this.success.push(elem158); + var _etype221 = 0; + _rtmp3222 = input.readListBegin(); + _etype221 = _rtmp3222.etype; + _size218 = _rtmp3222.size; + for (var _i223 = 0; _i223 < _size218; ++_i223) + { + var elem224 = null; + elem224 = new ttypes.KeySlice(); + elem224.read(input); + this.success.push(elem224); } input.readListEnd(); } else { @@ -1581,12 +1581,12 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.LIST, 0); output.writeListBegin(Thrift.Type.STRUCT, this.success.length); - for (var iter159 in this.success) - { - if (this.success.hasOwnProperty(iter159)) - { - iter159 = this.success[iter159]; - iter159.write(output); + for (var iter225 in this.success) + { + if (this.success.hasOwnProperty(iter225)) + { + iter225 = this.success[iter225]; + iter225.write(output); } } output.writeListEnd(); @@ -1749,19 +1749,19 @@ { case 0: if (ftype == Thrift.Type.LIST) { - var _size160 = 0; - var _rtmp3164; + var _size226 = 0; + var _rtmp3230; this.success = []; - var _etype163 = 0; - _rtmp3164 = input.readListBegin(); - _etype163 = _rtmp3164.etype; - _size160 = _rtmp3164.size; - for (var _i165 = 0; _i165 < _size160; ++_i165) - { - var elem166 = null; - elem166 = new ttypes.KeySlice(); - elem166.read(input); - this.success.push(elem166); + var _etype229 = 0; + _rtmp3230 = input.readListBegin(); + _etype229 = _rtmp3230.etype; + _size226 = _rtmp3230.size; + for (var _i231 = 0; _i231 < _size226; ++_i231) + { + var elem232 = null; + elem232 = new ttypes.KeySlice(); + elem232.read(input); + this.success.push(elem232); } input.readListEnd(); } else { @@ -1806,12 +1806,12 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.LIST, 0); output.writeListBegin(Thrift.Type.STRUCT, this.success.length); - for (var iter167 in this.success) - { - if (this.success.hasOwnProperty(iter167)) - { - iter167 = this.success[iter167]; - iter167.write(output); + for (var iter233 in this.success) + { + if (this.success.hasOwnProperty(iter233)) + { + iter233 = this.success[iter233]; + iter233.write(output); } } output.writeListEnd(); @@ -2587,53 +2587,53 @@ { case 1: if (ftype == Thrift.Type.MAP) { - var _size168 = 0; - var _rtmp3172; + var _size234 = 0; + var _rtmp3238; this.mutation_map = {}; - var _ktype169 = 0; - var _vtype170 = 0; - _rtmp3172 = input.readMapBegin(); - _ktype169 = _rtmp3172.ktype; - _vtype170 = _rtmp3172.vtype; - _size168 = _rtmp3172.size; - for (var _i173 = 0; _i173 < _size168; ++_i173) - { - var key174 = null; - var val175 = null; - key174 = input.readBinary(); - var _size176 = 0; - var _rtmp3180; - val175 = {}; - var _ktype177 = 0; - var _vtype178 = 0; - _rtmp3180 = input.readMapBegin(); - _ktype177 = _rtmp3180.ktype; - _vtype178 = _rtmp3180.vtype; - _size176 = _rtmp3180.size; - for (var _i181 = 0; _i181 < _size176; ++_i181) - { - var key182 = null; - var val183 = null; - key182 = input.readString(); - var _size184 = 0; - var _rtmp3188; - val183 = []; - var _etype187 = 0; - _rtmp3188 = input.readListBegin(); - _etype187 = _rtmp3188.etype; - _size184 = _rtmp3188.size; - for (var _i189 = 0; _i189 < _size184; ++_i189) - { - var elem190 = null; - elem190 = new ttypes.Mutation(); - elem190.read(input); - val183.push(elem190); + var _ktype235 = 0; + var _vtype236 = 0; + _rtmp3238 = input.readMapBegin(); + _ktype235 = _rtmp3238.ktype; + _vtype236 = _rtmp3238.vtype; + _size234 = _rtmp3238.size; + for (var _i239 = 0; _i239 < _size234; ++_i239) + { + var key240 = null; + var val241 = null; + key240 = input.readBinary(); + var _size242 = 0; + var _rtmp3246; + val241 = {}; + var _ktype243 = 0; + var _vtype244 = 0; + _rtmp3246 = input.readMapBegin(); + _ktype243 = _rtmp3246.ktype; + _vtype244 = _rtmp3246.vtype; + _size242 = _rtmp3246.size; + for (var _i247 = 0; _i247 < _size242; ++_i247) + { + var key248 = null; + var val249 = null; + key248 = input.readString(); + var _size250 = 0; + var _rtmp3254; + val249 = []; + var _etype253 = 0; + _rtmp3254 = input.readListBegin(); + _etype253 = _rtmp3254.etype; + _size250 = _rtmp3254.size; + for (var _i255 = 0; _i255 < _size250; ++_i255) + { + var elem256 = null; + elem256 = new ttypes.Mutation(); + elem256.read(input); + val249.push(elem256); } input.readListEnd(); - val175[key182] = val183; + val241[key248] = val249; } input.readMapEnd(); - this.mutation_map[key174] = val175; + this.mutation_map[key240] = val241; } input.readMapEnd(); } else { @@ -2661,26 +2661,26 @@ if (this.mutation_map != null) { output.writeFieldBegin('mutation_map', Thrift.Type.MAP, 1); output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.MAP, Thrift.objectLength(this.mutation_map)); - for (var kiter191 in this.mutation_map) - { - if (this.mutation_map.hasOwnProperty(kiter191)) - { - var viter192 = this.mutation_map[kiter191]; - output.writeString(kiter191); - output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.LIST, Thrift.objectLength(viter192)); - for (var kiter193 in viter192) - { - if (viter192.hasOwnProperty(kiter193)) - { - var viter194 = viter192[kiter193]; - output.writeString(kiter193); - output.writeListBegin(Thrift.Type.STRUCT, viter194.length); - for (var iter195 in viter194) - { - if (viter194.hasOwnProperty(iter195)) - { - iter195 = viter194[iter195]; - iter195.write(output); + for (var kiter257 in this.mutation_map) + { + if (this.mutation_map.hasOwnProperty(kiter257)) + { + var viter258 = this.mutation_map[kiter257]; + output.writeString(kiter257); + output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.LIST, Thrift.objectLength(viter258)); + for (var kiter259 in viter258) + { + if (viter258.hasOwnProperty(kiter259)) + { + var viter260 = viter258[kiter259]; + output.writeString(kiter259); + output.writeListBegin(Thrift.Type.STRUCT, viter260.length); + for (var iter261 in viter260) + { + if (viter260.hasOwnProperty(iter261)) + { + iter261 = viter260[iter261]; + iter261.write(output); } } output.writeListEnd(); @@ -2964,35 +2964,35 @@ { case 0: if (ftype == Thrift.Type.MAP) { - var _size196 = 0; - var _rtmp3200; + var _size262 = 0; + var _rtmp3266; this.success = {}; - var _ktype197 = 0; - var _vtype198 = 0; - _rtmp3200 = input.readMapBegin(); - _ktype197 = _rtmp3200.ktype; - _vtype198 = _rtmp3200.vtype; - _size196 = _rtmp3200.size; - for (var _i201 = 0; _i201 < _size196; ++_i201) - { - var key202 = null; - var val203 = null; - key202 = input.readString(); - var _size204 = 0; - var _rtmp3208; - val203 = []; - var _etype207 = 0; - _rtmp3208 = input.readListBegin(); - _etype207 = _rtmp3208.etype; - _size204 = _rtmp3208.size; - for (var _i209 = 0; _i209 < _size204; ++_i209) - { - var elem210 = null; - elem210 = input.readString(); - val203.push(elem210); + var _ktype263 = 0; + var _vtype264 = 0; + _rtmp3266 = input.readMapBegin(); + _ktype263 = _rtmp3266.ktype; + _vtype264 = _rtmp3266.vtype; + _size262 = _rtmp3266.size; + for (var _i267 = 0; _i267 < _size262; ++_i267) + { + var key268 = null; + var val269 = null; + key268 = input.readString(); + var _size270 = 0; + var _rtmp3274; + val269 = []; + var _etype273 = 0; + _rtmp3274 = input.readListBegin(); + _etype273 = _rtmp3274.etype; + _size270 = _rtmp3274.size; + for (var _i275 = 0; _i275 < _size270; ++_i275) + { + var elem276 = null; + elem276 = input.readString(); + val269.push(elem276); } input.readListEnd(); - this.success[key202] = val203; + this.success[key268] = val269; } input.readMapEnd(); } else { @@ -3021,19 +3021,19 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.MAP, 0); output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.LIST, Thrift.objectLength(this.success)); - for (var kiter211 in this.success) - { - if (this.success.hasOwnProperty(kiter211)) - { - var viter212 = this.success[kiter211]; - output.writeString(kiter211); - output.writeListBegin(Thrift.Type.STRING, viter212.length); - for (var iter213 in viter212) - { - if (viter212.hasOwnProperty(iter213)) - { - iter213 = viter212[iter213]; - output.writeString(iter213); + for (var kiter277 in this.success) + { + if (this.success.hasOwnProperty(kiter277)) + { + var viter278 = this.success[kiter277]; + output.writeString(kiter277); + output.writeListBegin(Thrift.Type.STRING, viter278.length); + for (var iter279 in viter278) + { + if (viter278.hasOwnProperty(iter279)) + { + iter279 = viter278[iter279]; + output.writeString(iter279); } } output.writeListEnd(); @@ -3108,19 +3108,19 @@ { case 0: if (ftype == Thrift.Type.LIST) { - var _size214 = 0; - var _rtmp3218; + var _size280 = 0; + var _rtmp3284; this.success = []; - var _etype217 = 0; - _rtmp3218 = input.readListBegin(); - _etype217 = _rtmp3218.etype; - _size214 = _rtmp3218.size; - for (var _i219 = 0; _i219 < _size214; ++_i219) - { - var elem220 = null; - elem220 = new ttypes.KsDef(); - elem220.read(input); - this.success.push(elem220); + var _etype283 = 0; + _rtmp3284 = input.readListBegin(); + _etype283 = _rtmp3284.etype; + _size280 = _rtmp3284.size; + for (var _i285 = 0; _i285 < _size280; ++_i285) + { + var elem286 = null; + elem286 = new ttypes.KsDef(); + elem286.read(input); + this.success.push(elem286); } input.readListEnd(); } else { @@ -3149,12 +3149,12 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.LIST, 0); output.writeListBegin(Thrift.Type.STRUCT, this.success.length); - for (var iter221 in this.success) - { - if (this.success.hasOwnProperty(iter221)) - { - iter221 = this.success[iter221]; - iter221.write(output); + for (var iter287 in this.success) + { + if (this.success.hasOwnProperty(iter287)) + { + iter287 = this.success[iter287]; + iter287.write(output); } } output.writeListEnd(); @@ -3413,19 +3413,19 @@ { case 0: if (ftype == Thrift.Type.LIST) { - var _size222 = 0; - var _rtmp3226; + var _size288 = 0; + var _rtmp3292; this.success = []; - var _etype225 = 0; - _rtmp3226 = input.readListBegin(); - _etype225 = _rtmp3226.etype; - _size222 = _rtmp3226.size; - for (var _i227 = 0; _i227 < _size222; ++_i227) - { - var elem228 = null; - elem228 = new ttypes.TokenRange(); - elem228.read(input); - this.success.push(elem228); + var _etype291 = 0; + _rtmp3292 = input.readListBegin(); + _etype291 = _rtmp3292.etype; + _size288 = _rtmp3292.size; + for (var _i293 = 0; _i293 < _size288; ++_i293) + { + var elem294 = null; + elem294 = new ttypes.TokenRange(); + elem294.read(input); + this.success.push(elem294); } input.readListEnd(); } else { @@ -3454,12 +3454,12 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.LIST, 0); output.writeListBegin(Thrift.Type.STRUCT, this.success.length); - for (var iter229 in this.success) - { - if (this.success.hasOwnProperty(iter229)) - { - iter229 = this.success[iter229]; - iter229.write(output); + for (var iter295 in this.success) + { + if (this.success.hasOwnProperty(iter295)) + { + iter295 = this.success[iter295]; + iter295.write(output); } } output.writeListEnd(); @@ -3901,18 +3901,18 @@ { case 0: if (ftype == Thrift.Type.LIST) { - var _size230 = 0; - var _rtmp3234; + var _size296 = 0; + var _rtmp3300; this.success = []; - var _etype233 = 0; - _rtmp3234 = input.readListBegin(); - _etype233 = _rtmp3234.etype; - _size230 = _rtmp3234.size; - for (var _i235 = 0; _i235 < _size230; ++_i235) - { - var elem236 = null; - elem236 = input.readString(); - this.success.push(elem236); + var _etype299 = 0; + _rtmp3300 = input.readListBegin(); + _etype299 = _rtmp3300.etype; + _size296 = _rtmp3300.size; + for (var _i301 = 0; _i301 < _size296; ++_i301) + { + var elem302 = null; + elem302 = input.readString(); + this.success.push(elem302); } input.readListEnd(); } else { @@ -3941,12 +3941,12 @@ if (this.success != null) { output.writeFieldBegin('success', Thrift.Type.LIST, 0); output.writeListBegin(Thrift.Type.STRING, this.success.length); - for (var iter237 in this.success) - { - if (this.success.hasOwnProperty(iter237)) - { - iter237 = this.success[iter237]; - output.writeString(iter237); + for (var iter303 in this.success) + { + if (this.success.hasOwnProperty(iter303)) + { + iter303 = this.success[iter303]; + output.writeString(iter303); } } output.writeListEnd(); ======================================= --- /lib/gen-nodejs/cassandra_types.js Thu Aug 25 16:20:07 2011 +++ /lib/gen-nodejs/cassandra_types.js Thu Jan 12 09:21:14 2012 @@ -23,7 +23,8 @@ 'LT' : 4 }; ttypes.IndexType = { -'KEYS' : 0 +'KEYS' : 0, +'CUSTOM' : 1 }; ttypes.Compression = { 'GZIP' : 1, @@ -34,7 +35,7 @@ 'VOID' : 2, 'INT' : 3 }; -ttypes.VERSION = '19.10.0'; +ttypes.VERSION = '19.19.0'; var Column = module.exports.Column = function(args) { this.name = null; this.value = null; @@ -1713,10 +1714,94 @@ return; }; +var EndpointDetails = module.exports.EndpointDetails = function(args) { + this.host = null; + this.datacenter = null; + this.rack = null; + if (args) { + if (args.host !== undefined) { + this.host = args.host; + } + if (args.datacenter !== undefined) { + this.datacenter = args.datacenter; + } + if (args.rack !== undefined) { + this.rack = args.rack; + } + } +}; +EndpointDetails.prototype = {}; +EndpointDetails.prototype.read = function(input) { + input.readStructBegin(); + while (true) + { + var ret = input.readFieldBegin(); + var fname = ret.fname; + var ftype = ret.ftype; + var fid = ret.fid; + if (ftype == Thrift.Type.STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == Thrift.Type.STRING) { + this.host = input.readString(); + } else { + input.skip(ftype); + } + break; + case 2: + if (ftype == Thrift.Type.STRING) { + this.datacenter = input.readString(); + } else { + input.skip(ftype); + } + break; + case 3: + if (ftype == Thrift.Type.STRING) { + this.rack = input.readString(); + } else { + input.skip(ftype); + } + break; + default: + input.skip(ftype); + } + input.readFieldEnd(); + } + input.readStructEnd(); + return; +}; + +EndpointDetails.prototype.write = function(output) { + output.writeStructBegin('EndpointDetails'); + if (this.host != null) { + output.writeFieldBegin('host', Thrift.Type.STRING, 1); + output.writeString(this.host); + output.writeFieldEnd(); + } + if (this.datacenter != null) { + output.writeFieldBegin('datacenter', Thrift.Type.STRING, 2); + output.writeString(this.datacenter); + output.writeFieldEnd(); + } + if (this.rack != null) { + output.writeFieldBegin('rack', Thrift.Type.STRING, 3); + output.writeString(this.rack); + output.writeFieldEnd(); + } + output.writeFieldStop(); + output.writeStructEnd(); + return; +}; + var TokenRange = module.exports.TokenRange = function(args) { this.start_token = null; this.end_token = null; this.endpoints = null; + this.rpc_endpoints = null; + this.endpoint_details = null; if (args) { if (args.start_token !== undefined) { this.start_token = args.start_token; @@ -1727,6 +1812,12 @@ if (args.endpoints !== undefined) { this.endpoints = args.endpoints; } + if (args.rpc_endpoints !== undefined) { + this.rpc_endpoints = args.rpc_endpoints; + } + if (args.endpoint_details !== undefined) { + this.endpoint_details = args.endpoint_details; + } } }; TokenRange.prototype = {}; @@ -1772,6 +1863,47 @@ elem46 = input.readString(); this.endpoints.push(elem46); } + input.readListEnd(); + } else { + input.skip(ftype); + } + break; + case 4: + if (ftype == Thrift.Type.LIST) { + var _size47 = 0; + var _rtmp351; + this.rpc_endpoints = []; + var _etype50 = 0; + _rtmp351 = input.readListBegin(); + _etype50 = _rtmp351.etype; + _size47 = _rtmp351.size; + for (var _i52 = 0; _i52 < _size47; ++_i52) + { + var elem53 = null; + elem53 = input.readString(); + this.rpc_endpoints.push(elem53); + } + input.readListEnd(); + } else { + input.skip(ftype); + } + break; + case 5: + if (ftype == Thrift.Type.LIST) { + var _size54 = 0; + var _rtmp358; + this.endpoint_details = []; + var _etype57 = 0; + _rtmp358 = input.readListBegin(); + _etype57 = _rtmp358.etype; + _size54 = _rtmp358.size; + for (var _i59 = 0; _i59 < _size54; ++_i59) + { + var elem60 = null; + elem60 = new ttypes.EndpointDetails(); + elem60.read(input); + this.endpoint_details.push(elem60); + } input.readListEnd(); } else { input.skip(ftype); @@ -1801,12 +1933,40 @@ if (this.endpoints != null) { output.writeFieldBegin('endpoints', Thrift.Type.LIST, 3); output.writeListBegin(Thrift.Type.STRING, this.endpoints.length); - for (var iter47 in this.endpoints) - { - if (this.endpoints.hasOwnProperty(iter47)) - { - iter47 = this.endpoints[iter47]; - output.writeString(iter47); + for (var iter61 in this.endpoints) + { + if (this.endpoints.hasOwnProperty(iter61)) + { + iter61 = this.endpoints[iter61]; + output.writeString(iter61); + } + } + output.writeListEnd(); + output.writeFieldEnd(); + } + if (this.rpc_endpoints != null) { + output.writeFieldBegin('rpc_endpoints', Thrift.Type.LIST, 4); + output.writeListBegin(Thrift.Type.STRING, this.rpc_endpoints.length); + for (var iter62 in this.rpc_endpoints) + { + if (this.rpc_endpoints.hasOwnProperty(iter62)) + { + iter62 = this.rpc_endpoints[iter62]; + output.writeString(iter62); + } + } + output.writeListEnd(); + output.writeFieldEnd(); + } + if (this.endpoint_details != null) { + output.writeFieldBegin('endpoint_details', Thrift.Type.LIST, 5); + output.writeListBegin(Thrift.Type.STRUCT, this.endpoint_details.length); + for (var iter63 in this.endpoint_details) + { + if (this.endpoint_details.hasOwnProperty(iter63)) + { + iter63 = this.endpoint_details[iter63]; + iter63.write(output); } } output.writeListEnd(); @@ -1841,22 +2001,22 @@ { case 1: if (ftype == Thrift.Type.MAP) { - var _size48 = 0; - var _rtmp352; + var _size64 = 0; + var _rtmp368; this.credentials = {}; - var _ktype49 = 0; - var _vtype50 = 0; - _rtmp352 = input.readMapBegin(); - _ktype49 = _rtmp352.ktype; - _vtype50 = _rtmp352.vtype; - _size48 = _rtmp352.size; - for (var _i53 = 0; _i53 < _size48; ++_i53) - { - var key54 = null; - var val55 = null; - key54 = input.readString(); - val55 = input.readString(); - this.credentials[key54] = val55; + var _ktype65 = 0; + var _vtype66 = 0; + _rtmp368 = input.readMapBegin(); + _ktype65 = _rtmp368.ktype; + _vtype66 = _rtmp368.vtype; + _size64 = _rtmp368.size; + for (var _i69 = 0; _i69 < _size64; ++_i69) + { + var key70 = null; + var val71 = null; + key70 = input.readString(); + val71 = input.readString(); + this.credentials[key70] = val71; } input.readMapEnd(); } else { @@ -1880,13 +2040,13 @@ if (this.credentials != null) { output.writeFieldBegin('credentials', Thrift.Type.MAP, 1); output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.credentials)); - for (var kiter56 in this.credentials) - { - if (this.credentials.hasOwnProperty(kiter56)) - { - var viter57 = this.credentials[kiter56]; - output.writeString(kiter56); - output.writeString(viter57); + for (var kiter72 in this.credentials) + { + if (this.credentials.hasOwnProperty(kiter72)) + { + var viter73 = this.credentials[kiter72]; + output.writeString(kiter72); + output.writeString(viter73); } } output.writeMapEnd(); @@ -1902,6 +2062,7 @@ this.validation_class = null; this.index_type = null; this.index_name = null; + this.index_options = null; if (args) { if (args.name !== undefined) { this.name = args.name; @@ -1915,6 +2076,9 @@ if (args.index_name !== undefined) { this.index_name = args.index_name; } + if (args.index_options !== undefined) { + this.index_options = args.index_options; + } } }; ColumnDef.prototype = {}; @@ -1958,6 +2122,30 @@ } else { input.skip(ftype); } + break; + case 5: + if (ftype == Thrift.Type.MAP) { + var _size74 = 0; + var _rtmp378; + this.index_options = {}; + var _ktype75 = 0; + var _vtype76 = 0; + _rtmp378 = input.readMapBegin(); + _ktype75 = _rtmp378.ktype; + _vtype76 = _rtmp378.vtype; + _size74 = _rtmp378.size; + for (var _i79 = 0; _i79 < _size74; ++_i79) + { + var key80 = null; + var val81 = null; + key80 = input.readString(); + val81 = input.readString(); + this.index_options[key80] = val81; + } + input.readMapEnd(); + } else { + input.skip(ftype); + } break; default: input.skip(ftype); @@ -1990,6 +2178,21 @@ output.writeString(this.index_name); output.writeFieldEnd(); } + if (this.index_options != null) { + output.writeFieldBegin('index_options', Thrift.Type.MAP, 5); + output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.index_options)); + for (var kiter82 in this.index_options) + { + if (this.index_options.hasOwnProperty(kiter82)) + { + var viter83 = this.index_options[kiter82]; + output.writeString(kiter82); + output.writeString(viter83); + } + } + output.writeMapEnd(); + output.writeFieldEnd(); + } output.writeFieldStop(); output.writeStructEnd(); return; @@ -2013,14 +2216,15 @@ this.max_compaction_threshold = null; this.row_cache_save_period_in_seconds = null; this.key_cache_save_period_in_seconds = null; - this.memtable_flush_after_mins = null; - this.memtable_throughput_in_mb = null; - this.memtable_operations_in_millions = null; this.replicate_on_write = null; this.merge_shards_chance = null; this.key_validation_class = null; - this.row_cache_provider = 'org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider'; + this.row_cache_provider = null; this.key_alias = null; + this.compaction_strategy = null; + this.compaction_strategy_options = null; + this.row_cache_keys_to_save = null; + this.compression_options = null; if (args) { if (args.keyspace !== undefined) { this.keyspace = args.keyspace; @@ -2073,15 +2277,6 @@ if (args.key_cache_save_period_in_seconds !== undefined) { this.key_cache_save_period_in_seconds = args.key_cache_save_period_in_seconds; } - if (args.memtable_flush_after_mins !== undefined) { - this.memtable_flush_after_mins = args.memtable_flush_after_mins; - } - if (args.memtable_throughput_in_mb !== undefined) { - this.memtable_throughput_in_mb = args.memtable_throughput_in_mb; - } - if (args.memtable_operations_in_millions !== undefined) { - this.memtable_operations_in_millions = args.memtable_operations_in_millions; - } if (args.replicate_on_write !== undefined) { this.replicate_on_write = args.replicate_on_write; } @@ -2097,6 +2292,18 @@ if (args.key_alias !== undefined) { this.key_alias = args.key_alias; } + if (args.compaction_strategy !== undefined) { + this.compaction_strategy = args.compaction_strategy; + } + if (args.compaction_strategy_options !== undefined) { + this.compaction_strategy_options = args.compaction_strategy_options; + } + if (args.row_cache_keys_to_save !== undefined) { + this.row_cache_keys_to_save = args.row_cache_keys_to_save; + } + if (args.compression_options !== undefined) { + this.compression_options = args.compression_options; + } } }; CfDef.prototype = {}; @@ -2178,19 +2385,19 @@ break; case 13: if (ftype == Thrift.Type.LIST) { - var _size58 = 0; - var _rtmp362; + var _size84 = 0; + var _rtmp388; this.column_metadata = []; - var _etype61 = 0; - _rtmp362 = input.readListBegin(); - _etype61 = _rtmp362.etype; - _size58 = _rtmp362.size; - for (var _i63 = 0; _i63 < _size58; ++_i63) - { - var elem64 = null; - elem64 = new ttypes.ColumnDef(); - elem64.read(input); - this.column_metadata.push(elem64); + var _etype87 = 0; + _rtmp388 = input.readListBegin(); + _etype87 = _rtmp388.etype; + _size84 = _rtmp388.size; + for (var _i89 = 0; _i89 < _size84; ++_i89) + { + var elem90 = null; + elem90 = new ttypes.ColumnDef(); + elem90.read(input); + this.column_metadata.push(elem90); } input.readListEnd(); } else { @@ -2245,27 +2452,6 @@ } else { input.skip(ftype); } - break; - case 21: - if (ftype == Thrift.Type.I32) { - this.memtable_flush_after_mins = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 22: - if (ftype == Thrift.Type.I32) { - this.memtable_throughput_in_mb = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 23: - if (ftype == Thrift.Type.DOUBLE) { - this.memtable_operations_in_millions = input.readDouble(); - } else { - input.skip(ftype); - } break; case 24: if (ftype == Thrift.Type.BOOL) { @@ -2301,6 +2487,68 @@ } else { input.skip(ftype); } + break; + case 29: + if (ftype == Thrift.Type.STRING) { + this.compaction_strategy = input.readString(); + } else { + input.skip(ftype); + } + break; + case 30: + if (ftype == Thrift.Type.MAP) { + var _size91 = 0; + var _rtmp395; + this.compaction_strategy_options = {}; + var _ktype92 = 0; + var _vtype93 = 0; + _rtmp395 = input.readMapBegin(); + _ktype92 = _rtmp395.ktype; + _vtype93 = _rtmp395.vtype; + _size91 = _rtmp395.size; + for (var _i96 = 0; _i96 < _size91; ++_i96) + { + var key97 = null; + var val98 = null; + key97 = input.readString(); + val98 = input.readString(); + this.compaction_strategy_options[key97] = val98; + } + input.readMapEnd(); + } else { + input.skip(ftype); + } + break; + case 31: + if (ftype == Thrift.Type.I32) { + this.row_cache_keys_to_save = input.readI32(); + } else { + input.skip(ftype); + } + break; + case 32: + if (ftype == Thrift.Type.MAP) { + var _size99 = 0; + var _rtmp3103; + this.compression_options = {}; + var _ktype100 = 0; + var _vtype101 = 0; + _rtmp3103 = input.readMapBegin(); + _ktype100 = _rtmp3103.ktype; + _vtype101 = _rtmp3103.vtype; + _size99 = _rtmp3103.size; + for (var _i104 = 0; _i104 < _size99; ++_i104) + { + var key105 = null; + var val106 = null; + key105 = input.readString(); + val106 = input.readString(); + this.compression_options[key105] = val106; + } + input.readMapEnd(); + } else { + input.skip(ftype); + } break; default: input.skip(ftype); @@ -2361,12 +2609,12 @@ if (this.column_metadata != null) { output.writeFieldBegin('column_metadata', Thrift.Type.LIST, 13); output.writeListBegin(Thrift.Type.STRUCT, this.column_metadata.length); - for (var iter65 in this.column_metadata) - { - if (this.column_metadata.hasOwnProperty(iter65)) - { - iter65 = this.column_metadata[iter65]; - iter65.write(output); + for (var iter107 in this.column_metadata) + { + if (this.column_metadata.hasOwnProperty(iter107)) + { + iter107 = this.column_metadata[iter107]; + iter107.write(output); } } output.writeListEnd(); @@ -2407,21 +2655,6 @@ output.writeI32(this.key_cache_save_period_in_seconds); output.writeFieldEnd(); } - if (this.memtable_flush_after_mins != null) { - output.writeFieldBegin('memtable_flush_after_mins', Thrift.Type.I32, 21); - output.writeI32(this.memtable_flush_after_mins); - output.writeFieldEnd(); - } - if (this.memtable_throughput_in_mb != null) { - output.writeFieldBegin('memtable_throughput_in_mb', Thrift.Type.I32, 22); - output.writeI32(this.memtable_throughput_in_mb); - output.writeFieldEnd(); - } - if (this.memtable_operations_in_millions != null) { - output.writeFieldBegin('memtable_operations_in_millions', Thrift.Type.DOUBLE, 23); - output.writeDouble(this.memtable_operations_in_millions); - output.writeFieldEnd(); - } if (this.replicate_on_write != null) { output.writeFieldBegin('replicate_on_write', Thrift.Type.BOOL, 24); output.writeBool(this.replicate_on_write); @@ -2447,6 +2680,46 @@ output.writeString(this.key_alias); output.writeFieldEnd(); } + if (this.compaction_strategy != null) { + output.writeFieldBegin('compaction_strategy', Thrift.Type.STRING, 29); + output.writeString(this.compaction_strategy); + output.writeFieldEnd(); + } + if (this.compaction_strategy_options != null) { + output.writeFieldBegin('compaction_strategy_options', Thrift.Type.MAP, 30); + output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.compaction_strategy_options)); + for (var kiter108 in this.compaction_strategy_options) + { + if (this.compaction_strategy_options.hasOwnProperty(kiter108)) + { + var viter109 = this.compaction_strategy_options[kiter108]; + output.writeString(kiter108); + output.writeString(viter109); + } + } + output.writeMapEnd(); + output.writeFieldEnd(); + } + if (this.row_cache_keys_to_save != null) { + output.writeFieldBegin('row_cache_keys_to_save', Thrift.Type.I32, 31); + output.writeI32(this.row_cache_keys_to_save); + output.writeFieldEnd(); + } + if (this.compression_options != null) { + output.writeFieldBegin('compression_options', Thrift.Type.MAP, 32); + output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.compression_options)); + for (var kiter110 in this.compression_options) + { + if (this.compression_options.hasOwnProperty(kiter110)) + { + var viter111 = this.compression_options[kiter110]; + output.writeString(kiter110); + output.writeString(viter111); + } + } + output.writeMapEnd(); + output.writeFieldEnd(); + } output.writeFieldStop(); output.writeStructEnd(); return; @@ -2510,22 +2783,22 @@ break; case 3: if (ftype == Thrift.Type.MAP) { - var _size66 = 0; - var _rtmp370; + var _size112 = 0; + var _rtmp3116; this.strategy_options = {}; - var _ktype67 = 0; - var _vtype68 = 0; - _rtmp370 = input.readMapBegin(); - _ktype67 = _rtmp370.ktype; - _vtype68 = _rtmp370.vtype; - _size66 = _rtmp370.size; - for (var _i71 = 0; _i71 < _size66; ++_i71) - { - var key72 = null; - var val73 = null; - key72 = input.readString(); - val73 = input.readString(); - this.strategy_options[key72] = val73; + var _ktype113 = 0; + var _vtype114 = 0; + _rtmp3116 = input.readMapBegin(); + _ktype113 = _rtmp3116.ktype; + _vtype114 = _rtmp3116.vtype; + _size112 = _rtmp3116.size; + for (var _i117 = 0; _i117 < _size112; ++_i117) + { + var key118 = null; + var val119 = null; + key118 = input.readString(); + val119 = input.readString(); + this.strategy_options[key118] = val119; } input.readMapEnd(); } else { @@ -2541,19 +2814,19 @@ break; case 5: if (ftype == Thrift.Type.LIST) { - var _size74 = 0; - var _rtmp378; + var _size120 = 0; + var _rtmp3124; this.cf_defs = []; - var _etype77 = 0; - _rtmp378 = input.readListBegin(); - _etype77 = _rtmp378.etype; - _size74 = _rtmp378.size; - for (var _i79 = 0; _i79 < _size74; ++_i79) - { - var elem80 = null; - elem80 = new ttypes.CfDef(); - elem80.read(input); - this.cf_defs.push(elem80); + var _etype123 = 0; + _rtmp3124 = input.readListBegin(); + _etype123 = _rtmp3124.etype; + _size120 = _rtmp3124.size; + for (var _i125 = 0; _i125 < _size120; ++_i125) + { + var elem126 = null; + elem126 = new ttypes.CfDef(); + elem126.read(input); + this.cf_defs.push(elem126); } input.readListEnd(); } else { @@ -2591,13 +2864,13 @@ if (this.strategy_options != null) { output.writeFieldBegin('strategy_options', Thrift.Type.MAP, 3); output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.strategy_options)); - for (var kiter81 in this.strategy_options) - { - if (this.strategy_options.hasOwnProperty(kiter81)) - { - var viter82 = this.strategy_options[kiter81]; - output.writeString(kiter81); - output.writeString(viter82); + for (var kiter127 in this.strategy_options) + { + if (this.strategy_options.hasOwnProperty(kiter127)) + { + var viter128 = this.strategy_options[kiter127]; + output.writeString(kiter127); + output.writeString(viter128); } } output.writeMapEnd(); @@ -2611,12 +2884,12 @@ if (this.cf_defs != null) { output.writeFieldBegin('cf_defs', Thrift.Type.LIST, 5); output.writeListBegin(Thrift.Type.STRUCT, this.cf_defs.length); - for (var iter83 in this.cf_defs) - { - if (this.cf_defs.hasOwnProperty(iter83)) - { - iter83 = this.cf_defs[iter83]; - iter83.write(output); + for (var iter129 in this.cf_defs) + { + if (this.cf_defs.hasOwnProperty(iter129)) + { + iter129 = this.cf_defs[iter129]; + iter129.write(output); } } output.writeListEnd(); @@ -2667,19 +2940,19 @@ break; case 2: if (ftype == Thrift.Type.LIST) { - var _size84 = 0; - var _rtmp388; + var _size130 = 0; + var _rtmp3134; this.columns = []; - var _etype87 = 0; - _rtmp388 = input.readListBegin(); - _etype87 = _rtmp388.etype; - _size84 = _rtmp388.size; - for (var _i89 = 0; _i89 < _size84; ++_i89) - { - var elem90 = null; - elem90 = new ttypes.Column(); - elem90.read(input); - this.columns.push(elem90); + var _etype133 = 0; + _rtmp3134 = input.readListBegin(); + _etype133 = _rtmp3134.etype; + _size130 = _rtmp3134.size; + for (var _i135 = 0; _i135 < _size130; ++_i135) + { + var elem136 = null; + elem136 = new ttypes.Column(); + elem136.read(input); + this.columns.push(elem136); } input.readListEnd(); } else { @@ -2705,12 +2978,12 @@ if (this.columns != null) { output.writeFieldBegin('columns', Thrift.Type.LIST, 2); output.writeListBegin(Thrift.Type.STRUCT, this.columns.length); - for (var iter91 in this.columns) - { - if (this.columns.hasOwnProperty(iter91)) - { - iter91 = this.columns[iter91]; - iter91.write(output); + for (var iter137 in this.columns) + { + if (this.columns.hasOwnProperty(iter137)) + { + iter137 = this.columns[iter137]; + iter137.write(output); } } output.writeListEnd(); @@ -2721,10 +2994,163 @@ return; }; +var CqlMetadata = module.exports.CqlMetadata = function(args) { + this.name_types = null; + this.value_types = null; + this.default_name_type = null; + this.default_value_type = null; + if (args) { + if (args.name_types !== undefined) { + this.name_types = args.name_types; + } + if (args.value_types !== undefined) { + this.value_types = args.value_types; + } + if (args.default_name_type !== undefined) { + this.default_name_type = args.default_name_type; + } + if (args.default_value_type !== undefined) { + this.default_value_type = args.default_value_type; + } + } +}; +CqlMetadata.prototype = {}; +CqlMetadata.prototype.read = function(input) { + input.readStructBegin(); + while (true) + { + var ret = input.readFieldBegin(); + var fname = ret.fname; + var ftype = ret.ftype; + var fid = ret.fid; + if (ftype == Thrift.Type.STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == Thrift.Type.MAP) { + var _size138 = 0; + var _rtmp3142; + this.name_types = {}; + var _ktype139 = 0; + var _vtype140 = 0; + _rtmp3142 = input.readMapBegin(); + _ktype139 = _rtmp3142.ktype; + _vtype140 = _rtmp3142.vtype; + _size138 = _rtmp3142.size; + for (var _i143 = 0; _i143 < _size138; ++_i143) + { + var key144 = null; + var val145 = null; + key144 = input.readBinary(); + val145 = input.readString(); + this.name_types[key144] = val145; + } + input.readMapEnd(); + } else { + input.skip(ftype); + } + break; + case 2: + if (ftype == Thrift.Type.MAP) { + var _size146 = 0; + var _rtmp3150; + this.value_types = {}; + var _ktype147 = 0; + var _vtype148 = 0; + _rtmp3150 = input.readMapBegin(); + _ktype147 = _rtmp3150.ktype; + _vtype148 = _rtmp3150.vtype; + _size146 = _rtmp3150.size; + for (var _i151 = 0; _i151 < _size146; ++_i151) + { + var key152 = null; + var val153 = null; + key152 = input.readBinary(); + val153 = input.readString(); + this.value_types[key152] = val153; + } + input.readMapEnd(); + } else { + input.skip(ftype); + } + break; + case 3: + if (ftype == Thrift.Type.STRING) { + this.default_name_type = input.readString(); + } else { + input.skip(ftype); + } + break; + case 4: + if (ftype == Thrift.Type.STRING) { + this.default_value_type = input.readString(); + } else { + input.skip(ftype); + } + break; + default: + input.skip(ftype); + } + input.readFieldEnd(); + } + input.readStructEnd(); + return; +}; + +CqlMetadata.prototype.write = function(output) { + output.writeStructBegin('CqlMetadata'); + if (this.name_types != null) { + output.writeFieldBegin('name_types', Thrift.Type.MAP, 1); + output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.name_types)); + for (var kiter154 in this.name_types) + { + if (this.name_types.hasOwnProperty(kiter154)) + { + var viter155 = this.name_types[kiter154]; + output.writeString(kiter154); + output.writeString(viter155); + } + } + output.writeMapEnd(); + output.writeFieldEnd(); + } + if (this.value_types != null) { + output.writeFieldBegin('value_types', Thrift.Type.MAP, 2); + output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.value_types)); + for (var kiter156 in this.value_types) + { + if (this.value_types.hasOwnProperty(kiter156)) + { + var viter157 = this.value_types[kiter156]; + output.writeString(kiter156); + output.writeString(viter157); + } + } + output.writeMapEnd(); + output.writeFieldEnd(); + } + if (this.default_name_type != null) { + output.writeFieldBegin('default_name_type', Thrift.Type.STRING, 3); + output.writeString(this.default_name_type); + output.writeFieldEnd(); + } + if (this.default_value_type != null) { + output.writeFieldBegin('default_value_type', Thrift.Type.STRING, 4); + output.writeString(this.default_value_type); + output.writeFieldEnd(); + } + output.writeFieldStop(); + output.writeStructEnd(); + return; +}; + var CqlResult = module.exports.CqlResult = function(args) { this.type = null; this.rows = null; this.num = null; + this.schema = null; if (args) { if (args.type !== undefined) { this.type = args.type; @@ -2735,6 +3161,9 @@ if (args.num !== undefined) { this.num = args.num; } + if (args.schema !== undefined) { + this.schema = args.schema; + } } }; CqlResult.prototype = {}; @@ -2760,19 +3189,19 @@ break; case 2: if (ftype == Thrift.Type.LIST) { - var _size92 = 0; - var _rtmp396; + var _size158 = 0; + var _rtmp3162; this.rows = []; - var _etype95 = 0; - _rtmp396 = input.readListBegin(); - _etype95 = _rtmp396.etype; - _size92 = _rtmp396.size; - for (var _i97 = 0; _i97 < _size92; ++_i97) - { - var elem98 = null; - elem98 = new ttypes.CqlRow(); - elem98.read(input); - this.rows.push(elem98); + var _etype161 = 0; + _rtmp3162 = input.readListBegin(); + _etype161 = _rtmp3162.etype; + _size158 = _rtmp3162.size; + for (var _i163 = 0; _i163 < _size158; ++_i163) + { + var elem164 = null; + elem164 = new ttypes.CqlRow(); + elem164.read(input); + this.rows.push(elem164); } input.readListEnd(); } else { @@ -2785,6 +3214,14 @@ } else { input.skip(ftype); } + break; + case 4: + if (ftype == Thrift.Type.STRUCT) { + this.schema = new ttypes.CqlMetadata(); ***The diff for this file has been truncated for email.*** ============================================================================== Revision: fa928c4ff9a5 Author: gdusbabek Date: Mon Jan 16 08:00:22 2012 Log: * introduce ConnectionError for distinguishing pooling errors that should get reported back to the user and errors that the driver should try to address. * Connection uses a timeout to handle instances where a query never finishes (this has been observed with some transport errors). * ConnectionInPool extends Connection and keeps track of connection state and health. * PooledConnection2 is API compatible with PooledConnection (will replace it in next commit). http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=fa928c4ff9a5 Modified: /lib/driver.js /test/test_driver.js ======================================= --- /lib/driver.js Wed Jan 11 09:11:31 2012 +++ /lib/driver.js Mon Jan 16 08:00:22 2012 @@ -22,6 +22,7 @@ var logTiming = require('logmagic').local('node-cassandra-client.driver.timing'); var sys = require('sys'); +var util = require('util'); var constants = require('constants'); var Buffer = require('buffer').Buffer; var EventEmitter = require('events').EventEmitter; @@ -370,6 +371,7 @@ }); }; + /** * @param options: valid parts are: * user, pass, host, port, keyspace, use_bigints, timeout, log_time @@ -378,6 +380,7 @@ options = options || {}; log.info('connecting ' + options.host + ':' + options.port); this.validators = {}; + // todo: build con during connect(). this.con = thrift.createConnection(options.host, options.port); this.client = null; this.connectionInfo = options; @@ -547,7 +550,19 @@ start = new Date().getTime(); logCql.trace('CQL QUERY', {'query': query, 'parameterized_query': cqlString, 'args': args}); - this.client.execute_cql_query(cql, ttypes.Compression.NONE, function(err, res) { + // if a connection dies at the right place, execute_cql_query never returns. make sure the callback gets called. + var timeoutId = setTimeout(function() { + callback(new Error('Connection timed out')); + timeoutId = null; + }, this.timeout); // todo: should we disambiguate connection timeout vs query timeout? + self.client.execute_cql_query(cql, ttypes.Compression.NONE, function(err, res) { + if (!timeoutId) { + log.warn('query returned after timeout: ' + cql); + return; + } else { + clearTimeout(timeoutId); + } + end = new Date().getTime(); diff = (end - start); if (self.connectionInfo.log_time) { @@ -579,8 +594,224 @@ callback(null, res.num); } else if (res.type === ttypes.CqlResultType.VOID) { callback(null); + } else { + callback(new Error('Execution unexpectedly got here. Result type is ' + res.type)); } } }); } }; + + +/** + * pooled connection behave a bit different but offer the same service interface as regular connections. + * This constructor behaves differently from the normal Connection since Connection() does some socket work. + * that work is delayed to connect() here. + */ +var ConnectionInPool = module.exports.ConnectionInPool = function(options) { + options.staleThreshold = options.staleThreshold || 10000; + // cache options so that thrift setup can happen later. + this._options = options; + this.taken = false; // true when being used in a query. + this.connected = false; // true when connected. + this.unhealthyAt = 0; // timestamp this connection went bad. +} +util.inherits(ConnectionInPool, Connection); + +/** + * connects to the remote endpoint. + * @param callback + */ +ConnectionInPool.prototype.connect = function(callback) { + var self = this; + Connection.call(this, this._options); + Connection.prototype.connect.call(this, function(err) { + self.connected = !err; + self.unhealthyAt = err ? new Date().getTime() : 0; + callback(err); + }); +}; + +ConnectionInPool.prototype.isHealthy = function() { + return this.unhealthyAt === 0; +} + +/** + * a 'stale unhealthy' node is a node that has been bad for some period of time. After that + * period, it is safe to retry the connection. + */ +ConnectionInPool.prototype.isStaleUnhealthy = function() { + return !this.isHealthy() && new Date().getTime() - this.unhealthyAt > this._options.staleThreshold; +} + +// this will replace pooled connection and generic-collections at some point. +var PooledConnection2 = module.exports.PooledConnection2 = function(config) { + var self = this; + config = config || {}; + this.connections = []; + this.current_node = 0; + this.use_bigints = config.use_bigints ? true : false; + this.timeout = config.timeout || DEFAULT_CONNECTION_TIMEOUT; + this.log_time = config.log_time || false; + + // Construct a list of nodes from hosts in : form + for (var i = 0; i < config.hosts.length; i++) { + var hostSpec = config.hosts[i]; + if (!hostSpec) { continue; } + var host = hostSpec.split(':'); + if (host.length > 2) { + log.warn('malformed host entry "' + hostSpec + '" (skipping)'); + continue; + } + log.debug("adding " + hostSpec + " to working node list"); + this.connections.push(new ConnectionInPool({ + host: host[0], + port: (isNaN(host[1])) ? 9160 : host[1], + keyspace: config.keyspace, + user: config.user, + pass: config.pass, + use_bigints: self.use_bigints, + timeout: self.timeout, + log_time: self.log_time + })); + } +}; + +/** + * increment the current node pointer, skipping over any bad nodes. has a side-effect of resetting + * unhealthy nodes that are stale (but not reconnecting them). + * @return boolean indicating if all nodes are unhealthy. + */ +PooledConnection2.prototype._incr = function() { + var incrCount = 0; + while (incrCount < this.connections.length) { + incrCount += 1; + this.current_node = (this.current_node + 1) % this.connections.length; + if (this.connections[this.current_node]) { + if (this.connections[this.current_node].isHealthy()) { + break; + } else if (this.connections[this.current_node].isStaleUnhealthy()) { + // unhealthy and stale, so let reset the node (appears as if unconnected). + this.connections[this.current_node].taken = false; + this.connections[this.current_node].connected = false; + this.connections[this.current_node].unhealthyAt = 0; + break; + } else { + //`console.log('not healthy ' + this.current_node + ',' + incrCount); + } + } + } + // all nodes are unhealthy if we looped around and no healthy nodes were found. + return incrCount >= this.connections.length && !this.connections[this.current_node].isHealthy(); +}; + +/** + * execute a query. retries on other nodes when connection failures are detected. + */ +PooledConnection2.prototype.execute = function(query, args, callback) { + var self = this; + self._getNextCon(function(err, con) { + if (err) { + callback(err, null); + } else { + try { + con.taken = true; + con.execute(query, args, function(err, result) { + con.taken = false; + var recoverableError = null; + if (err) { + if (err.hasOwnProperty('name') && contains(appExceptions, err.name)) { + callback(err, null); + return; + } else { + recoverableError = err; + } + if (recoverableError) { + con.unhealthyAt = new Date().getTime(); + con.taken = false; + log.warn('setting unhealthy from execute ' + con.connectionInfo.host + ':' + con.connectionInfo.port); + // try again. + self.execute(query, args, callback); + } + } else { + callback(null, result); + } + }); + } catch (err) { + // individual connection has failed. + con.unhealthyAt = new Date().getTime(); + con.taken = false; + log.warn('setting unhealthy from catch outside execute ' + con.connectionInfo.host + ':' + con.connectionInfo.port); + // try again. + self.execute(query, args, callback); + } + } + }); +}; + +/** gets the next untaken connection. errors when all connections are bad, or loop times out. */ +PooledConnection2.prototype._getNextCon = function(callback) { + var self = this; + var tryStart = new Date().getTime(); + var con = null; + var allBad = false; + var takens = []; + async.whilst(function truthTest() { + // should the timeout of getting a single connection be the sum of all connections? Think of a scenario where the + // timeout is N, but the first X nodes are unresponsive. You still want to allow access to the subsequent good + // nodes. + return !allBad && con === null && (new Date().getTime() - tryStart) < (self.timeout * self.connections.length); + }, function tryConnect(callback) { + var c = self.connections[self.current_node]; + allBad = self._incr(); + if (c.taken) { + takens[self.current_node] = takens[self.current_node] === undefined ? 1 : takens[self.current_node] + 1; + if (takens[self.current_node] > 0) { + // we've tried this node > 1 times and it still isn't available, this means that all other nodes are occupied + // or down (we've looped around all nodes). Continually checking will blow the stack, so lets wait + // 10 ms. before checking again. + setTimeout(callback, 10); + } else { + callback(); + } + } else if (c.unhealthyAt > 0) { + callback(); + } else if (!c.connected) { + c.connect(function(err) { + if (c.connected) { + con = c; + } + // some errors we pass back. some we swallow and iterate over. + if (err instanceof ttypes.NotFoundException) { + callback(err, null); + } else if (err && err.errno && err.errno === constants.ETIMEDOUT) { + callback(); + } else { + callback(); + } + }); + } else { + con = c; + callback(); + } + }, function whenDone(err) { + if (allBad && !err) { + err = new Error('All connections are unhealthy.'); + } else if (!con && !err) { + err = new Error('connection was not set'); + } + callback(err, con); + }); +}; + +PooledConnection2.prototype.shutdown = function(callback) { + this.connections.forEach(function(con) { + if (con.connected) { + con.close(); + } + }); + if (callback) { + callback(); + } +}; + ======================================= --- /test/test_driver.js Wed Jan 11 09:03:09 2012 +++ /test/test_driver.js Mon Jan 16 08:00:22 2012 @@ -27,7 +27,8 @@ var BigInteger = require('../lib/bigint').BigInteger; var Connection = require('../lib/driver').Connection; -var PooledConnection = require('../lib/driver').PooledConnection; +var PooledConnection = require('../lib/driver').PooledConnection2; +var ConnectionInPool = require('../lib/driver').ConnectionInPool; var ttypes = require('../lib/gen-nodejs/cassandra_types'); var Keyspace = require('../node-cassandra-client').Keyspace; var System = require('../lib/system').System; @@ -278,8 +279,8 @@ use_bigints: false}); con.execute('SELECT * FROM foo', [], function(err) { assert.ok(err); - assert.equal(err.name, 'NotFoundException') assert.equal(err.message, 'ColumnFamily or Keyspace does not exist'); + assert.equal(err.name, 'NotFoundException') test.finish(); }); }; @@ -847,7 +848,7 @@ exports.testPooledConnectionFailover = function(test, assert) { - var hosts = ['google.com:8000', '127.0.0.1:6567', '127.0.0.2', '127.0.0.1:19170']; + var hosts = ['google.com:8000', '127.0.0.1:6567', '127.0.0.1:19170', '127.0.0.2']; var conn = new PooledConnection({'hosts': hosts, 'keyspace': 'Keyspace1', use_bigints: true, 'timeout': 5000}); async.series([ @@ -989,4 +990,19 @@ }; - +exports.testConnectionInPool = function(test, assert) { + var con = new ConnectionInPool({ + host: '127.0.0.1', + port: 19170, + keyspace: 'Keyspace1', + use_bigints: true + }); + con.connect(function(err) { + if (err) { + assert.ifError(err); + } else { + con.close(); + test.finish(); + } + }); +}; ============================================================================== Revision: 32b3db04c0af Author: gdusbabek Date: Mon Jan 16 08:26:14 2012 Log: build thrift connection during connect. http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=32b3db04c0af Modified: /lib/driver.js ======================================= --- /lib/driver.js Mon Jan 16 08:00:22 2012 +++ /lib/driver.js Mon Jan 16 08:26:14 2012 @@ -380,8 +380,6 @@ options = options || {}; log.info('connecting ' + options.host + ':' + options.port); this.validators = {}; - // todo: build con during connect(). - this.con = thrift.createConnection(options.host, options.port); this.client = null; this.connectionInfo = options; this.timeout = options.timeout || DEFAULT_CONNECTION_TIMEOUT; @@ -396,6 +394,8 @@ var self = this, timeoutId; + // build connection here, so that timeouts on bad hosts happen now and not in the constructor. + this.con = thrift.createConnection(self.connectionInfo.host, self.connectionInfo.port); this.con.on('error', function(err) { clearTimeout(timeoutId); amendError(err, self.connectionInfo); ============================================================================== Revision: d511ea5c1af3 Author: gdusbabek Date: Mon Jan 16 08:26:47 2012 Log: * add cassandra-env.sh so that JMX gets started (port 7199) * dial log level down to debug. http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=d511ea5c1af3 Added: /test/conf/cassandra-env.sh Modified: /test/conf/log4j-server.properties ======================================= --- /dev/null +++ /test/conf/cassandra-env.sh Mon Jan 16 08:26:47 2012 @@ -0,0 +1,194 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +calculate_heap_sizes() +{ + case "`uname`" in + Linux) + system_memory_in_mb=`free -m | awk '/Mem:/ {print $2}'` + system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo` + break + ;; + FreeBSD) + system_memory_in_bytes=`sysctl hw.physmem | awk '{print $2}'` + system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024` + system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'` + break + ;; + SunOS) + system_memory_in_mb=`prtconf | awk '/Memory size:/ {print $3}'` + system_cpu_cores=`psrinfo | wc -l` + break + ;; + *) + # assume reasonable defaults for e.g. a modern desktop or + # cheap server + system_memory_in_mb="2048" + system_cpu_cores="2" + ;; + esac + + # set max heap size based on the following + # max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB)) + # calculate 1/2 ram and cap to 1024MB + # calculate 1/4 ram and cap to 8192MB + # pick the max + half_system_memory_in_mb=`expr $system_memory_in_mb / 2` + quarter_system_memory_in_mb=`expr $half_system_memory_in_mb / 2` + if [ "$half_system_memory_in_mb" -gt "1024" ] + then + half_system_memory_in_mb="1024" + fi + if [ "$quarter_system_memory_in_mb" -gt "8192" ] + then + quarter_system_memory_in_mb="8192" + fi + if [ "$half_system_memory_in_mb" -gt "$quarter_system_memory_in_mb" ] + then + max_heap_size_in_mb="$half_system_memory_in_mb" + else + max_heap_size_in_mb="$quarter_system_memory_in_mb" + fi + MAX_HEAP_SIZE="${max_heap_size_in_mb}M" + + # Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4 * heap size) + max_sensible_yg_per_core_in_mb="100" + max_sensible_yg_in_mb=`expr $max_sensible_yg_per_core_in_mb "*" $system_cpu_cores` + + desired_yg_in_mb=`expr $max_heap_size_in_mb / 4` + + if [ "$desired_yg_in_mb" -gt "$max_sensible_yg_in_mb" ] + then + HEAP_NEWSIZE="${max_sensible_yg_in_mb}M" + else + HEAP_NEWSIZE="${desired_yg_in_mb}M" + fi +} + +# Override these to set the amount of memory to allocate to the JVM at +# start-up. For production use you almost certainly want to adjust +# this for your environment. MAX_HEAP_SIZE is the total amount of +# memory dedicated to the Java heap; HEAP_NEWSIZE refers to the size +# of the young generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should +# be either set or not (if you set one, set the other). +# +# The main trade-off for the young generation is that the larger it +# is, the longer GC pause times will be. The shorter it is, the more +# expensive GC will be (usually). +# +# The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause +# times. If in doubt, and if you do not particularly want to tweak, go with +# 100 MB per physical CPU core. + +#MAX_HEAP_SIZE="4G" +#HEAP_NEWSIZE="800M" + +if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" ]; then + calculate_heap_sizes +else + if [ "x$MAX_HEAP_SIZE" = "x" ] || [ "x$HEAP_NEWSIZE" = "x" ]; then + echo "please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs (see cassandra-env.sh)" + exit 1 + fi +fi + +# Specifies the default port over which Cassandra will be available for +# JMX connections. +JMX_PORT="7199" + + +# Here we create the arguments that will get passed to the jvm when +# starting cassandra. + +# enable assertions. disabling this in production will give a modest +# performance benefit (around 5%). +JVM_OPTS="$JVM_OPTS -ea" + +# add the jamm javaagent +check_openjdk=`"${JAVA:-java}" -version 2>&1 | awk '{if (NR == 2) {print $1}}'` +if [ "$check_openjdk" != "OpenJDK" ] +then + JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar" +fi + +# enable thread priorities, primarily so we can give periodic tasks +# a lower priority to avoid interfering with client workload +JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities" +# allows lowering thread priority without being root. see +# http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html +JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42" + +# min and max heap sizes should be set to the same value to avoid +# stop-the-world GC pauses during resize, and so that we can lock the +# heap in memory on startup to prevent any of it from being swapped +# out. +JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}" +JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}" +JVM_OPTS="$JVM_OPTS -Xmn${HEAP_NEWSIZE}" +JVM_OPTS="$JVM_OPTS -XX:+HeapDumpOnOutOfMemoryError" + +# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR +if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then + JVM_OPTS="$JVM_OPTS -XX:HeapDumpPath=$CASSANDRA_HEAPDUMP_DIR/cassandra-`date +%s`-pid$$.hprof" +fi + +if [ "`uname`" = "Linux" ] ; then + # reduce the per-thread stack size to minimize the impact of Thrift + # thread-per-client. (Best practice is for client connections to + # be pooled anyway.) Only do so on Linux where it is known to be + # supported. + JVM_OPTS="$JVM_OPTS -Xss128k" +fi + +# GC tuning options +JVM_OPTS="$JVM_OPTS -XX:+UseParNewGC" +JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC" +JVM_OPTS="$JVM_OPTS -XX:+CMSParallelRemarkEnabled" +JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=8" +JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=1" +JVM_OPTS="$JVM_OPTS -XX:CMSInitiatingOccupancyFraction=75" +JVM_OPTS="$JVM_OPTS -XX:+UseCMSInitiatingOccupancyOnly" + +# GC logging options -- uncomment to enable +# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails" +# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDateStamps" +# JVM_OPTS="$JVM_OPTS -XX:+PrintHeapAtGC" +# JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution" +# JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime" +# JVM_OPTS="$JVM_OPTS -XX:+PrintPromotionFailure" +# JVM_OPTS="$JVM_OPTS -XX:PrintFLSStatistics=1" +# JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc-`date +%s`.log" + +# uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414 +# JVM_OPTS="$JVM_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1414" + +# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See +# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version: +# comment out this entry to enable IPv6 support). +JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true" + +# jmx: metrics and administration interface +# +# add this if you're having trouble connecting: +# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=" +# +# see +# http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole +# for more on configuring JMX through firewalls, etc. (Short version: +# get it working with no firewall first.) +JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT" +JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false" +JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false" ======================================= --- /test/conf/log4j-server.properties Tue Nov 29 03:18:53 2011 +++ /test/conf/log4j-server.properties Mon Jan 16 08:26:47 2012 @@ -18,22 +18,13 @@ # (%l is slower.) # output messages into a rolling log file as well as stdout -log4j.rootLogger=TRACE,stdout,R +log4j.rootLogger=DEBUG,stdout # stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n -# rolling log file -log4j.appender.R=org.apache.log4j.RollingFileAppender -log4j.appender.R.maxFileSize=20MB -log4j.appender.R.maxBackupIndex=50 -log4j.appender.R.layout=org.apache.log4j.PatternLayout -log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n -# Edit the next line to point to your logs directory -log4j.appender.R.File=/tmp/cass/system.log - # Application logging options #log4j.logger.org.apache.cassandra=DEBUG #log4j.logger.org.apache.cassandra.db=DEBUG ============================================================================== Revision: 78b70294277c Author: gdusbabek Date: Mon Jan 16 08:31:48 2012 Log: PooledConnection2 -> PooledConnection http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=78b70294277c Modified: /lib/driver.js /test/test_driver.js ======================================= --- /lib/driver.js Mon Jan 16 08:26:14 2012 +++ /lib/driver.js Mon Jan 16 08:31:48 2012 @@ -183,194 +183,6 @@ return this._colCount; }; -/** - * Perform queries against a pool of open connections. - * - * Accepts a single argument of an object used to configure the new PooledConnection - * instance. The config object supports the following attributes: - * - * hosts : List of strings in host:port format. - * keyspace : Keyspace name. - * user : User for authentication (optional). - * pass : Password for authentication (optional). - * maxSize : Maximum number of connection to pool (optional). - * idleMillis : Idle connection timeout in milliseconds (optional). - * - * Example: - * - * var pool = new PooledConnection({ - * hosts : ['host1:9160', 'host2:9170', 'host3', 'host4'], - * keyspace : 'database', - * user : 'mary', - * pass : 'qwerty', - * maxSize : 25, - * idleMillis : 30000 - * }); - * - * @param config an object used to control the creation of new instances. - */ -var PooledConnection = module.exports.PooledConnection = function(config) { - config = config || {}; - this.nodes = []; - this.holdFor = 10000; - this.current_node = 0; - this.use_bigints = config.use_bigints ? true : false; - this.timeout = config.timeout || DEFAULT_CONNECTION_TIMEOUT; - this.log_time = config.log_time || false; - - // Construct a list of nodes from hosts in : form - for (var i = 0; i < config.hosts.length; i++) { - var hostSpec = config.hosts[i]; - if (!hostSpec) { continue; } - var host = hostSpec.split(':'); - if (host.length > 2) { - log.warn('malformed host entry "' + hostSpec + '" (skipping)'); - } - log.debug("adding " + hostSpec + " to working node list"); - this.nodes.push([host[0], (isNaN(host[1])) ? 9160 : host[1]]); - } - - var self = this; - var maxSize = isNaN(config.maxSize) ? 25 : config.maxsize; - var idleMillis = isNaN(config.idleMillis) ? 30000 : config.idleMillis; - - this.pool = genericPool.Pool({ - name : 'Connection', - create : function(callback) { - // Advance through the set of configured nodes - if ((self.current_node + 1) >= self.nodes.length) { - self.current_node = 0; - } else { - self.current_node++; - } - - var tries = self.nodes.length; - - function retry(curNode) { - tries--; - - if ((curNode + 1) >= self.nodes.length) { - curNode = 0; - } else { - curNode++; - } - - var node = self.nodes[curNode]; - // Skip over any nodes known to be bad - if (node.holdUntil > (new Date().getTime())) { - return retry(curNode); - } - - var conn = new Connection({host: node[0], - port: node[1], - keyspace: config.keyspace, - user: config.user, - pass: config.pass, - use_bigints: self.use_bigints, - timeout: self.timeout, - log_time: self.log_time}); - - conn.connect(function(err) { - if (!err) { // Success, we're connected - callback(conn); - } else if (tries > 0) { // Fail, mark node inactive and retry - log.err("Unabled to connect to " + node[0] + ":" + node[1] + " (skipping)"); - node.holdUntil = new Date().getTime() + self.holdFor; - retry(curNode); - } else { // Exhausted all options - callback(err); - } - }); - } - retry(self.current_node); - }, - destroy : function(conn) { conn.close(); }, - max : maxSize, - idleTimeoutMillis : idleMillis, - log : false - }); -}; - -/** - * executes any query - * @param query any CQL statement with '?' placeholders. - * @param args array of arguments that will be bound to the query. - * @param callback executed when the query returns. the callback takes a different number of arguments depending on the - * type of query: - * SELECT (single row): callback(err, row) - * SELECT (mult rows) : callback(err, rows) - * SELECT (count) : callback(err, count) - * UPDATE : callback(err) - * DELETE : callback(err) - */ -PooledConnection.prototype.execute = function(query, args, callback) { - var self = this; - var seen = false; - - var exe = function(errback) { - async.waterfall([ - function acquireConnFromPool(callback) { - self.pool.acquire(function(err, conn) { - callback(err, conn); - }); - }, - - function executeQuery(conn, callback) { - conn.execute(query, args, function(err, res) { - callback(err, res, conn); - }); - } - ], - - function(err, res, conn) { - var connectionInfo; - - if (conn) { - self.pool.release(conn); - } - - if (err) { - if (err.hasOwnProperty('name') && contains(appExceptions, err.name)) { - callback(err, null); - } - else { - if (!seen) { - errback(); - } - else { - connectionInfo = (conn) ? conn.connectionInfo : null; - err = amendError(err, connectionInfo); - callback(err, res); - } - } - } - else { - callback(err, res); - } - }); - }; - - var retry = function() { - seen = true; - exe(retry); - }; - - exe(retry); -}; - -/** - * Signal the pool to shutdown. Once called, no new requests (read: execute()) - * can be made. When all pending requests have terminated, the callback is run. - * - * @param callback called when the pool is fully shutdown - */ -PooledConnection.prototype.shutdown = function(callback) { - var self = this; - this.pool.drain(function() { - self.pool.destroyAllNow(callback); - }); -}; - /** * @param options: valid parts are: @@ -644,8 +456,33 @@ return !this.isHealthy() && new Date().getTime() - this.unhealthyAt > this._options.staleThreshold; } -// this will replace pooled connection and generic-collections at some point. -var PooledConnection2 = module.exports.PooledConnection2 = function(config) { +/** + * Perform queries against a pool of open connections. + * + * Accepts a single argument of an object used to configure the new PooledConnection + * instance. The config object supports the following attributes: + * + * hosts : List of strings in host:port format. + * keyspace : Keyspace name. + * user : User for authentication (optional). + * pass : Password for authentication (optional). + * maxSize : Maximum number of connection to pool (optional). + * idleMillis : Idle connection timeout in milliseconds (optional). + * + * Example: + * + * var pool = new PooledConnection({ + * hosts : ['host1:9160', 'host2:9170', 'host3', 'host4'], + * keyspace : 'database', + * user : 'mary', + * pass : 'qwerty', + * maxSize : 25, + * idleMillis : 30000 + * }); + * + * @param config an object used to control the creation of new instances. + */ +var PooledConnection = module.exports.PooledConnection = function(config) { var self = this; config = config || {}; this.connections = []; @@ -682,7 +519,7 @@ * unhealthy nodes that are stale (but not reconnecting them). * @return boolean indicating if all nodes are unhealthy. */ -PooledConnection2.prototype._incr = function() { +PooledConnection.prototype._incr = function() { var incrCount = 0; while (incrCount < this.connections.length) { incrCount += 1; @@ -706,9 +543,18 @@ }; /** - * execute a query. retries on other nodes when connection failures are detected. + * executes any query + * @param query any CQL statement with '?' placeholders. + * @param args array of arguments that will be bound to the query. + * @param callback executed when the query returns. the callback takes a different number of arguments depending on the + * type of query: + * SELECT (single row): callback(err, row) + * SELECT (mult rows) : callback(err, rows) + * SELECT (count) : callback(err, count) + * UPDATE : callback(err) + * DELETE : callback(err) */ -PooledConnection2.prototype.execute = function(query, args, callback) { +PooledConnection.prototype.execute = function(query, args, callback) { var self = this; self._getNextCon(function(err, con) { if (err) { @@ -750,7 +596,7 @@ }; /** gets the next untaken connection. errors when all connections are bad, or loop times out. */ -PooledConnection2.prototype._getNextCon = function(callback) { +PooledConnection.prototype._getNextCon = function(callback) { var self = this; var tryStart = new Date().getTime(); var con = null; @@ -804,7 +650,14 @@ }); }; -PooledConnection2.prototype.shutdown = function(callback) { +/** + * Signal the pool to shutdown. Once called, no new requests (read: execute()) + * can be made. When all pending requests have terminated, the callback is run. + * + * @param callback called when the pool is fully shutdown + */ +PooledConnection.prototype.shutdown = function(callback) { + // todo: we need to be able to let pending execute()s finish and block executes from happening while shutting down. this.connections.forEach(function(con) { if (con.connected) { con.close(); ======================================= --- /test/test_driver.js Mon Jan 16 08:00:22 2012 +++ /test/test_driver.js Mon Jan 16 08:31:48 2012 @@ -27,7 +27,7 @@ var BigInteger = require('../lib/bigint').BigInteger; var Connection = require('../lib/driver').Connection; -var PooledConnection = require('../lib/driver').PooledConnection2; +var PooledConnection = require('../lib/driver').PooledConnection; var ConnectionInPool = require('../lib/driver').ConnectionInPool; var ttypes = require('../lib/gen-nodejs/cassandra_types'); var Keyspace = require('../node-cassandra-client').Keyspace; ============================================================================== Revision: 2fbdab86e2f2 Author: Gary Dusbabek Date: Mon Jan 16 08:34:22 2012 Log: remove generic pool dep http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=2fbdab86e2f2 Modified: /package.json ======================================= --- /package.json Tue Jan 10 14:22:57 2012 +++ /package.json Mon Jan 16 08:34:22 2012 @@ -29,7 +29,6 @@ "async": ">= 0.1.12", "thrift": ">= 0.6.0-1", "logmagic": ">= 0.1.1", - "generic-pool": ">= 1.0.7", "whiskey": ">= 0.6.1", "node-uuid": ">= 1.3.3" },