WO2021179122A1 - 数据处理方法及相关产品 - Google Patents

数据处理方法及相关产品 Download PDF

Info

Publication number
WO2021179122A1
WO2021179122A1 PCT/CN2020/078426 CN2020078426W WO2021179122A1 WO 2021179122 A1 WO2021179122 A1 WO 2021179122A1 CN 2020078426 W CN2020078426 W CN 2020078426W WO 2021179122 A1 WO2021179122 A1 WO 2021179122A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
target
timestamp
time stamp
current
Prior art date
Application number
PCT/CN2020/078426
Other languages
English (en)
French (fr)
Inventor
曾焕生
赖延辉
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN202080094736.3A priority Critical patent/CN115004167A/zh
Priority to PCT/CN2020/078426 priority patent/WO2021179122A1/zh
Publication of WO2021179122A1 publication Critical patent/WO2021179122A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors

Definitions

  • This application relates to the field of data processing technology, in particular to a data processing method and related products.
  • the embodiments of the present application provide a data processing method and related products, which can improve the intelligence of deleting expired data and help improve the efficiency of online services.
  • a data processing method applied to an electronic device, includes:
  • the data corresponding to the at least one target timestamp is deleted, and the remaining data in the plurality of data to be waited for are merged to obtain a target data set.
  • an embodiment of the present application provides a data processing device applied to an electronic device.
  • the device includes: a first acquiring unit, a second acquiring unit, a comparing unit, and a deleting unit, wherein:
  • the first acquiring unit is configured to acquire a data set to be processed, the data set to be processed includes a plurality of data, and each data corresponds to a time stamp;
  • the second obtaining unit is configured to obtain the current timestamp when the RocksDB storage engine is running;
  • the comparison unit is configured to compare the current timestamp with the timestamp corresponding to each data in the plurality of data to obtain at least one target timestamp;
  • the deleting unit is configured to delete the data corresponding to the at least one target time stamp, and merge the remaining data in the plurality of data to be processed to obtain a target data set.
  • an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are configured by the above Executed by the processor, and the foregoing program includes instructions for executing the steps in the first aspect of the embodiments of the present application.
  • an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute Some or all of the steps described in one aspect.
  • the embodiments of the present application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute as implemented in this application.
  • the computer program product may be a software installation package.
  • FIG. 1A is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 1B is a schematic flowchart of a data processing method disclosed in an embodiment of the present application.
  • FIG. 1C is a schematic diagram illustrating the principle of merging realization disclosed in the embodiment of the present application.
  • FIG. 2 is a schematic flowchart of another data processing method disclosed in an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another data processing method disclosed in an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of another electronic device disclosed in an embodiment of the present application.
  • Fig. 5A is a schematic structural diagram of a data processing device disclosed in an embodiment of the present application.
  • 5B is a schematic structural diagram of another data processing device disclosed in an embodiment of the present application.
  • 5C is a schematic structural diagram of another data processing device disclosed in an embodiment of the present application.
  • Fig. 5D is a schematic structural diagram of another data processing device disclosed in an embodiment of the present application.
  • the electronic devices involved in the embodiments of this application may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to wireless modems, as well as various forms of user equipment (user equipment).
  • equipment UE
  • mobile station mobile station
  • terminal device terminal device
  • the above-mentioned devices are collectively referred to as electronic devices, and the above-mentioned electronic devices may also be servers, service platforms, and so on.
  • FIG. 1A is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application.
  • the electronic device 100 may include a control circuit, and the control circuit may include a storage and processing circuit 110.
  • the storage and processing circuit 110 can be a memory, such as a hard disk drive memory, a non-volatile memory (such as flash memory or other electronic programmable read-only memory used to form a solid-state drive, etc.), and a volatile memory (such as a static or dynamic random access memory). Access to memory, etc.), etc., are not limited in the embodiment of the present application.
  • the processing circuit in the storage and processing circuit 110 may be used to control the operation of the electronic device 100.
  • the processing circuit can be implemented based on one or more microprocessors, microcontrollers, baseband processors, power management units, audio codec chips, application specific integrated circuits, display driver integrated circuits, and so on.
  • the storage and processing circuit 110 can be used to run software in the electronic device 100, such as Internet browsing applications, voice over internet protocol (VOIP) phone call applications, email applications, media playback applications, and operating system functions Wait. These softwares can be used to perform some control operations, for example, camera-based image capture, ambient light measurement based on ambient light sensors, proximity sensor measurement based on proximity sensors, and information based on status indicators such as the status indicators of light-emitting diodes.
  • software in the electronic device 100 such as Internet browsing applications, voice over internet protocol (VOIP) phone call applications, email applications, media playback applications, and operating system functions Wait.
  • VOIP voice over internet protocol
  • These softwares can be used to perform some control operations, for example, camera-based image capture, ambient light measurement based on ambient light sensors, proximity sensor measurement based on proximity sensors, and information based on status indicators such as the status indicators of light-emitting diodes.
  • Display functions touch event detection based on touch sensors, functions associated with displaying information on multiple (for example, layered) displays, operations associated with performing wireless communication functions, operations associated with collecting and generating audio signals ,
  • the control operations associated with the collection and processing of button press event data, as well as other functions in the electronic device 100, are not limited in the embodiment of the present application.
  • the electronic device 100 may further include an input-output circuit 150.
  • the input-output circuit 150 can be used to enable the electronic device 100 to input and output data, that is, allow the electronic device 100 to receive data from an external device and also allow the electronic device 100 to output data from the electronic device 100 to the external device.
  • the input-output circuit 150 may further include a sensor 170.
  • the sensor 170 may include an ambient light sensor, a proximity sensor based on light and capacitance, and a touch sensor (for example, a light-based touch sensor and/or a capacitive touch sensor.
  • the touch sensor structure is used independently), acceleration sensor, gravity sensor, and other sensors.
  • the input-output circuit 150 may also include one or more displays, such as the display 130.
  • the display 130 may include one or a combination of a liquid crystal display, an organic light emitting diode display, an electronic ink display, a plasma display, and a display using other display technologies.
  • the display 130 may include a touch sensor array (ie, the display 130 may be a touch display screen).
  • the touch sensor can be a capacitive touch sensor formed by an array of transparent touch sensor electrodes (such as indium tin oxide (ITO) electrodes), or it can be a touch sensor formed using other touch technologies, such as sonic touch, pressure-sensitive touch, and resistance. Touch, optical touch, etc., are not limited in the embodiment of the present application.
  • the audio component 140 may be used to provide audio input and output functions for the electronic device 100.
  • the audio component 140 in the electronic device 100 may include a speaker, a microphone, a buzzer, a tone generator, and other components for generating and detecting sounds.
  • the communication circuit 120 may be used to provide the electronic device 100 with the ability to communicate with external devices.
  • the communication circuit 120 may include analog and digital input-output interface circuits, and wireless communication circuits based on radio frequency signals and/or optical signals.
  • the wireless communication circuit in the communication circuit 120 may include a radio frequency transceiver circuit, a power amplifier circuit, a low noise amplifier, a switch, a filter, and an antenna.
  • the wireless communication circuit in the communication circuit 120 may include a circuit for supporting near field communication (NFC) by transmitting and receiving near-field coupled electromagnetic signals.
  • the communication circuit 120 may include a near field communication antenna and a near field communication transceiver.
  • the communication circuit 120 may also include a cellular phone transceiver and antenna, a wireless local area network transceiver circuit and antenna, and so on.
  • the electronic device 100 may further include a battery, a power management circuit, and other input-output units 160.
  • the input-output unit 160 may include buttons, joysticks, click wheels, scroll wheels, touch pads, keypads, keyboards, cameras, light emitting diodes, and other status indicators.
  • the user can input commands through the input-output circuit 150 to control the operation of the electronic device 100, and can use the output data of the input-output circuit 150 to realize receiving status information and other outputs from the electronic device 100.
  • FIG. 1B is a schematic flowchart of a data processing method provided by an embodiment of the present application.
  • the data processing method described in this embodiment is applied to the electronic device shown in FIG. 1A.
  • the data processing method includes:
  • the data set to be processed includes a plurality of data, and each data corresponds to a time stamp.
  • the data set to be processed may include multiple data, and the data may be at least one of the following: text data, video data, audio data, cache data, compressed packages, folders, etc., which will not be described here. limited.
  • Each data can correspond to a key-value pair, and each data corresponds to a timestamp.
  • the timestamp is used to record the generation time or expiration time of the data.
  • the timestamp field corresponding to the timestamp can be located at the end of the key-value pair.
  • the RocksDB storage engine is a persistent KV storage engine, which is a database with a log structure and is optimized for fast storage.
  • the electronic device can obtain the current timestamp when the RocksDB storage engine is running, and the current timestamp records the current time.
  • the electronic device compares the current timestamp with the timestamp corresponding to each data in the multiple data to obtain at least one target timestamp.
  • the data corresponding to the target timestamp can be used as the data to be deleted, and the expired data can be selected in this way. data.
  • the foregoing step 103 comparing the current timestamp with the timestamp corresponding to each data in the plurality of data, to obtain at least one target timestamp, may include the following steps:
  • the current timestamp is compared with the timestamp corresponding to each data in the plurality of data through a hook function in the RocksDB storage engine to obtain at least one target timestamp.
  • the RocksDB storage engine of the electronic device may include a hook function.
  • the hook function in the RocksDB storage engine the current timestamp is compared with the timestamp corresponding to each of the multiple data to obtain at least one target timestamp.
  • Corresponding data can be used as data to be deleted, and expired data can be selected in this way.
  • the timestamp of each data in the plurality of data is used to record the existence time corresponding to the data.
  • the current timestamp is corresponding to each data in the plurality of data. Compare the timestamps of to obtain at least one target timestamp, which may include the following steps:
  • A31 Determine the time length between the current time stamp and the time stamp corresponding to each data in the plurality of data and the current time stamp to obtain multiple time lengths
  • A32 Select a time length greater than a preset threshold from the multiple time lengths to obtain at least one target time length
  • A33 Use the time stamp of the data corresponding to the at least one target time length as the at least one target time stamp.
  • the preset threshold may be set by the user or be defaulted by the system.
  • the time stamp of each data in the multiple data is used to record the existence time corresponding to the data, and the existence time can be understood as the generation time or storage time of the data.
  • the electronic device can determine the current time stamp and the time length between the time stamp corresponding to each data in the multiple data and the current time stamp to obtain multiple time lengths, and furthermore, can select from multiple time lengths greater than
  • the threshold time length is preset to obtain at least one target time length, and the time stamp of the data corresponding to the at least one target time length can be used as the at least one target time stamp. In this way, some time stamps that exist for a long time can be selected.
  • step A31 the following steps may be further included:
  • A35 Determine the preset threshold corresponding to the target CPU usage rate according to the preset mapping relationship between the CPU usage rate and the threshold value.
  • the electronic device can pre-store the mapping relationship between the preset CPU usage rate and the threshold.
  • the electronic device can obtain the target CPU usage rate of the electronic device, and according to the preset CPU usage rate and the threshold value To determine the preset threshold corresponding to the target CPU usage rate, the threshold can be dynamically adjusted. For example, when the CPU usage rate is high, more data can be deleted, and when the CPU usage rate is low, some data can be deleted less .
  • the timestamp of each data in the plurality of data is used to record the expiration time corresponding to the data.
  • the current timestamp is corresponding to each data in the plurality of data. Compare the timestamps of to obtain at least one target timestamp, which may include the following steps:
  • the time stamp of each data in the multiple data is used to record the expiration time corresponding to the data
  • the electronic device can obtain the time stamp corresponding to each data in the multiple data, obtain multiple time stamps, and determine multiple times Stamp a timestamp earlier than the current timestamp to get at least one target timestamp.
  • merging can also be compressed, used to organize and merge existing data, thereby deleting some no longer valid data (for example, expired data), reducing the data size and the number of files to speed up reading Take the speed.
  • the consolidation process may include a compaction (also called major compaction) process. Compaciton process is to store files from low level to high level. As shown in Figure 1C, when the electronic device can merge the data of Level1 (first layer) with the data of Level2 (second layer), it will call the hook function that satisfies the compaction filter mechanism, thereby removing the expired data in Level1. Remove files that are no longer merged into Level2.
  • the embodiment of the application combines the existing features of RocksDB and utilizes the RocksDB compaction filter mechanism to automatically clear expired data.
  • Rocksdb can automatically delete expired data, eliminating the need for manual means to clear data.
  • a 4-byte timestamp field can be added to the end of each value. The timestamp can indicate the expiration time of the key; RocksDB exposes A hook function (the interface function exposed by RocksDB) Filter.
  • the hook function Filter is automatically called; in the hook function, it is judged whether the current timestamp is greater than the timestamp stored in the key-value If the current timestamp is greater than the expiration time stored at the end of the value, it means that the key-value pair has expired and needs to be deleted. Then, it is not merged into a new file, thereby achieving the purpose of automatically clearing the expired data.
  • the electronic device can implement the expired deletion hook function through the compaction filter mechanism of RocksDB, so that the expired data is automatically recovered, and there is no need to manually delete data intensively through business logic.
  • the process of deleting data is evenly distributed to the various consolidation processes of Rocksdb, and data is deleted smoothly.
  • the foregoing step 104 deleting the data corresponding to the at least one target timestamp, may include the following steps:
  • the electronic device may pre-store the preset mapping relationship between the number of timestamps and the number of threads, and further, in specific implementation, the electronic device may determine the number of target timestamps corresponding to at least one target timestamp , And according to the preset mapping relationship between the number of timestamps and the number of threads, determine the number of target threads corresponding to at least one target timestamp, load threads according to the number of target threads, and delete at least one target time according to the loaded threads
  • the data corresponding to the stamp, the data corresponding to each target timestamp corresponds to a thread, so that according to the number of data to be deleted, a corresponding number of threads can be configured to delete data, which helps to improve the efficiency of data deletion and improve system performance.
  • the electronic device can receive the data clearing instruction input by the user, and further, can respond to the data clearing instruction, and further, can perform the step of obtaining the current time stamp.
  • the preset conditions can be set by the user or the system defaults.
  • the operating environment parameters include at least one of the following: touch parameters, operating time, geographic location, external environment parameters, CPU temperature, CPU usage rate, memory usage rate, etc., which are not limited here.
  • the touch parameter can be at least one of the following: touch strength of the touch touch screen, touch area of the touch touch screen, touch duration of the touch touch screen, touch times of the touch touch screen, touch of the touch touch screen Temperature, etc., are not limited here, where the environmental parameters can be at least one of the following: ambient light brightness, ambient temperature, ambient humidity, magnetic field interference intensity, etc., which are not limited here.
  • the step of acquiring the current timestamp needs to be executed when the running time is a designated time; another example, the step of acquiring the current timestamp needs to be executed when the geographic location is a designated location.
  • step D1 the following steps may also be included:
  • the preset memory size can be set by the user or the system defaults.
  • the electronic device can determine the memory size of the data set to be processed, and when the memory size is greater than the preset memory size, execute the step of obtaining operating environment parameters; otherwise, when the memory size is less than or equal to the preset memory size, it may not Perform the following steps, so that data can be cleaned when there is only a certain amount of memory.
  • step 101 the following steps may also be included:
  • the physiological state parameters may be various parameters used to reflect the physiological functions of the user, and the physiological state parameters may be at least one of the following: heart rate, blood pressure, blood temperature, blood lipid content, blood glucose content, and thyroxine content , Adrenaline content, platelet content, blood oxygen content, etc., are not limited here.
  • the preset emotion type can be set by the user or the system defaults. The preset emotion type can be at least one of the following: dull, crying, calm, irritable, excited, depressed, etc., which are not limited here.
  • the electronic device can obtain the user's target physiological state parameters through a wearable device that can communicate with the electronic device.
  • Different physiological state parameters reflect the user's emotional type.
  • the electronic device can pre-store the physiological state parameters and emotions.
  • the mapping relationship between the types, and further, the target emotion type corresponding to the target physiological state parameter can be determined according to the mapping relationship, and further, when the target emotion type is the preset emotion type, step 101 may be executed, otherwise, step 101 may not be executed 101.
  • the above step E22 determining the target emotion type corresponding to the target physiological state parameter, can be implemented in the following manner:
  • E222 Perform an average calculation according to the multiple heart rate values to obtain an average heart rate value
  • E224 Determine the target first emotion value corresponding to the target heart rate level according to the preset mapping relationship between the heart rate level and the first emotion value;
  • E225 Perform a mean square error calculation according to the multiple heart rate values to obtain a target mean square error
  • E226 Determine the target second emotion value corresponding to the target mean square error according to the preset mapping relationship between the mean square error and the second emotion value;
  • E227 Determine the target weight pair corresponding to the target heart rate level according to the preset mapping relationship between the heart rate level and the weight value pair, the weight value pair including a first weight value and a second weight value, and the first weight value A weight value is a weight value corresponding to the first emotion value, and the second weight value is a weight value corresponding to the second emotion value;
  • E229. Determine the target emotion type corresponding to the target emotion value according to the preset mapping relationship between the emotion value and the emotion type.
  • the specified time period can be set by the user or the system defaults.
  • the electronic device can pre-store the mapping relationship between the preset heart rate level and the first emotion value, and the preset mean square error and the second emotion value.
  • the mapping relationship, and the mapping relationship between the preset heart rate level and the weight value pair, and the mapping relationship between the preset emotion value and the emotion type, the above weight value pair may include a first weight value and a second weight value,
  • the first weight value is the weight value corresponding to the first sentiment value
  • the second weight value is the weight value corresponding to the second sentiment value.
  • the sum of the first weight value and the second weight value can be 1, and the first weight value ,
  • the value range of the second weight is 0 ⁇ 1.
  • the emotion can be evaluated by the heart rate change curve.
  • the electronic device can sample the heart rate curve.
  • the specific sampling method can be: uniform sampling or random sampling to obtain multiple heart rate values, and the average heart rate can be calculated based on the multiple heart rate values to obtain the average heart rate value.
  • the mapping relationship between the heart rate value and the heart rate level can be pre-stored in the, and then the target heart rate level corresponding to the average heart rate value can be determined according to the mapping relationship, and further, can be based on the preset heart rate level and the first emotional value.
  • the mapping relationship is used to determine the target first emotion value corresponding to the target heart rate level.
  • the mean square error operation can be performed on multiple heart rate values to obtain the target mean square error, and the target mean square error can be calculated according to the preset mean square error and the second emotion value.
  • the mapping relationship determines the target second sentiment value corresponding to the target mean square error.
  • the electronic device may also determine a target weight pair corresponding to the target heart rate level according to the above-mentioned preset mapping relationship between the heart rate level and the weight value pair, and the target weight value pair may include the target first weight value and the target first weight value.
  • a weight value, the target first weight value is the weight value corresponding to the target first emotion value
  • the target second weight value is the weight value corresponding to the target second emotion value.
  • the electronic device can be based on the target first emotion value and the target first emotion value.
  • the second emotional value, the first weight of the target and the second weight of the target are weighted to obtain the final emotional value.
  • the specific calculation formula is as follows:
  • the target emotion type corresponding to the target emotion value can be determined according to the foregoing preset mapping relationship between the emotion value and the emotion type.
  • the above average heart rate reflects the user's heart rate value
  • the mean square error of the heart rate reflects the stability of the heart rate
  • the user's emotion is reflected through the two dimensions of the average heart rate and the mean square error, and the user's emotion type can be accurately determined.
  • the data processing method described in the above embodiment of the application is applied to electronic devices to obtain a data set to be processed.
  • the data set to be processed includes multiple data, each of which corresponds to a timestamp.
  • the RocksDB storage engine When the RocksDB storage engine is running , Obtain the current timestamp, compare the current timestamp with the timestamp corresponding to each data in the multiple data to obtain at least one target timestamp, delete the data corresponding to at least one target timestamp, and add data to After merging the remaining data to obtain the target data set, the expired data can be automatically recovered through RocksDB without manual intervention or intensive deletion of data.
  • the deletion process is allocated to each consolidation stage, and has very little impact on online business reads and writes. The entire deletion process is very smooth, which helps to improve system performance and also helps to improve online service efficiency.
  • FIG. 2 is a schematic flowchart of another data processing method provided by an embodiment of the present application.
  • the data processing method described in this embodiment is applied to the electronic device shown in FIG. 1A , The method may include the following steps:
  • the data processing method described in the above embodiment of the application is applied to electronic devices to obtain a data set to be processed.
  • the data set to be processed includes multiple data, each of which corresponds to a timestamp.
  • Receive the data clear instruction respond to the data clear instruction, get the current timestamp, compare the current timestamp with the timestamp corresponding to each data in the multiple data, get at least one target timestamp, delete at least one target timestamp corresponding Data, and merge the remaining data in multiple data to obtain the target data set, which can automatically recover expired data through RocksDB, can receive user instructions, and achieve data removal without intensive data deletion.
  • the deletion process is allocated to each consolidation stage, and the read and write impact on online business is very small. The entire deletion process is very smooth, which helps to improve system performance and also helps to improve the efficiency of online services.
  • FIG. 3 is a schematic flowchart of an embodiment of another data processing method provided by an embodiment of this application.
  • the data processing method described in this embodiment is applied to the electronic device as shown in FIG. 1A.
  • the method may include the following steps:
  • the data processing method described in the above embodiment of the application is applied to electronic devices to obtain a data set to be processed.
  • the data set to be processed includes multiple data, each of which corresponds to a timestamp.
  • the RocksDB storage engine When the RocksDB storage engine is running , Obtain the operating environment parameters, and when the operating environment parameters meet the preset conditions, obtain the current timestamp, compare the current timestamp with the timestamp corresponding to each data in the multiple data, obtain at least one target timestamp, delete Data corresponding to at least one target timestamp, and the remaining data in the multiple data to be merged to obtain the target data set.
  • the expired data can be automatically recovered through RocksDB without manual intervention.
  • FIG. 4 is an electronic device provided by an embodiment of the present application, including: a processor and a memory; and one or more programs, the one or more programs are stored in the In the memory and configured to be executed by the processor, the program includes instructions for executing the following steps:
  • the data corresponding to the at least one target timestamp is deleted, and the remaining data in the plurality of data to be waited for are merged to obtain a target data set.
  • the electronic device described in the above embodiment of the application obtains a data set to be processed.
  • the data set to be processed includes multiple data. Each data corresponds to a timestamp.
  • the current timestamp is obtained. Compare the current timestamp with the timestamp corresponding to each data in the multiple data to obtain at least one target timestamp, delete the data corresponding to at least one target timestamp, and merge the remaining data in the multiple data to be processed,
  • the target data set is obtained, and the expired data can be automatically recovered through RocksDB without manual intervention or intensive deletion of data.
  • the deletion process is allocated to each consolidation stage, and the read and write impact on online business is very small. The entire deletion process is very smooth, which helps to improve system performance and also helps to improve the efficiency of online services.
  • the time stamp of each data in the plurality of data is used to record the existence time corresponding to the data, and the current time stamp is corresponding to each data in the plurality of data.
  • the program includes instructions for executing the following steps:
  • the time stamp of the data corresponding to the at least one target time length is used as the at least one target time stamp.
  • the program further includes instructions for executing the following steps:
  • the timestamp of each data in the plurality of data is used to record the expiration time corresponding to the data, and in the step of matching the current timestamp with each data in the plurality of data
  • the program includes instructions for executing the following steps:
  • the program includes: Step instructions:
  • the current timestamp is compared with the timestamp corresponding to each data in the plurality of data through a hook function in the RocksDB storage engine to obtain at least one target timestamp.
  • the program includes instructions for executing the following steps:
  • Thread loading is performed according to the number of target threads, and data corresponding to the at least one target timestamp is deleted according to the loaded threads, and the data corresponding to each target timestamp corresponds to one thread.
  • the program further includes instructions for executing the following steps:
  • the step of obtaining the current time stamp is executed.
  • the program further includes instructions for executing the following steps:
  • the step of obtaining the current time stamp is executed.
  • the program further includes instructions for executing the following steps:
  • the step of obtaining operating environment parameters is executed.
  • an electronic device includes hardware structures and/or software modules corresponding to each function.
  • this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
  • the embodiment of the present application may divide the electronic device into functional units according to the foregoing method examples.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 5A is a schematic structural diagram of a data processing device provided by this embodiment.
  • the data processing apparatus is applied to the electronic equipment as shown in FIG. 1A.
  • the data processing apparatus includes: a first acquiring unit 501, a second acquiring unit 502, a comparing unit 503, and a deleting unit 504, wherein:
  • the first acquiring unit 501 is configured to acquire a data set to be processed, the data set to be processed includes multiple data, and each data corresponds to a time stamp;
  • the second obtaining unit 502 is configured to obtain the current timestamp when the RocksDB storage engine is running;
  • the comparison unit 503 is configured to compare the current timestamp with the timestamp corresponding to each data in the plurality of data to obtain at least one target timestamp;
  • the deleting unit 504 is configured to delete the data corresponding to the at least one target time stamp, and merge the remaining data in the plurality of data to be processed to obtain a target data set.
  • the data processing device described in the above embodiment of the application is applied to electronic equipment to obtain a data set to be processed.
  • the data set to be processed includes multiple data, and each data corresponds to a timestamp.
  • the RocksDB storage engine is running , Obtain the current timestamp, compare the current timestamp with the timestamp corresponding to each data in the multiple data to obtain at least one target timestamp, delete the data corresponding to at least one target timestamp, and add the data to the After merging the remaining data to obtain the target data set, the expired data can be automatically recovered through RocksDB without manual intervention or intensive deletion of data.
  • the deletion process is allocated to each consolidation stage, and the read and write impact on online business is very small. The entire deletion process is very smooth, which helps to improve system performance and also helps to improve the efficiency of online services.
  • the time stamp of each data in the plurality of data is used to record the existence time corresponding to the data, and the current time stamp is corresponding to each data in the plurality of data.
  • the comparing unit 503 is specifically configured to:
  • the time stamp of the data corresponding to the at least one target time length is used as the at least one target time stamp.
  • the comparison unit 503 is further specifically configured to:
  • the timestamp of each data in the plurality of data is used to record the expiration time corresponding to the data, and in the step of matching the current timestamp with each data in the plurality of data
  • the comparing unit 503 is specifically configured to:
  • the comparing unit 503 specifically uses At:
  • the current timestamp is compared with the timestamp corresponding to each data in the plurality of data through a hook function in the RocksDB storage engine to obtain at least one target timestamp.
  • the deleting unit 504 is specifically configured to:
  • Thread loading is performed according to the number of target threads, and data corresponding to the at least one target timestamp is deleted according to the loaded threads, and the data corresponding to each target timestamp corresponds to one thread.
  • FIG. 5B is another modified structure of the data processing device shown in FIG. 5A. Compared with FIG. 5A, it may further include: a receiving unit 505, wherein,
  • the receiving unit 505 is configured to receive a data clearing instruction
  • the second obtaining unit 502 responds to the data clearing instruction to execute the step of obtaining the current time stamp.
  • FIG. 5C is another modified structure of the data processing device shown in FIG. 5A. Compared with FIG. Unit 506, in which,
  • the third obtaining unit 506 is configured to obtain operating environment parameters
  • the second acquiring unit 502 executes the step of acquiring the current timestamp when the operating environment parameter meets a preset condition.
  • FIG. 5D is another modified structure of the data processing device shown in FIG. 5C. Compared with FIG. 5C, it may further include: a determining unit 507, wherein,
  • the determining unit 507 is configured to determine the memory size of the data set to be processed
  • the third acquiring unit 506 executes the step of acquiring operating environment parameters when the memory size is greater than the preset memory size.
  • An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute a part of any data processing method recorded in the above method embodiment Or all steps.
  • the embodiments of the present application also provide a computer program product.
  • the computer program product includes a non-transitory computer-readable storage medium storing a computer program.
  • the computer program is operable to cause a computer to execute the method described in the foregoing method embodiment. Part or all of the steps of any data processing method.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or in the form of software program modules.
  • the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • a number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
  • the foregoing memory includes: U disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: a flash disk , ROM, RAM, magnetic disk or CD, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据处理方法及相关产品,应用于电子设备,该方法包括:获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳(101);在RocksDB存储引擎运行时,获取当前时间戳(102);将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳(103);删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集(104)。该方法能够提升数据删除效率,有助于提升***性能。

