Index creation mode detection method, device, medium and computer equipment
Through automated scripts, traversing the project source code, using PLSQL syntax to parse the abstract syntax tree, quickly detecting the index creation method, solving the problems of low manual detection efficiency and misjudgment, and achieving efficient and accurate index creation method detection.
Patent Information
- Application Number
- CN202211608337.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-12-14
AI Technical Summary
In the prior art, the manual code review method detects index creation method is inefficient and prone to misjudgment, resulting in database table locking and program abnormalities, affecting project progress.
Through automated scripts, traverse project source code, use the first, second and third traversal rules, filter out the target suffix files, and parse the abstract syntax tree according to PLSQL syntax to quickly find indexes that have not been created using the online creation method.
It improves the efficiency and accuracy of the inspection of index creation method, avoids missed and missed searches in manual searches, and significantly reduces R&D costs.
Smart Images

Figure CN115952083B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an index creation mode detection method, apparatus, medium and computer equipment. Background Art
[0002] With the rapid development of the internet, some database development processes can improve the performance and efficiency of accessing database data by creating indexes. In actual database development, developers may not use online index creation due to development habits or capabilities. Failure to use online index creation can cause database tables to be locked when used, leading to program exceptions.
[0003] To avoid similar issues, manual code reviews can be used to examine database development source code one by one, determining from the corresponding fields in the source code whether the developer created the index online. However, manual code reviews often suffer from omissions and misjudgments, resulting in low efficiency and accuracy in detecting index creation methods. Furthermore, a database development project's source code may contain tens of thousands of lines, making manual code reviews time-consuming and impacting project progress. Summary of the Invention
[0004] The embodiments of the present invention provide a method, apparatus, medium and computer equipment for detecting an index creation mode, which can significantly improve the efficiency and accuracy of detecting an index creation mode and save database development time.
[0005] An embodiment of the present invention provides an index creation mode detection method, which is applied to a target database. The method includes:
[0006] Acquire fields to be detected, where the fields to be detected include fields related to the target database;
[0007] Traversing the fields to be detected based on a first traversal rule, and filtering out a first field to be detected belonging to a database file from the fields to be detected;
[0008] Traversing the first to-be-detected field based on a second traversal rule, and filtering out a second to-be-detected field belonging to the target database from the first to-be-detected field;
[0009] Traversing the second to-be-detected field based on a third traversal rule, and filtering out a third to-be-detected field belonging to a target node operation from the second to-be-detected field;
[0010] The third field to be detected is traversed based on the target function. If the third field to be detected includes a target field, a target index created in an online creation manner exists in the target database.
[0011] An embodiment of the present invention further provides an index creation mode detection device, which is applied to a target database and includes:
[0012] A to-be-detected field acquisition module is used to acquire the to-be-detected fields, wherein the to-be-detected fields include fields related to the target database;
[0013] A first traversal module, configured to traverse the fields to be detected based on a first traversal rule, and filter out a first field to be detected belonging to a database file from the fields to be detected;
[0014] A second traversal module, configured to traverse the first field to be detected based on a second traversal rule, and filter out a second field to be detected belonging to the target database from the first field to be detected;
[0015] a third traversal module, configured to traverse the second to-be-detected field based on a third traversal rule, and filter out a third to-be-detected field belonging to a target node operation from the second to-be-detected field;
[0016] The fourth traversal module is used to traverse the third field to be detected based on the target function. If the third field to be detected includes a target field, there is a target index created in an online creation manner in the target database.
[0017] Optionally, the first traversal module further includes:
[0018] A folder traversal submodule is used to traverse the folder where the field to be detected is located, and all subfolders contained in the folder;
[0019] The target suffix character search module is used to search whether the target suffix character exists in the name of the folder or the subfolder. If so, the field under the folder or subfolder containing the target suffix character is determined as the first field to be detected.
[0020] Optionally, the second traversal module includes:
[0021] A target programming language acquisition submodule is used to acquire the target programming language;
[0022] a parsing submodule, configured to parse the first to-be-detected field in the folder or the subfolder based on the target programming language;
[0023] The abnormality detection submodule is used to detect whether the process of parsing the first field to be detected is abnormal. If not, the parsed first field to be detected is determined as the second field to be detected.
[0024] Optionally, the third traversal module includes:
[0025] A parsing information acquisition submodule, configured to acquire parsing information of the second field to be detected;
[0026] The target node detection submodule is configured to detect whether a target node exists in the parsed information, and if so, determine the field in the second field to be detected that is related to the target node as the third field to be detected.
[0027] Optionally, the objective function includes a first objective function and a second objective function, and the fourth traversal module includes:
[0028] An attribute information acquisition submodule, configured to traverse the third field to be detected and acquire attribute information of the third field to be detected;
[0029] a target parameter detection submodule, configured to detect, based on the first target function, whether the attribute information includes a first target parameter related to index creation, and if so, to continue detecting whether the attribute information includes a second target parameter related to online index creation;
[0030] If so, the target index created in an online creation manner exists in the file in the folder or the subfolder.
[0031] Optionally, the device further comprises:
[0032] The character translation submodule is used to uniformly convert each character of the field to be detected into an uppercase character or a lowercase character based on a translation function.
[0033] In some embodiments of the present invention, a computer device may be provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-described method when executing the computer program.
[0034] In some embodiments of the present invention, a computer-readable storage medium may be provided, on which a computer program is stored. When the computer program is run on a computer, the computer is caused to execute the steps of the method as described above.
[0035] As can be seen from the above, this application uses an automated script to traverse the fields to be detected in the project source code, extracts the target suffix file from the fields to be detected using the first, second, and third traversal rules, and parses the abstract syntax tree according to the PLSQL syntax to quickly find out whether there is an index in the fields to be detected that has not been created using the online creation method. Therefore, the search time and search accuracy of the index creation method detected by the above method are fast, and the script traversal method can avoid missed searches and mischecks caused by manual searches. In addition, the process of detection using this method does not need to rely on manual processing, so that the R&D cost overhead can be significantly reduced completely through the automated script method. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 This is a schematic diagram of an application scenario of the index creation mode detection method provided by an embodiment of the present invention;
[0038] Figure 2 Schematic diagram of the process of detecting the index creation mode provided by an embodiment of the present invention;
[0039] Figure 3 This is a technical architecture diagram of the index creation mode detection method provided by an embodiment of the present invention;
[0040] Figure 4 1 is a schematic diagram of the structure of an index creation mode detection device provided by an embodiment of the present invention;
[0041] Figure 5 It is a structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.
[0043] The terms "first", "second" and "third" in the present invention are used only for descriptive purposes and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first", "second" and "third" may explicitly or implicitly include at least one of such features. In the description of the present invention, "multiple" means at least two, for example, two, three, etc., unless otherwise clearly and specifically defined. All directional indications in the embodiments of the present invention (such as up, down, left, right, front, back...) are only used to explain the relative positional relationship, movement, etc. between the components under a specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0044] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0045] The embodiments of the present invention provide a method, apparatus, computer equipment and storage medium for detecting an index creation mode.
[0046] Among them, the computer device can be a terminal device such as a mobile phone, tablet computer, laptop computer, or a wearable device, smart TV or other smart terminal.
[0047] The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms, but is not limited to these.
[0048] See also Figure 1 , Figure 1This is a schematic diagram of an application scenario of the index creation method detection method provided by an embodiment of the present invention. Taking the index creation method detection device integrated in a server as an example, the server can obtain binary log data generated by the first database to be synchronized when detecting a data change in the first database to be synchronized; parse the binary log data to obtain identifiable data corresponding to the binary log data; push the identifiable data to a first node for cleaning and processing the identifiable data at a first preset time interval; control the first node to load a cleaning and processing template, and convert the identifiable data into incremental binary log data as target log data through the cleaning and processing template; obtain the database value after the user operation corresponding to the target log data as incremental data at a second preset time interval, and concurrently synchronize the incremental data to the second database of the target storage.
[0049] As can be seen from the above, this application uses an automated script to traverse the fields to be detected in the project source code, extracts the target suffix file from the fields to be detected using the first, second, and third traversal rules, and parses the abstract syntax tree according to the PLSQL syntax to quickly find out whether there is an index in the fields to be detected that has not been created using the online creation method. Therefore, the search time and search accuracy of the index creation method detected by the above method are fast, and the script traversal method can avoid missed searches and mischecks caused by manual searches. In addition, the process of detection using this method does not need to rely on manual processing, so that the R&D cost overhead can be significantly reduced completely through the automated script method.
[0050] It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.
[0051] See also Figure 2 and Figure 3 , Figure 2 This is a flow chart of a method for detecting an index creation mode provided by an embodiment of the present invention. Figure 3 1 is a schematic diagram of the technical architecture of the index creation method detection method provided by an embodiment of the present invention. Figure 2 As shown, the process of the index creation detection method can be as follows:
[0052] Step 201: Obtain the field to be detected.
[0053] The fields to be detected may include fields related to the target database. In some embodiments, the fields to be detected may be obtained from the project source code management repository gitlab through a git clone command.
[0054] GitLab is an open source project for warehouse management systems that uses Git as a code management tool and a web service built on top of it. The target database can be Oracle, a relational database management system from Oracle Corporation.
[0055] Step 202: traverse the fields to be detected based on a first traversal rule, and select a first field to be detected belonging to a database file from the fields to be detected.
[0056] Optionally, step 202 may include the following steps:
[0057] Traverse the folder where the field to be detected is located, and all subfolders contained in the folder;
[0058] Check whether the target suffix character exists in the name of the folder or the subfolder. If so, determine the field under the folder or subfolder containing the target suffix character as the first field to be detected.
[0059] The target suffix character may be ".sql". It is understood that SQL, which stands for Structured Query Language, is a special-purpose programming language, a database query and programming language used to access data and query, update, and manage relational database systems. Therefore, if a folder or subfolder is named with the suffix .sql, it indicates that the files in the folder or subfolder are database files, and a list of SQL files corresponding to the database files can be further generated.
[0060] Step 203: traverse the first to-be-detected fields based on a second traversal rule, and filter out a second to-be-detected field belonging to the target database from the first to-be-detected fields.
[0061] Optionally, step 203 may further include the following steps:
[0062] Get the target programming language;
[0063] parsing the first to-be-detected field in the folder or the subfolder based on the target programming language;
[0064] It is detected whether the process of parsing the first field to be detected is abnormal; if not, the parsed first field to be detected is determined as the second field to be detected.
[0065] The target programming language is PLSQL syntax. PLSQL is a programming language specifically designed for Oracle servers. It adds some procedural control statements based on SQL. These statements may include type definitions, statements, loops, cursors, and exception or exception handling.
[0066] In some embodiments, the files in the sql file list can be traversed, and the sql file uses PLSQL syntax to parse the first field to be detected, and the first field to be detected is parsed into an abstract syntax tree (AST). If an exception is reported during the parsing process, it means that the sql file does not conform to the PLSQL syntax, indicating that the sql file is not a file of an Oracle database, for example, it can be a file of another database (MySQL, MariaDB). If the first field to be detected in the file is successfully parsed into an abstract syntax tree using PLSQL syntax, it means that the sql file conforms to the PLSQL syntax rules and is a file of an Oracle database.
[0067] Step 204: traverse the second to-be-detected fields based on the third traversal rule, and filter out the third to-be-detected fields belonging to the target node operation from the second to-be-detected fields.
[0068] Optionally, step 204 may further include the following steps:
[0069] Obtaining parsing information of the second field to be detected;
[0070] Detect whether a target node exists in the parsed information; if so, determine the field related to the target node in the second field to be detected as the third field to be detected.
[0071] The target node can be a DDLCommand node, i.e., a DDL instruction node used to define operations such as creating, modifying, and deleting database tables. It is understood that the presence of a DDLCommand node in the abstract syntax tree parsed using the PLSQL syntax is detected. If not, this indicates that the PLSQL file does not contain database DDL operations. Analysis of this file is skipped and the next file is analyzed. Accordingly, if a DDLCommand node exists, all DDLCommand node information in the file is extracted and stored in a DDLCommand node list.
[0072] Step 205: traverse the third field to be detected based on the target function. If the third field to be detected includes the target field, then the target index created in an online creation manner exists in the target database.
[0073] Optionally, the objective function includes a first objective function and a second objective function, wherein the first objective function may be a contain function and the second objective function may be a notcontain function.
[0074] Optionally, step 205 may further include the following steps:
[0075] Traversing the third field to be detected, and obtaining attribute information of the third field to be detected;
[0076] detecting, based on the first objective function, whether the attribute information includes a first objective parameter related to index creation, and if so, continuing to detect whether the attribute information includes a second objective parameter related to online index creation;
[0077] If so, the target index created in an online creation manner exists in the file in the folder or the subfolder.
[0078] The attribute information may be image attribute information, and the first target parameter may be obtained by extracting the image information. The first target parameter may be a "create index" field, that is, creating an index field. The following example illustrates the application of createindex, such as the following data table and index fields for creating user student IDs:
[0079] Createtablebook1(
[0080] Idint(8),
[0081] Namevarchar(20),
[0082] Pricefloat(3)
[0083] Datevarchar(20),
[0084] Sno(8) )
[0086] Createindexindex_book1onbook1(sno)
[0087] It can be seen that when creating the user student number data table, the index of the user student number data table can be created through createindex.
[0088] It can be understood that since the first target function is a contain function, it can be used to detect whether the image attribute information contains the createindex field. If it does, it means that an index creation operation exists in the file. If not, the analysis of the file is skipped and the next file is analyzed directly.
[0089] The second target parameter can be the "online" field. In some embodiments, the notcontain function can be used to determine whether the "online" field is included. If it is included, the file analysis is skipped. If it is not included, it indicates that the SQL file contains an issue where the Oracle database does not use the online creation method to grant user permissions when creating data tables and sequence indexes. The relevant developers need to be notified to modify the code. In some embodiments, the core expression of the above detection and analysis operation is as follows:
[0090] / / DDLCommand[contains(translate(@Image,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz"),"create index")and not(.. / DDL Command[contains(translate(@Image,"ABCDEFGHIJKLMNOPQRSTUVWXY Z","abcdefghijklmnopqrstuvwxyz"),"online")])]
[0091] Optionally, the method of the embodiment of the present application may further include:
[0092] Based on the translation function, each character of the to-be-detected field is uniformly converted into an uppercase character or a lowercase character.
[0093] The translation function may be a translate function. In some embodiments, the fields of the above sql file may be uniformly converted to uppercase or lowercase characters by the translate function, so as to unify the case of all detected characters during the entire traversal analysis detection process, thereby improving the efficiency and accuracy of the detection.
[0094] As can be seen from the above, this application uses an automated script to traverse the fields to be detected in the project source code, extracts the target suffix file from the fields to be detected using the first, second, and third traversal rules, and parses the abstract syntax tree according to the PLSQL syntax to quickly find out whether there is an index in the fields to be detected that has not been created using the online creation method. Therefore, the search time and search accuracy of the index creation method detected by the above method are fast, and the script traversal method can avoid missed searches and mischecks caused by manual searches. In addition, the process of detection using this method does not need to rely on manual processing, so that the R&D cost overhead can be significantly reduced completely through the automated script method.
[0095] In order to better implement the above method, accordingly, an embodiment of the present invention further provides an index creation mode detection device, which is specifically integrated in a terminal or a server.
[0096] refer to Figure 4 , the device comprises:
[0097] A to-be-detected field acquisition module 301 is configured to acquire to-be-detected fields, wherein the to-be-detected fields include fields related to the target database;
[0098] A first traversal module 302 is configured to traverse the fields to be detected based on a first traversal rule, and filter out a first field to be detected belonging to a database file from the fields to be detected;
[0099] A second traversal module 303 is configured to traverse the first to-be-detected field based on a second traversal rule, and filter out a second to-be-detected field belonging to the target database from the first to-be-detected field;
[0100] A third traversal module 304 is configured to traverse the second to-be-detected field based on a third traversal rule, and filter out a third to-be-detected field belonging to a target node operation from the second to-be-detected field;
[0101] The fourth traversal module 305 is configured to traverse the third field to be detected based on a target function. If the third field to be detected includes a target field, then a target index created online exists in the target database.
[0102] Optionally, the first traversal module further includes:
[0103] A folder traversal submodule is used to traverse the folder where the field to be detected is located, and all subfolders contained in the folder;
[0104] The target suffix character search module is used to search whether the target suffix character exists in the name of the folder or the subfolder. If so, the field under the folder or subfolder containing the target suffix character is determined as the first field to be detected.
[0105] Optionally, the second traversal module includes:
[0106] A target programming language acquisition submodule is used to acquire the target programming language;
[0107] a parsing submodule, configured to parse the first to-be-detected field in the folder or the subfolder based on the target programming language;
[0108] The abnormality detection submodule is used to detect whether the process of parsing the first field to be detected is abnormal. If not, the parsed first field to be detected is determined as the second field to be detected.
[0109] Optionally, the third traversal module includes:
[0110] A parsing information acquisition submodule, configured to acquire parsing information of the second field to be detected;
[0111] The target node detection submodule is configured to detect whether a target node exists in the parsed information, and if so, determine the field in the second field to be detected that is related to the target node as the third field to be detected.
[0112] Optionally, the objective function includes a first objective function and a second objective function, and the fourth traversal module includes:
[0113] An attribute information acquisition submodule, configured to traverse the third field to be detected and acquire attribute information of the third field to be detected;
[0114] a target parameter detection submodule, configured to detect, based on the first target function, whether the attribute information includes a first target parameter related to index creation, and if so, to continue detecting whether the attribute information includes a second target parameter related to online index creation;
[0115] If so, the target index created in an online creation manner exists in the file in the folder or the subfolder.
[0116] Optionally, the device further comprises:
[0117] The character translation submodule is used to uniformly convert each character of the field to be detected into an uppercase character or a lowercase character based on a translation function.
[0118] As can be seen from the above, this application uses an automated script to traverse the fields to be detected in the project source code, extracts the target suffix file from the fields to be detected using the first, second, and third traversal rules, and parses the abstract syntax tree according to the PLSQL syntax to quickly find out whether there is an index in the fields to be detected that has not been created using the online creation method. Therefore, the search time and search accuracy of the index creation method detected by the above method are fast, and the script traversal method can avoid missed searches and mischecks caused by manual searches. In addition, the process of detection using this method does not need to rely on manual processing, so that the R&D cost overhead can be significantly reduced completely through the automated script method.
[0119] In addition, an embodiment of the present invention further provides a computer device, which may be a terminal or a server. Figure 5, which shows a schematic diagram of the structure of a computer device involved in an embodiment of the present invention, specifically:
[0120] The computer device may include one or more processing core processors 401, one or more computer readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will understand that Figure 5 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0121] Processor 401 is the control center of the computer device. It connects the various components of the entire computer device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various functions of the computer device and processes data, thereby providing overall monitoring of the computer device. Optionally, processor 401 may include one or more processing cores; preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.
[0122] Memory 402 can be used to store software programs and modules. Processor 401 executes various functional applications and data processing by running the software programs and modules stored in memory 402. Memory 402 may primarily include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function, and the like; the data storage area may store data created based on the use of the computer device. In addition, memory 402 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory 402 may also include a memory controller to provide processor 401 with access to memory 402.
[0123] The computer device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0124] The computer device may further include an input unit 404, which may be configured to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0125] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the computer device will load the executable files corresponding to one or more application processes into the memory 402 according to the following instructions, and the processor 401 will run the application stored in the memory 402 to implement various functions as follows:
[0126] When monitoring data changes in the first database to be synchronized, obtaining binary log data generated by the first database;
[0127] Parsing the binary log data to obtain identifiable data corresponding to the binary log data;
[0128] Pushing the identifiable data to a first node for cleaning and processing the identifiable data at a first preset time interval;
[0129] Controlling the first node to load a cleaning and processing template, and converting the identifiable data into incremental binary log data as target log data by using the cleaning and processing template;
[0130] At a second preset time interval, a database value after the user operation corresponding to the target log data is obtained as incremental data, and the incremental data is concurrently synchronized to a second database of the target storage.
[0131] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0132] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0133] To this end, an embodiment of the present invention further provides a computer-readable storage medium, which stores a plurality of instructions. The instructions can be loaded by a processor to execute the methods provided in various optional implementations of the embodiments of the present invention.
[0134] According to one aspect of the present application, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional implementations of the above embodiments.
[0135] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0136] The storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0137] Since the instructions stored in the storage medium can execute the steps in the method provided in the embodiment of the present invention, the beneficial effects that can be achieved by the method provided in the embodiment of the present invention can be achieved. Please refer to the previous embodiment for details and will not be repeated here.
[0138] The above is a detailed introduction to the index creation mode detection method, device, computer equipment and storage medium provided in the embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for detecting an index creation mode, characterized in that: Applied to a target database, the method includes: Acquire fields to be detected, where the fields to be detected include fields related to the target database; Traversing the fields to be detected based on a first traversal rule, and screening out a first field to be detected belonging to a database file from the fields to be detected, including: traversing a folder where the field to be detected is located, and all subfolders contained in the folder; searching whether a target suffix character exists in the names of the folders or subfolders, and if so, determining the field under the folder or subfolder containing the target suffix character as the first field to be detected; Traversing the first to-be-detected field based on a second traversal rule, and screening out a second to-be-detected field belonging to the target database from the first to-be-detected field, including: obtaining a target programming language; parsing the first to-be-detected field in the folder or the subfolder based on the target programming language; detecting whether the parsing process of the first to-be-detected field is abnormal, and if not, determining the parsed first to-be-detected field as the second to-be-detected field; Traversing the second to-be-detected field based on a third traversal rule, and filtering out a third to-be-detected field belonging to a target node operation from the second to-be-detected field, including: obtaining parsed information of the second to-be-detected field; detecting whether a target node exists in the parsed information, and if so, determining a field in the second to-be-detected field that is related to the target node as the third to-be-detected field; The third field to be detected is traversed based on the target function. If the third field to be detected includes a target field, a target index created in an online creation manner exists in the target database.
2. The index creation mode detection method according to claim 1, characterized in that: The objective function includes a first objective function and a second objective function, and traversing the third field to be detected based on the objective function includes: Traversing the third field to be detected, and obtaining attribute information of the third field to be detected; detecting, based on the first objective function, whether the attribute information includes a first objective parameter related to index creation, and if so, continuing to detect whether the attribute information includes a second objective parameter related to online index creation; If so, the target index created in an online creation manner exists in the file in the folder or the subfolder.
3. The index creation mode detection method according to claim 1 or 2, characterized in that: The method further comprises: Based on the translation function, each character of the to-be-detected field is uniformly converted into an uppercase character or a lowercase character.
4. An index creation mode detection device, characterized in that: Applied to the target database, including: A to-be-detected field acquisition module is used to acquire the to-be-detected fields, wherein the to-be-detected fields include fields related to the target database; A first traversal module is configured to traverse the fields to be detected based on a first traversal rule, filter out a first field to be detected belonging to a database file from the fields to be detected, and traverse a folder where the field to be detected is located, as well as all subfolders contained in the folder; search for a target suffix character in the name of the folder or subfolder, and if so, determine the field under the folder or subfolder containing the target suffix character as the first field to be detected; a second traversal module, configured to traverse the first to-be-detected field based on a second traversal rule, filter out a second to-be-detected field belonging to the target database from the first to-be-detected field, and further configured to obtain a target programming language; parse the first to-be-detected field in the folder or the subfolder based on the target programming language; and detect whether the parsing process of the first to-be-detected field is abnormal; if not, determine the parsed first to-be-detected field as the second to-be-detected field; a third traversal module, configured to traverse the second field to be detected based on a third traversal rule, filter out a third field to be detected belonging to a target node operation from the second field to be detected, and obtain parsed information of the second field to be detected; detect whether a target node exists in the parsed information, and if so, determine a field in the second field to be detected that is related to the target node as the third field to be detected; The fourth traversal module is used to traverse the third field to be detected based on the target function. If the third field to be detected includes the target field, there is a target index created in an online creation manner in the target database.
5. The index creation mode detection device according to claim 4, characterized in that: The first traversal module also includes: A folder traversal submodule is used to traverse the folder where the field to be detected is located, and all subfolders contained in the folder; The target suffix character search module is used to search whether the target suffix character exists in the name of the folder or the subfolder. If so, the field under the folder or subfolder containing the target suffix character is determined as the first field to be detected.
6. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is run on a computer, the computer is caused to perform the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Method, device and equipment for data migration between databases
CN109753493A
Database detection method and device, electronic equipment and computer readable medium
CN113778994A