---------- Forwarded message ----------
From: Jiansheng Huang <jiansheng.wi@gmail.com>
Date: Wed, Mar 11, 2009 at 2:49 PM
Subject: NPE in apache cassandra
To: cassandra-user@incubator.apache.org, Avinash Lakshman <alakshman@facebook.com>, Prashant Malik <pmalik@facebook.com>
Cc: agupta@rocketfuelinc.com

Hi folks, I checked out the new code from apache and compiled it. When I start up the server with a clean installation base (i.e., without using any system/user data from previous installation),
I got the following.

    at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
    at java.io.DataOutputStream.writeUTF(DataOutputStream.java:323)
    at org.apache.cassandra.db.Table$TableMetadataSerializer.serialize(Table.java:254)
    at org.apache.cassandra.db.Table$TableMetadataSerializer.serialize(Table.java:244)
    at org.apache.cassandra.db.Table$TableMetadata.apply(Table.java:209)
    at org.apache.cassandra.db.DBManager.storeMetadata(DBManager.java:150)
    at org.apache.cassandra.db.DBManager.<init>(DBManager.java:102)
    at org.apache.cassandra.db.DBManager.instance(DBManager.java:61)
    at org.apache.cassandra.service.StorageService.start(StorageService.java:465)
    at org.apache.cassandra.service.CassandraServer.start(CassandraServer.java:110)
    at org.apache.cassandra.service.CassandraServer.main(CassandraServer.java:1078)
Disconnected from the target VM, address: '', transport: 'socket'

I did some debugging and found that in the following code, the first entry in cfNames is always null. Is it safe to say that if cfName is null, then we don't want to do the writings?

public void serialize(TableMetadata tmetadata, DataOutputStream dos) throws IOException
            int size = tmetadata.cfIdMap_.size();
            Set<String> cfNames = tmetadata.cfIdMap_.keySet();

            for ( String cfName : cfNames )
                dos.writeInt( tmetadata.cfIdMap_.get(cfName).intValue() );
A related question I have is what's the procedure for us to check in code? I have made some changes for adding latency counters in the server and exposing them through http. Would be good to check in the changes and minor fixes so that I don't have to risk of losing them ...