MySQL 8.0.40
Source Code Documentation
binary_log::Rand_event Class Reference

Logs random seed used by the next RAND(), and by PASSWORD() in 4.1.0. More...

#include <statement_events.h>

Inheritance diagram for binary_log::Rand_event:
[legend]

Public Types

enum  Rand_event_data { RAND_SEED1_OFFSET = 0 , RAND_SEED2_OFFSET = 8 }
 
- Public Types inherited from binary_log::Binary_log_event
enum  enum_post_header_length {
  QUERY_HEADER_MINIMAL_LEN = (4 + 4 + 1 + 2) , QUERY_HEADER_LEN = (QUERY_HEADER_MINIMAL_LEN + 2) , STOP_HEADER_LEN = 0 , START_V3_HEADER_LEN = (2 + ST_SERVER_VER_LEN + 4) ,
  ROTATE_HEADER_LEN = 8 , INTVAR_HEADER_LEN = 0 , APPEND_BLOCK_HEADER_LEN = 4 , DELETE_FILE_HEADER_LEN = 4 ,
  RAND_HEADER_LEN = 0 , USER_VAR_HEADER_LEN = 0 , FORMAT_DESCRIPTION_HEADER_LEN = (START_V3_HEADER_LEN + 1 + LOG_EVENT_TYPES) , XID_HEADER_LEN = 0 ,
  BEGIN_LOAD_QUERY_HEADER_LEN = APPEND_BLOCK_HEADER_LEN , ROWS_HEADER_LEN_V1 = 8 , TABLE_MAP_HEADER_LEN = 8 , EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN = (4 + 4 + 4 + 1) ,
  EXECUTE_LOAD_QUERY_HEADER_LEN , INCIDENT_HEADER_LEN = 2 , HEARTBEAT_HEADER_LEN = 0 , IGNORABLE_HEADER_LEN = 0 ,
  ROWS_HEADER_LEN_V2 = 10 , TRANSACTION_CONTEXT_HEADER_LEN = 18 , VIEW_CHANGE_HEADER_LEN = 52 , XA_PREPARE_HEADER_LEN = 0 ,
  TRANSACTION_PAYLOAD_HEADER_LEN = 0
}
 The lengths for the fixed data part of each event. More...
 

Public Member Functions

 Rand_event (unsigned long long seed1_arg, unsigned long long seed2_arg)
 
 Rand_event (const char *buf, const Format_description_event *fde)
 Written every time a statement uses the RAND() function; precedes other events for the statement. More...
 
- Public Member Functions inherited from binary_log::Binary_log_event
virtual ~Binary_log_event ()=0
 
 Binary_log_event (const Binary_log_event &)=default
 
 Binary_log_event (Binary_log_event &&)=default
 
Binary_log_eventoperator= (const Binary_log_event &)=default
 
Binary_log_eventoperator= (Binary_log_event &&)=default
 
enum Log_event_type get_event_type () const
 Helper method. More...
 
const Log_event_headerheader () const
 Return a const pointer to the header of the log event. More...
 
Log_event_headerheader ()
 Return a non-const pointer to the header of the log event. More...
 
const Log_event_footerfooter () const
 Return a const pointer to the footer of the log event. More...
 
Log_event_footerfooter ()
 Return a non-const pointer to the footer of the log event. More...
 
Event_readerreader ()
 Returns a reference to the event Event_reader object. More...
 

Public Attributes

unsigned long long seed1
 
unsigned long long seed2
 

Additional Inherited Members

- Static Public Attributes inherited from binary_log::Binary_log_event
static const int LOG_EVENT_TYPES = (ENUM_END_EVENT - 1)
 
- Protected Member Functions inherited from binary_log::Binary_log_event
 Binary_log_event (Log_event_type type_code)
 This constructor is used to initialize the type_code of header object m_header. More...
 
 Binary_log_event (const char **buf, const Format_description_event *fde)
 This constructor will create a new object of Log_event_header and initialize the variable m_header, which in turn will be used to initialize Log_event's member common_header. More...
 

Detailed Description

Logs random seed used by the next RAND(), and by PASSWORD() in 4.1.0.

4.1.1 does not need it (it's repeatable again) so this event needn't be written in 4.1.1 for PASSWORD() (but the fact that it is written is just a waste, it does not cause bugs).

The state of the random number generation consists of 128 bits, which are stored internally as two 64-bit numbers.

Binary Format

The Post-Header for this event type is empty. The Body has two components:

Body for Rand_event
Name Format

Description

seed1 8 byte unsigned integer

64 bit random seed1.

seed2 8 byte unsigned integer 64 bit random seed2.

Member Enumeration Documentation

◆ Rand_event_data

Enumerator
RAND_SEED1_OFFSET 
RAND_SEED2_OFFSET 

Constructor & Destructor Documentation

◆ Rand_event() [1/2]

binary_log::Rand_event::Rand_event ( unsigned long long  seed1_arg,
unsigned long long  seed2_arg 
)
inline
This will initialize the instance variables seed1 & seed2, and set the

type_code as RAND_EVENT in the header object in Binary_log_event

◆ Rand_event() [2/2]

binary_log::Rand_event::Rand_event ( const char *  buf,
const Format_description_event fde 
)

Written every time a statement uses the RAND() function; precedes other events for the statement.

Indicates the seed values to use for generating a random number with RAND() in the next statement. This is written only before a QUERY_EVENT and is not used with row-based logging

The buffer layout for variable part is as follows:
+----------------------------------------------+
| value for first seed | value for second seed |
+----------------------------------------------+
Parameters
bufContains the serialized event.
fdeAn FDE event (see Rotate_event constructor for more info).

Member Data Documentation

◆ seed1

unsigned long long binary_log::Rand_event::seed1

◆ seed2

unsigned long long binary_log::Rand_event::seed2

The documentation for this class was generated from the following files: