incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Weijun Li <weiju...@gmail.com>
Subject Re: Strategy to delete/expire keys in cassandra
Date Wed, 10 Mar 2010 21:43:52 GMT
Hi Sylvain,

I applied your patch to 0.5 but it seems that it's not compilable:

1) column.getTtl() is no defined in RowMutation.java
public static RowMutation getRowMutation(String table, String key,
Map<String, List<ColumnOrSuperColumn>> cfmap)
    {
        RowMutation rm = new RowMutation(table, key.trim());
        for (Map.Entry<String, List<ColumnOrSuperColumn>> entry :
cfmap.entrySet())
        {
            String cfName = entry.getKey();
            for (ColumnOrSuperColumn cosc : entry.getValue())
            {
                if (cosc.column == null)
                {
                    assert cosc.super_column != null;
                    for (org.apache.cassandra.service.Column column :
cosc.super_column.columns)
                    {
                        rm.add(new QueryPath(cfName, cosc.super_column.name,
column.name), column.value, column.timestamp, column.getTtl());
                    }
                }
                else
                {
                    assert cosc.super_column == null;
                    rm.add(new QueryPath(cfName, null, cosc.column.name),
cosc.column.value, cosc.column.timestamp, cosc.column.getTtl());
                }
            }
        }
        return rm;
    }

2) CassandraServer.java: Column.setTtl() is not defined.
if (column instanceof ExpiringColumn)
            {
                thrift_column.setTtl(((ExpiringColumn)
column).getTimeToLive());
            }

3) CliClient.java: type mismatch for ColumnParent
thriftClient_.insert(tableName, key, new ColumnParent(columnFamily,
superColumnName),
                             new Column(columnName, value.getBytes(),
System.currentTimeMillis()), ConsistencyLevel.ONE);

It seems that the patch doesn't add getTtl()/setTtl() stuff to Column.java?

Thanks,
-Weijun

-----Original Message-----
> From: Sylvain Lebresne [mailto:sylvain@yakaz.com]
> Sent: Thursday, February 25, 2010 2:23 AM
> To: Weijun Li
> Cc: cassandra-user@incubator.apache.org
> Subject: Re: Strategy to delete/expire keys in cassandra
>
> Hi,
>
> > Should I just run command (in Cassandra 0.5 source folder?) like:
> > patch –p1 –i  0001-Add-new-ExpiringColumn-class.patch
> > for all of the five patches in your ticket?
>
> Well, actually I lied. The patches were made for a version a little after
> 0.5.
> If you really want to try, I attach a version of those patches that
> (should)
> work with 0.5 (There is only the 3 first patch, but the fourth one is for
> tests so not necessary per se). Apply them with your patch command.
> Still, to compile that you will have to regenerate the thrift java
> interface
> (with ant gen-thrift-java), but for that you will have to install the right
> svn revision of thrift (which is libthrift-r820831 for 0.5). And if you
> manage to make it work, you will have to digg in cassandra.thrift as it
> make
> change to it.
>
> In the end, remember that this is not an official patch yet and it *will
> not* make it in Cassandra in its current form. All I can tell you is that I
> need those expiring columns for quite some of my usage and I will do what I
> can to make this feature included if and when possible.
>
> > Also what’s your opinion on extending ExpiringColumn to expire a key
> > completely? Otherwise it will be difficult to track what are expired
> > or old rows in Cassandra.
>
> I'm not sure how to make full rows (or even full superColumns for that
> matter) expire. What if you set a row to expire after some time and add new
> columns before this expiration ? Should you update the expiration of the
> row
> ? Which is to say that a row will expires when it's last column expire,
> which is almost what you get with expiring column.
> The one thing you may want though is that when all the columns of a row
> expire (or, to be precise, get physically deleted), the row itself is
> deleted. Looking at the code, I'm not convince this happen and I'm not sure
> why.
>
> --
> Sylvain
>
>

Mime
View raw message