Method, apparatus, device and storage medium for concurrent read and write of data in a tape library

By adjusting the number of read and write executors of the tape library to perform tasks concurrently, the read and write exceptions and hardware corruption caused by drive exceptions are solved in the prior art, and efficient and reliable read and write of the tape library is achieved.

CN116107507BActive Publication Date: 2025-07-25HANGZHOU HIKVISION SYST TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211743946.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2025-07-25
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

In the prior art, the tape library only involves concurrent write scenarios and does not consider drive exceptions, resulting in read and write exceptions and hardware corruption.

Method used

By obtaining the number of effective drives and actuators of the tape library, adjusting the number of read and write actuators, and performing read and write tasks concurrently, optimizing the read and write process to avoid hardware exceptions.

Benefits of technology

Concurrent read and write of the tape library is realized, reading and writing efficiency is improved, performance degradation and damage caused by drive hardware exceptions, and read and write reliability is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116107507B_ABST
    Figure CN116107507B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of data storage, and discloses a method, device, equipment and storage medium for concurrent reading and writing of data in a tape library. The method includes: when receiving a reading and writing task, obtaining the number of effective drives in the tape library, querying the read actuator list and the write actuator list to obtain the number of effective actuators, adjusting the number of read actuators and the number of write actuators according to the number of effective drives and the number of effective actuators, and concurrently executing the reading and writing tasks based on the read actuators and write actuators after the quantity adjustment; since the present invention concurrently executes the reading and writing tasks based on the read actuators and write actuators after the quantity adjustment, the concurrent reading and writing of the tape library is realized, the reading and writing efficiency of the tape library is improved, and since the present invention adjusts the number of read actuators and the number of write actuators according to the number of effective drives and the number of effective actuators in the tape library, the performance degradation and hardware damage caused by abnormal drive hardware are avoided, and the reading and writing reliability of the tape library is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data storage, and in particular, to a method, device, equipment, and storage medium for concurrent reading and writing of data in a tape library. Background Art

[0002] Currently, when writing to a tape library, write data executors equal in number to the number of tape library drives are usually directly generated, and data is concurrently written to the tape library through the write data executors. However, the prior art only involves the scenario of concurrent writing and does not involve the scenario of concurrent reading and writing. Moreover, since the write data executors equal in number to the number of tape library drives are directly generated in the prior art, the situation of drive exceptions is not considered, resulting in defects such as reading and writing exceptions and hardware damage. Summary of the Invention

[0003] The main objective of the present invention is to provide a method, device, equipment, and storage medium for concurrent reading and writing of data in a tape library, aiming to solve the technical problems in the prior art that the reading and writing of a tape library only involve the scenario of concurrent writing and do not involve the scenario of concurrent reading and writing, and since the write data executors equal in number to the number of tape library drives are directly generated in the prior art, the situation of drive exceptions is not considered, resulting in reading and writing exceptions and hardware damage.

[0004] To achieve the above objective, the present invention provides a method for concurrent reading and writing of data in a tape library, and the method for concurrent reading and writing of data in a tape library includes the following steps:

[0005] Obtain the number of effective drives in the tape library, and query the read executor list and the write executor list to obtain the number of effective executors;

[0006] Adjust the number of read executors and the number of write executors according to the number of effective drives and the number of effective executors;

[0007] Based on the read executors and write executors after the quantity adjustment, concurrently execute read tasks and write tasks.

[0008] In a possible implementation manner of the present application, the step of concurrently executing read tasks and write tasks based on the read executors and write executors after the quantity adjustment includes:

[0009] After the read executors after the quantity adjustment are started, obtain the tape identifier read by the previous read task;

[0010] According to the tape identifier, check whether there is a read task on the tape that is the same as the previous read task, and obtain the optimal read task according to the search result;

[0011] Based on the optimal read task, select a target tape and read the data on the target tape.

[0012] In a possible implementation manner of the present application, before the step of obtaining the number of valid drives in the tape library and querying the read actuator list and the write actuator list to obtain the number of valid actuators, the following steps are further included:

[0013] When a read task is received, obtain the tape identifier where the data corresponding to the read task is located;

[0014] Allocate the read task to the corresponding tape according to the tape identifier.

[0015] In a possible implementation manner of the present application, the step of selecting a target tape based on the optimal read task and reading the data on the target tape includes:

[0016] Select a target tape based on the optimal read task, compare the target tape with the tape read in the previous read task, and determine whether a tape change is required according to the comparison result;

[0017] If so, remove the tape in the drive, and schedule the drive in the unloaded tape state to load the target tape and read the data on the target tape.

[0018] In a possible implementation manner of the present application, the step of concurrently executing read tasks and write tasks based on the read actuators and write actuators after quantity adjustment includes:

[0019] After the write actuators after quantity adjustment are started, obtain the write tasks waiting to be executed;

[0020] Obtain the tape information of the tape used in the previous write task, and determine the idle tape according to the tape information;

[0021] Write the source data of the write task into the idle tape.

[0022] In a possible implementation manner of the present application, the step of obtaining the tape information of the tape used in the previous write task and determining the idle tape according to the tape information includes:

[0023] Obtain the tape information of the tape used in the previous write task;

[0024] Query whether the tape status of the tape used in the previous write task is normal according to the tape information;

[0025] Judge whether the remaining capacity of the tape used in the previous write task meets the write task according to the tape information;

[0026] Determine the idle tape according to the query result and the judgment result.

[0027] In a possible implementation manner of the present application, the method further includes:

[0028] After the read actuator and / or write actuator after quantity adjustment is started, detect whether there is a deletion mark on the read actuator and / or the write actuator;

[0029] If so, release the resources corresponding to the read actuator and / or the write actuator.

[0030] In addition, to achieve the above object, the present invention also provides a tape library concurrent read and write data device, and the tape library concurrent read and write data device includes: an acquisition module, an adjustment module, and an execution module;

[0031] The acquisition module is used to acquire the number of effective drives of the tape library, and query the read actuator list and the write actuator list to obtain the number of effective actuators;

[0032] The adjustment module is used to adjust the number of read actuators and the number of write actuators according to the number of effective drives and the number of effective actuators;

[0033] The execution module is used to concurrently execute read tasks and write tasks based on the read actuator and the write actuator after quantity adjustment.

[0034] In addition, to achieve the above object, the present invention also provides a tape library concurrent read and write data device, and the tape library concurrent read and write data device includes a memory, a processor, and a tape library concurrent read and write data program stored on the memory and executable on the processor, and the tape library concurrent read and write data program is configured to implement the tape library concurrent read and write data method as described above.

[0035] In addition, to achieve the above object, the present invention also provides a storage medium, and a tape library concurrent read and write data program is stored on the storage medium, and when the tape library concurrent read and write data program is executed by a processor, the tape library concurrent read and write data method as described above is implemented.

[0036] In the present invention, when a read / write task is received, the number of effective drives of the tape library is acquired, the read actuator list and the write actuator list are queried to obtain the number of effective actuators, the number of read actuators and the number of write actuators are adjusted according to the number of effective drives and the number of effective actuators, and read / write tasks are concurrently executed based on the read actuator and the write actuator after quantity adjustment; since the present invention concurrently executes read / write tasks based on the read actuator and the write actuator after quantity adjustment, the concurrent read and write of the tape library is realized, the read / write efficiency of the tape library is improved, and since the present invention adjusts the number of read actuators and the number of write actuators according to the number of effective drives and the number of effective actuators of the tape library, the performance degradation and hardware damage caused by drive hardware anomalies are avoided, and the read / write reliability of the tape library is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a schematic structural diagram of a tape library concurrent read / write data device in the hardware operating environment involved in the embodiment solution of the present invention;

[0038] Figure 2 It is a schematic flowchart of the first embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0039] Figure 3 It is a flowchart for installing a tape library in an embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0040] Figure 4 It is a structural diagram of a tape library directory tree in an embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0041] Figure 5 It is a flowchart for task scheduling and execution in an embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0042] Figure 6 It is a schematic flowchart of the second embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0043] Figure 7 It is a flowchart for the read executor to execute in an embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0044] Figure 8 It is a schematic flowchart of the second embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0045] Figure 9 It is a flowchart for the write executor to execute in an embodiment of the method for the tape library to concurrently read and write data of the present invention;

[0046] Figure 10 It is a structural block diagram of the first embodiment of the device for the tape library to concurrently read and write data of the present invention.

[0047] The realization, functional characteristics and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Detailed implementation manners

[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0049] Refer to Figure 1 , Figure 1 It is a schematic structural diagram of a tape library concurrent read / write data device in the hardware operating environment involved in the embodiment solution of the present invention.

[0050] Such as Figure 1As shown in the figure, the tape library concurrent read and write data device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. For the wired interface of the user interface 1003, it may be a USB interface in the present invention. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be a high-speed Random Access Memory (RAM) or a stable memory (Non-volatile Memory, NVM), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0051] Those skilled in the art can understand that Figure 1 the structure shown in does not constitute a limitation on the tape library concurrent read and write data device, and may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.

[0052] Such as Figure 1 As shown, the memory 1005 regarded as a computer storage medium may include an operating system, a network communication module, a user interface module, and a tape library concurrent read and write data program.

[0053] In Figure 1 the tape library concurrent read and write data device shown, the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server; the user interface 1003 is mainly used to connect to the user device; the tape library concurrent read and write data device calls the tape library concurrent read and write data program stored in the memory 1005 through the processor 1001 and executes the tape library concurrent read and write data method provided by the embodiments of the present invention.

[0054] Based on the above hardware structure, an embodiment of the tape library concurrent read and write data method of the present invention is proposed.

[0055] Referring to Figure 2 , Figure 2 which is a schematic flowchart of the first embodiment of the tape library concurrent read and write data method of the present invention, the first embodiment of the tape library concurrent read and write data method of the present invention is proposed.

[0056] In the first embodiment, the method for concurrent reading and writing of data in the tape library includes the following steps:

[0057] Step S10: Obtain the number of valid drives in the tape library, and query the read executor list and the write executor list to obtain the number of valid executors.

[0058] It should be understood that a tape library is a large-scale tape reading and writing device. Due to the high reliability, low error rate of the tape, and built-in dynamic encryption, combined with the material characteristics of the medium itself, it has very high security; moreover, the tape has a low cost and a large capacity, so currently the tape library device is quite favored for long-term data storage in the market.

[0059] Currently, when writing to a tape library, write data executors equal in number to the number of tape library drives are directly generated, and the data is concurrently written to the tape library through the write data executors. However, the prior art only involves the scenario of concurrent writing and does not involve the scenario of concurrent reading and writing. And since the write data executors equal in number to the number of tape library drives are directly generated in the prior art, the situation of drive anomalies is not considered, resulting in defects such as abnormal reading and writing and hardware damage.

[0060] Therefore, in order to overcome the above defects, in this embodiment, the read and write tasks are concurrently executed based on the read executors and write executors after quantity adjustment, thereby realizing the concurrent reading and writing of the tape library, improving the reading and writing efficiency of the tape library. And since in this embodiment, the number of read executors and write executors is also adjusted according to the number of valid drives and the number of valid executors in the tape library, the performance degradation and hardware damage caused by drive hardware anomalies are avoided, and the reading and writing reliability of the tape library is improved.

[0061] It can be understood that the execution subject of the method in this embodiment can be a tape library concurrent reading and writing data device with data processing, network communication, and program running functions, such as the control device of the tape library, or other electronic devices that can implement the same or similar functions. This embodiment does not limit this.

[0062] It should be noted that a tape library can be a large-scale tape reading and writing device, which can be composed of multiple drives, multiple tape slots, and a robotic arm. Among them, the drive can be a device component for reading and writing tapes, and the robotic arm can move to the position where the tape is located in the tape library, thereby automatically realizing the disassembly and loading of the tape.

[0063] It should be understood that before step S10, a read task and / or a write task can be received first. The read task and / or the write task can be issued by the user or by a device with reading and writing requirements. This embodiment does not limit this.

[0064] It is understandable that when issuing tasks, the task priority can be specified to avoid the priority inversion problem caused by high-priority tasks having to wait for the completion of low-priority tasks received earlier before being scheduled.

[0065] In specific implementation, for example, when a write task is received, first judge the task priority. Tasks with higher priority are inserted before tasks with lower priority. Tasks with the same priority are executed in the order of reception, first come, first served. Among them, the tape library should avoid random writing because it will cause frequent tape changes and rewind, resulting in a decline in read and write performance. Therefore, for write tasks, sequential writing can be adopted. Only when the tape space is insufficient, switch to an empty tape to continue executing the write task.

[0066] It should be noted that tape change can be that during data reading and writing, the robotic arm grabs the specified tape in the tape library and moves it to the slot to facilitate subsequent loading by the drive; if the drive has already loaded a tape, first the old tape needs to be removed, and then the new tape is moved to the specified position. This is a process of mechanical equipment operation and takes a relatively long time, generally 1 to 3 minutes.

[0067] Rewind can be that after the tape is loaded, when accessing the tape, like a tape recorder, the magnetic head is fixed and the tape moves linearly through the magnetic head. Therefore, it takes some time for the magnetic head to locate when reading and writing a specified position. This is a mechanical process.

[0068] It is understandable that the tape library resources can be initialized before receiving read tasks and / or write tasks to facilitate subsequent reading of tape library information.

[0069] For ease of understanding, refer to Figure 3 and Figure 4 for illustration, but this does not limit the present solution. Figure 3 is the installation flowchart of the tape library, Figure 4 is the structure diagram of the tape library directory tree, Figure 3 In, the process of initializing the tape library resources is as follows:

[0070] (1) Prepare hardware devices: The tape library is directly connected to the server through Gigabit Ethernet or connected to the server through a fiber optic switch. Among them, the hardware is a general server, IBM TS4300 (tape library), and the software is the Linux operating system.

[0071] (2) Install the Linear Tape File System (LTFS) package: Download the LTFS system installation package from the IBM official website and install it. Among them, LTFS allows users to search for information on the tape through a file tree directory, and the process of searching the tape is the same as that of disk storage.

[0072] (3) Mounting Directory: By using the LTFS mounting instruction, mount the tape library device to the specified directory. Entering the mounting directory, you can view all the tape lists. Each tape has a directory (the directory name is the same as the unique ID of the tape), forming a tape library directory tree, as Figure 4 shown.

[0073] Note: When the tape library leaves the factory, multiple barcodes will be provided, and the tape library manufacturer guarantees the uniqueness of the barcodes. Before using the tape library, you need to stick the barcodes on the tapes. In this way, the tape library will recognize the barcodes and use them as the unique IDs of the tapes.

[0074] (4) Reading Tape Library Information: You can use the LTFS query instruction to obtain the tape list information and the tape library drive list information. The application can record the ID list of the tapes and the status of each tape; it can also obtain the status of all the drives. In the specific implementation, through interfaces such as open, write, read, and close in the Portable Operating System Interface (POSIX), by specifying the path as "<mounting directory> / <tape ID> / <file name>", create and read / write files under the tape directory. Among them, POSIX is the general term for a series of interrelated standards defined by IEEE for running software on various UNIX operating systems. It includes file operation interfaces such as open, write, read, and close.

[0075] It should be understood that obtaining the number of effective drives in the tape library can be to query the tape library drive list, check the status of each drive according to the tape library drive list, and for the drives in an abnormal state, try to repair them through the LTFS instruction, and finally count the number of effective drives in the tape library. Among them, the effective drive can be a drive in an available state.

[0076] It should be noted that each actuator has a background thread for reading or writing data. When receiving a read / write task, the read / write task is executed by the read actuator list and / or the write actuator.

[0077] It can be understood that querying the read actuator list and the write actuator list and obtaining the number of effective actuators can be to query the read actuator list and the write actuator list, check the status of each read actuator and each write actuator according to the read actuator list and the write actuator list respectively, and count the number of effective actuators according to the inspection results. Among them, the number of effective actuators can be the sum of the number of effective read actuators and the number of effective write actuators.

[0078] Step S20: Adjust the number of read actuators and the number of write actuators according to the number of effective drives and the number of effective actuators.

[0079] It should be understood that adjusting the number of read actuators and write actuators according to the number of valid drivers and the number of valid actuators can be to compare the number of valid drivers with the number of valid actuators. When the number of valid drivers is equal to the number of valid actuators, the number of read actuators and write actuators is not adjusted;

[0080] When the number of valid drivers is less than the number of valid actuators, compare the number of read tasks and write tasks waiting to be executed. When the number of read tasks is less than the number of write tasks, mark the read actuators to be deleted until the number of unmarked read actuators is the same as the number of write actuators, and the sum of the two is less than or equal to the number of valid drivers; when the number of read tasks is equal to the number of write tasks, mark the read actuators and write actuators to be deleted simultaneously until the number of unmarked read actuators is the same as the number of write actuators, and the sum of the two is less than or equal to the number of valid drivers; when the number of read tasks is greater than the number of write tasks, mark the write actuators to be deleted until the number of unmarked read actuators is the same as the number of write actuators, and the sum of the two is less than or equal to the number of valid drivers. Among them, when an actuator detects a deletion mark, the actuator determines that there is no task being executed currently. Therefore, the resources can be directly released.

[0081] When the number of valid drivers is greater than the number of valid actuators and the number of valid actuators is 0, generate the same number of read actuators and write actuators simultaneously;

[0082] When the number of valid drivers is greater than the number of valid actuators and the number of valid actuators is greater than 0, compare the number of read tasks and write tasks waiting to be executed. When the number of read tasks is less than the number of write tasks, generate read actuators until the number of read actuators is the same as the number of write actuators, and the sum of the two is less than or equal to the number of valid drivers; when the number of read tasks is equal to the number of write tasks, generate read actuators and write actuators simultaneously until the number of read actuators is the same as the number of write actuators, and the sum of the two is less than or equal to the number of valid drivers; when the number of read tasks is greater than the number of write tasks, generate write actuators until the number of unread actuators is the same as the number of write actuators, and the sum of the two is less than or equal to the number of valid drivers.

[0083] For the sake of easy understanding, reference is made to Figure 5 for illustration, but it does not limit this solution. Figure 5 is the execution flow chart of task scheduling. In the figure, start the task scheduler, and the task scheduler starts a background thread. The execution process is as follows:

[0084] (1) Query the tape library drive list, check the status of each drive according to the tape library drive list. For the drives in an abnormal state, try to repair them through LTFS instructions, and finally count the number of valid drives in the tape library. Among them, the valid drives can be the drives in an available state.

[0085] (2) Query the read executor table and the write executor list, obtain the number of valid read executors and the number of valid write executors, determine the number of valid executors according to the number of valid read executors and the number of valid write executors, and compare the number of valid executors with the number of valid drivers calculated in (1).

[0086] (3) When the number of valid drivers is equal to the number of valid executors, no processing is performed.

[0087] (4) When the number of valid drivers is less than the number of valid executors, compare the number of read tasks and write tasks waiting to be executed. When the number of read tasks is less than the number of write tasks, mark to delete one read executor; otherwise, mark to delete one write executor. When an executor detects the deletion mark, the executor determines that there is no task being executed currently, so the resources can be directly released.

[0088] (5) When the number of valid drivers is greater than the number of valid executors and the number of valid executors is 0, generate an equal number of read executors and write executors.

[0089] (6) When the number of valid drivers is greater than the number of valid executors and the number of valid executors is greater than 0, compare the number of read tasks and write tasks waiting to be executed. When the number of read tasks is less than the number of write tasks, add a new write task executor; otherwise, add a new read executor.

[0090] After the task scheduler performs multiple schedules, the number of read executors and the number of write executors can meet the actual execution requirements.

[0091] Step S30: Based on the read executors and write executors after quantity adjustment, concurrently execute read tasks and write tasks.

[0092] It can be understood that after the adjustment of the number of read executors and the number of write executors is completed, the read tasks and write tasks can be concurrently executed based on the read executors and write executors after quantity adjustment, thereby realizing the dynamic adjustment of the number of executors, adapting to hardware device exceptions, and further reducing hardware losses, preventing multi-task competition for tape resources and causing further degradation of system performance, and reducing operation and maintenance costs.

[0093] Furthermore, in order to delete the executors without tasks being executed currently and release the resources corresponding to the executors, the method further includes:

[0094] After the read executors and / or write executors after quantity adjustment are started, detect whether there is a deletion mark on the read executors and / or the write executors;

[0095] If so, release the resources corresponding to the read executors and / or the write executors.

[0096] It should be understood that in order to delete the executor that is not currently executing a task and release the resources corresponding to the executor. In this embodiment, after the read executor and / or write executor after the quantity adjustment is started, it is detected whether there is a deletion mark on the read executor and / or write executor. If so, the resources corresponding to the read executor and / or write executor are released.

[0097] In the first embodiment, when a read / write task is received, the number of available drives in the tape library is obtained, the read executor list and the write executor list are queried to obtain the number of available executors, the number of read executors and write executors is adjusted according to the number of available drives and the number of available executors, and the read / write task is concurrently executed based on the read executor and write executor after the quantity adjustment; since this embodiment concurrently executes the read / write task based on the read executor and write executor after the quantity adjustment, the concurrent read / write of the tape library is realized, the read / write efficiency of the tape library is improved, and since this embodiment adjusts the number of read executors and write executors according to the number of available drives and the number of available executors in the tape library, the performance degradation and hardware damage caused by abnormal drive hardware are avoided, and the read / write reliability of the tape library is improved.

[0098] Refer to Figure 6 , Figure 6 is a schematic flowchart of the second embodiment of the method for concurrent read / write of data in the tape library of the present invention. Based on the first embodiment shown above Figure 2 a second embodiment of the method for concurrent read / write of data in the tape library of the present invention is proposed.

[0099] In the second embodiment, before the step S10, it further includes:

[0100] Step S01: When a read task is received, obtain the tape identifier where the data corresponding to the read task is located.

[0101] It should be understood that in order to classify the read tasks according to the tape identifier, reduce the occurrence of tape swapping, and improve the overall efficiency of the system. In this embodiment, when a read task is received, the tape identifier where the data corresponding to the read task is located is further obtained, and the read task is assigned to the corresponding tape according to the tape identifier.

[0102] It should be noted that the tape identifier can be used to represent the directory where the data is located. For example, the tape identifier can be the tape id.

[0103] Step S02: Assign the read task to the corresponding tape according to the tape identifier.

[0104] In a specific implementation, for example, when a read task is received, the read tasks are classified according to the tape ID where the data is located. For tasks with the same tape ID, the task priorities are first judged. The task with a higher priority is inserted before the task with a lower priority. For tasks with the same priority, they are executed in the order of reception, first come, first served, so as to accurately read the data through the path.

[0105] In the second embodiment, when a read task is received, the tape identifier where the data corresponding to the read task is located is obtained, and the read task is assigned to the corresponding tape according to the tape identifier, so that the read tasks can be classified according to the tape identifier, the occurrence of tape change can be reduced, and the overall efficiency of the system can be improved.

[0106] In the second embodiment, the method further includes:

[0107] Step S301: After the read actuator with adjusted quantity is started, obtain the tape identifier read by the previous read task.

[0108] It should be understood that in the prior art, for the tape reading operation, only the file path "<mounting directory> / <tape id> / file name" needs to be constructed, and the POSIX open interface is directly used to open the file. The tape library will schedule a suitable drive to perform the tape change operation internally.

[0109] Since the application layer cannot specify which drive the tape change operation inside the tape library occurs on; when the read task executor wants to change the tape, if the write executor is not in the state of writing data, there is a high probability that the tape change operation will occur on the tape that the write executor will use. When the write executor gets the task and continues to execute, it needs to load the previously used tape again, which will cause an additional tape change operation and also an additional rewind operation to the specified position. For multiple read executors and multiple write executors in concurrency, it may also trigger multiple tape change behaviors, and the entire process will at least cause long-term blockage of the read and write services.

[0110] Therefore, in order to overcome the above defects, in this embodiment, after the read actuator with adjusted quantity is started, it is checked whether there is a read task on the same tape as the previous read task according to the tape identifier read by the previous read task. The optimal read task is obtained according to the search result, and the data on the target tape is read according to the optimal read task.

[0111] Step S302: Check whether there is a read task on the same tape as the previous read task according to the tape identifier, and obtain the optimal read task according to the search result.

[0112] It can be understood that obtaining the optimal read task according to the search result can be taking the read task as the optimal read task when there is a read task on the same tape as the previous read task; when there is no read task on the same tape as the previous read task, check for read tasks on other tapes.

[0113] Step S303: Select a target tape based on the optimal read task, and read the data on the target tape.

[0114] It should be understood that selecting a target tape based on the optimal read task and reading the data on the target tape can be to select a target tape based on the optimal read task, compare the target tape with the tape read in the previous read task, and determine whether to change the tape according to the comparison result; if so, remove the tape in the drive, and schedule the drive in the unloaded tape state to load the target tape and read the data on the target tape.

[0115] For ease of understanding, reference is made to Figure 7 for illustration, but this solution is not limited. Figure 7 It is a flowchart for the read actuator to execute. In the figure, the read actuator starts a background thread, and the processing flow is as follows:

[0116] (1) Detect whether there is a deletion mark. If so, release resources and exit the execution.

[0117] (2) Select a read task from the task management. The selection strategy is to record the tape id read in the previous read task and find tasks on the same tape. If no task is found, find read tasks on other tapes.

[0118] (3) Compare the tape that the read task needs to read with the tape read in the previous task, and determine whether to change the tape.

[0119] (4) If a tape change is required, first use the move instruction provided by LTFS to remove the old tape. Since in this solution, when a tape change is required for a read task, the old tape is first removed using the move instruction provided by LTFS. At this time, the drive will be in the idle unloaded tape state. When opening the file on the new tape again, the internal scheduling algorithm of the tape library will preferentially schedule the drive in the unloaded tape state, which will not affect the tape to be used by the write actuator, thus avoiding switching the tape to be used by the write actuator when the read actuator changes the tape, and at least avoiding one tape change and rewind operation, and avoiding long-term business blocking.

[0120] (5) Open the data file and read the data on the tape.

[0121] In the second embodiment, after the read actuator with adjusted quantity is started, whether there is a read task on the same tape as the previous read task is found according to the tape identifier read in the previous read task. The optimal read task is obtained according to the search result, and the data on the target tape is read according to the optimal read task, so that the execution process of the read task can be optimized, the tape changing and rewind operations of the tape library can be reduced, and thus the efficient execution of the write task can be ensured, the task execution efficiency can be improved, and the overall throughput of the system can be increased.

[0122] Referring to Figure 8 , Figure 8 FIG. is a schematic flowchart of the third embodiment of the method for concurrent reading and writing of data in a tape library according to the present invention. Based on the above Figure 2 shown in the first embodiment, the third embodiment of the method for concurrent reading and writing of data in a tape library according to the present invention is proposed.

[0123] In the third embodiment, the method further includes:

[0124] Step S301': After the write actuator with adjusted quantity is started, obtain the write tasks waiting to be executed.

[0125] It should be understood that, in order to minimize the probability of tape changing and rewind and maintain the efficient and stable execution of the write task, in this embodiment, after the write actuator with adjusted quantity is started, the idle tape is determined according to the tape information of the tape used in the previous write task, and the source data of the write task is written to the idle tape.

[0126] Step S302': Obtain the tape information of the tape used in the previous write task, and determine the idle tape according to the tape information.

[0127] It should be noted that the tape information may include information such as tape status and remaining tape capacity.

[0128] It can be understood that determining the idle tape according to the tape information may be to judge whether the remaining tape capacity of the tape used in the previous write task meets the space required for the write task according to the tape information. When the remaining tape capacity meets the required space, the tape used in the previous write task is used as the idle tape; when the remaining tape capacity does not meet the required space, check whether other tapes are idle tapes.

[0129] Further, in order to improve the reliability of the idle tape, in this embodiment, the idle tape is determined jointly from the dimensions of tape status and remaining tape capacity. The step S302' includes:

[0130] Obtain the tape information of the tape used in the previous write task;

[0131] Query whether the tape status of the tape used in the previous write task is normal according to the tape information;

[0132] Determine whether the remaining capacity of the tape used in the previous write task meets the write task according to the tape information;

[0133] Determine the idle tape according to the query result and the judgment result.

[0134] Step S303': Write the source data of the write task to the idle tape.

[0135] For ease of understanding, reference is made to Figure 9 for illustration, but this does not limit the present solution. Figure 9 FIG. is a flowchart for the write executor to execute. In the figure, the write executor starts a background thread, and the execution process is as follows:

[0136] (1) Detect whether there is a deletion mark. If so, release the resources and exit the execution.

[0137] (2) Obtain a write task waiting to be executed from the task management module.

[0138] (3) First, obtain the id of the tape used last time, query whether the tape status is normal, and whether the remaining capacity meets the space required by the task.

[0139] (4) If the tape is abnormal or the remaining capacity of the tape does not meet the task requirements, obtain the next idle tape.

[0140] Note: Obtaining the next idle tape here means checking the tapes without written data in the tape list, constructing the file path "<mounting directory> / <tape id> / <file name>" through the tape id, directly opening the file through the posix interface, and the tape library will automatically perform a tape change operation internally.

[0141] (5) Receive the source data and write it to the tape.

[0142] (6) Store the data metadata, including the tape id where the data is stored, the data file name, the size of the data, etc.

[0143] In the third embodiment, after the write executor with adjusted quantity is started, the idle tape is determined according to the tape information of the tape used in the previous write task, and the source data of the write task is written to the idle tape, so as to minimize the probability of tape change and rewind, and keep the write task running efficiently and stably.

[0144] In addition, an embodiment of the present invention also proposes a storage medium, on which a tape library concurrent read and write data program is stored. When the tape library concurrent read and write data program is executed by a processor, the tape library concurrent read and write data method as described above is implemented.

[0145] In addition, referring to Figure 9, an embodiment of the present invention also provides a tape library concurrent read and write data device, and the tape library concurrent read and write data device includes: an acquisition module 10, an adjustment module 20, and an execution module 30;

[0146] The acquisition module 10 is configured to acquire the number of effective drives of the tape library, and query the read actuator list and the write actuator list to obtain the number of effective actuators;

[0147] The adjustment module 20 is configured to adjust the number of read actuators and the number of write actuators according to the number of effective drives and the number of effective actuators;

[0148] The execution module 30 is configured to concurrently execute read tasks and write tasks based on the read actuators and write actuators after the quantity adjustment.

[0149] In this embodiment, when a read / write task is received, the number of effective drives of the tape library is acquired, the read actuator list and the write actuator list are queried to obtain the number of effective actuators, the number of read actuators and the number of write actuators are adjusted according to the number of effective drives and the number of effective actuators, and the read and write tasks are concurrently executed based on the read actuators and write actuators after the quantity adjustment; since the read and write tasks are concurrently executed based on the read actuators and write actuators after the quantity adjustment in this embodiment, the concurrent read and write of the tape library is realized, the read and write efficiency of the tape library is improved, and since the number of read actuators and the number of write actuators are adjusted according to the number of effective drives and the number of effective actuators of the tape library in this embodiment, the performance degradation and hardware damage caused by abnormal drive hardware are avoided, and the read and write reliability of the tape library is improved.

[0150] For other embodiments or specific implementation manners of the tape library concurrent read and write data device of the present invention, reference may be made to the above method embodiments, and details are not described herein again.

[0151] It should be noted that, in this article, the terms "include", "comprise" or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or system including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or system. Without further limitation, an element defined by the phrase "including a..." does not exclude the existence of additional identical elements in the process, method, article or system including the element.

[0152] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0153] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as a Read Only Memory image (ROM) / Random Access Memory (RAM), magnetic disk, optical disk), and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present invention.

[0154] The above are only the preferred embodiments of the present invention, and do not limit the protection scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the protection scope of the present invention.

Claims

1. A method for concurrent reading and writing of data in a tape library, characterized in that, The method for concurrent reading and writing of data in the tape library includes the following steps: Obtain the number of valid drives in the tape library, query the read actuator list and the write actuator list, and obtain the number of valid actuators; Adjust the number of read actuators and the number of write actuators according to the number of valid drives and the number of valid actuators; Based on the read actuators and write actuators after the quantity adjustment, concurrently execute read tasks and write tasks.

2. The method for concurrent read and write of data in a tape library according to claim 1, characterized in that, The step of concurrently executing read tasks and write tasks based on the read actuators and write actuators after the quantity adjustment includes: After the read actuators after the quantity adjustment are started, obtain the tape identifier read by the previous read task; According to the tape identifier, check whether there is a read task on the same tape as the previous read task, and obtain the optimal read task according to the search result; Based on the optimal read task, select a target tape and read the data on the target tape.

3. The method for concurrent reading and writing of data in a tape library according to claim 2, wherein, Before the step of obtaining the number of valid drives in the tape library, querying the read actuator list and the write actuator list, and obtaining the number of valid actuators, it further includes: When a read task is received, obtain the tape identifier where the data corresponding to the read task is located; Allocate the read task to the corresponding tape according to the tape identifier.

4. The method for concurrent read and write of data in a tape library according to claim 2, characterized in that, The step of selecting a target tape based on the optimal read task and reading the data on the target tape includes: Select a target tape based on the optimal read task, compare the target tape with the tape read by the previous read task, and judge whether tape changing is required according to the comparison result; If so, remove the tape in the drive, and schedule the drive in the unloaded tape state to load the target tape, and read the data on the target tape.

5. The method for concurrent read and write of data in a tape library according to claim 1, wherein The step of concurrently executing read tasks and write tasks based on the read actuators and write actuators after the quantity adjustment includes: After the write actuators after the quantity adjustment are started, obtain the write tasks waiting to be executed; Obtain the tape information of the tape used by the previous write task, and determine the idle tape according to the tape information; Write the source data of the write task to the idle tape.

6. The method for concurrent read and write of data in a tape library according to claim 5, wherein, The step of obtaining the tape information of the tape used by the previous write task and determining the idle tape according to the tape information includes: Obtain the tape information of the tape used by the previous write task; According to the tape information, query whether the tape status of the tape used by the previous write task is normal; According to the tape information, judge whether the remaining capacity of the tape used by the previous write task meets the write task; Determine the idle tape according to the query result and the judgment result.

7. The method for concurrent reading and writing of data in a tape library according to any one of claims 1 to 6, characterized in that, The method further includes: After the read actuators and / or write actuators after the quantity adjustment are started, detect whether there is a deletion mark on the read actuators and / or the write actuators; If so, release the resources corresponding to the read actuators and / or the write actuators.

8. A tape library concurrent read and write data device, characterized in that, The device for concurrent reading and writing of data in the tape library includes: an acquisition module, an adjustment module, and an execution module; The acquisition module is used to obtain the number of valid drives in the tape library, query the read actuator list and the write actuator list, and obtain the number of valid actuators; The adjustment module is used to adjust the number of read actuators and the number of write actuators according to the number of valid drives and the number of valid actuators; The execution module is configured to concurrently execute read tasks and write tasks based on the read actuators and write actuators after quantity adjustment.

9. A tape library concurrent read and write data device, characterized in that, The tape library concurrent read and write data device includes: a memory, a processor, and a tape library concurrent read and write data program stored on the memory and executable on the processor. When the tape library concurrent read and write data program is executed by the processor, it implements the tape library concurrent read and write data method according to any one of claims 1 to 7.

10. A storage medium, characterized in that, A tape library concurrent read and write data program is stored on the storage medium. When the tape library concurrent read and write data program is executed by a processor, it implements the tape library concurrent read and write data method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Backup method supporting multi-driver concurrent writing of tape library

    CN108170377A

  • Task execution method and device, computer readable storage medium and electronic equipment

    CN113806034A