TW202004592A - Method and apparatus for correcting transaction causal sequence, and electronic device - Google Patents

Method and apparatus for correcting transaction causal sequence, and electronic device Download PDF

Info

Publication number
TW202004592A
TW202004592A TW108106322A TW108106322A TW202004592A TW 202004592 A TW202004592 A TW 202004592A TW 108106322 A TW108106322 A TW 108106322A TW 108106322 A TW108106322 A TW 108106322A TW 202004592 A TW202004592 A TW 202004592A
Authority
TW
Taiwan
Prior art keywords
transaction
timestamp
correction
database server
time stamp
Prior art date
Application number
TW108106322A
Other languages
Chinese (zh)
Other versions
TWI716822B (en
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 香港商阿里巴巴集團服務有限公司
Publication of TW202004592A publication Critical patent/TW202004592A/en
Application granted granted Critical
Publication of TWI716822B publication Critical patent/TWI716822B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/465Distributed object oriented systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)

Abstract

Provided are a method and apparatus for correcting a transaction causal sequence, and an electronic device. The method can comprise: initiating, to any database server in a distributed database, an execution request for a transaction to be executed; determining a correction time stamp, wherein the correction time stamp is not smaller than a transaction time stamp of a historical transaction, and the historical transaction is a historical transaction which a client requests for execution to each database server; and sending the correction time stamp to any database server, such that the transaction time stamp of any database server responding to the execution request is greater than the correction time stamp. The method can ensure that the transaction timestamp generated by a database server conforms to a causal sequence defined by a client.

Description

事務因果序的校正方法及裝置、電子設備Correction method and device for business causal order, electronic equipment

本說明書一個或多個實施例涉及終端技術領域,尤其涉及一種事務因果序的校正方法及裝置、電子設備。One or more embodiments of this specification relate to the technical field of terminals, and in particular, to a method and apparatus for correcting the cause and effect of transactions, and electronic equipment.

分散式資料庫中的各個資料庫伺服器在執行用戶端請求的事務時,執行的各個事務的事務時間戳記應保證符合用戶端定義的因果序。舉例而言,用戶端先向資料庫伺服器A請求執行事務T_1,並在資料庫伺服器A返回事務T_1執行成功的消息後,再向資料庫伺服器B請求執行事務T_2;那麼,因果序為事務T_2發生於事務T_1之後。因此,事務T_1的事務時間戳記應小於事務T_2的事務時間戳記。When each database server in the decentralized database executes the transaction requested by the client, the transaction timestamp of each transaction executed should ensure that it conforms to the causal order defined by the client. For example, the client first requests database server A to execute transaction T_1, and after database server A returns a successful transaction T_1 execution message, it then requests database server B to execute transaction T_2; then, causality Transaction T_2 occurs after transaction T_1. Therefore, the transaction timestamp of transaction T_1 should be less than the transaction timestamp of transaction T_2.

有鑑於此,本說明書一個或多個實施例提供一種事務因果序的校正方法及裝置、電子設備,可以保證各個事務的事務時間戳記符合用戶端定義的因果序。 為實現上述目的,本說明書一個或多個實施例提供技術方案如下: 根據本說明書一個或多個實施例的第一態樣,提出了一種事務因果序的校正方法,應用於中介軟體設備,所述中介軟體設備用於傳輸用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料;所述方法包括: 檢測用戶端發起的針對分散式資料庫中任一資料庫伺服器的待執行事務的執行請求; 確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 根據本說明書一個或多個實施例的第二態樣,提出了一種事務因果序的校正方法,應用於用戶端;所述方法包括: 向分散式資料庫中任一資料庫伺服器發起針對待執行事務的執行請求; 確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 根據本說明書一個或多個實施例的第三態樣,提出了一種事務因果序的校正方法,應用於資料庫伺服器;所述方法包括: 接收校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為用戶端向各資料庫伺服器請求執行的歷史事務; 當接收到所述用戶端發起的針對待執行事務的執行請求時,根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記。 根據本說明書一個或多個實施例的第四態樣,提出了一種事務因果序的校正裝置,應用於中介軟體設備,所述中介軟體設備用於傳輸用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料;所述裝置包括: 檢測單元,檢測用戶端發起的針對分散式資料庫中任一資料庫伺服器的待執行事務的執行請求; 確定單元,確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 發送單元,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 根據本說明書一個或多個實施例的第五態樣,提出了一種事務因果序的校正裝置,應用於用戶端;所述裝置包括: 請求單元,向分散式資料庫中任一資料庫伺服器發起針對待執行事務的執行請求; 確定單元,確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 發送單元,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 根據本說明書一個或多個實施例的第六態樣,提出了一種事務因果序的校正裝置,應用於資料庫伺服器;所述裝置包括: 接收單元,接收校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為用戶端向各資料庫伺服器請求執行的歷史事務; 產生單元,當接收到所述用戶端發起的針對待執行事務的執行請求時,根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記。 根據本說明書一個或多個實施例的第七態樣,提出了一種電子設備,包括: 處理器; 用於儲存處理器可執行指令的記憶體; 其中,所述處理器被配置為實現如上述任一實施例所述的事務因果序的校正方法。In view of this, one or more embodiments of this specification provide a method and device for correcting the causal order of transactions, and electronic equipment, which can ensure that the transaction timestamp of each transaction conforms to the causal order defined by the user. To achieve the above purpose, one or more embodiments of this specification provide technical solutions as follows: According to the first aspect of one or more embodiments of the present specification, a method for correcting the causal order of transactions is proposed, which is applied to an intermediary software device. Data for communication between servers; the method includes: Detect the execution request initiated by the client for the pending transaction of any database server in the distributed database; Determining a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, the historical transaction is a historical transaction requested by the client to perform execution on each database server; Sending a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. According to a second aspect of one or more embodiments of this specification, a method for correcting the causal order of transactions is proposed, which is applied to the user end; the method includes: Initiate an execution request for the pending transaction to any database server in the distributed database; Determining a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, the historical transaction is a historical transaction requested by the client to perform execution on each database server; Sending a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. According to a third aspect of one or more embodiments of this specification, a correction method for transaction causality is proposed, which is applied to the database server; the method includes: Receive a correction timestamp, the correction timestamp is not less than the transaction timestamp of the historical transaction, the historical transaction is a historical transaction that the user requests from each database server for execution; When receiving an execution request for a transaction to be executed initiated by the user terminal, a transaction timestamp in response to the execution request is generated according to the correction timestamp, so that the transaction timestamp is greater than the correction timestamp. According to a fourth aspect of one or more embodiments of this specification, a transaction causal order correction device is proposed, which is applied to an intermediary software device, and the intermediary software device is used to transmit each database in the client and the distributed database Data for communication between servers; the device includes: The detection unit detects the execution request initiated by the user terminal for the pending transaction of any database server in the distributed database; The determining unit determines a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, and the historical transaction is a historical transaction requested by the client to be executed by each database server; The sending unit sends a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. According to a fifth aspect of one or more embodiments of the present specification, a transaction causal order correction device is proposed, which is applied to the user terminal; the device includes: The request unit initiates an execution request for the transaction to be executed to any database server in the distributed database; The determining unit determines a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, and the historical transaction is a historical transaction requested by the client to be executed by each database server; The sending unit sends a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. According to a sixth aspect of one or more embodiments of this specification, a transaction causal order correction device is proposed, which is applied to a database server; the device includes: The receiving unit receives a correction timestamp, the correction timestamp is not less than the transaction timestamp of the historical transaction, the historical transaction is a historical transaction that the user requests to execute from each database server; The generating unit, when receiving the execution request for the transaction to be executed initiated by the user terminal, generates a transaction timestamp in response to the execution request according to the correction timestamp, so that the transaction timestamp is greater than the correction Time stamp. According to a seventh aspect of one or more embodiments of this specification, an electronic device is proposed, including: processor; Memory for storing processor executable instructions; Wherein, the processor is configured to implement the transaction causal order correction method as described in any of the above embodiments.

這裡將詳細地對示例性實施例進行說明,其示例表示在圖式圖式中。下面的描述涉及圖式圖式時,除非另有表示,不同圖式圖式中的相同數位表示相同或相似的要素。以下示例性實施例中所描述的實施方式並不代表與本說明書一個或多個實施例相一致的所有實施方式。相反,它們僅是與如所附申請專利範圍中所詳述的、本說明書一個或多個實施例的一些態樣相一致的裝置和方法的例子。 需要說明的是:在其他實施例中並不一定按照本說明書示出和描述的順序來執行相應方法的步驟。在一些其他實施例中,其方法所包括的步驟可以比本說明書所描述的更多或更少。此外,本說明書中所描述的單個步驟,在其他實施例中可能被分解為多個步驟進行描述;而本說明書中所描述的多個步驟,在其他實施例中也可能被合併為單個步驟進行描述。 圖1是一示例性實施例提供的一種事務因果序的校正系統的架構示意圖。如圖1所示,該系統可以包括用戶端10和分散式資料庫20。其中,分散式資料庫20可以包括資料庫伺服器20A、20B等。用戶端通過維護校正時間戳記(不小於歷史事務的事務時間戳記),並將校正時間戳記發送至需請求執行事務的資料庫伺服器,使得該資料庫伺服器在執行事務時可產生大於該校正時間戳記的事務時間戳記,從而滿足用戶端定義的因果序(該事務時間戳記應大於歷史事務的事務時間戳記)。下文將對上述過程進行詳細說明。 資料庫伺服器20A、20B等可以為包含一獨立主機的實體伺服器,或者也可以為主機集群承載的虛擬伺服器。在運行過程中,資料庫伺服器20A、20B等可以運行某一應用的伺服器側的程式,以實現該應用的相關業務功能,比如當該資料庫伺服器20A、20B等運行事務因果序的校正操作的程式時,可以被配置為用於實現事務因果序的校正功能的服務端。而在本說明書一個或多個實施例的技術方案中,可由資料庫伺服器20A、20B等通過與用戶端10進行配合,以實現對事務因果序進行校正的方案。 使用者可以使用諸如下述類型的電子設備作為用戶端10:平板設備、筆記型電腦、個人數位助理(PDAs,Personal Digital Assistants)等,本說明書一個或多個實施例並不對此進行限制。 而對於用戶端10與資料庫伺服器20A、20B等進行互動的網路(圖中未示出),可以包括多種類型的有線或無線網路。在一實施例中,該網路可以包括公共交換電話網路 (Public Switched Telephone Network,PSTN)和網際網路,本說明書一個或多個實施例並不對此進行限制。 下面分別針對用戶端和資料庫伺服器中的不同角色,對本說明書的事務因果序的校正方案進行說明。 圖2是一示例性實施例提供的一種用戶端側事務因果序的校正方法的流程圖。如圖2所示,該方法可以包括以下步驟: 步驟202,向分散式資料庫中任一資料庫伺服器發起針對待執行事務的執行請求。 步驟204,確定校正時間戳記。 在本實施例中,分散式資料庫中各資料庫伺服器的時鐘記錄的時間可能並不一致,若各資料庫伺服器按照自身的時鐘產生事務時間戳記,則可能導致事務的事務時間戳記不符合用戶端定義的因果序。例如,用戶端先向資料庫伺服器A請求執行事務T_1,此時資料庫伺服器A的時鐘為100;則資料庫伺服器A返回執行事務T_1的事務時間戳記為100。用戶端在確定資料庫伺服器A完成對事務T_1的執行後,再向資料庫伺服器B請求執行事務T_2(因果序為事務T_2發生於事務T_1之後),若此時資料庫伺服器B的時鐘為90(小於100),則資料庫伺服器B返回執行事務T_2的事務時間戳記為90,導致事務T_1的事務時間戳記反而大於事務T_2的事務時間戳記,即執行事務T_1和事務T_2的順序不符合用戶端定義的因果序。那麼,如果後續需讀取事務時間戳記在95之前的事務,就只能讀取出事務T_2,並不能夠讀取出事務T_1;而實際上事務T_1發生於事務T_2之前,屬於事務時間戳記在95之前的事務。 因此,用戶端可通過維護校正時間戳記來實現本說明書中事務因果序的校正方案。其中,所述校正時間戳記不小於歷史事務的事務時間戳記(以下簡稱為歷史事務時間戳記),所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務。在一實施例中,可將所述校正時間戳記設置為等於所述用戶端最近一次向資料庫伺服器(可能是所述任一資料庫伺服器,也可能是其他資料庫伺服器)請求執行的事務的事務時間戳記(以下簡稱為最近事務時間戳記);在另一實施例中,可將所述校正時間戳記設置為大於最近事務時間戳記。 步驟206,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 在本實施例中,基於所述校正時間戳記不小於歷史事務時間戳記的特點,所述任一資料庫伺服器在接收到所述校正時間戳記後,可根據所述校正時間戳記來產生回應於所述執行請求的事務時間戳記,從而使得產生的事務時間戳記在時間順序上晚於歷史事務時間戳記,滿足用戶端定義的因果序。在一實施例中,所述任一資料庫伺服器可先將自身的時鐘與所述校正時間戳記進行比較,再根據比較結果確定產生回應於所述執行請求的事務時間戳記的依據。比如,若所述任一資料庫伺服器自身的時鐘不大於所述校正時間戳記,則根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記,否則,根據自身的時鐘產生回應於所述執行請求的事務時間戳記。其中,當自身的時鐘不大於所述校正時間戳記時,可進一步將自身的時鐘修改為大於所述校正時間戳記,從而使得自身的時鐘不慢於其他資料庫伺服器的時鐘。在另一實施例中,所述任一資料庫伺服器可直接根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記。通過省略將自身的時鐘與所述校正時間戳記進行比較的操作,可提高產生事務時間戳記的效率。 相應的,圖3是一示例性實施例提供的一種資料庫伺服器側事務因果序的校正方法的流程圖。如圖3所示,該方法可以包括以下步驟: 步驟302,接收校正時間戳記。 在本實施例中,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為用戶端向各資料庫伺服器請求執行的歷史事務。其中,關於所述校正時間戳記的詳細描述,可參考上述圖3實施例中的相關內容,在此不再贅述。 步驟304,當接收到所述用戶端發起的針對待執行事務的執行請求時,根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記。 在本實施例中,若自身的時鐘不大於所述校正時間戳記,則根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記;否則,根據自身的時鐘產生回應於所述執行請求的事務時間戳記。進一步的,當自身的時鐘不大於所述校正時間戳記時,可將自身的時鐘修改為大於所述校正時間戳記,從而使得自身的時鐘不慢於其他資料庫伺服器的時鐘。類似的,針對資料庫伺服器根據校正時間戳記產生事務時間戳記的操作,其詳細說明可參考上述圖2實施例中的相關內容,在此不再贅述。 為了便於理解,下面以用戶端請求修改資料為例,對本說明書一個或多個實施例的技術方案進行詳細說明。圖4是一示例性實施例提供的一種事務因果序的校正方法的互動圖。如圖4所示,用戶端先後向資料庫伺服器A、資料庫伺服器B請求修改資料;其中,在資料庫伺服器A修改資料成功後,用戶端再向資料庫伺服器B請求修改資料。該校正方法可以包括以下步驟: 步驟401,用戶端向資料庫伺服器A發送執行請求a,以修改資料庫伺服器A中的資料a。 在本實施例中,用戶端可通過連接池與各個資料庫伺服器進行通信。 步驟402,資料庫伺服器A修改資料a。 步驟403,資料庫伺服器A產生事務時間戳記a。 步驟404,資料庫伺服器A向用戶端返回修改結果a和事務時間戳記a。 步驟405,用戶端確定校正時間戳記。 在本實施例中,可將校正時間戳記設置為等於最近事務時間戳記。而在當前階段,最近事務時間戳記為事務時間戳記a;因此,可將校正時間戳記設置為等於事務時間戳記a。例如,假定事務時間戳記a為92,那麼可將校正時間戳記設置為92。當然,也可將校正時間戳記設置為大於最近事務時間戳記;比如,承接於上述舉例,可將校正時間戳記設置為93、94、95等。 步驟406,用戶端向資料庫伺服器B發送執行請求b和校正時間戳記。 在本實施例中,用戶端在確定出資料庫伺服器A已經完成對資料a進行修改後,向資料庫伺服器B發送執行請求b以修改資料庫伺服器B中的資料b。那麼,此時的因果序為“資料庫伺服器A修改資料a”發生於“資料庫伺服器B修改資料b”之前。 步驟407,資料庫伺服器B比較校正時間戳記與自身的時鐘。 步驟408,當自身的時鐘不大於校正時間戳記時,資料庫伺服器B將自身的時鐘修改為大於校正時間戳記。 步驟409,資料庫伺服器B修改資料b。 步驟410,資料庫伺服器B產生事務時間戳記b。 在本實施例中,當自身的時鐘大於校正時間戳記時,資料庫伺服器B無需將自身的時鐘修改為大於校正時間戳記,直接根據自身的時鐘記錄的時刻產生事務時間戳記b(事務“修改資料b”的時刻)即可。當資料庫伺服器B自身的時鐘不大於校正時間戳記(此時校正時間戳記等於事務時間戳記a,而事務時間戳記a為事務“修改資料a”的時刻)時,若繼續採用自身時鐘記錄的時間來產生事務時間戳記b,則將導致事務時間戳記b不大於事務時間戳記a,即資料庫伺服器A修改資料a”並非發生於“資料庫伺服器B修改資料b”之前,從而不符合因果序。 因此,可先將自身的時鐘修改為大於校正時間戳記,再根據修改後的時鐘來產生事務時間戳記b以滿足上述因果序。比如,承接於上述校正時間戳記等於事務時間戳記a的舉例,假定自身的時鐘為90,由於自身的時鐘為90小於校正時間戳記92,可將自身的時鐘修改為93,再採用修改後的時鐘記錄的時刻產生事務時間戳記b,即事務時間戳記b為93。可見,事務時間戳記b大於事務時間戳記a,滿足“資料庫伺服器A修改資料a發生於資料庫伺服器B修改資料b之前”的因果序。當然,修改的幅度可根據實際情況靈活設定,本說明書並不對此進行限制。例如,還可將自身的時鐘修改為94、95、100等。通過對自身的時鐘進行修改,可使得自身的時鐘不慢於資料庫伺服器A的時鐘。那麼後續再出現上述因果序的要求時,可以避免資料庫伺服器B頻繁修改自身的時鐘。 需要說明的是,也可以省略將自身的時鐘修改為大於校正時間戳記的操作(即省略步驟408),直接在比較出自身的時鐘不大於校正時間戳記,以及執行事務“修改資料b”後,產生大於校正時間戳記的事務時間戳記b,從而可避免對自身的時鐘進行修改。 在本實施例中,資料庫伺服器B還可省略步驟407的比較操作(那麼步驟408也隨之無需執行),直接在執行事務“修改資料b”後,產生大於校正時間戳記的事務時間戳記b,從而可避免對自身的時鐘進行修改。同時,通過省略將自身的時鐘與校正時間戳記進行比較的操作,可提高產生事務時間戳記的效率。 步驟411,資料庫伺服器B向用戶端返回修改結果b和事務時間戳記b。 步驟412,用戶端根據事務時間戳記b更新校正時間戳記。 在本實施例中,在當前階段,最近事務時間戳記由事務時間戳記a更換為事務時間戳記b;因此,需要將校正時間戳記由事務時間戳記a更新為事務時間戳記b。比如,承接於上述事務時間戳記b為93的舉例,可將校正時間戳記更新為93。 在本申請的技術方案中,還可由中介軟體設備來維護校正時間戳記,以實現事務因果序的校正方案。請參見圖5,圖5是一示例性實施例提供的另一種事務因果序的校正系統的架構示意圖。如圖5所示,該系統可以包括用戶端30A-30C、中介軟體設備40和分散式資料庫50(包括資料庫伺服器50A、50B等)。其中,中介軟體設備40連接於用戶端30A-30C與分散式資料庫50之間,運行有中介軟體,從而可用於傳輸用戶端30A-30C與分散式資料庫50中各資料庫伺服器(資料庫伺服器50A、50B等)之間進行通信的資料。另外,用戶端30A-30C和分散式資料庫50與上述圖1中的用戶端10和分散式資料庫20類似,其詳細說明可參考上述圖1所示架構的相關內容,在此不再贅述。 請參見圖6,圖6是一示例性實施例提供的一種中介軟體設備側事務因果序的校正方法。如圖6所示,所述中介軟體設備中可運行中介軟體,以用於傳輸用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料;該方法可以包括以下步驟: 步驟602,檢測用戶端發起的針對分散式資料庫中任一資料庫伺服器的待執行事務的執行請求。 步驟604,確定校正時間戳記。 在本實施例中,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務。其中,關於所述校正時間戳記的詳細描述,可參考上述圖2實施例中的相關內容,在此不再贅述。 在本實施例中,基於由獨立於用戶端的中介軟體設備來維護校正時間戳記,當存在多個用戶端時,該多個用戶端均可通過同一中介軟體設備與分散式資料庫中的各個資料庫伺服器進行通信。因此,中介軟體設備可維護對應於各個用戶端的校正時間戳記;其中,可建立用戶端標識與相應校正時間戳記的映射關係。那麼,中介軟體設備在確定校正時間戳記時,可先確定所述執行請求的發送方用戶端的用戶端標識,再(根據所述映射關係)確定對應於所述用戶端標識的校正時間戳記。 步驟606,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 為了便於理解,下面以用戶端請求修改資料為例,對本說明書一個或多個實施例的技術方案進行詳細說明。如圖7所示,圖7是一示例性實施例提供的另一種事務因果序的校正方法的互動圖。中介軟體設備中運行有中介軟體,用於傳輸各個用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料。用戶端A先後向資料庫伺服器C、資料庫伺服器D請求修改資料;其中,在資料庫伺服器C修改資料成功後,用戶端A再向資料庫伺服器D請求修改資料。該校正方法可以包括以下步驟: 步驟701,用戶端A向中介軟體設備發送執行請求c,以修改資料庫伺服器C中的資料c; 在本實施例中,用戶端A可通過連接池與中介軟體設備進行通信。 步驟702,中介軟體設備向資料庫伺服器C轉發執行請求c。 步驟703,資料庫伺服器C修改資料c。 步驟704,資料庫伺服器C產生事務時間戳記c。 步驟705,資料庫伺服器C向中介軟體設備返回修改結果c和事務時間戳記c。 步驟706,中介軟體設備確定校正時間戳記a。 在本實施例中,可將對應於用戶端A的校正時間戳記a設置為等於用戶端A的最近事務時間戳記。而在當前階段,用戶端A的最近事務時間戳記為事務時間戳記c;因此,可將校正時間戳記a設置為等於事務時間戳記c。例如,假定事務時間戳記c為100,那麼可將校正時間戳記a設置為100。當然,也可將校正時間戳記a設置為大於最近事務時間戳記。比如,承接於上述舉例,可將校正時間戳記a設置為101、104、109等。由於中介軟體設備中維護有對應於各個用戶端的校正時間戳記,中介軟體設備可建立用戶端標識與相應校正時間戳記的映射關係,以區分出各個校正時間戳記。舉例而言,可將用戶端的IP位址作為用戶端標識,那麼可建立如表1所示的映射關係:

Figure 02_image001
當然,也可以採用其他與用戶端相關的資訊作為用戶端標識,本說明書並不對此進行限制。 步驟707,中介軟體設備向用戶端A轉發修改結果c。 在本實施例中,中介軟體設備可以只向用戶端A轉發修改結果c,而無需轉發校正時間戳記a,從而可實現對用戶端A的透明處理,使得用戶端A感知不到校正時間戳記的維護過程,按照正常的請求修改資料的流程執行即可。 步驟708,用戶端A向中介軟體設備發送執行請求d,以修改資料庫伺服器D中的資料d。 在本實施例中,用戶端A在確定出資料庫伺服器C已經完成對資料c進行修改後,向資料庫伺服器D發送執行請求d以修改資料d。那麼,此時的因果序為“資料庫伺服器C修改資料c”發生於“資料庫伺服器D修改資料d”之前。 步驟709,中介軟體設備向資料庫伺服器D轉發執行請求d和校正時間戳記a。 在本實施例中,基於對上述表1中映射關係的建立,中介軟體設備在確定對應於用戶端A的校正時間戳記a時,可先確定用戶端A的用戶端標識(即用戶端A的IP位址),再根據上述表1中的映射關係確定對應於用戶端A的校正時間戳記a。 步驟710,資料庫伺服器D比較校正時間戳記a與自身的時鐘。 步驟711,當自身的時鐘不大於校正時間戳記a時,資料庫伺服器D將自身的時鐘修改為大於校正時間戳記a。 步驟712,資料庫伺服器D修改資料d。 步驟713,資料庫伺服器D產生事務時間戳記d。 在本實施例中,當自身的時鐘大於校正時間戳記a時,資料庫伺服器D無需將自身的時鐘修改為大於校正時間戳記a,直接根據自身的時鐘記錄的時刻產生事務時間戳記d(事務“修改資料d”的時刻)即可。當資料庫伺服器D自身的時鐘不大於校正時間戳記(此時校正時間戳記a等於事務時間戳記c,而事務時間戳記c為事務“修改資料c”的時刻)時,若繼續採用自身時鐘記錄的時間來產生事務時間戳記d,則將導致事務時間戳記d不大於事務時間戳記c,即資料庫伺服器C修改資料c”並非發生於“資料庫伺服器D修改資料d”之前,從而不符合因果序。 因此,可先將自身的時鐘修改為大於校正時間戳記,再根據修改後的時鐘來產生事務時間戳記d以滿足上述因果序。比如,承接於上述校正時間戳記a等於事務時間戳記c的舉例,假定自身的時鐘為98,由於自身的時鐘為98小於校正時間戳記a的取值100,可將自身的時鐘修改為101,再採用修改後的時鐘記錄的時刻產生事務時間戳記d,即事務時間戳記d為101。可見,事務時間戳記d大於事務時間戳記c,滿足“資料庫伺服器C修改資料c發生於資料庫伺服器D修改資料d之前”的因果序。當然,修改的幅度可根據實際情況靈活設定,本說明書並不對此進行限制。例如,還可將自身的時鐘修改為102、105、111等。通過對自身的時鐘進行修改,可使得自身的時鐘不慢於資料庫伺服器C的時鐘。那麼後續再出現上述因果序的要求時,可以避免資料庫伺服器D頻繁修改自身的時鐘。 需要說明的是,也可以省略將自身的時鐘修改為大於校正時間戳記a的操作(即省略步驟711),直接在比較出自身的時鐘不大於校正時間戳記a,以及執行事務“修改資料d”後,產生大於校正時間戳記a的事務時間戳記d,從而可避免對自身的時鐘進行修改。 在本實施例中,資料庫伺服器D還可省略步驟710的比較操作(那麼步驟711也隨之無需執行),直接在執行事務“修改資料d”後,產生大於校正時間戳記a的事務時間戳記d,從而可避免對自身的時鐘進行修改。同時,通過省略將自身的時鐘與校正時間戳記進行比較的操作,可提高產生事務時間戳記的效率。 步驟714,資料庫伺服器D向中介軟體設備返回修改結果d和事務時間戳記d。 步驟715,中介軟體設備根據事務時間戳記d更新校正時間戳記a。 在本實施例中,在當前階段,用戶端A的最近事務時間戳記由事務時間戳記c更換為事務時間戳記d;因此,需要將校正時間戳記a由事務時間戳記c更新為事務時間戳記d。比如,承接於上述事務時間戳記d為101的舉例,可將校正時間戳記a更新為101。 步驟716,中介軟體設備向用戶端A轉發修改結果d。 由以上技術方案可見,通過維護校正時間戳記(不小於歷史事務的事務時間戳記),並將校正時間戳記發送至需請求執行事務的資料庫伺服器,使得該資料庫伺服器在執行事務時可根據校正時間戳記產生大於校正時間戳記的事務時間戳記,即符合用戶端定義的因果序。 圖8是一示例性實施例提供的一種電子設備的示意結構圖。請參考圖8,在硬體層面,該設備包括處理器802、內部匯流排804、網路介面806、內部記憶體808以及非揮發性記憶體810,當然還可能包括其他業務所需要的硬體。處理器802從非揮發性記憶體810中讀取對應的電腦程式到內部記憶體808中然後運行,在邏輯層面上形成事務因果序的校正裝置。當然,除了軟體實現方式之外,本說明書一個或多個實施例並不排除其他實現方式,比如邏輯裝置抑或軟硬體結合的方式等等,也就是說以下處理流程的執行主體並不限定於各個邏輯單元,也可以是硬體或邏輯裝置。 請參考圖9,在軟體實施方式中,事務因果序的校正裝置應用於中介軟體設備,所述中介軟體設備用於傳輸用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料;該事務因果序的校正裝置可以包括: 檢測單元91,檢測用戶端發起的針對分散式資料庫中任一資料庫伺服器的待執行事務的執行請求; 確定單元92,確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 發送單元93,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 可選的,所述中介軟體設備用於傳輸多個用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料,所述中介軟體設備維護有對應於各個用戶端的校正時間戳記;所述確定單元92具體用於: 確定所述執行請求的發送方用戶端的用戶端標識; 確定對應於所述用戶端標識的校正時間戳記。 可選的,所述校正時間戳記為所述用戶端最近一次向資料庫伺服器請求執行的事務的事務時間戳記。 圖10是一示例性實施例提供的另一種電子設備的示意結構圖。請參考圖10,在硬體層面,該設備包括處理器1002、內部匯流排1004、網路介面1006、內部記憶體1008以及非揮發性記憶體1010,當然還可能包括其他業務所需要的硬體。處理器1002從非揮發性記憶體1010中讀取對應的電腦程式到內部記憶體1008中然後運行,在邏輯層面上形成事務因果序的校正裝置。當然,除了軟體實現方式之外,本說明書一個或多個實施例並不排除其他實現方式,比如邏輯裝置抑或軟硬體結合的方式等等,也就是說以下處理流程的執行主體並不限定於各個邏輯單元,也可以是硬體或邏輯裝置。 請參考圖11,在軟體實施方式中,該事務因果序的校正裝置應用於用戶端;可以包括: 請求單元1101,向分散式資料庫中任一資料庫伺服器發起針對待執行事務的執行請求; 確定單元1102,確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 發送單元1103,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。 圖12是一示例性實施例提供的另一種電子設備的示意結構圖。請參考圖12,在硬體層面,該設備包括處理器1202、內部匯流排1204、網路介面1206、內部記憶體1208以及非揮發性記憶體1212,當然還可能包括其他業務所需要的硬體。處理器1202從非揮發性記憶體1212中讀取對應的電腦程式到內部記憶體1208中然後運行,在邏輯層面上形成事務因果序的校正裝置。當然,除了軟體實現方式之外,本說明書一個或多個實施例並不排除其他實現方式,比如邏輯裝置抑或軟硬體結合的方式等等,也就是說以下處理流程的執行主體並不限定於各個邏輯單元,也可以是硬體或邏輯裝置。 請參考圖13,在軟體實施方式中,該事務因果序的校正裝置應用於資料庫伺服器,可以包括: 接收單元1301,接收校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為用戶端向各資料庫伺服器請求執行的歷史事務; 產生單元1302,當接收到所述用戶端發起的針對待執行事務的執行請求時,根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記。 可選的,所述產生單元1302具體用於: 若自身的時鐘不大於所述校正時間戳記,則根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記; 否則,根據自身的時鐘產生回應於所述執行請求的事務時間戳記。 可選的,還包括: 修改單元1303,當自身的時鐘不大於所述校正時間戳記時,將自身的時鐘修改為大於所述校正時間戳記。 上述實施例闡明的系統、裝置、模組或單元,具體可以由電腦晶片或實體實現,或者由具有某種功能的產品來實現。一種典型的實現設備為電腦,電腦的具體形式可以是個人電腦、膝上型電腦、行動電話、相機電話、智慧電話、個人數位助理、媒體播放器、導航設備、電子郵件收發設備、遊戲控制台、平板電腦、可穿戴設備或者這些設備中的任意幾種設備的組合。 在一個典型的配置中,電腦包括一個或多個處理器(CPU)、輸入/輸出介面、網路介面和內部記憶體。 內部記憶體可能包括電腦可讀媒體中的非永久性記憶體,隨機存取記憶體(RAM)及/或非揮發性內部記憶體等形式,如唯讀記憶體(ROM)或快閃記憶體(flash RAM)。內部記憶體是電腦可讀媒體的示例。 電腦可讀媒體包括永久性和非永久性、可移動和非可移動媒體可以由任何方法或技術來實現資訊儲存。資訊可以是電腦可讀指令、資料結構、程式的模組或其他資料。電腦的儲存媒體的例子包括,但不限於相變內部記憶體(PRAM)、靜態隨機存取記憶體(SRAM)、動態隨機存取記憶體(DRAM)、其他類型的隨機存取記憶體(RAM)、唯讀記憶體(ROM)、電可抹除可編程唯讀記憶體唯讀記憶體(EEPROM)、快閃記憶體或其他內部記憶體技術、唯讀光碟唯讀記憶體(CD-ROM)、數位多功能光碟(DVD)或其他光學儲存、磁卡式磁帶、磁碟儲存、量子記憶體、基於石墨烯的儲存媒體或其他磁性儲存設備或任何其他非傳輸媒體,可用於儲存可以被計算設備存取的資訊。按照本文中的界定,電腦可讀媒體不包括暫存電腦可讀媒體(transitory media),如調變的資料信號和載波。 還需要說明的是,術語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、商品或者設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、商品或者設備所固有的要素。在沒有更多限制的情況下,由語句“包括一個……”限定的要素,並不排除在包括所述要素的過程、方法、商品或者設備中還存在另外的相同要素。 上述對本說明書特定實施例進行了描述。其它實施例在所附申請專利範圍的範圍內。在一些情況下,在申請專利範圍中記載的動作或步驟可以按照不同於實施例中的順序來執行並且仍然可以實現期望的結果。另外,在圖式圖式中描繪的過程不一定要求示出的特定順序或者連續順序才能實現期望的結果。在某些實施方式中,多工處理和平行處理也是可以的或者可能是有利的。 在本說明書一個或多個實施例使用的術語是僅僅出於描述特定實施例的目的,而非旨在限制本說明書一個或多個實施例。在本說明書一個或多個實施例和所附申請專利範圍中所使用的單數形式的“一種”、“所述”和“該”也旨在包括多數形式,除非上下文清楚地表示其他含義。還應當理解,本文中使用的術語“及/或”是指並包含一個或多個相關聯的列出項目的任何或所有可能組合。 應當理解,儘管在本說明書一個或多個實施例可能採用術語第一、第二、第三等來描述各種資訊,但這些資訊不應限於這些術語。這些術語僅用來將同一類型的資訊彼此區分開。例如,在不脫離本說明書一個或多個實施例範圍的情況下,第一資訊也可以被稱為第二資訊,類似地,第二資訊也可以被稱為第一資訊。取決於語境,如在此所使用的詞語“如果”可以被解釋成為“在……時”或“當……時”或“回應於確定”。 以上所述僅為本說明書一個或多個實施例的較佳實施例而已,並不用以限制本說明書一個或多個實施例,凡在本說明書一個或多個實施例的精神和原則之內,所做的任何修改、等同替換、改進等,均應包含在本說明書一個或多個實施例保護的範圍之內。Exemplary embodiments will be described in detail here, examples of which are shown in the drawings. When the following description refers to drawings, unless otherwise indicated, the same digits in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of devices and methods that are consistent with some aspects of one or more embodiments of this specification, as detailed in the appended patent application. It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than described in this specification. In addition, the single step described in this specification may be decomposed into multiple steps for description in other embodiments; and the multiple steps described in this specification may also be combined into a single step in other embodiments. description. FIG. 1 is a schematic structural diagram of a correction system for transaction causality provided by an exemplary embodiment. As shown in FIG. 1, the system may include a user terminal 10 and a distributed database 20. The distributed database 20 may include database servers 20A and 20B. The user end maintains the correction timestamp (transaction timestamp not less than the historical transaction) and sends the correction timestamp to the database server that needs to request the execution of the transaction, so that the database server can generate more than the correction when executing the transaction Timestamp transaction timestamp to meet the causal order defined by the user (the transaction timestamp should be greater than the historical transaction transaction timestamp). The above process will be described in detail below. The database servers 20A, 20B, etc. may be physical servers including an independent host, or virtual servers hosted by the host cluster. During operation, database servers 20A, 20B, etc., can run programs on the server side of an application to achieve related business functions of the application, such as when the database servers 20A, 20B, etc. run transactions When correcting the operation program, it can be configured as a server for realizing the correction function of transaction causality. In the technical solutions of one or more embodiments of this specification, the database servers 20A, 20B, etc. can cooperate with the user terminal 10 to implement a solution for correcting the causal order of transactions. The user can use electronic devices such as the following types as the user terminal 10: tablet devices, notebook computers, personal digital assistants (PDAs, Personal Digital Assistants), etc. One or more embodiments of this specification do not limit this. For the network (not shown in the figure) in which the user terminal 10 interacts with the database servers 20A, 20B, etc., various types of wired or wireless networks may be included. In an embodiment, the network may include a public switched telephone network (Public Switched Telephone Network, PSTN) and the Internet. One or more embodiments of this specification do not limit this. The following describes the correction scheme of the transaction causal order in this manual for the different roles of the client and the database server. FIG. 2 is a flowchart of a method for correcting the causal order of client-side transactions provided by an exemplary embodiment. As shown in FIG. 2, the method may include the following steps: Step 202: Initiate an execution request for a pending transaction to any database server in the distributed database. Step 204: Determine the correction timestamp. In this embodiment, the time recorded by the clock of each database server in the distributed database may be inconsistent. If each database server generates a transaction timestamp according to its own clock, it may cause the transaction timestamp of the transaction to be inconsistent User-defined causal order. For example, the client first requests database server A to execute transaction T_1. At this time, database server A's clock is 100; then database server A returns a transaction timestamp of 100 to execute transaction T_1. The client determines that database server A has completed the execution of transaction T_1, and then requests database server B to execute transaction T_2 (the causal order is that transaction T_2 occurs after transaction T_1). If the clock is 90 (less than 100), the database server B returns the transaction timestamp of executing transaction T_2 as 90, which causes the transaction timestamp of transaction T_1 to be greater than the transaction timestamp of transaction T_2, that is, the order of executing transaction T_1 and transaction T_2 Causal order that does not meet the user's definition. Then, if you need to read the transaction with the transaction timestamp before 95, you can only read transaction T_2, but not transaction T_1; in fact, transaction T_1 occurred before transaction T_2 and belongs to transaction timestamp. Affairs before 95. Therefore, the user end can maintain the correction timestamp to realize the correction scheme of the transaction causal order in this specification. Wherein, the correction timestamp is not less than a transaction timestamp of a historical transaction (hereinafter referred to as a historical transaction timestamp), and the historical transaction is a historical transaction requested by the user to perform execution on each database server. In one embodiment, the calibration timestamp may be set equal to the last time the client requested execution from a database server (may be any database server or other database server) The transaction timestamp of the transaction (hereinafter referred to as the most recent transaction timestamp); in another embodiment, the correction timestamp may be set to be greater than the most recent transaction timestamp. Step 206: Send a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. In this embodiment, based on the characteristic that the correction timestamp is not less than the historical transaction timestamp, after receiving the correction timestamp, the any database server may generate a response based on the correction timestamp The transaction timestamp of the execution request, so that the generated transaction timestamp is later in time sequence than the historical transaction timestamp, satisfying the causal order defined by the user end. In an embodiment, the database server may compare its own clock with the correction timestamp, and then determine the basis for generating the transaction timestamp in response to the execution request according to the comparison result. For example, if the clock of any database server is not greater than the correction timestamp, a transaction timestamp in response to the execution request is generated based on the correction timestamp, so that the transaction timestamp is greater than The correction timestamp, otherwise, generate a transaction timestamp in response to the execution request according to its own clock. When the own clock is not greater than the correction timestamp, the own clock may be further modified to be greater than the correction timestamp, so that the own clock is not slower than the clocks of other database servers. In another embodiment, the database server may directly generate a transaction timestamp in response to the execution request according to the correction timestamp, so that the transaction timestamp is greater than the correction timestamp. By omitting the operation of comparing its own clock with the correction time stamp, the efficiency of generating transaction time stamps can be improved. Correspondingly, FIG. 3 is a flowchart of a method for correcting the causal order of transactions on the database server side provided by an exemplary embodiment. As shown in FIG. 3, the method may include the following steps: Step 302: Receive a corrected time stamp. In this embodiment, the correction timestamp is not less than the transaction timestamp of the historical transaction, and the historical transaction is a historical transaction requested by the client from each database server for execution. For a detailed description of the correction timestamp, reference may be made to the related content in the embodiment of FIG. 3 above, and details are not described herein again. Step 304: When receiving the execution request for the transaction to be executed initiated by the user terminal, generate a transaction time stamp in response to the execution request according to the correction time stamp, so that the transaction time stamp is greater than the correction Time stamp. In this embodiment, if its own clock is not greater than the correction timestamp, a transaction timestamp in response to the execution request is generated according to the correction timestamp, so that the transaction timestamp is greater than the correction timestamp Otherwise, generate a transaction timestamp in response to the execution request according to its own clock. Further, when the own clock is not greater than the correction timestamp, the own clock may be modified to be greater than the correction timestamp, so that the own clock is not slower than the clocks of other database servers. Similarly, for the operation of the database server generating the transaction timestamp according to the correction timestamp, the detailed description can refer to the related content in the embodiment of FIG. 2 described above, which will not be repeated here. In order to facilitate understanding, the technical solution of one or more embodiments of this specification will be described in detail below by taking the user's request to modify data as an example. FIG. 4 is an interactive diagram of a method for correcting the causal order of transactions provided by an exemplary embodiment. As shown in Figure 4, the client requests database server A and database server B to modify the data; after the database server A modifies the data successfully, the client requests database server B to modify the data . The calibration method may include the following steps: Step 401: The client sends an execution request a to the database server A to modify the data a in the database server A. In this embodiment, the client can communicate with each database server through the connection pool. In step 402, the database server A modifies the data a. Step 403, the database server A generates a transaction time stamp a. In step 404, the database server A returns the modification result a and the transaction time stamp a to the client. Step 405: The user terminal determines the correction timestamp. In this embodiment, the correction timestamp may be set equal to the most recent transaction timestamp. At the current stage, the most recent transaction timestamp is the transaction timestamp a; therefore, the correction timestamp can be set equal to the transaction timestamp a. For example, assuming that the transaction timestamp a is 92, the correction timestamp may be set to 92. Of course, the correction timestamp can also be set to be greater than the most recent transaction timestamp; for example, following the above example, the correction timestamp can be set to 93, 94, 95, etc. In step 406, the client sends the execution request b and the correction timestamp to the database server B. In this embodiment, after determining that the database server A has finished modifying the data a, the client sends an execution request b to the database server B to modify the data b in the database server B. Then, the causal order at this time is that "database server A modifies data a" occurs before "database server B modifies data b". In step 407, the database server B compares the corrected time stamp with its own clock. Step 408, when its own clock is not greater than the corrected time stamp, the database server B modifies its own clock to be greater than the corrected time stamp. In step 409, the database server B modifies the data b. Step 410, the database server B generates a transaction time stamp b. In this embodiment, when its clock is greater than the correction timestamp, the database server B does not need to modify its clock to be greater than the correction timestamp, and directly generates a transaction timestamp b (transaction “modification” according to the time recorded by its clock Data b” at the moment). When the database server B's own clock is not greater than the correction timestamp (the correction timestamp is equal to the transaction timestamp a, and the transaction timestamp a is the moment when the transaction "modifies the data a"), if it continues to use its own clock recording Time to generate transaction timestamp b will result in transaction timestamp b not greater than transaction timestamp a, that is, database server A modify data a" does not occur before "database server B modifies data b", which is not consistent Causal order. Therefore, you can first modify your own clock to be greater than the corrected timestamp, and then generate the transaction timestamp b according to the modified clock to meet the above causal order. For example, to inherit the correction timestamp equal to the transaction timestamp a For example, suppose your own clock is 90. Since your own clock is 90 less than the corrected timestamp 92, you can modify your own clock to 93, and then use the modified clock to record the transaction time stamp b, that is, transaction time stamp b It is 93. It can be seen that the transaction timestamp b is greater than the transaction timestamp a, which satisfies the causal order of "database server A's modification of data a occurs before database server B's modification of data b." Of course, the range of modification can be based on the actual situation Flexible setting, this manual does not limit this. For example, you can also modify your own clock to 94, 95, 100, etc. By modifying your own clock, you can make your own clock not slower than the database server A Clock. Then when the above causal sequence requirements appear again, you can avoid the database server B frequently modifying its own clock. It should be noted that the operation of modifying its own clock to be greater than the correction timestamp can also be omitted (that is, the steps are omitted 408), directly after comparing that its own clock is not greater than the correction timestamp, and after executing the transaction "modify data b", a transaction timestamp b greater than the correction timestamp is generated, thereby avoiding modification of its own clock. In this implementation In the example, the database server B can also omit the comparison operation of step 407 (then step 408 does not need to be followed), and directly execute the transaction "modify data b" to generate a transaction time stamp b greater than the correction time stamp, thereby It can avoid modifying its own clock. At the same time, by omitting the operation of comparing its own clock with the correction timestamp, the efficiency of generating transaction timestamps can be improved. Step 411, the database server B returns the modification result b to the user terminal And transaction timestamp b. Step 412, the client updates the correction timestamp according to the transaction timestamp b. In this embodiment, at the current stage, the most recent transaction timestamp is replaced by the transaction timestamp a with the transaction timestamp b; The correction timestamp is updated from the transaction timestamp a to the transaction timestamp b. For example, following the example of the transaction timestamp b being 93, the correction timestamp can be updated to 93. In the technical solution of the present application, an intermediary can also be used Software equipment to maintain the correction timestamp to realize the correction scheme of the transaction causal order. Please refer to FIG. 5, which is another transaction provided by an exemplary embodiment. Schematic diagram of the causal order correction system. As shown in FIG. 5, the system may include client terminals 30A-30C, intermediary software devices 40, and a distributed database 50 (including database servers 50A, 50B, etc.). Among them, the intermediary software device 40 is connected between the client 30A-30C and the distributed database 50, and runs the intermediary software, so that it can be used to transmit each database server (data in the client 30A-30C and the distributed database 50) Library servers 50A, 50B, etc.) for communication. In addition, the client terminals 30A-30C and the distributed database 50 are similar to the client terminal 10 and the distributed database 20 in FIG. 1 described above. For detailed descriptions, reference may be made to the relevant content of the architecture shown in FIG. 1 described above, which will not be repeated here. . Please refer to FIG. 6, which is a method for correcting the causal order of transactions on the side of an intermediary software device according to an exemplary embodiment. As shown in FIG. 6, the middleware software device can run middleware software for transmitting data communicated between the client and each database server in the distributed database; the method may include the following steps: Step 602 To detect the execution request initiated by the client for the pending transaction of any database server in the distributed database. Step 604: Determine the correction timestamp. In this embodiment, the correction timestamp is not less than the transaction timestamp of a historical transaction, which is a historical transaction requested by the user to perform execution from each database server. For a detailed description of the correction timestamp, reference may be made to the related content in the embodiment of FIG. 2 described above, and details are not described herein again. In this embodiment, the calibration timestamp is maintained by an intermediary software device independent of the client. When there are multiple clients, the multiple clients can pass the same intermediary software device and each data in the distributed database. The library server communicates. Therefore, the intermediary software device can maintain the correction time stamp corresponding to each user terminal; among them, the mapping relationship between the user terminal identification and the corresponding correction time stamp can be established. Then, when determining the correction timestamp, the intermediary software device may first determine the user terminal identifier of the sender user terminal of the execution request, and then (according to the mapping relationship) determine the correction time stamp corresponding to the user terminal identifier. Step 606: Send a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. In order to facilitate understanding, the technical solution of one or more embodiments of this specification will be described in detail below by taking the user's request to modify data as an example. As shown in FIG. 7, FIG. 7 is an interactive diagram of another method for correcting the causal order of transactions provided by an exemplary embodiment. The intermediary software device runs intermediary software, which is used to transmit data between each client and each database server in the distributed database. The client A requests the database server C and the database server D to modify the data successively. After the database server C successfully modifies the data, the client A requests the database server D to modify the data. The calibration method may include the following steps: Step 701, the client A sends an execution request c to the intermediary software device to modify the data c in the database server C; in this embodiment, the client A can connect to the intermediary through the connection pool Software devices communicate. In step 702, the intermediary software device forwards the execution request c to the database server C. Step 703, the database server C modifies the data c. Step 704, the database server C generates a transaction time stamp c. In step 705, the database server C returns the modification result c and the transaction time stamp c to the intermediary software device. In step 706, the intermediary software device determines the correction timestamp a. In this embodiment, the correction time stamp a corresponding to the user terminal A may be set equal to the latest transaction time stamp of the user terminal A. At the current stage, the latest transaction timestamp of the client A is the transaction timestamp c; therefore, the correction timestamp a can be set equal to the transaction timestamp c. For example, assuming that the transaction time stamp c is 100, the correction time stamp a may be set to 100. Of course, the correction timestamp a can also be set to be greater than the most recent transaction timestamp. For example, following the above example, the correction timestamp a may be set to 101, 104, 109, etc. Since the intermediary software equipment maintains correction time stamps corresponding to each user terminal, the intermediary software equipment can establish a mapping relationship between the user terminal identification and the corresponding correction time stamp to distinguish each correction time stamp. For example, the IP address of the user terminal can be used as the user terminal identifier, then the mapping relationship shown in Table 1 can be established:
Figure 02_image001
Of course, other information related to the user terminal may also be used as the user terminal identifier, which is not limited in this specification. In step 707, the intermediary software device forwards the modification result c to the user terminal A. In this embodiment, the intermediary software device can only forward the modification result c to the client A without forwarding the correction timestamp a, so that the transparent processing of the client A can be realized, so that the client A cannot perceive the correction timestamp The maintenance process can be performed according to the normal process of requesting information modification. In step 708, the client A sends an execution request d to the intermediary software device to modify the data d in the database server D. In this embodiment, after determining that the database server C has finished modifying the data c, the client A sends an execution request d to the database server D to modify the data d. Then, the causal order at this time is that "database server C modifies data c" occurs before "database server D modifies data d". In step 709, the intermediary software device forwards the execution request d and the correction time stamp a to the database server D. In this embodiment, based on the establishment of the mapping relationship in Table 1 above, when determining the correction timestamp a corresponding to client A, the intermediary software device may first determine the client ID of client A (that is, client A’s IP address), and then determine the correction timestamp a corresponding to user terminal A according to the mapping relationship in Table 1 above. In step 710, the database server D compares the corrected time stamp a with its own clock. Step 711, when the own clock is not greater than the corrected time stamp a, the database server D modifies its own clock to be greater than the corrected time stamp a. In step 712, the database server D modifies the data d. In step 713, the database server D generates a transaction time stamp d. In this embodiment, when its own clock is greater than the correction timestamp a, the database server D does not need to modify its own clock to be greater than the correction timestamp a, and directly generates a transaction timestamp d (transaction based on the time recorded by its own clock "The time to modify the information d"). When the database server D's own clock is not greater than the correction timestamp (at this time, the correction timestamp a is equal to the transaction timestamp c, and the transaction timestamp c is the time when the transaction "modifies the data c"), if it continues to use its own clock recording Time to generate transaction timestamp d, it will result in transaction timestamp d not greater than transaction timestamp c, that is, database server C modify data c" does not occur before "database server D modify data d", thus not It conforms to the causal order. Therefore, you can first modify your own clock to be greater than the corrected timestamp, and then generate a transaction timestamp d based on the modified clock to meet the above causal order. For example, following the corrected timestamp a equals the transaction timestamp For example of c, suppose its own clock is 98. Since its own clock is 98 less than the value of correction timestamp a 100, you can modify your own clock to 101, and then use the modified clock to record the time to generate transaction timestamp d , That is, the transaction timestamp d is 101. It can be seen that the transaction timestamp d is greater than the transaction timestamp c, which satisfies the causal order of "database server C modified data c before database server D modified data d." Of course, the modification The amplitude can be set flexibly according to the actual situation, and this specification does not limit this. For example, you can also modify your own clock to 102, 105, 111, etc. By modifying your own clock, you can make your own clock not slower than The clock of the database server C. Then, when the above-mentioned causal sequence request appears again, the database server D can be prevented from frequently modifying its own clock. It should be noted that it can also be omitted to modify its clock to be greater than the correction timestamp The operation of a (that is, omit step 711) directly generates a transaction timestamp d greater than the correction timestamp a after comparing that its clock is not greater than the correction timestamp a, and after executing the transaction "modify data d", thereby avoiding Modify its own clock. In this embodiment, the database server D can also omit the comparison operation of step 710 (then step 711 does not need to be followed), and directly executes the transaction "modify data d", resulting in a greater than correction The transaction time stamp d of the time stamp a can avoid the modification of its own clock. At the same time, by omitting the operation of comparing its own clock with the correction time stamp, the efficiency of generating the transaction time stamp can be improved. Step 714, database The server D returns the modification result d and the transaction timestamp d to the intermediary software device. Step 715, the intermediary software device updates the correction timestamp a according to the transaction timestamp d. In this embodiment, at the current stage, the most recent transaction of the client A The time stamp is changed from the transaction time stamp c to the transaction time stamp d; therefore, the correction time stamp a needs to be updated from the transaction time stamp c to the transaction time stamp d. For example, following the above example of the transaction time stamp d being 101, you can change The correction timestamp a is updated to 101. Step 716, the intermediary software device forwards the modification result d to the user terminal A. As can be seen from the above technical solution, the After maintaining the correction timestamp (transaction timestamp not less than the historical transaction), and sending the correction timestamp to the database server that needs to request the execution of the transaction, so that the database server can generate a greater than according to the correction timestamp when executing the transaction The transaction timestamp of the corrected timestamp is in accordance with the causal order defined by the user. FIG. 8 is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Please refer to FIG. 8. At the hardware level, the device includes a processor 802, an internal bus 804, a network interface 806, an internal memory 808, and a non-volatile memory 810. Of course, it may include hardware required by other businesses. . The processor 802 reads the corresponding computer program from the non-volatile memory 810 into the internal memory 808 and then runs it to form a transaction causality correction device at a logical level. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as a logic device or a combination of hardware and software, etc., that is to say, the execution body of the following processing flow is not limited to Each logic unit may also be a hardware or logic device. Please refer to FIG. 9, in the software implementation, the transaction causality correction device is applied to the intermediary software device, which is used to transmit data for communication between the client and each database server in the distributed database The transaction causal order correction device may include: a detection unit 91, which detects an execution request initiated by the client for any database server in the distributed database to be executed; a determination unit 92, which determines the correction timestamp, The correction timestamp is not less than the transaction timestamp of the historical transaction, and the historical transaction is the historical transaction requested by the user to execute from each database server; the sending unit 93 sends the correction time to any database server Stamping so that the transaction timestamp of any database server in response to the execution request is greater than the correction timestamp. Optionally, the intermediary software device is used to transmit data for communication between multiple clients and each database server in the distributed database, and the intermediary software device maintains a calibration timestamp corresponding to each client; The determining unit 92 is specifically configured to: determine a user terminal identifier of the sender user terminal of the execution request; determine a correction timestamp corresponding to the user terminal identifier. Optionally, the correction timestamp is the transaction timestamp of the most recent transaction requested by the client to the database server for execution. FIG. 10 is a schematic structural diagram of another electronic device provided by an exemplary embodiment. Please refer to FIG. 10. At the hardware level, the device includes a processor 1002, an internal bus 1004, a network interface 1006, an internal memory 1008, and a non-volatile memory 1010. Of course, it may include hardware required by other businesses. . The processor 1002 reads the corresponding computer program from the non-volatile memory 1010 into the internal memory 1008 and then runs it to form a transaction causality correction device at a logical level. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as a logic device or a combination of hardware and software, etc., that is to say, the execution body of the following processing flow is not limited to Each logic unit may also be a hardware or logic device. Referring to FIG. 11, in the software implementation, the transaction causal order correction device is applied to the client; it may include: a request unit 1101, which initiates an execution request for a pending transaction to any database server in the distributed database The determination unit 1102 determines a correction timestamp, the correction timestamp is not less than the transaction timestamp of a historical transaction, the historical transaction is a historical transaction that the user requests from each database server for execution; the sending unit 1103, to The any database server sends a correction time stamp so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. 12 is a schematic structural diagram of another electronic device provided by an exemplary embodiment. Please refer to FIG. 12. At the hardware level, the device includes a processor 1202, an internal bus 1204, a network interface 1206, an internal memory 1208, and a non-volatile memory 1212. Of course, it may include hardware required by other businesses. . The processor 1202 reads the corresponding computer program from the non-volatile memory 1212 into the internal memory 1208 and then runs it to form a transaction causality correction device at a logical level. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as a logic device or a combination of hardware and software, etc., that is to say, the execution body of the following processing flow is not limited to Each logic unit may also be a hardware or logic device. Please refer to FIG. 13, in the software embodiment, the transaction causal order correction device is applied to the database server, and may include: a receiving unit 1301, receiving a correction timestamp, the correction timestamp is not less than the transaction timestamp of the historical transaction , The historical transaction is a historical transaction that the client requests from each database server for execution; the generating unit 1302 generates a response according to the corrected timestamp when receiving the execution request for the transaction to be executed initiated by the client The transaction timestamp of the execution request, so that the transaction timestamp is greater than the correction timestamp. Optionally, the generating unit 1302 is specifically configured to: if its clock is not greater than the correction timestamp, generate a transaction timestamp in response to the execution request according to the correction timestamp, so that the transaction time The stamp is greater than the correction timestamp; otherwise, a transaction timestamp in response to the execution request is generated according to its own clock. Optionally, it further includes: a modification unit 1303, when the own clock is not greater than the correction timestamp, modify the own clock to be greater than the correction timestamp. The system, device, module or unit explained in the above embodiments may be implemented by a computer chip or entity, or by a product with a certain function. A typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a mobile phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email sending and receiving device, and a game console , Tablet computers, wearable devices, or any combination of these devices. In a typical configuration, the computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and internal memory. Internal memory may include non-permanent memory, random access memory (RAM) and/or non-volatile internal memory in computer-readable media, such as read-only memory (ROM) or flash memory (flash RAM). Internal memory is an example of computer-readable media. Computer-readable media, including permanent and non-permanent, removable and non-removable media, can be stored by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change internal memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), and other types of random access memory (RAM ), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other internal memory technologies, read-only disc read-only memory (CD-ROM ), digital versatile disc (DVD) or other optical storage, magnetic cassette tape, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media, can be used for storage can be calculated Information accessed by the device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves. It should also be noted that the terms "include", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device that includes a series of elements includes not only those elements, but also includes Other elements not explicitly listed, or include elements inherent to this process, method, commodity, or equipment. Without more restrictions, the element defined by the sentence "include one..." does not exclude that there are other identical elements in the process, method, commodity, or equipment that includes the element. The foregoing describes specific embodiments of the present specification. Other embodiments are within the scope of the attached patent application. In some cases, the actions or steps described in the scope of the patent application may be performed in a different order than in the embodiment and still achieve the desired result. In addition, the processes depicted in the drawings do not necessarily require the particular order shown or sequential order to achieve the desired results. In some embodiments, multiplexing and parallel processing are also possible or may be advantageous. The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only, and is not intended to limit one or more embodiments of this specification. The singular forms "a", "said" and "the" used in the scope of one or more embodiments of the present specification and the appended patent applications are also intended to include most forms unless the context clearly indicates other meanings. It should also be understood that the term "and/or" as used herein refers to and includes any or all possible combinations of one or more associated listed items. It should be understood that although one or more embodiments in this specification may use the terms first, second, third, etc. to describe various information, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information. Depending on the context, the word "if" as used herein can be interpreted as "when" or "when..." or "responsive to certainty". The above are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Anything within the spirit and principle of one or more embodiments of this specification, Any modifications, equivalent replacements, improvements, etc. made should be included within the scope of protection of one or more embodiments of this specification.

