// UpdateBlpCheckpoint returns a statement to update a value in the // _vt.blp_checkpoint table. func UpdateBlpCheckpoint(uid uint32, pos myproto.ReplicationPosition, timeUpdated int64, txTimestamp int64) string { if txTimestamp != 0 { return fmt.Sprintf( "UPDATE _vt.blp_checkpoint "+ "SET pos='%v', time_updated=%v, transaction_timestamp=%v "+ "WHERE source_shard_uid=%v", myproto.EncodeReplicationPosition(pos), timeUpdated, txTimestamp, uid) } else { return fmt.Sprintf( "UPDATE _vt.blp_checkpoint "+ "SET pos='%v', time_updated=%v "+ "WHERE source_shard_uid=%v", myproto.EncodeReplicationPosition(pos), timeUpdated, uid) } }
// PopulateBlpCheckpoint returns a statement to populate the first value into // the _vt.blp_checkpoint table. func PopulateBlpCheckpoint(index uint32, pos myproto.ReplicationPosition, timeUpdated int64, flags string) string { return fmt.Sprintf("INSERT INTO _vt.blp_checkpoint "+ "(source_shard_uid, pos, time_updated, transaction_timestamp, flags) "+ "VALUES (%v, '%v', %v, 0, '%v')", index, myproto.EncodeReplicationPosition(pos), timeUpdated, flags) }