Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

0

Share

Download to read offline

How to add stuff to MySQL

Download to read offline

How to extend MySQL: from UDFs to components and to pull requests

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

How to add stuff to MySQL

  1. 1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | How to Add Stuff to MySQL Georgi “Joro” Kodinov Team Lead, SrvGen Team A Guided Tour
  2. 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  3. 3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Agenda 3 • The basic way: user defined functions • The old way: plugins • The new way: components • The advanced way: pull requests
  4. 4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | User Defined Functions The Basic Way 4
  5. 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Architecture of UDFs 5 SQL UDF call Result Client Server UDF Library
  6. 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Pros and Cons Pros Cons Easy A single return value Well documented No way to generate SQL errors SQL callable Limited data type support Dynamically loadable Need to be defined one by one Can also make aggregate functions 6 User Defined Functions
  7. 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | A User Defined Function: sql/udf_example.com 7 A loop over the arguments Check for NULL values Argument type Returning a result To return a NULL result set to 1
  8. 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Compiling and Running [gkodinov@loki01]~/work/mysql-8.0/sql: gcc -I ../include/ -I ../libbinlogevents/export/ -I ../bld/include/ -shared -std=c++11 -fPIC -o udf_example.so udf_example.cc 8
  9. 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Plugins The Old Way 9
  10. 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Architecture of Plugins 10 SQL Plugin API call Result Client Server Plugin Library Plugin Service
  11. 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Pros and Cons Pros Cons Better known Two plugins cannot co-operate directly Documented Plugins are linked with the server symbols Can respond to events in server Plugin APIs not easily extensible Multiple active plugins Complex loading/unloading sequence Can call back into the server code No explicit dependencies Dynamically loadable Hard to add new plugin APIs Lots of examples Good amount of useful plugin APIs 11 Plugins
  12. 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 12 Sample plugin: plugin/auth/auth_socket.cc
  13. 13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Compiling the plugin • Need a source distro • Put in plugin/ • Add CMakeLists.txt 13
  14. 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the plugin 14 Install the plugin Create a user using the plugin Authenticate Verify the result
  15. 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Components The New Way 15
  16. 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Architecture of Components 16 SQL Client Server Services
  17. 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Pros and Cons Pros Cons Explicit Dependencies Not all plugin APIs are migrated to components All components are equal and can communicate Not available in versions older than MySQL 8.0 Can dynamically add new service implementations Relatively new: lacks some refinements Can override existing service implementations Currently supports mostly C APIs Can provide soft transition by keeping the old and the new Dynamically loadable Can be adaptive to the services present Does not require the server binary to be built 17 Components
  18. 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Sample Service Definition And Implementation 18
  19. 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Sample Component 19 What service implementations a component provides What service implementations a component requires Component metadata Component Definition Shared Library Definition
  20. 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | How to Find And Use a Service: The Low Level Way 20
  21. 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | How to Find And Use a Service: The Easier Way 21
  22. 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Pull Requests The Advanced Way 22
  23. 23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 23 Pull Requests
  24. 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | The New And Improved Doxygen Manual 24
  25. 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Summary • Always consider a component first • Go to plugin If you: – need to implement an existing, not-yet-migrated plugin API – need to call into an existing, not-yet-migrated plugin service • Go to UDFs if you need an SQL callable function • Go to pull requests if none of the above fits 25
  26. 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 26

How to extend MySQL: from UDFs to components and to pull requests

Views

Total views

176

On Slideshare

0

From embeds

0

Number of embeds

43

Actions

Downloads

2

Shares

0

Comments

0

Likes

0

×