[ 
https://issues.apache.org/jira/browse/CASSANDRA-2388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048641#comment-13048641
 ] 

Mck SembWever edited comment on CASSANDRA-2388 at 6/13/11 6:03 PM:
-------------------------------------------------------------------

Just make sure i understand you T Jake, you would rather something like this in 
CassandraServer.java?
(I've renamed from the previous comment get_endpoints_in_same_datacenter(..) to 
sort_endpoints_by_proximity(..))
{noformat}
    public String[] sort_endpoints_by_proximity(String endpoint, String[] 
endpoints, boolean restrictToSameDC) 
        throws TException, InvalidRequestException
    {
        try
        {
            List<String> results = new ArrayList<String>();
            InetAddress address = InetAddress.getByName(endpoint);
            String datacenter = 
DatabaseDescriptor.getEndpointSnitch().getDatacenter(address);
            List<InetAddress> addresses = new ArrayList<InetAddress>();
            for(String ep : endpoints)
            {
                addresses.add(InetAddress.getByName(ep));
            }
            DatabaseDescriptor.getEndpointSnitch().sortByProximity(address, 
addresses);
            for(InetAddress ep : addresses)
            {
                String dc = 
DatabaseDescriptor.getEndpointSnitch().getDatacenter(ep);
                if(FailureDetector.instance.isAlive(ep) && (!restrictToSameDC 
|| datacenter.equals(dc)))
                {
                    results.add(ep.getHostName());
                }
            }
            return results.toArray(new String[results.size()]);
        }
        catch (UnknownHostException e)
        {
            throw new InvalidRequestException(e.getMessage());
        }
    }
{noformat}

      was (Author: michaelsembwever):
    Just make sure i understand you T Jake, you would rather something like 
this in CassandraServer.java?
(I've renamed from the previous comment get_endpoints_in_same_datacenter(..) to 
sort_endpoints_by_proximity(..))
{noformat}
    public String[] sort_endpoints_by_proximity(String endpoint, String[] 
endpoints, boolean restrictToSameDC) 
        throws TException, InvalidRequestException
    {
        try
        {
            List<String> results = new ArrayList<String>();
            InetAddress address = InetAddress.getByName(endpoint);
            String datacenter = 
DatabaseDescriptor.getEndpointSnitch().getDatacenter(address);
            List<InetAddress> addresses = new ArrayList<InetAddress>();
            for(String ep : endpoints)
            {
                addresses.add(InetAddress.getByName(endpoint));
            }
            DatabaseDescriptor.getEndpointSnitch().sortByProximity(address, 
addresses);
            for(InetAddress ep : addresses)
            {
                String dc = 
DatabaseDescriptor.getEndpointSnitch().getDatacenter(ep);
                if(FailureDetector.instance.isAlive(ep) && (!restrictToSameDC 
|| datacenter.equals(dc)))
                {
                    results.add(ep.getHostName());
                }
            }
            return results.toArray(new String[results.size()]);
        }
        catch (UnknownHostException e)
        {
            throw new InvalidRequestException(e.getMessage());
        }
    }
{noformat}
  
> ColumnFamilyRecordReader fails for a given split because a host is down, even 
> if records could reasonably be read from other replica.
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2388
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2388
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Hadoop
>            Reporter: Eldon Stegall
>            Assignee: Mck SembWever
>              Labels: hadoop, inputformat
>             Fix For: 0.8.1
>
>         Attachments: 0002_On_TException_try_next_split.patch, 
> CASSANDRA-2388.patch, CASSANDRA-2388.patch
>
>
> ColumnFamilyRecordReader only tries the first location for a given split. We 
> should try multiple locations for a given split.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to