Showing entries 351 to 360 of 1038
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: Insight for DBAs (reset)
MySQL Escaping on the Client-Side With Go

Day-to-day database operation requires, from an administrator, deep knowledge of db internals and security issues, in particular things like SQL injections. In order to prevent such kind of an attack, we have included go-sql-driver into our code for secure placeholder escaping.

Unfortunately, not all cases are secured by the driver.

In case we are using the standard driver for working with MySQL, if we need to pass a variable to the database query, we use a placeholder “?” in order for the server to understand that it needs to process the incoming variable to avoid injection. It works fine with just regular SELECT/INSERT/UPDATE statements, but, unfortunately, MySQL server is not able to process all types of queries.

For example:

db.Exec("CREATE USER ?@? IDENTIFIED BY ?", name, host, pass)

This query will return an error from the …

[Read more]
SQL Query Formatting Tools Used At Percona

Percona engineers often need to analyze and review complex SQL database queries. Good formatting can make these SQL queries much easier to understand and work with. Without clear formatting, queries can become confusing and hard to debug.

Online query formatting services provide one set of solutions. Examples are Code Beautify, FreeFormatter, and sqlformat.org. However, many users are not comfortable sharing their queries with third-party services, especially if your SQL code contains confidential information.

This article examines alternatives to online tools for SQL query formatting tools that have been successfully used by Percona engineers. These solutions come in different types:

  1. Plug-ins to your code editor or …
[Read more]
Backup and Restore in Percona Kubernetes Operator for Percona XtraDB Cluster

Database backups are a fundamental requirement in almost every implementation, no matter the size of the company or the nature of the application. Taking a backup should be a simple task that can be automated to ensure it’s done consistently and on schedule. Percona has an enterprise-grade backup tool, Percona XtraBackup, that can be used to accomplish these tasks. Percona also has a Percona Kubernetes Operator for Percona XtraDB Cluster (PXC Operator), which has Percona XtraBackup built into it. Percona XtraBackup has the ability for both automated and on-demand backups. Today we will explore taking backups and restoring these backups using the PXC Operator deployed …

[Read more]
Tuning MySQL/InnoDB Flushing for a Write-Intensive Workload

In this post, the third in a series explaining the internals of InnoDB flushing, we’ll focus on tuning. (Others in the series can be seen at InnoDB Flushing in Action for Percona Server for MySQL and Give Love to Your SSDs – Reduce innodb_io_capacity_max!)

Understanding the tuning process is very important since we don’t want to make things worse or burn our SSDs. We proceed with one section per variable or closely-related variables. The variables are also grouped in sections based on the version of MySQL or Percona Server for MySQL where they are valid. A given variable may be present more …

[Read more]
Multithreaded ALTER TABLE with pt-online-schema-change and myloader

pt-online-schema-change emulates the way that MySQL alters tables internally, but it works on a copy of the table you wish to alter. It executes INSERT statements to import the data, that runs in a single connection to fill the new table. In this repository, there is a script called myloader_pt-osc.sh that uses myloader to execute parallel INSERTs, instead of using pt-online-schema-change internal tooling, but it also uses a patched version of pt-online-schema-change.

Patch pt-online-schema-change

There are 2 changes that we needed to perform on pt-online-schema-change:

1- Be able to stop the execution after the copy of the table is created
2- Tell pt-online-schema-change that no data needs to be imported

We are …

[Read more]
Introduction to Percona Kubernetes Operator for Percona XtraDB Cluster

As a Solutions Engineer at Percona, one of my responsibilities is to support our customers as they investigate new and emerging technologies. This affords me the opportunity to speak to many current and new customers who partner with Percona.

The topic of Kubernetes is becoming more popular as companies are investigating and adopting this technology. The issue most companies are encountering is having a stateful database that doesn’t fall victim to an environment tuned for ephemeral workloads. This obviously introduces a level of complexity as to how to run a stateful database in an inherently stateless world, as databases are not natively designed for that.

To make your life easier, as a part of the Percona Cloud-Native Autonomous Database Initiative, our engineering teams have built a …

[Read more]
Prepare MySQL for a Safe Shutdown

In Percona’s Managed Services, we start up and shut down MySQL servers all the time.  Over the years, we’ve seen various issues occur due to the way servers are shut down.  No matter if it is a situation where unexpected errors appear in the log or you’re stuck waiting for hours for a server to finishing shut down… Here are some steps we can take to minimize any trouble and prepare MySQL for shutdown.

This list of “super safe practices” was born from lessons we’ve learned in a wide variety of MySQL environments.

1. Stop Replication.

Under some (rare) circumstances, a slave may try to startup in the incorrect position. To help minimize this risk, stop the IO thread first so it’s not receiving new events.

STOP SLAVE IO_THREAD;

Wait for the SQL thread to apply all events, then stop it too.

SHOW SLAVE STATUS\G
STOP SLAVE SQL_THREAD;

This puts both of the …

[Read more]
Setting up an InnoDB Cluster With a Few Lines of Code

In this day and age, large enterprise companies make use of Ansible, Puppet, or Chef to provision MySQL servers, be it replica sets or clusters. This eases the burden of deployment and workflow management.

However, for some smaller companies, the learning curve hampers the immediate adoption of automation software. This is where the MySQL Shell helps, by allowing you to deploy an N-node InnoDB Cluster or ReplicaSet in less than 60 lines of code.

The Requirements

  • Percona Server for MySQL version 8.0.17 or later, preferable version 8.0.19, each node started as standalone servers
  • Percona MySQL Shell 8.0 or equivalent upstream version
  • MySQL root user and password or equivalent user with grant option
  • Hostname configured on each node, can be done with …
[Read more]
Testing Percona XtraDB Cluster 8.0 with DBdeployer

In the light of support for Percona XtraDB Cluster (PXC), the DBdeployer anniversary, and the newly released Percona XtraDB Cluster 8.0, I’m happy to announce that Giuseppe Maxia has recently updated DBdeployer to support Percona XtraDB Cluster 8.0.

We at Percona, with my colleague Ramesh Sivaraman, have tested and deployed Percona XtraDB Cluster (PXC) 8.0.18  successfully using DBdeployer.

What is DBdeployer and How Do You …

[Read more]
[Warning] InnoDB: Difficult to Find Free Blocks in the Buffer Pool

A couple of weeks ago, one of our customers reached us asking about the WARNING messages in their MySQL error log. After a while, there were a few more requests from some other customers asking whether to worry about these messages or not. In this post, I am going to write about the condition at which this WARNING message is written into the log and will explain some of the fundamentals behind the scene.

Look at the warningmber message which appears in the MySQL error log. It says it’s difficult to find a free block in the buffer pool and searched through the pool in a loop for 336 times. This is something weird to imagine; why would it have to go in a loop so many times? Let’s try to understand this.

[Warning] InnoDB: Difficult to find free blocks in the buffer pool (336 search iterations)! 0 failed attempts to flush a page! Consider increasing the buffer pool size. It is also possible that in your Unix version …

[Read more]
Showing entries 351 to 360 of 1038
« 10 Newer Entries | 10 Older Entries »