A method for calculating the level of failure factors in distributed databases

Through the horizontal calculation method of distributed database fault factors, the test coverage and accuracy problems caused by randomly selecting fault instances in database high-availability testing are solved, efficient fault simulation and coverage are achieved, and the accuracy of high-availability testing is ensured.

CN118394853BActive Publication Date: 2024-09-03TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410867639.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-09-03
Estimated Expiration
2044-07-01

AI Technical Summary

Technical Problem

In database high-availability functional testing, the random selection of fault instances results in reduced test coverage and low test accuracy. The selected fault instances may not meet the current test requirements, causing the test to need to be re-executed, reducing efficiency.

Method used

Adopt the horizontal calculation method of distributed database failure factors, obtain database deployment information, mapping relationships between instances and physical machines, and table distribution relationships by building components, calculate availability and IP sets of potential failures, and combine shard number sorting and backup sharding relationship, determine the subset of faulty nodes whose coverage meets the requirements, and achieve high-availability fault simulation.

Benefits of technology

Improved test coverage and accuracy, ensuring that one test can fully cover the high availability logic of the database, avoiding repeated testing, and improving the accuracy of high availability testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394853B
    Figure CN118394853B
Patent Text Reader

Abstract

The present invention provides a method for calculating the level of fault factors of a distributed database. According to the actual distribution of database tables and the available status of shards, combined with the fault classification to be constructed, a method for calculating constructible fault instances or fault nodes is provided, so as to solve the problems of single selection of fault nodes and inaccurate matching with test targets, and improve test coverage and test accuracy. The idea of ​​the present invention is to conduct high-availability test on tables from the perspective of test coverage. The simulated fault instances need to cover the situations where the table is still available and the table is unavailable after the fault occurs. A calculation method is provided to obtain two major fault sets, and then fault simulation is performed according to the fault information of each subset, and test cases are executed to complete high-availability testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer technology, and in particular relates to a method for calculating the level of failure factors of a distributed database. Background Art

[0002] Dividing the table data in the database into multiple copies and storing them on different instances is a feature of distributed database storage. Each copy on an instance is called a shard. In order to provide users with high availability and prevent a situation where a certain instance fails and users cannot read and write data in the table, backup storage is implemented on the table storage, that is, a table can be stored with up to 2 backups, and the primary and backup shards of the same shard cannot be on the same instance.

[0003] During the database high-availability functional testing process, it is necessary to simulate node failures first, and then test whether the database processing logic is correct after the failure occurs. The original method of selecting fault instances is to select only one instance to simulate the failure, and it is randomly selected. The selected fault node is relatively simple. This method is simple to implement automatically and can meet the requirements of high-availability testing. However, as the number of instances supported by the database deployment increases, the shards of the table can be selectively stored on certain instances. Two problems will arise. One problem is that the test coverage will be reduced. The second problem is that a randomly selected instance may not be the instance corresponding to the table used in the current test. This will cause the test to fail to achieve the expected results, and it is necessary to reselect and execute the test again, reducing the test accuracy. Summary of the invention

[0004] In view of this, the present invention aims to propose a method for calculating the level of failure factors of a distributed database, in order to solve at least one of the above-mentioned technical problems.

[0005] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0006] A method for calculating the level of a distributed database failure factor comprises the following steps:

[0007] Construct and use the first, second and third components to respectively obtain the deployment information of the database, the mapping relationship between the database instance and the physical machine, and the distribution relationship of the database table; wherein, according to the deployment information, the mapping relationship and the distribution relationship, a set A including the IP address of the physical machine to which the fault instance belongs is obtained;

[0008] Construct and use the fourth and fifth components to respectively calculate the availability of the database table and the distribution combination of nodes that maintain the availability; wherein a set B including IPs with potential failures is obtained according to the availability and distribution combination;

[0009] The complement of set A and set B is taken as set C, and the power set of set C is calculated to obtain a subset of faulty nodes whose coverage meets the requirements;

[0010] Sort the backup shards of the database instance in ascending order according to the shard number, traverse all backup shards starting from the largest shard number, take set B and all IPs corresponding to the current shard number as the minimum subset, and compare whether the minimum subset is consistent with set A. If they are inconsistent, record the minimum subset and the IP in set A, otherwise replace the current shard with the next shard;

[0011] The union of the minimum subset, set A, and the subset of the faulty nodes is obtained to obtain the distributed database failure factor.

[0012] Furthermore, the set A is a set of faulty IPs, and the specific acquisition process thereof includes:

