| About the Author |
|
xix | |
| About the Technical Reviewers |
|
xxi | |
| Acknowledgments |
|
xxiii | |
| Introduction |
|
xxv | |
|
Part 1 Getting Started with MySQL Development |
|
|
1 | (150) |
|
Chapter 1 MySQL and The Open Source Revolution |
|
|
3 | (20) |
|
What Is Open Source Software? |
|
|
4 | (1) |
|
Why Use Open Source Software? |
|
|
5 | (3) |
|
Is Open Source Really a Threat to Commercial Software? |
|
|
8 | (1) |
|
Legal Issues and the GNU Manifesto |
|
|
9 | (2) |
|
Let the Revolution Continue! |
|
|
11 | (1) |
|
|
|
12 | (2) |
|
|
|
14 | (1) |
|
What Can You Modify in MySQL? Are There Limits? |
|
|
15 | (1) |
|
|
|
16 | (2) |
|
So, Can You Modify MySQL or Not? |
|
|
18 | (1) |
|
Guidelines for Modifying MySQL |
|
|
18 | (1) |
|
A Real-World Example: TiVo |
|
|
19 | (4) |
|
|
|
20 | (3) |
|
Chapter 2 The Anatomy of a Database System |
|
|
23 | (34) |
|
Types of Database Systems |
|
|
23 | (1) |
|
Object-Oriented Database Systems |
|
|
23 | (1) |
|
Object-Relational Database Systems |
|
|
24 | (1) |
|
Relational Database Systems |
|
|
25 | (2) |
|
Relational Database System Architecture |
|
|
27 | (1) |
|
|
|
27 | (2) |
|
|
|
29 | (1) |
|
|
|
30 | (2) |
|
|
|
32 | (2) |
|
Internal Representation of Queries |
|
|
34 | (1) |
|
|
|
35 | (1) |
|
|
|
36 | (2) |
|
|
|
38 | (1) |
|
Relational Database Architecture Summary |
|
|
38 | (1) |
|
The MySQL Database System |
|
|
38 | (1) |
|
MySQL System Architecture |
|
|
39 | (2) |
|
|
|
41 | (1) |
|
|
|
41 | (1) |
|
|
|
42 | (1) |
|
|
|
43 | (1) |
|
|
|
43 | (3) |
|
|
|
46 | (3) |
|
File Access via Pluggable Storage Engines |
|
|
49 | (8) |
|
|
|
56 | (1) |
|
Chapter 3 A Tour of the MySQL Source Code |
|
|
57 | (60) |
|
|
|
57 | (1) |
|
Understanding the Licensing Options |
|
|
57 | (1) |
|
|
|
58 | (1) |
|
|
|
59 | (1) |
|
|
|
60 | (2) |
|
The mysql_main() Function |
|
|
62 | (2) |
|
Handling Connections and Creating Threads |
|
|
64 | (7) |
|
|
|
71 | (8) |
|
Preparing the Query for Optimization |
|
|
79 | (4) |
|
|
|
83 | (5) |
|
|
|
88 | (3) |
|
|
|
91 | (1) |
|
Important Classes and Structures |
|
|
92 | (7) |
|
|
|
99 | (3) |
|
|
|
102 | (1) |
|
|
|
102 | (1) |
|
|
|
102 | (2) |
|
|
|
104 | (1) |
|
|
|
105 | (1) |
|
|
|
105 | (1) |
|
|
|
106 | (2) |
|
Keeping an Engineering Logbook |
|
|
108 | (1) |
|
|
|
109 | (2) |
|
Building the System for the First Time |
|
|
111 | (6) |
|
|
|
115 | (2) |
|
Chapter 4 Test-Driven MySQL Development |
|
|
117 | (34) |
|
|
|
117 | (1) |
|
|
|
117 | (3) |
|
|
|
120 | (2) |
|
|
|
122 | (1) |
|
Introducing Software Testing |
|
|
123 | (1) |
|
Functional Testing vs. Defect Testing |
|
|
123 | (4) |
|
|
|
127 | (1) |
|
Using the MySQL Test Suite |
|
|
128 | (8) |
|
|
|
136 | (7) |
|
|
|
143 | (8) |
|
|
|
149 | (2) |
|
|
|
151 | (302) |
|
|
|
153 | (42) |
|
|
|
153 | (1) |
|
|
|
154 | (1) |
|
|
|
154 | (1) |
|
|
|
154 | (2) |
|
|
|
156 | (1) |
|
Inline Debugging Statements |
|
|
156 | (3) |
|
|
|
159 | (2) |
|
|
|
161 | (1) |
|
|
|
161 | (3) |
|
|
|
164 | (2) |
|
GNU Data Display Debugger |
|
|
166 | (2) |
|
|
|
168 | (2) |
|
|
|
170 | (1) |
|
Inline Debugging Statements |
|
|
170 | (8) |
|
|
|
178 | (1) |
|
|
|
179 | (1) |
|
|
|
179 | (4) |
|
|
|
183 | (6) |
|
|
|
189 | (6) |
|
|
|
193 | (2) |
|
|
|
195 | (56) |
|
Building Embedded Applications |
|
|
195 | (1) |
|
What Is an Embedded System? |
|
|
195 | (1) |
|
Types of Embedded Systems |
|
|
196 | (1) |
|
Embedded Database Systems |
|
|
196 | (1) |
|
|
|
197 | (1) |
|
Methods of Embedding MySQL |
|
|
198 | (1) |
|
|
|
198 | (1) |
|
Deep Embedding (libmysqld) |
|
|
198 | (1) |
|
|
|
198 | (1) |
|
|
|
199 | (1) |
|
Advantages of MySQL Embedding |
|
|
199 | (1) |
|
Limitations of MySQL Embedding |
|
|
199 | (1) |
|
|
|
200 | (1) |
|
|
|
200 | (1) |
|
Most Commonly Used Functions |
|
|
201 | (1) |
|
Creating an Embedded Server |
|
|
202 | (1) |
|
|
|
203 | (1) |
|
|
|
204 | (1) |
|
|
|
205 | (1) |
|
|
|
206 | (1) |
|
|
|
206 | (1) |
|
|
|
207 | (1) |
|
Disconnecting from and Finalizing the Server |
|
|
208 | (1) |
|
|
|
208 | (1) |
|
|
|
209 | (1) |
|
Building Embedded MySQL Applications |
|
|
210 | (1) |
|
Compiling the Library (libmysqld) |
|
|
210 | (1) |
|
Compiling libmysqld on Linux |
|
|
210 | (1) |
|
Compiling libmysqld on Windows |
|
|
210 | (1) |
|
|
|
211 | (2) |
|
|
|
213 | (1) |
|
Creating a Basic Embedded Server |
|
|
213 | (1) |
|
|
|
213 | (4) |
|
|
|
217 | (6) |
|
What About Error Handling? |
|
|
223 | (1) |
|
Embedded Server Application |
|
|
224 | (1) |
|
|
|
224 | (3) |
|
|
|
227 | (1) |
|
|
|
228 | (2) |
|
|
|
230 | (1) |
|
Managed vs. unmanaged code |
|
|
230 | (1) |
|
|
|
230 | (8) |
|
Customer Interface (Main Form) |
|
|
238 | (6) |
|
Administration Interface (Administration Form) |
|
|
244 | (3) |
|
Detecting Interface Requests |
|
|
247 | (1) |
|
|
|
247 | (4) |
|
|
|
249 | (2) |
|
Chapter 7 Adding Functions and Commands to MySQL |
|
|
251 | (30) |
|
Adding User-Defined Functions |
|
|
251 | (1) |
|
|
|
252 | (1) |
|
|
|
252 | (1) |
|
Creating a User-Defined Library |
|
|
252 | (5) |
|
Adding a New User-Defined Function |
|
|
257 | (5) |
|
|
|
262 | (4) |
|
Compiling and Testing the New Native Function |
|
|
266 | (1) |
|
|
|
267 | (8) |
|
Adding to the Information Schema |
|
|
275 | (6) |
|
|
|
280 | (1) |
|
Chapter 8 Extending MySQL High Availability |
|
|
281 | (58) |
|
|
|
281 | (1) |
|
|
|
282 | (1) |
|
How Does Replication Achieve High Availability? |
|
|
283 | (1) |
|
|
|
284 | (1) |
|
Requirements for Replication |
|
|
284 | (2) |
|
|
|
286 | (2) |
|
|
|
288 | (1) |
|
Connecting the Slave to the Master |
|
|
288 | (2) |
|
|
|
290 | (1) |
|
|
|
290 | (1) |
|
|
|
291 | (1) |
|
|
|
291 | (2) |
|
Show Binlog Events Command |
|
|
293 | (3) |
|
|
|
296 | (1) |
|
|
|
296 | (1) |
|
A Brief Tour of the Replication Source Code |
|
|
297 | (1) |
|
Replication Source Code Files |
|
|
297 | (2) |
|
|
|
299 | (6) |
|
|
|
305 | (2) |
|
|
|
307 | (3) |
|
|
|
310 | (1) |
|
Global Slave Stop Command |
|
|
311 | (11) |
|
|
|
322 | (17) |
|
|
|
338 | (1) |
|
Chapter 9 Developing MySQL Plugins |
|
|
339 | (30) |
|
|
|
339 | (1) |
|
|
|
339 | (1) |
|
|
|
340 | (4) |
|
|
|
344 | (3) |
|
|
|
347 | (1) |
|
The RFID Authentication Plugin |
|
|
348 | (1) |
|
|
|
349 | (1) |
|
|
|
349 | (6) |
|
Architecture of Authentication Plugins |
|
|
355 | (2) |
|
Building the RFID Authentication Plugin |
|
|
357 | (8) |
|
RFID Authentication in Action |
|
|
365 | (2) |
|
|
|
367 | (2) |
|
|
|
368 | (1) |
|
Chapter 10 Building Your Own Storage Engine |
|
|
369 | (84) |
|
MySQL Storage Engine Overview |
|
|
369 | (2) |
|
Storage Engine Development Process |
|
|
371 | (1) |
|
|
|
372 | (1) |
|
|
|
372 | (1) |
|
|
|
372 | (3) |
|
|
|
375 | (4) |
|
A Brief Tour of a MySQL Storage Engine |
|
|
379 | (1) |
|
The Spartan Storage Engine |
|
|
380 | (1) |
|
|
|
380 | (1) |
|
|
|
381 | (8) |
|
|
|
389 | (14) |
|
|
|
403 | (2) |
|
Stage 1: Stubbing the Engine |
|
|
405 | (1) |
|
Creating the Spartan Plugin Source Files |
|
|
405 | (1) |
|
Adding the CMakeLists.txt File |
|
|
406 | (1) |
|
Compiling the Spartan Engine |
|
|
407 | (1) |
|
Testing Stage 1 of the Spartan Engine |
|
|
407 | (4) |
|
Stage 2: Working with Tables |
|
|
411 | (1) |
|
Updating the Spartan Source Files |
|
|
412 | (1) |
|
|
|
413 | (3) |
|
Testing Stage 2 of the Spartan Engine |
|
|
416 | (1) |
|
Stage 3: Reading and Writing Data |
|
|
417 | (1) |
|
Updating the Spartan Source Files |
|
|
417 | (4) |
|
Testing Stage 3 of the Spartan Engine |
|
|
421 | (1) |
|
Stage 4: Updating and Deleting Data |
|
|
422 | (1) |
|
Updating the Spartan Source Files |
|
|
423 | (1) |
|
Testing Stage 4 of the Spartan Engine |
|
|
424 | (5) |
|
Stage 5: Indexing the Data |
|
|
429 | (1) |
|
Updating the Spartan Source Files |
|
|
430 | (12) |
|
Testing Stage 5 of the Spartan Engine |
|
|
442 | (6) |
|
Stage 6: Adding Transaction Support |
|
|
448 | (5) |
|
|
|
452 | (1) |
|
Part 3 Advanced Database Internals |
|
|
453 | (148) |
|
Chapter 11 Database System Internals |
|
|
455 | (10) |
|
|
|
455 | (1) |
|
MySQL Query Execution Revisited |
|
|
455 | (1) |
|
What Is a Compiled Query? |
|
|
456 | (1) |
|
Exploring MySQL Internals |
|
|
457 | (1) |
|
Getting Started Using MySQL for Experiments |
|
|
457 | (2) |
|
|
|
459 | (1) |
|
The Database System Internals Experiment |
|
|
460 | (1) |
|
|
|
460 | (1) |
|
Overview of the Experiment Project |
|
|
460 | (1) |
|
Components of the Experiment Project |
|
|
461 | (2) |
|
Conducting the Experiments |
|
|
463 | (2) |
|
|
|
463 | (2) |
|
Chapter 12 Internal Query Representation |
|
|
465 | (30) |
|
|
|
465 | (2) |
|
|
|
467 | (1) |
|
|
|
467 | (1) |
|
|
|
468 | (2) |
|
Implementing DBXP Query Trees in MySQL |
|
|
470 | (1) |
|
|
|
470 | (1) |
|
|
|
471 | (1) |
|
Stubbing the DBXP_Select Command |
|
|
472 | (7) |
|
Adding the Query Tree Class |
|
|
479 | (8) |
|
Showing Details of the Query Tree |
|
|
487 | (8) |
|
|
|
494 | (1) |
|
Chapter 13 Query Optimization |
|
|
495 | (48) |
|
Types of Query Optimizers |
|
|
495 | (1) |
|
|
|
496 | (2) |
|
|
|
498 | (1) |
|
|
|
498 | (1) |
|
|
|
499 | (1) |
|
Heuristic Optimization Revisited |
|
|
499 | (1) |
|
|
|
500 | (1) |
|
Stubbing the DBXP Select Command |
|
|
501 | (2) |
|
Important MySQL Structures and Classes |
|
|
503 | (1) |
|
|
|
503 | (1) |
|
|
|
504 | (1) |
|
|
|
505 | (1) |
|
|
|
506 | (2) |
|
Modifications to the Existing Code |
|
|
508 | (6) |
|
Details of the Heuristic Optimizer |
|
|
514 | (24) |
|
Compiling and Testing the Code |
|
|
538 | (5) |
|
|
|
541 | (2) |
|
Chapter 14 Query Execution |
|
|
543 | (58) |
|
Query Execution Revisited |
|
|
543 | (1) |
|
|
|
543 | (1) |
|
|
|
544 | (1) |
|
|
|
544 | (1) |
|
|
|
545 | (3) |
|
|
|
548 | (2) |
|
|
|
550 | (1) |
|
|
|
550 | (1) |
|
|
|
551 | (1) |
|
|
|
552 | (1) |
|
|
|
553 | (2) |
|
|
|
555 | (1) |
|
|
|
556 | (1) |
|
|
|
557 | (1) |
|
Updating the DBXP Select Command |
|
|
558 | (2) |
|
|
|
560 | (1) |
|
|
|
560 | (1) |
|
|
|
561 | (1) |
|
|
|
562 | (10) |
|
|
|
572 | (1) |
|
|
|
572 | (4) |
|
|
|
576 | (2) |
|
The check_rewind() Method |
|
|
578 | (3) |
|
Compiling and Testing the Code |
|
|
581 | (6) |
|
|
|
584 | (3) |
|
|
|
587 | (1) |
|
|
|
587 | (1) |
|
|
|
587 | (1) |
|
|
|
588 | (1) |
|
|
|
588 | (1) |
|
|
|
588 | (1) |
|
|
|
588 | (1) |
|
|
|
589 | (6) |
|
|
|
595 | (1) |
|
|
|
595 | (1) |
|
|
|
596 | (1) |
|
|
|
597 | (4) |
| Index |
|
601 | |