WO2014101199A1 - 数据的处理方法和装置 - Google Patents

数据的处理方法和装置 Download PDF

Info

Publication number
WO2014101199A1
WO2014101199A1 PCT/CN2012/088073 CN2012088073W WO2014101199A1 WO 2014101199 A1 WO2014101199 A1 WO 2014101199A1 CN 2012088073 W CN2012088073 W CN 2012088073W WO 2014101199 A1 WO2014101199 A1 WO 2014101199A1
Authority
WO
WIPO (PCT)
Prior art keywords
result set
data
query
location information
scanning
Prior art date
Application number
PCT/CN2012/088073
Other languages
English (en)
French (fr)
Inventor
叶开河
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201280001994.8A priority Critical patent/CN104321766A/zh
Priority to PCT/CN2012/088073 priority patent/WO2014101199A1/zh
Priority to EP12890810.0A priority patent/EP2924587A4/en
Publication of WO2014101199A1 publication Critical patent/WO2014101199A1/zh
Priority to US14/751,775 priority patent/US20150293816A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • G06F11/1451Management of the data involved in backup or backup restore by selection of backup contents
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • G06F16/24561Intermediate data storage techniques for performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/22Arrangements for sorting or merging computer data on continuous record carriers, e.g. tape, drum, disc
    • G06F7/24Sorting, i.e. extracting data from one or more carriers, rearranging the data in numerical or other ordered sequence, and rerecording the sorted data on the original carrier or on a different carrier or set of carriers sorting methods in general
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/84Using snapshots, i.e. a logical point-in-time copy of the data

Definitions

  • the present invention relates to computer technologies, and in particular, to a data processing method and apparatus. Background technique
  • the non-relational database has the following advantages: mass storage, high availability, and partition expansion. Therefore, its software architecture and model are quite different from the software architecture and model of the traditional relational database.
  • the distribution of data is different from the distribution of data in a traditional relational database, which is mainly distributed in an in-memory table and a data file, wherein the data in the in-memory table is not a copy of the data, and Is part of the complete data.
  • the present invention provides a data processing method and apparatus for avoiding the situation that the result set is extracted only once in a non-relational database in a non-relational database, resulting in excessive memory occupation and collapse, thereby effectively improving The response speed obtained by the result set.
  • a first aspect of the present invention provides a data processing method for use in a non-relational database, including:
  • the data acquisition mode is to obtain the sort result set mode
  • the result set is stored in the temporary space, and the scanning is continued. After the scanning is completed, the All the data saved in the temporary space is sorted, and the sorted data is added to the result set satisfying the preset condition and distributed to the client, and the second position information extracted each time is recorded.
  • the query object includes a memory table. If the data in the at least one memory table is not scanned, and the persistence condition is met, the method further includes:
  • mapping information of the at least one data file and the at least one memory table is recorded.
  • the method further includes:
  • the method further includes:
  • the scanning is stopped, the result set that satisfies the condition is sent to the client, and the third location information of the current scan is recorded;
  • the method further includes:
  • the data in the query object is scanned, and the scanned data is added to the result set;
  • the scanning is stopped, the result set that satisfies the condition is sent to the client, and the third location information of the current scan is recorded;
  • the first location information corresponding to the query identifier is updated to the third location information corresponding to the query identifier.
  • the first location information and the second location information both include a scan location in the currently scanned memory table or a scan location in the currently scanned data file; or, when the query mode is a parallel query In the mode, the first location information and the second location information both include a scan location in the memory table and a scan location in the data file.
  • the data acquisition manner is a method for obtaining a sort result set
  • the result set After the result set satisfies the preset condition, the result set is stored in the temporary space, and the scanning is continued. After the scanning is completed, all the data stored in the temporary space are sorted, and the sorted data is added.
  • the result of satisfying the preset condition is collectively distributed to the client, and the second location information extracted each time is recorded, including:
  • the data acquisition mode is to obtain the sort result set mode
  • the result set is stored in the memory page, and the scanning is continued, after the scanning is completed, the All the data saved in the memory page is sorted, and the sorted data is added to the result set satisfying the preset condition, and is distributed to the client, and the second location information extracted each time is recorded;
  • the memory space includes the memory page.
  • the seventh possible implementation manner of the first aspect if the data acquiring manner is to obtain a sorting result set manner, After the result set satisfies the preset condition, the result set is stored in the temporary space, and the scanning is continued. After the scanning is completed, all the data stored in the temporary space are sorted, and the sorted data is added. The result of satisfying the preset condition is collectively distributed to the client, and the second location information extracted each time is recorded, including:
  • the data acquisition mode is a method for obtaining a sort result set
  • the result set is stored in a memory page, and the result is compared in the memory page.
  • the centralized data is sorted, and the sorted result set is put into the temporary page;
  • the result set after the sorting process is sorted by means of multi-way merging, and the result set after multi-way merging and sorting processing is sequentially sent and sent to the batch.
  • the client and recording the second location information extracted each time;
  • the temporary space includes the memory page and the temporary page.
  • a second aspect of the present invention provides a data processing apparatus for use in a non-relational database, including:
  • a receiving module configured to receive a first query request sent by the client, where the first query request includes a query object and a data acquiring manner;
  • a scanning module configured to scan data in the query object, and add the scanned data to a result set
  • a result set processing module configured to: if the data acquisition mode is to obtain a non-sorted result set mode, after the result set meets a preset condition, trigger the scanning module to stop scanning, and send a result set that satisfies the condition Giving the client the first location information of the current scan;
  • the result set processing module is further configured to: if the data acquisition manner is a method for obtaining a sort result set, after the result set satisfies the preset condition, save the result set into a temporary space, and continue Scanning, after the scanning is completed, sorting all the data stored in the temporary space, and adding the sorted data to the result set satisfying the preset condition, and distributing it to the client, and recording each time The extracted second location information.
  • the query object includes a memory table, and if the data in the at least one memory table is not scanned, and the persistence condition is met, the device further Includes:
  • a recording module configured to record mapping information of the at least one data file and the at least one memory table when the data in the at least one memory table is transferred to the at least one data file.
  • the method further includes:
  • a configuration module configured to configure a unique query identifier for the first query request
  • a saving module configured to save the first location information, the query object, and the data obtaining manner, and corresponding to the first location information, the query object, and the data obtaining manner; and the result set processing module Specifically, if the data acquisition mode is a method for obtaining a non-sorted result set, after the result set meets a preset condition, the scanning is stopped, and the query condition and a result set satisfying the condition are sent to the client. And record the first location information of the current scan.
  • the receiving module is further configured to receive a second query request sent by the client, where the second The query identifier includes the query identifier;
  • the scanning module is further configured to scan data in the query object according to the second query request, the first location information, the query object, and the data acquiring manner corresponding to the query identifier, and The scanned data is added to the result set;
  • the result set processing module is further configured to: after the result set meets the preset condition, trigger the scanning module to stop scanning, and send a result set that satisfies the condition to the client, and then record the third of the current scan.
  • the location information, and the first location information corresponding to the query identifier is updated to the third location information corresponding to the query identifier.
  • the receiving module is further configured to receive a second query request sent by the client, where the second The query identifier includes the query identifier;
  • the scanning module is further configured to: according to the second query request, the first location information, the query object, and the data acquiring manner corresponding to the query identifier, and the at least one data file and the at least one memory table Mapping information, scanning data in the query object, and adding the scanned data to the result set;
  • the result set processing module is further configured to: after the result set meets a preset condition, trigger the scanning module to stop scanning, and send a result set that satisfies the condition to the client, and then record the current Scanning the third location information, and updating the first location information corresponding to the query identifier to the third location information corresponding to the query identifier.
  • the result set processing module is further configured to: if the data acquiring manner is to obtain a sorting result The collection mode, after the result set satisfies the preset condition, the result set is stored in the memory page, and the scanning is continued, and after the scanning module scans, all the saved in the memory page is saved. Sorting the data, adding the sorted data to the result set satisfying the preset condition, and distributing the result to the client, and recording the second location information extracted each time;
  • the memory space includes the memory page.
  • the result set processing module is further configured to: if the data acquiring manner is to obtain a sorting result The collection mode, after the result set satisfies the preset condition, storing the result set in a memory page, and sorting the data in the result set in the memory page, and then sorting The processed result set is put into the temporary page; after the scanning module scan is completed, in the temporary space, the sorted processed result set is sorted by using a multi-way merge mode, and sequentially The result set after multi-way merge and sort processing is sent to the client in batches, and the second location information extracted each time is recorded;
  • the temporary space includes the memory page and the temporary page.
  • the technical effect of the present invention is: receiving a first query request sent by the client, the first query request includes a query object and a data acquisition manner; scanning the data in the query object, and adding the scanned data to the result Concentration, if the data acquisition method is to obtain the non-sorted result set mode, after the result set satisfies the preset condition, the scanning is stopped, the result set satisfying the condition is sent to the client, and the first position of the current scan is recorded.
  • FIG. 1 is a schematic structural diagram of a database on which a data processing method according to the present invention is based;
  • FIG. 2 is a flow chart of an embodiment of a method for processing data according to the present invention.
  • FIG. 3 is a flow chart of another embodiment of a method for processing data according to the present invention.
  • FIG. 4 is a flow chart of still another embodiment of a method for processing data according to the present invention.
  • FIG. 5 is a schematic structural diagram of an embodiment of a data processing apparatus according to the present invention.
  • FIG. 6 is a schematic structural diagram of another embodiment of a data processing apparatus according to the present invention.
  • FIG. 7 is a hardware architecture diagram of a data processing apparatus according to an embodiment of the present invention.
  • 1 is a schematic structural diagram of a non-relational database on which a data processing method according to the present invention is based.
  • the database includes: an in-memory table 11, a data file 12, a memory page 13, and a temporary page 14.
  • the data may be distributed in the memory table 11 and the data file 12, or in the memory table 11, or in the data file 12.
  • the data in the memory table 11 is not a copy of the data, but a part of the complete data.
  • the memory table 11 and the data file 12 can be scanned, and the scanned data can be temporarily stored in the memory page 13 or the memory page 13 and the temporary page 14. It should be noted that the memory page 13 and the temporary page 14 Belongs to the memory space.
  • FIG. 2 is a flowchart of an embodiment of a method for processing data according to the present invention.
  • the execution subject of the embodiment is a data processing device, and is applied to a non-relational database.
  • the method includes:
  • Step 201 Receive a first query request sent by the client, where the first query request includes a query object and a data acquisition manner.
  • Step 202 Scan the data in the query object, and add the scanned data to the result set.
  • the data obtaining manner may be a method of acquiring a non-sorted result set or acquiring a sorted result set.
  • step 203 may be performed; when the data acquisition mode is the method of obtaining the sort result set, step 204 may be performed.
  • Step 203 If the data acquisition mode is to obtain the non-sorted result set mode, after the result set meets the preset condition, the scanning is stopped, and the result set that satisfies the condition is sent to the client, and Record the first location information of the current scan. End.
  • Step 204 If the data acquisition mode is the method for obtaining the sort result set, after the result set meets the preset condition, the result set that satisfies the condition is stored in the temporary space, and the scanning is continued, and after the scanning is completed, the temporary space is completed. All the data saved in the data is sorted, and the sorted data is added to the result set satisfying the preset condition and distributed to the client, and the second position information extracted each time is recorded.
  • the preset condition is used such that the result set satisfying the preset condition does not cause insufficient memory and collapses.
  • the preset condition may be the number of data in the result set or the size of the result set; for example, the condition set satisfies the preset condition: the number of data in the result set satisfies the preset result The number of pieces of data to be concentrated; or, the size of the result set capacity satisfies the size of the preset result set capacity.
  • FIG. 3 is a flowchart of another embodiment of a method for processing data according to the present invention.
  • the method for obtaining a non-sorted result set is taken as an example, and the technical solution of the embodiment is introduced in detail. Show that the method includes:
  • Step 301 Receive a first query request sent by the client, where the first query request includes a query object, a data acquisition mode, a query mode, a query filter condition, and a preset result set condition, and configure a unique request for the first query request.
  • Query ID includes a query object, a data acquisition mode, a query mode, a query filter condition, and a preset result set condition.
  • the first query request may further include one or a combination of the following: a query mode, a query filter condition, and a preset result set condition.
  • the first query request further includes a query mode, a query filtering condition, and a preset result set condition as an example.
  • the query mode can be a serial query mode or a parallel query mode.
  • the query filtering condition includes characteristics of the data, so that the scanned data can be filtered according to the characteristics of the data to obtain data matching the characteristics of the data in the query filtering condition. For example: when the query object is a student achievement, and the query request condition is not carried in the first query request, the data of the scanned student achievement is added to the result set; if the query object is a student achievement, and the first query request is carried With the query filter condition, if the query filter condition is that the student score is 60 or more, the scanned student's score and the score of 60 or more will be added to the result set.
  • Step 302 Scan the data in the query object according to the query mode, filter the scanned data according to the query filtering condition, and add the data satisfying the query filtering condition to the result set.
  • Step 303 After the result set satisfies the preset result set condition, the scanning is stopped, and the result set and the query identifier satisfying the preset result set condition are sent to the client, and the first position information of the current scan is recorded.
  • the data in the query object in the first query request is scanned one by one, and the scanned data is added.
  • the scan is stopped, and the result set that satisfies the preset result set condition is sent to the client, and the result set is sent to the client, and the result set is The data is cleared and waiting to store the data scanned for the next time.
  • the preset result set condition may be the number of data sets or the size of the result set in the result set, and may be the same as or different from the preset conditions. In this embodiment, the preset result set condition is greater than or equal to the upper threshold.
  • step 303 when the preset result set condition is less than the upper threshold, the operation in step 303 may be performed.
  • the preset result set condition is greater than or equal to the upper threshold, the specific implementation of step 303 may be After the result set meets the preset condition, the scanning is stopped, the result set that satisfies the condition is sent to the client, and the first position information of the current scan is recorded.
  • Step 304 Save the first location information, the query object, the data acquisition mode, the query mode, the query filter condition, and the preset result set condition, and select the first location information, the query object, the data acquisition mode, the query mode, and the query. Filter conditions and preset result set conditions correspond to the query ID.
  • the client after receiving the result set, the client requests to acquire the next batch of result sets if the result set is not obtained, so that the processing device that triggers the data continues scanning according to the first position information of the current scan; After judging that all the result sets have been obtained, the processing ends.
  • the first location information may be as shown in Table 1: Memory table memory table id+rowkey+supername Multiple groups* Data file file name+file offset multiple groups* Where id is used to mark the memory table, owkey is used to mark the user, and supername is used to mark the data under the user. "Multiple groups*" is used to indicate that there are multiple memory tables and data files.
  • Step 305 Receive a second query request sent by the client, where the second query request includes the query identifier.
  • the client determines the result set, and when the result set has not been obtained, the query request may continue to be sent to continue to obtain the result set.
  • Step 306 According to the second query request, the first location information, the query object, the data obtaining manner, the query mode, the query filtering condition, and the preset result set condition, and the memory table and the data file corresponding to the query identifier. Mapping information, scanning the data in the query object, and adding the scanned data to the result set.
  • the query object when the query object includes a memory table, or an in-memory table and a data file, after the query identifier and the result set satisfying the preset result set condition are sent to the client, Recording at least one data file and the at least one memory table when data in at least one memory table is not scanned, and when a persistence condition is reached, when data in at least one memory table is transferred to at least one data file Mapping information. Therefore, when the data in the memory table in the query object is not scanned and the persistence condition is reached, the mapping information is queried according to the first location information, and the memory table corresponding to the one memory table is obtained. And the mapping information of the data file, and according to the mapping information of the memory table and the data file, find the data file corresponding to the one memory table, and scan the data in the data file.
  • Step 307 After the result set meets the preset condition, stop scanning, send a result set that satisfies the condition to the client, and record the third location information of the current scan;
  • Step 308 Update the first location information corresponding to the query identifier to the third location information corresponding to the query identifier.
  • step 306 scanning, according to the second query request, the first location information, the query object, the data obtaining manner, the query mode, the query filtering condition, and the preset result set condition corresponding to the query identifier, scanning the data in the query object , and add the scanned data to the result set.
  • the persistence condition may be as follows: The data in the memory table reaches a preset threshold; and, the data in the memory table reaches a preset configuration time. It should be noted that when the memory is expressed to the preset condition, the data in the memory table will be transferred to the data file.
  • the first location information and the second location information both include the current scan to The scan position in the memory table or the scan position in the currently scanned data file; or,
  • the first location information and the second location information each include a scan location in the plurality of memory tables and a scan location in the plurality of data files.
  • FIG. 4 is a flowchart of still another embodiment of a method for processing data according to the present invention.
  • the method for obtaining a result set is taken as an example, and the technical solution of the embodiment is described in detail. As shown, the method includes:
  • Step 401 Receive a first query request sent by the client, where the first query request includes a query object, a data acquisition mode, a query mode, a query filter condition, and a preset result set condition.
  • Step 402 Scan the data in the query object according to the query mode, filter the scanned data according to the query filtering condition, and add the data satisfying the query filtering condition to the result set.
  • Step 403 After the result set satisfies the preset condition, the result set is stored in a memory page.
  • the above memory space includes a memory page and a temporary page.
  • Step 404 Determine whether the amount of data in the result set sorted in the memory page is less than or equal to the memory page size; if less than or equal to, perform step 405; if yes, perform step 406.
  • Step 405 Sort the result set in the memory page, send the sorted result set to the client in batches, and record the second location information extracted each time. End.
  • Step 406 The result set is stored in a memory page, and the result set is sorted in the memory page, and the sorted result set is put into the temporary page.
  • the amount of data in the result set sorted in the memory page is larger than the size of the memory page.
  • the result set in the memory page needs to be partially sorted, that is, if there are multiple result sets in the memory page, multiple result sets are divided, and the divided result sets are sorted and placed into temporary pages respectively. .
  • Step 407 After the scanning is completed, in the temporary space, the multi-way merge mode is used, the result set after the sorting process is sorted, and the result set after the multi-way merge and sort processing is sequentially sent and sent in batches. Give the client, and record the second location information for each extraction.
  • the query object includes a memory table, and if at least one of the data in the memory table is not scanned, and the persistence is achieved.
  • the method further includes:
  • mapping information of the at least one data file and the at least one memory table is recorded.
  • the memory table when the memory table is initialized, a mapping relationship between the memory table ID and the data file ID is established, and a corresponding reference count is set for each memory table, and the initial reference count is 0.
  • the reference count corresponding to the memory table is used to indicate whether the memory table is referenced (that is, scanned), for example: when the memory table is referenced (that is, the memory table is scanned), the reference count corresponding to the memory table is incremented by one; At the end of the reference, the reference count for the memory table is decremented by 1.
  • the reference count corresponding to the referenced memory table may be incremented by one, only when the result is obtained, or when the memory table is not subsequently referenced. , the reference count corresponding to the memory table is decremented by 1.
  • the memory table Flush refers to the process of persisting the data of the memory table to the data file
  • judge Whether the corresponding reference count is zero If it is not zero (that is, the data in the memory table is not scanned), the reference of the memory table is set to NULL, and the reference of the data file corresponding to the memory table is set.
  • mapping information for example: rowkey+supername maps to file offset.
  • the reference count corresponding to the memory table is 0.
  • the mapping relationship of the data file ID corresponding to the memory table ID may be deleted.
  • FIG. 5 is a schematic structural diagram of an embodiment of a data processing apparatus according to the present invention.
  • the apparatus of this embodiment is applied to a non-relational database, and the apparatus includes: a receiving module 51, a scanning module 52, and a result set processing.
  • the module 53 is configured to receive a first query request sent by the client, where the first query request includes a query object and a data acquisition mode, and the scan module 52 is configured to scan data in the query object.
  • the result set processing module 53 is configured to trigger the scanning after the result set satisfies a preset condition if the data obtaining manner is to obtain a non-sorted result set manner The module stops scanning, and sends a result set that satisfies the condition to the client, and records the first location information of the current scan; or the result set processing module 53 is further configured to: if the data acquisition manner is to obtain the sort result The collection mode, after the result set satisfies the preset condition, the result set is stored in the temporary space, followed by After the scan is completed, all the data stored in the temporary space are sorted, and the sorted data is added to the result set satisfying the preset condition, and the wholesale is sent to the client, and each record is recorded. Second extracted second location information.
  • the processing device of the data in this embodiment may perform the technical solution of the method embodiment shown in FIG. 2, and the implementation principles thereof are similar, and details are not described herein again.
  • the first query request sent by the client is received, where the first query request includes a query object and a data acquisition manner; the data in the query object is scanned, and the scanned data is added to the result set. If the data acquisition method is to obtain the non-sorted result set mode, after the result set meets the preset condition, the scanning is stopped, the result set that satisfies the condition is sent to the client, and the first location information of the current scan is recorded.
  • the data acquisition manner is to obtain the sort result set mode
  • the result set is stored in the temporary space, and the scanning is continued, after the scanning is completed, the Sorting all the data saved in the temporary space, and adding the sorted data to the result set satisfying the preset condition
  • the client and records the second location information extracted each time, thereby ensuring that the result set does not collapse due to excessive memory, thereby avoiding the basic one-time only in the non-relational database in the prior art.
  • the result of extracting the result set causes the memory to be occupied too much and crashes, thereby effectively improving the response speed of the result set acquisition.
  • FIG. 6 is a schematic structural diagram of another embodiment of a data processing apparatus according to the present invention, in the above figure
  • the query object includes a memory table. If the data in at least one of the memory tables is not scanned, and the persistence condition is reached, the device further includes: a recording module 54 is configured to record mapping information of the at least one data file and the at least one memory table when the data in the at least one memory table is transferred to the at least one data file.
  • the device further includes: a configuration module 55 and a saving module 56; wherein, the configuration module
  • the saving module 56 is configured to save the first location information, the query object, and the data acquisition manner, and the first location information, the query object, and the data acquisition manner.
  • the query ID corresponds.
  • the result set processing module 53 is specifically configured to: if the data acquisition manner is to obtain a non-sorted result set manner, after the result set meets the preset condition, stop scanning, and send the query condition and the result set satisfying the condition to the The client, and records the first location information of the current scan.
  • the receiving module 51 is further configured to receive a second query request sent by the client, where the second query request includes the query identifier;
  • the scanning module 52 is further configured to scan the data in the query object according to the second query request, the first location information, the query object, and the data acquisition manner corresponding to the query identifier, and scan the data. Add to the result set;
  • the result set processing module 53 is further configured to: after the result set meets the preset condition, trigger the scanning module to stop scanning, send the result set that satisfies the condition to the client, and record the third position information of the current scan, And updating the first location information corresponding to the query identifier to the third location information corresponding to the query identifier.
  • the receiving module 51 is further configured to receive a second query request sent by the client, where the second query request includes the query identifier;
  • the scanning module 52 is further configured to: according to the second query request, the first location information, the query object, and the data acquiring manner corresponding to the query identifier, and the mapping information of the at least one data file and the at least one memory table, The data in the query object is scanned and the scanned data is scanned Add to the result set;
  • the result set processing module 53 is further configured to: after the result set meets the preset condition, trigger the scanning module to stop scanning, send the result set that satisfies the condition to the client, and record the third position information of the current scan, And updating the first location information corresponding to the query identifier to the third location information corresponding to the query identifier.
  • the data processing apparatus of this embodiment may perform the technical solution of the method embodiment shown in FIG. 3, and the implementation principles thereof are similar, and details are not described herein again.
  • the result set processing module 53 is further configured to: if the data obtaining mode is a method for obtaining a sorting result set, After the result set satisfies the preset condition, the result set is stored in the memory page, and the scanning is continued. After the scanning module scans, all the data stored in the memory page is sorted and sorted. The subsequent data is added to the result set that satisfies the preset condition, and is distributed to the client, and the second location information extracted each time is recorded;
  • the memory space includes the memory page.
  • the result set processing module 53 is further configured to: if the data obtaining manner is a method for obtaining a sorted result set, storing the result set in a memory page after the result set satisfies the preset condition And sorting the data in the result set in the memory page, and then putting the sorted result set into a temporary page; after the scanning module scans, in the temporary space,
  • the multi-way merge method is used to sort the result set after the sorting process, and the result set obtained by multi-way merging and sorting processing is sent to the client in batches, and the first time of each extraction is recorded. Two location information;
  • the temporary space includes the memory page and the temporary page.
  • the processing device of the data in this embodiment may perform the technical solution of the method embodiment shown in FIG. 4, and the implementation principles thereof are similar, and details are not described herein again.
  • FIG. 7 is a hardware architecture diagram of a data processing apparatus according to another embodiment of the present invention, including at least one processor 71 (eg, a CPU), at least one network interface 72 or other communication interface, a memory 73, and at least one communication bus. 74, used to implement connection communication between these devices.
  • the processor 71 is operative to execute executable modules, such as computer programs, stored in the memory 73.
  • the memory 73 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. Reservoir.
  • the communication connection between the system gateway and at least one other network element is implemented by at least one network interface 72 (which may be wired or wireless), and may use an Internet, a wide area network, a local network, a metropolitan area network, or the like.
  • the memory 73 stores program instructions that can be executed by the processor 71, wherein the program instructions include a receiving module 51, a scanning module 52, and a result set processing module 53.
  • the program instructions include a receiving module 51, a scanning module 52, and a result set processing module 53.
  • the program instructions include a receiving module 51, a scanning module 52, and a result set processing module 53.
  • Computer readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one location to another.
  • a storage medium may be any available media that can be accessed by a computer.
  • computer readable media may comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage media or other magnetic storage device, or can be used for carrying or storing in the form of an instruction or data structure.
  • the desired program code and any other medium that can be accessed by the computer may suitably be a computer readable medium.
  • the software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable , fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, wireless, and microwaves are included in the fixing of the associated media.
  • coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, wireless, and microwaves are included in the fixing of the associated media.
  • a disk and a disc include a compact disc (CD), a laser disc, a disc, a digital versatile disc (DVD), a floppy disk, and a Blu-ray disc, wherein the disc is usually magnetically copied, and the disc is The laser is used to optically replicate the data. Combinations of the above should also be included within the protection hierarchy of computer readable media.

Landscapes

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

Abstract

本发明提供一种数据的处理方法和装置,该方法应用于非关系型数据库中,包括:接收客户端发送的第一查询请求,该第一查询请求中包括查询对象和数据获取方式;对该查询对象中的数据进行扫描,并将扫描到的数据加入到结果集中;若该数据获取方式为获取非排序结果集方式,则在该结果集满足预设的条件后,停止扫描,将满足条件的结果集发送给该客户端,并记录当前扫描的第一位置信息;若该数据获取方式为获取排序结果集方式,在该结果集满足该预设的条件后,将该结果集存入临时空间中,在扫描完成后,对该临时空间中保存的所有数据进行排序,并将排序后的结果集分批提取发送给该客户端,并记录每次提取的第二位置信息。

Description

数据的处理方法和装置
技术领域 本发明涉及计算机技术, 尤其涉及一种数据的处理方法和装置。 背景技术
随着互联网不断的发展, 互联网应用的规模也不断壮大, 互联网应用所 依赖的数据库存储也面临着越来越大的挑战。 目前, 传统的关系型数据库已 经 4艮难满足这些互联网公司的海量数据的存储需求, 因此, 数据库领域也由 传统的关系型数据库(例如: Oracle, DB2、 MySQL )逐步发展成百家争鸣 的局面, 特别是在非关系型数据库。
在现有技术中, 非关系型数据库具有如下优点: 海量存储, 高可用以及 分区扩展, 因此, 其在软件构架和模型上, 与传统的关系型数据库的软件架 构和模型有很大的差别。 另外, 在非关系型数据库中, 数据的分布方式也不 同于传统的关系型数据库中数据的分布,其主要分布在内存表和数据文件中, 其中, 内存表中的数据不是数据的副本, 而是完整数据的一部分。
但是, 由于该非关系型数据库中数据的分布方式, 因此, 在非关系型数 据库中, 基本只能一次性地对结果集进行提取, 从而使得在对结果集提取时 内存占用很大, 进而导致结果集提取响应速度相对较低。 发明内容
本发明提供一种数据的处理方法和装置, 用于避免现有技术中在非关系 数据库中基本只能一次性地对结果集进行提取而导致内存占用过多而崩溃的 情况, 从而有效地提高了结果集获取的响应速度。
本发明的第一方面是提供一种数据的处理方法, 应用于非关系型数据库 中, 包括:
对所述查询对象中的数据进行扫描,并将扫描到的数据加入到结果集中; 若所述数据获取方式为获取非排序结果集方式, 则在所述结果集满足预 设的条件后, 停止扫描, 将满足条件的结果集发送给所述客户端, 并记录当 前扫描的第一位置信息;
若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述 预设的条件后, 将所述结果集存入临时空间中, 继续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排序, 并将排序后的数据加入到满足 所述预设条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位 置信息。
在第一方面的第一种可能的实现方式中, 所述查询对象中包含内存表, 若至少一个内存表中的数据未扫描完, 且达到了持久化条件时, 所述方法还 包括:
在将所述至少一个内存表中的数据转存到至少一个数据文件中时, 记录 所述至少一个数据文件和所述至少一个内存表的映射信息。
结合第一方面或第一方面的第一种可能的实现方式, 在第一方面的第二 种可能的实现方式中, 所述若所述数据获取方式为获取非排序结果集方式, 则在所述结果集满足预设的条件后, 停止扫描, 将满足条件的结果集发送给 所述客户端, 并记录当前扫描的第一位置信息之后, 所述方法还包括:
为所述第一查询请求配置唯一的查询标识;
保存所述第一位置信息、 查询对象和数据获取方式, 并将所述第一位置 信息、 查询对象和数据获取方式与所述查询标识相对应;
则所述将满足条件的结果集发送给所述客户端, 包括:
将所述查询标识和满足条件的结果集发送给所述客户端。
结合第一方面的第二种可能的实现方式, 在第一方面的第三种可能的实 现方式中, 还包括:
接收所述客户端发送的第二查询请求, 所述第二查询请求中包括所述查 询标识;
根据所述第二查询请求,以及与所述查询标识对应的所述第一位置信息、 查询对象和数据获取方式, 对所述查询对象中的数据进行扫描, 并将扫描到 的数据加入到结果集中;
在所述结果集满足预设的条件后, 停止扫描, 将满足条件的结果集发送 给所述客户端, 并记录当前扫描的第三位置信息;
将所述查询标识对应的第一位置信息更新为所述查询标识对应的第三位 置信息。
结合第一方面的第二种可能的实现方式, 在第一方面的第四种可能的实 现方式中, 还包括:
接收所述客户端发送的第二查询请求, 所述第二查询请求中包括所述查 询标识 ^
根据所述第二查询请求, 与所述查询标识对应的所述第一位置信息、 查 询对象和数据获取方式, 以及所述至少一个数据文件和所述至少一个内存表 的映射信息, 对所述查询对象中的数据进行扫描, 并将扫描到的数据加入到 结果集中;
在所述结果集满足预设的条件后, 停止扫描, 将满足条件的结果集发送 给所述客户端, 并记录当前扫描的第三位置信息;
将所述查询标识对应的第一位置信息更新为所述查询标识对应的第三位 置信息。
结合第一方面的第三种或者第四种可能的实现方式, 在第一方面的第五 种可能的实现方式中, 当所述第一查询请求包括查询方式, 且所述查询方式 为顺序查询方式时, 所述第一位置信息和所述第二位置信息均包括当前扫描 到的内存表中的扫描位置或者当前扫描到的数据文件中的扫描位置; 或者, 当所述查询方式为并行查询方式时, 所述第一位置信息和所述第二位置 信息均包括所述内存表中的扫描位置和所述数据文件中的扫描位置。
结合第一方面或者第一方面的第一种可能的实现方式, 在第一方面的第 六种可能的实现方式中, 所述若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述预设的条件后, 将所述结果集存入临时空间中, 继 续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排序, 并将 排序后的数据加入到满足所述预设条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位置信息, 包括:
若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述 预设的条件后, 将所述结果集存入内存页中, 继续扫描, 在扫描完成后, 对 所述内存页中保存的所有数据进行排序, 并将排序后的数据加入到满足所述 预设条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位置信 息; 其中, 所述内存空间包括所述内存页。
结合第一方面或者第一方面的第一种可能的实现方式, 在第一方面的第 七种可能的实现方式中, 所述若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述预设的条件后, 将所述结果集存入临时空间中, 继 续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排序, 并将 排序后的数据加入到满足所述预设条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位置信息, 包括:
若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述 预设的条件后, 将所述结果集存入内存页中, 并在所述内存页中对所述结果 集中的数据进行排序处理, 再将排序处理后的结果集放入到临时页中;
在扫描完成后, 在所述临时空间中, 采用多路归并的方式, 对所述排序 处理后的结果集进行排序, 并依次将采用多路归并和排序处理后的结果集分 批提取发送给所述客户端, 并记录每次提取的第二位置信息;
其中, 所述临时空间包括所述内存页和所述临时页。
本发明的第二方面是提供一种数据的处理装置, 应用于非关系型数据库 中, 包括:
接收模块, 用于接收客户端发送的第一查询请求, 所述第一查询请求中 包括查询对象和数据获取方式;
扫描模块, 用于对所述查询对象中的数据进行扫描, 并将扫描到的数据 加入到结果集中;
结果集处理模块, 用于若所述数据获取方式为获取非排序结果集方式, 则在所述结果集满足预设的条件后, 触发所述扫描模块停止扫描, 并将满足 条件的结果集发送给所述客户端, 再记录当前扫描的第一位置信息;
所述结果集处理模块, 还用于若所述数据获取方式为获取排序结果集方 式,则在所述结果集满足所述预设的条件后,将所述结果集存入临时空间中, 继续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排序, 并 将排序后的数据加入到满足所述预设条件的结果集中分批发送给所述客户端 , 并记录每次提取的第二位置信息。
在第二方面的第一种可能的实现方式中, 所述查询对象中包含内存表, 若至少一个内存表中的数据未扫描完, 且达到了持久化条件时, 所述装置还 包括:
记录模块, 用于在将所述至少一个内存表中的数据转存到至少一个数据 文件中时, 记录所述至少一个数据文件和所述至少一个内存表的映射信息。
结合第二方面或者第二方面的第一种可能的实现方式, 在第二方面的第 二种可能的实现方式中, 还包括:
配置模块, 用于为所述第一查询请求配置唯一的查询标识;
保存模块, 用于保存所述第一位置信息、 查询对象和数据获取方式, 并 将所述第一位置信息、 查询对象和数据获取方式与所述查询标识相对应; 则所述结果集处理模块具体用于若所述数据获取方式为获取非排序结果 集方式, 则在所述结果集满足预设的条件后, 停止扫描, 将所述查询条件和 满足条件的结果集发送给所述客户端, 并记录当前扫描的第一位置信息。
结合第二方面的第二种可能的实现方式, 在第二方面的第三种可能的实 现方式中, 所述接收模块还用于接收所述客户端发送的第二查询请求, 所述 第二查询请求中包括所述查询标识;
所述扫描模块还用于根据所述第二查询请求, 以及与所述查询标识对应 的所述第一位置信息、 查询对象和数据获取方式, 对所述查询对象中的数据 进行扫描, 并将扫描到的数据加入到结果集中;
所述结果集处理模块还用于在所述结果集满足预设的条件后, 触发所述 扫描模块停止扫描, 并将满足条件的结果集发送给所述客户端, 再记录当前 扫描的第三位置信息, 以及将所述查询标识对应的第一位置信息更新为所述 查询标识对应的第三位置信息。
结合第二方面的第二种可能的实现方式, 在第二方面的第四种可能的实 现方式中, 所述接收模块还用于接收所述客户端发送的第二查询请求, 所述 第二查询请求中包括所述查询标识;
所述扫描模块还用于根据所述第二查询请求, 与所述查询标识对应的所 述第一位置信息、 查询对象和数据获取方式, 以及所述至少一个数据文件和 所述至少一个内存表的映射信息, 对所述查询对象中的数据进行扫描, 并将 扫描到的数据加入到结果集中;
所述结果集处理模块还用于在所述结果集满足预设的条件后, 触发所述 扫描模块停止扫描, 并将满足条件的结果集发送给所述客户端, 再记录当前 扫描的第三位置信息, 以及将所述查询标识对应的第一位置信息更新为所述 查询标识对应的第三位置信息。
结合第二方面或者第二方面的第一种可能实现方式, 在第二方面的第五 种可能的实现方式中, 所述结果集处理模块还具体用于若所述数据获取方式 为获取排序结果集方式, 则在所述结果集满足所述预设的条件后, 将所述结 果集存入内存页中, 继续扫描, 在所述扫描模块扫描完成后, 对所述内存页 中保存的所有数据进行排序, 并将排序后的数据加入到满足所述预设条件的 结果集中分批发送给所述客户端, 并记录每次提取的第二位置信息;
其中, 所述内存空间包括所述内存页。
结合第二方面或者第二方面的第一种可能实现方式, 在第二方面的第六 种可能的实现方式中, 所述结果集处理模块还具体用于若所述数据获取方式 为获取排序结果集方式, 则在所述结果集满足所述预设的条件后, 将所述结 果集存入内存页中,并在所述内存页中对所述结果集中的数据进行排序处理, 再将排序处理后的结果集放入到临时页中; 在所述扫描模块扫描完成后, 在 所述临时空间中, 采用多路归并的方式, 对所述排序处理后的结果集进行排 序, 并依次将采用多路归并和排序处理后的结果集分批提取发送给所述客户 端, 并记录每次提取的第二位置信息;
其中, 所述临时空间包括所述内存页和所述临时页。
本发明的技术效果是: 接收客户端发送的第一查询请求, 该第一查询请 求中包括查询对象和数据获取方式; 对该查询对象中的数据进行扫描, 并将 扫描到的数据加入到结果集中,若该数据获取方式为获取非排序结果集方式, 则在该结果集满足预设的条件后, 停止扫描, 将满足条件的结果集发送给该 客户端, 并记录当前扫描的第一位置信息; 若所述数据获取方式为获取排序 结果集方式, 则在所述结果集满足所述预设的条件后, 将所述结果集存入临 时空间中, 继续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进 行排序, 并将排序后的数据加入到满足所述预设条件的结果集中分批发送给 所述客户端, 并记录每次提取的第二位置信息, 从而保证了结果集不会因为 过大而导致内存不够用而崩溃, 即避免了现有技术中在非关系数据库中基本 只能一次性地对结果集进行提取而导致内存占用过多而崩溃的情况, 进而有 效地提高了结果集获取的响应速度。 附图说明 图 1为本发明数据的处理方法所基于的数据库的架构示意图;
图 2为本发明数据的处理方法的一个实施例的流程图;
图 3为本发明数据的处理方法的另一个实施例的流程图;
图 4为本发明数据的处理方法的又一个实施例的流程图;
图 5为本发明数据的处理装置的一个实施例的结构示意图;
图 6为本发明数据的处理装置的另一个实施例的结构示意图;
图 7为本发明一个实施例提供的数据的处理装置的硬件架构图。 具体实施方式 图 1为本发明数据的处理方法所基于的非关系型数据库的架构示意图, 如图 1所示, 该数据库包括: 内存表 11、 数据文件 12、 内存页 13和临时页 14。其中,数据可以分布在内存表 11和数据文件 12中,或者, 内存表 11中, 又或者数据文件 12中。 其中, 内存表 11中的数据不是数据的副本, 而是完 整数据的一部分。 另外, 可以对内存表 11和数据文件 12进行扫描, 并可以 将扫描到的数据临时存在内存页 13或者, 内存页 13和临时页 14中, 需要说 明的是, 该内存页 13和临时页 14属于内存空间。
图 2为本发明数据的处理方法的一个实施例的流程图, 结合图 1所示的 数据库, 如图 2所示, 本实施例的执行主体为数据的处理装置, 并应用于非 关系型数据库中, 则该方法包括:
步骤 201、 接收客户端发送的第一查询请求, 该第一查询请求中包括查 询对象和数据获取方式。
步骤 202、 对该查询对象中的数据进行扫描, 并将扫描到的数据加入到 结果集中。
在本实施例中, 优选地, 数据获取方式可以为获取非排序结果集方式或 者获取排序结果集方式。 当数据获取方式为获取非排序结果集方式, 则可以 执行步骤 203;当数据获取方式为获取排序结果集方式,则可以执行步骤 204。
步骤 203、 若该数据获取方式为获取非排序结果集方式, 则在该结果集 满足预设的条件后, 停止扫描, 将满足条件的结果集发送给该客户端, 并记 录当前扫描的第一位置信息。 结束。
步骤 204、 若该数据获取方式为获取排序结果集方式, 则在该结果集满 足预设的条件后, 将满足条件的结果集存入临时空间中, 继续扫描, 在扫描 完成后, 对临时空间中保存的所有数据进行排序, 并将排序后的数据加入到 满足预设条件的结果集中分批发送给客户端, 并记录每次提取的第二位置信 息。
在本实施例中, 预设的条件用于使得满足该预设条件的结果集不会导致 内存不够而崩溃。 优选地, 预设的条件可以为结果集中数据的条数或者结果 集容量的大小; 举例来说, 该结果集满足该预设的条件可以为: 该结果集中 数据的条数满足预设的结果集中数据的条数; 或者, 该结果集容量的大小满 足预设的结果集容量的大小。
在本实施例中, 保证了结果集不会因为过大而导致内存不够用而崩溃, 即避免了现有技术中在非关系数据库中基本只能一次性地对结果集进行提取 而导致内存占用过多而崩溃的情况, 进而有效地提高了结果集获取的响应速 度。
图 3为本发明数据的处理方法的另一个实施例的流程图,在本实施例中, 以获取方式为获取非排序结果集方式为例, 详细介绍本实施例的技术方案, 如图 3所示, 该方法包括:
步骤 301、 接收客户端发送的第一查询请求, 该第一查询请求中包括查 询对象、 数据获取方式、 查询方式、 查询过滤条件和预设的结果集条件, 并 为该第一查询请求配置唯一查询标识。
需要说明的是, 第一查询请求除了包括查询对象和数据获取方式外, 还 可以包括如下一种或者几种的组合: 查询方式、 查询过滤条件和预设的结果 集条件。 在本实施例中, 优选地, 第一查询请求还包括查询方式、 查询过滤 条件和预设的结果集条件为例。
其中, 查询方式可以为串行查询方式或者并行查询方式。 该查询过滤条 件包括数据的特征, 从而能够根据数据的特征, 对扫描到的数据进行过滤, 以获取与该查询过滤条件中的数据的特征匹配的数据。 例如: 当查询对象为 学生成绩, 且第一查询请求中没有携带查询过滤条件, 则将扫描到的学生成 绩的数据均加入到结果集中; 若查询对象为学生成绩, 且第一查询请求中携 带查询过滤条件, 该查询过滤条件为学生成绩为 60分以上, 则将扫描到的学 生成绩, 且为 60分以上的数据加入到结果集中。
步骤 302、 根据该查询方式, 对该查询对象中的数据进行扫描, 并根据 查询过滤条件, 对扫描到的数据进行过滤, 再将满足查询过滤条件的数据加 入到结果集中。
步骤 303、 在结果集满足预设的结果集条件后, 停止扫描, 将满足预设 的结果集条件的结果集和查询标识发送给客户端, 并记录当前扫描的第一位 置信息。
在本实施例中, 当接收到第一查询请求后, 根据该第一查询请求中的查 询方式, 对该第一查询请求中的查询对象中的数据逐条进行扫描, 并将扫描 到的数据加入到结果集中,直至结果集满足预设的结果集条件后,停止扫描, 并将满足预设的结果集条件的结果集发送给客户端, 并将结果集发送给客户 端后, 将结果集中的数据清空, 等待存储下一次扫描到的数据。
另外, 在本实施例中, 预设的结果集条件可以为结果集中的数据条数或 者结果集容量的大小, 可以与上述预设的条件相同, 也可以不相同。 其中, 在本实施例中, 该预设的结果集条件大于或等于上限阈值。
还需要说明的是, 当预设的结果集条件小于上限阈值时, 则可以执行步 骤 303 中的操作, 当预设的结果集条件大于或等于上限阈值时, 则步骤 303 的具体实现方式可以为: 在该结果集满足预设的条件后, 停止扫描, 将满足 条件的结果集发送给该客户端, 并记录当前扫描的第一位置信息。
步骤 304、保存该第一位置信息、 查询对象、数据获取方式、 查询方式、 查询过滤条件和预设的结果集条件, 并将该第一位置信息、 查询对象、 数据 获取方式、 查询方式、 查询过滤条件和预设的结果集条件与该查询标识相对 应。
在本实施例中, 客户端在接收到结果集后, 若判断结果集未获取完, 则 请求获取下一批结果集, 从而触发数据的处理装置根据当前扫描的第一位置 信息继续扫描; 若判断获取完所有结果集, 则结束处理。
更为优选的, 在本实施例中, 第一位置信息可以如表一所示:
Figure imgf000011_0001
内存表 内存表 id+rowkey+supername 多组 * 数据文件 文件名 +文件偏移量 多组 * 其中, 该 id用于标记内存表, owkey用于标记用户 , supername用于标 记用户下的数据。 "多组 *"用于表示内存表和数据文件的数量为多个。
步骤 305、 接收该客户端发送的第二查询请求, 该第二查询请求中包括 该查询标识。
在本实施例中, 客户端接收到结果集后进行判断, 当结果集还未获取完 时, 还可以继续发送查询请求, 以继续获取结果集。
步骤 306、根据该第二查询请求,与该查询标识对应的该第一位置信息、 查询对象、 数据获取方式、 查询方式、 查询过滤条件和预设的结果集条件, 以及内存表和数据文件的映射信息, 对该查询对象中的数据进行扫描, 并将 扫描到的数据加入到结果集中。
在本实施例中, 当查询对象包括内存表, 或者内存表和数据文件时, 在 将所述查询标识和所述满足该预设的结果集条件的结果集发送给所述客户端 之后, 当至少一个内存表中的数据未扫描完, 且达到了持久化条件时, 在将 至少一个内存表中的数据转存到至少一个数据文件中时, 记录至少一个数据 文件和所述至少一个内存表的映射信息。 从而在继续扫描时, 若查询对象中 的一个内存表中的数据未扫描完, 且达到了持久化条件, 则根据第一位置信 息, 查询该映射信息, 获取与该一个内存表对应的内存表和数据文件的映射 信息, 并根据该内存表和数据文件的映射信息, 找到该一个内存表对应的数 据文件, 对该数据文件中的数据进行扫描。
步骤 307、 在该结果集满足预设的条件后, 停止扫描, 将满足条件的结 果集发送给该客户端, 并记录当前扫描的第三位置信息;
步骤 308、 将该查询标识对应的第一位置信息更新为该查询标识对应的 第三位置信息。
另外, 还需要说明的是, 当该查询对象包括内存表, 或者内存表和数据 文件, 在将该查询标识和上述结果集发送给该客户端之后, 且该内存表中的 数据未扫描完, 且没有达到了持久化条件时, 步骤 306的还一种具体实现方 式为: 根据该第二查询请求, 以及与该查询标识对应的该第一位置信息、 查询 对象、 数据获取方式、 查询方式、 查询过滤条件和预设的结果集条件, 对该 查询对象中的数据进行扫描, 并将扫描到的数据加入到结果集中。
其中,持久化条件可以为如下一种: 内存表中的数据达到预设阈值;和, 内存表中的数据达到预设配置时间。 需要说明的是, 在内存表达到预设化条 件时, 该内存表中的数据将转存到数据文件中。
进一步地,在本发明的还一个实施例中,在上述图 3方法所示实施例中, 当该查询方式为顺序查询方式时, 该第一位置信息和该第二位置信息均包括 当前扫描到的内存表中的扫描位置或者当前扫描到的数据文件中的扫描位置; 或者,
当该查询方式为并行查询方式时, 该第一位置信息和该第二位置信息均 包括多个内存表中的扫描位置和多个数据文件中的扫描位置。
图 4为本发明数据的处理方法的又一个实施例的流程图,在本实施例中, 以获取结果集方式为获取排序结果集方式为例, 详细介绍本实施例的技术方 案, 如图 4所示, 该方法包括:
步骤 401、 接收客户端发送的第一查询请求, 该第一查询请求中包括查 询对象、 数据获取方式、 查询方式、 查询过滤条件和预设的结果集条件。
步骤 402、 根据该查询方式, 对该查询对象中的数据进行扫描, 并根据 查询过滤条件, 对扫描到的数据进行过滤, 再将满足查询过滤条件的数据加 入到结果集中。
步骤 403、 在该结果集满足所述预设的条件后, 将所述结果集存入内存 页中。
在本实施例中, 上述内存空间包括内存页和临时页。
步骤 404、 判断在内存页中排序的结果集中的数据量是否小于或等于内 存页大小; 若小于或等于, 则执行步骤 405; 若大于, 则执行步骤 406。
步骤 405、 在该内存页中对该结果集进行排序处理, 再将排序处理后的 结果集分批提取发送给该客户端, 并记录每次提取的第二位置信息。 结束。
步骤 406、 将该结果集存入内存页中, 并在该内存页中对该结果集进行 排序处理, 再将排序处理后的结果集放入到临时页中。
在本实施例中, 内存页中排序的结果集中的数据量大于内存页的大小, 需要对内存页中的结果集进行部分排序, 即若内存页中的结果集有多个, 则 将多个结果集进行划分, 对划分后的结果集进行排序, 在分别放入到临时页 中。
步骤 407、 在扫描完成后, 在该临时空间中, 采用多路归并的方式, 对 该排序处理后的结果集进行排序, 并依次将采用多路归并和排序处理后的结 果集分批提取发送给该客户端, 并记录每次提取的第二位置信息。
还需要说明的而是, 在本实施例 第二位置信息可以如表二所示:
Figure imgf000014_0001
Figure imgf000014_0002
进一步的, 在本发明的还一个实施例中, 在上述各个所示方法实施例的 基础上, 该查询对象中包含内存表, 若至少一个内存表中的数据未扫描完, 且达到了持久化条件时, 该方法还包括:
在将该至少一个内存表中的数据转存到至少一个数据文件中时, 记录该 至少一个数据文件和该至少一个内存表的映射信息。
在本实施例中, 初始化内存表时, 建立内存表 ID与数据文件 ID的映射 关系, 并为每个内存表设置其对应的引用计数, 初始时引用计数为 0。 该内 存表对应的引用计数用于说明该内存表是否被引用 (即被扫描) , 例如: 当 引用内存表(即对该内存表进行扫描)时, 将该内存表对应的引用计数加 1; 在引用结束时, 对该内存表对应的引用计数减 1。 对于多批次获取结果集的 场景中, 在开始获取第一批次的结果集时, 可以对引用的内存表对应的引用 计数加 1 , 只有当结果获取完, 或者后续不在引用该内存表时, 才对该内存 表对应的引用计数减 1。
另外, 当在多批结果集提取的周期中, 引用的内存表中的数据达到了持 久化条件, 且当该内存表 Flush (指内存表的数据持久化到数据文件的过程) 时, 判断其对应的引用计数是否为零, 如果不为零(即说明该内存表中的数 据未扫描完) , 则将其内存表的引用置为 NULL, 同时, 将该内存表对应的 数据文件的引用设置为持久化的文件引用,并根据该内存表 ID和数据文件 ID 的映射关系,生成映射信息(例如: rowkey+supername映射为文件偏移量)。 同时, 将该内存表对应的引用计数为 0。 则继续扫描时, 由于内存表的引用 置为 NULL, 因此, 查询映射信息, 获取该内存表对应的数据文件, 以继续 对该数据文件进行扫描。
另外, 当引用计数对应的内存表已经持久化, 且引用计数为 0, 说明在 该内存表中扫描已经完成, 因此, 可以删除该内存表 ID对应的数据文件 ID 的映射关系。
图 5为本发明数据的处理装置的一个实施例的结构示意图,如图 5所示, 本实施例的装置应用于非关系型数据库, 该装置包括: 接收模块 51、 扫描模 块 52和结果集处理模块 53; 其中, 接收模块 51用于接收客户端发送的第一 查询请求, 所述第一查询请求中包括查询对象和数据获取方式; 扫描模块 52 用于对所述查询对象中的数据进行扫描,并将扫描到的数据加入到结果集中; 结果集处理模块 53用于若所述数据获取方式为获取非排序结果集方式,则在 所述结果集满足预设的条件后, 触发所述扫描模块停止扫描, 并将满足条件 的结果集发送给所述客户端, 再记录当前扫描的第一位置信息; 或者, 所述 结果集处理模块 53还用于若所述数据获取方式为获取排序结果集方式,则在 所述结果集满足所述预设的条件后, 将所述结果集存入临时空间中, 继续扫 描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排序, 并将排序 后的数据加入到满足所述预设条件的结果集中分批发送给所述客户端, 并记 录每次提取的第二位置信息。
本实施例的数据的处理装置可以执行图 2所示方法实施例的技术方案, 其实现原理相类似, 此处不再赘述。
在本实施例中, 接收客户端发送的第一查询请求, 该第一查询请求中包 括查询对象和数据获取方式; 对该查询对象中的数据进行扫描, 并将扫描到 的数据加入到结果集中, 若该数据获取方式为获取非排序结果集方式, 则在 该结果集满足预设的条件后, 停止扫描, 将满足条件的结果集发送给该客户 端, 并记录当前扫描的第一位置信息; 若所述数据获取方式为获取排序结果 集方式, 则在所述结果集满足所述预设的条件后, 将所述结果集存入临时空 间中, 继续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排 序, 并将排序后的数据加入到满足所述预设条件的结果集中分批发送给所述 客户端, 并记录每次提取的第二位置信息, 从而保证了结果集不会因为过大 而导致内存不够用而崩溃, 即避免了现有技术中在非关系数据库中基本只能 一次性地对结果集进行提取而导致内存占用过多而崩溃的情况, 进而有效地 提高了结果集获取的响应速度。
图 6为本发明数据的处理装置的另一个实施例的结构示意图, 在上述图
5所示实施例的基础上, 如图 6所示, 该查询对象中包含内存表, 若至少一 个内存表中的数据未扫描完, 且达到了持久化条件时, 该装置还包括: 记录 模块 54用于在将该至少一个内存表中的数据转存到至少一个数据文件中时, 记录该至少一个数据文件和该至少一个内存表的映射信息。
优选地, 该装置还包括: 配置模块 55和保存模块 56; 其中, 配置模块
55用于为该第一查询请求配置唯一的查询标识; 保存模块 56用于保存该第 一位置信息、 查询对象和数据获取方式, 并将该第一位置信息、 查询对象和 数据获取方式与该查询标识相对应。
则该结果集处理模块 53 具体用于若该数据获取方式为获取非排序结果 集方式, 则在该结果集满足预设的条件后, 停止扫描, 将该查询条件和满足 条件的结果集发送给该客户端, 并记录当前扫描的第一位置信息。
更为优选地, 该接收模块 51还用于接收该客户端发送的第二查询请求, 该第二查询请求中包括该查询标识;
该扫描模块 52还用于根据该第二查询请求,以及与该查询标识对应的该 第一位置信息、查询对象和数据获取方式,对该查询对象中的数据进行扫描, 并将扫描到的数据加入到结果集中;
该结果集处理模块 53还用于在该结果集满足预设的条件后,触发该扫描 模块停止扫描, 并将满足条件的结果集发送给该客户端, 再记录当前扫描的 第三位置信息, 以及将该查询标识对应的第一位置信息更新为该查询标识对 应的第三位置信息。
或者, 更为优选地, 该接收模块 51还用于接收该客户端发送的第二查询 请求, 该第二查询请求中包括该查询标识;
该扫描模块 52还用于根据该第二查询请求,与该查询标识对应的该第一 位置信息、 查询对象和数据获取方式, 以及该至少一个数据文件和该至少一 个内存表的映射信息, 对该查询对象中的数据进行扫描, 并将扫描到的数据 加入到结果集中;
该结果集处理模块 53还用于在该结果集满足预设的条件后,触发该扫描 模块停止扫描, 并将满足条件的结果集发送给该客户端, 再记录当前扫描的 第三位置信息, 以及将该查询标识对应的第一位置信息更新为该查询标识对 应的第三位置信息。
本实施例的数据的处理装置可以执行图 3所示方法实施例的技术方案, 其实现原理相类似, 此处不再赘述。
在本发明的还一个实施例的结构示意图, 在上述图 5所示实施例的基础 上,结果集处理模块 53还具体用于若所述数据获取方式为获取排序结果集方 式, 则在所述结果集满足所述预设的条件后, 将所述结果集存入内存页中, 继续扫描, 在所述扫描模块扫描完成后, 对所述内存页中保存的所有数据进 行排序, 并将排序后的数据加入到满足所述预设条件的结果集中分批发送给 所述客户端, 并记录每次提取的第二位置信息;
其中, 该内存空间包括该内存页。
或者,该结果集处理模块 53还具体用于若所述数据获取方式为获取排序 结果集方式, 则在所述结果集满足所述预设的条件后, 将所述结果集存入内 存页中, 并在所述内存页中对所述结果集中的数据进行排序处理, 再将排序 处理后的结果集放入到临时页中; 在所述扫描模块扫描完成后, 在所述临时 空间中, 采用多路归并的方式, 对所述排序处理后的结果集进行排序, 并依 次将采用多路归并和排序处理后的结果集分批提取发送给所述客户端, 并记 录每次提取的第二位置信息;
其中, 该临时空间包括该内存页和该临时页。
本实施例的数据的处理装置可以执行图 4所示方法实施例的技术方案, 其实现原理相类似, 此处不再赘述。
图 7描述了本发明另一个实施例提供的数据的处理装置的硬件架构图, 包括至少一个处理器 71 (例如 CPU ) , 至少一个网络接口 72或者其他通信 接口, 存储器 73 , 和至少一个通信总线 74, 用于实现这些装置之间的连接通 信。 处理器 71用于执行存储器 73中存储的可执行模块, 例如计算机程序。 存储器 73可能包含高速随机存取存储器( RAM: Random Access Memory ) , 也可能还包括非易失性存储器( non-volatile memory ) , 例如至少一个磁盘存 储器。 通过至少一个网络接口 72 (可以是有线或者无线) 实现该系统网关与 至少一个其他网元之间的通信连接, 可以使用互联网, 广域网, 本地网, 城 域网等。
在一些实施方式中, 存储器 73存储了程序指令, 程序指令可以被处理器 71执行, 其中, 程序指令包括接收模块 51、 扫描模块 52和结果集处理模块 53。 其中, 各模块的具体实现参见图 5所揭示的相应模块, 这里不再累述。
通过以上的实施方式的描述, 所属领域的技术人员可以清楚地了解到本 发明可以用硬件实现, 或固件实现, 或它们的组合方式来实现。 当使用软件 实现时, 可以将上述功能存储在计算机可读介质中或作为计算机可读介质上 的一个或多个指令或代码进行传输。 计算机可读介质包括计算机存储介质和 通信介质, 其中通信介质包括便于从一个地方向另一个地方传送计算机程序 的任何介质。 存储介质可以是计算机能够存取的任何可用介质。 以此为例但 不限于: 计算机可读介质可以包括 RAM、 ROM, EEPROM、 CD-ROM或其 他光盘存储、 磁盘存储介质或者其他磁存储设备、 或者能够用于携带或存储 具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他 介质。 此外。 任何连接可以适当的成为计算机可读介质。 例如, 如果软件是 使用同轴电缆、 光纤光缆、 双绞线、 数字用户线 (DSL )或者诸如红外线、 无线电和微波之类的无线技术从网站、 服务器或者其他远程源传输的, 那么 同轴电缆、 光纤光缆、 双绞线、 DSL或者诸如红外线、 无线和微波之类的无 线技术包括在所属介质的定影中。如本发明所使用的,盘(Disk )和碟(disc ) 包括压缩光碟(CD ) 、 激光碟、 光碟、 数字通用光碟 ( DVD ) 、 软盘和蓝光 光碟, 其中盘通常磁性的复制数据, 而碟则用激光来光学的复制数据。 上面 的组合也应当包括在计算机可读介质的保护层级之内。
总之, 以上所述仅为本发明技术方案的较佳实施例而已, 并非用于限定 本发明的保护层级。 凡在本发明的精神和原则之内, 所作的任何修改、 等同 替换、 改进等, 均应包含在本发明的保护层级之内。

Claims

权 利 要 求 书
1、一种数据的处理方法,应用于非关系型数据库中,其特征在于,包括: 接收客户端发送的第一查询请求, 所述第一查询请求中包括查询对象和 数据获取方式;
对所述查询对象中的数据进行扫描,并将扫描到的数据加入到结果集中; 若所述数据获取方式为获取非排序结果集方式, 则在所述结果集满足预 设的条件后, 停止扫描, 将满足条件的结果集发送给所述客户端, 并记录当 前扫描的第一位置信息;
若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述 预设的条件后, 将所述结果集存入临时空间中, 继续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排序, 并将排序后的数据加入到满足 所述预设条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位 置信息。
2、 根据权利要求 1所述的方法, 其特征在于, 所述查询对象中包含内存 表, 若至少一个内存表中的数据未扫描完, 且达到了持久化条件时, 所述方 法还包括:
在将所述至少一个内存表中的数据转存到至少一个数据文件中时, 记录 所述至少一个数据文件和所述至少一个内存表的映射信息。
3、 根据权利要求 1或 2所述的方法, 其特征在于, 所述若所述数据获取 方式为获取非排序结果集方式, 则在所述结果集满足预设的条件后, 停止扫 描, 将满足条件的结果集发送给所述客户端, 并记录当前扫描的第一位置信 息之后, 所述方法还包括:
为所述第一查询请求配置唯一的查询标识;
保存所述第一位置信息、 查询对象和数据获取方式, 并将所述第一位置 信息、 查询对象和数据获取方式与所述查询标识相对应;
则所述将满足条件的结果集发送给所述客户端, 包括:
将所述查询标识和满足条件的结果集发送给所述客户端。
4、 根据权利要求 3所述的方法, 其特征在于, 还包括:
接收所述客户端发送的第二查询请求, 所述第二查询请求中包括所述查 询标识; 根据所述第二查询请求,以及与所述查询标识对应的所述第一位置信息、 查询对象和数据获取方式, 对所述查询对象中的数据进行扫描, 并将扫描到 的数据加入到结果集中;
在所述结果集满足预设的条件后, 停止扫描, 将满足条件的结果集发送 给所述客户端, 并记录当前扫描的第三位置信息;
将所述查询标识对应的第一位置信息更新为所述查询标识对应的第三位 置信息。
5、 根据权利要求 3所述的数据的处理方法, 其特征在于, 还包括: 接收所述客户端发送的第二查询请求, 所述第二查询请求中包括所述查 询标识;
根据所述第二查询请求, 与所述查询标识对应的所述第一位置信息、 查 询对象和数据获取方式, 以及所述至少一个数据文件和所述至少一个内存表 的映射信息, 对所述查询对象中的数据进行扫描, 并将扫描到的数据加入到 结果集中;
在所述结果集满足预设的条件后, 停止扫描, 将满足条件的结果集发送 给所述客户端, 并记录当前扫描的第三位置信息;
将所述查询标识对应的第一位置信息更新为所述查询标识对应的第三位 置信息。
6、 根据权利要求 4或 5所述的数据的处理方法, 其特征在于, 当所述第 一查询请求包括查询方式, 且所述查询方式为顺序查询方式时, 所述第一位 置信息和所述第二位置信息均包括当前扫描到的内存表中的扫描位置或者当 前扫描到的数据文件中的扫描位置; 或者,
当所述查询方式为并行查询方式时, 所述第一位置信息和所述第二位置 信息均包括所述内存表中的扫描位置和所述数据文件中的扫描位置。
7、 根据权利要求 1或 2所述的数据的处理方法, 其特征在于, 所述若所 述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述预设的条 件后, 将所述结果集存入临时空间中, 继续扫描, 在扫描完成后, 对所述临 时空间中保存的所有数据进行排序, 并将排序后的数据加入到满足所述预设 条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位置信息, 包括: 若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述 预设的条件后, 将所述结果集存入内存页中, 继续扫描, 在扫描完成后, 对 所述内存页中保存的所有数据进行排序, 并将排序后的数据加入到满足所述 预设条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位置信 息;
其中, 所述内存空间包括所述内存页。
8、 根据权利要求 1或 2所述的数据的处理方法, 其特征在于, 所述若所 述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述预设的条 件后, 将所述结果集存入临时空间中, 继续扫描, 在扫描完成后, 对所述临 时空间中保存的所有数据进行排序, 并将排序后的数据加入到满足所述预设 条件的结果集中分批发送给所述客户端, 并记录每次提取的第二位置信息, 包括:
若所述数据获取方式为获取排序结果集方式, 则在所述结果集满足所述 预设的条件后, 将所述结果集存入内存页中, 并在所述内存页中对所述结果 集中的数据进行排序处理, 再将排序处理后的结果集放入到临时页中;
在扫描完成后, 在所述临时空间中, 采用多路归并的方式, 对所述排序 处理后的结果集进行排序, 并依次将采用多路归并和排序处理后的结果集分 批提取发送给所述客户端, 并记录每次提取的第二位置信息;
其中, 所述临时空间包括所述内存页和所述临时页。
9、一种数据的处理装置,应用于非关系型数据库中,其特征在于,包括: 接收模块, 用于接收客户端发送的第一查询请求, 所述第一查询请求中 包括查询对象和数据获取方式;
扫描模块, 用于对所述查询对象中的数据进行扫描, 并将扫描到的数据 加入到结果集中;
结果集处理模块, 用于若所述数据获取方式为获取非排序结果集方式, 则在所述结果集满足预设的条件后, 触发所述扫描模块停止扫描, 并将满足 条件的结果集发送给所述客户端, 再记录当前扫描的第一位置信息; 或者, 所述结果集处理模块, 还用于若所述数据获取方式为获取排序结果集方 式,则在所述结果集满足所述预设的条件后,将所述结果集存入临时空间中, 继续扫描, 在扫描完成后, 对所述临时空间中保存的所有数据进行排序, 并 将排序后的数据加入到满足所述预设条件的结果集中分批发送给所述客户端 , 并记录每次提取的第二位置信息。
10、 根据权利要求 8所述的数据的处理装置, 其特征在于, 所述查询对 象中包含内存表, 若至少一个内存表中的数据未扫描完, 且达到了持久化条 件时, 所述装置还包括:
记录模块, 用于在将所述至少一个内存表中的数据转存到至少一个数据 文件中时, 记录所述至少一个数据文件和所述至少一个内存表的映射信息。
11、根据权利要求 9或 10所述的数据的处理装置,其特征在于,还包括: 配置模块, 用于为所述第一查询请求配置唯一的查询标识;
保存模块, 用于保存所述第一位置信息、 查询对象和数据获取方式, 并 将所述第一位置信息、 查询对象和数据获取方式与所述查询标识相对应;
则所述结果集处理模块具体用于若所述数据获取方式为获取非排序结果 集方式, 则在所述结果集满足预设的条件后, 停止扫描, 将所述查询条件和 满足条件的结果集发送给所述客户端, 并记录当前扫描的第一位置信息。
12、 根据权利要求 11所述的数据的处理装置, 其特征在于, 所述接收模 块还用于接收所述客户端发送的第二查询请求, 所述第二查询请求中包括所 述查询标识;
所述扫描模块还用于根据所述第二查询请求, 以及与所述查询标识对应 的所述第一位置信息、 查询对象和数据获取方式, 对所述查询对象中的数据 进行扫描, 并将扫描到的数据加入到结果集中;
所述结果集处理模块还用于在所述结果集满足预设的条件后, 触发所述 扫描模块停止扫描, 并将满足条件的结果集发送给所述客户端, 再记录当前 扫描的第三位置信息, 以及将所述查询标识对应的第一位置信息更新为所述 查询标识对应的第三位置信息。
13、 根据权利要求 11所述的数据的处理装置, 其特征在于, 所述接收模 块还用于接收所述客户端发送的第二查询请求, 所述第二查询请求中包括所 述查询标识;
所述扫描模块还用于根据所述第二查询请求, 与所述查询标识对应的所 述第一位置信息、 查询对象和数据获取方式, 以及所述至少一个数据文件和 所述至少一个内存表的映射信息, 对所述查询对象中的数据进行扫描, 并将 扫描到的数据加入到结果集中;
所述结果集处理模块还用于在所述结果集满足预设的条件后, 触发所述 扫描模块停止扫描, 并将满足条件的结果集发送给所述客户端, 再记录当前 扫描的第三位置信息, 以及将所述查询标识对应的第一位置信息更新为所述 查询标识对应的第三位置信息。
14、 根据权利要求 9或 10所述的数据的处理装置, 其特征在于, 所述结 果集处理模块还具体用于若所述数据获取方式为获取排序结果集方式, 则在 所述结果集满足所述预设的条件后,将所述结果集存入内存页中,继续扫描, 在所述扫描模块扫描完成后, 对所述内存页中保存的所有数据进行排序, 并 将排序后的数据加入到满足所述预设条件的结果集中分批发送给所述客户端 , 并记录每次提取的第二位置信息;
其中, 所述内存空间包括所述内存页。
15、 根据权利要求 9或 10所述的数据的处理装置, 其特征在于, 所述结 果集处理模块还具体用于若所述数据获取方式为获取排序结果集方式, 则在 所述结果集满足所述预设的条件后, 将所述结果集存入内存页中, 并在所述 内存页中对所述结果集中的数据进行排序处理, 再将排序处理后的结果集放 入到临时页中; 在所述扫描模块扫描完成后, 在所述临时空间中, 采用多路 归并的方式, 对所述排序处理后的结果集进行排序, 并依次将采用多路归并 和排序处理后的结果集分批提取发送给所述客户端, 并记录每次提取的第二 位置信息;
其中, 所述临时空间包括所述内存页和所述临时页。
PCT/CN2012/088073 2012-12-31 2012-12-31 数据的处理方法和装置 WO2014101199A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201280001994.8A CN104321766A (zh) 2012-12-31 2012-12-31 数据的处理方法和装置
PCT/CN2012/088073 WO2014101199A1 (zh) 2012-12-31 2012-12-31 数据的处理方法和装置
EP12890810.0A EP2924587A4 (en) 2012-12-31 2012-12-31 METHOD AND DEVICE FOR DATA PROCESSING
US14/751,775 US20150293816A1 (en) 2012-12-31 2015-06-26 Data processing method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/088073 WO2014101199A1 (zh) 2012-12-31 2012-12-31 数据的处理方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/751,775 Continuation US20150293816A1 (en) 2012-12-31 2015-06-26 Data processing method and apparatus

Publications (1)

Publication Number Publication Date
WO2014101199A1 true WO2014101199A1 (zh) 2014-07-03

Family

ID=51019799

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/088073 WO2014101199A1 (zh) 2012-12-31 2012-12-31 数据的处理方法和装置

Country Status (4)

Country Link
US (1) US20150293816A1 (zh)
EP (1) EP2924587A4 (zh)
CN (1) CN104321766A (zh)
WO (1) WO2014101199A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260402A (zh) * 2015-09-18 2016-01-20 久盈世纪(北京)科技有限公司 用于数据管理的方法与设备
CN111814045A (zh) * 2020-06-30 2020-10-23 平安科技(深圳)有限公司 数据查询方法、装置、电子设备及存储介质
CN116644090A (zh) * 2023-07-27 2023-08-25 天津神舟通用数据技术有限公司 一种数据查询方法、装置、设备及介质

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10437720B2 (en) * 2014-03-12 2019-10-08 Optumsoft, Inc. Deferred destruction for efficient resource reclamation
CN107644033B (zh) * 2016-07-21 2021-08-17 阿里巴巴集团控股有限公司 一种在非关系型数据库中进行数据查询的方法与设备
CN110019288B (zh) * 2017-08-25 2020-12-08 中国移动通信集团甘肃有限公司 一种数据操作方法及装置
CN110348870A (zh) * 2018-04-08 2019-10-18 深圳凯茜微想科技有限公司 一种展示广告的方法、装置和系统
CN110363561A (zh) * 2018-04-09 2019-10-22 深圳凯茜微想科技有限公司 一种展示广告的方法、装置和系统
CN109658043A (zh) * 2018-10-16 2019-04-19 深圳壹账通智能科技有限公司 催收数据处理方法、装置、设备和存储介质
CN110781326A (zh) * 2019-10-25 2020-02-11 湖南省公安厅 图片检索、获取方法、装置及图片存储系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101196935A (zh) * 2008-01-03 2008-06-11 中兴通讯股份有限公司 一种创建索引库的系统及其方法
CN102609488A (zh) * 2012-01-20 2012-07-25 北京星网锐捷网络技术有限公司 客户端及其数据查询方法、服务端和数据查询系统
CN102750353A (zh) * 2012-06-08 2012-10-24 清华大学 一种在键值库中进行分布式数据分析的方法

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050076018A1 (en) * 2003-10-07 2005-04-07 Neidecker-Lutz Burkhard K. Sorting result buffer
US7580920B2 (en) * 2004-07-22 2009-08-25 Microsoft Corporation System and method for graceful degradation of a database query
US8015612B2 (en) * 2007-04-27 2011-09-06 Rogson Ariel S Addressing security in writes to memory
US8478775B2 (en) * 2008-10-05 2013-07-02 Microsoft Corporation Efficient large-scale filtering and/or sorting for querying of column based data encoded structures
US8190943B2 (en) * 2009-03-13 2012-05-29 Massachusetts Institute Of Technology Systolic merge sorter
US8055850B2 (en) * 2009-04-06 2011-11-08 International Business Machines Corporation Prioritization of directory scans in cache
WO2011065654A1 (en) * 2009-11-25 2011-06-03 Lg Electronics Inc. Method of processing epg metadata in network device and network device for controlling the same
US8745034B1 (en) * 2011-05-04 2014-06-03 Google Inc. Selectively retrieving search results in accordance with predefined sort criteria
US9405802B2 (en) * 2011-05-05 2016-08-02 Reversinglabs International, Gmbh Database system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101196935A (zh) * 2008-01-03 2008-06-11 中兴通讯股份有限公司 一种创建索引库的系统及其方法
CN102609488A (zh) * 2012-01-20 2012-07-25 北京星网锐捷网络技术有限公司 客户端及其数据查询方法、服务端和数据查询系统
CN102750353A (zh) * 2012-06-08 2012-10-24 清华大学 一种在键值库中进行分布式数据分析的方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2924587A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260402A (zh) * 2015-09-18 2016-01-20 久盈世纪(北京)科技有限公司 用于数据管理的方法与设备
CN111814045A (zh) * 2020-06-30 2020-10-23 平安科技(深圳)有限公司 数据查询方法、装置、电子设备及存储介质
CN116644090A (zh) * 2023-07-27 2023-08-25 天津神舟通用数据技术有限公司 一种数据查询方法、装置、设备及介质
CN116644090B (zh) * 2023-07-27 2023-11-10 天津神舟通用数据技术有限公司 一种数据查询方法、装置、设备及介质

