SlideShare a Scribd company logo
1 of 21
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Guided tour on the MySQL Source Code
Georgi Kodinov
MySQL team lead
Confidential – Oracle Internal/Restricted/Highly Restricted
Copyright © 2016, 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.
Confidential – Oracle Internal/Restricted/Highly Restricted 2
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Agenda
Confidential – Oracle Internal/Restricted/Highly Restricted 3
The directory layout of the codebase
Session establishment and termination
Query execution
Add functionality to MySQL
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Important directories in the codebase
Directory Purpose
sql/ Most of the server code
storage/ Storage engines
plugin/ Non-storage-engine plugins
sql-common/ Code common between client and server
libmysql/ Client library code
libmysqld/ Embedded server client library glue code
mysql-test/ Integral tests
libservices/ The plugin services library, plugin part
mysys*/ Portability library, utilities
vio/ Network connection abstraction library
client/ Client tools
Confidential – Oracle Internal/Restricted/Highly Restricted 4
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Session establishment and termination
• Each transport has its own listening thread: *_conn_event_handler()
– Runs Connection_acceptor::connection_event_loop()
• Communicates via a Protocol class sub-class. Protocol_classic for the native
MySQL protocol. Work in progress !
• Each session has a THD created. The THD is the session state. The THD is in
a OS thread attribute (current_thd()). There can be nested THDs.
• Connection_handler_manager class drives the threading model
Confidential – Oracle Internal/Restricted/Highly Restricted 5
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Session establishment and termination contd.
• handle_connection() is the main worker thread execution function
• check_connection() is where authentication happens
• close_connection() is the function to close the connection. Called by both
the worker thread or KILL
Confidential – Oracle Internal/Restricted/Highly Restricted 6
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Query execution at a glance
• do_command() fetches and executes a command (RPC)
• dispatch_command() has the command (RPC) id main switch()
• The THD has the current command being executed
• mysql_parse() parses and executes a single query.
– Called in a loop for the COM_QUERY command
• mysql_execute_command() is the execution part of mysql_parse()
– Used to be a switch() over the SQL command id and call different C functions
– Now in the process of being transformed to calls to Sql_cmd::execute().
– Lots of sub-classes for Sql_cmd.
Confidential – Oracle Internal/Restricted/Highly Restricted 7
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
The parser: work in progress
• In older releases the parser produced the execution plan directly
– Item class subclasses
• Started adding a separate parse stage data structure
– Parse_tree_node subclasses
• Extra pass
– Sql_cmd *PT_Statement::make_cmd()
– Still called by the parser
Confidential – Oracle Internal/Restricted/Highly Restricted 8
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Query execution passes: handle_query() et al
• “Open” all tables: open_tables_for_query ()
• Preparation: SELECT_LEX::prepare() and friends
– Name resolution: setup_fields() et al
– Some transformations, like flattening subqueries etc
• Optimization: SELECT_LEX::optimize() and friends
– Produces a JOIN object for each subquery level
– Calls JOIN::optimize() to produce query execution plan
• Execution: JOIN::exec() or st_select_lex_unit::execute()
– Pumps result into a Query_result sub-class.
Confidential – Oracle Internal/Restricted/Highly Restricted 9
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Adding functionality to MySQL: Plugins
Confidential – Oracle Internal/Restricted/Highly Restricted 10
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Plugins overview
• A plugin is:
– An API that the server calls
– init() and deinit()
– A bunch of system variables
– A bunch of status variables
• A plugin does:
– Initialize and de-initialize itself
– Implement the API that the server will call
– Call back into the server via the plugin services
Confidential – Oracle Internal/Restricted/Highly Restricted 11
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Plugins: Pros and Cons
Pros Cons
Clean versioned API to implement Can only implement a fixed set of APIs defined by the
server
Can be loaded and unloaded dynamically Can only interact with the server. Not other plugins
Can use services to call back into the server Acquiring and releasing plugin handles by the server is
expensive
Can be built with the binary distro, no need for the server
source
Very poor set of plugin services
Are versioned and can be reused across versions Linked with the server binary: can call into the server
code without services
The tree cmake files detect “foreign” plugin directories
and compile them
APIs cannot be related so APIs tend to be large (see e.g.
the SE API : 200+ methods)
Confidential – Oracle Internal/Restricted/Highly Restricted 12
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Most notable plugin types
• Storage engines
• INFORMATION_SCHEMA tables
• Daemon
• Authentication
• Audit
• Keyring
Confidential – Oracle Internal/Restricted/Highly Restricted 13
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
How to write a plugin ?
• Take an existing one and alter it
• Plenty of examples
– Live plugins
– Test plugins
• Put it in plugin/ or storage/ so it compiles
Confidential – Oracle Internal/Restricted/Highly Restricted 14
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Adding functionality to MySQL
Plugin Services
Confidential – Oracle Internal/Restricted/Highly Restricted 15
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
What is a plugin service ?
• The reverse of a plugin API
• Allows plugins to call into the server
• Version controlled
• In essence a set function pointers in each plugin that the server fills in at
INSTALL PLUGIN time
• Header in include/mysql/service_*.h
Confidential – Oracle Internal/Restricted/Highly Restricted 16
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Please use the plugin services !
• Calling server code directly => a “dirty” plugin
– No portability across versions
– No guarantee to work with future versions
• Plugin services are the reverse of Plugin APIs
– Inlcude/mysql/service_*.h
• We have some good ones in 5.7:
– command_service_st : execute a RPC command
– mysql_locking_service_st : interface to MDL locks
– security_context_service_st : interface to the security context
– srv_session_service_st : handle “sessions” inside the server
Confidential – Oracle Internal/Restricted/Highly Restricted 17
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Adding functionality to MySQL: UDFs
Confidential – Oracle Internal/Restricted/Highly Restricted 18
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
What are the UDFs
• Can reside in external binaries
• Can be loaded and unloaded
• Can share binaries with plugins or other UDFs
• Executed as single result or aggregate SQL functions
• Easy to write, lots of examples
Confidential – Oracle Internal/Restricted/Highly Restricted 19
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
UDFs: Pros and Cons
Pros Cons
Easy to write Terrible for the DBA to administer
Can share a binary with the plugins No global initialization and deinitialization
Can be version safe No access to plugin services
Somewhat limited data type range
Only SQL functions, not commands to execute
No THD context
Confidential – Oracle Internal/Restricted/Highly Restricted 20
MySQL Code Tour: Session Establishment and Query Execution

More Related Content

What's hot

Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7
Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7
Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7Gareth Chapman
 
Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMark Leith
 
TFA Collector - what can one do with it
TFA Collector - what can one do with it TFA Collector - what can one do with it
TFA Collector - what can one do with it Sandesh Rao
 
Oracle EM12c Release 4 New Features!
Oracle EM12c Release 4 New Features!Oracle EM12c Release 4 New Features!
Oracle EM12c Release 4 New Features!Kellyn Pot'Vin-Gorman
 
Oracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructureOracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructureSimon Haslam
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsGokhan Atil
 
How to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata EnvironmentsHow to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata EnvironmentsSandesh Rao
 
Oracle Database In-Memory Meets Oracle RAC
Oracle Database In-Memory Meets Oracle RACOracle Database In-Memory Meets Oracle RAC
Oracle Database In-Memory Meets Oracle RACMarkus Michalewicz
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesJeff Smith
 
Anatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business SuiteAnatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business Suitevasuballa
 
Making MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid InfrastructureMaking MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid InfrastructureIlmar Kerm
 
Boost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BSBoost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BSInformation Development World
 
Colvin exadata and_oem12c
Colvin exadata and_oem12cColvin exadata and_oem12c
Colvin exadata and_oem12cEnkitec
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewKris Rice
 

What's hot (20)

Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7
Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7
Oracle ORAchk & EXAchk, What's New in 12.1.0.2.7
 
Em13c features- HotSos 2016
Em13c features- HotSos 2016Em13c features- HotSos 2016
Em13c features- HotSos 2016
 
Maximizing Oracle RAC Uptime
Maximizing Oracle RAC UptimeMaximizing Oracle RAC Uptime
Maximizing Oracle RAC Uptime
 
Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sys
 
Em13c New Features- Two of Two
Em13c New Features- Two of TwoEm13c New Features- Two of Two
Em13c New Features- Two of Two
 
Performance in the Oracle Cloud
Performance in the Oracle CloudPerformance in the Oracle Cloud
Performance in the Oracle Cloud
 
TFA Collector - what can one do with it
TFA Collector - what can one do with it TFA Collector - what can one do with it
TFA Collector - what can one do with it
 
Oracle EM12c Release 4 New Features!
Oracle EM12c Release 4 New Features!Oracle EM12c Release 4 New Features!
Oracle EM12c Release 4 New Features!
 
Oracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructureOracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructure
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAs
 
How to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata EnvironmentsHow to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata Environments
 
