src/java/org/apache/cassandra/db/SystemTable.java
/**
     * Write a new current local node id to the system table.
     *
     * @param oldNodeId the previous local node id (that {@code newNodeId}
     * replace) or null if no such node id exists (new node or removed system
     * table)
     * @param newNodeId the new current local node id to record
     */
Write a new current local node id to the system table.
@param oldNodeId the previous local node id (that  newNodeId
replace) or null if no such node id exists (new node or removed system
table)
@param newNodeId the new current local node id to record
Write a new current local node id to the system table . @param oldNodeId the previous local node id ( that newNodeId replace ) or null if no such node id exists ( new node or removed system table ) @param newNodeId the new current local node id to record
public static void writeCurrentLocalNodeId(NodeId oldNodeId, NodeId newNodeId, long now)
    {
        long logicalNow = LamportClock.getVersion();
        ByteBuffer ip = ByteBuffer.wrap(FBUtilities.getBroadcastAddress().getAddress());
        ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, NODE_ID_CF);
        cf.addColumn(new Column(newNodeId.bytes(), ip, logicalNow));
        ColumnFamily cf2 = cf.cloneMe();
        if (oldNodeId != null)
        {
            cf2.addColumn(new DeletedColumn(oldNodeId.bytes(), (int) (now / 1000), logicalNow, null));
        }
        RowMutation rmCurrent = new RowMutation(Table.SYSTEM_TABLE, CURRENT_LOCAL_NODE_ID_KEY);
        RowMutation rmAll = new RowMutation(Table.SYSTEM_TABLE, ALL_LOCAL_NODE_ID_KEY);
        rmCurrent.add(cf2);
        rmAll.add(cf);
        try
        {
            rmCurrent.apply();
            rmAll.apply();
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
    }
public static void writeCurrentLocalNodeId ( NodeId oldNodeId , NodeId newNodeId , long now ) { long logicalNow = LamportClock . getVersion ( ) ; ByteBuffer ip = ByteBuffer . wrap ( FBUtilities . getBroadcastAddress ( ) . getAddress ( ) ) ; ColumnFamily cf = ColumnFamily . create ( Table . SYSTEM_TABLE , NODE_ID_CF ) ; cf . addColumn ( new Column ( newNodeId . bytes ( ) , ip , logicalNow ) ) ; ColumnFamily cf2 = cf . cloneMe ( ) ; if ( oldNodeId != null ) { cf2 . addColumn ( new DeletedColumn ( oldNodeId . bytes ( ) , ( int ) ( now / 1000 ) , logicalNow , null ) ) ; } RowMutation rmCurrent = new RowMutation ( Table . SYSTEM_TABLE , CURRENT_LOCAL_NODE_ID_KEY ) ; RowMutation rmAll = new RowMutation ( Table . SYSTEM_TABLE , ALL_LOCAL_NODE_ID_KEY ) ; rmCurrent . add ( cf2 ) ; rmAll . add ( cf ) ; try { rmCurrent . apply ( ) ; rmAll . apply ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Write a new current local node id to the system table.
Write a new current local node id to the system table .