[0013] If the current fault is a node-level fault, and there are multiple instances deployed in the IP where the fault occurs, the IP of the database instance is obtained according to the distribution relationship in the table, and the physical machine IP corresponding to the database instance is obtained by traversing the mapping relationship. If a physical machine IP corresponds to multiple database instances, the physical machine IP is only recorded once, and the set of faulty IPs of multiple physical machines is taken as set A;

[0014] Otherwise, the instance IP of the third component is a faulty IP.

[0015] Furthermore, the backup shards are sorted in order and recorded in the linked list L in sequence, and the current pointer points to the last node of the linked list L;

[0016] The process of replacing the current fragment with the next fragment is: moving the pointer to the previous node of the linked list node pointed to by the current pointer.

[0017] Furthermore, the implementation process of the first component includes:

[0018] Connect to the database environment according to the specified IP, obtain the deployment information of the database, obtain the IP addresses of all instances in the database through the interface provided by the database, and return the instance IP list.

[0019] Furthermore, the implementation process of the second component includes:

[0020] Traverse the instance IP list returned by the first component, obtain all IP information in the physical machine where each instance IP is located, compare the IP information in the physical machine with the instance IP to obtain all instance IPs corresponding to each physical machine, and record the correspondence between the physical machine and the instance IP in a two-dimensional array.

[0021] Furthermore, the implementation process of the third component includes: executing a database operation instruction to obtain the shard name of the table, the instance to which the shard belongs, and the available status of the shard.

[0022] Furthermore, the implementation process of the fourth component includes:

[0023] Divide the shards of the table into multiple groups according to the distribution relationship returned by the third component, calculate the number of available shards in each group, and obtain the availability of each shard group based on the calculation result;

[0024] If the number of available shards in the current shard group is 0, the current shard group has no availability;

[0025] If the number of available shards in the current shard group is 1, the current shard group is available without backup, and an available relationship list is established;

[0026] If the number of available shards in the current shard group is greater than 1, the current shard group has available backups, and an available relationship list is established;

[0027] The available relationship list records the shard names and instance IP addresses corresponding to the available shards.

[0028] Furthermore, the implementation process of the fifth component includes:

[0029] Establish an availability distribution relationship matrix between instance IP and shards according to the available relationship list returned by the fourth component, wherein the rows of the availability distribution relationship matrix are shards and the columns are instance IPs;

[0030] Subtract 1 from all element values ​​in the availability distribution relationship matrix to obtain a tracking matrix, and then change the tracking matrix. Specifically, select the column with the most element values ​​of 0 in the tracking matrix, change the element value of 0 in this column to 1, and change the element value of 0 in the same row as the current element value to 2;

[0031] Repeat the operation of changing the tracking matrix until all the values ​​of the elements in the changed matrix are not 0, and the change is completed.

[0032] Compared with the prior art, the method for calculating the level of a distributed database failure factor described in the present invention has the following beneficial effects:

[0033] Improve test coverage to fully cover the database high availability processing logic;

[0034] The accuracy of test cases is improved. According to the actual distribution and availability of the objects under test, the fault nodes are calculated and then a high-availability fault simulation is performed, which can achieve the test purpose in one go and avoid the situation where repeated abnormalities are created to achieve the high-availability test purpose. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0036] Figure 1 The present invention is a flowchart of a method for calculating the level of a distributed database failure factor according to an embodiment of the present invention. DETAILED DESCRIPTION

[0037] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0038] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0039] like Figure 1 As shown: A method for calculating the level of a distributed database failure factor comprises the following steps:

[0040] Step 1: Calculate the distribution of the table and obtain information about all instances or nodes of the table distribution:

[0041] Construct and use the first, second and third components to respectively obtain the deployment information of the database, the mapping relationship between the database instance and the physical machine, and the distribution relationship of the database table; wherein, according to the deployment information, the mapping relationship and the distribution relationship, a set A including the IP address of the physical machine to which the fault instance belongs is obtained;

[0042] Step 2: Get a set of instance or node information that ensures the table is available:

[0043] Construct and use the fourth and fifth components to respectively calculate the availability of the database table and the distribution combination of nodes that maintain the availability; wherein a set B including IPs with potential failures is obtained according to the availability and distribution combination;

[0044] Step 3: Get multiple combinations of fault nodes for constructing positive use cases:

[0045] The complement of set A and set B is taken as set C, and the power set of set C is calculated to obtain a subset of faulty nodes whose coverage meets the requirements;

[0046] Step 4: Calculate the combination of fault nodes for constructing abnormal use cases:

[0047] Sort the backup shards of the database instance in ascending order according to the shard number, traverse all backup shards starting from the largest shard number, take set B and all IPs corresponding to the current shard number as the minimum subset, and compare whether the minimum subset is consistent with set A. If they are inconsistent, record the minimum subset and the IP in set A, otherwise replace the current shard with the next shard;

