Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
merge from 2.0
  • Loading branch information
jbellis committed Feb 28, 2014
2 parents 15728ad + cdd3625 commit 38a3181
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Expand Up @@ -7,6 +7,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)
Expand Down
Expand Up @@ -65,7 +65,7 @@ class CqlRecordWriter extends AbstractColumnFamilyRecordWriter<Map<String, ByteB
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>();
Expand Down Expand Up @@ -98,7 +98,7 @@ class CqlRecordWriter extends AbstractColumnFamilyRecordWriter<Map<String, ByteB
CqlRecordWriter(Configuration conf)
{
super(conf);
this.clients = new HashMap<Range, RangeClient>();
this.clients = new HashMap<>();

try
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 38a3181

Please sign in to comment.