Repository: pingcap/tidb
File: pkg/session/bootstrap.go (Go)

Code before:

       index_details json,        -- est_index_size, reason, DDL to create this index, ...
       top_impacted_queries json, -- improvement, plan before and after this index, ...
       workload_impact json,      -- improvement and more details, ...
       extra json,                -- for the cloud env to save more info like RU, cost_saving, ...
       index idx_create(created_at),
       index idx_update(updated_at),
       unique index idx(schema_name, table_name, index_columns))`

	// CreateKernelOptionsTable is a table to store kernel options for tidb.
	CreateKernelOptionsTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_kernel_options (
	        module varchar(128),
	        name varchar(128),
	        value varchar(128),
	        updated_at datetime,
	        status varchar(128),
	        description text,
	        primary key(module, name))`

	// CreateTiDBMViewRefreshTable is a table to store current (latest) refresh state for each materialized view.
	CreateTiDBMViewRefreshTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_mview_refresh (
		MVIEW_ID bigint NOT NULL,
		LAST_REFRESH_RESULT varchar(16) DEFAULT NULL,
		LAST_REFRESH_TYPE varchar(16) DEFAULT NULL,
		LAST_REFRESH_TIME datetime DEFAULT NULL,
		LAST_REFRESH_READ_TSO bigint DEFAULT NULL,
		LAST_REFRESH_FAILED_REASON longtext DEFAULT NULL,
		PRIMARY KEY(MVIEW_ID))`

	// CreateTiDBMLogPurgeTable is a table to store current (latest) purge state for each materialized view log.
	CreateTiDBMLogPurgeTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_mlog_purge (
		MLOG_ID bigint NOT NULL,
		LAST_PURGE_TIME datetime DEFAULT NULL,
		LAST_PURGE_ROWS bigint DEFAULT NULL,
		LAST_PURGE_DURATION bigint DEFAULT NULL,
		PRIMARY KEY(MLOG_ID))`

	// CreateTiDBMViewRefreshHistTable is a table to store mview refresh history.
	// Note: REFRESH_JOB_ID is auto-increment BIGINT (internal).
	CreateTiDBMViewRefreshHistTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_mview_refresh_hist (
		MVIEW_ID bigint NOT NULL,
		MVIEW_NAME varchar(64) NOT NULL,
		REFRESH_JOB_ID bigint NOT NULL AUTO_INCREMENT,
		IS_NEWEST_REFRESH varchar(3) NOT NULL,
		REFRESH_METHOD varchar(32) NOT NULL,
		REFRESH_TIME datetime DEFAULT NULL,
		REFRESH_ENDTIME datetime DEFAULT NULL,
		REFRESH_STATUS varchar(16) DEFAULT NULL,
		REFRESH_READ_TSO bigint DEFAULT NULL,
		REFRESH_FAILED_REASON text DEFAULT NULL,
		PRIMARY KEY(REFRESH_JOB_ID),

Review comment (suggestion):
```suggestion
		LAST_SUCESSFUL_REFRESH_READ_TSO bigint DEFAULT NULL,
```

Code after:

       index_details json,        -- est_index_size, reason, DDL to create this index, ...
       top_impacted_queries json, -- improvement, plan before and after this index, ...
       workload_impact json,      -- improvement and more details, ...
       extra json,                -- for the cloud env to save more info like RU, cost_saving, ...
       index idx_create(created_at),
       index idx_update(updated_at),
       unique index idx(schema_name, table_name, index_columns))`

	// CreateKernelOptionsTable is a table to store kernel options for tidb.
	CreateKernelOptionsTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_kernel_options (
	        module varchar(128),
	        name varchar(128),
	        value varchar(128),
	        updated_at datetime,
	        status varchar(128),
	        description text,
	        primary key(module, name))`

	// CreateTiDBMViewRefreshTable is a table to store current (latest) refresh state for each materialized view.
	CreateTiDBMViewRefreshTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_mview_refresh (
		MVIEW_ID bigint NOT NULL,
		LAST_REFRESH_RESULT varchar(16) DEFAULT NULL,
		LAST_REFRESH_TYPE varchar(16) DEFAULT NULL,
		LAST_REFRESH_TIME datetime DEFAULT NULL,
		LAST_SUCCESSFUL_REFRESH_READ_TSO bigint DEFAULT NULL,
		LAST_REFRESH_FAILED_REASON longtext DEFAULT NULL,
		PRIMARY KEY(MVIEW_ID))`

	// CreateTiDBMLogPurgeTable is a table to store current (latest) purge state for each materialized view log.
	CreateTiDBMLogPurgeTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_mlog_purge (
		MLOG_ID bigint NOT NULL,
		LAST_PURGE_TIME datetime DEFAULT NULL,
		LAST_PURGE_ROWS bigint DEFAULT NULL,
		LAST_PURGE_DURATION bigint DEFAULT NULL,
		PRIMARY KEY(MLOG_ID))`

	// CreateTiDBMViewRefreshHistTable is a table to store mview refresh history.
	// Note: REFRESH_JOB_ID is auto-increment BIGINT (internal).
	CreateTiDBMViewRefreshHistTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_mview_refresh_hist (
		MVIEW_ID bigint NOT NULL,
		MVIEW_NAME varchar(64) NOT NULL,
		REFRESH_JOB_ID bigint NOT NULL AUTO_INCREMENT,
		IS_NEWEST_REFRESH varchar(3) NOT NULL,
		REFRESH_METHOD varchar(32) NOT NULL,
		REFRESH_TIME datetime DEFAULT NULL,
		REFRESH_ENDTIME datetime DEFAULT NULL,
		REFRESH_STATUS varchar(16) DEFAULT NULL,
		REFRESH_READ_TSO bigint DEFAULT NULL,
		REFRESH_FAILED_REASON text DEFAULT NULL,
		PRIMARY KEY(REFRESH_JOB_ID),