Description

数据处理方法及相关产品 技术领域
本申请涉及数据处理技术领域,具体涉及一种数据处理方法及相关产品。
背景技术
随着电子设备(如:手机、平板电脑等)的大量普及应用,电子设备能够支持的应用越来越多,功能越来越强大,电子设备向着多样化、个性化的方向发展,成为用户生活中不可缺少的电子用品。
目前来看,在需要通过业务逻辑来及时删除过期数据,并且需要结合业务运行状态,例如在业务低峰期删除数据,避免影响线上服务。主要有以下缺点:集中删除,对删除期间的业务读写有影响,会造成读写延迟上升;业务低峰期一般是凌晨,大规模删除数据,无人值守,有一定的风险,因此,如何合理删除过期数据以提升线上服务效率的问题亟待解决。
发明内容
本申请实施例提供了一种数据处理方法及相关产品,能够提升过期数据删除智能性,有助于提升线上服务效率。
第一方面,本申请实施例一种数据处理方法,应用于电子设备,包括:
获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳;
在RocksDB存储引擎运行时,获取当前时间戳;
将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳;
删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
第二方面,本申请实施例提供了一种数据处理装置,应用于电子设备,所述装置包括:第一获取单元、第二获取单元、比对单元和删除单元,其中,
所述第一获取单元,用于获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳;
所述第二获取单元,用于在RocksDB存储引擎运行时,获取当前时间戳;
所述比对单元,用于将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳;
所述删除单元,用于删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
第三方面,本申请实施例提供一种电子设备,包括处理器、存储器、通信接口,以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第一方面中的步骤的指令。
第四方面,本申请实施例提供了一种计算机可读存储介质,其中,上述计算机可读存 储介质存储用于电子数据交换的计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面中所描述的部分或全部步骤。
第五方面,本申请实施例提供了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。
附图说明
下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1A是本申请实施例提供的一种电子设备的结构示意图;
图1B是本申请实施例公开的一种数据处理方法的流程示意图;
图1C是本申请实施例公开的合并实现原理的演示示意图;
图2是本申请实施例公开的另一种数据处理方法的流程示意图;
图3是本申请实施例公开的另一种数据处理方法的流程示意图;
图4是本申请实施例公开的另一种电子设备的结构示意图;
图5A是本申请实施例公开的一种数据处理装置的结构示意图;
图5B是本申请实施例公开的另一种数据处理装置的结构示意图;
图5C是本申请实施例公开的另一种数据处理装置的结构示意图;
图5D是本申请实施例公开的另一种数据处理装置的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、***、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
本申请实施例所涉及到的电子设备可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(user equipment,UE),移动台(mobile station,MS),终端设备(terminal device)等等。为方便描述,上面提到的设备统称为电子设备,上述电子设备还可以为服务器、业务平台等等。
下面对本申请实施例进行详细介绍。
请参阅图1A,图1A是本申请实施例公开的一种电子设备的结构示意图,电子设备100可以包括控制电路,该控制电路可以包括存储和处理电路110。该存储和处理电路110可以存储器,例如硬盘驱动存储器,非易失性存储器(例如闪存或用于形成固态驱动器的其它电子可编程只读存储器等),易失性存储器(例如静态或动态随机存取存储器等)等,本申请实施例不作限制。存储和处理电路110中的处理电路可以用于控制电子设备100的运转。该处理电路可以基于一个或多个微处理器,微控制器,基带处理器,功率管理单元,音频编解码器芯片,专用集成电路,显示驱动器集成电路等来实现。
存储和处理电路110可用于运行电子设备100中的软件,例如互联网浏览应用程序,互联网协议语音(voice over internet protocol,VOIP)电话呼叫应用程序,电子邮件应用程序,媒体播放应用程序,操作***功能等。这些软件可以用于执行一些控制操作,例如,基于照相机的图像采集,基于环境光传感器的环境光测量,基于接近传感器的接近传感器测量,基于诸如发光二极管的状态指示灯等状态指示器实现的信息显示功能,基于触摸传感器的触摸事件检测,与在多个(例如分层的)显示器上显示信息相关联的功能,与执行无线通信功能相关联的操作,与收集和产生音频信号相关联的操作,与收集和处理按钮按压事件数据相关联的控制操作,以及电子设备100中的其它功能等,本申请实施例不作限制。
电子设备100还可以包括输入-输出电路150。输入-输出电路150可用于使电子设备100实现数据的输入和输出,即允许电子设备100从外部设备接收数据和也允许电子设备100将数据从电子设备100输出至外部设备。输入-输出电路150可以进一步包括传感器170。传感器170可以包括环境光传感器,基于光和电容的接近传感器,触摸传感器(例如,基于光触摸传感器和/或电容式触摸传感器,其中,触摸传感器可以是触控显示屏的一部分,也可以作为一个触摸传感器结构独立使用),加速度传感器,重力传感器,和其它传感器等。
输入-输出电路150还可以包括一个或多个显示器,例如显示器130。显示器130可以包括液晶显示器,有机发光二极管显示器,电子墨水显示器,等离子显示器,使用其它显示技术的显示器中一种或者几种的组合。显示器130可以包括触摸传感器阵列(即,显示器130可以是触控显示屏)。触摸传感器可以是由透明的触摸传感器电极(例如氧化铟锡(ITO)电极)阵列形成的电容式触摸传感器,或者可以是使用其它触摸技术形成的触摸传感器,例如音波触控,压敏触摸,电阻触摸,光学触摸等,本申请实施例不作限制。
音频组件140可以用于为电子设备100提供音频输入和输出功能。电子设备100中的音频组件140可以包括扬声器,麦克风,蜂鸣器,音调发生器以及其它用于产生和检测声音的组件。
通信电路120可以用于为电子设备100提供与外部设备通信的能力。通信电路120可以包括模拟和数字输入-输出接口电路,和基于射频信号和/或光信号的无线通信电路。通信电路120中的无线通信电路可以包括射频收发器电路、功率放大器电路、低噪声放大器、开关、滤波器和天线。举例来说,通信电路120中的无线通信电路可以包括用于通过发射和接收近场耦合电磁信号来支持近场通信(near field communication,NFC)的电路。例如,通信电路120可以包括近场通信天线和近场通信收发器。通信电路120还可以包括蜂窝电话收发器和天线,无线局域网收发器电路和天线等。
电子设备100还可以进一步包括电池,电力管理电路和其它输入-输出单元160。输入-输出单元160可以包括按钮,操纵杆,点击轮,滚动轮,触摸板,小键盘,键盘,照相机,发光二极管和其它状态指示器等。
用户可以通过输入-输出电路150输入命令来控制电子设备100的操作,并且可以使用输入-输出电路150的输出数据以实现接收来自电子设备100的状态信息和其它输出。
请参阅图1B,图1B是本申请实施例提供的一种数据处理方法的流程示意图,本实施例中所描述的数据处理方法,应用于如图1A的电子设备,该数据处理方法包括:
101、获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳。
其中,本申请实施例中,待处理数据集可以包括多个数据,数据可以为以下至少一种:文本数据、视频数据、音频数据、缓存数据、压缩包、文件夹等等,在此不做限定。每一数据可以对应一个键值对key-value,每一数据对应一个时间戳,时间戳用于记录该数据的生成时间或者过期时间。时间戳对应的时间戳字段可以位于键值对的尾部。
102、在RocksDB存储引擎运行时,获取当前时间戳。
其中,本申请实施例中,RocksDB存储引擎为一个持久化KV存储引擎,它是一个日志结构的数据库,并针对快速存储进行了优化。
具体实现中,电子设备可以在RocksDB存储引擎运行时,获取当前时间戳,该当前时间戳记录了当前时间。
103、将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
其中,电子设备将当前时间戳与多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,目标时间戳对应的数据可以作为待删除数据,通过该方式可以甄选出过期数据。
在一个可能的示例中,上述步骤103,将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,可以包括如下步骤:
通过所述RocksDB存储引擎中的钩子函数将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
其中,电子设备的RocksDB存储引擎可以包括钩子函数,通过RocksDB存储引擎中的钩子函数将当前时间戳与多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,时间戳对应的数据可以作为待删除数据,通过该方式可以甄选出过期数据。
在一个可能的示例中,所述多个数据中每一数据的时间戳用于记录该数据对应的存在 时间,上述步骤103,将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,可以包括如下步骤:
A31、确定所述当前时间戳与所述多个数据中每一数据对应的时间戳与所述当前时间戳之间的时间长度,得到多个时间长度;
A32、从所述多个时间长度中选取大于预设阈值的时间长度,得到至少一个目标时间长度;
A33、将所述至少一个目标时间长度对应的数据的时间戳作为所述至少一个目标时间戳。
其中,本申请实施例中,预设阈值可以由用户自行设置或者***默认。多个数据中每一数据的时间戳用于记录该数据对应的存在时间,存在时间可以理解为数据的生成时间或者存储时间。
具体实现中,电子设备可以确定当前时间戳与多个数据中每一数据对应的时间戳与当前时间戳之间的时间长度,得到多个时间长度,进而,可以从多个时间长度中选取大于预设阈值的时间长度,得到至少一个目标时间长度,并且可以将至少一个目标时间长度对应的数据的时间戳作为至少一个目标时间戳,如此,可以选取一些存在存在时间较久的时间戳。
进一步地,在一个可能的示例中,上述步骤A31之前,还可以包括如下步骤:
A34、获取所述电子设备的目标CPU使用率;
A35、按照预设的CPU使用率与阈值之间的映射关系,确定所述目标CPU使用率对应的所述预设阈值。
其中,电子设备中可以预先存储预设的CPU使用率与阈值之间的映射关系,具体实现中,电子设备可以获取电子设备的目标CPU使用率,并且按照预设的CPU使用率与阈值之间的映射关系,确定目标CPU使用率对应的预设阈值,如此,可以实现动态调整阈值,例如,CPU使用率高的时候,可以多删除一些数据,CPU使用率低的时候,可以少删除一些数据。
在一个可能的示例中,所述多个数据中每一数据的时间戳用于记录该数据对应的过期时间,上述步骤103,将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,可以包括如下步骤:
B31、获取所述多个数据中每一数据对应的时间戳,得到多个时间戳;
B32、确定所述多个时间戳早于所述当前时间戳的时间戳,得到所述至少一个目标时间戳。
具体实现中,多个数据中每一数据的时间戳用于记录该数据对应的过期时间,电子设备可以获取多个数据中每一数据对应的时间戳,得到多个时间戳,确定多个时间戳早于当前时间戳的时间戳,得到至少一个目标时间戳。
104、删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
本申请实施例中,合并:也可以成为压缩,用于对已有的数据进行整理合并,从而删除一些不再有效的数据(例如,过期的数据),减少数据规模和文件数量,以加快读取速 度。合并过程可以包括Compaction(也称为major compaction)过程。Compaciton过程即将文件从低Level向高Level存储。如图1C所示,电子设备可以实现Level1层(第一层)的数据与Level2层(第二层)的数据合并时,就会调用满足compaction filter机制的钩子函数,从而,将Level1中过期数据剔除掉,不再合并到Level2中的文件。
具体实现中,本申请实施例,结合RocksDB的已有特性,并利用RocksDB compaction filter机制,自动清除过期数据,通过该方式,Rocksdb可以自动删除过期数据,不再需要人工手段清除数据。具体地,可以在写入一个key-value数据对时,通过程序逻辑,在每个value的尾部追加4个字节的时间戳字段,该时间戳可以表示这个key的过期时刻;RocksDB对外暴露出了一个钩子函数(RocksDB对外暴露的接口函数)Filter,RocksDB运行时,在每一次数据合并时,自动都会调用钩子函数Filter;在钩子函数中判断当前时间戳是否大于key-value中存储的时间戳,如果当前时间戳大于存储在value尾部的过期时刻,则表示该key-value对已经过期,需要删除,然后,不将其合并到新文件,从而,实现自动清除过期数据的目的。
基于上述本申请实施例中,电子设备可以通过RocksDB的compaction filter机制,实现过期删除钩子函数,从而,自动回收过期数据,不需要人工通过业务逻辑来密集删除数据。删除数据过程均摊到Rocksdb的各个合并过程中,平滑删除数据。
在一个可能的示例中,上述步骤104,删除所述至少一个目标时间戳对应的数据,可以包括如下步骤:
41、确定所述至少一个目标时间戳对应的目标时间戳数量;
42、按照预设的时间戳数量与线程数量之间的映射关系,确定所述至少一个目标时间戳对应的目标线程数量;
43、依据所述目标线程数量进行线程加载,并依据加载后的线程删除所述至少一个目标时间戳对应的数据,每一目标时间戳对应的数据对应一个线程。
其中,本申请实施例中,电子设备中可以预先存储预设的时间戳数量与线程数量之间的映射关系,进而,具体实现中,电子设备可以确定至少一个目标时间戳对应的目标时间戳数量,并且按照预设的时间戳数量与线程数量之间的映射关系,确定至少一个目标时间戳对应的目标线程数量,并依据目标线程数量进行线程加载,并依据加载后的线程删除至少一个目标时间戳对应的数据,每一目标时间戳对应的数据对应一个线程,如此,可以依据待删除数据的数量,配置相应数量的线程进行数据删除,有助于提升数据删除效率,提升***性性能。
在一个可能的示例中,还可以包括如下步骤:
C1、接收数据清除指令;
C2、响应所述数据清除指令,执行所述获取当前时间戳的步骤。
具体实现中,电子设备可以接收由用户输入的数据清除指令,进而,可以响应该数据清除指令,进而,可以执行获取当前时间戳的步骤。
在一个可能的示例中,还可以包括如下步骤:
D1、获取运行环境参数;
D2、在所述运行环境参数满足预设条件时,执行所述获取当前时间戳的步骤。
其中,预设条件可以由用户自行设置或者***默认。其中,运行环境参数包括以下至少一种:触控参数、运行时间、地理位置、外部环境参数、CPU温度、CPU使用率、内存占用率等等,在此不做限定。其中,触控参数可以为以下至少一种:触控触摸屏的触控力度、触控触摸屏的触控面积、触控触摸屏的触控时长、触控触摸屏的触控次数、触控触摸屏的触控温度等等,在此不做限定,其中,环境参数可以为以下至少一种:环境光亮度、环境温度、环境湿度、磁场干扰强度等等,在此不做限定。例如,需要在运行时间为指定时间时,才执行所述获取当前时间戳的步骤;又例如,需要在地理位置为指定位置时,才执行所述获取当前时间戳的步骤。
在一个可能的示例中,上述步骤D1之前,还可以包括如下步骤:
D3、确定所述待处理数据集的内存大小;
D4、在所述内存大小大于预设内存大小时,执行所述获取运行环境参数的步骤。
具体实现中,预设内存大小可以由用户自行设置或者***默认。电子设备可以确定待处理数据集的内存大小,并且在内存大小大于预设内存大小时,执行所述获取运行环境参数的步骤,否则,在内存大小小于或等于预设内存大小时,则可以不执行后续步骤,如此,可以在只有数量内存在一定量时,才进行数据清理。
在一个可能的示例中,步骤101之前,还可以包括如下步骤:
E21、获取用户的目标生理状态参数;
E22、确定所述目标生理状态参数对应的目标情绪类型;
E23、在所述目标情绪类型为预设情绪类型时,执行所述获取待处理数据集的步骤。
其中,本申请实施例中,生理状态参数可以为用于反映用户生理机能的各种参数,生理状态参数可以为以下至少一种:心率、血压、血温、血脂含量、血糖含量、甲状腺素含量、肾上腺素含量、血小板含量、血氧含量等等,在此不做限定。预设情绪类型可以由用户自行设置或者***默认。预设情绪类型可以为以下至少一种:沉闷、哭泣、平静、暴躁、兴奋、郁闷等等,在此不做限定。
具体实现中,电子设备可以通过可该电子设备进行通信连接的可穿戴设获取用户的目标生理状态参数,不同的生理状态参数反映了用户的情绪类型,电子设备中可以预先存储生理状态参数与情绪类型之间的映射关系,进而,可以依据该映射关系确定目标生理状态参数对应的目标情绪类型,进而,可以在目标情绪类型为预设情绪类型时,执行步骤101,否则,则可以不执行步骤101。
在一个可能的示例中,在所述目标生理状态参数为指定时间段内的心率变化曲线时,上述步骤E22,确定所述目标生理状态参数对应的目标情绪类型,可以按照如下方式实施:
E221、对所述心率变化曲线进行采样,得到多个心率值;
E222、依据所述多个心率值进行均值运算,得到平均心率值;
E223、确定所述平均心率值对应的目标心率等级;
E224、按照预设的心率等级与第一情绪值之间的映射关系,确定所述目标心率等级对应的目标第一情绪值;
E225、依据所述多个心率值进行均方差运算,得到目标均方差;
E226、按照预设的均方差与第二情绪值之间的映射关系,确定所述目标均方差对应的 目标第二情绪值;
E227、按照预设的心率等级与权值对之间的映射关系,确定所述目标心率等级对应的目标权值对,所述权值对包括第一权值和第二权值,所述第一权值为所述第一情绪值对应的权值,所述第二权值为所述第二情绪值对应的权值;
E228、依据所述目标第一情绪值、所述目标第二情绪值和所述目标权值对进行加权运算,得到最终情绪值;
E229、按照预设的情绪值与情绪类型之间的映射关系,确定所述目标情绪值对应的所述目标情绪类型。
其中,指定时间段可以由用户自行设置或者***默认,电子设备中可以预先存储预设的心率等级与第一情绪值之间的映射关系,以及预设的均方差与第二情绪值之间的映射关系,以及预设的心率等级与权值对之间的映射关系,以及预设的情绪值与情绪类型之间的映射关系,上述权值对可以包括第一权值和第二权值,第一权值为第一情绪值对应的权值,第二权值为第二情绪值对应的权值,其中,第一权值与第二权值之和可以为1,且第一权值、第二权值的取值范围均为0~1。本申请实施例中,可以通过心率变化曲线来评估情绪。
具体实现中,电子设备可以对心率变化曲线进行采样,具体采样方式可以为:均匀采样或者随机采样,得到多个心率值,并且可以依据多个心率值进行均值运算,得到平均心率值,电子设备中可以预先存储心率值与心率等级之间的映射关系,进而,可以依据该映射关系确定平均心率值对应的目标心率等级,进而,可以按照上述预设的心率等级与第一情绪值之间的映射关系,确定目标心率等级对应的目标第一情绪值,进而,还可以依据多个心率值进行均方差运算,得到目标均方差,并且可以按照预设的均方差与第二情绪值之间的映射关系,确定该目标均方差对应的目标第二情绪值。
进一步地,电子设备还可以按照上述预设的心率等级与权值对之间的映射关系,确定目标心率等级对应的目标权值对,该目标权值对可以包括目标第一权值和目标第一权值,目标第一权值为目标第一情绪值对应的权值,目标第二权值为目标第二情绪值对应的权值,进而,电子设备可以依据目标第一情绪值、目标第二情绪值、目标第一权值和目标第二权值进行加权运算,得到最终情绪值,具体计算公式如下:
最终情绪值=目标第一情绪值*目标第一权值+目标第二情绪值*目标第二权值
进而,可以按照上述预设的情绪值与情绪类型之间的映射关系,确定目标情绪值对应的目标情绪类型。其中,上述平均心率反映了用户的心率值,心率的均方差反映了心率稳定性,通过平均心率和均方差两个维度反映了用户的情绪,能够精准确定用户的情绪类型。
可以看出,上述本申请实施例所描述的数据处理方法,应用于电子设备,获取待处理数据集,待处理数据集包括多个数据,每一数据对应一个时间戳,在RocksDB存储引擎运行时,获取当前时间戳,将当前时间戳与多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,删除至少一个目标时间戳对应的数据,并将待多个数据中的剩余数据进行合并,得到目标数据集,能够通过RocksDB自动回收过期数据,不需要人工介入,不需要密集地删除数据。并且删除过程是分摊到每个合并阶段,对线上业务的读写影响非常小,整个删除过程非常平滑,有助于提升***性能,也有助于提升线上服务效率。
与上述一致地,请参阅图2,图2是本申请实施例提供的另一种数据处理方法的流程示意图,本实施例中所描述的数据处理方法,应用于如图1A所示的电子设备,该方法可包括以下步骤:
201、获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳。
202、在RocksDB存储引擎运行时,接收数据清除指令。
203、响应所述数据清除指令,获取当前时间戳。
204、将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
205、删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
其中,上述步骤201-205的具体实现过程可参照图1B所示的方法中相应的描述,在此不再赘述。
可以看出,上述本申请实施例所描述的数据处理方法,应用于电子设备,获取待处理数据集,待处理数据集包括多个数据,每一数据对应一个时间戳,在RocksDB存储引擎运行时,接收数据清除指令,响应数据清除指令,获取当前时间戳,将当前时间戳与多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,删除至少一个目标时间戳对应的数据,并将待多个数据中的剩余数据进行合并,得到目标数据集,能够通过RocksDB自动回收过期数据,能够接收用户指令,实现数据清除,不需要密集地删除数据。并且删除过程是分摊到每个合并阶段,对线上业务的读写影响非常小,整个删除过程非常平滑,有助于提升***性能,也有助于提升线上服务效率。
与上述一致地,请参阅图3,为本申请实施例提供的另一种数据处理方法的实施例流程示意图,本实施例中所描述的数据处理方法,应用于如图1A的电子设备,本方法可包括以下步骤:
301、获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳。
302、在RocksDB存储引擎运行时,获取运行环境参数。
303、在所述运行环境参数满足预设条件时,获取当前时间戳。
304、将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
305、删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
其中,上述步骤301-305的具体实现过程可参照图1B所示的方法中相应的描述,在此不再赘述。
可以看出,上述本申请实施例所描述的数据处理方法,应用于电子设备,获取待处理数据集,待处理数据集包括多个数据,每一数据对应一个时间戳,在RocksDB存储引擎运行时,获取运行环境参数,并在运行环境参数满足预设条件时,获取当前时间戳,将当前时间戳与多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,删除至少一个目标时间戳对应的数据,并将待多个数据中的剩余数据进行合并,得到目标数据集, 能够通过RocksDB自动回收过期数据,不需要人工介入,能够在运行环境参数满足一定条件时,实现数据删除,且不需要密集地删除数据。并且删除过程是分摊到每个合并阶段,对线上业务的读写影响非常小,整个删除过程非常平滑,有助于提升***性能,也有助于提升线上服务效率。
与上述一致地,请参阅图4,图4是本申请实施例提供的一种电子设备,包括:处理器和存储器;以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置成由所述处理器执行,所述程序包括用于执行以下步骤的指令:
获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳;
在RocksDB存储引擎运行时,获取当前时间戳;
将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳;
删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
可以看出,上述本申请实施例所描述的电子设备,获取待处理数据集,待处理数据集包括多个数据,每一数据对应一个时间戳,在RocksDB存储引擎运行时,获取当前时间戳,将当前时间戳与多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,删除至少一个目标时间戳对应的数据,并将待多个数据中的剩余数据进行合并,得到目标数据集,能够通过RocksDB自动回收过期数据,不需要人工介入,不需要密集地删除数据。并且删除过程是分摊到每个合并阶段,对线上业务的读写影响非常小,整个删除过程非常平滑,有助于提升***性能,也有助于提升线上服务效率。
在一个可能的示例中,所述多个数据中每一数据的时间戳用于记录该数据对应的存在时间,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述程序包括用于执行以下步骤的指令:
确定所述当前时间戳与所述多个数据中每一数据对应的时间戳与所述当前时间戳之间的时间长度,得到多个时间长度;
从所述多个时间长度中选取大于预设阈值的时间长度,得到至少一个目标时间长度;
将所述至少一个目标时间长度对应的数据的时间戳作为所述至少一个目标时间戳。
在一个可能的示例中,所述程序还包括用于执行以下步骤的指令:
获取所述电子设备的目标CPU使用率;
按照预设的CPU使用率与阈值之间的映射关系,确定所述目标CPU使用率对应的所述预设阈值。
在一个可能的示例中,所述多个数据中每一数据的时间戳用于记录该数据对应的过期时间,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述程序包括用于执行以下步骤的指令:
获取所述多个数据中每一数据对应的时间戳,得到多个时间戳;
确定所述多个时间戳早于所述当前时间戳的时间戳,得到所述至少一个目标时间戳。
在一个可能的示例中,在所述将所述当前时间戳与所述多个数据中每一数据对应的时 间戳进行比对,得到至少一个目标时间戳方面,所述程序包括用于执行以下步骤的指令:
通过所述RocksDB存储引擎中的钩子函数将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
在一个可能的示例中,在所述删除所述至少一个目标时间戳对应的数据方面,所述程序包括用于执行以下步骤的指令:
确定所述至少一个目标时间戳对应的目标时间戳数量;
按照预设的时间戳数量与线程数量之间的映射关系,确定所述至少一个目标时间戳对应的目标线程数量;
依据所述目标线程数量进行线程加载,并依据加载后的线程删除所述至少一个目标时间戳对应的数据,每一目标时间戳对应的数据对应一个线程。
在一个可能的示例中,所述程序还包括用于执行以下步骤的指令:
接收数据清除指令;
响应所述数据清除指令,执行所述获取当前时间戳的步骤。
在一个可能的示例中,所述程序还包括用于执行以下步骤的指令:
获取运行环境参数;
在所述运行环境参数满足预设条件时,执行所述获取当前时间戳的步骤。
在一个可能的示例中,所述程序还包括用于执行以下步骤的指令:
确定所述待处理数据集的内存大小;
在所述内存大小大于预设内存大小时,执行所述获取运行环境参数的步骤。
上述主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所提供的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对电子设备进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
请参阅图5A,图5A是本实施例提供的一种数据处理装置的结构示意图。该数据处理装置应用于如图1A所示的电子设备,所述数据处理装置包括:第一获取单元501、第二获取单元502、比对单元503和删除单元504,其中,
所述第一获取单元501,用于获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳;
所述第二获取单元502,用于在RocksDB存储引擎运行时,获取当前时间戳;
所述比对单元503,用于将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳;
所述删除单元504,用于删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
可以看出,上述本申请实施例所描述的数据处理装置,应用于电子设备,获取待处理数据集,待处理数据集包括多个数据,每一数据对应一个时间戳,在RocksDB存储引擎运行时,获取当前时间戳,将当前时间戳与多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,删除至少一个目标时间戳对应的数据,并将待多个数据中的剩余数据进行合并,得到目标数据集,能够通过RocksDB自动回收过期数据,不需要人工介入,不需要密集地删除数据。并且删除过程是分摊到每个合并阶段,对线上业务的读写影响非常小,整个删除过程非常平滑,有助于提升***性能,也有助于提升线上服务效率。
在一个可能的示例中,所述多个数据中每一数据的时间戳用于记录该数据对应的存在时间,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述比对单元503具体用于:
确定所述当前时间戳与所述多个数据中每一数据对应的时间戳与所述当前时间戳之间的时间长度,得到多个时间长度;
从所述多个时间长度中选取大于预设阈值的时间长度,得到至少一个目标时间长度;
将所述至少一个目标时间长度对应的数据的时间戳作为所述至少一个目标时间戳。
在一个可能的示例中,所述比对单元503还具体用于:
获取所述电子设备的目标CPU使用率;
按照预设的CPU使用率与阈值之间的映射关系,确定所述目标CPU使用率对应的所述预设阈值。
在一个可能的示例中,所述多个数据中每一数据的时间戳用于记录该数据对应的过期时间,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述比对单元503具体用于:
获取所述多个数据中每一数据对应的时间戳,得到多个时间戳;
确定所述多个时间戳早于所述当前时间戳的时间戳,得到所述至少一个目标时间戳。
在一个可能的示例中,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述比对单元503具体用于:
通过所述RocksDB存储引擎中的钩子函数将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
在一个可能的示例中,在所述删除所述至少一个目标时间戳对应的数据方面,所述删除单元504具体用于:
确定所述至少一个目标时间戳对应的目标时间戳数量;
按照预设的时间戳数量与线程数量之间的映射关系,确定所述至少一个目标时间戳对应的目标线程数量;
依据所述目标线程数量进行线程加载,并依据加载后的线程删除所述至少一个目标时间戳对应的数据,每一目标时间戳对应的数据对应一个线程。
在一个可能的示例中,如图5B所示,图5B为图5A所示的数据处理装置的又一变型结构,其与图5A相比较,还可以包括:接收单元505,其中,
所述接收单元505,用于接收数据清除指令;
由所述第二获取单元502响应所述数据清除指令,执行所述获取当前时间戳的步骤。
在一个可能的示例中,如图5C所示,图5C为图5A所示的数据处理装置的又一变型结构,其与图5A相比较,还可以包括:所述装置还包括:第三获取单元506,其中,
所述第三获取单元506,用于获取运行环境参数;
由所述第二获取单元502在所述运行环境参数满足预设条件时,执行所述获取当前时间戳的步骤。
在一个可能的示例中,如图5D所示,图5D为图5C所示的数据处理装置的又一变型结构,其与图5C相比较,还可以包括:确定单元507,其中,
所述确定单元507,用于确定所述待处理数据集的内存大小;
由所述第三获取单元506在所述内存大小大于预设内存大小时,执行所述获取运行环境参数的步骤。
可以理解的是,本实施例的数据处理装置的各程序模块的功能可根据上述方法实施例中的方法具体实现,其具体实现过程可以参照上述方法实施例的相关描述,此处不再赘述。
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任何一种数据处理方法的部分或全部步骤。
本申请实施例还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如上述方法实施例中记载的任何一种数据处理方法的部分或全部步骤。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络 单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件程序模块的形式实现。
所述集成的单元如果以软件程序模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、ROM、RAM、磁盘或光盘等。
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (20)

  1. 一种数据处理方法,其特征在于,应用于电子设备,包括:
    获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳;
    在RocksDB存储引擎运行时,获取当前时间戳;
    将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳;
    删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
  2. 根据权利要求1所述的方法,其特征在于,所述多个数据中每一数据的时间戳用于记录该数据对应的存在时间,所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,包括:
    确定所述当前时间戳与所述多个数据中每一数据对应的时间戳与所述当前时间戳之间的时间长度,得到多个时间长度;
    从所述多个时间长度中选取大于预设阈值的时间长度,得到至少一个目标时间长度;
    将所述至少一个目标时间长度对应的数据的时间戳作为所述至少一个目标时间戳。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    获取所述电子设备的目标CPU使用率;
    按照预设的CPU使用率与阈值之间的映射关系,确定所述目标CPU使用率对应的所述预设阈值。
  4. 根据权利要求1所述的方法,其特征在于,所述多个数据中每一数据的时间戳用于记录该数据对应的过期时间,所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,包括:
    获取所述多个数据中每一数据对应的时间戳,得到多个时间戳;
    确定所述多个时间戳早于所述当前时间戳的时间戳,得到所述至少一个目标时间戳。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳,包括:
    通过所述RocksDB存储引擎中的钩子函数将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述删除所述至少一个目标时间戳对应的数据,包括:
    确定所述至少一个目标时间戳对应的目标时间戳数量;
    按照预设的时间戳数量与线程数量之间的映射关系,确定所述至少一个目标时间戳对应的目标线程数量;
    依据所述目标线程数量进行线程加载,并依据加载后的线程删除所述至少一个目标时间戳对应的数据,每一目标时间戳对应的数据对应一个线程。
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述方法还包括:
    接收数据清除指令;
    响应所述数据清除指令,执行所述获取当前时间戳的步骤。
  8. 根据权利要求1-6任一项所述的方法,其特征在于,所述方法还包括:
    获取运行环境参数;
    在所述运行环境参数满足预设条件时,执行所述获取当前时间戳的步骤。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    确定所述待处理数据集的内存大小;
    在所述内存大小大于预设内存大小时,执行所述获取运行环境参数的步骤。
  10. 一种数据处理装置,其特征在于,应用于电子设备,所述装置包括:第一获取单元、第二获取单元、比对单元和删除单元,其中,
    所述第一获取单元,用于获取待处理数据集,所述待处理数据集包括多个数据,每一数据对应一个时间戳;
    所述第二获取单元,用于在RocksDB存储引擎运行时,获取当前时间戳;
    所述比对单元,用于将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳;
    所述删除单元,用于删除所述至少一个目标时间戳对应的数据,并将所述待多个数据中的剩余数据进行合并,得到目标数据集。
  11. 根据权利要求10所述的装置,其特征在于,所述多个数据中每一数据的时间戳用于记录该数据对应的存在时间,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述比对单元具体用于:
    确定所述当前时间戳与所述多个数据中每一数据对应的时间戳与所述当前时间戳之间的时间长度,得到多个时间长度;
    从所述多个时间长度中选取大于预设阈值的时间长度,得到至少一个目标时间长度;
    将所述至少一个目标时间长度对应的数据的时间戳作为所述至少一个目标时间戳。
  12. 根据权利要求11所述的装置,其特征在于,所述比对单元还具体用于:
    获取所述电子设备的目标CPU使用率;
    按照预设的CPU使用率与阈值之间的映射关系,确定所述目标CPU使用率对应的所述预设阈值。
  13. 根据权利要求10所述的装置,其特征在于,所述多个数据中每一数据的时间戳用于记录该数据对应的过期时间,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述比对单元具体用于:
    获取所述多个数据中每一数据对应的时间戳,得到多个时间戳;
    确定所述多个时间戳早于所述当前时间戳的时间戳,得到所述至少一个目标时间戳。
  14. 根据权利要求10-13任一项所述的装置,其特征在于,在所述将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳方面,所述比对单元具体用于:
    通过所述RocksDB存储引擎中的钩子函数将所述当前时间戳与所述多个数据中每一数据对应的时间戳进行比对,得到至少一个目标时间戳。
  15. 根据权利要求10-14任一项所述的装置,其特征在于,在所述删除所述至少一个目标时间戳对应的数据方面,所述删除单元具体用于:
    确定所述至少一个目标时间戳对应的目标时间戳数量;
    按照预设的时间戳数量与线程数量之间的映射关系,确定所述至少一个目标时间戳对应的目标线程数量;
    依据所述目标线程数量进行线程加载,并依据加载后的线程删除所述至少一个目标时间戳对应的数据,每一目标时间戳对应的数据对应一个线程。
  16. 根据权利要求10-15任一项所述的装置,其特征在于,所述装置还包括:接收单元,其中,
    所述接收单元,用于接收数据清除指令;
    由所述第二获取单元响应所述数据清除指令,执行所述获取当前时间戳的步骤。
  17. 根据权利要求10-15任一项所述的装置,其特征在于,所述装置还包括:第三获取单元,其中,
    所述第三获取单元,用于获取运行环境参数;
    由所述第二获取单元在所述运行环境参数满足预设条件时,执行所述获取当前时间戳的步骤。
  18. 一种电子设备,其特征在于,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-9任一项所述的方法中的步骤的指令。
  19. 一种计算机可读存储介质,其特征在于,存储用于电子数据交换的计算机程序,其中,所述计算机程序使得计算机执行如权利要求1-9任一项所述的方法。
  20. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如权利要求1-9任一项所述的方法。
PCT/CN2020/078426 2020-03-09 2020-03-09 数据处理方法及相关产品 WO2021179122A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202080094736.3A CN115004167A (zh) 2020-03-09 2020-03-09 数据处理方法及相关产品
PCT/CN2020/078426 WO2021179122A1 (zh) 2020-03-09 2020-03-09 数据处理方法及相关产品

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/078426 WO2021179122A1 (zh) 2020-03-09 2020-03-09 数据处理方法及相关产品

Publications (1)

Publication Number Publication Date
WO2021179122A1 true WO2021179122A1 (zh) 2021-09-16

Family

ID=77671157

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/078426 WO2021179122A1 (zh) 2020-03-09 2020-03-09 数据处理方法及相关产品

Country Status (2)

Country Link
CN (1) CN115004167A (zh)
WO (1) WO2021179122A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070288529A1 (en) * 2006-06-09 2007-12-13 Oracle International Corporation Framework to optimize delete all rows operations on database objects
CN107193839A (zh) * 2016-03-15 2017-09-22 阿里巴巴集团控股有限公司 数据聚合方法及装置
CN107229649A (zh) * 2016-03-25 2017-10-03 腾讯科技(深圳)有限公司 数据更新***及方法
CN107798009A (zh) * 2016-08-31 2018-03-13 阿里巴巴集团控股有限公司 数据聚合方法、装置及***

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9229960B2 (en) * 2013-02-11 2016-01-05 International Business Machines Corporation Database management delete efficiency
US11461010B2 (en) * 2015-07-13 2022-10-04 Samsung Electronics Co., Ltd. Data property-based data placement in a nonvolatile memory device
CN110134697B (zh) * 2019-05-22 2024-01-16 南京大学 一种面向键值对存储引擎的参数自动调优方法、装置、***

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070288529A1 (en) * 2006-06-09 2007-12-13 Oracle International Corporation Framework to optimize delete all rows operations on database objects
CN107193839A (zh) * 2016-03-15 2017-09-22 阿里巴巴集团控股有限公司 数据聚合方法及装置
CN107229649A (zh) * 2016-03-25 2017-10-03 腾讯科技(深圳)有限公司 数据更新***及方法
CN107798009A (zh) * 2016-08-31 2018-03-13 阿里巴巴集团控股有限公司 数据聚合方法、装置及***

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ANONYMOUS: "A precise TTL expiration elimination mechanism based on RocksDB", 3 December 2019 (2019-12-03), pages 1 - 6, XP055846280, Retrieved from the Internet <URL:https://segmentfault.com/a/1190000021185954> *

Also Published As

Publication number Publication date
CN115004167A (zh) 2022-09-02

Similar Documents

Publication Publication Date Title
JP7414842B2 (ja) コメント追加方法及び電子デバイス
CN108512695B (zh) 监控应用卡顿的方法及装置
EP3502881B1 (en) Method for preloading application, storage medium, and terminal device
CN108874466B (zh) 控件调用方法、电子装置及计算机可读存储介质
KR20200027554A (ko) 음성 인식 방법 및 장치, 그리고 저장 매체
US10643021B2 (en) Method and device for processing web page content
CN109154946A (zh) 一种显示收藏对象的方法和终端
WO2021232289A1 (zh) 镜像拉取方法及相关产品
US20230129384A1 (en) Method for Browsing Application Folder and Electronic Device
WO2015014305A1 (en) Method and apparatus for presenting clipboard contents on a mobile terminal
WO2015027856A1 (zh) 信息反馈方法、装置及终端
WO2021232292A1 (zh) 日志数据处理方法及相关产品
US10540415B2 (en) Apparatus and method for managing history information in an electronic device
WO2020103070A1 (zh) 一种对应用程序进行处理的方法、装置和电子设备
CN109669662A (zh) 一种语音输入方法、装置、存储介质及移动终端
CN108536388A (zh) 分屏处理方法、装置、存储介质和电子设备
CN104063400A (zh) 数据搜索方法和装置
JP2020515123A (ja) メッセージ通知方法及び端末
WO2021254200A1 (zh) 操作***内存回收的页颠簸保护方法及装置
CN106230919B (zh) 一种文件上传的方法和装置
WO2021179122A1 (zh) 数据处理方法及相关产品
CN104254020A (zh) 媒体数据的播放方法、装置及终端
WO2021168800A1 (zh) 数据同步方法及相关产品
CN109240986B (zh) 一种日志处理方法、装置及存储介质
CN113419795B (zh) 调用关系的展示方法、装置、计算机设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20924505

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 200223)

122 Ep: pct application non-entry in european phase

Ref document number: 20924505

Country of ref document: EP

Kind code of ref document: A1