incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cbertu81@libero.it" <cbert...@libero.it>
Subject R: WriteMultiColumns just write one column ... amazing!
Date Thu, 24 Mar 2011 16:55:55 GMT
I answer myself :)
But i put the answer here maybe is useful for someone in future.
The problem was in the Timestamp, if you "copy" a column from another row but 
you don't change the timestamp then it will be written only if in the past, a 
column with the same name (key) has not been erased after the set timestamp.

Best regards

Carlo

>----Messaggio originale----
>Da: cbertu81@libero.it
>Data: 24/03/2011 16.03
>A: <user@cassandra.apache.org>
>Ogg: WriteMultiColumns just write one column ... amazing!
>
>Hi all,
>I'm almost sure I'm just tired and I am doing something stupid however I 
can't 
>understand this problem.
>In one Super Column Family I have just 2 rows, called ALL and INCREMENTAL.
>
>For some reason I sometimes need to duplicate a SuperColumn from the row ALL 
>to the INCREMENTAL one ... very easy 
>(cassandra 0.7.4, java, pelops)
>
>    private static void mirrorizeEngineSuperColumn(Bytes superColumnId) {
>        Mutator mutator = Pelops.createMutator(SocialContext.
POOL_NAME_VALUE);
>        Selector selector = Pelops.createSelector(SocialContext.
>POOL_NAME_VALUE);
>        try {
>            SuperColumn sc = selector.getSuperColumnFromRow(MotoreFamily, 
>SocialColumn.MOTORE_ALL_ROW, superColumnId, ConsistencyLevel.QUORUM);
>            LOG.debug("Column list size of supercolumn is " + sc.
>getColumnsSize());
>            mutator.writeSubColumns(MotoreFamily, SocialColumn.
>MOTORE_INCREMENTALI_ROW, superColumnId, sc.getColumns());
>            mutator.execute(ConsistencyLevel.QUORUM);
>        } catch (NotFoundException nfe) {
>            LOG.debug("Supercolumn not found ...");
>        } catch (Exception e) {
>            LOG.error(e.toString());
>        }
>    }
>
>When I print it the column list size is exact (3, 4 it depends on which 
>supercolumn I'm working) but when I write them I find only one column of 
this 
>column list ... here is the output produced (viewing with cassandra cli ...) 
-- 
>compare the 3 super_column in the row INCREMENTAL and you'll see they're 
>different from the one in the row ALL
>
>RowKey: ALL
>=> (super_column=54b05120-552f-11e0-9d1f-020054554e01,
>     (column=54fc9c60-552f-11e0-9d1f-020054554e01, value=00000003, 
>timestamp=1300872296917000)
>     (column=746595b0-553f-11e0-9e66-020054554e01, value=00000002, 
>timestamp=1300879284037000)
>     (column=6ec46ef0-5540-11e0-9e66-020054554e01, value=00000004, 
>timestamp=1300879641811000)
>     (column=99d911d0-5541-11e0-af7b-020054554e01, value=00000001, 
>timestamp=1300880138869000))
>=> (super_column=97351e20-5545-11e0-9464-001d72d09363,
>     (column=9763cf40-5545-11e0-9464-001d72d09363, value=00000004, 
>timestamp=1300881876938000)
>     (column=1e5b7a40-5549-11e0-8da1-020054554e01, value=00000005, 
>timestamp=1300883402593000)
>     (column=89f7c3e0-560b-11e0-a6ac-020054554e01, value=00000005, 
>timestamp=1300966880883000))
>=> (super_column=cadf5940-55ed-11e0-9b97-020054554e01,
>     (column=cb03aa20-55ed-11e0-9b97-020054554e01, value=00000004, 
>timestamp=1300954178721000)
>     (column=27092500-5609-11e0-b1f1-020054554e01, value=00000004, 
>timestamp=1300965858839000)
>     (column=5cdf88d0-560a-11e0-a6ac-020054554e01, value=00000005, 
>timestamp=1300966438198000)
>     (column=c6e34110-561c-11e0-9399-020054554e01, value=00000005, 
>timestamp=1300974305208000))
>=> (super_column=309d66a0-5602-11e0-9cc8-020054554e01,
>     (column=30d8e900-5602-11e0-9cc8-020054554e01, value=00000005, 
>timestamp=1300963602927000)
>     (column=8c8a4f40-5603-11e0-9cc8-020054554e01, value=00000005, 
>timestamp=1300963728307000)
>     (column=62246620-5606-11e0-9e06-020054554e01, value=00000005, 
>timestamp=1300964702748000)
>     (column=db951080-561b-11e0-8880-020054554e01, value=00000003, 
>timestamp=1300973895462000))
>=> (super_column=e44f1860-560c-11e0-b696-020054554e01,
>     (column=e5045ea0-560c-11e0-b696-020054554e01, value=00000005, 
>timestamp=1300967480905000))
>=> (super_column=e53d7000-560c-11e0-b696-020054554e01,
>     (column=e56395a0-560c-11e0-b696-020054554e01, value=00000005, 
>timestamp=1300967620609000))
>=> (super_column=90ce8370-5615-11e0-b696-020054554e01,
>     (column=9100de10-5615-11e0-b696-020054554e01, value=00000005, 
>timestamp=1300971213814000)
>     (column=a5171450-5615-11e0-b696-020054554e01, value=00000005, 
>timestamp=1300971294115000)
>     (column=9fb68390-5617-11e0-9ed9-020054554e01, value=00000002, 
>timestamp=1300972093565000)
>     (column=79889ed0-561a-11e0-bf27-020054554e01, value=00000002, 
>timestamp=1300973301530000))
>-------------------
>RowKey: INCREMENTAL
>=> (super_column=cadf5940-55ed-11e0-9b97-020054554e01,
>     (column=c6e34110-561c-11e0-9399-020054554e01, value=00000005, 
>timestamp=1300974305208000))
>=> (super_column=309d66a0-5602-11e0-9cc8-020054554e01,
>     (column=db951080-561b-11e0-8880-020054554e01, value=00000003, 
>timestamp=1300973895462000))
>=> (super_column=90ce8370-5615-11e0-b696-020054554e01,
>     (column=9fb68390-5617-11e0-9ed9-020054554e01, value=00000002, 
>timestamp=1300972093565000))
>
>I think I'm getting crazy!
>TIA for any help
>
>Best regards
>
>Carlo
>



Mime
View raw message