Check the version
After you upgrade ODC, you can access Web ODC in a browser by using the IP address and port number of the host (the host where the Nginx proxy is deployed in a high-availability deployment) (http://IP:PORT or http://DOMAIN:PORT).
After you log in to ODC, select About ODC in the drop-down list in the upper-right corner of the Connections page. In the dialog box that appears, you can view the version number of the current application to determine whether the upgrade is successful. For more information about how to use Web ODC, see ODC User Guide (Web ODC).
Data check for upgrade
After the ODC version is upgraded, some periodic tasks may display different content due to the version iteration updates. You can log in to the metadata database and execute an SQL statement to correct the content. The specific procedure is as follows:
Correct the data: Correct the status of the execution records
During the migration of tasks, tasks in non-terminal states are all migrated to the CANCELED state. This causes the status of the task and the migrated task to be inconsistent. Run the following SQL statements to correct the status.
DELIMITER //
CREATE PROCEDURE batch_update_schedule_task()
BEGIN
DECLARE batch_size INT DEFAULT 1000;
DECLARE min_id BIGINT DEFAULT 0;
DECLARE max_id BIGINT DEFAULT 0;
DECLARE max_table_id BIGINT;
DECLARE updated_rows INT DEFAULT 0;
-- Obtain the maximum ID.
SELECT IFNULL(MAX(id), 0) INTO max_table_id FROM schedule_task WHERE job_id < 0;
my_loop: WHILE min_id < max_table_id DO
SET max_id = min_id + batch_size;
-- Execute the batch update.
UPDATE schedule_task st
JOIN (
SELECT
-fint.flow_instance_id AS job_id,
tt.status AS task_status
FROM flow_instance_node_task fint
JOIN task_task tt ON tt.id = fint.task_task_id
WHERE fint.flow_instance_id IN (
SELECT -job_id
FROM schedule_task WHERE job_id < 0
)
) source_data ON st.job_id = source_data.job_id
SET st.status = source_data.task_status
WHERE st.status != source_data.task_status
AND st.id > min_id
AND st.id <= max_id;
-- Optional: Obtain the number of affected rows, which is required for logging.
-- SELECT ROW_COUNT() INTO updated_rows;
SET min_id = max_id;
END WHILE my_loop;
END //
DELIMITER ;
CALL batch_update_schedule_task();
Hide data: Hide the migrated tasks
In ODC versions earlier than V4.4.1, the subtasks of SQL plans and partitioning plans were database changes and displayed in the Database Change section of the ticket module. Now, these tasks are migrated to the Execution Records section of the job module. If you do not want to display historical data in the ticket module, run the following SQL statements to correct the data.
DELIMITER //
CREATE PROCEDURE batch_update_flow_instance_node_task()
BEGIN
DECLARE batch_size INT DEFAULT 10000;
DECLARE last_id BIGINT DEFAULT 0;
DECLARE max_id BIGINT;
SELECT MAX(id) INTO max_id FROM flow_instance_node_task;
WHILE last_id < max_id DO
-- SQL_PLAN
UPDATE flow_instance_node_task fint
JOIN task_task tt ON tt.id = fint.task_task_id
SET fint.task_type = 'SQL_PLAN'
WHERE tt.task_type = 'ASYNC'
AND fint.flow_instance_id IN (
SELECT -job_id
FROM schedule_task
WHERE job_group = 'SQL_PLAN' AND job_id < 0
)
AND fint.id > last_id AND fint.id <= last_id + batch_size;
-- PARTITION_PLAN
UPDATE flow_instance_node_task fint
JOIN task_task tt ON tt.id = fint.task_task_id
SET fint.task_type = 'PARTITION_PLAN'
WHERE tt.task_type = 'ASYNC'
AND fint.flow_instance_id IN (
SELECT -job_id
FROM schedule_task
WHERE job_group = 'PARTITION_PLAN' AND job_id < 0
)
AND fint.id > last_id AND fint.id <= last_id + batch_size;
SET last_id = last_id + batch_size;
END WHILE;
END //
DELIMITER ;
CALL batch_update_flow_instance_node_task();
Check the history of logical database changes
After the upgrade, the historical data of logical database change tickets cannot be viewed. You can obtain the historical change data from the metadata database.
Prerequisites
- You have installed the OBClient client. For more information, see Download OBClient.
Procedure
Obtain the execution script.
Log in to the server where the source database is located and run the script.
$sh logical_db_view.sh Logical database change task information viewing tool Usage: luojiku.sh<command>[parameters...] Note: All IDs used in the commands are IDs in the schedule_schedule table. Commands: list List all logical database change tasks (the most recent 20). detail <schedule_id> View the details of a task (the ID of the task is schedule_schedule.id). all <schedule_id> View the execution status of all physical databases of a task. physical <schedule_id> <db_id> View the details of the execution of a specified physical database. help Display this help information. Environment variables: ODC_DATABASE_HOST Database host (default: localhost) ODC_DATABASE_PORT Database port (default: 2883) ODC_DATABASE_NAME Database name (default: odc) ODC_DATABASE_USERNAME Database username (default: root) ODC_DATABASE_PASSWORD Database password Example: logical_db_view.sh list logical_db_view.sh detail 123 # schedule_schedule.id = 123. logical_db_view.sh all 123 logical_db_view.sh physical 123 456 Note: This script uses the obclient client tool to connect to the OceanBase database.If the database connection error occurs, configure the environment variables to ensure that the database connection information is accurate.
The environment variable configuration command is as follows. Fill in the actual metadata configuration information.
export ODC_DATABASE_HOST=xx.xx.xx.xx export ODC_DATABASE_PORT=2883 export ODC_DATABASE_NAME=odc export ODC_DATABASE_USERNAME=root export ODC_DATABASE_PASSWORD=********After the database connection is successful, run the following commands to view the historical data of logical database changes. Here are some common use cases.
List all logical database change tasks:
sh logical_db_view.sh list.View the details of a logical database change task:
sh logical_db_view.sh detail 532.View the execution status of a physical database:
sh logical_db_view.sh all 532.View the details of the execution of a physical database based on the physical database ID:
sh logical_db_view.sh physical 532 55658.
