You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Ramzi Rabah <rr...@playdom.com> on 2009/12/21 19:46:02 UTC

Small HintedHanoffManager improvement?

Hi guys,
before I go ahead and open an enhancement bug for this, I just want to
make sure it is valid.
In HintedHandOffManager in the part where we deliver a message to the
target node:

private static boolean sendMessage(InetAddress endPoint, String
tableName, String key) throws IOException
    {
        if (!FailureDetector.instance().isAlive(endPoint))
        {
            return false;
        }

        Table table = Table.open(tableName);
        RowMutation rm = new RowMutation(tableName, key);
        for (ColumnFamilyStore cfstore : table.getColumnFamilyStores().values())
        {
            ColumnFamily cf = cfstore.getColumnFamily(new
IdentityQueryFilter(key, new
QueryPath(cfstore.getColumnFamilyName())));
            if (cf != null)
                rm.add(cf);
        }
        Message message = rm.makeRowMutationMessage();
        WriteResponseHandler responseHandler = new WriteResponseHandler(1);
        MessagingService.instance().sendRR(message, new InetAddress[]
{ endPoint }, responseHandler);
...

It seems that we still send a row mutation even if the cf of the row
is null. My question is, what is the point of sending a RowMutation
with an empty cf. I don't believe this will break anything (if we
handle a mutation message with an empty cf properly), but it seems to
me like a redundant mutation message sent and processed.

On a different note, I have a few questions about HHOM design.
HintedHandOffManager seems to send the whole CF for a key, even if the
only thing that changed was a value in 1 single column. Will this
scale if I have a CF with 1000 columns, and why not only send that one
column?

And one last question about HHOM, since the node that is handling the
Hint might not be (and is probably not) one of the replicas if I
understood the code correctly, Will the data written to it ever be
cleaned, if I issue a delete later on down the line?

My 2 cents :)
Ramzi

Re: Small HintedHanoffManager improvement?

Posted by Ramzi Rabah <rr...@playdom.com>.
Cool thanks for the explanation. It might happen if a delete hint for
that entry was sent after the data hint was submitted to that node so
both hint and the delete hint are sent to the same node leading to an
empty CF (which is a very unlikely scenario), but it does seem that
the code handles it gracefully (it does write it to the commitlog, not
to the memtable, but then when you recover from the commitlog, I
believe the code ignores the entry).

On Tue, Dec 22, 2009 at 8:19 AM, Jonathan Ellis <jb...@gmail.com> wrote:
> On Mon, Dec 21, 2009 at 12:46 PM, Ramzi Rabah <rr...@playdom.com> wrote:
>> It seems that we still send a row mutation even if the cf of the row
>> is null.
>
> It should never happen, and if it does it's harmless, so adding a
> special case for it is counterproductive.
>
>> On a different note, I have a few questions about HHOM design.
>> HintedHandOffManager seems to send the whole CF for a key, even if the
>> only thing that changed was a value in 1 single column.
>
> Only the changed parts are written to hint nodes in the first place.
>
>> And one last question about HHOM, since the node that is handling the
>> Hint might not be (and is probably not) one of the replicas if I
>> understood the code correctly, Will the data written to it ever be
>> cleaned, if I issue a delete later on down the line?
>
> Hinted data is removed by cleanup operations.
>
> -Jonathan
>

Re: Small HintedHanoffManager improvement?

Posted by Jonathan Ellis <jb...@gmail.com>.
On Mon, Dec 21, 2009 at 12:46 PM, Ramzi Rabah <rr...@playdom.com> wrote:
> It seems that we still send a row mutation even if the cf of the row
> is null.

It should never happen, and if it does it's harmless, so adding a
special case for it is counterproductive.

> On a different note, I have a few questions about HHOM design.
> HintedHandOffManager seems to send the whole CF for a key, even if the
> only thing that changed was a value in 1 single column.

Only the changed parts are written to hint nodes in the first place.

> And one last question about HHOM, since the node that is handling the
> Hint might not be (and is probably not) one of the replicas if I
> understood the code correctly, Will the data written to it ever be
> cleaned, if I issue a delete later on down the line?

Hinted data is removed by cleanup operations.

-Jonathan

Re: Small HintedHanoffManager improvement?

Posted by 孔令华 <ko...@gmail.com>.
2009/12/22 Ramzi Rabah <rr...@playdom.com>

> Hi guys,
> before I go ahead and open an enhancement bug for this, I just want to
> make sure it is valid.
> In HintedHandOffManager in the part where we deliver a message to the
> target node:
>
> private static boolean sendMessage(InetAddress endPoint, String
> tableName, String key) throws IOException
>    {
>        if (!FailureDetector.instance().isAlive(endPoint))
>        {
>            return false;
>        }
>
>        Table table = Table.open(tableName);
>        RowMutation rm = new RowMutation(tableName, key);
>        for (ColumnFamilyStore cfstore :
> table.getColumnFamilyStores().values())
>        {
>            ColumnFamily cf = cfstore.getColumnFamily(new
> IdentityQueryFilter(key, new
> QueryPath(cfstore.getColumnFamilyName())));
>            if (cf != null)
>                rm.add(cf);
>        }
>        Message message = rm.makeRowMutationMessage();
>        WriteResponseHandler responseHandler = new WriteResponseHandler(1);
>        MessagingService.instance().sendRR(message, new InetAddress[]
> { endPoint }, responseHandler);
> ...
>
> It seems that we still send a row mutation even if the cf of the row
> is null. My question is, what is the point of sending a RowMutation
> with an empty cf. I don't believe this will break anything (if we
> handle a mutation message with an empty cf properly), but it seems to
> me like a redundant mutation message sent and processed.
>
> On a different note, I have a few questions about HHOM design.
> HintedHandOffManager seems to send the whole CF for a key, even if the
> only thing that changed was a value in 1 single column. Will this
> scale if I have a CF with 1000 columns, and why not only send that one
> column?
>
-------------------------------------
Remind that column is only a kind of tags. Only new data will be written to
the hint-node. So all the data of the key in the hint-node are new to the
node that come back again. So all the data should be sent to the node.

>
> And one last question about HHOM, since the node that is handling the
> Hint might not be (and is probably not) one of the replicas if I
> understood the code correctly, Will the data written to it ever be
> cleaned, if I issue a delete later on down the line?
>
> -------------------------------------
All the data should be cleaned manually by issuing "nodeprobe cleanup".
WARN: if there're hinted data in the node, donot use cleanup. Just using it
when the cluster is stable.

My 2 cents :)
> Ramzi
>