Science and technology

5 new enhancements in Apache ShardingSphere

Apache ShardingSphere, a robust distributed database, lately launched a serious replace to optimize and improve its options, efficiency, testing, documentation, and examples. In brief, the challenge continues to work onerous at growth to make it simpler so that you can handle your group’s information.

1. SQL audit for information sharding

The downside: When a consumer executes an SQL question with out the sharding function in large-scale information sharding situations, the SQL question is routed to the underlying database for execution. As a outcome, many database connections are occupied, and companies are severely affected by a timeout or different points. Worse nonetheless, ought to the consumer carry out an UPDATE/DELETE operation, a considerable amount of information could also be incorrectly up to date or deleted.

ShardingSphere’s answer: As of model 5.2.0, ShardingSphere offers the SQL audit for information sharding function and permits customers to configure audit methods. The technique specifies a number of audit algorithms, and customers can determine whether or not audit guidelines must be disabled. SQL execution is strictly prohibited if any audit algorithm fails to move.

Here’s the configuration of an SQL audit for information sharding:

guidelines:
- !SHARDING
  tables:
    t_order:
      actualDataNodes: ds_${0..1}.t_order_${0..1}
      tableStrategy:
        normal:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_inline
      auditStrategy:
        auditorNames:
          - sharding_key_required_auditor
        allowHintDisable: true
  defaultAuditStrategy:
    auditorNames:
      - sharding_key_required_auditor
    allowHintDisable: true  auditors:
    sharding_key_required_auditor:
      kind: DML_SHARDING_CONDITIONS

Given complicated enterprise situations, this new function means that you can dynamically disable the audit algorithm by utilizing SQL hints in order that partial enterprise SQL operations will be executed.

ShardingSphere has a built-in DML disables full-route audit algorithm. You can even implement a ShardingAuditAlgorithm interface to realize superior SQL audit features:

/* ShardingSphere trace: disableAuditNames=sharding_key_required_auditor */ SELECT * FROM t_order;

2. SQL execution course of administration

The ShardingSphere MySQL database offers a SHOW PROCESSLIST assertion, permitting you to view the at present operating thread. You can kill the thread with the KILL assertion for SQL that takes too lengthy to be briefly terminated.

(Duan Zhengqiang, CC BY-SA 4.0)

The SHOW PROCESSLIST and KILL statements are extensively utilized in each day operation and upkeep administration. To improve your potential to handle ShardingSphere, model 5.2.0 helps the MySQL SHOW PROCESSLIST and KILL statements. When you execute a DDL/DML assertion by ShardingSphere, ShardingSphere mechanically generates a singular UUID identifier and shops the SQL execution data in every occasion.

When you execute the SHOW PROCESSLIST assertion, ShardingSphere processes the SQL execution data based mostly on the present working mode.

If the present mode is cluster mode, ShardingSphere collects and synchronizes the SQL execution data of every compute node by the governance middle after which returns the abstract to the consumer. If the present mode is the standalone mode, ShardingSphere solely returns SQL execution data within the present compute node.

You get to find out whether or not to execute the KILL assertion based mostly on the outcome returned by SHOW PROCESSLIST, and ShardingSphere cancels the SQL in execution based mostly on the ID within the KILL assertion.

3. Shardingsphere-on-cloud

Shardingsphere-on-cloud is a challenge of Apache ShardingSphere offering cloud-oriented options. Version 0.1.0 has been launched, and it has been formally voted as a sub-project of Apache ShardingSphere.

Shardinsphere-on-cloud will proceed releasing configuration templates, deployment scripts, and different automation instruments for ShardingSphere on the cloud.

It may also polish the engineering practices when it comes to excessive availability, information migration, observability, shadow DB, safety, and audit, optimize the supply mode of Helm Charts, and proceed to reinforce its cloud-native administration capabilities by Kubernetes Operator. There are already introductory points within the challenge repository to assist these excited about getting Go, Database, and Cloud up and operating rapidly.

4. Access port

In model 5.2.0, ShardingSphere-Proxy can monitor specified IP addresses and combine openGauss database drivers by default. ShardingSphere-JDBC helps c3p0 information sources, and a Connection.prepareStatement can specify the columns.

5. Distributed transaction

The authentic logical database-level transaction supervisor has been adjusted to a world supervisor, supporting distributed transactions throughout a number of logical databases. XA transactions at the moment are mechanically managed by ShardingSphere, which removes the XA assertion’s potential to manage distributed transactions.

Use ShardingSphere for distributed information

ShardingSphere helps a number of databases, and every enchancment takes extra work off your arms. The institution of the shardingsphere-on-cloud sub-project exhibits ShardingSphere’s dedication to being cloud-native. The better ShardingSphere neighborhood welcomes anybody excited about Go, databases, and the cloud to hitch the shardingsphere-on-cloud sub-project!


The article was first revealed on Medium.com and has been republished with permission.

Most Popular

To Top