[0048] Step 5: Get the union of the minimum subset, set A, and the subset of the faulty nodes to obtain the distributed database failure factor.

[0049] The set A is a set of faulty IPs, and the specific acquisition process includes:

[0050] If the current fault is a node-level fault, and there are multiple instances deployed in the IP where the fault occurs, the IP of the database instance is obtained according to the distribution relationship in the table, and the physical machine IP corresponding to the database instance is obtained by traversing the mapping relationship. If a physical machine IP corresponds to multiple database instances, the physical machine IP is only recorded once, and the set of faulty IPs of multiple physical machines is taken as set A;

[0051] Otherwise, the instance IP of the third component is a faulty IP.

[0052] After the backup shards are sorted in sequence, they are recorded in the linked list L in sequence, and the current pointer points to the last node of the linked list L;

[0053] The process of replacing the current fragment with the next fragment is: moving the pointer to the previous node of the linked list node pointed to by the current pointer.

[0054] Specifically:

[0055] Step a) Calculate the IP address of the backup shard. According to the final matrix obtained by the third component, the row and column values ​​of the element value in region 2 are the IP addresses corresponding to the shards, which are recorded as {shard name: ip, shard name: ip}. Use the merge sort algorithm to sort the shard names from small to large, and record them in the linked list L in order of {shard name: ip, shard name: ip}. The current pointer points to the last node.

[0056] Step b) obtaining the shard number i of the selected minimum subset = the shard name i of the element pointed to by the current pointer of the linked list L;

[0057] Step c) Select the smallest subset: all IPs of set B plus the IP of the node corresponding to shard number i;

[0058] Step d) If the minimum subset is equal to set A, the linked list pointer points to the previous node and sub-steps b) and c) are executed again; if the minimum subset is not equal to set A, proceed to sub-step e);

[0059] The faulty node selected in step e) has two values: the IP of the smallest subset and the IP of set A.

[0060] The implementation process of the first component includes:

[0061] Connect to the database environment according to the specified IP, obtain the deployment information of the database, obtain the IP addresses of all instances in the database through the interface provided by the database, remotely connect to the database management node, execute the interface provided by the database to obtain node information, and return the instance IP list ins_list: {ip1, ip2, ..., ipn}.

[0062] The implementation process of the second component includes:

[0063] Copy ins_list to a new list ins_list_tmp;

[0064] Read the element values ​​in ins_list_tmp in sequence, connect to the physical machine, obtain all IP information on the machine according to the network command provided by the operating system, and perform a logical AND operation with ins_list_tmp. The result is the instance list belonging to a machine. Maintain a two-dimensional array, append the element {nth group: instance i, instance j}, and remove the selected element value in ins_list_tmp.

[0065] If ins_list_tmp is not empty, continue to repeat the above steps;

[0066] Get the mapping relationship between all physical machines and corresponding instance IPs w_ins_list: {{Group 1: ip1, ip2}, {Group 2: ip3, ip4}, ...};

[0067] If the number of instances corresponding to each group is 1, it is a single-instance deployment, otherwise it is a multi-instance deployment.

[0068] The implementation process of the third component includes: executing a database operation instruction to obtain the shard name of the table, the instance to which the shard belongs, and the available status of the shard, specifically:

[0069] Connect to the database and execute the database operation command showdatacopymap table name to obtain the distribution information and available status information of all shards in the table. This information is a collection of available information of all shards, including the name of each shard, the instance to which the shard belongs, and the available status of the shard (0 for available and 1 for unavailable).

[0070] The implementation process of the fourth component includes:

[0071] According to the distribution information returned by the third component, group by shard number. If the shard number is null, it is uniformly calculated as n0. All shards belong to the same shard. Calculate the number of shards in the same group with an available state of 0, starting from the smallest shard.

[0072] If it is equal to 0, the shard is unavailable and there is no available node. If it returns false, the process ends and the fault information cannot be selected;

[0073] If it is not equal to 0, continue to count other shards until all shards are counted;

[0074] If the statistics of all shards are equal to 1, the shard is available but has no backup, and there is no instance that can cause a failure. True is returned, the list of available relationships is maintained, and the process ends;

[0075] If the number is greater than 1, the shard is available and has a backup, true is returned, the list of available relationships is maintained, and the process ends;

[0076] The available relationship list records the shard name and the instance IP corresponding to the available shard.

[0077] The implementation process of the fifth component includes:

[0078] Establish an availability distribution relationship matrix between instance IP and shards according to the available relationship list returned by the fourth component, wherein the rows of the availability distribution relationship matrix are shards and the columns are instance IPs;

[0079] Subtract 1 from all element values ​​in the availability distribution relationship matrix to obtain a tracking matrix, and then change the tracking matrix. Specifically, select the column with the most element values ​​of 0 in the tracking matrix, change the element value of 0 in this column to 1, and change the element value of 0 in the same row as the current element value to 2;

[0080] Repeat the operation of changing the tracking matrix until all the values ​​of the elements in the changed matrix are not 0, and the change is completed.

[0081] There are many specific implementation processes of the fifth component, which are as follows:

[0082] Process example 1:

[0083] 1) According to the list of available relations obtained by the fourth component, a two-dimensional matrix is ​​constructed (the value determined by each row and column is called an element); the horizontal row represents the shard n, and the vertical column represents the instance P. For example, Table 1 has 5 shards distributed on 5 instances. The matrix is ​​constructed as follows: P1, n1 is 1, indicating that there is an available n1 shard on the P1 instance, and P1, n2 is 0, indicating that there is no available n2 shard on the P1 instance. From this table, it can also be concluded that the available shards of n1 are distributed on the P1 and P2 instances, and the n1 and n5 shards are available on the P1 instance.

[0084] 2) If a node-level fault is constructed, call the second component to determine whether it is a multi-instance. If it is a multi-instance, further merge matrix 1 according to the relationship between the physical machine and the instance (refer to process example 3 for details). Otherwise, continue.

[0085] 3) Copy the above matrix to form a shard candidate result matrix, hereinafter referred to as matrix 2. The initial value of the elements of matrix 2 is determined by the corresponding element value of matrix 1. The element value of matrix 2 = the element value of matrix 1 minus 1; -1 means that the element is invalid, 0 means that the element is not selected yet, 1 means that the element has been selected, and 2 means that it is repeated and not used.

[0086] 4) Construct the matrix by summing columns to divide the available slices on each instance into a selected list and a waiting list. The selected list is the slices selected after the following calculation, and the waiting list is the slices that are not selected;

[0087] A. Calculate the total number of shards to be selected distributed on each instance:

[0088] The total number of unselected shards of the instance S1{y} = the number of 0 values ​​in each column element;

[0089] The total number of repeated fragments of the instance S2{y} = the number of elements in each column whose value is 2;

[0090] Where y is the instance number, starting from 1.

[0091] B. Calculate the list of candidate instances:

[0092] Sort the values ​​of S1{y} and take the maximum value S1{j}. If there are multiple maximum values, such as S1{2} and S1{3} are both equal to 3, then take the one with the smallest y, here we take y=2;

[0093] Set y=2, which is the second instance P2. The selected shards are n1, n2, and n5. The corresponding value is changed from 0 to 1. At the same time, the element values ​​corresponding to all backup shards of these three shards are changed to 2. P2 is added to the list of selected instances.

[0094] 5) Check that if all element values ​​are not 0, the process ends, indicating that the selection of available instances has been completed. Otherwise, continue to repeat the above steps to select;

[0095] According to the calculation, the S1 values ​​of the P3 and P4 columns are both 2, which is the maximum value. The S2{3} and S2{4} values ​​are compared again and S2{4} is smaller. In this round, P4 is selected as the selected instance, and P2 and P4 are added to the selected instance list, and the element value is changed.

[0096] After the second round, all element values ​​are checked to be non-zero, and the process ends. The final instance list selected is P2 and P4.

[0097] This method will yield:

[0098] If a node-level failure is constructed, a set of available physical machine IPs is obtained;

[0099] If an instance-level failure is constructed, a set of available instance IPs is obtained.

[0100] Specific working process:

[0101] This time, the data in table t1 is used to construct an exception before or during the read or write operation of t1 to test the high availability processing of the database;

[0102] Table t1 has 5 shards, namely n1, n2, n3, n4, n5, each shard stores the IP address of the machine;

[0103] All instances of table distribution are represented by set A, and a set of instances that ensure table availability is represented by set B;

[0104] Set A = {ip1, ip2, ip3, ip4, ip5};

[0105] Set B = {ip2, ip4};

[0106] The complement of set A and set B is the set C of faulty nodes;

[0107] Set C = {ip1, ip3, ip5};

[0108] Then there are 7 possible values ​​of the fault node in the forward use case, namely {ip1}, {ip3}, {ip5}, {ip1,ip3}, {ip1,ip5}, {ip3,ip5}, {ip1,ip3,ip5};

[0109] Get the IP relationship of the backup shards corresponding to the 5 shards, shard number i=5, corresponding IP is ip1, get the minimum set ip2, ip4, ip1, IP combinations are: {ip2, ip4, ip1} and {ip2, ip4, ip1, ip3, ip5};