Oracle Database In-Memory Meets Oracle RAC
Oracle Database In-Memory Meets Oracle RACOracle Database In-Memory Meets Oracle RAC
Oracle Database In-Memory Meets Oracle RAC
 
Em13c New Features- One of Two
Em13c New Features- One of TwoEm13c New Features- One of Two
Em13c New Features- One of Two
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web Services
 
Anatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business SuiteAnatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business Suite
 
Making MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid InfrastructureMaking MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid Infrastructure
 
AWR and ASH in an EM12c World
AWR and ASH in an EM12c WorldAWR and ASH in an EM12c World
AWR and ASH in an EM12c World
 
Boost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BSBoost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BS
 
Colvin exadata and_oem12c
Colvin exadata and_oem12cColvin exadata and_oem12c
Colvin exadata and_oem12c
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ Overview
 

Similar to MySQL Code Tour: Session Establishment and Query Execution

MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsBen Krug
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerProvisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerSimon Haslam
 
FOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component InfrastructureFOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component InfrastructureGeorgi Kodinov
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance TuningMark Swarbrick
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 
Oracle Office Hours - Exposing REST services with APEX and ORDS
Oracle Office Hours - Exposing REST services with APEX and ORDSOracle Office Hours - Exposing REST services with APEX and ORDS
Oracle Office Hours - Exposing REST services with APEX and ORDSDoug Gault
 
Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOrgad Kimchi
 
MySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL FabricMySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL FabricMark Swarbrick
 
Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data Oracle Developers
 
MySQL in OPC(Oracle Public Cloud)
MySQL in OPC(Oracle Public Cloud)MySQL in OPC(Oracle Public Cloud)
MySQL in OPC(Oracle Public Cloud)Ramana Yeruva
 
Kscope Not Your Father's Enterprise Manager
Kscope Not Your Father's Enterprise ManagerKscope Not Your Father's Enterprise Manager
Kscope Not Your Father's Enterprise ManagerKellyn Pot'Vin-Gorman
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsSveta Smirnova
 
MySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIMySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIRui Quelhas
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksDave Stokes
 
MySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQLMySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQLMiguel Araújo
 
NoSQL no MySQL 5.7
NoSQL no MySQL 5.7NoSQL no MySQL 5.7
NoSQL no MySQL 5.7MySQL Brasil
 

Similar to MySQL Code Tour: Session Establishment and Query Execution (20)

MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerProvisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack Manager
 
FOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component InfrastructureFOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component Infrastructure
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
Oracle Office Hours - Exposing REST services with APEX and ORDS
Oracle Office Hours - Exposing REST services with APEX and ORDSOracle Office Hours - Exposing REST services with APEX and ORDS
Oracle Office Hours - Exposing REST services with APEX and ORDS
 
Developer day v2
Developer day v2Developer day v2
Developer day v2
 
Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New Features
 
MySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL FabricMySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL Fabric
 
Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data
 
MySQL in OPC(Oracle Public Cloud)
MySQL in OPC(Oracle Public Cloud)MySQL in OPC(Oracle Public Cloud)
MySQL in OPC(Oracle Public Cloud)
 
Kscope Not Your Father's Enterprise Manager
Kscope Not Your Father's Enterprise ManagerKscope Not Your Father's Enterprise Manager
Kscope Not Your Father's Enterprise Manager
 
MySQL Quick Dive
MySQL Quick DiveMySQL Quick Dive
MySQL Quick Dive
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
 
MySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPIMySQL Connector/Node.js and the X DevAPI
MySQL Connector/Node.js and the X DevAPI
 
Marcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL WorkbenchMarcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL Workbench
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
 
MySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQLMySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQL
 
NoSQL no MySQL 5.7
NoSQL no MySQL 5.7NoSQL no MySQL 5.7
NoSQL no MySQL 5.7
 

More from Georgi Kodinov

2023 TurnovoConf MySQL Authentication.pptx
2023 TurnovoConf MySQL Authentication.pptx2023 TurnovoConf MySQL Authentication.pptx
2023 TurnovoConf MySQL Authentication.pptxGeorgi Kodinov
 
2022 TurnovoConf MySQL за начинаещи.pptx
2022 TurnovoConf MySQL за начинаещи.pptx2022 TurnovoConf MySQL за начинаещи.pptx
2022 TurnovoConf MySQL за начинаещи.pptxGeorgi Kodinov
 
OpenSUSE Conf 2020 MySQL Clone
OpenSUSE Conf 2020 MySQL CloneOpenSUSE Conf 2020 MySQL Clone
OpenSUSE Conf 2020 MySQL CloneGeorgi Kodinov
 
