Your SlideShare is downloading. ×
0
CUBRID InsideFirst Look Inside CUBRID<br />Jan 18, 2009<br />
저작권 Copyright Notice<br />CREATIVE COMMONS 저작자표시-동일조건변경허락 2.0 대한민국<br />이용자는 아래의 조건을 따르는 경우에 한하여 자유롭게<br />이 저작물을 복제, 배포, ...
CUBRID<br />
Contents<br />System Architecture and Processes<br />Design & Implementation Concepts<br />Module and Source Structure<br ...
<ul><li>What is CUBRID?
System Architecture
CUBRID Processes and IPC
Query Processing Workflow</li></ul>System Architecture and Processes<br />1<br />5/<br />41   First Look Inside CUBRID<br />
System Architecture and ProcessesWhat is CUBRID?<br />CUBRID is<br />Open Source DBMS owned and developed by NHN<br />Host...
System Architecture and ProcessesSystem Architecture<br />1.2<br />Server Subsystem<br />Multi-threaded storage engine par...
System Architecture and ProcessesSystem Architecture<br />1.2<br />CUBRID<br />Manager<br />GUI<br />Interface<br />PHP<br...
1.2<br />CUBRID<br />Manager<br />GUI<br />Interface<br />PHP<br />OLE DB<br />Ruby<br />CUBRID<br />Manager<br />JDBC<br ...
System Architecture and ProcessesCUBRID Processes and IPC<br />Master Process ‘cub_master’<br />Daemon process listening o...
System Architecture and ProcessesCUBRID Processes and IPC<br />1.3<br />JDBC driver<br />CCI library<br />connect<br />que...
System Architecture and ProcessesQuery Processing Workflow<br />1.4<br />12/<br />41   First Look Inside CUBRID<br />
System Architecture and ProcessesQuery Processing Workflow<br />1.4<br />XASL  Type<br />UNION<br />Extended Access Spec L...
Design & Implementation Concepts<br />2<br /><ul><li>Client-Server and Standalone Mode
Object, Class and OID
Representation, Record Descriptor, and Memory Object Pointer
Workspace – Object & Lock Caching
2PL vs. MVCC
XASL (Extended Access Spec Language)
Heap, B+tree, Catalog, and Temp
Click Counter</li></ul>14/<br />41   First Look Inside CUBRID<br />
Design & Implementation ConceptsClient-Server and Standalone Mode<br />2.1<br />15/<br />41   First Look Inside CUBRID<br />
Design & Implementation ConceptsObject, Class and OID<br />2.2<br />16/<br />41   First Look Inside CUBRID<br />
Design & Implementation ConceptsRepresentation, Record Descriptor, and Memory Object Pointer<br />2.3<br />17/<br />41   F...
Design & Implementation ConceptsWorkspace – Object & Lock Caching<br />2.4<br />18/<br />41   First Look Inside CUBRID<br />
Design & Implementation Concepts2PL vs. MVCC<br />2.5<br />19/<br />41   First Look Inside CUBRID<br />
Design & Implementation ConceptsXASL (Extended Access Spec Language)<br />2.6<br />20/<br />41   First Look Inside CUBRID<...
Design & Implementation ConceptsHeap, B+tree, Catalog, and Temp<br />2.7<br />21/<br />41   First Look Inside CUBRID<br />
Design & Implementation ConceptsClick Counter<br />In Terms of User<br />Whenever the user clicks an article, the read cou...
Design & Implementation ConceptsClick Counter<br />2.8<br />Don’t walk the same passage twice!<br />When you get there, do...
Module and Source Structure<br />3<br /><ul><li>Overall Structure
Query Processing Component
Transaction Management Component
Server Storage Management Component
Client Storage Management Component
Object Management Component
Job and Thread Management Component
Client-Server Communication Layer
Broker Component</li></ul>24/<br />41   First Look Inside CUBRID<br />
Upcoming SlideShare
Loading in...5
×

CUBRID Inside - Architecture, Source & Management Components

3,327

Published on

This presentation explains in details the structure of CUBRID architecture, its components, modules, as well as source code structure.

Overall Structure
- Query Processing Component
- Transaction Management Component
- Server Storage Management Component
- Client Storage Management Component
- Object Management Component
- Job and Thread Management Component
- Client-Server Communication Layer
- Broker Component

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,327
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "CUBRID Inside - Architecture, Source & Management Components"

  1. 1. CUBRID InsideFirst Look Inside CUBRID<br />Jan 18, 2009<br />
  2. 2. 저작권 Copyright Notice<br />CREATIVE COMMONS 저작자표시-동일조건변경허락 2.0 대한민국<br />이용자는 아래의 조건을 따르는 경우에 한하여 자유롭게<br />이 저작물을 복제, 배포, 전송, 전시, 공연 및 방송할 수 있습니다.<br />이차적 저작물을 작성할 수 있습니다.<br />다음과 같은 조건을 따라야 합니다:<br />저작자표시. 귀하는 원저작자를 표시하여야 합니다. <br />What does "Attribute this work" mean? The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well. <br />동일조건변경허락. 귀하가 이 저작물을 개작, 변형 또는 가공했을 경우에는, 이 저작물과 동일한 이용허락조건하에서만 배포할 수 있습니다. <br />귀하는, 이 저작물의 재이용이나 배포의 경우, 이 저작물에 적용된 이용허락조건을 명확하게 나타내어야 합니다.<br />저작권자로부터 별도의 허가를 받으면 이러한 조건들은 적용되지 않습니다.<br />Nothing in this license impairs or restricts the author's moral rights.<br />CREATIVE COMMONS Attribution-Share Alike 2.0 Korea<br />You are free:<br />to Share — to copy, distribute and transmit the work<br />to Remix — to adapt the work<br />Under the following conditions:<br />Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). <br />What does "Attribute this work" mean? The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well. <br />Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. <br />For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.<br />Any of the above conditions can be waived if you get permission from the copyright holder.<br />Nothing in this license impairs or restricts the author's moral rights.<br />http://creativecommons.org/licenses/by-sa/2.0/kr/<br />Copyright 2009 Search Solution Corporation. All Rights Reserved.<br />
  3. 3. CUBRID<br />
  4. 4. Contents<br />System Architecture and Processes<br />Design & Implementation Concepts<br />Module and Source Structure<br />In The Next CUBRID Inside<br />4/<br />41 First Look Inside CUBRID<br />
  5. 5. <ul><li>What is CUBRID?
  6. 6. System Architecture
  7. 7. CUBRID Processes and IPC
  8. 8. Query Processing Workflow</li></ul>System Architecture and Processes<br />1<br />5/<br />41 First Look Inside CUBRID<br />
  9. 9. System Architecture and ProcessesWhat is CUBRID?<br />CUBRID is<br />Open Source DBMS owned and developed by NHN<br />Hosted at nForge site<br />Targeted to a database platform for Internet portal service<br />Relational database system with object extensions – Object-Relational Model<br />1,000,000 line of source code scaled project<br />Engine – C/C++, CUBRID Manager (GUI) and JDBC driver – Java<br />CUBRID provides<br />Full-featured database server engine<br />Server and Broker architecture<br />GUI management and query tool<br />CUBRID Manager<br />Various API (JDBC, ODBC(OLE DB), PHP, and CCI)<br />Python and Ruby as contributed projects<br />1.1<br />6/<br />41 First Look Inside CUBRID<br />
  10. 10. System Architecture and ProcessesSystem Architecture<br />1.2<br />Server Subsystem<br />Multi-threaded storage engine part which runs as DB server<br />Consists of Transaction Manager, Object Manager, Lock Manager, Query Manager, Log Manager, and Storage Manager<br />Client Subsystem<br />Client library part providing native C API<br />Consists of Query Parser & Optimizer, Object & Lock Cache, Transaction Manager and Object Manager<br />Broker Subsystem<br />Linked with client library and implemented CCI protocol<br />Does job queuing, connection pooling, monitoring and logging<br />Connectors<br />JDBC driver<br />CCI library<br />Many drivers are implemented with CCI library – ODBC, OLEDB, PHP, Python, and Ruby<br />7/<br />41 First Look Inside CUBRID<br />
  11. 11. System Architecture and ProcessesSystem Architecture<br />1.2<br />CUBRID<br />Manager<br />GUI<br />Interface<br />PHP<br />OLE DB<br />Ruby<br />CUBRID<br />Manager<br />JDBC<br />ODBC<br />CCI<br />Python<br />CM Server<br />Job<br />Queuing<br />Monitoring<br />Connection<br />Pooling<br />Logging<br />Admin<br />Utility<br />Broker<br />Create, Delete, Copy, Rename<br />Query<br />Parser &<br />Optimizer<br />Lock<br />Cache<br />Object<br />Manager<br />Transaction<br />Manager<br />Add Volume<br />Load /<br />Unload<br />Backup /<br />Restore<br />Query<br />Manager<br />Lock<br />Manager<br />Server<br />Compact /<br />Optimize<br />Storage<br />Manager<br />Log<br />Manager<br />Check /<br />Diag<br />Active<br />Log<br />File Based<br />Objects<br />Data<br />Volume<br />Index<br />Volume<br />Temp<br />Volume<br />Archive<br />Log<br />8/<br />41 First Look Inside CUBRID<br />
  12. 12. 1.2<br />CUBRID<br />Manager<br />GUI<br />Interface<br />PHP<br />OLE DB<br />Ruby<br />CUBRID<br />Manager<br />JDBC<br />ODBC<br />CCI<br />Python<br />CM Server<br />Create, Delete, Copy, Rename<br />Job<br />Queuing<br />Monitoring<br />Connection<br />Pooling<br />Logging<br />Admin<br />Utility<br />Broker<br />Client Library<br />Add Volume<br />Native C API<br />Parser<br />Object<br />Manager<br />Schema<br />Manager<br />Transaction<br />Manager<br />Load /<br />Unload<br />Query<br />Transform<br />Workspace Manager<br />Backup /<br />Restore<br />Query<br />Optimizer<br />Memory Manager<br />Compact /<br />Optimize<br />Plan<br />Generation<br />Check /<br />Diag<br />Communication Module<br />Storage Engine<br />Server<br />Communication Module<br />Transaction<br />Manager<br />Log<br />Manager<br />Lock<br />Manager<br />Query<br />Manager<br />Access<br />Method<br />B+Tree<br />Module<br />File Manager<br />System<br />Catalog Module<br />System Architecture<br />Buffer Manager<br />Disk Manager<br />Active<br />Log<br />File Based<br />Objects<br />Data<br />Volume<br />Index<br />Volume<br />Temp<br />Volume<br />Archive<br />Log<br />9/<br />41 First Look Inside CUBRID<br />
  13. 13. System Architecture and ProcessesCUBRID Processes and IPC<br />Master Process ‘cub_master’<br />Daemon process listening on the TCP port for clients’ connection<br />csql, broker, and admin utilities<br />Registrar of server processes using Unix Domain Socket<br />Server Process ‘cub_server’<br />Multi-threaded process serving clients’ requests<br />Has thread pool and job queue<br />Accesses database volume and log files<br />One server process per one database<br />Broker Process ‘cub_broker’<br />Daemon process listening on the TCP port for connectors’ connection<br />Controls cub_cas processes (fork/kill) with connection queue<br />CAS Process ‘cub_cas’<br />Connects to the server process in behalf of connectors<br />According to the database and user name<br />CSQL Program ‘csql’<br />Interactive SQL execution<br />1.3<br />10/<br />41 First Look Inside CUBRID<br />
  14. 14. System Architecture and ProcessesCUBRID Processes and IPC<br />1.3<br />JDBC driver<br />CCI library<br />connect<br />query &<br />result<br />query &<br />result<br />port listening<br />cub_broker<br />cubrid_broker.conf<br />fork<br />parse<br />descriptor pass<br />AP<br />Web Server<br />cub_cas<br />cub_cas<br />shared memory<br />cubridcs.so<br />cubridcs.so<br />csql<br />connect<br />cubridcs.so<br />request &<br />response<br />request &<br />response<br />parse<br />Broker<br />TCP<br />job queue<br />multi-thread<br />port listening<br />descriptor pass<br />parse<br />cub_master<br />cub_server<br />cubrid.so<br />cubrid.conf<br />UDS<br />Active<br />Server<br />Standby<br />Server<br />mount<br />(read/write)<br />read<br />register<br />volume file<br />log file<br />databases.txt<br />volume file<br />log file<br />Replication<br />cub_admin<br />cubridsa.so<br />11/<br />41 First Look Inside CUBRID<br />
  15. 15. System Architecture and ProcessesQuery Processing Workflow<br />1.4<br />12/<br />41 First Look Inside CUBRID<br />
  16. 16. System Architecture and ProcessesQuery Processing Workflow<br />1.4<br />XASL Type<br />UNION<br />Extended Access Spec Language<br />(XASL)<br />DIFFERENCE<br />INTERSECTION<br />OBJFETCH<br />Query Manager<br />TransactionManager<br />Lock Manager<br />SETFETCH<br />BUILD_LIST<br />BUILD_VALUE<br />Query Result Cache<br />Query Plan Cache<br />Query Evaluator<br />(Interpreter)<br />SCAN<br />MERGE_LIST<br />Scan Management<br />READ<br />UPDATE<br />Storage Manager<br />DELETE<br />INSERT<br />13/<br />41 First Look Inside CUBRID<br />
  17. 17. Design & Implementation Concepts<br />2<br /><ul><li>Client-Server and Standalone Mode
  18. 18. Object, Class and OID
  19. 19. Representation, Record Descriptor, and Memory Object Pointer
  20. 20. Workspace – Object & Lock Caching
  21. 21. 2PL vs. MVCC
  22. 22. XASL (Extended Access Spec Language)
  23. 23. Heap, B+tree, Catalog, and Temp
  24. 24. Click Counter</li></ul>14/<br />41 First Look Inside CUBRID<br />
  25. 25. Design & Implementation ConceptsClient-Server and Standalone Mode<br />2.1<br />15/<br />41 First Look Inside CUBRID<br />
  26. 26. Design & Implementation ConceptsObject, Class and OID<br />2.2<br />16/<br />41 First Look Inside CUBRID<br />
  27. 27. Design & Implementation ConceptsRepresentation, Record Descriptor, and Memory Object Pointer<br />2.3<br />17/<br />41 First Look Inside CUBRID<br />
  28. 28. Design & Implementation ConceptsWorkspace – Object & Lock Caching<br />2.4<br />18/<br />41 First Look Inside CUBRID<br />
  29. 29. Design & Implementation Concepts2PL vs. MVCC<br />2.5<br />19/<br />41 First Look Inside CUBRID<br />
  30. 30. Design & Implementation ConceptsXASL (Extended Access Spec Language)<br />2.6<br />20/<br />41 First Look Inside CUBRID<br />
  31. 31. Design & Implementation ConceptsHeap, B+tree, Catalog, and Temp<br />2.7<br />21/<br />41 First Look Inside CUBRID<br />
  32. 32. Design & Implementation ConceptsClick Counter<br />In Terms of User<br />Whenever the user clicks an article, the read counter of the article is increased.<br />Counts the clicks on the article<br />In Terms of Service Application Developer<br />The read counter is very important for bulletin board type service.<br />Combine getting article data and increasing read counter together<br />get_article() + increase_counter() = get_article_and_increase_counter()<br />(SELECT article_info) + (UPDATE read_counter+1)<br />In Terms of Database Engineer<br />Do SELECT and UPDATE in one SQL statement<br />SELECT trigger? SELECT FOR UDPATE?<br />UPDATE the record with the short term lock<br />Example<br />SELECT doc_id, title, INCR(read_counter), post_date FROM board WHERE doc_id=?<br />2.8<br />22/<br />41 First Look Inside CUBRID<br />
  33. 33. Design & Implementation ConceptsClick Counter<br />2.8<br />Don’t walk the same passage twice!<br />When you get there, do as many things as possible.<br />Killing two birds with one stone.<br />23/<br />41 First Look Inside CUBRID<br />
  34. 34. Module and Source Structure<br />3<br /><ul><li>Overall Structure
  35. 35. Query Processing Component
  36. 36. Transaction Management Component
  37. 37. Server Storage Management Component
  38. 38. Client Storage Management Component
  39. 39. Object Management Component
  40. 40. Job and Thread Management Component
  41. 41. Client-Server Communication Layer
  42. 42. Broker Component</li></ul>24/<br />41 First Look Inside CUBRID<br />
  43. 43. Module and Source StructureOverall Structure<br />41 First Look Inside CUBRID<br />25/<br />3.1<br />C API<br />Transaction Management<br />Common & Support<br />Broker<br />Job & Thread Management<br />CCI Library<br />Server Storage Management<br />CUBRID Manager<br />Query Processing<br />Client-Server Comm<br />PHP Connector<br />Query Processing<br />Native C API<br />Query Processing<br />Job & Thread Management<br />Utilities<br />Object Management<br />Memory Manager<br />JDBC Driver<br />Client Storage Management<br />Java Stored Procedure<br />
  44. 44. 41 First Look Inside CUBRID<br />26/<br />Module and Source Structure<br />3.1<br />src/<br />broker<br />CUBRID<br />Manager<br />GUI<br />PHP<br />OLE DB<br />Ruby<br />JDBC<br />ODBC<br />CCI<br />Python<br />CM Server<br />src/<br />query<br />src/<br />storage<br />src/<br />transaction<br />src/<br />compat<br />Create, Delete, Copy, Rename<br />Job<br />Queuing<br />Monitoring<br />Connection<br />Pooling<br />Logging<br />Client Library<br />Add Volume<br />Native C API<br />Parser<br />Object<br />Manager<br />Schema<br />Manager<br />Transaction<br />Manager<br />Load /<br />Unload<br />Query<br />Transform<br />Workspace Manager<br />Backup /<br />Restore<br />Query<br />Optimizer<br />Memory Manager<br />Compact /<br />Optimize<br />Plan<br />Generation<br />Check /<br />Diag<br />Communication Module<br />src/<br />cmserver<br />src/<br />communication<br />src/<br />jdbc<br />src/<br />object<br />src/<br />oledb<br />src/<br />php<br />src/<br />cci<br />src/<br />odbc<br />src/<br />optimizer<br />src/<br />base<br />src/<br />executables<br />src/<br />heaplayers<br />src/<br />parser<br />src/<br />thread<br />src/<br />connection<br />Storage Engine<br />Communication Module<br />Transaction<br />Manager<br />Log<br />Manager<br />Lock<br />Manager<br />Query<br />Manager<br />Access<br />Method<br />B+Tree<br />Module<br />File Manager<br />System<br />Catalog Module<br />Buffer Manager<br />Disk Manager<br />
  45. 45. Module and Source StructureQuery Processing Component<br />Scanner/Parser<br />Parses query string and builds parse tree<br />Uses ANTLR v1.x as parser generator<br />Will be replaced with ‘bison’ at R2.0<br />Source files in src/parser<br />Data structure: PT_PARSER, PT_NODE, …<br />Semantic Checker<br />Type check and binding, name resolution, semantic checking, view translation, and so on<br />Source files in src/parser<br />Parse tree traversing function: parser_walk_tree()<br />Optimizer<br />Rewrite optimization by heuristic rules<br />Select a query execution plan by CBO (Cost Based Optimization) method<br />Source files in src/parser and src/optimizer<br />Data structure: QO_NODE, QO_PLANNER, …<br />XASL Generator<br />Generate XASL tree from the query execution plan<br />XASL contains scan information (heap/index/list file/set/method scan), value list, and predicates<br />Source files in src/parser<br />Data structure: XASL_NODE, REGU_VARIABLE, …<br />Query Manager (Executor)<br />Executes XASL tree (XASL interpreter)<br />Includes query evaluator, query plan cache, query result cache, query result file, and scan management<br />Source files in src/query<br />Main function: qexec_execute_mainblock()<br />Cursor Manager<br />Extracts tuple from the list file page shipped from the server Query Manager<br />Source files in src/query<br />3.2<br />27/<br />41 First Look Inside CUBRID<br />
  46. 46. Module and Source StructureQuery Processing Component<br />3.2<br />Object Management Component<br />Broker<br />Semantic Checker<br />Scanner/Parser<br />Optimizer<br />XASL Generator<br />Cursor Manager<br />Client-Server Communication Layer<br />Client-Server Communication Layer<br />Server<br />Query Plan/Result Cache<br />Query Manager<br />Transaction Management Component<br />Query Evaluator<br />(Interpreter)<br />Storage Management Component<br />(Server)<br />Scan Management<br />28/<br />41 First Look Inside CUBRID<br />
  47. 47. Module and Source StructureTransaction Management Component<br />Transaction Manager<br />Controls transaction – start, commit/abort, savepoint, and top operation<br />Works tightly with lock and log manager <br />Supports 2PC protocol for global transaction<br />Initialize other related modules such as lock, log, and recovery manager<br />Source files in src/transaction<br />Data structure: LOG_TDES, TRANTABLE, …<br />Object Locator<br />Controls the flow of objects between the workspaces and the database pages<br />Translates between memory representation and disk representation<br />Caches objects from the server into the workspace with the granted locks<br />Cached object and lock provides fast access to the objects and reduces interacting with the lock manager on the server<br />Source files in src/transaction<br />Lock Manager<br />Based on strict 2PL protocol<br />Includes support for OR feature<br />class lock and instance lock<br />Deadlock detector with WFG<br />As separate thread<br />Source files in src/transaction<br />Data structure: LK_ENTRY, LK_TRAN_LOCK, …<br />Log Manager<br />Transaction logging and recovering<br />REDO/UNDO recovery protocol<br />WAL protocol<br />Physical logging and logical logging<br />Supports group commit and asynchronous commit feature<br />Source files in src/transaciton<br />Data structure: LOG_GLOBAL, LOG_HDRPAGE, LOG_PAGE, <br />3.3<br />29/<br />41 First Look Inside CUBRID<br />
  48. 48. Module and Source StructureTransaction Management Component<br />3.3<br />Storage Management Component<br />(Client)<br />Object Management Component<br />Transaction Manager<br />(Client)<br />Broker<br />Object Locator<br />(Client)<br />Client-Server Communication Layer<br />Client-Server Communication Layer<br />Server<br />Object Locator<br />(Server)<br />Lock Manager<br />Transaction Manager<br />(Server)<br />Storage Management Component<br />(Server)<br />Log Manager<br />30/<br />41 First Look Inside CUBRID<br />
  49. 49. Module and Source StructureServer Storage Management Component<br />File I/O Manager<br />Provides disk I/O access functions and implements file structure<br />Coordinates the allocation and deallocation of unstructured files and pages<br />File>Sector>Page<br />File manager requests sectors from the disk manager<br />Source files in src/storage<br />Identifier: vdes, PAGEID<br />Disk Manager<br />Volume file management – implements volume structure in a OS file<br />A volume corresponds to a singe file<br />A set of contiguous pages of fixed size<br />Source files in src/storage<br />Identifier: volid<br />Page Buffer Manager<br />Data buffer pool with LRU replacement algorithm<br />Uses buffer hash table and fix/unfix protocol (latch)<br />Source files in src/storage<br />Identifier: VPID<br />Data structure: PGBUF_BUFFER_POOL<br />Slotted Page Manager<br />Manages insertions, deletions, and modifications of records on pages<br />Each record has an associated slot identifier<br />Source files in src/storage<br />OID = (pageid, slotid, volid)<br />Overflow File Manager<br />Larger object than the size of a page is placed on overflow pages<br />Source files in src/storage<br />Object Heap Manager<br />Inserts/deletes/updates objects within a file<br />Permanent unchangeable OID is assigned to an object when it is stored on a heap<br />Provides heap scan method (sequential scan) and direct fetch method<br />An object heap holds the instances of one class<br />Source files in src/storage<br />Identifier: HFID<br />B+-tree Manager<br />Implements prefix B+-tree index with KVL<br />Provides index scan method – unique find and range search<br />3.4<br />31/<br />41 First Look Inside CUBRID<br />
  50. 50. Module and Source StructureServer Storage Management Component<br />3.4<br />Broker<br />Client-Server Communication Layer<br />Client-Server Communication Layer<br />Server<br />Query Processing Component<br />(Server)<br />Transaction Management Component<br />(Server)<br />Object Heap Manager<br />B+-tree Manager<br />Large Object Manager<br />Extendible Hash Manager<br />File Manager<br />Slotted Page Manager<br />Overflow File Manager<br />Page Buffer Manager<br />Catalog Manager<br />Disk Manager<br />I/O Manager<br />32/<br />41 First Look Inside CUBRID<br />
  51. 51. Module and Source StructureClient Storage Management Component<br />Workspace Manager<br />Maintains a cache of database objects within the virtual memory address space of client process<br />Maintains hash table that maps a OID into MOP<br />MOP has OID field and a pointer to memory object<br />Source files in src/object<br />Quick Fit Allocator<br />Memory manager for workspace<br />Source files in src/object, src/base<br />Garbage Collector<br />To collect and free the unused(dangled) memory objects<br />Normally GC is disabled<br />Object and Lock Caching<br />When the contents of object(s) is(are) required, the object locator is called to fetch the object(s) from the database via the server-side object locator<br />The object locator translate the disk representation of the objet into the memory representation and allocates MOP to points it<br />While accessing the object in the database, the requested lock is held by the lock manager in the server and the memory object has the cached lock mode<br />The cached objects can be decached at any time when its state is not consistent with the disk objects, or will be decached at the time of transaction abort<br />At the time of transaction commit, only the cached locks are released; objects remains with null lock<br />3.5<br />33/<br />41 First Look Inside CUBRID<br />
  52. 52. Module and Source StructureClient Storage Management Component<br />3.5<br />Object Management Component<br />Broker<br />Garbage Collector<br />Quick File Allocator<br />Workspace Manager<br />Transaction Management Component <br />Object Locator (Client)<br />Client-Server Communication Layer<br />Client-Server Communication Layer<br />Server<br />34/<br />41 First Look Inside CUBRID<br />
  53. 53. Module and Source StructureObject Management Component<br />Object Accessor<br />Interface for object creation, deletion, inspection, and modification<br />Source files in src/object<br />Object Representation<br />Transforms (or translates) between the disk representation and the memory representation of the object<br />Resolves byte ordering also<br />Source files in src/object, src/base<br />Functions: or_xxx(), tf_mem_to_disk(), tf_disk_to_mem(), …<br />Data Type and Domain<br />Internal data structure for data type and domain<br />Source files in src/object<br />Data structure: TP_DOMAIN<br />Sets<br />Source files in src/object<br />Data structure: SETOBJ, COL<br />Schema Manager<br />Implements OR model regarding database schema<br />Definitions of the class object – attributes, method, class inheritance, and conflict resolution<br />Memory representation of class object<br />Source files in src/objet<br />Data structure: SM_CLASS, SM_ATTRIBUTE, …<br />Authentication and Authorization<br />User authentication and database privilege<br />User, GRANT, REVOKE, …<br />Source files in src/object<br />Trigger Manager<br />Implements trigger feature<br />Source files src/object<br />Dynamic Loader<br />Support dynamic loading of shared object as ‘method’<br />Depreciated feature<br />Large Object<br />Implements glo, elo, fbo classes and supporting methods<br />Source files in src/object<br />3.6<br />35/<br />41 First Look Inside CUBRID<br />
  54. 54. Module and Source StructureObject Management Component<br />3.6<br />Object Accessor<br />Broker<br />Schema Manager<br />Authentication<br /> & Authorization<br />Trigger Manager<br />Set<br />Dynamic Loader<br />Data Type and Domain<br />Object Representation<br />Storage Management Component<br />(Client)<br />Client-Server Communication Layer<br />Client-Server Communication Layer<br />Server<br />36/<br />41 First Look Inside CUBRID<br />
  55. 55. Module and Source StructureJob and Thread Management Component<br />Connection Manager<br />Connection establishment and management and request handler<br />Source files in src/communication, src/connection<br />Data structure: CSS_QUEUE_ENTRY, CSS_CONN_ENTRY, …<br />Job Queue<br />Master thread monitors socket fds (select()), receives clients’ request packet, en-queues it, and then wake up a worker thread in the thread pool<br />Source files in src/connection<br />Data structure: CSS_JOB_ENTRY, …<br />Critical Section<br />Implements semaphore<br />Source files in src/thread<br />System Threads<br />Master thread<br />Deadlock detection thread<br />Run deadlock detection algorithm periodically<br />Resolves deadlock by aborting unilaterally victim transaction(s)<br />Checkpoint thread<br />Executes periodic checkpoint action<br />OOB handling thread<br />Catch OOB signal<br />Page flush thread<br />Flushes dirty data buffer pages to the volume files in the background<br />To reduce burden of page replacement<br />Log flush thread<br />Flushes dirty log buffer pages to the log file in the background<br />Implements group commit and asynchronous commit features<br />Source files in src/thread<br />3.7<br />37/<br />41 First Look Inside CUBRID<br />
  56. 56. Module and Source StructureClient-Server Communication Layer<br />Socket Transceiver<br />Socket utility functions<br />TCP/IP, Unix domain socket, and named pipe<br />Source files in src/connection<br />Linux and Windows port<br />Packet Handler<br />Sends requests and receives response between client and server<br />Packet types: request packet, data packet, close packet, out-of-band packet, error packet, abort packet<br />Packet format: packet header + payload<br />Queuing request and data packets<br />Source files in src/connection<br />Communication Interface Layer<br />RPC stub style functions<br />Implements object serialization<br />Source files in src/communication<br />3.8<br />38/<br />41 First Look Inside CUBRID<br />
  57. 57. Module and Source StructureBroker Component<br />Broker Process<br />Accepts connection requests from the Connectors (JDBC, CCI, …)<br />Allocates and/or assigns CAS process to the request<br />Controls and monitors CAS processes<br />Has four threads<br />main: manages cas process<br />receiver_thread: does accept() and enqueues new job<br />dispatch_thread: dequeue job and assigns cas process<br />cas_monitor_thread: monitors cas process to restart<br />Source files in src/broker<br />CAS Process<br />Linked with CUBRID client library<br />So, run as a single thread<br />Receives and processes requests from the application(Connectors)<br />Connect to database<br />Prepare and execute query<br />Fetch the result<br />Commit/rollback transaction<br />Get/set parameters<br />Has four states<br />IDLE: not connected with AP<br />BUSY: processing request<br />CLIENT_WAIT: connected and waiting for request; within a transaction<br />CLOSE_WAIT: connected and waiting for request; out of a transaction<br />Source files in src/broker<br />3.9<br />39/<br />41 First Look Inside CUBRID<br />
  58. 58. In The Next CUBRID Inside<br />4<br />40/<br />41 First Look Inside CUBRID<br />
  59. 59. In The Next CUBRID Inside<br />4<br />What topic do you want to see covered in the next CUBRID Inside?<br />Suggesting Topics<br />41/<br />41 First Look Inside CUBRID<br />
  60. 60. Question?<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×