Skip to content

Commit

Permalink
Merge pull request actiontech#4 from actiontech/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
funnyAnt authored Apr 9, 2019
2 parents c3e2929 + 77833e0 commit 5b4b8ca
Show file tree
Hide file tree
Showing 115 changed files with 15,452 additions and 1,634 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![GitHub release](https://img.shields.io/github/release/actiontech/dble.svg)](https://github.com/actiontech/dble/releases)
<img src="https://travis-ci.org/actiontech/dble.svg?branch=master">

dble (pronouced "double", less bug and no "ou") is maintain by [ActionTech](https://opensource.actionsky.com).
dble (pronouced "double", less bug and no "ou") is maintained by [ActionTech](https://opensource.actionsky.com).

## What is dble?

Expand All @@ -21,7 +21,7 @@ As your business grows, you can use dble to replace the origin single MySQL inst
Use dble as same as MySQL. You can replace MySQL with dble to power your application without changing a single line of code in most cases.

- __High availability__
dble server can used as clustered, business will not suffer with single node fail.
dble server can be used as clustered, business will not suffer from single node fail.

- __SQL Support__
Support(some in Roadmap) SQL 92 standard and MySQL dialect. We support complex SQL query like group by, order by, distinct, join ,union, sub-query(in Roadmap) and so on.
Expand All @@ -30,13 +30,13 @@ Support(some in Roadmap) SQL 92 standard and MySQL dialect. We support complex S
Optimize the complex query, including, without limitation, Global-table join sharding-table, ER-relation tables, Sub-Queries, Simplifying select items, and the like.

- __Distributed Transaction__
Support Distributed Transaction using two-phase commit. You can choose normal mode for performance or XA mode for data safe, of course, the XA mode dependent on MySQL-5.7's XA Transaction, MySQL node's high availability and data reliability of disk.
Support Distributed Transaction using two-phase commit. You can choose normal mode for performance or XA mode for data safety, of course, the XA mode dependent on MySQL-5.7's XA Transaction, MySQL node's high availability and data reliability of disk.


## History
dble is based on [MyCat](https://github.com/MyCATApache/Mycat-Server). Firstly we have to thank MyCat's contributors.
dble is based on [MyCat](https://github.com/MyCATApache/Mycat-Server). First of all, thanks to the contributors from MyCat.

For us, focus on MySQL is a better choice. So we cancelled the support for other databases, deeply improved/optimized its behavior on compatibility, complex query and distributed transaction. And of course, fixed lots of bugs.
For us, focusing on MySQL is a better choice. So we cancelled the support for other databases, deeply improved/optimized its behavior on compatibility, complex query and distributed transaction. And of course, fixed lots of bugs.

For more details, see [Roadmap](./docs/ROADMAP.md) and [Issues](https://github.com/actiontech/dble/issues) .

Expand Down Expand Up @@ -69,14 +69,14 @@ for details on submitting patches and the contribution workflow.

* IRC: [![Visit our IRC channel](https://kiwiirc.com/buttons/irc.freenode.net/dble.png)](https://kiwiirc.com/client/irc.freenode.net/?nick=user|?&theme=cli#dble)
* QQ group: 669663113
* [If you use DBLE, please let us know.](https://wj.qq.com/s/2291106/09f4)
* [If you're using DBLE, please let us know.](https://wj.qq.com/s/2291106/09f4)
* wechat subscription QR code

![dble](./docs/QR_code.png)

## Contact us

Dble has enterprise support plan, you may contact our sales team:
Dble has enterprise support plans, you may contact our sales team:
* Global Sales: 400-820-6580
* North China: 86-13718877200, Mr.Wang
* South China: 86-18503063188, Mr.Cao
Expand Down
2 changes: 1 addition & 1 deletion dble_checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@

<module name="UncommentedMain">
<property name="excludedClasses"
value="(com\.actiontech\.dble\.DbleStartup)|(com\.actiontech\.dble\.config\.loader\.zkprocess\.xmltozk\.XmltoZkMain)|(com\.actiontech\.dble\.util\.DecryptUtil)|(com\.actiontech\.dble\.util\.dataMigrator\.DataMigrator)|(com\.actiontech\.dble\.config\.loader\.ucoreprocess\.XmltoUcore)"/>
value="(com\.actiontech\.dble\.DbleStartup)|(com\.actiontech\.dble\.config\.loader\.zkprocess\.xmltozk\.XmltoZkMain)|(com\.actiontech\.dble\.util\.DecryptUtil)|(com\.actiontech\.dble\.util\.dataMigrator\.DataMigrator)|(com\.actiontech\.dble\.cluster\.xmltoKv\.XmltoCluster)"/>
</module>
<module name="Indentation">
<property name="arrayInitIndent" value="8"/>
Expand Down
3 changes: 3 additions & 0 deletions dble_checkstyle_suppression.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<suppress checks=".*" files="StructureMeta.java"/>
<suppress checks=".*" files="UcoreInterface.java"/>
<suppress checks=".*" files="UcoreGrpc.java"/>
<suppress checks=".*" files="AlertBlockQueue.java"/>
<suppress checks=".*" files="UshardInterface.java"/>
<suppress checks=".*" files="DbleClusterGrpc.java"/>
<suppress checks="Indentation" files="MyTime.java"/>
<suppress checks="CyclomaticComplexity" files="MyTime.java"/>
<suppress checks="CyclomaticComplexity" files="TimSort.java"/>
Expand Down
3 changes: 3 additions & 0 deletions findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<Match>
<Class name="com.actiontech.dble.meta.protocol.StructureMeta$TableMeta$Builder"/>
</Match>
<Match>
<Package name="com.actiontech.dble.cluster.impl.ushard"/>
</Match>
<Match>
<Package name="com.actiontech.dble.alarm"/>
</Match>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>[8.18,)</version>
<version>8.18</version>
</dependency>
</dependencies>
<configuration>
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/com/actiontech/dble/DbleServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import com.actiontech.dble.buffer.BufferPool;
import com.actiontech.dble.buffer.DirectByteBufferPool;
import com.actiontech.dble.cache.CacheService;
import com.actiontech.dble.cluster.ClusterGeneralConfig;
import com.actiontech.dble.cluster.ClusterParamCfg;
import com.actiontech.dble.config.ServerConfig;
import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig;
import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig;
import com.actiontech.dble.config.model.SchemaConfig;
import com.actiontech.dble.config.model.SystemConfig;
Expand All @@ -36,6 +36,7 @@
import com.actiontech.dble.route.RouteService;
import com.actiontech.dble.route.sequence.handler.*;
import com.actiontech.dble.server.ServerConnectionFactory;
import com.actiontech.dble.server.status.AlertManager;
import com.actiontech.dble.server.status.OnlineLockStatus;
import com.actiontech.dble.server.status.SlowQueryLog;
import com.actiontech.dble.server.util.GlobalTableUtil;
Expand Down Expand Up @@ -75,6 +76,7 @@ public final class DbleServer {
private static final long DEFAULT_OLD_CONNECTION_CLEAR_PERIOD = 5 * 1000L;

private static final DbleServer INSTANCE = new DbleServer();

private static final Logger LOGGER = LoggerFactory.getLogger("Server");
private AtomicBoolean backupLocked;

Expand Down Expand Up @@ -171,8 +173,8 @@ public String genXaTxId() {
id.append("'" + NAME + "Server.");
if (isUseZK()) {
id.append(ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID));
} else if (isUseUcore()) {
id.append(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID));
} else if (isUseGeneralCluster()) {
id.append(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID));
} else {
id.append(this.getConfig().getSystem().getServerNodeId());

Expand Down Expand Up @@ -366,6 +368,7 @@ public void startup() throws IOException {
if (system.getEnableAlert() == 1) {
AlertUtil.switchAlert(true);
}
AlertManager.getInstance().startAlert();
if (aio) {
int processorCount = frontProcessorCount + backendProcessorCount;
LOGGER.info("using aio network handler ");
Expand Down Expand Up @@ -426,7 +429,7 @@ public Thread newThread(Runnable r) {

userManager.initForLatest(config.getUsers(), system.getMaxCon());

if (isUseUcore()) {
if (isUseGeneralCluster()) {
try {
OnlineLockStatus.getInstance().metaUcoreInit(true);
} catch (Exception e) {
Expand Down Expand Up @@ -694,11 +697,12 @@ private boolean isUseZkSwitch() {
}

public boolean isUseZK() {
return ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) != null;
return ClusterGeneralConfig.getInstance().isUseCluster() && ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) != null;
}

public boolean isUseUcore() {
return UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) != null;
public boolean isUseGeneralCluster() {
return ClusterGeneralConfig.getInstance().isUseCluster() &&
ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) == null;
}

public TxnLogProcessor getTxnLogProcessor() {
Expand Down Expand Up @@ -1081,4 +1085,5 @@ public FrontendUserManager getUserManager() {
return userManager;
}


}
19 changes: 14 additions & 5 deletions src/main/java/com/actiontech/dble/alarm/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@

package com.actiontech.dble.alarm;

import java.util.Map;
import com.actiontech.dble.cluster.bean.ClusterAlertBean;


public interface Alert {
enum AlertLevel {
NOTICE, WARN, CRITICAL
}
void alertSelf(String code, AlertLevel level, String desc, Map<String, String> labels);
void alert(String code, AlertLevel level, String desc, String alertComponentType, String alertComponentId, Map<String, String> labels);
boolean alertResolve(String code, AlertLevel level, String alertComponentType, String alertComponentId, Map<String, String> labels);
boolean alertSelfResolve(String code, AlertLevel level, Map<String, String> labels);

enum AlertType {
ALERT, ALERT_RESOLVE, ALERT_SELF, ALERT_SELF_RESOLVE
}

void alertSelf(ClusterAlertBean bean);

void alert(ClusterAlertBean bean);

boolean alertResolve(ClusterAlertBean bean);

boolean alertSelfResolve(ClusterAlertBean bean);
}
Loading

0 comments on commit 5b4b8ca

Please sign in to comment.