Hi all,
    I don't know if anyone had post this question , if it is ,plz let
me know the post.
    Here is the problem i met:
    First ,  i create the keyspace that contains a columnfamily ,and
the columfamily contains a indexed column . The code is :
        ColumnDef clDef = new ColumnDef("name".getBytes("UTF-8"), "BytesType");
        clDef.setIndex_name("name");
        clDef.setIndex_type(IndexType.KEYS);

        List<ColumnDef> clList = new ArrayList<ColumnDef>();
        clList.add(clDef);

        CfDef cfDef = new CfDef(OperationEntry.KEYSPACE,
OperationEntry.COLUMN_FAMILY);
        cfDef.setColumn_metadata(clList);

        List<CfDef> cfDefList = new ArrayList<CfDef>();
        cfDefList.add(cfDef);

        KsDef ksDef=new KsDef(OperationEntry.KEYSPACE,
                "org.apache.cassandra.locator.RackUnawareStrategy", 1,
cfDefList);

        client.system_add_keyspace(ksDef);

    This works ok.
    But when i want to insert a row into this columnfamily ,
            ColumnParent parent = new ColumnParent();
            parent.setColumn_family("Standard1");
            Column column = new Column();
            column.setName("name".getBytes("UTF-8"));
            column.setValue("index".getBytes("UTF-8"));
            column.setClock(new Clock());
            client.insert("index".getBytes("UTF-8"), parent, column,
ConsistencyLevel.ONE);

This insert operation invoke an exception TimedOutException() ,but
insert other noindexed columns works ok.

   Anything wrong with my code ?



-- 
Best regards,

Ivy Tang

Reply via email to