CN109740027A - Method for interchanging data, device, server and storage medium - Google Patents
Method for interchanging data, device, server and storage medium Download PDFInfo
- Publication number
- CN109740027A CN109740027A CN201910080274.9A CN201910080274A CN109740027A CN 109740027 A CN109740027 A CN 109740027A CN 201910080274 A CN201910080274 A CN 201910080274A CN 109740027 A CN109740027 A CN 109740027A
- Authority
- CN
- China
- Prior art keywords
- data
- directory
- title
- original
- directory title
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 64
- 238000012986 modification Methods 0.000 claims description 70
- 230000004048 modification Effects 0.000 claims description 70
- 238000004590 computer program Methods 0.000 claims description 3
- 230000008439 repair process Effects 0.000 claims description 3
- 238000005096 rolling process Methods 0.000 description 21
- 230000009471 action Effects 0.000 description 20
- 230000008569 process Effects 0.000 description 18
- 230000002159 abnormal effect Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 6
- 230000005291 magnetic effect Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 238000005192 partition Methods 0.000 description 3
- 230000002093 peripheral effect Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 210000003733 optic disk Anatomy 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a kind of method for interchanging data, device, server and storage mediums, wherein data exchange request includes the mark of the first data to be exchanged and the mark of the second data this method comprises: receiving data exchange request;According to the first original directory title of the first data of identifier lookup of the first data, and, according to the second original directory title of the second data of identifier lookup of the second data;The first original directory title and the second original directory title are exchanged, the first new directory title of the first data and the second new directory title of the second data are obtained.The embodiment of the present invention, by exchanging the directory name of data to be exchanged, can be rapidly completed data exchange, and avoid the read-write operation of data to be exchanged and occupy server resource, improve the efficiency of data exchange when carrying out data exchange.
Description
Technical field
The present embodiments relate to field of computer technology more particularly to a kind of method for interchanging data, device, server and
Storage medium.
Background technique
In database and data management software, the number of different objects is stored using the data file under different catalogues
According to being a kind of common method, and there is the demand for swapping the data of different objects in database.
Column storage table in database, for the data of different lines, a kind of existing storage mode is by the data of different lines
It is stored in data file independent, the column data file of the same table is stored in the same catalogue.Such as database
Middle column storage table T has two column: C1 and C2, and the data of the table are potentially stored in catalogue DATA_T, and the data of two column are respectively
File DATA_C1.dta and DATA_C2.dta under the catalogue.
And database has the operation of data exchange, such as the operation of partition table exchange partition, needs the sublist number of partition table
It is swapped according to the data with other tables.Currently, for the data using document storage mode, more commonly used data exchange side
Method is data duplication.But the method for this data duplication be due to that there are read-write operation and can occupy server resource, it may
It will affect the progress of database regular traffic, such as data base read-write file operation, be forced other industry being lined up because of resource occupation
Business operation etc., in the huge situation of database data amount, performance is poor.
Summary of the invention
The embodiment of the invention provides a kind of method for interchanging data, device, server and storage mediums, can solve existing
In technology the technical issues of low efficiency.
In a first aspect, the embodiment of the invention provides a kind of method for interchanging data, comprising:
Data exchange request is received, the data exchange request includes the mark and the second data of the first data to be exchanged
Mark;
According to the first original directory title of the first data described in the identifier lookup of first data, and, according to institute
State the second original directory title of the second data described in the identifier lookup of the second data;
The first original directory title and the second original directory title are exchanged, the first new mesh of the first data is obtained
Record the second new directory title of title and the second data.
Second aspect, the embodiment of the invention also provides a kind of DEU data exchange unit, which includes:
Request module, exchange request for receiving data, the data exchange request includes the first data to be exchanged
The mark of mark and the second data;
Catalogue module, the first original directory name for the first data according to the identifier lookup of first data
Claim, and, according to the second original directory title of the second data described in the identifier lookup of second data;
Switching Module obtains first for exchanging the first original directory title and the second original directory title
First new directory title of data and the second new directory title of the second data.
Further, the Switching Module is specifically used for:
It is the first temp directory title, the second original directory name modifications by the first original directory name modifications
For the first original directory title, the first original directory name is referred to as the second new directory title;
It is the second original directory title, the second original directory title by the first temp directory name modifications
As the first new directory title.
Further, described device further includes temporary file module, and the temporary file module is specifically used for: in the friendship
It changes before the first original directory title and the second original directory title,
The directory information of exchange transaction number and first data and the directory information of second data are obtained, and will
Exchange transaction number, the directory information of first data and the directory information of second data are stored in temporary file
In, the directory information of first data include the first data catalogue mark and the first data directory path, described second
The directory information of data includes the directory path of the catalogue mark and the second data of the second data.
Further, described device further includes the first roll-back module, and first roll-back module is specifically used for: the exchange
After the first original directory title and the second original directory title,
Detect that rollback is requested;
If finding the first temp directory title and the second new directory title being lost, asked according to the rollback
Asking the first temp directory name modifications is the first original directory title;
If finding the first temp directory title and finding the second new directory title, according to the rollback
Request will the second new directory name modifications for the second original directory title and then by the first temp directory name
Title is revised as the first original directory title.
Further, described device further includes the second roll-back module, and second roll-back module is specifically used for: the exchange
After the first original directory title and the second original directory title,
Detect that rollback is requested;
Affairs are exchanged with the temporary file if the first temp directory title, revocation transaction number can not be found
Catalogue mark and the catalogue mark of the first data in the temporary file or the second data in number identical and rewind journal
Catalogue identify different, then be the second temp directory title, the second new directory name by the first new directory name modifications
Title is revised as the first new directory title, and by the second temp directory name modifications is the second new directory name
Claim.
Further, described device further includes third roll-back module, and the third roll-back module is specifically used for: the exchange
After the first original directory title and the second original directory title,
Detect that rollback is requested;
If the first temp directory title can not be found and find the first new directory title, second is faced
When directory name be revised as the second new directory title.
After directory name and the second original directory title,
Further, described device further includes the 4th roll-back module, and the 4th roll-back module is specifically used for: the exchange
After the first original directory title and the second original directory title,
Detect that rollback is requested;
If the first temp directory title can not be found and the first new directory title can not be found, by institute
The second new directory name modifications are stated to be the first new directory title and then be described by the second temp directory name modifications
Two new directory titles.
The third aspect, the embodiment of the invention also provides a kind of server, the server includes:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device realizes method for interchanging data as described above.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer
Program, the program realize method for interchanging data as described above when being executed by processor.
The embodiment of the present invention is by receiving data exchange request, the first number according to the identifier lookup of first data
According to the first original directory title, and, according to the second original mesh of the second data described in the identifier lookup of second data
Title is recorded, and exchanges the first original directory title and the second original directory title, obtains the first of the first data
Second new directory title of new directory title and the second data.The embodiment of the present invention passes through exchange when carrying out data exchange
Data exchange can be rapidly completed in the directory name of data to be exchanged, and avoids the read-write operation of data to be exchanged and account for
With server resource, the efficiency of data exchange is improved.
Detailed description of the invention
Fig. 1 is the flow chart of the method for interchanging data in the embodiment of the present invention one;
Fig. 2 is the schematic diagram of the method for interchanging data in the embodiment of the present invention one;
Fig. 3 is the flow chart of the method for interchanging data in the embodiment of the present invention two;
Fig. 4 is the flow chart of the method for interchanging data in the embodiment of the present invention three;
Fig. 5 is the structural schematic diagram of the DEU data exchange unit in the embodiment of the present invention four;
Fig. 6 is the structural schematic diagram of the server in the embodiment of the present invention five.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just
Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is the flow chart of the method for interchanging data in the embodiment of the present invention one, and the present embodiment is applicable to realize data
The case where exchange, this method can be executed by DEU data exchange unit, which can be real by the way of software and/or hardware
It is existing, for example, the device is configured in server.
Whole explanation is carried out by method for interchanging data of the schematic diagram to the embodiment of the present invention, referring specifically to Fig. 2.
Fig. 2 is the schematic diagram of the method for interchanging data in the embodiment of the present invention one, and the left side is the corresponding text of two data to be exchanged in figure
The directory name of part is respectively A and B, realizes data exchange, the right side in figure by the directory name of two data respective files of exchange
Side is that the directory name of the corresponding file of two data after data exchange is respectively B and A, realizes simple and fast data
Exchange.
As shown in Figure 1, this method can specifically include:
S110, data exchange request is received, data exchange request includes the mark and the second number of the first data to be exchanged
According to mark.
Wherein, data exchange is to handle in database the exchange that the data under wherein different directories carry out, due to data
Data in library under different directories correspond to different objects, also refer to that the data of different objects swap, according to reality in database
Border situation needs to carry out the operation of data exchange.
Specifically, DEU data exchange unit can receive the data exchange request of user's transmission, also can receive in database
The data exchange request sent when other operations is carried out, is not construed as limiting in source the present embodiment of specific data exchange request.
Further, the mark of the mark and the second data in data exchange request including the first data to be exchanged, wherein mark is used
In distinguishing data to be exchanged, the concrete form of mark, which can according to need, to be set, such as can pass through digital representation.
S120, the first original directory title according to the first data of identifier lookup of the first data, and, according to the second number
According to the second data of identifier lookup the second original directory title.
Wherein, directory name is for distinguishing different catalogues, and data to be exchanged are respectively stored in difference in the present embodiment
The corresponding catalogue of directory name in, such as the first data are stored in the first catalogue, and the second data are stored in the second catalogue
Deng.
Specifically, after obtaining the mark of the first data and the mark of the second data, by being preset in DEU data exchange unit
In search program or algorithm can be according to the directory name of the identifier lookup of the first data to the first data, according to the second number
According to identifier lookup to the directory name of the second data, the directory name of the first data is the first original directory name in the present embodiment
Claim, the directory name of the second data is the second original directory title.
S130, the first original directory title of exchange and the second original directory title, obtain the first new directory of the first data
Second new directory title of title and the second data.
Specifically, the first original directory title of exchange and the second original directory title, may include: by the first original directory
Name modifications are the first temp directory title, and the second original directory name modifications are the first original directory title, the first original mesh
Record name is referred to as the second new directory title;It is the second original directory title, the second original mesh by the first temp directory name modifications
Record name is referred to as the first new directory title.
Wherein, the first new directory title and the second new directory title be in order to distinguish before data exchange and data exchange after
Directory name not renames the corresponding directory name of the first data and the corresponding directory name of the second data.Example
Property, if the entitled A of the first original directory of the first data, the entitled B of the second original directory of the second data carries out data friendship
After alternatively, the entitled B of the first new directory of the first data, the entitled A of the second new directory of the second data, it is seen then that be only the
The directory name of one data and the second data is exchanged, and does not generate new directory name.
The technical solution of the present embodiment, by receiving data exchange request, according to the identifier lookup first of the first data number
According to the first original directory title, and, according to the second original directory title of the second data of identifier lookup of the second data, and
And the first original directory title and the second original directory title are exchanged, obtain the first new directory title and second of the first data
Second new directory title of data.The present embodiment, can by exchanging the directory name of data to be exchanged when carrying out data exchange
It data exchange is rapidly completed, and avoids the read-write operation of data to be exchanged and occupies server resource, improve data
The efficiency of exchange.
Embodiment two
Fig. 3 is the flow chart of the method for interchanging data in the embodiment of the present invention two.Base of the present embodiment in above-described embodiment
On plinth, above-mentioned method for interchanging data has been advanced optimized.Correspondingly, as shown in figure 3, the method for the present embodiment specifically includes:
S210, data exchange request is received, data exchange request includes the mark and the second number of the first data to be exchanged
According to mark.
S220, the first original directory title according to the first data of identifier lookup of the first data, and, according to the second number
According to the second data of identifier lookup the second original directory title.
The directory information of S230, the directory information for obtaining exchange transaction number and the first data and the second data, and will hand over
The directory information for changing transaction number, the directory information of the first data and the second data is stored in temporary file.
Wherein, exchange transaction number is the mark (ID) of corresponding Current transaction when carrying out data exchange.Directory information includes
Catalogue mark and directory path, the directory information of the first data include the catalogue road of the catalogue mark and the first data of the first data
Diameter, the directory information of the second data include the directory path of the catalogue mark and the second data of the second data.Such as first data
Catalogue mark can be id1, directory path can be name1, the second data catalogue mark can be id2, directory path
It can be name2.
Specifically, obtaining the directory information of the first data according to the mark of the first data, obtained according to the mark of the second data
The directory information and for taking the directory information of the second data, and obtaining exchange transaction number, and transaction number, the first data will be exchanged
The directory information of two data is stored in temporary file.Wherein, temporary file is a newly-built file of data exchange, temporarily
After document creation is completed, the corresponding catalogue of the first data neutralizes in the corresponding catalogue of the second data and stores the temporary file.
Temporary file in the present embodiment is the atomicity for guaranteeing data exchange, guarantee in data exchange or after
It is continuous that any time point when rollback is needed to be abnormal, correct state can be restored it.
S240, the first original directory title of exchange and the second original directory title, obtain the first new directory of the first data
Second new directory title of title and the second data.
Specifically, the first original directory title of exchange and the second original directory title, may include: by the first original directory
Name modifications are the first temp directory title, and the second original directory name modifications are the first original directory title, the first original mesh
Record name is referred to as the second new directory title;It is the second original directory title, the second original mesh by the first temp directory name modifications
Record name is referred to as the first new directory title.
In addition, may include: generation data exchange after the first original directory title of exchange and the second original directory title
Rewind journal, may include Log Types, exchange transaction number, the directory information of the first data and the second number in the rewind journal
According to directory information.If the rewind journal is used to carry out rollback to the data exchange when occurring any mistake after data exchange
Operation.
S250, detect that rollback is requested.
Wherein, rollback (Rollback) refers to that program or data are when the error occurs in database, and program or data is extensive
The multiple operation to last correct status.
Specifically, DEU data exchange unit detects this affairs after the rollback request or data exchange that user sends
The rollback request sent when appearance is abnormal in the rollback request sent when subsequent operation exception or data exchange process, specifically
The rollback request sent when can be abnormal for any one step in S210-S240, the source sheet of specific rollback request
It is not construed as limiting in embodiment.Further, the specific execution sequence of S250 is not only after S240, if appointing in S210-S240
When step of anticipating is abnormal, it can also be executed after any one step in S210-S240.
If S260, finding the first temp directory title and the second new directory title and losing, according to rollback request by the
One temp directory name modifications are the first original directory title.
Specifically, illustrating occur exception in data exchange process if finding the first temp directory title, not completing
Data exchange, if the second new directory title (i.e. the first original directory title) at this time after data exchange is also not present, explanation
In data exchange process only by the first original directory name modifications be the first temp directory title, be also not carried out the second original mesh
Record name modifications are the first original directory title (i.e. the second new directory title).At this point, being requested according to the rollback directly by first
Temp directory name modifications are the first original directory title, that is, realize rollback.
If S270, finding the first temp directory title and finding the second new directory title, being requested according to rollback will
Second new directory name modifications are the second original directory title and then are the first original mesh by the first temp directory name modifications
Record title.
Specifically, illustrating data exchange mistake if finding the first temp directory title and finding the second new directory title
In journey by the first original directory name modifications be the first temp directory title after, also perform and repair the second original directory title
It is changed to the first original directory title (i.e. the second new directory title).At this point, requesting to repair the second new directory title according to the rollback
Be changed to the second original directory title and then by the first temp directory name modifications be the first original directory title, realize back
Rolling.
It optionally, can also include S251-S252 (not shown) after S240, specific:
S251, detect that rollback is requested.
S252, if the first temp directory title can not be found, revocation transaction number with temporary file exchanges transaction number
Catalogue mark and the catalogue mark of the first data in temporary file or the catalogue of the second data in identical and rewind journal
Mark is different, then is the second temp directory title by the first new directory name modifications, the second new directory name modifications are first new
Directory name, and by the second temp directory name modifications be the second new directory title.
Wherein, revocation transaction number is the mark (ID) of corresponding Current transaction when carrying out rollback.
If the first temp directory title can not be found, illustrate that data exchange process has been finished, the first interim mesh
Record title is not present.At this point, judging revocation transaction number, whether transaction number is identical, i.e. judgement is interim with exchanging in temporary file
Whether file is that the corresponding transaction number of revocation transaction number generates and revocation transaction number affairs corresponding with exchange transaction number are
No is the same affairs.And the catalogue mark and the first data in temporary file for judging the first data in rewind journal
Catalogue identifies whether the mesh of the catalogue mark and the second data in temporary file of the second data in identical or rewind journal
Record identifies whether identical.
Specifically, exchanging affairs with temporary file if the first temp directory title, revocation transaction number can not be found
Catalogue mark and the catalogue mark of the first data in temporary file or the mesh of the second data in number identical and rewind journal
Record mark is different, then executes rolling back action on the basis of data exchange is completed, and the first new directory name modifications are faced for second
When directory name, the second new directory name modifications are the first new directory title, and by the second temp directory name modifications are the
Two new directory titles.If data exchange executes rolling back action, temp directory title therein and facing when data exchange when completing
When directory name it is different, distinguish, handled when occurring abnormal so as to subsequent rollback process.
If the first temp directory title can not be found, revocation transaction number is different from the exchange transaction number in temporary file,
Illustrating temporary file not is that the corresponding affairs of revocation transaction number generate, and the data exchange in the corresponding affairs of revocation transaction number is simultaneously
It is not carried out, therefore does not execute rolling back action directly.If also, the catalogue mark and temporary file of the first data in rewind journal
In the first data the catalogue catalogue mark that identifies the second data in identical or rewind journal and the in temporary file
The catalogue mark of two data is identical, then illustrates that data exchange is not carried out, also do not execute rolling back action directly.
It optionally, can also include S261-S262 (not shown) after S240, specific:
S261, detect that rollback is requested.
It is interim by second if S262, the first temp directory title can not be found and find the first new directory title
Directory name is revised as the second new directory title.
Specifically, illustrate that data exchange process has been finished if the first temp directory title can not be found, first
Temp directory title is not present.If finding the first new directory title at this time, illustrate in the affairs after data exchange
Other operations rollback has been carried out, and occur abnormal in rollback process, rollback before is not carried out success.Also,
Rolling back action before has been completed that by the first new directory name modifications be the second temp directory title, later by the second new mesh
Record the operation that name modifications are the first new directory title, at this time then before rolling back action by the second temp directory name modifications
For the second new directory title, that is, realize rolling back action.
It optionally, can also include S271-S272 (not shown) after S240, specific:
S271, detect that rollback is requested;
If S272, the first temp directory title can not be found and the first new directory title can not be found, by second
New directory name modifications are the first new directory title and then are the second new directory title by the second temp directory name modifications.
Specifically, illustrate that data exchange process has been finished if the first temp directory title can not be found, first
Temp directory title is not present.If can not also find the first new directory title, the rolling back action before illustrating has been completed
It is the second temp directory title by the first new directory name modifications, the rolling back action after not carrying out also.At this point, before then
Rolling back action be the first new directory title by the second new directory name modifications and then by the second temp directory name modifications be
Second new directory title, that is, realize rolling back action.
The technical solution of the present embodiment, by receiving data exchange request, according to the identifier lookup first of the first data number
According to the first original directory title, and, according to the second original directory title of the second data of identifier lookup of the second data, and
And the first original directory title and the second original directory title are exchanged, obtain the first new directory title and second of the first data
Second new directory title of data;Also, it detects that rollback is requested, is requested to realize rolling back action according to the rollback.The present embodiment
When carrying out data exchange, by exchange data to be exchanged directory name, data exchange can be rapidly completed, and avoid to
It exchanges the read-write operation of data and occupies server resource, improve the efficiency of data exchange;Also, by establishing interim text
Part and different temp directory titles is set in the rollback process after data exchange and data are exchanged into function, may be implemented not
With the rolling back action of the data exchange under abnormal conditions, the atomicity of data exchange is further ensured.
Embodiment three
Fig. 4 is the flow chart of the method for interchanging data in the embodiment of the present invention three.The present embodiment can be with above-described embodiment
Basis further embodies the rolling back action in method for interchanging data by an example.This method specifically can wrap
It includes:
S301, beginning.
Specifically, starting to execute rolling back action after detecting rollback request.
Information in S302, acquisition rewind journal.
The information of rewind journal stored when obtaining data exchange may include Log Types, exchange in the rewind journal
The directory information of transaction number, the directory information of the first data and the second data.
S303, it whether there is the first temp directory title.
Since the first temp directory title can be generated in data exchange process, the first temp directory name is judged whether there is
Claim, and if it exists, illustrate occur abnormal conditions in data exchange process, then execute S311, if it does not exist, illustrate data exchange process
It is finished, then executes S304.
S304, it whether there is the second temp directory title.
In the present embodiment, the rollback process that data exchange executes after completing can generate the second temp directory title, at this time
Judge whether there is the second temp directory title, and if it exists, then illustrate that abnormal conditions occurs in rollback process, then executes S310, if
It is not present, then illustrates that rollback does not carry out also, therefore execute S305.Wherein, if it does not exist the second temp directory title when, can be with
Illustrate that rollback has executed completion, if but rollback executed completion, do not have to carry out rollback again in S301, therefore in the present embodiment
Only illustrate that rollback does not carry out also when the second temp directory title if it does not exist.
S305, revocation transaction number in temporary file whether exchange transaction number identical.
Judge to cancel transaction number in temporary file whether exchange transaction number identical, that is, judge whether temporary file is removed
It sells that the corresponding transaction number of transaction number generates and whether revocation transaction number affairs corresponding with exchange transaction number is the same thing
Business.If they are the same, then S306 is executed, if it is different, illustrating temporary file not is that the corresponding affairs of revocation transaction number generate, cancels thing
Data exchange in business number corresponding affairs is not carried out, then executes S314.
Catalogue mark in S306, rewind journal identifies whether identical with the catalogue in temporary file.
Judging that the catalogue mark of the first data in rewind journal and the catalogue of the first data in temporary file identify is
The catalogue mark and the catalogue of the second data in temporary file of the second data in no identical or rewind journal identify whether
It is identical.If they are the same, illustrate that data exchange is not carried out, then execute S314, if it is different, then executing S307.
S307, the first new directory name modifications are the second temp directory title.
S308, the second new directory name modifications are the first new directory title.
S309, the second temp directory name modifications are the second new directory title.
Executing the second temp directory name modifications is rollback completion after the second new directory title, execution S314.
S310, it whether there is the first new directory title.
Specifically, then illustrate that abnormal conditions occurs in rollback process there are the second temp directory title, at this time if it exists first
New directory title, rolling back action before have been completed that by the first new directory name modifications be the second temp directory title, it
Afterwards it is the operation of the first new directory title by the second new directory name modifications, executes S309 at this time.First new directory if it does not exist
Title, the rolling back action before illustrating have been completed that by the first new directory name modifications be the second temp directory title, also not
Rolling back action after progress executes S308.
S311, it whether there is the second new directory title.
Specifically, illustrating occur abnormal conditions in data exchange process there are the first temp directory title, judgement at this time is
No there are the second new directory titles, and if it exists, illustrates to face the first original directory name modifications for first in data exchange process
When directory name after, also perform by the second original directory name modifications be first original directory title (i.e. the second new directory
Title), then execute S312.If it does not exist, illustrate in data exchange process to be only first by the first original directory name modifications
Temp directory title, being also not carried out the second original directory name modifications is the first original directory title (i.e. the second new directory name
Claim), then execute S313.
S312, the second new directory name modifications are the second original directory title.
S313, the first temp directory name modifications are the first original directory title.
Executing the first temp directory name modifications is rollback completion after the first original directory title, execution S314.
S314, end.
The technical solution of the present embodiment detects that rollback is requested after data exchange, can be held according to rollback request
Rolling back action under the different abnormal conditions of row.The present embodiment is when carrying out data exchange, by the catalogue for exchanging data to be exchanged
Data exchange can be rapidly completed in title, and avoids the read-write operation of data to be exchanged and occupy server resource, improve
The efficiency of data exchange;Also, by establishing temporary file and the rollback after data exchange and data are exchanged into function
Different temp directory titles is set in journey, the rolling back action of the data exchange under different abnormal conditions may be implemented, further
It ensure that the atomicity of data exchange.
Example IV
Fig. 5 is the structural schematic diagram of the DEU data exchange unit in the embodiment of the present invention four, and the present embodiment is applicable to realize
The case where data exchange.DEU data exchange unit provided by the embodiment of the present invention can be performed provided by any embodiment of the invention
Method for interchanging data has the corresponding functional module of execution method and beneficial effect.The device specifically include request module 410,
Catalogue module 420 and Switching Module 430, in which:
Request module 410, exchange request for receiving data, data exchange request includes the mark of the first data to be exchanged
Know the mark with the second data;
Catalogue module 420, for the first original directory title according to the first data of identifier lookup of the first data, with
And the second original directory title of the second data of identifier lookup according to the second data;
Switching Module 430 obtains the first data for exchanging the first original directory title and the second original directory title
Second new directory title of the first new directory title and the second data.
The embodiment of the present invention is by receiving data exchange request, according to the first of the first data of identifier lookup of the first data
Original directory title, and, according to the second original directory title of the second data of identifier lookup of the second data, and exchange the
One original directory title and the second original directory title, obtain the first data the first new directory title and the second data
Two new directory titles.The embodiment of the present invention, can be fast by exchanging the directory name of data to be exchanged when carrying out data exchange
Speed completes data exchange, and avoids the read-write operation of data to be exchanged and occupy server resource, improves data exchange
Efficiency.
Further, Switching Module 430 is specifically used for:
It is the first temp directory title by the first original directory name modifications, the second original directory name modifications are first former
Beginning directory name, the first original directory name are referred to as the second new directory title;
It is the second original directory title by the first temp directory name modifications, the second original directory name is referred to as the first new mesh
Record title.
Further, which further includes temporary file module, and temporary file module is specifically used for: original in exchange first
Before directory name and the second original directory title,
The directory information of exchange transaction number and the first data and the directory information of the second data are obtained, and affairs will be exchanged
Number, the directory informations of the directory information of the first data and the second data be stored in temporary file, the directory information of the first data
The directory path of catalogue mark and the first data including the first data, the directory information of the second data includes the mesh of the second data
The directory path of record mark and the second data.
Further, which further includes the first roll-back module, and the first roll-back module is specifically used for: the first original mesh of exchange
After recording title and the second original directory title,
Detect that rollback is requested;
It is interim by first according to rollback request if finding the first temp directory title and the second new directory title being lost
Directory name is revised as the first original directory title;
It is new by second according to rollback request if finding the first temp directory title and finding the second new directory title
Directory name is revised as the second original directory title and then is the first original directory name by the first temp directory name modifications
Claim.
Further, which further includes the second roll-back module, and the second roll-back module is specifically used for: the first original mesh of exchange
After recording title and the second original directory title,
Detect that rollback is requested;
If can not find the first temp directory title, revocation transaction number it is identical as the exchange transaction number in temporary file and
Catalogue mark in rewind journal identifies not with the catalogue mark of the first data in temporary file or the catalogue of the second data
Together, then by the first new directory name modifications be the second temp directory title, the second new directory name modifications be the first new directory name
Claim, and by the second temp directory name modifications be the second new directory title.
Further, which further includes third roll-back module, and third roll-back module is specifically used for: the first original mesh of exchange
After recording title and the second original directory title,
Detect that rollback is requested;
If the first temp directory title can not be found and find the first new directory title, by the second temp directory name
Title is revised as the second new directory title.
After directory name and the second original directory title,
Further, which further includes the 4th roll-back module, and the 4th roll-back module is specifically used for: the first original mesh of exchange
After recording title and the second original directory title,
Detect that rollback is requested;
If the first temp directory title can not be found and the first new directory title can not be found, by the second new directory
Name modifications are the first new directory title and then are the second new directory title by the second temp directory name modifications.
DEU data exchange unit provided by the embodiment of the present invention can be performed data provided by any embodiment of the invention and hand over
Method is changed, has the corresponding functional module of execution method and beneficial effect.
Embodiment five
Fig. 6 is the structural schematic diagram of the server in the embodiment of the present invention five.Fig. 6, which is shown, to be suitable for being used to realizing the present invention
The block diagram of the exemplary servers 512 of embodiment.The server 512 that Fig. 6 is shown is only an example, should not be to the present invention
The function and use scope of embodiment bring any restrictions.
As shown in fig. 6, server 512 is showed in the form of generic server.The component of server 512 may include but not
Be limited to: one or more processor 516, storage device 528 connect different system components (including storage device 528 and processing
Device 516) bus 518.
Bus 518 indicates one of a few class bus structures or a variety of, including storage device bus or storage device control
Device processed, peripheral bus, graphics acceleration port, processor or total using the local of any bus structures in a variety of bus structures
Line.For example, these architectures include but is not limited to industry standard architecture (Industry Subversive
Alliance, ISA) bus, microchannel architecture (Micro Channel Architecture, MAC) bus is enhanced
Isa bus, Video Electronics Standards Association (Video Electronics Standards Association, VESA) local are total
Line and peripheral component interconnection (Peripheral Component Interconnect, PCI) bus.
Server 512 typically comprises a variety of computer system readable media.These media can be it is any being capable of bedding and clothing
The usable medium that business device 512 accesses, including volatile and non-volatile media, moveable and immovable medium.
Storage device 528 may include the computer system readable media of form of volatile memory, such as arbitrary access
Memory (Random Access Memory, RAM) 530 and/or cache memory 532.Server 512 can be further
Including other removable/nonremovable, volatile/non-volatile computer system storage mediums.Only as an example, storage system
System 534 can be used for reading and writing immovable, non-volatile magnetic media (Fig. 6 do not show, commonly referred to as " hard disk drive ").To the greatest extent
It is not shown in pipe Fig. 6, the disc driver for reading and writing to removable non-volatile magnetic disk (such as " floppy disk ") can be provided, with
And to removable anonvolatile optical disk, such as CD-ROM (Compact Disc Read-Only Memory, CD-ROM), number
Word optic disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical mediums) read-write CD
Driver.In these cases, each driver can be connected by one or more data media interfaces with bus 518.
Storage device 528 may include at least one program product, which has one group of (for example, at least one) program module,
These program modules are configured to perform the function of various embodiments of the present invention.
Program/utility 540 with one group of (at least one) program module 542 can store in such as storage dress
It sets in 528, such program module 542 includes but is not limited to operating system, one or more application program, other program moulds
It may include the realization of network environment in block and program data, each of these examples or certain combination.Program module
542 usually execute function and/or method in embodiment described in the invention.
Server 512 can also be with one or more external equipments 514 (such as keyboard, direction terminal, display 524 etc.)
Communication, can also be enabled a user to one or more terminal interact with the server 512 communicate, and/or with make the clothes
Any terminal (such as network interface card, modem etc.) that business device 512 can be communicated with one or more of the other computing terminal
Communication.This communication can be carried out by input/output (I/O) interface 522.Also, server 512 can also be suitable by network
Orchestration 520 and one or more network (such as local area network (Local Area Network, LAN), wide area network (Wide Area
Network, WAN) and/or public network, such as internet) communication.As shown in fig. 6, network adapter 520 passes through bus 518
It is communicated with other modules of server 512.It should be understood that although not shown in the drawings, can be used in conjunction with server 512 other hard
Part and/or software module, including but not limited to: microcode, terminal driver, redundant processor, external disk drive array, magnetic
Disk array (Redundant Arrays of Independent Disks, RAID) system, tape drive and data backup
Storage system etc..
The program that processor 516 is stored in storage device 528 by operation, thereby executing various function application and number
According to processing, such as realize method for interchanging data provided by the embodiment of the present invention, this method comprises:
Data exchange request is received, data exchange request includes the mark of the first data to be exchanged and the mark of the second data
Know;
According to the first original directory title of the first data of identifier lookup of the first data, and, according to the second data
Second original directory title of the second data of identifier lookup;
Exchange the first original directory title and the second original directory title, obtain the first new directory title of the first data with
And second data the second new directory title.
Embodiment six
The embodiment of the present invention six additionally provides a kind of computer readable storage medium, is stored thereon with computer program, should
The method for interchanging data as provided by the embodiment of the present invention is realized when program is executed by processor, this method comprises:
Data exchange request is received, data exchange request includes the mark of the first data to be exchanged and the mark of the second data
Know;
According to the first original directory title of the first data of identifier lookup of the first data, and, according to the second data
Second original directory title of the second data of identifier lookup;
Exchange the first original directory title and the second original directory title, obtain the first new directory title of the first data with
And second data the second new directory title.
The computer storage medium of the embodiment of the present invention, can be using any of one or more computer-readable media
Combination.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readable
Storage medium for example may be-but not limited to-the system of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, device or
Device, or any above combination.The more specific example (non exhaustive list) of computer readable storage medium includes: tool
There are electrical connection, the portable computer diskette, hard disk, random access memory (RAM), read-only memory of one or more conducting wires
(ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-
ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this document, computer-readable storage
Medium can be any tangible medium for including or store program, which can be commanded execution system, device or device
Using or it is in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited
In wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof
Program code, described program design language include object oriented program language-such as Java, Smalltalk, C++,
It further include conventional procedural programming language-such as " C " language or similar programming language.Program code can be with
It fully executes, partly execute on the user computer on the user computer, being executed as an independent software package, portion
Divide and partially executes or executed on remote computer or terminal completely on the remote computer on the user computer.It is relating to
And in the situation of remote computer, remote computer can pass through the network of any kind --- including local area network (LAN) or extensively
Domain net (WAN)-be connected to subscriber computer, or, it may be connected to outer computer (such as provided using Internet service
Quotient is connected by internet).
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that
The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,
It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention
It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also
It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.
Claims (10)
1. a kind of method for interchanging data characterized by comprising
Data exchange request is received, the data exchange request includes the mark of the first data to be exchanged and the mark of the second data
Know;
According to the first original directory title of the first data described in the identifier lookup of first data, and, according to described
Second original directory title of the second data described in the identifier lookup of two data;
The first original directory title and the second original directory title are exchanged, the first new directory name of the first data is obtained
Second new directory title of title and the second data.
2. the method according to claim 1, wherein exchange the first original directory title and second original
Beginning directory name, comprising:
It is the first temp directory title by the first original directory name modifications, the second original directory name modifications are institute
The first original directory title is stated, the first original directory name is referred to as the second new directory title;
It is the second original directory title by the first temp directory name modifications, the second original directory name is referred to as
First new directory title.
3. according to the method described in claim 2, it is characterized in that, the exchange the first original directory title and described the
Before two original directory titles, further includes:
The directory information of exchange transaction number and first data and the directory information of second data are obtained, and will be described
Exchange transaction number, the directory information of first data and the directory information of second data are stored in temporary file, institute
The directory information for stating the first data includes that the catalogue of the first data identifies the directory path with the first data, second data
Directory information includes the directory path of the catalogue mark and the second data of the second data.
4. according to the method described in claim 3, it is characterized in that, the exchange the first original directory title and described the
After two original directory titles, further includes:
Detect that rollback is requested;
If finding the first temp directory title and the second new directory title being lost, being requested according to the rollback will
The first temp directory name modifications are the first original directory title;
If finding the first temp directory title and finding the second new directory title, requested according to the rollback
The second new directory name modifications are the second original directory title and then repair the first temp directory title
It is changed to the first original directory title.
5. according to the method described in claim 3, it is characterized in that, the exchange the first original directory title and described the
After two original directory titles, further includes:
Detect that rollback is requested;
Transaction number phase is exchanged with the temporary file if the first temp directory title, revocation transaction number can not be found
Catalogue mark and the catalogue mark of the first data in the temporary file or the mesh of the second data in same and rewind journal
Record mark is different, then is the second temp directory title by the first new directory name modifications, the second new directory title is repaired
It is changed to the first new directory title, and by the second temp directory name modifications is the second new directory title.
6. according to the method described in claim 3, it is characterized in that, the exchange the first original directory title and described the
After two original directory titles, further includes:
Detect that rollback is requested;
If the first temp directory title can not be found and find the first new directory title, by the second interim mesh
Record name modifications are the second new directory title.
7. according to the method described in claim 3, it is characterized in that, the exchange the first original directory title and described the
After two original directory titles, further includes:
Detect that rollback is requested;
If the first temp directory title can not be found and the first new directory title can not be found, by described
Two new directory name modifications are the first new directory title and then are described second new by the second temp directory name modifications
Directory name.
8. a kind of DEU data exchange unit characterized by comprising
Request module, exchange request for receiving data, the data exchange request includes the mark of the first data to be exchanged
With the mark of the second data;
Catalogue module, for the first original directory title of the first data according to the identifier lookup of first data, with
And the second original directory title of the second data according to the identifier lookup of second data;
Switching Module obtains the first data for exchanging the first original directory title and the second original directory title
The first new directory title and the second data the second new directory title.
9. a kind of server, which is characterized in that the server includes:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
The now method for interchanging data as described in any in claim 1-7.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor
The method for interchanging data as described in any in claim 1-7 is realized when execution.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910080274.9A CN109740027B (en) | 2019-01-28 | 2019-01-28 | Data exchange method, device, server and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910080274.9A CN109740027B (en) | 2019-01-28 | 2019-01-28 | Data exchange method, device, server and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109740027A true CN109740027A (en) | 2019-05-10 |
CN109740027B CN109740027B (en) | 2020-01-10 |
Family
ID=66366258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910080274.9A Active CN109740027B (en) | 2019-01-28 | 2019-01-28 | Data exchange method, device, server and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109740027B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888717A (en) * | 2019-11-05 | 2020-03-17 | 中盈优创资讯科技有限公司 | Transaction control method and device for directory operation of HDFS (Hadoop distributed File System) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080027899A1 (en) * | 2005-08-09 | 2008-01-31 | Quark, Inc. | Systems and Methods for Integrating from Data Sources to Data Target Locations |
US20100017420A1 (en) * | 2008-07-21 | 2010-01-21 | International Business Machines Corporation | Performing An All-To-All Data Exchange On A Plurality Of Data Buffers By Performing Swap Operations |
CN104486448A (en) * | 2014-12-29 | 2015-04-01 | 成都致云科技有限公司 | Data processing method and device |
CN104702441A (en) * | 2015-03-17 | 2015-06-10 | 四川天邑康和通信股份有限公司 | Data exchange method between network intelligent management terminal and network facility |
CN105787065A (en) * | 2016-03-01 | 2016-07-20 | 浪潮通用软件有限公司 | Method for realizing integrated exchange platform |
CN107248984A (en) * | 2017-06-06 | 2017-10-13 | 北京京东尚科信息技术有限公司 | Data exchange system, method and apparatus |
CN107403012A (en) * | 2017-08-01 | 2017-11-28 | 山东浪潮通软信息科技有限公司 | A kind of method for interchanging data and device |
CN107734034A (en) * | 2017-10-17 | 2018-02-23 | 泰康保险集团股份有限公司 | Server docking system, method, computer-readable recording medium and front end processor |
CN108829767A (en) * | 2018-05-29 | 2018-11-16 | 吉贝克信息技术(北京)有限公司 | Data exchange system and its method, apparatus and computer storage medium |
-
2019
- 2019-01-28 CN CN201910080274.9A patent/CN109740027B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080027899A1 (en) * | 2005-08-09 | 2008-01-31 | Quark, Inc. | Systems and Methods for Integrating from Data Sources to Data Target Locations |
US20100017420A1 (en) * | 2008-07-21 | 2010-01-21 | International Business Machines Corporation | Performing An All-To-All Data Exchange On A Plurality Of Data Buffers By Performing Swap Operations |
CN104486448A (en) * | 2014-12-29 | 2015-04-01 | 成都致云科技有限公司 | Data processing method and device |
CN104702441A (en) * | 2015-03-17 | 2015-06-10 | 四川天邑康和通信股份有限公司 | Data exchange method between network intelligent management terminal and network facility |
CN105787065A (en) * | 2016-03-01 | 2016-07-20 | 浪潮通用软件有限公司 | Method for realizing integrated exchange platform |
CN107248984A (en) * | 2017-06-06 | 2017-10-13 | 北京京东尚科信息技术有限公司 | Data exchange system, method and apparatus |
CN107403012A (en) * | 2017-08-01 | 2017-11-28 | 山东浪潮通软信息科技有限公司 | A kind of method for interchanging data and device |
CN107734034A (en) * | 2017-10-17 | 2018-02-23 | 泰康保险集团股份有限公司 | Server docking system, method, computer-readable recording medium and front end processor |
CN108829767A (en) * | 2018-05-29 | 2018-11-16 | 吉贝克信息技术(北京)有限公司 | Data exchange system and its method, apparatus and computer storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888717A (en) * | 2019-11-05 | 2020-03-17 | 中盈优创资讯科技有限公司 | Transaction control method and device for directory operation of HDFS (Hadoop distributed File System) |
Also Published As
Publication number | Publication date |
---|---|
CN109740027B (en) | 2020-01-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110442560A (en) | Method, apparatus, server and storage medium are recurred in a kind of log | |
CN109684307A (en) | A kind of date storage method, device, equipment and storage medium | |
CN110297689A (en) | Intelligent contract executes method, apparatus, equipment and medium | |
CN108959621A (en) | A kind of implementation method, device, equipment and the storage medium of block chain network | |
JP2021504813A (en) | Blockchain network transaction processing methods, devices, equipment and storage media | |
US7908510B2 (en) | Storage system and method of designing disaster recovery constitution | |
CN109710190A (en) | A kind of date storage method, device, equipment and storage medium | |
CN109951547A (en) | Transactions requests method for parallel processing, device, equipment and medium | |
CN109800336A (en) | Table implementation method, device, equipment and medium based on key-value pair storage system | |
CN109597640B (en) | Account management method, device, equipment and medium for application program | |
CN111626602B (en) | Service processing method, service processing device, storage medium and electronic equipment | |
CN109241015A (en) | Method for data to be written in distributed memory system | |
CN109446202A (en) | Identifier allocation method, device, server and storage medium | |
CN107122362A (en) | Cloud database resource extends the method and system with service extension | |
CN109347899A (en) | The method of daily record data is written in distributed memory system | |
CN109800234A (en) | Service platform database system, upgrade method, equipment and storage medium | |
CN109284108A (en) | Date storage method, device, electronic equipment and storage medium | |
US11157456B2 (en) | Replication of data in a distributed file system using an arbiter | |
CN109977097B (en) | Network configuration management method and system based on database | |
CN109740027A (en) | Method for interchanging data, device, server and storage medium | |
CN109634983A (en) | Recall determination method, apparatus, equipment and the medium of interest point information | |
CN109033456A (en) | A kind of condition query method, apparatus, electronic equipment and storage medium | |
CN109710629A (en) | Data access method, device, server and storage medium | |
CN109657167A (en) | Collecting method, device, server and storage medium | |
CN108491457A (en) | A kind of method and apparatus for synchronizing public cloud resource |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |