[ 
https://issues.apache.org/jira/browse/CASSANDRA-10599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ashraful Islam updated CASSANDRA-10599:
---------------------------------------
    Description: 
I was trying to delete a row from one table when another table's row with the 
same primary key has been deleted

{code:title=DeleteToDelete.java|borderStyle=solid}
@Override
public Collection<Mutation> augment(ByteBuffer key, ColumnFamily update) {
        String keySpace = properties.getProperty("keyspace");
        String columnFamily = properties.getProperty("table");

        if (!update.deletionInfo().isLive()) {

                CFMetaData cfMetaData = Schema.instance.getCFMetaData(keySpace, 
columnFamily);

                for (ColumnDefinition columnDefinition : 
cfMetaData.allColumns()) {
                        Mutation mutation = new Mutation(keySpace, key);
                        mutation.delete(columnFamily, 
CellNames.simpleSparse(columnDefinition.name), System.currentTimeMillis());
                }
        }
}
{code}

*This code is not deleting row with the same key that have been inserted with 
insert into values command.*
*but if i insert the value by replacing*
{code}
mutation.delete(columnFamily, CellNames.simpleSparse(columnDefinition.name), 
System.currentTimeMillis());
{code}

*by* 

{code}
mutation.add(columnFamily, CellNames.simpleSparse(columnDefinition.name), 
ByteBufferUtil.bytes(35), System.currentTimeMillis());
{code}

*in the above code, Then the value is deleted with the trigger*

  was:
I was trying to delete a row from one table when another table's row with the 
same primary key has been deleted

{code:title=DeleteToDelete.java|borderStyle=solid}
        @Override
        public Collection<Mutation> augment(ByteBuffer key, ColumnFamily 
update) {
                String keySpace = properties.getProperty("keyspace");
                String columnFamily = properties.getProperty("table");
                if (!update.deletionInfo().isLive()) {
                        CFMetaData cfMetaData = 
Schema.instance.getCFMetaData(keySpace, columnFamily);
                        for (ColumnDefinition columnDefinition : 
cfMetaData.allColumns()) {
                                
System.out.println(CellNames.simpleSparse(columnDefinition.name));
                                Mutation mutation = new Mutation(keySpace, key);
                                mutation.delete(columnFamily, 
CellNames.simpleSparse(columnDefinition.name), System.currentTimeMillis());
                        }
                }
        }
{code}

*This code is not deleting row with the same key that have been inserted with 
insert into values command.*
*but if i insert the value by replacing*
{code}
mutation.delete(columnFamily, CellNames.simpleSparse(columnDefinition.name), 
System.currentTimeMillis());
{code}

*by* 

{code}
mutation.add(columnFamily, CellNames.simpleSparse(columnDefinition.name), 
ByteBufferUtil.bytes(35), System.currentTimeMillis());
{code}

*in the above code, Then the value is deleted with the trigger*


> Delete operation not deleting sometimes  by Trigger augment method
> ------------------------------------------------------------------
>
>                 Key: CASSANDRA-10599
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10599
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API, Core, Examples, Tools
>         Environment: CentOS 6.6 Cassandra 2.2.2
>            Reporter: Ashraful Islam
>              Labels: Trigger
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I was trying to delete a row from one table when another table's row with the 
> same primary key has been deleted
> {code:title=DeleteToDelete.java|borderStyle=solid}
> @Override
> public Collection<Mutation> augment(ByteBuffer key, ColumnFamily update) {
>       String keySpace = properties.getProperty("keyspace");
>       String columnFamily = properties.getProperty("table");
>       if (!update.deletionInfo().isLive()) {
>               CFMetaData cfMetaData = Schema.instance.getCFMetaData(keySpace, 
> columnFamily);
>               for (ColumnDefinition columnDefinition : 
> cfMetaData.allColumns()) {
>                       Mutation mutation = new Mutation(keySpace, key);
>                       mutation.delete(columnFamily, 
> CellNames.simpleSparse(columnDefinition.name), System.currentTimeMillis());
>               }
>       }
> }
> {code}
> *This code is not deleting row with the same key that have been inserted with 
> insert into values command.*
> *but if i insert the value by replacing*
> {code}
> mutation.delete(columnFamily, CellNames.simpleSparse(columnDefinition.name), 
> System.currentTimeMillis());
> {code}
> *by* 
> {code}
> mutation.add(columnFamily, CellNames.simpleSparse(columnDefinition.name), 
> ByteBufferUtil.bytes(35), System.currentTimeMillis());
> {code}
> *in the above code, Then the value is deleted with the trigger*



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to