Also Published As

Publication number Publication date
CN104321766A (zh) 2015-01-28
EP2924587A1 (en) 2015-09-30
EP2924587A4 (en) 2015-12-02
US20150293816A1 (en) 2015-10-15

Similar Documents

Publication Publication Date Title
WO2014101199A1 (zh) 数据的处理方法和装置
US20190213203A1 (en) Distributed database transaction protocol
CN111046034B (zh) 管理内存数据及在内存中维护数据的方法和系统
US9189506B2 (en) Database index management
CN106484820B (zh) 一种重命名方法、访问方法及装置
US20150178329A1 (en) Multiple rid spaces in a delta-store-based database to support long running transactions
JP2016539417A (ja) 列指向データベース処理方法および処理デバイス
EP2863310A1 (en) Data processing method and apparatus, and shared storage device
WO2015149628A1 (zh) Dns缓存信息处理方法、设备及系统
WO2013086969A1 (zh) 重复数据查找方法、装置及系统
WO2013078583A1 (zh) 优化数据访问的方法及装置、优化数据存储的方法及装置
US8380663B2 (en) Data integrity in a database environment through background synchronization
WO2015070663A1 (zh) 一种日志结构数据库系统查询请求消息处理方法及装置
CN111723161A (zh) 一种数据处理方法、装置及设备
CN103810219A (zh) 一种基于行存储数据库的数据处理方法及装置
WO2017112861A1 (en) System and method for adaptive filtering of data requests
JP2017045454A (ja) 同時の、増分の及び世代のマークアンドスィープガーベッジコレクション
CN113377289A (zh) 一种缓存管理方法、系统、计算设备及可读存储介质
WO2016141722A1 (zh) 时序数据处理方法及装置
US9836491B1 (en) Method and apparatus for hardware-implemented AVL tree updates
CN103365987A (zh) 一种基于共享磁盘架构的集群数据库系统及数据处理方法
CN110109866B (zh) 一种文件系统目录的管理方法及设备
WO2014180395A1 (zh) 海量数据融合存储方法及系统
WO2015049719A1 (ja) ストレージシステム及びストレージ方法
JP2004265421A5 (zh)

Legal Events

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

Ref document number: 12890810

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2012890810

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2012890810

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE