public void moveFlow ( FlowQueueKey oldKey , FlowQueueKey newKey ) throws DataException , IOException { byte [ ] oldRowKey = queueKeyConverter . toBytes ( oldKey ) ; Get get = new Get ( oldRowKey ) ; Table flowQueueTable = null ; try { flowQueueTable = hbaseConnection . getTable ( TableName . valueOf ( Constants . FLOW_QUEUE_TABLE ) ) ; Result result = flowQueueTable . get ( get ) ; if ( result == null || result . isEmpty ( ) ) { // no existing row throw new DataException ( "No row for key " + Bytes . toStringBinary ( oldRowKey ) ) ; } // copy the existing row to the new key Put p = new Put ( queueKeyConverter . toBytes ( newKey ) ) ; for ( Cell c : result . rawCells ( ) ) { p . addColumn ( CellUtil . cloneFamily ( c ) , CellUtil . cloneQualifier ( c ) , CellUtil . cloneValue ( c ) ) ; } flowQueueTable . put ( p ) ; // delete the old row Delete d = new Delete ( oldRowKey ) ; flowQueueTable . delete ( d ) ; } finally { if ( flowQueueTable != null ) { flowQueueTable . close ( ) ; } } }
Moves a flow_queue record from one row key to another . All Cells in the existing row will be written to the new row . This would primarily be used for transitioning a flow s data from one status to another .