2020 pre fosdem mysql clone
2020 pre fosdem   mysql clone2020 pre fosdem   mysql clone
2020 pre fosdem mysql cloneGeorgi Kodinov
 
2019 BGOUG Autumn MySQL Clone
2019  BGOUG Autumn MySQL Clone2019  BGOUG Autumn MySQL Clone
2019 BGOUG Autumn MySQL CloneGeorgi Kodinov
 
2019 indit blackhat_honeypot your database server
2019 indit blackhat_honeypot your database server2019 indit blackhat_honeypot your database server
2019 indit blackhat_honeypot your database serverGeorgi Kodinov
 
PLe19 How To Instrument Your Code in performance_schema
PLe19 How To Instrument Your Code in performance_schemaPLe19 How To Instrument Your Code in performance_schema
PLe19 How To Instrument Your Code in performance_schemaGeorgi Kodinov
 
DevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 SecurityDevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 SecurityGeorgi Kodinov
 
DevTalks.ro 2019 MySQL Data Masking Talk
DevTalks.ro 2019 MySQL Data Masking TalkDevTalks.ro 2019 MySQL Data Masking Talk
DevTalks.ro 2019 MySQL Data Masking TalkGeorgi Kodinov
 
MySQL Enterprise Data Masking
MySQL Enterprise Data MaskingMySQL Enterprise Data Masking
MySQL Enterprise Data MaskingGeorgi Kodinov
 
Percona Live Europe 2018: What's New in MySQL 8.0 Security
Percona Live Europe 2018: What's New in MySQL 8.0 SecurityPercona Live Europe 2018: What's New in MySQL 8.0 Security
Percona Live Europe 2018: What's New in MySQL 8.0 SecurityGeorgi Kodinov
 
How to add stuff to MySQL
How to add stuff to MySQLHow to add stuff to MySQL
How to add stuff to MySQLGeorgi Kodinov
 
BGOUG17: Cloudy with a chance of MySQL
BGOUG17: Cloudy with a chance of MySQLBGOUG17: Cloudy with a chance of MySQL
BGOUG17: Cloudy with a chance of MySQLGeorgi Kodinov
 
Pl17: MySQL 8.0: security
Pl17: MySQL 8.0: securityPl17: MySQL 8.0: security
Pl17: MySQL 8.0: securityGeorgi Kodinov
 
Fosdem17 honeypot your database server
Fosdem17 honeypot your database serverFosdem17 honeypot your database server
Fosdem17 honeypot your database serverGeorgi Kodinov
 
2016 oSC MySQL Firewall
2016 oSC MySQL Firewall2016 oSC MySQL Firewall
2016 oSC MySQL FirewallGeorgi Kodinov
 
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7Georgi Kodinov
 
BGOUG 2014 Decrease Your MySQL Attack Surface
BGOUG 2014 Decrease Your MySQL Attack SurfaceBGOUG 2014 Decrease Your MySQL Attack Surface
BGOUG 2014 Decrease Your MySQL Attack SurfaceGeorgi Kodinov
 
BGOUG 2014: Developing Using MySQL
BGOUG 2014: Developing Using MySQLBGOUG 2014: Developing Using MySQL
BGOUG 2014: Developing Using MySQLGeorgi Kodinov
 

More from Georgi Kodinov (20)

2023 TurnovoConf MySQL Authentication.pptx
2023 TurnovoConf MySQL Authentication.pptx2023 TurnovoConf MySQL Authentication.pptx
2023 TurnovoConf MySQL Authentication.pptx
 
2022 TurnovoConf MySQL за начинаещи.pptx
2022 TurnovoConf MySQL за начинаещи.pptx2022 TurnovoConf MySQL за начинаещи.pptx
2022 TurnovoConf MySQL за начинаещи.pptx
 
OpenSUSE Conf 2020 MySQL Clone
OpenSUSE Conf 2020 MySQL CloneOpenSUSE Conf 2020 MySQL Clone
OpenSUSE Conf 2020 MySQL Clone
 
2020 pre fosdem mysql clone
2020 pre fosdem   mysql clone2020 pre fosdem   mysql clone
2020 pre fosdem mysql clone
 
2019 BGOUG Autumn MySQL Clone
2019  BGOUG Autumn MySQL Clone2019  BGOUG Autumn MySQL Clone
2019 BGOUG Autumn MySQL Clone
 
2019 indit blackhat_honeypot your database server
2019 indit blackhat_honeypot your database server2019 indit blackhat_honeypot your database server
2019 indit blackhat_honeypot your database server
 
PLe19 How To Instrument Your Code in performance_schema
PLe19 How To Instrument Your Code in performance_schemaPLe19 How To Instrument Your Code in performance_schema
PLe19 How To Instrument Your Code in performance_schema
 
DevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 SecurityDevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 Security
 
DevTalks.ro 2019 MySQL Data Masking Talk
DevTalks.ro 2019 MySQL Data Masking TalkDevTalks.ro 2019 MySQL Data Masking Talk
DevTalks.ro 2019 MySQL Data Masking Talk
 
MySQL Enterprise Data Masking
MySQL Enterprise Data MaskingMySQL Enterprise Data Masking
MySQL Enterprise Data Masking
 
Percona Live Europe 2018: What's New in MySQL 8.0 Security
Percona Live Europe 2018: What's New in MySQL 8.0 SecurityPercona Live Europe 2018: What's New in MySQL 8.0 Security
Percona Live Europe 2018: What's New in MySQL 8.0 Security
 
How to add stuff to MySQL
How to add stuff to MySQLHow to add stuff to MySQL
How to add stuff to MySQL
 
Pl18 saving bandwidth
Pl18 saving bandwidthPl18 saving bandwidth
Pl18 saving bandwidth
 
BGOUG17: Cloudy with a chance of MySQL
BGOUG17: Cloudy with a chance of MySQLBGOUG17: Cloudy with a chance of MySQL
BGOUG17: Cloudy with a chance of MySQL
 
Pl17: MySQL 8.0: security
Pl17: MySQL 8.0: securityPl17: MySQL 8.0: security
Pl17: MySQL 8.0: security
 
Fosdem17 honeypot your database server
Fosdem17 honeypot your database serverFosdem17 honeypot your database server
Fosdem17 honeypot your database server
 
2016 oSC MySQL Firewall
2016 oSC MySQL Firewall2016 oSC MySQL Firewall
2016 oSC MySQL Firewall
 
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
OpenSuse 2015: Secure Deployment Changes Coming in MySQL 5.7
 
BGOUG 2014 Decrease Your MySQL Attack Surface
BGOUG 2014 Decrease Your MySQL Attack SurfaceBGOUG 2014 Decrease Your MySQL Attack Surface
BGOUG 2014 Decrease Your MySQL Attack Surface
 
BGOUG 2014: Developing Using MySQL
BGOUG 2014: Developing Using MySQLBGOUG 2014: Developing Using MySQL
BGOUG 2014: Developing Using MySQL
 

Recently uploaded

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 

Recently uploaded (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 

MySQL Code Tour: Session Establishment and Query Execution

  • 1. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Guided tour on the MySQL Source Code Georgi Kodinov MySQL team lead Confidential – Oracle Internal/Restricted/Highly Restricted
  • 2. Copyright © 2016, 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. Confidential – Oracle Internal/Restricted/Highly Restricted 2
  • 3. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Agenda Confidential – Oracle Internal/Restricted/Highly Restricted 3 The directory layout of the codebase Session establishment and termination Query execution Add functionality to MySQL
  • 4. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Important directories in the codebase Directory Purpose sql/ Most of the server code storage/ Storage engines plugin/ Non-storage-engine plugins sql-common/ Code common between client and server libmysql/ Client library code libmysqld/ Embedded server client library glue code mysql-test/ Integral tests libservices/ The plugin services library, plugin part mysys*/ Portability library, utilities vio/ Network connection abstraction library client/ Client tools Confidential – Oracle Internal/Restricted/Highly Restricted 4
  • 5. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Session establishment and termination • Each transport has its own listening thread: *_conn_event_handler() – Runs Connection_acceptor::connection_event_loop() • Communicates via a Protocol class sub-class. Protocol_classic for the native MySQL protocol. Work in progress ! • Each session has a THD created. The THD is the session state. The THD is in a OS thread attribute (current_thd()). There can be nested THDs. • Connection_handler_manager class drives the threading model Confidential – Oracle Internal/Restricted/Highly Restricted 5
  • 6. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Session establishment and termination contd. • handle_connection() is the main worker thread execution function • check_connection() is where authentication happens • close_connection() is the function to close the connection. Called by both the worker thread or KILL Confidential – Oracle Internal/Restricted/Highly Restricted 6
  • 7. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Query execution at a glance • do_command() fetches and executes a command (RPC) • dispatch_command() has the command (RPC) id main switch() • The THD has the current command being executed • mysql_parse() parses and executes a single query. – Called in a loop for the COM_QUERY command • mysql_execute_command() is the execution part of mysql_parse() – Used to be a switch() over the SQL command id and call different C functions – Now in the process of being transformed to calls to Sql_cmd::execute(). – Lots of sub-classes for Sql_cmd. Confidential – Oracle Internal/Restricted/Highly Restricted 7
  • 8. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | The parser: work in progress • In older releases the parser produced the execution plan directly – Item class subclasses • Started adding a separate parse stage data structure – Parse_tree_node subclasses • Extra pass – Sql_cmd *PT_Statement::make_cmd() – Still called by the parser Confidential – Oracle Internal/Restricted/Highly Restricted 8
  • 9. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Query execution passes: handle_query() et al • “Open” all tables: open_tables_for_query () • Preparation: SELECT_LEX::prepare() and friends – Name resolution: setup_fields() et al – Some transformations, like flattening subqueries etc • Optimization: SELECT_LEX::optimize() and friends – Produces a JOIN object for each subquery level – Calls JOIN::optimize() to produce query execution plan • Execution: JOIN::exec() or st_select_lex_unit::execute() – Pumps result into a Query_result sub-class. Confidential – Oracle Internal/Restricted/Highly Restricted 9
  • 10. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Adding functionality to MySQL: Plugins Confidential – Oracle Internal/Restricted/Highly Restricted 10
  • 11. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Plugins overview • A plugin is: – An API that the server calls – init() and deinit() – A bunch of system variables – A bunch of status variables • A plugin does: – Initialize and de-initialize itself – Implement the API that the server will call – Call back into the server via the plugin services Confidential – Oracle Internal/Restricted/Highly Restricted 11
  • 12. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Plugins: Pros and Cons Pros Cons Clean versioned API to implement Can only implement a fixed set of APIs defined by the server Can be loaded and unloaded dynamically Can only interact with the server. Not other plugins Can use services to call back into the server Acquiring and releasing plugin handles by the server is expensive Can be built with the binary distro, no need for the server source Very poor set of plugin services Are versioned and can be reused across versions Linked with the server binary: can call into the server code without services The tree cmake files detect “foreign” plugin directories and compile them APIs cannot be related so APIs tend to be large (see e.g. the SE API : 200+ methods) Confidential – Oracle Internal/Restricted/Highly Restricted 12
  • 13. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Most notable plugin types • Storage engines • INFORMATION_SCHEMA tables • Daemon • Authentication • Audit • Keyring Confidential – Oracle Internal/Restricted/Highly Restricted 13
  • 14. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | How to write a plugin ? • Take an existing one and alter it • Plenty of examples – Live plugins – Test plugins • Put it in plugin/ or storage/ so it compiles Confidential – Oracle Internal/Restricted/Highly Restricted 14
  • 15. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Adding functionality to MySQL Plugin Services Confidential – Oracle Internal/Restricted/Highly Restricted 15
  • 16. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | What is a plugin service ? • The reverse of a plugin API • Allows plugins to call into the server • Version controlled • In essence a set function pointers in each plugin that the server fills in at INSTALL PLUGIN time • Header in include/mysql/service_*.h Confidential – Oracle Internal/Restricted/Highly Restricted 16
  • 17. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Please use the plugin services ! • Calling server code directly => a “dirty” plugin – No portability across versions – No guarantee to work with future versions • Plugin services are the reverse of Plugin APIs – Inlcude/mysql/service_*.h • We have some good ones in 5.7: – command_service_st : execute a RPC command – mysql_locking_service_st : interface to MDL locks – security_context_service_st : interface to the security context – srv_session_service_st : handle “sessions” inside the server Confidential – Oracle Internal/Restricted/Highly Restricted 17
  • 18. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Adding functionality to MySQL: UDFs Confidential – Oracle Internal/Restricted/Highly Restricted 18
  • 19. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | What are the UDFs • Can reside in external binaries • Can be loaded and unloaded • Can share binaries with plugins or other UDFs • Executed as single result or aggregate SQL functions • Easy to write, lots of examples Confidential – Oracle Internal/Restricted/Highly Restricted 19
  • 20. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | UDFs: Pros and Cons Pros Cons Easy to write Terrible for the DBA to administer Can share a binary with the plugins No global initialization and deinitialization Can be version safe No access to plugin services Somewhat limited data type range Only SQL functions, not commands to execute No THD context Confidential – Oracle Internal/Restricted/Highly Restricted 20