cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "xiangdong Huang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-8581) Null pointer in cassandra.hadoop.ColumnFamilyRecoderWriter
Date Mon, 23 Mar 2015 06:23:11 GMT

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

xiangdong Huang commented on CASSANDRA-8581:
--------------------------------------------

Ok, here is the differences:

diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java
index 6823342..68c8714 100644
--- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java
+++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java
@@ -187,21 +187,23 @@ final class ColumnFamilyRecordWriter extends AbstractColumnFamilyRecordWriter<By
                 while (true)
                 {
                     // send the mutation to the last-used endpoint.  first time through,
this will NPE harmlessly.
-                    try
-                    {
-                        client.batch_mutate(batch, consistencyLevel);
-                        break;
-                    }
-                    catch (Exception e)
-                    {
-                        closeInternal();
-                        if (!iter.hasNext())
-                        {
-                            lastException = new IOException(e);
-                            break outer;
-                        }
+                    if(client!=null){
+	                	try
+	                    {
+	                        client.batch_mutate(batch, consistencyLevel);
+	                        break;
+	                    }
+	                    catch (Exception e)
+	                    {
+	                    	e.printStackTrace();
+	                    	closeInternal();
+	                        if (!iter.hasNext())
+	                        {
+	                            lastException = new IOException(e);
+	                            break outer;
+	                        }
+	                    }
                     }
-
                     // attempt to connect to a different endpoint
                     try
                     {


> Null pointer in cassandra.hadoop.ColumnFamilyRecoderWriter
> ----------------------------------------------------------
>
>                 Key: CASSANDRA-8581
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8581
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Hadoop
>            Reporter: xiangdong Huang
>            Assignee: Brandon Williams
>              Labels: hadoop
>             Fix For: 2.1.4
>
>         Attachments: 屏幕快照 2015-01-08 下午7.59.29.png, 屏幕快照 2015-01-08
下午8.01.15.png, 屏幕快照 2015-01-08 下午8.07.23.png
>
>
> When I run examples/hadoop_word_count. I find that ReducerToFilesystem is correct but
when I use ReducerToCassandra, the program will call loadYaml().
> The reason is that the program catch a exception at line 196 of ColumnFamilyRecoderWriter.java.

> Then it check why the exception occur, then it loadYaml to check if the disk is broken...
> However, the exception is NullPointerException. because the client is not initialized.
>  
> So we need a check to judge whether the client is null. 
> (
> The exception, original code and fixed code are in the attachments.
> )



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message