[0110] The values ​​of the fault node factors in the test cases are obtained as follows:

[0111] Table 1: Values ​​of fault node factors in test cases

[0112]

[0113] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0114] In the several embodiments provided in the present application, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the division of the units described above is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The above-mentioned units may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

[0116] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for calculating the level of failure factors of a distributed database, characterized in that: The steps include: Construct and use the first, second and third components to respectively obtain the deployment information of the database, the mapping relationship between the database instance and the physical machine, and the distribution relationship of the database table; wherein, according to the deployment information, the mapping relationship and the distribution relationship, a set A including the IP address of the physical machine to which the fault instance belongs is obtained; Construct and use the fourth and fifth components to respectively calculate the availability of the database table and the distribution combination of nodes that maintain the availability; wherein a set B including IPs with potential failures is obtained according to the availability and distribution combination; The complement of set A and set B is taken as set C, and the power set of set C is calculated to obtain a subset of faulty nodes whose coverage meets the requirements; Sort the backup shards of the database instance in ascending order according to the shard number, traverse all backup shards starting from the largest shard number, take set B and all IPs corresponding to the current shard number as the minimum subset, and compare whether the minimum subset is consistent with set A. If they are inconsistent, record the minimum subset and the IP in set A, otherwise replace the current shard with the next shard; The union of the minimum subset, set A, and the subset of the faulty nodes is obtained to obtain the distributed database failure factor.

2. A method for calculating the level of a distributed database failure factor according to claim 1, characterized in that: The set A is a set of faulty IPs, and the specific acquisition process includes: If the current fault is a node-level fault, and there are multiple instances deployed in the IP where the fault occurs, the IP of the database instance is obtained according to the distribution relationship in the table, and the physical machine IP corresponding to the database instance is obtained by traversing the mapping relationship. If a physical machine IP corresponds to multiple database instances, the physical machine IP is only recorded once, and the set of faulty IPs of multiple physical machines is taken as set A; Otherwise, the instance IP of the third component is a faulty IP.

3. The method for calculating the level of a distributed database failure factor according to claim 1, characterized in that: After the backup shards are sorted in sequence, they are recorded in the linked list L in sequence, and the current pointer points to the last node of the linked list L; The process of replacing the current fragment with the next fragment is: moving the pointer to the previous node of the linked list node pointed to by the current pointer.

4. The method for calculating the level of a distributed database failure factor according to claim 1, characterized in that: The implementation process of the first component includes: Connect to the database environment according to the specified IP, obtain the deployment information of the database, obtain the IP addresses of all instances in the database through the interface provided by the database, and return the instance IP list.

5. The method for calculating the level of a distributed database failure factor according to claim 1, characterized in that: The implementation process of the second component includes: Traverse the instance IP list returned by the first component, obtain all IP information in the physical machine where each instance IP is located, compare the IP information in the physical machine with the instance IP to obtain all instance IPs corresponding to each physical machine, and record the correspondence between the physical machine and the instance IP in a two-dimensional array.

6. A method for calculating the level of a distributed database failure factor according to claim 1, characterized in that: The implementation process of the third component includes: executing a database operation instruction to obtain the shard name of the table, the instance to which the shard belongs, and the available status of the shard.

7. A method for calculating the level of a distributed database failure factor according to claim 1, characterized in that: The implementation process of the fourth component includes: Divide the shards of the table into multiple groups according to the distribution relationship returned by the third component, calculate the number of available shards in each group, and obtain the availability of each shard group based on the calculation result; If the number of available shards in the current shard group is 0, the current shard group has no availability; If the number of available shards in the current shard group is 1, the current shard group is available without backup, and an available relationship list is established; If the number of available shards in the current shard group is greater than 1, the current shard group has available backups, and an available relationship list is established; The available relationship list records the shard names and instance IP addresses corresponding to the available shards.

8. The method for calculating the level of a distributed database failure factor according to claim 1, characterized in that: The implementation process of the fifth component includes: Establish an availability distribution relationship matrix between instance IP and shards according to the available relationship list returned by the fourth component, wherein the rows of the availability distribution relationship matrix are shards and the columns are instance IPs; Subtract 1 from all element values ​​in the availability distribution relationship matrix to obtain a tracking matrix, and then change the tracking matrix. Specifically, select the column with the most element values ​​of 0 in the tracking matrix, change the element value of 0 in this column to 1, and change the element value of 0 in the same row as the current element value to 2; Repeat the operation of changing the tracking matrix until all the values ​​of the elements in the changed matrix are not 0, and the change is completed.