WO2012119547A1 - 一种数据同步的方法、系统及设备 - Google Patents

一种数据同步的方法、系统及设备 Download PDF

Info

Publication number
WO2012119547A1
WO2012119547A1 PCT/CN2012/072028 CN2012072028W WO2012119547A1 WO 2012119547 A1 WO2012119547 A1 WO 2012119547A1 CN 2012072028 W CN2012072028 W CN 2012072028W WO 2012119547 A1 WO2012119547 A1 WO 2012119547A1
Authority
WO
WIPO (PCT)
Prior art keywords
client
data synchronization
server
message
synchronization request
Prior art date
Application number
PCT/CN2012/072028
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 中国移动通信有限公司
Publication of WO2012119547A1 publication Critical patent/WO2012119547A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/24Negotiation of communication capabilities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/40Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass for recovering from a failure of a protocol instance or entity, e.g. service redundancy protocols, protocol state redundancy or protocol service redirection

Definitions

  • the present invention relates to the field of communications, and in particular, to a method, system, and device for data synchronization. Background technique
  • Synchronization Markup Language (SyncML), which is a platform-independent, open standard protocol that can be used in compatible devices and programs. Data synchronization between networks.
  • a SyncML protocol-based client (SyncML Client) and a SyncML protocol-based server (SyncML Server)
  • SyncML Client a SyncML protocol-based client
  • SyncML Server a SyncML protocol-based server
  • the Package) request which carries the MaxMsgSize parameter in the data initialization request, is used to indicate that the SyncML Client can recognize the maximum message length returned by the SyncML Server.
  • Step 102 The SyncML Server stores the MaxMsgSize parameter sent by the SyncML Client, and returns an initialization response to the SyncML Client after the initialization operation is completed.
  • the above steps 101 and 102 are the initialization operations before the SyncML Client and the SyncML Server perform data synchronization, and the SyncML Client sends its own related information to the SyncML Server.
  • Step 103 The SyncML Client sends a Sync Package request carrying the operation information to the SyncML Server, where the message length of the data synchronization request is not greater than the maximum message length indicated by the MaxMsgSize parameter.
  • the operation information is a synchronization operation performed by the SyncML Client to request the SyncML Server, such as Synchronize the information in the SyncML Client's address book to the SyncML Server's operation information, synchronize the updated calendar information in the SyncML Client to the SyncML Server's operation information, and so on.
  • Step 104 The SyncML Server performs an operation corresponding to the operation information, generates an execution status message (Status package) of the operation, and returns the execution status information to the SyncML Client to complete the current SyncML Client and the SyncML Server. Data synchronization process.
  • the message length of the execution status message generated by the SyncML Server is smaller than the message length of the received data synchronization request, and since the message length of the data synchronization request is not greater than the maximum message length indicated by the MaxMsgSize parameter, the SyncML Server to the SyncML The message length of the execution status message returned by the Client is also not greater than the maximum message length indicated by the MaxMsgSize parameter. Therefore, the SyncML Client can correctly recognize the received execution status message.
  • the operation information is the deletion operation information
  • the message length of the execution status message generated by the SyncML Server after the specified information is deleted is greater than the message length of the data synchronization request, in particular, the data synchronization request carries multiple deletion operations.
  • the message length of the execution status message returned by the SyncML Server to the SyncML Client may be greater than the maximum message length indicated by the MaxMsgSize parameter, resulting in the SyncML Client.
  • the received execution status message cannot be correctly identified, which in turn causes the data synchronization operation to fail.
  • the SyncML Client requests the SyncML Server to synchronously delete the first to eighth records in the database as an example to illustrate that the message length of the execution status message returned by the SyncML Server may be greater than the maximum message length indicated by the MaxMsgSize parameter.
  • the content of the data synchronization request sent by SyncML Client to SyncML Server is:
  • ⁇ Delete> //The operation information in the data synchronization request sent by the SyncML Client is the deletion operation information
  • the generated execution status message is as follows:
  • ⁇ /Status> //SyncML Server deletes the generated status message after the 12th record in the database; it should be noted that the location information of the same data recorded in the SyncML Client and SyncML Server may be different, for example : The location information recorded in the SyncML Client is 1 record, the location information recorded in the SyncML Server is 5, the location information recorded in the SyncML Client is 2 records, and the location information recorded in the SyncML Server is 6, to In this way, the execution status message of the 5th to 12th records in the database deleted by the SyncML Server is deleted, that is, the execution status message of the first to eighth records in the database requested by the SyncML Client is deleted.
  • the message length of the data synchronization request sent by the SyncML Client is 592 bytes
  • the message length of the execution status message returned by the SyncML Server is 1036 bytes.
  • the maximum message length that SyncML Client can recognize is between 592 bytes and 1036 bytes, SyncML Client can send data synchronization request to SyncML Server normally, but it can not correctly identify the execution status message returned by SyncML Server, so that data synchronization operation failure.
  • Embodiments of the present invention provide a data synchronization method, system, and device, which are used to solve the problem in the prior art when a message length of an execution status message generated by a server is greater than a maximum message length that can be recognized by a client.
  • the problem of synchronous operation failure is a problem of synchronous operation failure.
  • a method of data synchronization comprising:
  • the server determines a message length of the execution status message generated after responding to the operation information in the data synchronization request;
  • the server returns a status code to the client after determining that the length of the generated execution status message is greater than the maximum message length that the client can recognize, and instructs the client to reduce the message length of the data synchronization request, and then sends a message length reduction to the server. Data synchronization request and data synchronization again.
  • a server comprising:
  • a request receiving module configured to receive a data synchronization request
  • a judging module configured to determine whether a message length of the execution status message generated after responding to the operation information in the data synchronization request is greater than a maximum message length recognizable by the client;
  • a returning module configured to return a status code to the client when the length of the message indicating that the generated execution status message is greater than the maximum message length that the client can recognize, instructing the client to reduce the message length of the data synchronization request
  • the server sends a data synchronization request that reduces the message length and re-synchronizes the data.
  • a client, the client includes:
  • a request sending module configured to send a data synchronization request
  • a status code receiving module configured to receive a status code
  • an adjustment module configured to reduce a message length of the currently sent data synchronization request, and trigger a request sending module by using a data synchronization request that reduces the length of the message, requesting synchronization with the server to perform data synchronization.
  • a system for data synchronization comprising:
  • a client configured to send a data synchronization request, and when the status code is received, reduce the data After the length of the requested message, the data synchronization request for reducing the message length is sent again and the data synchronization is resumed;
  • a server configured to determine a message length of the execution status message generated after responding to the operation information in the data synchronization request, when the data synchronization request is received, determining that the generated message length of the execution status message is greater than the client can recognize When the maximum message length is returned, the status code is returned.
  • the server detects the message length of the execution status message returned to the client, and discards the synchronization request of the client when determining that the message length of the execution status message is greater than the maximum message length that the client can recognize ( That is, the execution status message generated by the current generation is not returned to the client, but the synchronization operation is re-sent by requesting the client to resend the data synchronization request with the message length reduction by returning the status code to the client, and performing the embodiment of the present invention by looping
  • the scheme makes the message length of the execution status message generated by the server gradually close to and smaller than the maximum message length that the client can recognize until the data synchronization process between the client and the server is completed, thereby avoiding the fact that the client cannot correctly recognize the execution status message.
  • the problem of the synchronization process being interrupted.
  • FIG. 1 is a schematic diagram of steps of data synchronization between a SyncML Client and a SyncML Server in the background art
  • FIG. 2 is a schematic diagram of steps of a method for data synchronization according to Embodiment 1 of the present invention
  • Embodiment 3 is a schematic diagram of steps of a method for data synchronization in Embodiment 2 of the present invention.
  • FIG. 4 is a schematic structural diagram of a system for data synchronization in Embodiment 3 of the present invention.
  • FIG. 5 is a schematic structural diagram of a server according to Embodiment 4 of the present invention.
  • FIG. 6 is a schematic structural diagram of a client in an embodiment of the present invention. detailed description
  • the server actively detects the message length of the execution status message returned to the client, and when determining that the message length of the execution status message is greater than the maximum message length that the client can recognize, Abandoning the synchronization request of the client (that is, not returning the execution status message generated by the client to the client), but returning the status code to the client, requesting the client to resend the data synchronization request with the reduced message length, because the server re-receives The message length of the data synchronization request is reduced, so the message length of the regenerated execution status message is also reduced, and the message length of the regenerated execution status message is not greater than the maximum message length that the client can recognize.
  • the data synchronization operation is completed; otherwise, the client is required to send a data synchronization request whose message length is continuously reduced until the message length of the finally generated execution status message is not greater than the maximum message length that the client can recognize.
  • the server is required to re-adjust the data synchronization request until the completion process, which overcomes the problem that the server blindly sends an execution status message to the client in the prior art.
  • the synchronization process between the client and the server may be interrupted.
  • the solution in the embodiments of the present invention can be applied to the SyncML protocol.
  • the server involved can be a SyncML Server, and the client involved can be a SyncML Client.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • FIG. 2 it is a schematic diagram of a method for data synchronization in the first embodiment of the present invention, where the method includes the following steps:
  • Step 201 The server receives a data initialization request sent by the client, where the data initialization request carries a MaxMsgSize parameter.
  • Step 202 The server stores the MaxMsgSize parameter and returns an initialization response.
  • steps 201 and 202 are processes for initializing between the server and the client, which are preferred steps of the embodiment.
  • the server and the client can perform the above initialization operation before the first data synchronization, without performing the above initialization operation in each data synchronization process.
  • the server may determine and record the MaxMsgSize parameter in the initialization process of step 201 and step 202 above, thereby determining the maximum message length that the client can recognize, and may also determine the maximum message length that the client can recognize, such as the client.
  • the terminal sends the maximum message length that it can recognize to the server through other instructions.
  • Step 203 The server receives a data synchronization request sent by the client.
  • the data synchronization request received by the server may be the data synchronization request sent by the client to the server for the first time, or the client may adjust the data synchronization request after the previous data synchronization is abandoned by the server.
  • the data synchronization request includes at least one piece of operation information.
  • eight pieces of deletion operation information required to delete the first to eighth records in the database may be included.
  • Step 204 The server determines a message length of an execution status message generated after responding to the operation information in the data synchronization request.
  • the server determines that the generated execution status message has a message length of 1036. byte.
  • Step 205 The server determines whether the generated message length of the execution status message is greater than the maximum message length that the client can recognize. If yes, step 206 is performed; otherwise, the generated execution status message is returned to the client, and the data synchronization process is completed. .
  • the server does not immediately return to the client after generating the execution status message, but determines whether the message length of the execution status message is greater than the maximum message length that the client can recognize, that is, the client is determined.
  • the generated execution status message can be correctly identified.
  • the data synchronization process is abandoned, that is, the execution status message generated by the current generation is not returned to the client, and the synchronization process is interrupted because the client cannot correctly recognize the execution status message.
  • Step 206 The server determines whether the number of times the status code is continuously returned before reaching the set threshold. If yes, the current data synchronization process is ended; otherwise, step 207 is performed.
  • the last return status code in the status code is continuously returned to the current return status code to the client, and the server does not return an execution status message to the client. For example, if the server receives the data synchronization request sent by the client for the 15th time, and returns the status when receiving the data synchronization request sent by the same client for the 5th to the 10th consecutive times.
  • the code, but the 9th return is the execution status message, which means that the number of consecutive status codes is 5 consecutively, and the 9th data synchronization process is successfully completed.
  • the server will notify the client to end the data synchronization process, and the client is no longer required to send a data synchronization request for the event that needs to be synchronized. If the client wants a new data synchronization request for other events, the client can send a new data synchronization request to the server again for other events.
  • Step 206 is a preferred step of the embodiment of the present invention.
  • the retransmission process in step 206 may occur because the message length of the execution status message generated by the server is greater than the maximum message length that the client can recognize, or may occur due to poor network environment.
  • it may be set to terminate the current data synchronization process when the number of times the server continuously returns the status code has reached the set threshold value for any reason, and may also be set to: "Server generated The message length of the execution status message is greater than the maximum message length that the client can recognize. This causes the server to terminate the data synchronization process only when the number of consecutive status codes returned before the server has reached the set threshold.
  • Step 207 The server returns a status code (Aert Code) to the client, and jumps to step 203 to wait for re-receiving the data synchronization request with the message length reduced by the client.
  • a status code (Aert Code)
  • the status code indicates that the length of the message of the execution status message generated by the server is greater than the maximum message length that the client can recognize, the server abandons the data synchronization request of the client, and the server waits for the data length of the message retransmission of the client to be reduced. Requesting, cyclically performing the operations of steps 203 to 207 above until the data synchronization process with the client can be completed in step 205, or determining that the number of consecutive return status codes has reached the set threshold in step 206 And exit the data synchronization process.
  • the server will increase the number of consecutive return status codes based on the number of consecutive return status codes involved in step 206, and utilize the continuously added consecutive return status code. The number of times is the judgment condition of the next execution of step 206.
  • the process of performing data synchronization on the server side is described. Since the server does not immediately return to the client after generating the execution status message, the message length of the execution status message is determined to be greater than the client. When the maximum message length that can be recognized by the end, the data synchronization process is abandoned, and the client is required to adjust the message length of the data synchronization request until the length of the generated execution status message is not greater than the maximum message length that the client can recognize. The data synchronization process is completed to avoid the problem that the synchronization process is interrupted because the client cannot correctly recognize the execution status message.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the second embodiment of the present invention is to describe the data synchronization method of the embodiment of the present invention from the client side.
  • the solution of the second embodiment of the present invention corresponds to the solution of the first embodiment.
  • the program is explained.
  • the solution of the second embodiment of the present invention includes the following steps:
  • Step 301 The client sends a data initialization request to the server, where the data initialization request carries a MaxMsgSize parameter.
  • This step corresponds to step 201 and step 202 in the first embodiment, and is an initialization process between the client and the server. This step is also a preferred step of the embodiment.
  • Step 302 The client sends a data synchronization request to the server.
  • This step corresponds to step 203 in the first embodiment.
  • the client may send a data synchronization request to the server when data synchronization is first performed with the server, or may adjust the adjacent one after receiving the status code returned by the server. After the message length of the data synchronization request sent last time, the data synchronization request with the reduced message length is sent to the server.
  • Step 303 The client determines whether the server returns a status code or an execution status message. If the status code is returned, step 304 is performed; otherwise, the data synchronization process is completed.
  • This step corresponds to step 204 to step 207 of the first embodiment.
  • the server determines that the message length of the execution status message is greater than the maximum message length that the client can recognize, that is, when the client cannot correctly identify the execution status message, the client is Returns the status code.
  • the client receives the status code returned by the server, indicating that the server abandons the current data synchronization request, the client needs to retransmit the data synchronization request; if the client receives the execution status message returned by the server, the server side The data synchronization process has been completed, and the client completes the data synchronization process after recognizing the received execution status message.
  • Step 304 The client reduces the message length of the adjacent data synchronization request sent last time, and jumps to step 302 to send a data synchronization request for reducing the message length to the server.
  • the data synchronization request sent in step 205 carries the (L-M) deletion operation information, and requests the server to perform data synchronization again.
  • the message length of the data synchronization request is reduced, the content of the deletion operation that the server needs to perform is also reduced. Therefore, the length of the generated execution status message is reduced as compared with the previous one, and the data synchronization between the server and the client is successfully implemented. The possibility.
  • the M deletion operation information removed by the client may be required to respond to the corresponding operation by carrying the data synchronization request of the M deletion operation information after the data synchronization process is successfully executed.
  • the data synchronization request sent by the client to the server can carry L (L is a positive mode one greater than 1:
  • the client determines the length of the message for each deletion operation information, and removes the N deletion operation information with the longest message length, where N is a positive integer greater than 0 and less than L.
  • the client removes M pieces of deletion operation information in the data synchronization request, and the M is a positive integer greater than 0 and less than L.
  • the client may remove the M deletion operation information according to the number of the deletion operation information carried in the data synchronization request, and may also remove the M deletion operation information according to the message length of the data synchronization request, which are respectively described below:
  • the M deletion operation information is removed according to the number of deletion operation information carried in the data synchronization request.
  • the client presets a first ratio range, such as a reduction of 8% to 12% of the deletion operation information each time.
  • the client determines the M pieces of deletion operation information that need to be removed, and the ratio of the M to the L is within the first ratio range.
  • the M deletion operation information is removed according to the message length of the data synchronization request.
  • the second ratio range preset by the client such as the message length of each data synchronization request, is reduced by 8% to 12%.
  • the client determines the message length of each deletion operation information in the L deletion operation information. Then, the client determines, according to the set second ratio range, the M deletion operation information that needs to be removed, and the ratio of the message length of the removed M deletion operation information to the message length of the data synchronization request before the message length reduction is Within the second ratio range.
  • the carried deletion operation information is L
  • the length of the data synchronization request message is a
  • M is deleted from the L deletion operation information.
  • the operation information requires that the message length of the M deletion operation information is b, and the ratio of b to a is within the second ratio range.
  • the deletion operation information in the data synchronization request is removed by the above method
  • the client receives the execution status message returned by the server (representing the client)
  • the server completes the data synchronization operation for the data synchronization request for removing the deletion operation information
  • the deletion operation corresponding to the deletion operation information removed by the client still needs to be synchronized with the server. Therefore, the client sends the deletion operation information including the removal to the server.
  • the data synchronization request, for the data synchronization request including the removed deletion operation information can re-execute the scheme of the second embodiment to perform the synchronization operation.
  • the process of performing data synchronization on the client side is described. Because the length is too long, the current data synchronization process is abandoned. Therefore, the client will reduce the message length of the data synchronization request and then resend the message to the server.
  • the server is required to perform the data synchronization process according to the data synchronization request received again, and the loop is repeated until the data synchronization process between the client and the server is completed, thereby avoiding the problem that the synchronization process is interrupted because the client cannot correctly recognize the execution status message.
  • the second embodiment of the present invention further provides a manner in which multiple clients reduce the message length of the data synchronization request, so that the message length of the execution status message generated by the server is gradually close to and smaller than the maximum message length that the client can recognize, ensuring When the synchronization process is performed correctly, the server can maximize the simultaneous response operation, reduce the synchronization process between the client and the server, and improve the data synchronization efficiency.
  • Embodiment 3 is a diagrammatic representation of Embodiment 3
  • the third embodiment of the present invention further provides a system for data synchronization, where the system includes a client 11 and a server 12, wherein: the client 11 is configured to send a data synchronization request, and when the status code is received, reduce the data synchronization. After the length of the requested message, the data synchronization request for reducing the message length is again sent and the data synchronization is re-synchronized; the server 12 is configured to determine the execution status generated after responding to the operation information in the data synchronization request upon receiving the data synchronization request. The message length of the message returns the status code when it is determined that the generated message length of the execution status message is greater than the maximum message length that the client can recognize.
  • the server 12 is further configured to determine whether the number of consecutively returned status codes has reached a set threshold. When the threshold is not reached, the status code is returned to the client and the number of consecutive status codes is incremented. Wherein, the last return status code in the status code is continuously returned to the current return status code to the client, and the server does not return an execution status message to the client;
  • the server 12 is further configured to perform an initialization operation with the client 11, and store the maximum message length that the client carried in the data initialization request sent by the client 11 can recognize.
  • the client 12 in this embodiment can reduce the message length of the data synchronization request in various ways in the second embodiment.
  • the interaction process between the client 11 and the server 12 of the data synchronization system in the third embodiment is as shown in FIG. 4:
  • the client 11 and the server 12 perform an initialization operation, and the client 11 sends a data initial to the server 12: 1 ⁇ 2 4 ⁇ (Initialization Package) request, and carries the MaxMsgSize parameter in the Initialization Package request, which is used to represent the client 11
  • the maximum message length of the message returned by the server 12 can be identified; the server 12 stores the MaxMsgSize parameter and, upon completion of the initialization operation, returns an initialization response to the client 11.
  • client 11 sends data synchronization to server 12 when data synchronization is required.
  • the message length of the data synchronization request is not greater than the maximum message length represented by the MaxMsgSize parameter.
  • the server 12 performs the operation requested by the client 11, and generates an execution status message (Status package). If the length of the generated execution status message is greater than the maximum message length indicated by the MaxMsgSize parameter, the server 12 returns a status code ( Alert Code) to the client 11 to notify the client 11 that the message length of the currently generated execution status message is greater than the MaxMsgSize parameter.
  • a status code Alert Code
  • the maximum message length indicated if the generated message length of the execution status message is not greater than the maximum message length indicated by the MaxMsgSize parameter, the server 12 returns the generated execution status information to the client 11 to complete the current data synchronization process.
  • the client 11 when receiving the status code, the client 11 reduces the message length of the data synchronization request, and then resends the data synchronization request for reducing the message length and re-synchronizes the data, and jumps to the third step.
  • Embodiment 4 The fourth embodiment of the present invention further provides a server, as shown in FIG. 5, including: a request receiving module 21, a determining module 22, and a returning module 23, wherein: the request receiving module 21 is configured to receive a data synchronization request; and the determining module 22 is configured to: Determining whether the message length of the execution status message generated after responding to the operation information in the data synchronization request is greater than the maximum message length that the client can recognize; the returning module 23 is configured to use the message length of the generated execution status message to be greater than the client When the maximum message length that can be recognized by the terminal, the status code is returned to the client, and the client is instructed to reduce the message length of the data synchronization request, and then send a data synchronization request for reducing the message length to the server and re-synchronize the data.
  • a server as shown in FIG. 5, including: a request receiving module 21, a determining module 22, and a returning module 23, wherein: the request receiving module 21 is configured to receive a data synchronization request
  • the server further includes a counting module 24, configured to record the number of times before returning the status code continuously, wherein the last return status code in the status code is continuously returned to the current return status code to the client, and the server does not send the status message to the client. An execution status message has been returned.
  • the determining module 22 is further configured to determine whether the number of times before the status code is continuously returned reaches a set threshold, and when the result of the determination is that the set threshold is not reached, the return module 23 is triggered.
  • the server further includes: an initialization module 25 and a storage module 26, wherein the initialization module 25 is configured to receive a data initialization request sent by the client, where the data initialization request carries a maximum message length that the client can recognize, and returns to the initialization. Response; storage module 26 stores the maximum message length that the client can recognize.
  • the fourth embodiment of the present invention further includes functional modules capable of implementing the steps of the first embodiment, which are not described herein.
  • Embodiment 5 is a diagrammatic representation of Embodiment 5:
  • the fifth embodiment of the present invention further provides a client, as shown in FIG. 6, including: a request sending module 31, a status code receiving module 32, and an adjusting module 33, wherein: the request sending module 31 is configured to send a data synchronization request; The receiving module 32 is configured to: after receiving the data synchronization request, receive the returned status code; the adjusting module 33 is configured to reduce the message length of the currently sent data synchronization request, and trigger the request sending module by using a data synchronization request that reduces the message length. Request to re-synchronize data with the server.
  • the adjustment module 33 can reduce the message length of the data synchronization request in various manners in the second embodiment.
  • the fifth embodiment of the present invention further includes functional modules capable of implementing the steps of the second embodiment, which are not described herein.
  • the data synchronization request carries L deletion operation information
  • the adjustment module may implement the message length of the data synchronization reduction request by using the following module:
  • a module for removing M pieces of deletion operation information in a data synchronization request the L is a positive integer greater than 1, and the M is a positive integer greater than 0 and less than L.
  • the module for removing the M deletion operation information in the data synchronization request may be specifically used to:
  • Determining the message length of each deletion operation information determining M deletion operation information to be removed according to the set second ratio range, the message length of the removed M deletion operation information and the data synchronization request before the message length reduction
  • the ratio of the message length is within the second ratio range.
  • the data synchronization request carries L deletion operation information
  • the adjustment module may implement the message length of the reduced data synchronization request by using the following module:
  • the client may further include: means for transmitting, to the server, a data synchronization request including the removed deletion operation information upon receiving the execution status message returned by the server.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the application can take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware.
  • the application may employ computer-usable storage media (including but not limited to disk storage, in one or more of the computer-usable program code embodied therein.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据同步的方法、系统及设备,主要内容包括:服务器对返回给客户端的执行状态消息的消息长度进行检测,当确定执行状态消息的消息长度大于客户端能够识别的最大消息长度时,放弃本次客户端的同步请求(即不向客户端返回本次产生的执行状态消息),而是通过向客户端返回状态码,要求客户端重新发送消息长度减少的数据同步请求来重新进行同步操作,通过循环执行本发明实施例的方案,使服务器生成的执行状态消息的消息长度逐步接近并小于客户端能够识别的最大消息长度,直至客户端与服务器之间数据同步过程完成,避免由于客户端无法正确识别执行状态消息而导致同步过程中断的问题。

Description

一种数据同步的方法、 系统及设备
本申请要求于 2011年 3月 7日提交中国专利局、申请号为 201110053760.5、 发明名称为"一种数据同步的方法、 系统及设备"的中国专利申请的优先权, 其 全部内容通过引用结合在本申请中。 技术领域
本发明涉及通信领域, 尤其涉及一种数据同步的方法、 系统及设备。 背景技术
目前的移动数据同步化大多建立在互不兼容的私有协议上,每种协议只能 支持有限种类的设备、 系统及数据类型, 这些不兼容的协议增加了各方面(用 户、 生产商、 服务提供商、 开发商)工作的复杂度, 且这些不兼容的协议还会 限制移动设备的使用、 数据的访问和发行。
为了解决上述移动数据同步化的问题,业界提出了一种信息同步标准协议 (Synchronization Markup Language , SyncML) , SyncML协议是一种与平台无关 的、 开放的标准协议, 可以在兼容的设备、 程序及网络之间进行数据同步。
例如, 基于 SyncML协议的客户端 ( SyncML Client )和基于 SyncML协 议的服务器(SyncML Server )之间进行数据(如通讯簿、 日历等数据) 同步 时的过程如图 1所示, 包括以下步骤:
Package )请求, 在数据初始化请求中携带了 MaxMsgSize 参数, 用于表示 SyncML Client能够识别 SyncML Server返回消息的最大消息长度。
步骤 102: SyncML Server存储所述 SyncML Client发送的 MaxMsgSize参 数, 在完成初始化操作后, 向 SyncML Client返回初始化响应。
上述步骤 101和步骤 102是 SyncML Client和 SyncML Server进行数据同 步之前的初始化操作过程, SyncML Client将自身的相关信息发送给 SyncML Server。
步骤 103: SyncML Client向 SyncML Server发送携带操作信息的数据同步 ( Sync Package )请求, 所述数据同步请求的消息长度不大于 MaxMsgSize参 数所表示的最大消息长度。
所述操作信息是 SyncML Client请求 SyncML Server执行的同步操作, 如 将 SyncML Client的通讯簿内的信息同步至 SyncML Server的操作信息、 将 SyncML Client内更新后的日历信息同步至 SyncML Server的操作信息等。
步骤 104: SyncML Server执行所述操作信息对应的操作, 生成所述操作 的执行状态消息 (Status package ), 并将所述执行状态信息返回给 SyncML Client, 完成本次 SyncML Client和 SyncML Server之间的数据同步过程。
在一般情况下, SyncML Server生成的执行状态消息的消息长度小于接收 到的数据同步请求的消息长度, 且由于数据同步请求的消息长度不大于 MaxMsgSize参数所表示的最大消息长度, 则 SyncML Server向 SyncML Client 返回的执行状态消息的消息长度也不大于 MaxMsgSize参数所表示的最大消息 长度, 因此, SyncML Client能够正确识别接收到的执行状态消息。
但是, 在所述操作信息是删除操作信息时, SyncML Server将指定的信息 删除后生成的执行状态消息的消息长度将大于数据同步请求的消息长度,特别 是在数据同步请求中携带多条删除操作信息的情况下, 由于 SyncML Server将 为每条删除操作信息生成相应的状态消息, 则 SyncML Server返回给 SyncML Client的执行状态消息的消息长度可能会大于 MaxMsgSize参数所表示的最大 消息长度, 导致 SyncML Client无法正确识别接收到的执行状态消息, 进而使 数据同步操作失败。
以 SyncML Client请求 SyncML Server同步删除数据库中第 1条至第 8条 记录为例, 来说明 SyncML Server返回的执行状态消息的消息长度可能会大于 MaxMsgSize参数所表示的最大消息长度的情况。
SyncML Client向 SyncML Server发送的数据同步请求的内容为:
<Delete> //SyncML Client发送的数据同步请求中的操作信息是删除操作信息;
<CmdID>12345</CmdID>
<Archive />
<Cred>
<Meta>
<Type xmlns='syncml:metinf>syncml:auth-md5</Type>
<Format xmlns='syncml:metinf>b64</Format>
</Meta>
<Data>Zd5awBsesf0csa==</Data> //确认数据同步请求完整传输的校验信息;
Figure imgf000005_0001
y//¾5fpl/r¾rpl¾¾¾><><>gJoo§J <<
。£I1 <>US y/8/¾5fplr¾rpl¾¾¾><><>gJoo§J <<. 库中第 8条记录;
</Item>
</Delete>
SyncML Server接收到 SyncML Client发送的数据同步请求时, 执行相应 的删除操作, 将数据库中第 5条至第 12条记录删除, 生成的执行状态消息如 下:
<Status>
<CmdID>3</CmdID>
<MsgRef>2</MsgRefxCmdRef>5</CmdRefxCmd>Delete</Cmd>
<SourceRef>1012</SourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 5条记录后的生成的状态消息;
<Status>
<CmdID>4</CmdID>
<MsgRef>2</MsgRefxCmdRef>6</CmdRefxCmd>Delete</Cmd>
<SourceRef>1013</SourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 6条记录后的生成的状态消息;
<Status>
<CmdID>5</CmdID>
<MsgRef>2</MsgRefxCmdRef>7</CmdRefxCmd>Delete</Cmd>
<SourceRef>1014</SourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 7条记录后的生成的状态消息;
<Status>
<CmdID>6</CmdID>
<MsgRef>2</MsgRefxCmdRef>8</CmdRefxCmd>Delete</Cmd>
<SourceRef>1015</SourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 8条记录后的生成的状态消息;
<Status>
<CmdID>7</CmdID> <MsgRef>2</MsgRefxCmdRef>9</CmdRefxCmd>Delete</Cmd>
<S ourceRef > 1016</S ourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 9条记录后的生成的状态消息;
<Status>
<CmdID>8</CmdID>
<MsgRef>2</MsgRefxCmdRef>10</CmdRefxCmd>Delete</Cmd>
<SourceRef>1017</SourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 10条记录后的生成的状态消息;
<Status>
<CmdID>9</CmdID>
<MsgRef>2</MsgRefxCmdRef>ll</CmdRefxCmd>Delete</Cmd>
<S ourceRef > 1018</S ourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 11条记录后的生成的状态消息;
<Status>
<CmdID>10</CmdID>
<MsgRef>2</MsgRefxCmdRef>12</CmdRefxCmd>Delete</Cmd>
<SourceRef>l 019</SourceRef>
<Data>200</Data>
</Status> //SyncML Server删除数据库中第 12条记录后的生成的状态消息; 需要说明的是, 在 SyncML Client和 SyncML Server中记录的同一数据在 数据库中的位置信息可能是不同的, 例如: 在 SyncML Client中记录的位置信 息为 1的记录, 在 SyncML Server中记录的位置信息为 5 , 在 SyncML Client 中记录的位置信息为 2的记录, 在 SyncML Server中记录的位置信息为 6, 以 此类推, SyncML Server生成的删除数据库中第 5条至第 12条记录的执行状态 消息, 也就是删除 SyncML Client请求的数据库中第 1条至第 8条记录的执行 状态消息。
从上例中可以看出, SyncML Client发送的数据同步请求的消息长度为 592 字节, 而 SyncML Server返回的执行状态消息的消息长度为 1036 字节, 若 SyncML Client能够识别的最大消息长度介于 592字节和 1036字节之间时, SyncML Client可以向 SyncML Server正常发送数据同步请求, 但却不能正确 识别 SyncML Server返回的执行状态消息, 使数据同步操作失败。 发明内容 本发明实施例提供一种数据同步的方法、 系统及设备, 用以解决现有技术 中存在的当服务器生成的执行状态消息的消息长度大于客户端能够识别的最 大消息长度时, 导致数据同步操作失败的问题。
一种数据同步的方法, 所述方法包括:
服务器在接收到客户端发送的数据同步请求时,确定在响应所述数据同步 请求中的操作信息后生成的执行状态消息的消息长度;
服务器在确定生成的执行状态消息的消息长度大于客户端能够识别的最 大消息长度时, 向客户端返回状态码, 指示客户端减少所述数据同步请求的消 息长度后, 向服务器发送减少消息长度的数据同步请求并重新进行数据同步。
一种服务器, 所述服务器包括:
请求接收模块, 用于接收数据同步请求;
判断模块,用于判断响应所述数据同步请求中的操作信息后生成的执行状 态消息的消息长度是否大于客户端能够识别的最大消息长度;
返回模块,用于在判断结果为生成的执行状态消息的消息长度大于客户端 能够识别的最大消息长度时, 向客户端返回状态码,指示客户端减少所述数据 同步请求的消息长度后,向服务器发送减少消息长度的数据同步请求并重新进 行数据同步。
一种客户端, 所述客户端包括:
请求发送模块, 用于发送数据同步请求;
状态码接收模块, 用于接收状态码;
调整模块, 用于减少当前发送的所述数据同步请求的消息长度, 并利用减 少消息长度的数据同步请求触发请求发送模块,请求与服务器重新进行数据同 步。
一种数据同步的系统, 所述系统包括:
客户端, 用于发送数据同步请求, 并在接收到状态码时, 减少所述数据同 步请求的消息长度后 ,再次发送减少消息长度的数据同步请求并重新进行数据 同步;
服务器, 用于在接收到数据同步请求时,确定在响应所述数据同步请求中 的操作信息后生成的执行状态消息的消息长度,在确定生成的执行状态消息的 消息长度大于客户端能够识别的最大消息长度时, 返回状态码。
本发明实施例的方案中,服务器对返回给客户端的执行状态消息的消息长 度进行检测,当确定执行状态消息的消息长度大于客户端能够识别的最大消息 长度时,放弃本次客户端的同步请求(即不向客户端返回本次产生的执行状态 消息), 而是通过向客户端返回状态码, 要求客户端重新发送消息长度减少的 数据同步请求来重新进行同步操作,通过循环执行本发明实施例的方案,使服 务器生成的执行状态消息的消息长度逐步接近并小于客户端能够识别的最大 消息长度, 直至客户端与服务器之间数据同步过程完成,避免由于客户端无法 正确识别执行状态消息而导致同步过程中断的问题。 附图说明
图 1为背景技术中 SyncML Client和 SyncML Server之间进行数据同步的 步骤示意图;
图 2为本发明实施例一中数据同步的方法步骤示意图;
图 3为本发明实施例二中数据同步的方法步骤示意图;
图 4为本发明实施例三中数据同步的系统结构示意图;
图 5为本发明实施例四中服务器的结构示意图;
图 6为本发明实施例伍中客户端的结构示意图。 具体实施方式
为了实现本发明目的,在本发明实施例的方案中,服务器主动对返回给客 户端的执行状态消息的消息长度进行检测,当确定执行状态消息的消息长度大 于客户端能够识别的最大消息长度时,放弃本次客户端的同步请求(即不向客 户端返回本次产生的执行状态消息), 而是通过向客户端返回状态码, 要求客 户端重新发送消息长度减少的数据同步请求,由于服务器重新接收到的数据同 步请求的消息长度减少, 因此重新生成的执行状态消息的消息长度也会减少, 在重新生成的执行状态消息的消息长度不大于客户端能够识别的最大消息长 度时, 完成本次数据同步操作; 否则, 重复要求客户端发送消息长度不断减少 的数据同步请求,直至最终生成的执行状态消息的消息长度不大于客户端能够 识别的最大消息长度。通过本发明方案,服务器在执行状态消息不能被客户端 正确识别时, 要求客户端重新调整数据同步请求, 直至完成通过过程, 克服了 现有技术中服务器盲目地向客户端发送执行状态消息,导致客户端与服务器之 间的同步过程可能出现中断的问题。
本发明各实施例中的方案可以应用于 SyncML协议中,所涉及的服务器可 以是 SyncML Server, 所涉及的客户端可以是 SyncML Client。
下面结合说明书附图对本发明实施例进行详细描述。
实施例一:
如图 2所示, 为本发明实施例一中数据同步的方法步骤示意图, 所述方法 包括以下步骤:
步骤 201 : 服务器接收客户端发送的数据初始化请求, 所述数据初始化请 求中携带了 MaxMsgSize参数。
步骤 202: 服务器存储所述 MaxMsgSize参数, 并返回初始化响应。
上述步骤 201和步骤 202是服务器和客户端之间进行初始化的过程,是本 实施例的优选步骤。
在本实施例的方案中,服务器和客户端可以在首次进行数据同步之前进行 上述初始化操作, 无需在每次数据同步过程中执行上述初始化操作。
服务器可以通过在上述步骤 201和步骤 202的初始化过程中确定并记录所 述 MaxMsgSize参数, 进而确定客户端能够识别的最大消息长度, 也可以通过 其他方式确定客户端能够识别的最大消息长度,如客户端通过其他指令将自身 能够识别的最大消息长度发送给服务器。
步骤 203: 服务器接收客户端发送的数据同步请求。
在本步骤中,服务器接收到的数据同步请求可以是客户端首次向服务器发 送的数据同步请求,也可以是由于相邻的前一次数据同步被服务器放弃后,客 户端调整重新调整数据同步请求的消息长度后再次发送的数据同步请求。
所述数据同步请求中包括至少一条操作信息, 在本实施例中, 可以包括要 求删除数据库中第 1条至第 8条记录的 8条删除操作信息。 步骤 204: 服务器确定在响应所述数据同步请求中的操作信息后生成的执 行状态消息的消息长度。
假设在步骤 203中客户端发送的数据同步请求包含 8条操作信息,要求删 除除数据库中第 1条至第 8条记录, 则在本步骤中,服务器确定生成的执行状 态消息的消息长度为 1036字节。
步骤 205: 服务器判断生成的执行状态消息的消息长度是否大于客户端能 够识别的最大消息长度, 若是, 则执行步骤 206; 否则, 将生成的执行状态消 息返回给客户端, 完成本次数据同步过程。
在本实施例的方案中,服务器在生成执行状态消息后并不立即向客户端返 回,而是判断所述执行状态消息的消息长度是否大于客户端能够识别的最大消 息长度,也就是判断客户端能够正确识别生成的执行状态消息。在确定客户端 不能正确识别所述执行状态消息时,放弃本次数据同步过程, 即不向客户端返 回本次生成的执行状态消息,避免由于客户端无法正确识别执行状态消息而导 致同步过程中断的问题。
步骤 206: 服务器判断之前连续返回状态码的次数是否达到设定门限值, 若达到, 则结束本次数据同步过程; 否则, 执行步骤 207。
其中,连续返回状态码中的最后一次返回状态码至本次向客户端返回状态 码之间, 服务器没有向客户端返回过执行状态消息。 例如, 若本次是服务器第 15次接收到所述客户端发送的数据同步请求,而在第 14次至第 10次的连续 5 次接收到同一客户端发送的数据同步请求时都返回了状态码,但在第 9次返回 的是执行状态消息, 则表示之前连续返回状态码的次数为 5次, 第 9次的数据 同步过程成功完成。
若之前连续返回状态码的次数是否达到设定门限值,则服务器将通知客户 端结束本次数据同步过程,要求客户端不再针对本次需要同步的事件发送数据 同步请求。若客户端希望针对其他事件发起的新的数据同步请求, 则客户端可 以针对其他事件再次向服务器发送新的数据同步请求。
步骤 206是本发明实施例的优选步骤, 通过设定重传次数的门限值,避免 同步过程出现死循环而无法停止的问题, 同时,也避免重传次数过多导致通信 资源的过度浪费的问题。 需要说明的是,步骤 206中的重传过程可能是由于服务器生成的执行状态 消息的消息长度大于客户端能够识别的最大消息长度而发生的,也可能是由于 网络环境较差而发生的,在本实施例中, 可以设定不论何种原因导致服务器判 断之前连续返回状态码的次数已达到设定门限值时,都要求结束本次数据同步 过程; 也可以设定: 以 "服务器生成的执行状态消息的消息长度大于客户端能 够识别的最大消息长度"这一原因导致服务器判断之前连续返回状态码的次数 已达到设定门限值时, 才要求结束本次数据同步过程。
步骤 207: 服务器向客户端返回状态码(Alert Code ), 并跳转至步骤 203 , 等待重新接收客户端发送的消息长度减少了的数据同步请求。
所述状态码表示由于服务器生成的执行状态消息的消息长度大于客户端 能够识别的最大消息长度,服务器放弃本次客户端的数据同步请求,服务器将 等待客户端重传的消息长度减少了的数据同步请求, 循环执行上述步骤 203~ 步骤 207的操作, 直至在步骤 205中能够完成与客户端之间的数据同步过程, 或是在步骤 206 中确定连续返回状态码的次数已达到设定门限值而退出数据 同步过程。
在本步骤中,服务器向客户端返回状态码后,服务器将在步骤 206中涉及 的连续返回状态码的次数基础上,再增加连续返回状态码的次数, 并利用再次 增加的连续返回状态码的次数作为下一次执行步骤 206的判断条件。
通过本发明实施例一的方案,描述了服务器侧进行数据同步的过程, 由于 服务器在生成了执行状态消息后并不立即向客户端返回,而是在确定所述执行 状态消息的消息长度大于客户端能够识别的最大消息长度时,放弃本次数据同 步过程,要求客户端调整数据同步请求的消息长度, 直至生成的执行状态消息 的消息长度不大于客户端能够识别的最大消息长度时才与客户端完成数据同 步过程,避免由于客户端无法正确识别执行状态消息而导致同步过程中断的问 题。
实施例二:
本发明实施例二是从客户端侧来描述本发明实施例的数据同步方法,本发 明实施例二的方案与实施例一的方案相对应, 下面以图 3为例,对本发明实施 例二的方案进行说明。 本发明实施例二的方案包括以下步骤:
步骤 301: 客户端向服务器发送数据初始化请求, 所述数据初始化请求中 携带了 MaxMsgSize参数。
本步骤与实施例一中的步骤 201和步骤 202对应,是客户端和服务器之间 的初始化过程, 本步骤也是本实施例的优选步骤。
步骤 302: 客户端向服务器发送数据同步请求。
本步骤与实施例一中的步骤 203相对应,客户端可以在首次与服务器之间 进行数据同步时向服务器发送数据同步请求,也可以是在接收到服务器返回的 状态码后,调整相邻的上一次发送的数据同步请求的消息长度后, 向服务器发 送消息长度减少后的数据同步请求。
步骤 303: 客户端判断服务器返回的是状态码还是执行状态消息, 若返回 的是状态码, 则执行步骤 304; 否则, 完成本次数据同步过程。
本步骤与实施例一的步骤 204~步骤 207对应, 在服务器确定执行状态消 息的消息长度大于客户端能够识别的最大消息长度,即确定客户端不能正确识 别所述执行状态消息时, 向客户端返回状态码。
在本步骤中, 若客户端接收到服务器返回的状态码,表示服务器放弃本次 数据同步请求, 则客户端需要重传数据同步请求; 若客户端接收到服务器返回 的执行状态消息,表示服务器侧已完成本次数据同步过程,客户端识别接收到 的执行状态消息后, 完成本次数据同步过程。
步骤 304: 客户端减少相邻的上一次发送的数据同步请求的消息长度, 并 跳转至步骤 302, 向服务器发送减少消息长度的数据同步请求。
客户端去除了 M条删除操作信息后, 在步骤 205中发送的数据同步请求 中将携带 (L-M )条删除操作信息, 请求与服务器重新进行数据同步。
由于数据同步请求的消息长度减少了,服务器需要执行的删除操作内容也 减少了, 因此, 生成的执行状态消息的消息长度相对于上一次也将减少, 提高 服务器和客户端之间数据同步成功实现的可能性。
客户端去除的 M条删除操作信息可以在本次数据同步过程成功执行后, 再通过携带所述 M条删除操作信息的数据同步请求来要求服务器响应相应的 操作。 假设客户端发送给服务器的数据同步请求中可以携带 L ( L为大于 1的正 方式一:
客户端确定每条删除操作信息的消息长度, 并去除消息长度最长的 N条 删除操作信息, 所述 N为大于 0且小于 L的正整数。
方式二:
客户端去除所述数据同步请求中的 M条删除操作信息, 所述 M为大于 0 且小于 L的正整数。
具体地,客户端可以按照数据同步请求中携带的删除操作信息的数量来去 除其中 M条删除操作信息, 也可以按照数据同步请求的消息长度来去除其中 M条删除操作信息, 下面分别加以说明:
1、按照数据同步请求中携带的删除操作信息的数量来去除其中 M条删除 操作信息。
首先,客户端预先设定的第一比值范围, 如每次削减 8%~12%数目的删除 操作信息。
然后, 客户端确定需要去除的 M条删除操作信息, 所述 M与 L的比值在 所述第一比值范围内。
例如, 在 L=10时, 客户端确定当 M=l时, 削减的数目为 10%, M与 L 的比值在第一比值范围内, 因此, 客户端去除 10条删除操作信息中的 1条删 除操作信息。
2、 按照数据同步请求的消息长度来去除其中 M条删除操作信息。
首先,客户端预先设定的第二比值范围,如每次数据同步请求的消息长度 削减 8%~12%。
然后, 客户端确定 L条删除操作信息中, 每条删除操作信息的消息长度。 接着, 客户端根据设定的第二比值范围, 确定需要去除的 M条删除操作 信息, 所述去除的 M条删除操作信息的消息长度与消息长度减少前的数据同 步请求的消息长度的比值在所述第二比值范围内。
例如, 在携带的删除操作信息为 L条时, 数据同步请求的消息长度为 a, 则按照每条删除操作信息的消息长度, 从 L条删除操作信息中选择 M条删除 操作信息,要求 M条删除操作信息的消息长度为 b,且 b与 a的比值在第二比 值范围内。
需要说明的是,无论通过上述何种方式去除数据同步请求中的删除操作信 息后, 若去除删除操作信息的数据同步请求发送到服务器,且客户端接收到服 务器返回的执行状态消息(表示客户端和服务器完成针对去除删除操作信息的 数据同步请求的数据同步操作)后,客户端去除的删除操作信息对应的删除操 作仍需要与服务器进行同步, 因此,客户端向服务器发送包含去除的删除操作 信息的数据同步请求,针对包含去除的删除操作信息的数据同步请求, 可以重 新执行本实施例二的方案, 进行同步操作。
通过本发明实施例二的方案,描述了客户端侧进行数据同步的过程, 由于 长度过长而放弃本次数据同步过程, 因此,客户端将减少数据同步请求的消息 长度后重新发送给服务器,要求服务器按照再次接收到的数据同步请求进行数 据同步过程, 如此循环, 直至客户端与服务器之间数据同步过程完成, 避免由 于客户端无法正确识别执行状态消息而导致同步过程中断的问题。 进一步地, 本发明实施例二还提供了多种客户端减少数据同步请求的消息长度的方式,使 服务器生成的执行状态消息的消息长度逐步接近并小于客户端能够识别的最 大消息长度,在确保同步过程正确执行的情况下,使服务器能够同时响应的操 作达到最大化, 减少客户端和服务器之间的同步过程, 提高数据同步效率。
实施例三:
本发明实施例三还提供一种数据同步的系统, 所述系统包括客户端 11和 服务器 12, 其中: 客户端 11用于发送数据同步请求, 并在接收到状态码时, 减少所述数据同步请求的消息长度后,再次发送减少消息长度的数据同步请求 并重新进行数据同步; 服务器 12用于在接收到数据同步请求时, 确定在响应 所述数据同步请求中的操作信息后生成的执行状态消息的消息长度,在确定生 成的执行状态消息的消息长度大于客户端能够识别的最大消息长度时,返回状 态码。
服务器 12还用于判断之前连续返回状态码的次数是否达到设定门限值, 在没有达到门限值时, 向客户端返回状态码, 并增加连续返回状态码的次数。 其中,连续返回状态码中的最后一次返回状态码至本次向客户端返回状态 码之间, 服务器没有向客户端返回过执行状态消息;
服务器 12还用于与客户端 11进行初始化操作, 存储客户端 11发送的数 据初始化请求中携带的客户端能够识别的最大消息长度。
本实施例中的客户端 12可以按照实施例二中的多种方式来减少数据同步 请求的消息长度。
具体的,本实施例三中数据同步的系统的客户端 11和服务器 12的交互过 程如图 4所示:
第一步, 客户端 11和服务器 12之间进行初始化操作, 客户端 11向服务 器 12发送数据初: ½ 4匕 ( Initialization Package )请求, 在 Initialization Package 请求中携带 MaxMsgSize参数, 用于表示客户端 11能够识别服务器 12返回消 息的最大消息长度; 服务器 12存储所述 MaxMsgSize参数, 并在完成初始化 操作后, 向客户端 11返回初始化响应。
第二步, 在需要进行数据同步时, 客户端 11 向服务器 12发送数据同步
( Sync Package )请求, 所述数据同步请求的消息长度不大于 MaxMsgSize参 数所表示的最大消息长度。
第三步, 由服务器 12执行客户端 11请求的操作, 并生成执行状态消息 ( Status package )。 若生成的执行状态消息的消息长度大于 MaxMsgSize参数 所表示的最大消息长度, 则服务器 12向客户端 11返回状态码( Alert Code ), 通知客户端 11 当前生成的执行状态消息的消息长度大于 MaxMsgSize参数所 表示的最大消息长度; 若生成的执行状态消息的消息长度不大于 MaxMsgSize 参数所表示的最大消息长度, 则服务器 12将生成的执行状态信息返回给客户 端 11 , 完成本次数据同步过程。
第四步,客户端 11在接收到状态码时, 减少数据同步请求的消息长度后, 再次发送减少消息长度的数据同步请求并重新进行数据同步, 并跳转至第三 步。
实施例四: 本发明实施例四还提供一种服务器, 如图 5 所示, 包括: 请求接收模块 21、 判断模块 22和返回模块 23 , 其中: 请求接收模块 21用于接收数据同步 请求; 判断模块 22用于判断响应所述数据同步请求中的操作信息后生成的执 行状态消息的消息长度是否大于客户端能够识别的最大消息长度; 返回模块 23 用于在判断结果为生成的执行状态消息的消息长度大于客户端能够识别的 最大消息长度时, 向客户端返回状态码,指示客户端减少所述数据同步请求的 消息长度后, 向服务器发送减少消息长度的数据同步请求并重新进行数据同 步。
所述服务器还包括计数模块 24, 用于记录之前连续返回状态码的次数, 其中,连续返回状态码中的最后一次返回状态码至本次向客户端返回状态码之 间, 服务器没有向客户端返回过执行状态消息。
所述判断模块 22还用于判断之前连续返回状态码的次数是否达到设定门 限值, 在判断结果为没有达到设定门限值时, 触发返回模块 23。
返回模块 23在向客户端返回状态码后,触发计数模块 24增加连续返回状 态码的次数。
所述服务器还包括: 初始化模块 25和存储模块 26, 其中, 初始化模块 25 用于接收客户端发送的数据初始化请求,所述数据初始化请求中携带了客户端 能够识别的最大消息长度, 并返回初始化响应; 存储模块 26存储所述客户端 能够识别的最大消息长度。
本发明实施四中还包括能够实现实施例一各步骤的功能模块,此处不再赘 述。
实施例五:
本发明实施例五还提供一种客户端, 如图 6 所示, 包括: 请求发送模块 31、 状态码接收模块 32和调整模块 33 , 其中: 请求发送模块 31用于发送数 据同步请求; 状态码接收模块 32用于在发送数据同步请求后, 接收返回的状 态码; 调整模块 33用于减少当前发送的所述数据同步请求的消息长度, 并利 用减少消息长度的数据同步请求触发请求发送模块,请求与服务器重新进行数 据同步。 所述调整模块 33可以按照实施例二中的多种方式来减少数据同步请求的 消息长度。
本发明实施五中还包括能够实现实施例二各步骤的功能模块,此处不再赘 述。
具体的,所述数据同步请求中携带 L条删除操作信息;调整模块可以通过 以下模块实现所述减少数据同步请求的消息长度:
用于去除数据同步请求中的 M条删除操作信息的模块; 所述 L为大于 1 的正整数, 所述 M为大于 0且小于 L的正整数。
其中, 所述用于去除数据同步请求中的 M条删除操作信息的模块具体可 以用于:
根据设定的第一比值范围, 确定需要去除的 M条删除操作信息, 所述 M 与 L的比值在所述第一比值范围内; 或者,
确定每条删除操作信息的消息长度,根据设定的第二比值范围,确定需要 去除的 M条删除操作信息, 所述去除的 M条删除操作信息的消息长度与消息 长度减少前的数据同步请求的消息长度的比值在所述第二比值范围内。
或者,所述数据同步请求中携带 L条删除操作信息;调整模块可以通过以 下模块实现所述减少数据同步请求的消息长度:
用于确定每条删除操作信息的消息长度, 并去除消息长度最长的 N条删 除操作信息的模块, 所述 L为大于 1的正整数, 所述 N为大于 0且小于 L的 正整数。
所述客户端还可以包括: 用于在接收到服务器返回的执行状态消息时, 向 服务器发送包含去除的删除操作信息的数据同步请求的模块。
本领域内的技术人员应明白, 本申请的实施例可提供为方法、 系统、 或计 算机程序产品。 因此, 本申请可采用完全硬件实施例、 完全软件实施例、 或结 合软件和硬件方面的实施例的形式。 而且, 本申请可采用在一个或多个其中包 含有计算机可用程序代码的计算机可用存储介质 (包括但不限于磁盘存储器、
CD-ROM, 光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、 设备(系统)、 和计算机程序产 品的流程图和 /或方框图来描述的。应理解可由计算机程序指令实现流程图和 /或方框图中的每一流程和 /或方框、以及流程图和 /或方框图中的流程和 / 或方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入 式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算 个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设 备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中 的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个 流程和 /或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使 得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处 理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个 流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基 本创造性概念, 则可对这些实施例做出另外的变更和修改。 所以, 所附权利要 求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。 明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及 其等同技术的范围之内, 则本发明也意图包含这些改动和变型在内。

Claims

权 利 要 求
1、 一种数据同步的方法, 其特征在于, 所述方法包括:
服务器在接收到客户端发送的数据同步请求时,确定在响应所述数据同步 请求中的操作信息后生成的执行状态消息的消息长度;
服务器在确定生成的执行状态消息的消息长度大于客户端能够识别的最 大消息长度时, 向客户端返回状态码, 指示客户端减少所述数据同步请求的消 息长度后, 向服务器发送减少消息长度的数据同步请求并重新进行数据同步。
2、 如权利要求 1所述的方法, 其特征在于, 服务器在确定生成的执行状 态消息的消息长度大于客户端能够识别的最大消息长度之后,且向客户端返回 状态码之前, 所述方法还包括:
服务器确定之前连续返回状态码的次数未达到设定门限值;
服务器本次在向客户端返回状态码之后, 所述方法还包括:
服务器增加连续返回状态码的次数。
3、 如权利要求 1或 2所述的方法, 其特征在于, 服务器接收数据同步请 求之前, 所述方法还包括:
服务器接收客户端发送的数据初始化请求,所述数据初始化请求中携带客 户端能够识别的最大消息长度;
服务器存储所述客户端能够识别的最大消息长度, 并返回初始化响应。
4、 一种数据同步的方法, 其特征在于, 所述方法包括:
客户端向服务器发送数据同步请求;
客户端在接收到服务器返回的状态码时,减少所述数据同步请求的消息长 度, 并向服务器发送减少消息长度的数据同步请求,请求与服务器重新进行数 据同步。
5、 如权利要求 4所述的方法, 其特征在于, 所述数据同步请求中携带 L 条删除操作信息;
客户端减少所述数据同步请求的消息长度, 具体包括:
客户端去除数据同步请求中的 M条删除操作信息;
所述 L为大于 1的正整数, 所述 M为大于 0且小于 L的正整数。
6、 如权利要求 5所述的方法, 其特征在于, 客户端确定需要去除的 M条 删除操作信息, 具体包括:
客户端根据设定的第一比值范围, 确定需要去除的 M条删除操作信息, 所述 M与 L的比值在所述第一比值范围内; 或者
客户端确定每条删除操作信息的消息长度,根据设定的第二比值范围,确 定需要去除的 M条删除操作信息, 所述去除的 M条删除操作信息的消息长度 与消息长度减少前的数据同步请求的消息长度的比值在所述第二比值范围内。
7、 如权利要求 4所述的方法, 其特征在于, 所述数据同步请求中携带 L 条删除操作信息;
客户端减少所述数据同步请求的消息长度, 具体包括:
客户端确定每条删除操作信息的消息长度, 并去除消息长度最长的 N条 删除操作信息, 所述 L为大于 1的正整数, 所述 N为大于 0且小于 L的正整 数。
8、 如权利要求 5或 7所述的方法, 其特征在于, 客户端向服务器发送减 少消息长度的数据同步请求之后, 所述方法还包括:
客户端在接收到服务器返回的执行状态消息时,向服务器发送包含去除的 删除操作信息的数据同步请求。
9、 一种服务器, 其特征在于, 所述服务器包括:
请求接收模块, 用于接收数据同步请求;
判断模块,用于判断响应所述数据同步请求中的操作信息后生成的执行状 态消息的消息长度是否大于客户端能够识别的最大消息长度;
返回模块,用于在判断结果为生成的执行状态消息的消息长度大于客户端 能够识别的最大消息长度时, 向客户端返回状态码,指示客户端减少所述数据 同步请求的消息长度后,向服务器发送减少消息长度的数据同步请求并重新进 行数据同步。
10、 如权利要求 9所述的服务器, 其特征在于, 所述服务器还包括: 计数模块, 用于记录之前连续返回状态码的次数;
所述判断模块还用于:判断之前连续返回状态码的次数是否达到设定门限 值, 在判断结果为没有达到设定门限值时, 触发返回模块; 所述返回模块还用于: 在向客户端返回状态码后,触发计数模块增加连续 返回状态码的次数。
11、 如权利要求 9或 10所述的服务器, 其特征在于, 所述服务器还包括: 初始化模块, 用于接收客户端发送的数据初始化请求, 所述数据初始化请 求中携带客户端能够识别的最大消息长度, 并返回初始化响应;
存储模块, 用于存储所述客户端能够识别的最大消息长度。
12、 一种客户端, 其特征在于, 所述客户端包括:
请求发送模块, 用于发送数据同步请求;
状态码接收模块, 用于接收状态码;
调整模块, 用于减少当前发送的所述数据同步请求的消息长度, 并利用减 少消息长度的数据同步请求触发请求发送模块,请求与服务器重新进行数据同 步。
13、 如权利要求 12所述的客户端, 其特征在于, 所述数据同步请求中携 带 L条删除操作信息;
调整模块通过以下模块实现所述减少数据同步请求的消息长度:
用于去除数据同步请求中的 M条删除操作信息的模块; 所述 L为大于 1 的正整数, 所述 M为大于 0且小于 L的正整数。
14、 如权利要求 13所述的客户端, 其特征在于, 所述用于去除数据同步 请求中的 M条删除操作信息的模块具体用于:
根据设定的第一比值范围, 确定需要去除的 M条删除操作信息, 所述 M 与 L的比值在所述第一比值范围内; 或者,
确定每条删除操作信息的消息长度,根据设定的第二比值范围,确定需要 去除的 M条删除操作信息, 所述去除的 M条删除操作信息的消息长度与消息 长度减少前的数据同步请求的消息长度的比值在所述第二比值范围内。
15、 如权利要求 12所述的客户端, 其特征在于, 所述数据同步请求中携 带 L条删除操作信息;
调整模块通过以下模块实现所述减少数据同步请求的消息长度:
用于确定每条删除操作信息的消息长度, 并去除消息长度最长的 N条删 除操作信息的模块, 所述 L为大于 1的正整数, 所述 N为大于 0且小于 L的 正整数。
16、如权利要求 13或 15所述的客户端,其特征在于,所述客户端还包括: 用于在接收到服务器返回的执行状态消息时,向服务器发送包含去除的删 除操作信息的数据同步请求的模块。
17、 一种数据同步的系统, 其特征在于, 所述系统包括:
客户端, 用于发送数据同步请求, 并在接收到状态码时, 减少所述数据同 步请求的消息长度后,再次发送减少消息长度的数据同步请求并重新进行数据 同步;
服务器, 用于在接收到数据同步请求时,确定在响应所述数据同步请求中 的操作信息后生成的执行状态消息的消息长度,在确定生成的执行状态消息的 消息长度大于客户端能够识别的最大消息长度时, 返回状态码。
PCT/CN2012/072028 2011-03-07 2012-03-07 一种数据同步的方法、系统及设备 WO2012119547A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110053760.5A CN102684865B (zh) 2011-03-07 2011-03-07 一种数据同步的方法、系统及设备
CN201110053760.5 2011-03-07

Publications (1)

Publication Number Publication Date
WO2012119547A1 true WO2012119547A1 (zh) 2012-09-13

Family

ID=46797494

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/072028 WO2012119547A1 (zh) 2011-03-07 2012-03-07 一种数据同步的方法、系统及设备

Country Status (2)

Country Link
CN (1) CN102684865B (zh)
WO (1) WO2012119547A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666340A (zh) * 2020-05-27 2020-09-15 中国平安财产保险股份有限公司 基于大数据的同步数据校对方法、装置和计算机设备
CN112783972A (zh) * 2020-12-31 2021-05-11 武汉工程大学 图像特征值数据的同步方法及系统

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105827736B (zh) * 2016-05-20 2019-01-25 上海画擎信息科技有限公司 一种消息发送方法及系统
CN114449034B (zh) * 2022-01-28 2024-06-25 湖南快乐阳光互动娱乐传媒有限公司 一种服务调用系统及方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1565101A (zh) * 2001-10-09 2005-01-12 诺基亚有限公司 在服务器的请求消息具有最大长度的同步系统中由服务器发起同步的方法
CN1744606A (zh) * 2005-09-30 2006-03-08 北京邮电大学 在终端和服务器之间移动用户个人数据的同步处理方法
CN101399656A (zh) * 2007-09-27 2009-04-01 华为技术有限公司 一种同步标记语言中的数据同步方法及系统
CN101442397A (zh) * 2007-11-23 2009-05-27 中兴通讯股份有限公司 原因值传输方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7570668B2 (en) * 2001-10-03 2009-08-04 Nokia Corporation Data synchronization
CN100518134C (zh) * 2004-09-01 2009-07-22 华为技术有限公司 报文转换过程中的超长报文的处理方法
CN101877862A (zh) * 2009-04-30 2010-11-03 中兴通讯股份有限公司 大对象传输方法、服务器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1565101A (zh) * 2001-10-09 2005-01-12 诺基亚有限公司 在服务器的请求消息具有最大长度的同步系统中由服务器发起同步的方法
CN1744606A (zh) * 2005-09-30 2006-03-08 北京邮电大学 在终端和服务器之间移动用户个人数据的同步处理方法
CN101399656A (zh) * 2007-09-27 2009-04-01 华为技术有限公司 一种同步标记语言中的数据同步方法及系统
CN101442397A (zh) * 2007-11-23 2009-05-27 中兴通讯股份有限公司 原因值传输方法

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666340A (zh) * 2020-05-27 2020-09-15 中国平安财产保险股份有限公司 基于大数据的同步数据校对方法、装置和计算机设备
CN111666340B (zh) * 2020-05-27 2023-10-27 中国平安财产保险股份有限公司 基于大数据的同步数据校对方法、装置和计算机设备
CN112783972A (zh) * 2020-12-31 2021-05-11 武汉工程大学 图像特征值数据的同步方法及系统

Also Published As

Publication number Publication date
CN102684865B (zh) 2015-05-27
CN102684865A (zh) 2012-09-19

Similar Documents

Publication Publication Date Title
US9967315B2 (en) Electronic device, storage medium and file transferring method
US10069894B2 (en) Electronic device, storage medium and file transferring method
EP3108639B1 (en) Transport accelerator implementing extended transmission control functionality
EP2119171B1 (en) Improved data transfer method, system and protocol
CN109309730B (zh) 一种可信的文件传输方法和系统
US20030225835A1 (en) Distributing files from a single server to multiple clients via cyclical multicasting
WO2013178082A1 (zh) 图片上传方法、系统、客户端及网络服务器、计算机存储介质
JP2002524915A (ja) 低待ち時間通信用のシステムおよび方法
JP2014524092A (ja) 単一ソケットポイントツーマルチポイント性能による高信頼性仮想双方向データストリーム通信のためのシステムおよび方法
KR20080068110A (ko) 데이터 동기화 처리 방법 그리고 클라이언트 단말기, 서버및 그것의 데이터 동기화 시스템
WO2012149762A1 (zh) 拥塞控制方法及设备
EP4239974A1 (en) Data transmission method and apparatus, and computer-readable medium and electronic device
WO2014180407A1 (zh) 推送方法及装置
CN113157300A (zh) 一种数据处理方法、装置和存储介质
WO2012119547A1 (zh) 一种数据同步的方法、系统及设备
JP2009515489A (ja) 無線ネットワークにおいてシステム情報メッセージを断片化する方法および装置
WO2014206034A1 (zh) 数据的分解同步方法及系统
WO2009103212A1 (zh) 一种数据同步的方法、系统和装置
CN112261142B (zh) 一种rdma网络的数据重传方法、装置及fpga
CN105743951A (zh) 一种数据发送、接收的方法及装置
CN110740195B (zh) 一种基于消息引擎的分布式系统数据同步方法及系统
CN110018875B (zh) 一种基于idv的桌面同步实现方法
WO2018076903A1 (zh) 一种动态时间分配方法及装置
CN115277649A (zh) 多媒体会议场景下的文档协同编辑的方法及装置
WO2003051017A2 (en) Method and apparatus to facilitate direct transfer of data between a data device and a network connection

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: 12754498

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: 12754498

Country of ref document: EP

Kind code of ref document: A1