Permalink
Browse files

Merge branch 'cassandra-2.1' into trunk

  • Loading branch information...
2 parents 1b64414 + 38a3181 commit b23d6ba0b3c7263b14ec785f898d19fb7ffa553b @jbellis jbellis committed Feb 28, 2014
Showing with 9 additions and 4 deletions.
  1. +4 −0 CHANGES.txt
  2. +5 −4 src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
View
@@ -11,6 +11,10 @@
* Scrub should not always clear out repaired status (CASSANDRA-5351)
* Improve handling of range tombstone for wide partitions (CASSANDRA-6446)
* Fix ClassCastException for compact table with composites (CASSANDRA-6738)
+Merged from 2.0:
+ * Pool CqlRecordWriter clients by inetaddress rather than Range
+ (CASSANDRA-6665)
+
2.1.0-beta1
* Add flush directory distinct from compaction directories (CASSANDRA-6357)
@@ -65,7 +65,7 @@
private static final Logger logger = LoggerFactory.getLogger(CqlRecordWriter.class);
// handles for clients for each range running in the threadpool
- protected final Map<Range, RangeClient> clients;
+ protected final Map<InetAddress, RangeClient> clients;
// host to prepared statement id mappings
protected final ConcurrentHashMap<Cassandra.Client, Integer> preparedStatements = new ConcurrentHashMap<Cassandra.Client, Integer>();
@@ -98,7 +98,7 @@
CqlRecordWriter(Configuration conf)
{
super(conf);
- this.clients = new HashMap<Range, RangeClient>();
+ this.clients = new HashMap<>();
try
{
@@ -163,13 +163,14 @@ public void write(Map<String, ByteBuffer> keyColumns, List<ByteBuffer> values) t
Range<Token> range = ringCache.getRange(getPartitionKey(keyColumns));
// get the client for the given range, or create a new one
- RangeClient client = clients.get(range);
+ final InetAddress address = ringCache.getEndpoint(range).get(0);
+ RangeClient client = clients.get(address);
if (client == null)
{
// haven't seen keys for this range: create new client
client = new RangeClient(ringCache.getEndpoint(range));
client.start();
- clients.put(range, client);
+ clients.put(address, client);
}
// add primary key columns to the bind variables

0 comments on commit b23d6ba

Please sign in to comment.