CN111831206A - Storage space switching method and back-end monitoring system - Google Patents

Storage space switching method and back-end monitoring system Download PDF

Info

Publication number
CN111831206A
CN111831206A CN201910301232.3A CN201910301232A CN111831206A CN 111831206 A CN111831206 A CN 111831206A CN 201910301232 A CN201910301232 A CN 201910301232A CN 111831206 A CN111831206 A CN 111831206A
Authority
CN
China
Prior art keywords
space
index information
state
linked list
updating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910301232.3A
Other languages
Chinese (zh)
Other versions
CN111831206B (en
Inventor
沈佐兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201910301232.3A priority Critical patent/CN111831206B/en
Publication of CN111831206A publication Critical patent/CN111831206A/en
Application granted granted Critical
Publication of CN111831206B publication Critical patent/CN111831206B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Closed-Circuit Television Systems (AREA)

Abstract

The embodiment of the application provides a storage space switching method and a rear-end monitoring system, in order to realize asynchronous updating of primary index information and secondary index information of a storage space and reduce time consumption of a storage space switching process, when it is monitored that the storage space corresponding to any front-end computer needs to be switched, the storage space is recorded as a delay closing space in a preset global linked list, and the delay closing space is recorded as a state to be closed in the global linked list; distributing a new storage space for the front-end computer, and updating the primary index information and the secondary index information of the new storage space; updating secondary index information of a delayed closing space in a global linked list, wherein the delayed closing space is in a state to be closed, and updating the state of the secondary index information into a closing state; and updating the delayed closing space in the closing state in the global linked list, closing the delayed closing space, and updating the state of the delayed closing space to be the closed state in the global linked list.

Description

Storage space switching method and back-end monitoring system
Technical Field
The application relates to the technical field of video monitoring, in particular to a storage space switching method and a rear-end monitoring system.
Background
In order to improve management efficiency, space utilization rate and the like, the size of the storage space allocated by the back-end monitoring system for the front-end terminal is usually fixed, such as 256MB or 1GB, and therefore, one storage space can only be used for the front-end terminal to perform data storage for a period of time. For example, when data written to its storage space B by one front-end camera a reaches a fixed size (e.g., close to the capacity of the storage space B), the storage space B will not be available for the front-end camera a to continue storing data. At this time, the storage location of the monitoring data of the front camera needs to be switched from the storage space B to another new storage space.
In the related art, the switching process of the storage space of the front-end camera is a serial process, and taking the front-end camera a as an example, the storage space B needs to be closed first, and then a new storage space C is applied as the storage location of the front-end camera a. The index information of the code stream data stored in the storage space B needs to be updated before the storage space B is closed, the index information of the storage space B needs to be updated after the storage space B is closed, and after the storage space C is applied, the index information of the storage space C needs to be updated and the index information of the code stream data in the storage space C needs to be initialized.
It can be seen that the above switching process involves updating the index information many times, which results in a long time-consuming switching process. Before the storage space of the new application can be used, the code stream data monitored by the front-end computer can only be stored in the buffer area allocated to the front-end computer by the back-end monitoring system, however, the size of the buffer area is limited, and the situation of data overflow may occur, resulting in the loss of the code stream data.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method and an apparatus for switching storage space, so as to at least partially improve the above problem.
In order to achieve the above purpose, the embodiment of the present application adopts the following technical solutions:
in a first aspect, an embodiment of the present application provides a storage space switching method, which is applied to a back-end monitoring system communicatively connected to at least one front-end computer, where the method includes:
when it is monitored that the storage space distributed by the rear-end monitoring system for any front-end computer needs to be switched, recording the storage space as a delay closing space into a preset global linked list, and recording the state of the delay closing space in the global linked list as a state to be closed;
distributing a new storage space for the front-end computer, and updating primary index information and secondary index information of the new storage space;
updating the secondary index information of the delayed closing space in the state to be closed, which is recorded by the global linked list, and updating the state of the delayed closing space in which the secondary index information is updated into a closing state in the global linked list;
updating the first-level index information of the delayed closing space in the closing state recorded by the global linked list, closing the delayed closing space in which the first-level index information is updated, and updating the state of the delayed closing space in which the first-level index information is updated to be in a closed state in the global linked list.
In a second aspect, an embodiment of the present application provides a back-end monitoring system, where the back-end monitoring system includes:
the management thread is used for recording the storage space serving as a delay closing space into a preset global linked list when the situation that the storage space distributed to any front-end computer by the rear-end monitoring system needs to be switched is monitored, and recording the state of the delay closing space into a state to be closed in the global linked list;
the storage module is used for distributing a new storage space for the front-end computer and updating the primary index information and the secondary index information of the new storage space;
the management thread is further configured to:
updating the secondary index information of the delayed closing space in the state to be closed, which is recorded by the global linked list, and updating the state of the delayed closing space in which the secondary index information is updated into a closing state in the global linked list;
updating the first-level index information of the delayed closing space in the closing state recorded by the global linked list, closing the delayed closing space in which the first-level index information is updated, and updating the state of the delayed closing space in which the first-level index information is updated to be in a closed state in the global linked list.
According to the storage space switching method and the rear-end monitoring system provided by the embodiment of the application, when it is monitored that the storage space distributed by the rear-end monitoring system for any front-end computer needs to be switched, the storage space is recorded as a delay closing space in a preset global linked list, and the delay closing space is recorded as a state to be closed in the global linked list; distributing a new storage space for the front-end computer, and updating the primary index information and the secondary index information of the new storage space; updating secondary index information of a delayed closing space in a global linked list, wherein the delayed closing space is in a state to be closed, and updating the state of the secondary index information to be in a closing state; and updating the delayed closing space in the closing state in the global linked list, closing the delayed closing, and updating the state of the delayed closing space in the global linked list to be the closed state. Therefore, asynchronous updating of the first-level index information and the second-level index information of the storage space is achieved, time consumption of the storage space switching process is reduced, and data loss caused by overlong time consumption of the storage space switching process can be avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is an interaction diagram of a back-end monitoring system and a front-end camera according to an embodiment of the present disclosure;
fig. 2 is a functional block diagram of a back-end monitoring system according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a storage space switching method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a sub-step of step 33 shown in FIG. 3;
FIG. 5 is a schematic view of another substep of step 33 of FIG. 3;
FIG. 6 is a schematic diagram of a sub-step of step 34 shown in FIG. 3;
FIG. 7 is a schematic diagram of another substep of step 34 shown in FIG. 3.
Icon: 10-a back-end monitoring system; 11-the front end machine is connected to the flow receiving module; 12-a stream receiving module; 13-a storage module; 14-a management process; 21. 22-front camera.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
Referring to fig. 1, fig. 1 is an interactive schematic diagram of a back-end monitoring system 10 and a front-end camera according to an embodiment of the present disclosure. The back-end monitoring system 10 may be deployed on one server or a plurality of servers communicatively connected to each other, which is not limited in this embodiment. The back-end monitoring system 10 may be communicatively coupled to at least one front-end camera (e.g., the front- end cameras 21 and 22 shown in fig. 1) via a network to enable data interaction.
Referring to fig. 2, fig. 2 is a functional module schematic diagram of a back-end monitoring system 10 according to an embodiment of the present disclosure. The back-end monitoring system 10 may include a front-end machine access management module 11, a stream receiving module 12 (also called "code stream data receiving module"), and a storage module 13.
The front-end camera access management module 11 is configured to monitor whether a front-end camera is accessed, allocate a certain memory space for the accessed front-end camera as a buffer area of the front-end camera when the front-end camera is monitored to be accessed, and apply for a new memory space from the memory module 13. The storage module 13 is configured to manage and organize storage resources (e.g., hard disks, disk arrays, etc.) in the back-end monitoring system 10, and is configured to respond to an application from the front-end computer access management module 11, and allocate a storage space for the accessed front-end computer to store code stream data sent by the accessed front-end computer.
The storage module 13 may organize the storage resources of the back-end monitoring system 10 in a particular manner. In one example, the storage module 13 may use a file system to organize the storage resources of the back-end monitoring system, in which case one storage space allocated to the front-end camera by the storage module 13 may be regarded as one file. In yet another example, the storage module 13 may employ a block-based storage system to organize the storage resources of the back-end monitoring system 10, in which case one storage space allocated to the front-end camera by the storage module 13 may be regarded as one storage block. Of course, the storage module 13 may also use other ways to organize the storage resources, which is not limited in this embodiment.
As described in the background section, when the storage space B of the front-end camera a is switched, at least two updates of the primary index information and at least two updates of the secondary index information are required to be completed, so that the storage location of the code stream data of the front-end camera a can be switched from the storage space B to the new storage space C. Before the switching is completed, the code stream data of the front-end camera a will be continuously written into the buffer, but the buffer has a small capacity, and therefore, data overflow may be caused, and data loss may be caused.
To at least partially improve the above problem, the present embodiment provides a storage space switching method and a back-end monitoring system, which will be described in detail below.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for switching a storage space according to an embodiment of the present application, which can be applied to the back-end monitoring system 10 shown in fig. 2. The individual steps of the method will be explained below.
Step 31, when it is monitored that the storage space allocated to any front-end camera by the rear-end monitoring system 10 needs to be switched, recording the storage space as a delay closing space in a preset global linked list, and recording the state of the delay closing space in the global linked list as a to-be-closed state.
In this embodiment, a global linked list is created in the back-end monitoring system 10 in advance. When monitoring the storage space to be switched, the back-end monitoring system 10 records the identification information of the storage space in the global linked list, and records the state of the storage space as a state to be closed. The identification information may be, but is not limited to, a file name, a file location, and the like. It should be noted that, in this embodiment, the storage spaces indicated by the identification information recorded in the global linked list are all time-delay closed spaces.
In implementation, for each storage space recorded by the global linked list, a state field corresponding to the storage space may be set in the global linked list, and a value of the state field may be used to indicate a state of the storage space. For example, when the value of the status field corresponding to one storage space is 0, it indicates that the storage space is in a state to be closed; when the value of a state field corresponding to one storage space is 1, indicating that the storage space is in a closed state; when the value of the status field corresponding to a memory space is 2, it indicates that the memory space is in a closed state. Of course, the corresponding relationship between the value of the status field and the indicated status may be flexibly adjusted according to the actual situation, which is not limited in this embodiment.
Optionally, in the case that the storage space in this embodiment is a storage block or a file, each storage space may have a corresponding handle, and each module in the back-end monitoring system 10 may perform a read operation or a write operation on the storage space through the handle, for example, the stream receiving module 12 may write code stream data into the storage space through the handle of one storage space.
Based on this, in this embodiment, the handle of the storage space that needs to be switched may be transferred to the global linked list as the identification information. Since the stream receiving module 12 does not typically access the global linked list, the stream receiving module 12 cannot write data to the deferred closed space through its handle.
Optionally, referring to fig. 2 again, the back-end monitoring system 10 may create a management thread 14 to monitor the memory space allocated to each front-end camera by the back-end monitoring system 10, so as to determine that the memory space of any front-end camera needs to be switched when the memory space allocated to the front-end camera is monitored to meet a specific condition. For example, when it is monitored that code stream data stored in a storage space of any front-end camera reaches a preset size, it may be determined that the storage space of the front-end camera needs to be switched.
Taking the front-end camera 21 shown in fig. 1 as an example, assuming that the management thread 14 monitors that the codestream data stored in the storage space S1 of the front-end camera 21 reaches the preset size, it may be determined that the storage space S1 of the front-end camera 21 needs to be switched, that is: it is necessary to close the storage space S1 and apply for a new storage space for the front-end camera 21. Therefore, the identification information S1 of the storage space S1 is recorded into the global linked list, and the value of the state field corresponding to the storage space S1 is set to a value (e.g., 0) indicating the state to be closed.
And step 32, distributing a new storage space for the front-end camera, and updating the primary index information and the secondary index information of the new storage space.
In this embodiment, each storage space may generally have two levels of index information, e.g., may have a first level of index information and a second level of index information. The first-level index information refers to metadata (metadata) for describing attribute information of the storage space, and may include, for example, a name, a size, a location in a storage resource provided by the storage module, and the like of the storage space. The secondary index information refers to metadata for describing code stream data in the storage space, such as an attribute of the code stream data stored in the storage space, a specific location of the code stream data in the storage space, and the like.
In implementation, for the new storage space allocated by the storage module 13, the back-end monitoring system 10 may directly record information such as the start position of the new storage space as a part of the first-level index information of the new storage space; and initializing the type of code stream data required to be stored in the new storage space and the related information of the corresponding front-end camera so as to update the secondary index information of the new storage file.
And step 33, updating the secondary index information of the delayed closing space in the state to be closed, which is recorded by the global linked list, and updating the state of the delayed closing space in which the secondary index information is updated to the closing state in the global linked list.
In this embodiment, the delayed closing space after the second-level index information is updated is the delayed closing space in the closing state.
Optionally, in this embodiment, in step 33, the step of updating the secondary index information of the delayed closing space in the state to be closed, which is recorded in the global linked list, may be implemented by the steps shown in fig. 4.
Step 41, monitoring the writing time for writing the code stream data sent by the front-end camera from the stream receiving module 12 into the storage module 13 each time, and counting the number of times that the writing time of the front-end camera is continuously lower than the preset average writing time to obtain a continuous number of times.
And 42, if the continuous times reach a first preset value, determining a delay closing space which corresponds to the front-end computer and is in a to-be-closed state from the delay closing spaces recorded by the global linked list, and updating secondary index information of the determined delay closing space.
In practice, steps 41 and 42 may be performed by the aforementioned management thread 14.
Taking the scenario shown in fig. 1 as an example, if the stream receiving module 12 receives the stream data1 sent by the front-end camera 21, in an embodiment, the management thread 14 may use a time when the stream receiving module 12 receives the stream data1 as a timing starting point, and use a time when all the stream data is written into the storage space provided by the storage module 13 as a timing ending point, where a difference between the timing ending point and the timing starting point is a writing duration of the front-end camera 21 writing the stream data1 into the storage module 13 this time.
In another embodiment, when the stream receiving module 12 receives the stream data1, the stream receiving module 12 puts the stream data1 into the buffer, so that the management thread 14 may use the time when the stream data1 starts to be written into the storage module 13 from the buffer as a timing starting point, use the time when the stream data1 is completely written into the storage module 13 as a timing ending point, and the difference between the timing ending point and the timing starting point is the writing duration of the front-end camera 21 writing the stream data1 into the storage module 13 this time.
In practice, for each front-end camera, the management thread 14 may record a number field corresponding to the front-end camera. The initial value of the number field may be, for example, X0, and X0 may be any integer, which is not limited in this embodiment. The management thread 14 compares the writing duration with the preset average writing duration each time the writing duration of the front-end camera is monitored, and adds 1 to the current value of the time field if the writing duration is lower than the preset average writing duration; if the write duration is not less than the preset average write duration, the current value of the number of times field may be reset to X0.
Thus, the difference between the current value of the count field and X0 is the consecutive count of the present embodiment. For example, when X0 is 0 and the current value of the number field is 3, the consecutive number is 3. Namely: the writing duration of the front-end camera for 3 continuous times is lower than the preset average writing duration. The preset average writing time can be flexibly set according to test data or empirical data.
Optionally, in an implementation process, the preset average writing duration may be further updated in real time through the following steps:
calculating the average value of each monitored writing duration within a second preset duration every interval; and updating the average value to the preset average writing time.
The second preset time period may be flexibly set according to a requirement, for example, may be 2 hours to 10 hours, or may be 1 day to 3 days, which is not limited in this embodiment.
In the implementation process, if it is monitored that the continuous writing time of the front-end camera for multiple times is lower than the preset average writing time, it indicates that the storage space corresponding to the front-end camera is in an idle state, and at this time, the secondary index information of the delayed closing space corresponding to the front-end camera can be updated. Therefore, when it is detected that the consecutive times of any front-end camera reaches the first preset value, the secondary index information of the time-delay closed space, which is recorded in the global linked list, corresponds to the front-end camera and is in the state to be closed, may be updated through step 42.
Optionally, the first preset value may be flexibly set according to actual requirements, and may be, for example, 3 to 10, such as 5. The present embodiment does not limit this.
Optionally, in this embodiment, step 33 may further include the step shown in fig. 5.
And 51, monitoring the duration of which the continuous times are lower than the first preset value, and if the duration reaches the first preset duration, judging whether the writing duration is lower than the average writing duration or not when the writing duration of the front-end camera is monitored next time. If yes, go to step 52; if not, go to step 53.
And step 52, determining a delay closing space corresponding to the front-end computer and in a state to be closed from the global linked list, and updating secondary index information of the determined delay closing space.
In detail, when implemented, the management thread 14 may set a timer for each front end camera. Taking the front-end camera 21 as an example, when it is monitored that the write-in duration of the front-end camera 21 is lower than the preset average write-in duration, the timer of the front-end camera 21 may be cleared, and timing is started. Wherein the timing length of the timer may serve as the length of time in which the consecutive times are lower than the first preset value.
If the continuous times are still lower than the first preset value when the timing duration of the timer reaches the first preset duration, indicating that the secondary index information of the storage space corresponding to the front-end camera 21 is not updated within the past first preset duration, determining whether the writing duration is lower than the preset average writing duration when the writing duration of the front-end camera 21 is monitored next time; if the result is yes, indicating that the storage space corresponding to the front-end camera 21 is relatively free, the secondary index information of the storage space corresponding to the front-end camera 21 may be updated.
And 53, when the next time that the storage space of the front-end camera needs to be switched is monitored, determining a delay closing space which corresponds to the front-end camera and is in a state to be closed from the global linked list, and updating secondary index information of the determined delay closing space.
In detail, in the foregoing example, assuming that it is monitored in step 31 that the storage space S1 of the front-end camera 21 needs to be switched and a new storage space S2 is allocated to the front-end camera 21, when it is monitored that the new storage space S2 needs to be switched, the delayed closing space in the to-be-closed state corresponding to the front-end camera 21 may be determined from the global linked list, and the secondary index information thereof may be updated. The new storage space S2 described herein may serve as the next monitored storage space in step 53 that needs to be switched.
And step 34, updating the first-level index information of the delayed closing space in the closing state recorded in the global linked list, closing the delayed closing space in which the first-level index information is updated, and updating the state of the delayed closing space in which the first-level index information is updated to be in the closed state in the global linked list.
In this embodiment, the delayed closing space in which the first-level index information and the second-level index information are both updated is the delayed closing space in the closed state.
The delayed closing space in which the first-level index information and the second-level index information are updated can be directly closed. In detail, for the case that the identification information recorded in the global linked list is a handle of the delayed closing space, the handle may be directly closed, thereby implementing closing of the delayed closing space.
Optionally, in this embodiment, in step 34, the step of updating the first-level index information of the delayed closing space in the closing state recorded in the global linked list may be implemented by the steps shown in fig. 6.
And step 61, when updating the primary index information of any storage space, searching a first delay closing space in which the primary index information and the primary index information of the storage space are in the same logic address area from the delay closing space in the closing state recorded by the global linked list.
If the first-level index information of the storage space N is to be updated currently, the first delayed closing space is a delayed closing space in a closing state recorded by the global linked list, and the first-level index information of the storage space N are in a delayed closing space in the same logical address area.
In this embodiment, the step 61 may be triggered to be executed, for example, when the first-level index information of the allocated new storage space is updated (i.e., when the step 32 is executed).
And 62, updating the searched first-level index information of the first delayed closing space in batch. Through research, batch updating is performed on information in the same logical address area, and compared with the mode that a plurality of pieces of information in the same logical address area are updated respectively, the required operation amount is less, and the time consumption is shorter.
In the embodiment, each time a new storage space is allocated, the first-level index information of the new storage space needs to be updated. In addition, in a plurality of storage spaces provided by the back-end monitoring system, the first-level index information of other storage spaces and the first-level index information of the new storage space may be in the same logical address area. Therefore, each time a new storage space is allocated, a first delayed closing space can be determined from the delayed closing spaces recorded by the global linked list, and the first-level index information of the first delayed closing space is updated.
In step 32, the first-level index information of the new storage space may be updated together with step 62, so as to further reduce the operation amount.
In order to avoid that the first-level index information of the delayed closing space is not updated for a long time, optionally, in step 34, the step of updating the first-level index information of the delayed closing space in the closing state recorded in the global linked list may further include the step shown in fig. 7.
Step 71, counting the switching times of the front-end camera.
Here, taking the front camera 21 as an example, switching the storage position of the codestream data of the front camera 21 from the storage space S1 to the storage space S2 is performed once, and switching the storage position of the codestream data of the front camera 21 from the storage space S2 to the storage space S3 is performed once.
And 72, when the switching times reach a second preset value, determining the number of second delay closing spaces in a closing state, corresponding to the front-end machine, in the global linked list.
The second delay closing space is a delay closing space which corresponds to the front-end computer and is in a closing state in the delay closing space of the global connection record.
And 73, if the number is greater than 1, searching other delay closing spaces which are in a closing state and have the same logical address area as the first-level index information of the second delay closing space from the global linked list aiming at each second delay closing space.
And 74, updating the first-level index information of the second delayed closing space and the searched other delayed closing spaces in batch.
In this embodiment, in a general case, the delay closed space recorded in the global linked list and corresponding to each front-end computer only includes one delay closed space in the closed state, and if more than one delay closed spaces in the closed state (i.e., more than one second delay closed spaces) occur, the first-level index information indicating the more than one second delay closed spaces is not updated for a long time, and at this time, the first-level index information of the second delay closed spaces may be forcibly updated.
Correspondingly, in order to reduce the operation amount, when the first-level index information of the second latency shutdown space is updated, the first-level index information and the first-level index information of other latency shutdown spaces in which the second latency shutdown space is in the same logical address area and is in a shutdown state may be updated.
Through research, on the basis of the design, the situation that the primary index information and/or the secondary index information of some delayed closed spaces are not updated for a long time can still occur, so that complete data cannot be acquired in the subsequent process.
Based on this, step 34 may further include the steps of:
if the management thread 14 monitors that the data writing to any one of the delay closing spaces by the streaming receiving module fails, the primary index information and/or the secondary index information of the delay closing space are/is updated, the delay closing space is closed, and the state of the delay closing space is updated to be a closed state in the global linked list.
In this embodiment, in the implementation process, if there is a need for a user to invoke code stream data in the delayed closing space, in order to ensure integrity of data invoked by the user, step 34 may further include the following steps:
when monitoring a monitoring call instruction for any delay closed space, the management thread 14 may determine whether the state of the delay closed space recorded in the global linked list is a closed state. If the state is not the closed state, updating the first-level index information and/or the second-level index information of the time delay closed space, closing the time delay closed space, and updating the state of the time delay closed space to be the closed state in the global linked list.
In the two steps, if the first-level index information and the second-level index information of the delayed closing space are not updated, the first-level index information and the second-level index information of the delayed closing space are updated. And if the first-level index information of the delayed closing space is not updated, only updating the first-level index information of the delayed closing space.
It should be noted that, when the first-level index information of the delayed closing space in which the data writing fails is updated, or when the first-level index information of the delayed closing space to which the monitoring and fetching instruction is directed is updated, the step 61 may be triggered to be executed, that is, the batch updating of the first-level index information is triggered.
Optionally, the management thread 14 may delete the time delay closed space in the closed state in the global linked list at intervals of a third preset time, specifically, the third preset time may be flexibly set according to an actual requirement, which is not limited in this embodiment.
Optionally, if a power failure occurs during updating of the first-level index information or the second-level index information of any one of the delayed closing spaces in the foregoing process, after the back-end monitoring system 10 is restarted, the first-level index information or the second-level index information of the incomplete delayed closing space may be searched from the multiple delayed closing spaces provided by the back-end monitoring system 10, and the first-level index information or the second-level index information of the searched delayed closing space is continuously updated.
It should be noted that, in this embodiment, the storage space has index information of two levels only as an example, and the storage space switching method and the back-end monitoring system provided in this embodiment are also applicable to a storage space having index information of more than two levels.
In summary, the storage space switching method and the back-end monitoring system provided in this embodiment asynchronously update the first-level index information and the second-level index information of each delayed closing space, and compared with a serial storage space switching manner in the prior art, reduce time consumption required by a switching process, thereby improving a data loss problem caused by too long time consumption of the storage space switching process, and improving integrity and stability of the back-end monitoring system.
In addition, compared with the prior art method of avoiding the data loss problem by increasing the size of the buffer, the cost is lower.
In the embodiments provided in the present application, it should be understood that the disclosed system and method may be implemented in other ways. The above-described system embodiments are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A storage space switching method, applied to a back-end monitoring system communicatively connected to at least one front-end computer, the method comprising:
when it is monitored that the storage space distributed by the rear-end monitoring system for any front-end computer needs to be switched, recording the storage space as a delay closing space into a preset global linked list, and recording the state of the delay closing space in the global linked list as a state to be closed;
distributing a new storage space for the front-end computer, and updating primary index information and secondary index information of the new storage space;
updating the secondary index information of the delayed closing space in the state to be closed, which is recorded by the global linked list, and updating the state of the delayed closing space in which the secondary index information is updated into a closing state in the global linked list;
updating the first-level index information of the delayed closing space in the closing state recorded by the global linked list, closing the delayed closing space in which the first-level index information is updated, and updating the state of the delayed closing space in which the first-level index information is updated to be in a closed state in the global linked list.
2. The method according to claim 1, wherein the back-end monitoring system comprises a stream receiving module and a storage module, the stream receiving module is configured to receive the code stream data sent by the front-end terminal and write the code stream data into a storage space provided by the storage module for the front-end terminal;
the updating of the secondary index information of the delayed closing space in the state to be closed, which is recorded by the global linked list, includes:
monitoring the writing-in duration for writing the code stream data sent by the front-end camera into the storage module from the stream receiving module each time, and counting the times that the writing-in duration of the front-end camera is continuously lower than the preset average writing-in duration to obtain a continuous time;
and if the continuous times reach a first preset value, determining a delay closing space which corresponds to the front-end computer and is in a to-be-closed state from the delay closing spaces recorded by the global linked list, and updating secondary index information of the determined delay closing space.
3. The method according to claim 2, wherein the updating the secondary index information of the delayed closing space in the global linked list, which is in the state to be closed, further comprises:
monitoring the duration of the continuous times lower than the first preset value;
if the time length reaches a first preset time length, determining a delay closing space corresponding to the front-end camera and in a to-be-closed state from the global linked list when the next monitored writing time length of the front-end camera is lower than the average writing time length, and updating secondary index information of the determined delay closing space;
and if the write-in duration of the front-end camera monitored next time is not lower than the average write-in duration, determining a delay closing space corresponding to the front-end camera and in a state to be closed from the global linked list when the storage space of the front-end camera needs to be switched monitored next time, and updating secondary index information of the determined delay closing space.
4. The method according to claim 2 or 3, wherein the updating the secondary index information of the delayed closing space in the to-be-closed state recorded in the global linked list further comprises:
calculating the average value of each monitored writing-in duration within a second preset duration every interval;
and updating the average value to the preset average writing time.
5. The method according to any one of claims 1 to 3, wherein the storage spaces are storage blocks or files, each storage space has a corresponding handle, and the backend monitoring system can perform read operation and/or write operation on the storage space through the handle; the recording the storage space as a delayed closing space into a preset global linked list includes:
and transferring the handle of the storage space to the global linked list.
6. The method according to any of claims 1-3, wherein the updating the first-level index information of the delayed closing space in the closed state of the global linked list record comprises:
when updating the primary index information of any storage space, searching a first delay closing space in which the primary index information and the primary index information of the storage space are in the same logic address area from the delay closing space in the closing state recorded by the global linked list;
and updating the searched first-stage index information of the first delay closing space in batch.
7. The method of claim 6, wherein updating the first-level index information of the delayed close space of the global linked list record in the closed state further comprises:
counting the switching times of the storage space of the front-end camera;
when the switching times reach a second preset value, determining the number of second delay closing spaces which correspond to the front-end computers and are in a closing state from the global linked list;
if the number is larger than 1, searching other delay closing spaces which are in a closing state and have the same logic address area as the first-level index information of the second delay closing space from the global linked list aiming at each second delay closing space;
and updating the second delayed closing space and the searched first-level index information of the other delayed closing spaces in batches.
8. The method of claim 6, wherein updating the first-level index information of the delayed close space of the global linked list record in the closed state further comprises:
when detecting that the data writing to any delay closing space fails, updating the primary index information and/or the secondary index information of the delay closing space, closing the delay closing space, and updating the state of the delay closing space to be a closed state in the global linked list; and/or the presence of a gas in the gas,
when a monitoring calling instruction for any delay closing space is detected, judging whether the state of the delay closing space recorded in the global linked list is a closed state or not; if the state is not the closed state, updating the first-level index information or the second-level index information of the time delay closed space, closing the time delay closed space, and updating the state of the time delay closed space to be the closed state in the global linked list.
9. The method according to any one of claims 1-3, further comprising:
and deleting the closed delay closing space in the closed state from the delay closing space recorded by the global linked list every third preset time.
10. A back-end monitoring system, the back-end monitoring system comprising:
the management thread is used for recording the storage space serving as a delay closing space into a preset global linked list when the situation that the storage space distributed to any front-end computer by the rear-end monitoring system needs to be switched is monitored, and recording the state of the delay closing space into a state to be closed in the global linked list;
the storage module is used for distributing a new storage space for the front-end computer and updating the primary index information and the secondary index information of the new storage space;
the management thread is further configured to:
updating the secondary index information of the delayed closing space in the state to be closed, which is recorded by the global linked list, and updating the state of the delayed closing space in which the secondary index information is updated into a closing state in the global linked list;
updating the first-level index information of the delayed closing space in the closing state recorded by the global linked list, closing the delayed closing space in which the first-level index information is updated, and updating the state of the delayed closing space in which the first-level index information is updated to be in a closed state in the global linked list.
CN201910301232.3A 2019-04-15 2019-04-15 Storage space switching method and back-end monitoring system Active CN111831206B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910301232.3A CN111831206B (en) 2019-04-15 2019-04-15 Storage space switching method and back-end monitoring system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910301232.3A CN111831206B (en) 2019-04-15 2019-04-15 Storage space switching method and back-end monitoring system

Publications (2)

Publication Number Publication Date
CN111831206A true CN111831206A (en) 2020-10-27
CN111831206B CN111831206B (en) 2022-06-14

Family

ID=72914197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910301232.3A Active CN111831206B (en) 2019-04-15 2019-04-15 Storage space switching method and back-end monitoring system

Country Status (1)

Country Link
CN (1) CN111831206B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114138795A (en) * 2021-12-08 2022-03-04 兴业银行股份有限公司 Index dynamic updating method and system for thread safety

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102360337A (en) * 2011-10-17 2012-02-22 杭州海康威视数字技术股份有限公司 Method for using hard disk according to quota on digital video recorder and device thereof
CN103092528A (en) * 2011-11-01 2013-05-08 新太科技股份有限公司 Method of space storage conversion according to disk space and performance changes
CN103530180A (en) * 2013-10-18 2014-01-22 北京奇虎科技有限公司 Method and device for switching storage space of application programs
CN103677674A (en) * 2013-12-27 2014-03-26 华为技术有限公司 Data processing method and device
US20140111695A1 (en) * 2012-10-24 2014-04-24 Mstar Semiconductor, Inc. Memory space configuration method applied in video signal processing apparatus
CN104967807A (en) * 2014-12-30 2015-10-07 浙江大华技术股份有限公司 Caching method and apparatus
CN107154966A (en) * 2017-04-24 2017-09-12 浙江宇视科技有限公司 A kind of video data wiring method and device
CN109117087A (en) * 2018-07-19 2019-01-01 北京蜂盒科技有限公司 Acquire method, apparatus, storage medium and the electronic equipment of monitoring data

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102360337A (en) * 2011-10-17 2012-02-22 杭州海康威视数字技术股份有限公司 Method for using hard disk according to quota on digital video recorder and device thereof
CN103092528A (en) * 2011-11-01 2013-05-08 新太科技股份有限公司 Method of space storage conversion according to disk space and performance changes
US20140111695A1 (en) * 2012-10-24 2014-04-24 Mstar Semiconductor, Inc. Memory space configuration method applied in video signal processing apparatus
CN103530180A (en) * 2013-10-18 2014-01-22 北京奇虎科技有限公司 Method and device for switching storage space of application programs
CN103677674A (en) * 2013-12-27 2014-03-26 华为技术有限公司 Data processing method and device
CN104967807A (en) * 2014-12-30 2015-10-07 浙江大华技术股份有限公司 Caching method and apparatus
CN107154966A (en) * 2017-04-24 2017-09-12 浙江宇视科技有限公司 A kind of video data wiring method and device
CN109117087A (en) * 2018-07-19 2019-01-01 北京蜂盒科技有限公司 Acquire method, apparatus, storage medium and the electronic equipment of monitoring data

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114138795A (en) * 2021-12-08 2022-03-04 兴业银行股份有限公司 Index dynamic updating method and system for thread safety

Also Published As

Publication number Publication date
CN111831206B (en) 2022-06-14

Similar Documents

Publication Publication Date Title
US11853549B2 (en) Index storage in shingled magnetic recording (SMR) storage system with non-shingled region
CN108319654B (en) Computing system, cold and hot data separation method and device, and computer readable storage medium
CN111159436B (en) Method, device and computing equipment for recommending multimedia content
US20150213100A1 (en) Data synchronization method and system
CN106227621B (en) The data back up method and system of logic-based volume management simplification volume
CN111176549B (en) Data storage method and device based on cloud storage and storage medium
CN107092628B (en) Time series data processing method and device
CN109800181B (en) Disk-based data writing method, data writing device and terminal equipment
CN104794119A (en) Middleware message storage and transmission method and system
CN111158939A (en) Data processing method, data processing device, storage medium and electronic equipment
CN111831206B (en) Storage space switching method and back-end monitoring system
CN115408149A (en) Time sequence storage engine memory design and distribution method and device
CN114647658A (en) Data retrieval method, device, equipment and machine-readable storage medium
US9747167B2 (en) Persistency free architecture
CN110866068B (en) Advertisement data storage method and device based on HDFS
CN112181277B (en) Data storage space management method and device, storage medium and electronic equipment
CN115794446B (en) Message processing method and device, electronic equipment and storage medium
CN105830067B (en) A kind of file information processing method, device and document handling apparatus, system
CN110019870B (en) Image retrieval method and system based on memory image cluster
CN115934999A (en) Video stream data storage method, device and medium based on block file
EP3547142B1 (en) Processing message
CN109669814A (en) A kind of restoration methods of Metadata Service, device, equipment and readable storage medium storing program for executing
CN115421856A (en) Data recovery method and device
US20220284034A1 (en) Replicating data changes of a source database in a target database using data change records and runtime statistics of the source database
CN111625502B (en) Data reading method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant