WO2013091183A1 - 一种键值对的操作方法及装置 - Google Patents

一种键值对的操作方法及装置 Download PDF

Info

Publication number
WO2013091183A1
WO2013091183A1 PCT/CN2011/084320 CN2011084320W WO2013091183A1 WO 2013091183 A1 WO2013091183 A1 WO 2013091183A1 CN 2011084320 W CN2011084320 W CN 2011084320W WO 2013091183 A1 WO2013091183 A1 WO 2013091183A1
Authority
WO
WIPO (PCT)
Prior art keywords
key
value
log
value pair
shadow
Prior art date
Application number
PCT/CN2011/084320
Other languages
English (en)
French (fr)
Inventor
周训淼
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201180003583.8A priority Critical patent/CN103502970B/zh
Priority to PCT/CN2011/084320 priority patent/WO2013091183A1/zh
Publication of WO2013091183A1 publication Critical patent/WO2013091183A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0894Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage

Definitions

  • the embodiments of the present invention relate to the field of computer technologies, and in particular, to a method and an apparatus for operating a key value pair. Background technique
  • a transaction is a complete logical process consisting of a sequence of database operations. For example, bank transfer, deducting the amount from the original account, and adding the amount to the target account, the sum of these two database operations constitutes a complete logical process, which cannot be split.
  • This process is called a transaction, and a transaction has four majors.
  • Characteristics (English tube called ACID: atomic atomicity, consistent 'I' raw consistency, isolation 'I' raw isolation, persistent 'I' raw durability).
  • the Key-Value storage system has high scalability and robustness and has been widely used in more and more database systems, but usually the Key-Value storage system is based on a key value. (Key-value) Pairs can be guaranteed to be atomic and consistent when inserting/getting/deleteing interfaces. However, Key-Value storage systems have restrictions on the size of Value and key-value pairs. The operation is the operation mode of the whole storage and fetching. There is no interface that can guarantee the one-time put/delete multiple key-value pairs, that is, the existing Key-Value storage system cannot solve the atomicity and durability. The problem of one-time put/delete multiple key-value pairs in the scene.
  • WAL Ahead Logging
  • the write-ahead log is used to provide atoms in a relational database system.
  • a series of techniques for sex and persistence two of the ACID properties).
  • all operations are written to the log (log) file before committing, and the log file usually includes redo ( Redo) and ⁇ pin (undo) information.
  • Redo redo
  • ⁇ pin undo
  • the program can check the log file and compare the contents of the operation scheduled to be executed when the power is suddenly lost with the actual operation. Based on this comparison, the program can decide whether to continue as it is or continue. Complete the remaining operations, or 4 operations that have been done.
  • the technical solutions for realizing the atomicity and persistence of transactions through the WAL method have at least the following defects: 1.
  • the implementation process is complicated and inefficient, and the WAL is a system-level log system, and all update operations need to be recorded.
  • the log file is used to recover the system after a failure, and most of the single put/delete operations are guaranteed to be atomic and persistent by the key-value storage system, so there is no need to repeatedly record the log file.
  • the log segment corresponding to the error point needs to be found from the huge log system to recover, and a complicated checkpoint mechanism is needed.
  • the WAL records the operation log. It needs to be replayed by operation replay or by finding the corresponding reverse operation.
  • some keys in the application based on the Key-Value storage system are not guaranteed to be the last time and the value calculated in the next redo or reverse operation. The results calculated at the time of execution are exactly the same, which leads to the inability to recover the system; 3. Because of the key-value The characteristic of the storage system is that there is a limit on the size of the value. At the same time, there is a feature that the whole storage is taken.
  • Embodiments of the present invention provide a method and apparatus for operating a key-value pair, which can solve the problem of operating multiple key-value pairs at a time in a scenario where atomicity and persistence must be ensured when using a key-value pair system.
  • the method for operating a key-value pair includes:
  • the operation device of the key value pair provided by the embodiment of the present invention includes:
  • a creating unit configured to create a shadow log for the key value pair transmitted by the upper layer application system, where the key value pair includes a key and a value, wherein the shadow log records an operation type of the key value pair, the key, and the Value, the type of the value;
  • a log storage unit configured to write the shadow log to a key value storage system
  • a key-value pair storage unit configured to write the key-value pair to the key-value storage system when the shadow log is successfully written to the key-value storage system.
  • the embodiments of the present invention have the following advantages:
  • the upper layer application system transmits only when the shadow log is successfully written into the key value storage system.
  • the key-value pair is written to the key-value storage system. Since the shadow log created for the key-value pair has the type of operation, key, value, and value of the key-value pair, and the shadow log can be written to the key-value storage system, Writing a key-value pair to a key-value storage system also guarantees the atomicity and persistence of transactions consisting of key-value pairs.
  • FIG. 1 is a schematic diagram of a method for operating a key-value pair according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a shadow log according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of an apparatus for operating a key value pair according to an embodiment of the present invention. detailed description
  • Embodiments of the present invention provide a method and apparatus for operating a key-value pair, which can solve the problem of operating multiple key-value pairs at a time in a scenario where atomicity and persistence must be ensured when using a key-value pair system.
  • a method for operating a key-value pair includes: 101. Create a shadow log for the key value pair transmitted by the upper application system, the key value pair includes a key and a value, and the operation type, key, value, and value type of the key value pair are recorded in the shadow log.
  • the upper application system needs to write the key value pair to the key value storage system, but in order to ensure the atomicity and durability of the transaction, the upper application system may first transmit the key value pair to the embodiment provided by the embodiment of the present invention.
  • the operation device of the key value pair after the operation device of the key value pair obtains the key value pair from the upper application system, creates a shadow log (the full name of the shadow log) for the key value pair, and the shadow log has both a shadow copy and a log system. characteristic.
  • the key value pair transmitted by the upper application system includes two parts: a key (key) and a value (value).
  • the operation type and key of the key value pair are recorded in the shadow log created by the key value pair.
  • a value of the value, and the operation device of the key value pair in the embodiment of the present invention may transmit a series of key value pairs (ie, a set of key value pairs or multiple key value pairs) for the upper application system to create a shadow, The type of operation for each key-value pair, the key and value for each key-value pair, and the type of each value are recorded in the shadow log.
  • the key and the value of the key value pair, the type of the operation, and the type of the value are first recorded, so that the core can be restored as it is in the event of a failure.
  • the operation types include insert (put), get (get), and delete (delete), where put: will specify the corresponding key
  • Value is inserted into the key value storage system; get: Gets the specified key from the key value storage system to get the specified value; delete: Deletes the value corresponding to the specified key from the key value storage system.
  • the key value pair transmitted by the upper application system may create a shadow log, which may include the following steps:
  • Al generating log data according to the key value pair, wherein the log data includes a shadow key and a value, and the shadow key is a copy of the key;
  • A2 Generate log metadata according to the key value pair, where the log metadata includes a key, a value, a type of the value, and an operation type of the key-value pair.
  • the log data generated in step A1 (English full name is log data) includes a shadow key (in English, the full name of the shadow key) and a value (the value is exactly the same as the value in the key-value pair), and the shadow key is the key in the key-value pair.
  • the shadow key generation rule can be: "prefix” + "shadow log ID” + “serial number", for example, the key is keyl, then the generated key-value pair can be shadowlog# ⁇ shadowname > #keyl,
  • the shadow key is generated and then matched with the value of the original key value pair to constitute the log data.
  • the key value pair is included.
  • Key, value, value type, operation type where operation type refers to what operation is performed by the upper application system on the key value pair, specifically, operations such as insert or delete, value
  • the type refers to what type of data the value in the key-value pair belongs to.
  • the upper-level application system transmits a series of key-value pairs, the type of the value can be divided into different types according to the type of the value.
  • the key-value pairs of the same type of values are divided into a group, only need to be represented by a type of value without repeating the record, and the value recorded in the key-value pair is binary data in the shadow log, only through
  • the value type of this parameter can be used to restore the original key value to the median value, laying the cornerstone for the original recovery.
  • the shadow log created by the process of the step A1 and the step A2 includes the log data and the log metadata.
  • the status parameter can also be carried in the shadow log, and the status parameter is used. Identifies whether the shadow log in step 102 is successfully written to the key value storage system. For example, two different states may be preset for the state parameter: successful (Yes) and unsuccessful (No), and the state parameter may specifically be included in the log metadata. in.
  • the shadow log is introduced in an actual application scenario.
  • Figure 2 shows the structure of the shadow log.
  • the upper application system transmits three.
  • the key-value pairs are key 1 and value 1, key 2 and value 2, key 3 and value 3.
  • the left side of the dotted line is the original three key-value pairs, and the right side of the dotted line is the specific content of the created shadow log.
  • the shadow log includes log data and log metadata.
  • a shadow key 1 is created according to the key 1: shadow log # ⁇ shadow name> #key1
  • the shadow key 2 is also created according to the key 2: shadow log # ⁇ shadow Name> # ⁇ 2
  • shadow key 1 shadow key 2
  • shadow key 3 shadow log # ⁇ shadow name> #key3
  • shadow key 1 shadow key 2
  • shadow key 3 shadow log # ⁇ shadow name> #key3
  • step 101 may further include the steps before creating a shadow log for the key value pair transmitted by the upper application system: It is determined whether the key value pair transmitted by the upper application system needs to ensure the atomicity and the persistence. If necessary, the triggering step 101 is performed, that is, the judgment mechanism is added before the shadow log is created, and the method provided by the embodiment of the present invention is used to solve the problem.
  • the problem of one-time operation of multiple key-value pairs in an atomic and persistent scenario the process of increasing the judgment performs the method provided by the embodiment of the present invention when the transaction needs to ensure atomicity and durability, so as to be compatible with the existing upper layer.
  • the interaction technology between the application system and the key value storage system can be implemented by encapsulating into a similar batchput/batchdelete interface in practical applications.
  • the implementation of the bulk insert/bulk delete interface provided by the embodiment of the present invention may be implemented by an interface, such as a batch operation, which is not limited herein.
  • step 1 creates a shadow log for the key value pair
  • the created shadow is written into the key value storage system, because the operation type, key, value, and value of the key value pair are recorded in the shadow log.
  • Type write the shadow log to the key value storage system, if it can write successfully, it means that the value recorded in the shadow log can be written into the key value storage system, if the upper application system transmits a series of key value pairs (ie A set of key-value pairs or multiple key-value pairs), if the shadow log is successfully written to the key-value storage system, it means that each value of multiple key-value pairs recorded in the shadow log can be written to the key-value store.
  • the system if the shadow is not successfully written to the storage system, indicates that the value recorded in the shadow log cannot be successfully written to the key value storage system.
  • the state parameter may be carried in the shadow log, and the different parameter values of the state parameter (for example, by Yes and No) respectively indicate that the shadow log is successfully written into the key value storage system or is not successfully written. Enter the key value storage system.
  • the writing of the shadow log to the key value storage system may specifically include the following steps:
  • the shadow log includes log data and log metadata.
  • the log data written to the key value storage system includes a shadow key and a value. If the log data can be successfully written to the key value storage system, the value in the log data is indicated. Can be written to the key value storage system.
  • step B2 after the log data is written to the key value storage system, the log metadata is written to the key value storage system, and the log metadata includes the operation type, key, value, and value type of the key value pair, and the log element.
  • the data is written to the key-value storage system to lay the groundwork for the original key-value pair to recover from the failure.
  • the shadow log is successfully written to the key value storage system, the key value pair is written to the key value storage system.
  • the step 102 writes the shadow log to the key value storage system
  • the key value pair transmitted by the upper application system is written into the key value storage system.
  • the shadow is created.
  • the created shadow log is deleted, and the write failure to the upper application system is failed.
  • the shadow log can be identified by the state parameter carried in the shadow log.
  • the state parameter is unsuccessful, it indicates that the shadow log is not successfully written to the key value storage system, and the shadow log created in step 101 is deleted and applied to the upper layer.
  • the system feedback write fails.
  • the upper application system reconfigures the key value pairs that need to be written to the key value storage system.
  • key values there are many reasons why the shadow log is not successfully written to the key value storage system, such as key values.
  • the storage system has a limit on the size of the value. For example, the key value storage system only supports the maximum size of the key as 1M. A value greater than the 1M limit causes a write failure when the operation is performed, and is set by the key value storage system itself.
  • Constraint conditions cannot be successfully written to the key value storage system when the key value pair does not satisfy the constraint condition.
  • the value cannot be null, the key value storage system disk is full, etc., which can be used as the constraint set by the key value storage system itself.
  • the shadows cannot be successfully written to the key-value storage system because of the key-value pairs recorded in the shadow system.
  • the operation type, key, value, and value type so the original key value pair cannot be successfully written to the key value storage system.
  • the upper layer application system when the shadow log cannot be successfully written into the key value storage system, the upper layer application system
  • the feedback write fails, and the key application pair that needs to be written into the key value storage system is reconfigured by the upper application system, that is, the error can be reported in advance in the embodiment of the present invention, and the error is reported to the upper application system in time.
  • the original key value in the example is not written to the key value storage system at this time, and the error is not found in the WAL mode in the prior art.
  • the key value pair is successfully written into the key value storage system, and the shadow log is deleted. That is, after the trial write function of the shadow log is implemented, the shadow log is not required to be permanently saved in the embodiment of the present invention.
  • the shadow log is created in the embodiment of the present invention to ensure that the original key value pair can be successfully written into the key value storage system, and according to the original
  • the key-value pair creates a shadow log and writes the shadow log to the key-value storage system first, and then writes the original key-value pair to the key-value storage system after the shadow log is successfully written to the key-value storage system.
  • the key value pair is restored according to the type of the operation, the key, the value, and the value;
  • the embodiment of the present invention further provides the original recovery mechanism, extracts the corresponding information of the key-value pair from the shadow log, and then restores the original key-value pair according to the information, that is, performs the step.
  • C2 according to the operation type recorded in the shadow log, the operation type of the original key value pair, according to the type of the key, the value and the value recorded in the shadow log, the original key value pair can be obtained, and the value in the key value pair is recorded in the shadow log.
  • the binary data only the type of the value of the value can be recovered as it is, and the type of the value can be recovered as it is, without the need to follow the current value.
  • the method may further include the step of deleting the created shadow log.
  • the method further includes the following steps: performing periodic asynchronous task inspection on the shadow log.
  • the period of the asynchronous task inspection has not arrived, if the upper application system reads the key value pair from the key value storage system, the trigger will be The key-value pair is written to the operation of the key-value storage system, and then responds to the read request of the upper-layer application system. That is to say, if the cycle of the asynchronous task patrol recovery has not arrived yet, and the upper layer application needs to read the atomic pair that just created the shadow log to ensure the operation of atomicity and persistence, then it is necessary to continue to complete the key value.
  • the status parameter of the shadow log is periodically patrolled.
  • the status parameter indicates that the status parameter is unsuccessful
  • the shadow log can be directly deleted to avoid occupying too much space resources.
  • C1 to C3 and then delete the created shadow log.
  • the period is set to 1 second, which means that the state of the shadow log is polled every 1 second.
  • the operation of the transaction guarantees atomicity and persistence in the embodiment of the present invention.
  • the data set can be added by adding a lock mechanism. All keys are locked for concurrency control for isolation and consistency.
  • the upper layer application system transmits only when the shadow log is successfully written into the key value storage system.
  • the key-value pair is written to the key-value storage system. Since the shadow log created for the key-value pair has the type of operation, key, value, and value of the key-value pair, and the shadow log can be written to the key-value storage system, Writing a key-value pair to a key-value storage system also guarantees the atomicity and persistence of transactions consisting of key-value pairs.
  • the above embodiment describes the operation method of the key value pair provided by the embodiment of the present invention.
  • the operation device of the key value pair provided by the embodiment of the present invention is introduced.
  • the operation device of the key value pair can specifically and the key value.
  • the storage system and the upper application system are completely decoupled and deployed separately between the key value storage system and the upper application system, and are independently formed into a transaction adaptation layer. They can also be distributed in the form of plugins, and the atomicity and persistence of the transaction need to be guaranteed.
  • the operating device of the key value pair provided by the embodiment of the present invention can also be deployed in the key value storage system to expand the existing key value storage system and cannot guarantee the atomicity of multiple key value pairs during operation. Persistence, the application range of the key value storage system is expanded.
  • the operation device of the key value pair provided by the embodiment of the present invention can also be deployed in the upper application system, so that the range of the key value storage system that can be used by the upper application system can be increased. , which helps to reduce costs.
  • the operation device 300 of the key value pair includes:
  • the creating unit 301 is configured to create a shadow log for the key value pair transmitted by the upper application system, where the key value pair includes a key and a value, and the operation type, the key, the value, and the value type of the key value pair are recorded in the shadow log;
  • the key value pair storage unit 303 is configured to write the key value pair to the key value storage system when the shadow log is successfully written to the key value storage system.
  • the actual application may include: a first generation module, configured to generate log data according to the key value pair, where the log data includes a shadow key and a value, and the shadow key is a copy of the key;
  • the second generation module is configured to generate log metadata according to the key value pair, where the log metadata includes a key, a value, a type of the value, and an operation type.
  • log storage unit 302 may specifically include:
  • a first writing module configured to write log data into the key value storage system
  • a second writing module configured to write log metadata to the key value storage system.
  • the operation device 300 of the key value pair may further be: a failure processing unit 304, configured to be created when the shadow log is not successfully written to the key value storage system. The shadow log is deleted, and the upper layer application system write fails.
  • the operation device 300 of the key value pair may further be a unit: a first deletion unit 305, configured to successfully write the key value pair to the key value storage system, delete Shadow log.
  • the operation device 300 of the key value pair may also be as follows:
  • the obtaining unit 306 is configured to: if the key value pair is not successfully written into the key value storage system, obtain the type of the operation type, the key, the value, and the value from the shadow log;
  • the restoring unit 307 is configured to restore the key value pair according to the operation type, the key, the value, and the value; the key value pair storage unit 308 is configured to write the restored key value pair to the key value storage system.
  • the second deletion unit 309 is configured to delete the created shadow message after the key value is stored in the heavy storage unit.
  • the method may further include: The patrol unit (not shown in FIG. 3) is configured to perform periodic asynchronous task patrol on the shadow log.
  • the patrol unit (not shown in FIG. 3) is configured to perform periodic asynchronous task patrol on the shadow log.
  • the upper application system reads the key value from the key value storage system. Yes, triggers the operation of writing the key-value pair to the key-value storage system, and then responds to the read request of the upper-layer application system.
  • the method may further include: a determining unit (not shown in FIG. 3), configured to determine whether the key value pair transmitted by the upper application system needs to ensure atomicity and persistence, and if necessary, the trigger creating unit 301 performs .
  • the log storage unit since the creating unit first creates a shadow log for the key value pair, the log storage unit first writes the shadow log to the key value storage system, and only when the shadow log is successfully written into the key value storage system, the key value pair The storage unit writes the key value pairs transmitted by the upper application system to the key value storage system, because the shadow log records created for the key value pairs have the operation type, key, value, and value type of the key value pair, and the shadow log can When written to the key-value storage system, writing the key-value pairs to the key-value storage system ensures the atomicity and persistence of the transactions consisting of the key-value pairs.

Abstract

一种键值对的操作方法及装置,其中方法包括:为上层应用系统传送的键值对创建影子日志,所述键值对包括键和值,所述影子日志中记录有所述键值对的操作类型、所述键、所述值、所述值的类型;将所述影子日志写入键值存储系统;若所述影子日志被成功写入所述键值存储系统,将所述键值对写入所述键值存储系统。

Description

一种键值对的操作方法及装置
技术领域
本发明实施例涉及计算机技术领域,尤其涉及一种键值对的操作方法及装 置。 背景技术
在数据库系统中,一个事务是指由一系列数据库操作序列组成的一个完整 的逻辑过程。 例如银行转帐, 从原账户扣除金额, 以及向目标账户添加金额, 这两个数据库操作的总和, 构成一个完整的逻辑过程, 不可拆分, 这个过程就 被称为一个事务,一个事务具有四大特性(英文筒称 ACID: 原子性 atomicity, 一致' I"生 consistency, 隔离 'I"生 isolation, 持久' I"生 durability )。
键值(Key- Value )存储系统具有艮高的可伸缩性和鲁棒性, 已经在越来 越多的数据库系统中得到了广泛的使用, 但是通常 Key- Value存储系统在提供 基于一个键值 ( key- value )对的插入(put ) /获取(get ) /删除(delete )接口 时能够保证原子性和一致性, 但是 Key- Value存储系统对 Value的大小存在限 制, 而且对 key-value对的操作是整存整取的操作方式, 没有提供能保证一次 性 put/delete多个 key- value对的接口, 也就是说现有的 Key- Value存储系统无 法解决在必须保证原子性和持久性的场景中一次性 put/delete多个 key-value对 的问题。
在计算机科学中, 为了实现一个事务的原子性和持久性,现有技术中存在 一种预写式日志(WAL, Write Ahead Logging )的方式, 预写式日志是关系数 据库系统中用于提供原子性和持久性(ACID属性中的两个) 的一系列技术, 在使用 WAL的系统中,所有的操作在提交之前都要先写入日志( log )文件中, log 文件中通常包括重做(redo )和^销 (undo )信息。 这样做的目的可以通 过一个例子来说明: 假设一个程序在执行某些操作的过程中机器掉电了,在重 新启动时,程序可能需要知道当时执行的操作是成功了还是部分成功或者是失 败了, 如果使用了 WAL, 程序就可以检查 log文件, 并对突然掉电时计划执 行的操作内容跟实际上执行的操作内容进行比较,在这个比较的基础上,程序 就可以决定是保持原样还是继续完成剩余的操作, 或者是 4敦销已做的操作。 但是现有技术中通过 WAL 方式实现事务的原子性和持久性的技术方案 中, 至少存在以下缺陷: 1、 实现过程复杂且效率低, WAL是系统级的日志系 统, 对所有更新操作都需要记录下来 log文件, 以用于出现故障后恢复系统, 而大部分的单一 put/delete操作都是本身就由 key- value存储系统保证了原子性 和持久性的, 故并不需要重复记录 log文件, 另外当使用 WAL的系统出现故 障之后, 需要从庞大的日志系统中找到出错的点对应的日志段才能进行恢复, 且需要比较复杂的检查点机制; 2、 WAL记录的是操作日志, 出现故障时需要 通过操作重放或者找到对应的反向操作进行回退, 而基于 Key- Value存储系统 的应用中有些场景在下次重做或反向操作的时候计算出来的 key和 value是不 能保证跟上次执行时计算出来的结果完全一样, 这就导致无法恢复系统; 3、 由于 key- value存储系统的特点是对 value的大小存在限制,同时还有个特点是 整存整取, 也就是说对于 value的任何一次修改都必须将整个 value取出来增 加或者删除 value内部部分内容然后再将整个 value写进去, 这就导致有可能 记录下来的操作日志在下次用于恢复的时候发现 value过大而写不进去, 导致 恢复系统失败。
综上所述, 现有的 WAL方式并不能用于键值存储系统解决在必须保证原 子性和持久性的场景中一次性插入或删除多个键值对的问题,这就使得在使用 键值存储系统时解决在必须保证原子性和持久性的场景中一次性对多个键值 对进行操作成为一个难题。 发明内容
本发明实施例提供了一种键值对的操作方法及装置,能够解决使用键值对 系统时在必须保证原子性和持久性的场景中一次性对多个键值对进行操作的 问题。
一方面, 本发明实施例提供的键值对的操作方法, 包括:
为上层应用系统传送的键值对创建影子日志, 所述键值对包括键和值, 所 述影子日志中记录有所述键值对的操作类型、所述键、所述值、所述值的类型; 将所述影子日志写入键值存储系统;
若所述影子日志被成功写入所述键值存储系统,将所述键值对写入所述键 值存储系统。 另一方面, 本发明实施例提供的键值对的操作装置, 包括:
创建单元, 用于为上层应用系统传送的键值对创建影子日志, 所述键值对 包括键和值,所述影子日志中记录有所述键值对的操作类型、所述键、所述值、 所述值的类型;
日志存储单元, 用于将所述影子日志写入键值存储系统;
键值对存储单元, 用于当所述影子日志被成功写入所述键值存储系统时, 将所述键值对写入所述键值存储系统。
从以上技术方案可以看出, 本发明实施例具有以下优点:
本发明实施例中, 由于首先为键值对创建影子日志, 然后先将该影子曰志 写入键值存储系统,只有在影子日志被成功写入键值存储系统时才将上层应用 系统传送的键值对写入到键值存储系统,由于为键值对创建的影子日志记录有 键值对的操作类型、键、值、值的类型, 而影子日志能够被写入键值存储系统, 则将键值对写入键值存储系统也就能够保证由键值对组成的事务的原子性和 持久性。 附图说明
图 1为本发明实施例提供的键值对的操作方法的一个示意图;
图 2为本发明实施例提供的影子日志的结构示意图;
图 3为本发明实施例提供的键值对的操作装置的一个示意图。 具体实施方式
本发明实施例提供了一种键值对的操作方法及装置,能够解决使用键值对 系统时在必须保证原子性和持久性的场景中一次性对多个键值对进行操作的 问题。
为使得本发明的发明目的、 特征、优点能够更加的明显和易懂, 下面将结 合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、 完整地描 述,显然,下面所描述的实施例仅仅是本发明一部分实施例,而非全部实施例。 基于本发明中的实施例, 本领域的技术人员所获得的所有其他实施例,都属于 本发明保护的范围。
请参阅图 1 , 本发明实施例提供的键值对的操作方法, 包括: 101、 为上层应用系统传送的键值对创建影子日志, 键值对包括键和值, 影子日志中记录有键值对的操作类型、 键、 值、 值的类型。
在本发明实施例中, 上层应用系统需要将键值对写入键值存储系统,但是 为了保证事务的原子性和持久性,上层应用系统可以先将键值对传送给本发明 实施例提供的键值对的操作装置,键值对的操作装置从上层应用系统获取到键 值对后, 为该键值对创建影子日志 (英文全称 shadow log ) , 该影子日志同时 具有影子拷贝和日志系统的特性。
需要说明的是, 上层应用系统传送的键值对包括键 ( key )和值(value ) 两部分, 本发明实施例中为键值对创建的影子日志中记录有键值对的操作类 型、键、 值以及该值的类型, 另外本发明实施例中键值对的操作装置可以为上 层应用系统传送一系列键值对(即一组键值对或多个键值对)创建影子曰志, 在影子日志中记录各个键值对的操作类型、各个键值对的键和值以及每一个值 的类型。 本发明实施例中影子日志中将键值对的键和值、 操作类型、 值的类型 都先记录下来, 为能够在出现故障时能够原样恢复打下基石出。操作类型包括插 入(put )、 获取(get )、 删除(delete )三种, 其中, put: 将指定 Key对应的
Value插入到键值存储系统中; get: 将指定 key从键值存储系统中获取指定 value; delete: 将指定 Key对应的 value从键值存储系统中删除。
需要说明的是,本发明实施例中为上层应用系统传送的键值对创建影子日 志具体可以包括步骤:
Al、 根据键值对生成日志数据, 其中, 日志数据包括影子键和值, 影子 键为键的副本;
A2、 根据键值对生成日志元数据, 其中, 日志元数据中包括键、 值、 值 的类型以及键值对的操作类型。
对于步骤 A1生成的日志数据 (英文全称为 log data ) 包括影子键(英文 全称为 shadow key )和值(该值和键值对中的值完全相同), 影子键是键值对 中的键的副本, 在实际应用中, 影子键的生成规则具体可以为: "前缀" + "影 子日志 ID" + "序列号",例如,键为 keyl , 则生成的键值对可以为 shadowlog# < shadowname > #keyl, 当实际应用中也可以采用其他的方式根据键值对的键 为其生成影子键, 影子键生成后再配上原来键值对中的值就构成日志数据了。
对于步骤 A2生成的日志元数据(英文全称为 log metadata )中包括键值对 的键、 值、 值的类型、 操作类型, 其中, 操作类型指的是上层应用系统对该键 值对进行什么样的操作, 具体可以指插入(put )或删除(delete )等操作, 值 的类型指的是键值对中的值属于什么类型的数据,当上层应用系统传送一系列 键值对时,通过值的类型的区分能够将各个键值对根据值的类型的不同划分为 不同的组,将值的类型相同的键值对划分为一个组, 只需要用一个值的类型代 表即可而不需要重复记录, 另外键值对中的值记录在影子日志中是二进制数 据, 只有通过值的类型这一参数才能原样恢复出原键值对中值是什么类型, 为 原样恢复打下基石出。
需要说明的是, 通过步骤 A1和步骤 A2的生成过程, 创建的影子日志其 实包括日志数据和日志元数据,在实际应用中,还可以在影子日志中携带状态 参数 ( status ) , 状态参数用于标识步骤 102中影子日志是否被成功写入键值存 储系统,例如可以为状态参数预置两个不同的状态:成功( Yes )和未成功( No ), 该状态参数具体可以包括在日志元数据中。
为了详细说明本发明实施例中创建的影子日志,接下来以一个实际的应用 场景来介绍影子日志, 如图 2所示为影子日志的结构示意图, 在图 2中, 上层 应用系统传送了 3个键值对, 分別为键 1和值 1、 键 2和值 2、 键 3和值 3 , 虚线的左侧是原始的 3个键值对, 虚线的右侧是创建的影子日志的具体内容, 影子日志包括日志数据和日志元数据,在日志数据中,根据键 1创建了影子键 1 : 影子日志#〈影子名称〉 #键1 , 同样根据键 2创建了影子键 2: 影子日志# 〈影子名称〉 #键2, 根据键 3创建了影子键 3: 影子日志#〈影子名称〉 #键3 , 并且影子键 1、 影子键 2、 影子键 3分別配上了原始的键值对中的值 1、 值 2、 值 3 , 在日志元数据中包括: 影子日志的名称、 状态参数、 值的类型列表、 影 子数据信息列表,影子日志的名称为:影子日志#元数据 #影子名称#序列号(英 文全称为 shadowlog#metadata#shadowname#serialnumber ), ^夫态参数包括成功 (英文缩写 Y )和未成功(英文缩写为 N )两种, 值的类型列表(英文全称为 value class name list ) 中分別记录了 3个键值对的值的类型, 影子数据信息列 表 (英文全称为 shadow data info list ),在每一个影子数据信息中包括有三个参 数: 影子键、 操作类型、 值的类型。
需要说明的是,在本发明实施例中, 步骤 101为上层应用系统传送的键值 对创建影子日志之前还可以包括步骤: 判断上层应用系统传送的键值对是否需要保证原子性和持久性, 若需要, 触发步骤 101执行, 即在创建影子日志之前增加判断机制, 本发明实施例提供 的方法是用于解决在必须保证原子性和持久性的场景中一次性对多个键值对 进行操作的问题,增加判断的过程在事务需要保证原子性和持久性时执行本发 明实施例提供的方法, 以兼容现有的上层应用系统和键值存储系统的交互技 术, 在实际应用中, 可以通过封装成类似批量插入 ( batchput ) /批量删除 ( batchdelete )接口来实现, 当需要对事务的操作保证原子性和持久性时可以 调用本发明实施例提供的批量插入 /批量删除的接口来实现, 也可以封装成一 个接口例如批量操作 ( batchoperation )来实现, 此处仅作说明不作限定。
102、 将影子日志写入键值存储系统。
在本发明实施例中, 步骤 1为键值对创建影子日志之后,将创建的影子曰 志写入键值存储系统中, 由于影子日志中记录有键值对的操作类型、 键、 值、 值的类型, 将影子日志写入键值存储系统, 若能够写入成功, 则表示影子日志 中记录的值能够被写入键值存储系统中,若上层应用系统传送了一系列键值对 (即一组键值对或多个键值对), 若影子日志被写入键值存储系统成功了, 则 表示影子日志中记录的多个键值对的每个值都能够被写入键值存储系统,若影 子曰志写入存储系统未成功则说明影子日志中记录的值不能够被成功写入键 值存储系统。
在实际应用中,如前述描述可以在影子日志中携带状态参数, 用该状态参 数的不同参数值(例如通过 Yes和 No )分別表示影子日志被成成功写入键值 存储系统或未被成功写入键值存储系统。
需要说明的是,在本发明实施例中,将影子日志写入键值存储系统具体可 以包括步骤:
B1、 将日志数据写入键值存储系统;
B2、 将日志元数据写入所述键值存储系统。
影子日志包括日志数据和日志元数据, 对于步骤 B1 , 写入键值存储系统 的日志数据包括影子键和值, 若日志数据能够被成功写入键值存储系统, 则说 明该日志数据中的值能够被写入键值存储系统。
对于步骤 B2, 将日志数据写入键值存储系统之后, 将日志元数据写入键 值存储系统, 日志元数据包括键值对的操作类型、 键、 值、 值的类型, 日志元 数据被写入键值存储系统为原始键值对出现故障时的原样恢复打下基石出。
103、若影子日志被成功写入键值存储系统,将键值对写入键值存储系统。 在本发明实施例中, 当步骤 102将影子日志写入键值存储系统成功时,将 上层应用系统传送的键值对写入键值存储系统,在本发明实施例中,是在创建 的影子日志被成功写入键值存储系统之后才将上层应用系统传送的原始键值 对写入键值存储系统中, 当上层应用系统传送的原始键值对为多个时, 由于为 这些个键值对创建的影子日志能够被成功写入键值存储系统,故这些多个键值 对也能够保证都被写入键值存储系统,能够保证由这些键值对组成的事件被操 作的原子性和持久性, 其中,原子性指的是事务的全部操作集合在数据库中要 么全部正确反映、要么全部不反映的特性,持久性指的是一个事务成功完成后, 它对数据库的更改便持久地保存在数据库之中, 并且是完全的, 即使系统可能 出现故障。 并列的步骤:
若影子日志没有被成功写入键值存储系统,将创建的影子日志删除, 并向 上层应用系统反馈写入失败。
例如, 可以通过在影子日志中携带的状态参数来识別, 当状态参数为未成 功时,表示影子日志没有被成功写入键值存储系统,将步骤 101中创建的影子 日志删除并向上层应用系统反馈写入失败,由上层应用系统对需要写入键值存 储系统的键值对进行重新配置, 需要说明的是,影子日志没有被成功写入键值 存储系统的原因有很多, 例如键值存储系统对值的大小存在限制,如键值存储 系统只支持键的大小最大为 1M, 大于这个 1M限制的值在进行操作时就会发 生写入失败,又如键值存储系统自身设定的约束条件当键值对不满足该约束条 件时无法成功写入键值存储系统, 例如值不能为空、键值存储系统磁盘被写满 等均可以作为键值存储系统自身设定的约束条件,当这些约束条件不满足时影 子曰志就无法成功被写入键值存储系统,由于影子系统中记录有键值对的操作 类型、 键、 值、 值的类型, 所以原始的键值对也无法成功写入键值存储系统, 在本发明实施例中,当影子日志无法成功写入键值存储系统时向上层应用系统 反馈写入失败,由上层应用系统对需要写入键值存储系统的键值对进行重新配 置, 即本发明实施例中能够提前报错, 及时报错给上层应用系统, 而本发明实 施例中原始的键值对此时并没有写入键值存储系统,而不用按照现有技术中通 过 WAL方式在故障恢复时才发现错误。 将键值对成功写入键值存储系统,删除影子日志, 即当影子日志的试写入功能 实现之后, 本发明实施例中并不需要永久性的保存该影子日志, 这和现有技术 中 WAL方式中每一个操作在提交之前都需要保存在日志文件中是不同的, 本 发明实施例中创建影子日志主要是为了保证原始的键值对能够成功写入键值 存储系统, 而根据原始的键值对创建了影子日志, 并且先将影子日志写入到键 值存储系统,在影子日志成功写入键值存储系统之后再将原始的键值对写入键 值存储系统。
Cl、 若将键值对没有成功写入键值存储系统, 从影子日志中获取操作类 型、 键、 值、 值的类型;
C2、 根据操作类型、 键、 值、 值的类型还原出键值对;
C3、 将还原后的键值对写入键值存储系统。
也就是说,在步骤 103执行失败时,本发明实施例还提供的原样恢复机制, 从影子日志中提取键值对的相应信息,然后根据这些信息原样恢复出原始的键 值对, 即执行步骤 C2, 根据影子日志中记录的操作类型得到原键值对的操作 类型、 根据影子日志中记录的键、值以及值的类型可以得到原键值对, 另外键 值对中的值记录在影子日志中是二进制数据,只有通过值的类型这一参数才能 原样恢复出原键值对中值是什么类型,通过该值的类型就能够原样恢复出原键 值对中的值, 而不需要按照现有技术中采用的 WAL方式来恢复键和值, 避免 了按照现有的方式再次执行计算出来的结果不完全一样的问题,然后将还原的 键值对写入键值存储系统。 当上层应用系统传送多个键值对时,将多个键值对 写入键值存储系统时, 可能存在部分写入失败的情况, 那么本发明实施例中通 过日志元数据中包括的内容就直接可以恢复出原始的键值对,将还原后的键值 对写入键值存储系统即可。
在将还原后的键值对写入键值存储系统之后还可以包括步骤:将创建的影 子日志删除。
需要说明的是,在本发明实施例中, 为了保证任何一个过程中出错都能够 恢复, 在步骤 101之后还可以包括步骤: 对影子日志进行周期异步任务巡检, 在异步任务巡检的周期还没到来时,若上层应用系统向键值存储系统读取键值 对,触发将键值对写入键值存储系统的操作, 然后再响应上层应用系统的读取 请求。 也就是说, 如果异步任务巡检恢复的周期还没到来, 而这个时候上层应 用需要读取刚创建了影子日志用于保证原子性和持久性的操作的原子对,则需 要继续完成将键值对写入键值存储系统的操作,然后向上层应用系统反馈需要 读取的键值对。例如周期性的巡检影子日志的状态参数, 当状态参数表示未成 功时, 可以直接删除影子日志, 以避免占用过多的空间资源, 当状态参数表示 成功时,可以进行重做,即执行步骤 C1至 C3 ,然后再将创建的影子日志删除, 例如, 周期设定 1秒, 就是指每隔 1秒就轮询一下影子日志的状态。
以上实施例介绍了本发明实施例对事务的操作保证了原子性以及持久性, 为了能够进一步的保证事务的其它两个特性(隔离性和一致性), 可以通过增 加锁机制,对数据集中的所有键进行加锁来进行并发控制,从而实现隔离性以 及一致性。
本发明实施例中, 由于首先为键值对创建影子日志, 然后先将该影子曰志 写入键值存储系统,只有在影子日志被成功写入键值存储系统时才将上层应用 系统传送的键值对写入到键值存储系统,由于为键值对创建的影子日志记录有 键值对的操作类型、键、值、值的类型, 而影子日志能够被写入键值存储系统, 则将键值对写入键值存储系统也就能够保证由键值对组成的事务的原子性和 持久性。
以上实施例介绍了本发明实施例提供的键值对的操作方法,接下来介绍本 发明实施例提供的键值对的操作装置, 在实际应用中,键值对的操作装置具体 可以和键值存储系统和上层应用系统完全解耦,单独部署在键值存储系统和上 层应用系统之间, 独立成一个事务适配层, 也可以以插件的形式发布, 在需要 保证事务的原子性和持久性时直接运行,当然本发明实施例提供的键值对的操 作装置还可以部署在键值存储系统中,以扩大现有的键值存储系统无法保证多 个键值对在操作时的原子性和持久性, 扩大键值存储系统的应用范围, 当然本 发明实施例提供的键值对的操作装置还可以部署在上层应用系统中,这样就能 够增加上层应用系统能够使用的键值存储系统的范围, 从而有利于降低成本。
如图 3所示, 键值对的操作装置 300, 包括: 创建单元 301 , 用于为上层应用系统传送的键值对创建影子日志, 其中, 键值对包括键和值,影子日志中记录有键值对的操作类型、键、值、值的类型; 曰志存储单元 302, 用于将影子日志写入键值存储系统;
键值对存储单元 303 , 用于当影子日志被成功写入键值存储系统时, 将键 值对写入键值存储系统。
需要说明的是, 对于创建单元 301而言, 在实际应用中, 具体可以包括: 第一生成模块, 用于根据键值对生成日志数据, 其中, 日志数据包括影子 键和值, 影子键为所述键的副本;
第二生成模块, 用于根据键值对生成日志元数据, 日志元数据中包括键、 值、 值的类型、 操作类型。
需要说明的是, 对于日志存储单元 302而言, 在实际应用中, 具体可以包 括:
第一写入模块, 用于将日志数据写入键值存储系统;
第二写入模块, 用于将日志元数据写入所述键值存储系统。
如图 3所示,在日志存储单元 302执行之后,键值对的操作装置 300还可 以如下单元: 失败处理单元 304, 用于当影子日志没有被成功写入键值存储系 统时, 将创建的影子日志删除, 并向上层应用系统反馈写入失败,
如图 3所示, 在键值对存储单元 303执行之后, 键值对的操作装置 300 还可以如下单元:第一删除单元 305 ,用于若将键值对成功写入键值存储系统, 删除影子日志。
如图 3所示, 在键值对存储单元 303执行之后, 键值对的操作装置 300 还可以如下单元:
获取单元 306, 用于若将键值对没有成功写入键值存储系统, 从影子日志 中获取操作类型、 键、 值、 值的类型;
还原单元 307, 用于根据操作类型、 键、 值、 值的类型还原出键值对; 键值对重存储单元 308, 用于将还原后的键值对写入键值存储系统。
在键值对重存储单元 308执行之后,键值对的操作装置 300还可以如下单 元: 第二删除单元 309, 用于在键值对重存储单元执行之后将创建的影子曰志 删除。
需要说明的是,在本发明实施例中,在创建单元 301执行之后还可以包括: 巡检单元(未在图 3中示出), 用于对影子日志进行周期异步任务巡检, 在异 步任务巡检的周期还没到来时, 若上层应用系统向键值存储系统读取键值对, 触发将键值对写入键值存储系统的操作, 然后再响应上层应用系统的读取请 求。 在创建单元 301执行之前还可以包括: 判断单元(未在图 3中示出), 用 于判断上层应用系统传送的键值对是否需要保证原子性和持久性, 若需要, 触 发创建单元 301执行。
需要说明的是, 上述装置各模块 /单元之间的信息交互、 执行过程等内容, 由于与本发明方法实施例基于同一构思,其带来的技术效果与本发明方法实施 例相同, 具体内容可参见本发明如图 1所示的方法实施例中的叙述, 此处不再 赘述。
本发明实施例中, 由于创建单元首先为键值对创建影子日志, 然后日志存 储单元先将该影子日志写入键值存储系统,只有在影子日志被成功写入键值存 储系统时键值对存储单元才将上层应用系统传送的键值对写入到键值存储系 统, 由于为键值对创建的影子日志记录有键值对的操作类型、 键、 值、 值的类 型, 而影子日志能够被写入键值存储系统, 则将键值对写入键值存储系统也就 能够保证由键值对组成的事务的原子性和持久性。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤 是可以通过程序来指令相关的硬件完成,该程序可以存储于一种计算机可读存 储介质中, 上述提到的存储介质可以是只读存储器, 磁盘或光盘等。
以上对本发明所提供的一种键值对的操作方法及装置进行了详细介绍,对 于本领域的一般技术人员,依据本发明实施例的思想,在具体实施方式及应用 范围上均会有改变之处, 因此, 本说明书内容不应理解为对本发明的限制。

Claims

权 利 要 求
1、 一种键值对的操作方法, 其特征在于, 包括:
为上层应用系统传送的键值对创建影子日志, 所述键值对包括键和值, 所 述影子日志中记录有所述键值对的操作类型、所述键、所述值、所述值的类型; 将所述影子日志写入键值存储系统;
若所述影子日志被成功写入所述键值存储系统,将所述键值对写入所述键 值存储系统。
2、 根据权利要求 1所述的键值对的操作方法, 其特征在于, 所述为上层 应用系统传送的键值对创建影子日志包括:
根据所述键值对生成日志数据, 所述日志数据包括影子键和所述值, 所述 影子键为所述键的副本;
根据所述键值对生成日志元数据,所述日志元数据中包括所述键、所述值、 所述值的类型、 所述操作类型。
3、 根据权利要求 2所述的键值对的操作方法, 其特征在于, 所述将所述 影子日志写入键值存储系统包括:
将所述日志数据写入所述键值存储系统;
将所述日志元数据写入所述键值存储系统。
4、 根据权利要求 1所述的键值对的操作方法, 其特征在于, 所述方法还 包括:
若所述影子日志没有被成功写入所述键值存储系统,将创建的影子日志删 除, 并向所述上层应用系统反馈写入失败。
5、 根据权利要求 1或 4所述的键值对的操作方法, 其特征在于, 所述影 子曰志中携带有状态参数,所述状态参数用于标识所述影子日志是否被成功写 入所述键值存储系统。
6、 根据权利要求 1所述的键值对的操作方法, 其特征在于, 所述方法还 包括: 若将所述键值对成功写入所述键值存储系统, 删除所述影子日志。
7、 根据权利要求 1所述的键值对的操作方法, 其特征在于, 所述方法还 包括:
若将所述键值对没有成功写入所述键值存储系统,从所述影子日志中获取 所述操作类型、 所述键、 所述值、 所述值的类型; 根据所述操作类型、 所述键、 所述值、 所述值的类型还原出键值对; 将还原后的键值对写入所述键值存储系统。
8、 根据权利要求 7所述的键值对的操作方法, 其特征在于, 所述将还原 后的键值对写入所述键值存储系统之后还包括: 将创建的影子日志删除。
9、 根据权利要求 1所述的键值对的操作方法, 其特征在于, 所述为上层 应用系统传送的键值对创建影子日志之后, 还包括:
对所述影子日志进行周期异步任务巡检;
在所述异步任务巡检的周期还没到来时,若所述上层应用系统向所述键值 存储系统读取所述键值对,触发将键值对写入键值存储系统的操作, 然后再响 应所述上层应用系统的读取请求。
10、 根据权利要求 1所述的键值对的操作方法, 其特征在于, 所述为上层 应用系统传送的键值对创建影子日志之前, 还包括:
判断所述上层应用系统传送的键值对是否需要保证原子性和持久性,若需 要, 触发所述为上层应用系统传送的键值对创建影子日志执行。
11、 一种键值对的操作装置, 其特征在于, 包括:
创建单元, 用于为上层应用系统传送的键值对创建影子日志, 所述键值对 包括键和值,所述影子日志中记录有所述键值对的操作类型、所述键、所述值、 所述值的类型;
日志存储单元, 用于将所述影子日志写入键值存储系统;
键值对存储单元, 用于当所述影子日志被成功写入所述键值存储系统时, 将所述键值对写入所述键值存储系统。
12、 根据权利要求 11所述的键值对的操作装置, 其特征在于, 所述创建 单元包括:
第一生成模块, 用于根据所述键值对生成日志数据, 所述日志数据包括影 子键和所述值, 所述影子键为所述键的副本;
第二生成模块, 用于根据所述键值对生成日志元数据, 所述日志元数据中 包括所述键、 所述值、 所述值的类型、 所述操作类型。
13、 根据权利要求 12所述的键值对的操作装置, 其特征在于, 日志存储 单元包括:
第一写入模块, 用于将所述日志数据写入所述键值存储系统; 第二写入模块, 用于将所述日志元数据写入所述键值存储系统。
14、 根据权利要求 11所述的键值对的操作装置, 其特征在于, 所述装置 还包括:
失败处理单元, 用于当所述影子日志没有被成功写入所述键值存储系统 时, 将创建的影子日志删除, 并向所述上层应用系统反馈写入失败。
15、 根据权利要求 11所述的键值对的操作装置, 其特征在于, 所述装置 还包括:
第一删除单元, 用于若将所述键值对成功写入所述键值存储系统,删除所 述影子日志。
16、 根据权利要求 11所述的键值对的操作装置, 其特征在于, 所述装置 还包括:
获取单元, 用于若将所述键值对没有成功写入所述键值存储系统,从所述 影子日志中获取所述操作类型、 所述键、 所述值、 所述值的类型;
还原单元, 用于根据所述操作类型、 所述键、 所述值、 所述值的类型还原 出键值对;
键值对重存储单元, 用于将还原后的键值对写入所述键值存储系统。
17、 根据权利要求 16所述的键值对的操作装置, 其特征在于, 所述装置 还包括:
第二删除单元,用于在所述键值对重存储单元执行之后将创建的影子曰志 删除。
18、 根据权利要求 11所述的键值对的操作装置, 其特征在于, 所述装置 还包括:
巡检单元, 用于对所述影子日志进行周期异步任务巡检,在所述异步任务 巡检的周期还没到来时,若所述上层应用系统向所述键值存储系统读取所述键 值对,触发将键值对写入键值存储系统的操作, 然后再响应所述上层应用系统 的读取请求。
19、 根据权利要求 11所述的键值对的操作装置, 其特征在于, 所述装置 还包括:
判断单元,用于判断所述上层应用系统传送的键值对是否需要保证原子性 和持久性, 若需要, 触发所述创建单元执行。
PCT/CN2011/084320 2011-12-21 2011-12-21 一种键值对的操作方法及装置 WO2013091183A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201180003583.8A CN103502970B (zh) 2011-12-21 2011-12-21 一种键值对的操作方法及装置
PCT/CN2011/084320 WO2013091183A1 (zh) 2011-12-21 2011-12-21 一种键值对的操作方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/084320 WO2013091183A1 (zh) 2011-12-21 2011-12-21 一种键值对的操作方法及装置

Publications (1)

Publication Number Publication Date
WO2013091183A1 true WO2013091183A1 (zh) 2013-06-27

Family

ID=48667642

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/084320 WO2013091183A1 (zh) 2011-12-21 2011-12-21 一种键值对的操作方法及装置

Country Status (2)

Country Link
CN (1) CN103502970B (zh)
WO (1) WO2013091183A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108287832A (zh) * 2017-01-09 2018-07-17 上海掌门科技有限公司 插入标签的方法和装置

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103838844B (zh) * 2014-03-03 2018-01-19 珠海市君天电子科技有限公司 一种键值对数据存储、传输方法及装置
CN107765992B (zh) * 2016-08-22 2021-01-15 华为技术有限公司 一种处理数据的方法和装置
CN109542665A (zh) * 2017-09-21 2019-03-29 阿里巴巴集团控股有限公司 掉电恢复方法、数据写入方法及装置
CN110402436B (zh) * 2017-12-29 2021-10-08 华为技术有限公司 处理预写日志的方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1289966A (zh) * 1999-09-29 2001-04-04 株式会社东芝 通过事务对多个文件实现原子更新的事务文件系统
US20060156064A1 (en) * 2005-01-13 2006-07-13 International Business Machines Corporation System and method for maintaining checkpoints of a keyed data structure using a sequential log
US7526720B1 (en) * 2000-11-22 2009-04-28 Adobe Systems Incorporated System and method for storing data associated with a file
US20110252067A1 (en) * 2010-04-12 2011-10-13 Symantec Corporation Insert optimization for b+ tree data structure scalability
US20110252099A1 (en) * 2010-04-07 2011-10-13 Amol Pattekar Apparatus and method for efficiently managing data in a social netwroking service

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1289966A (zh) * 1999-09-29 2001-04-04 株式会社东芝 通过事务对多个文件实现原子更新的事务文件系统
US7526720B1 (en) * 2000-11-22 2009-04-28 Adobe Systems Incorporated System and method for storing data associated with a file
US20060156064A1 (en) * 2005-01-13 2006-07-13 International Business Machines Corporation System and method for maintaining checkpoints of a keyed data structure using a sequential log
US20110252099A1 (en) * 2010-04-07 2011-10-13 Amol Pattekar Apparatus and method for efficiently managing data in a social netwroking service
US20110252067A1 (en) * 2010-04-12 2011-10-13 Symantec Corporation Insert optimization for b+ tree data structure scalability

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108287832A (zh) * 2017-01-09 2018-07-17 上海掌门科技有限公司 插入标签的方法和装置

Also Published As

Publication number Publication date
CN103502970B (zh) 2016-01-27
CN103502970A (zh) 2014-01-08

Similar Documents

Publication Publication Date Title
US11797489B2 (en) System and method for using local storage to emulate centralized storage
JP5264077B2 (ja) 地理的分散型クラスタ
US8806264B2 (en) Methods for detecting split brain in a distributed system
TWI507899B (zh) 資料庫管理系統及方法
KR101840996B1 (ko) 파일 시스템에 대한 체크포인트
US9575849B2 (en) Synchronized backup and recovery of database systems
CN105393243B (zh) 事务定序
US8468313B2 (en) Asynchronous replication with write concurrency grouping
US7996363B2 (en) Real-time apply mechanism in standby database environments
US20170161161A1 (en) Periodic data replication
CN113396407A (zh) 用于利用区块链技术扩充数据库应用的系统和方法
CN105302667B (zh) 基于集群架构的高可靠性数据备份与恢复方法
CN105574187B (zh) 一种异构数据库复制事务一致性保障方法及系统
WO2015101084A1 (zh) 恢复数据的方法、服务器及系统
US20160350353A1 (en) Elimination of log file synchronization delay at transaction commit time
WO2018098972A1 (zh) 一种日志恢复方法、存储装置和存储节点
JP2007518195A (ja) リモートデータミラーリングを用いたクラスタデータベース
US20120084260A1 (en) Log-shipping data replication with early log record fetching
US11748215B2 (en) Log management method, server, and database system
US7254683B2 (en) Speculative data mirroring apparatus method and system
WO2013091183A1 (zh) 一种键值对的操作方法及装置
US10671567B2 (en) System and method for optimized lock detection
US11163799B2 (en) Automatic rollback to target for synchronous replication
CN110196788B (zh) 一种数据读取方法、装置、系统及存储介质
WO2019109257A1 (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: 11877872

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11877872

Country of ref document: EP

Kind code of ref document: A1