10‧‧‧用戶端 20‧‧‧分散式資料庫 20A‧‧‧資料庫伺服器 20B‧‧‧資料庫伺服器 202‧‧‧步驟 204‧‧‧步驟 206‧‧‧步驟 302‧‧‧步驟 304‧‧‧步驟 A‧‧‧資料庫伺服器 B‧‧‧資料庫伺服器 401‧‧‧步驟 402‧‧‧步驟 403‧‧‧步驟 404‧‧‧步驟 405‧‧‧步驟 406‧‧‧步驟 407‧‧‧步驟 408‧‧‧步驟 409‧‧‧步驟 410‧‧‧步驟 411‧‧‧步驟 412‧‧‧步驟 30A‧‧‧用戶端 30B‧‧‧用戶端 30C‧‧‧用戶端 40‧‧‧中介軟體設備 50‧‧‧分散式資料庫 50A‧‧‧資料庫伺服器 50B‧‧‧資料庫伺服器 602‧‧‧步驟 604‧‧‧步驟 606‧‧‧步驟 C‧‧‧資料庫伺服器 D‧‧‧資料庫伺服器 701‧‧‧步驟 702‧‧‧步驟 703‧‧‧步驟 704‧‧‧步驟 705‧‧‧步驟 706‧‧‧步驟 707‧‧‧步驟 708‧‧‧步驟 709‧‧‧步驟 710‧‧‧步驟 711‧‧‧步驟 712‧‧‧步驟 713‧‧‧步驟 714‧‧‧步驟 715‧‧‧步驟 716‧‧‧步驟 802‧‧‧處理器 804‧‧‧內部匯流排 806‧‧‧網路介面 808‧‧‧內部記憶體 810‧‧‧非揮發性記憶體 91‧‧‧檢測單元 92‧‧‧確定單元 93‧‧‧發送單元 1002‧‧‧處理器 1004‧‧‧內部匯流排 1006‧‧‧網路介面 1008‧‧‧內部記憶體 1010‧‧‧非揮發性記憶體 1101‧‧‧請求單元 1102‧‧‧確定單元 1103‧‧‧發送單元 1202‧‧‧處理器 1204‧‧‧內部匯流排 1206‧‧‧網路介面 1208‧‧‧內部記憶體 1210‧‧‧非揮發性記憶體 1301‧‧‧接收單元 1302‧‧‧產生單元 1303‧‧‧修改單元10‧‧‧Client 20‧‧‧Distributed database 20A‧‧‧Database server 20B‧‧‧Database server 202‧‧‧Step 204‧‧‧Step 206‧‧‧Step 302‧‧‧Step 304‧‧‧Step A‧‧‧Database server B‧‧‧Database server 401‧‧‧Step 402‧‧‧Step 403‧‧‧ steps 404‧‧‧Step 405‧‧‧Step 406‧‧‧Step 407‧‧‧Step 408‧‧‧Step 409‧‧‧Step 410‧‧‧Step 411‧‧‧Step 412‧‧‧Step 30A‧‧‧Client 30B‧‧‧Client 30C‧‧‧Client 40‧‧‧Intermediary software equipment 50‧‧‧Distributed database 50A‧‧‧Database server 50B‧‧‧Database server 602‧‧‧Step 604‧‧‧Step 606‧‧‧Step C‧‧‧Database server D‧‧‧Database server 701‧‧‧Step 702‧‧‧Step 703‧‧‧Step 704‧‧‧Step 705‧‧‧Step 706‧‧‧Step 707‧‧‧Step 708‧‧‧Step 709‧‧‧Step 710‧‧‧Step 711‧‧‧Step 712‧‧‧Step 713‧‧‧Step 714‧‧‧Step 715‧‧‧Step 716‧‧‧Step 802‧‧‧ processor 804‧‧‧Internal bus 806‧‧‧Network interface 808‧‧‧Internal memory 810‧‧‧ Non-volatile memory 91‧‧‧Detection unit 92‧‧‧ Confirmation unit 93‧‧‧Sending unit 1002‧‧‧ processor 1004‧‧‧Internal bus 1006‧‧‧Web interface 1008‧‧‧Internal memory 1010‧‧‧ Nonvolatile memory 1101‧‧‧ Request Unit 1102‧‧‧ Confirmation unit 1103‧‧‧Sending unit 1202‧‧‧ processor 1204‧‧‧Internal bus 1206‧‧‧Web interface 1208‧‧‧Internal memory 1210‧‧‧ Nonvolatile memory 1301‧‧‧Receiving unit 1302‧‧‧Generation unit 1303‧‧‧Modification unit

圖1是一示例性實施例提供的一種事務因果序的校正系統的架構示意圖。 圖2是一示例性實施例提供的一種用戶端側事務因果序的校正方法的流程圖。 圖3是一示例性實施例提供的一種資料庫伺服器側事務因果序的校正方法的流程圖。 圖4是一示例性實施例提供的一種事務因果序的校正方法的互動圖。 圖5是一示例性實施例提供的另一種事務因果序的校正系統的架構示意圖。 圖6是一示例性實施例提供的一種中介軟體設備側事務因果序的校正方法的流程圖。 圖7是一示例性實施例提供的另一種事務因果序的校正方法的互動圖。 圖8是一示例性實施例提供的一種電子設備的示意結構圖。 圖9是一示例性實施例提供的一種事務因果序的校正裝置的方塊圖。 圖10是一示例性實施例提供的另一種電子設備的示意結構圖。 圖11是一示例性實施例提供的另一種事務因果序的校正裝置的方塊圖。 圖12是一示例性實施例提供的另一種電子設備的示意結構圖。 圖13是一示例性實施例提供的另一種事務因果序的校正裝置的方塊圖。FIG. 1 is a schematic structural diagram of a correction system for transaction causality provided by an exemplary embodiment. FIG. 2 is a flowchart of a method for correcting the causal order of client-side transactions provided by an exemplary embodiment. FIG. 3 is a flowchart of a method for correcting the causal order of transactions on the database server side provided by an exemplary embodiment. FIG. 4 is an interactive diagram of a method for correcting the causal order of transactions provided by an exemplary embodiment. FIG. 5 is a schematic structural diagram of another transaction causal order correction system provided by an exemplary embodiment. FIG. 6 is a flowchart of a method for correcting the causal order of transactions on the side of an intermediary software device according to an exemplary embodiment. 7 is an interactive diagram of another method for correcting the causal order of transactions provided by an exemplary embodiment. FIG. 8 is a schematic structural diagram of an electronic device provided by an exemplary embodiment. FIG. 9 is a block diagram of an apparatus for correcting transaction causality according to an exemplary embodiment. FIG. 10 is a schematic structural diagram of another electronic device provided by an exemplary embodiment. FIG. 11 is a block diagram of another apparatus for correcting the causal order of transactions according to an exemplary embodiment. 12 is a schematic structural diagram of another electronic device provided by an exemplary embodiment. FIG. 13 is a block diagram of another transaction causal order correction device provided by an exemplary embodiment.

Claims (17)

一種事務因果序的校正方法,應用於中介軟體設備,所述中介軟體設備用於傳輸用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料;所述方法包括: 檢測用戶端發起的針對分散式資料庫中任一資料庫伺服器的待執行事務的執行請求; 確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。A method for correcting the cause and effect of transactions is applied to an intermediary software device. The intermediary software device is used to transmit data for communication between a client and each database server in a distributed database; the method includes: Detect the execution request initiated by the client for the pending transaction of any database server in the distributed database; Determining a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, the historical transaction is a historical transaction requested by the client to perform execution on each database server; Sending a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. 根據請求項1所述的方法,所述中介軟體設備用於傳輸多個用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料,所述中介軟體設備維護有對應於各個用戶端的校正時間戳記;所述確定校正時間戳記,包括: 確定所述執行請求的發送方用戶端的用戶端標識; 確定對應於所述用戶端標識的校正時間戳記。According to the method of claim 1, the intermediary software device is used to transmit data for communication between multiple clients and each database server in the distributed database, and the intermediary software device maintains corresponding to each user Correction time stamp at the end; the determination of the correction time stamp includes: Determine the user terminal identifier of the sender user terminal of the execution request; A correction timestamp corresponding to the user terminal identification is determined. 根據請求項1所述的方法,所述校正時間戳記為所述用戶端最近一次向資料庫伺服器請求執行的事務的事務時間戳記。According to the method of claim 1, the correction timestamp is the transaction timestamp of the most recent transaction requested by the client to the database server. 一種事務因果序的校正方法,應用於用戶端;所述方法包括: 向分散式資料庫中任一資料庫伺服器發起針對待執行事務的執行請求; 確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。A method for correcting the causal order of transactions is applied to the user side; the method includes: Initiate an execution request for the pending transaction to any database server in the distributed database; Determining a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, the historical transaction is a historical transaction requested by the client to perform execution on each database server; Sending a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. 一種事務因果序的校正方法,應用於資料庫伺服器;所述方法包括: 接收校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為用戶端向各資料庫伺服器請求執行的歷史事務; 當接收到所述用戶端發起的針對待執行事務的執行請求時,根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記。A method for correcting the causal order of transactions, applied to the database server; the method includes: Receive a correction timestamp, the correction timestamp is not less than the transaction timestamp of the historical transaction, the historical transaction is a historical transaction that the user requests from each database server for execution; When receiving an execution request for a transaction to be executed initiated by the user terminal, a transaction timestamp in response to the execution request is generated according to the correction timestamp, so that the transaction timestamp is greater than the correction timestamp. 根據請求項5所述的方法,所述根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記,包括: 若自身的時鐘不大於所述校正時間戳記,則根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記; 否則,根據自身的時鐘產生回應於所述執行請求的事務時間戳記。According to the method of claim 5, the generating a transaction time stamp in response to the execution request based on the correction time stamp so that the transaction time stamp is greater than the correction time stamp includes: If its own clock is not greater than the correction timestamp, a transaction timestamp in response to the execution request is generated according to the correction timestamp, so that the transaction timestamp is greater than the correction timestamp; Otherwise, a transaction timestamp in response to the execution request is generated according to its own clock. 根據請求項6所述的方法,還包括: 當自身的時鐘不大於所述校正時間戳記時,將自身的時鐘修改為大於所述校正時間戳記。The method according to claim 6, further comprising: When the own clock is not greater than the correction time stamp, the own clock is modified to be greater than the correction time stamp. 一種事務因果序的校正裝置,應用於中介軟體設備,所述中介軟體設備用於傳輸用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料;所述裝置包括: 檢測單元,檢測用戶端發起的針對分散式資料庫中任一資料庫伺服器的待執行事務的執行請求; 確定單元,確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 發送單元,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。A device for correcting the cause and effect of transactions is applied to an intermediary software device. The intermediary software device is used to transmit data for communication between a client and each database server in a distributed database; the device includes: The detection unit detects the execution request initiated by the user terminal for the pending transaction of any database server in the distributed database; The determining unit determines a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, and the historical transaction is a historical transaction requested by the client to be executed by each database server; The sending unit sends a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. 根據請求項8所述的裝置,所述中介軟體設備用於傳輸多個用戶端與分散式資料庫中各資料庫伺服器之間進行通信的資料,所述中介軟體設備維護有對應於各個用戶端的校正時間戳記;所述確定單元具體用於: 確定所述執行請求的發送方用戶端的用戶端標識; 確定對應於所述用戶端標識的校正時間戳記。The apparatus according to claim 8, the intermediary software device is used to transmit data for communication between multiple clients and each database server in the distributed database, and the intermediary software device maintains corresponding to each user Correction timestamp at the terminal; the determination unit is specifically used to: Determine the user terminal identifier of the sender user terminal of the execution request; A correction timestamp corresponding to the user terminal identification is determined. 根據請求項8所述的裝置,所述校正時間戳記為所述用戶端最近一次向資料庫伺服器請求執行的事務的事務時間戳記。According to the device of claim 8, the correction timestamp is the transaction timestamp of the most recent transaction requested by the client to the database server. 一種事務因果序的校正裝置,應用於用戶端;所述裝置包括: 請求單元,向分散式資料庫中任一資料庫伺服器發起針對待執行事務的執行請求; 確定單元,確定校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為所述用戶端向各資料庫伺服器請求執行的歷史事務; 發送單元,向所述任一資料庫伺服器發送校正時間戳記,以使得所述任一資料庫伺服器回應於所述執行請求的事務時間戳記大於所述校正時間戳記。A device for correcting the causal order of transactions, applied to the user end; the device includes: The request unit initiates an execution request for the transaction to be executed to any database server in the distributed database; The determining unit determines a correction timestamp, the correction timestamp is not less than a transaction timestamp of a historical transaction, and the historical transaction is a historical transaction requested by the client to be executed by each database server; The sending unit sends a correction time stamp to the any database server, so that the transaction time stamp of the any database server in response to the execution request is greater than the correction time stamp. 一種事務因果序的校正裝置,應用於資料庫伺服器;所述裝置包括: 接收單元,接收校正時間戳記,所述校正時間戳記不小於歷史事務的事務時間戳記,所述歷史事務為用戶端向各資料庫伺服器請求執行的歷史事務; 產生單元,當接收到所述用戶端發起的針對待執行事務的執行請求時,根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記。A transaction causality correction device applied to a database server; the device includes: The receiving unit receives a correction timestamp, the correction timestamp is not less than the transaction timestamp of the historical transaction, the historical transaction is a historical transaction that the user requests to execute from each database server; The generating unit, when receiving the execution request for the transaction to be executed initiated by the user terminal, generates a transaction timestamp in response to the execution request according to the correction timestamp, so that the transaction timestamp is greater than the correction Time stamp. 根據請求項12所述的裝置,所述產生單元具體用於: 若自身的時鐘不大於所述校正時間戳記,則根據所述校正時間戳記產生回應於所述執行請求的事務時間戳記,以使得所述事務時間戳記大於所述校正時間戳記; 否則,根據自身的時鐘產生回應於所述執行請求的事務時間戳記。According to the apparatus of claim 12, the generating unit is specifically configured to: If its own clock is not greater than the correction timestamp, a transaction timestamp in response to the execution request is generated according to the correction timestamp, so that the transaction timestamp is greater than the correction timestamp; Otherwise, a transaction timestamp in response to the execution request is generated according to its own clock. 根據請求項13所述的裝置,還包括: 修改單元,當自身的時鐘不大於所述校正時間戳記時,將自身的時鐘修改為大於所述校正時間戳記。The device according to claim 13, further comprising: The modification unit, when the own clock is not greater than the correction time stamp, modify the own clock to be greater than the correction time stamp. 一種電子設備,包括: 處理器; 用於儲存處理器可執行指令的記憶體; 其中,所述處理器被配置為實現如請求項1-3中任一項所述的方法。An electronic device, including: processor; Memory for storing processor executable instructions; Wherein, the processor is configured to implement the method according to any one of the request items 1-3. 一種電子設備,包括: 處理器; 用於儲存處理器可執行指令的記憶體; 其中,所述處理器被配置為實現如請求項4中所述的方法。An electronic device, including: processor; Memory for storing processor executable instructions; Wherein, the processor is configured to implement the method as described in claim 4. 一種電子設備,包括: 處理器; 用於儲存處理器可執行指令的記憶體; 其中,所述處理器被配置為實現如請求項5-7中任一項所述的方法。An electronic device, including: processor; Memory for storing processor executable instructions; Wherein, the processor is configured to implement the method according to any one of the request items 5-7.
TW108106322A 2018-05-31 2019-02-25 Method and device for correcting transaction causality, and electronic equipment TWI716822B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810550782.4A CN108829497A (en) 2018-05-31 2018-05-31 The bearing calibration of affairs causal ordering and device, electronic equipment
CN201810550782.4 2018-05-31

Publications (2)

Publication Number Publication Date
TW202004592A true TW202004592A (en) 2020-01-16
TWI716822B TWI716822B (en) 2021-01-21

Family

ID=64147120

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108106322A TWI716822B (en) 2018-05-31 2019-02-25 Method and device for correcting transaction causality, and electronic equipment

Country Status (3)

Country Link
CN (1) CN108829497A (en)
TW (1) TWI716822B (en)
WO (1) WO2019228012A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829497A (en) * 2018-05-31 2018-11-16 阿里巴巴集团控股有限公司 The bearing calibration of affairs causal ordering and device, electronic equipment
CN109560985A (en) * 2018-11-19 2019-04-02 北京航空航天大学 A kind of causal semanitics test method
CN110018884B (en) * 2019-03-19 2023-06-06 创新先进技术有限公司 Distributed transaction processing method, coordination device, database and electronic equipment
CN113946448B (en) * 2021-10-28 2024-05-28 苏州浪潮智能科技有限公司 Time sequence management method and device for server cluster and electronic equipment

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2702577B1 (en) * 1993-03-11 1995-04-28 Gec Alsthom Transport Sa Method for checking the correct execution of a multitasking computer program.
US6571270B1 (en) * 1999-03-15 2003-05-27 International Business Machines Corporation Timeout detection facility
JP2006236251A (en) * 2005-02-28 2006-09-07 Fujitsu Ltd Time stamp device, time calibration method and time calibration program
US7856463B2 (en) * 2006-03-21 2010-12-21 Advantest Corporation Probability density function separating apparatus, probability density function separating method, testing apparatus, bit error rate measuring apparatus, electronic device, and program
CN1960242B (en) * 2006-10-17 2011-09-07 中控科技集团有限公司 Method, device, system for implementing clock synchronization, and distribution system
JP2012018201A (en) * 2010-07-06 2012-01-26 Hitachi Ltd Text correction and recognition method
JP5608834B1 (en) * 2012-12-27 2014-10-15 パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカ Video display method
CN104615478A (en) * 2014-12-31 2015-05-13 电子科技大学 Simulation advance order error recognizing and correcting method used for distributed simulation
CN106155780B (en) * 2015-04-02 2020-01-31 阿里巴巴集团控股有限公司 node election method and device based on time
CN106325978B (en) * 2015-06-19 2020-06-30 阿里巴巴集团控股有限公司 Distributed transaction processing method and device
CN105183536B (en) * 2015-09-14 2018-11-13 中国人民解放军国防科学技术大学 Optimistic time management method based on GPU
CN106330465B (en) * 2016-11-21 2020-10-13 航天信息股份有限公司 Distributed timestamp processing method, server and system
CN108829497A (en) * 2018-05-31 2018-11-16 阿里巴巴集团控股有限公司 The bearing calibration of affairs causal ordering and device, electronic equipment

Also Published As

Publication number Publication date
TWI716822B (en) 2021-01-21
CN108829497A (en) 2018-11-16
WO2019228012A1 (en) 2019-12-05

Similar Documents

Publication Publication Date Title
TWI716822B (en) Method and device for correcting transaction causality, and electronic equipment
TWI727467B (en) Trustworthiness verification method, system, device and equipment of alliance chain
TW201937417A (en) Interaction method, device and system of cross block chain and electronic equipment
US9762670B1 (en) Manipulating objects in hosted storage
US11379836B2 (en) Methods and systems for recording data based on plurality of blockchain networks
US10193997B2 (en) Encoded URI references in restful requests to facilitate proxy aggregation
WO2022218227A1 (en) Blockchain-based deposit method and apparatus, and electronic device
US20210157801A1 (en) Methods and systems for recording data based on plurality of blockchain networks
EP3779692B1 (en) Blockchain data processing
US11050550B2 (en) Methods and systems for reading data based on plurality of blockchain networks
WO2020024650A1 (en) Data processing method and apparatus, and client
WO2019085780A1 (en) Cloud storage system and method for achieving user-defined data processing in cloud storage system
US11275601B2 (en) System and method for auto recovery of deleted virtual machines identified through comparison of virtual machine management application snapshots and having corresponding backups at a storage device
US11223692B2 (en) Service execution methods and apparatuses
US10581997B2 (en) Techniques for storing or accessing a key-value item
WO2023207529A1 (en) Data processing method and apparatus, device, medium, and product
WO2023207087A1 (en) Optimal-link selection method and apparatus for blockchain, and electronic device
CN111949441A (en) System and method for extensible backup search
TWI714017B (en) Data processing method, device and server
US20210157787A1 (en) Methods and systems for reading data based on plurality of blockchain networks
US11892914B2 (en) System and method for an application container prioritization during a restoration
US10091286B1 (en) Method and system for enhanced client-server communication in a cached communication environment
CN110889040A (en) Method and device for pushing information
CN117194298A (en) Control method, device, equipment and storage medium