use of com.alibaba.cobar.config.model.SchemaConfig in project cobar by alibaba.
the class NoShardingSpace method testDefaultSpace.
public void testDefaultSpace() throws SQLNonTransientException {
SchemaConfig schema = this.schema;
String stmt = "insert into offer (member_id, gmt_create) values ('1','2001-09-13 20:20:33')";
for (int i = 0; i < 1000000; i++) {
ServerRouter.route(schema, stmt, null, null);
}
}
use of com.alibaba.cobar.config.model.SchemaConfig in project cobar by alibaba.
the class ShardingDefaultSpace method testDefaultSpace.
/**
* 路由到defaultSpace的性能测试
*/
public void testDefaultSpace() throws SQLNonTransientException {
SchemaConfig schema = this.getSchema();
String sql = "insert into xoffer (member_id, gmt_create) values ('1','2001-09-13 20:20:33')";
for (int i = 0; i < 1000000; i++) {
ServerRouter.route(schema, sql, null, null);
}
}
use of com.alibaba.cobar.config.model.SchemaConfig in project cobar by alibaba.
the class ShardingMultiTableSpace method testTableSpace.
/**
* 路由到tableSpace的性能测试
*
* @throws SQLNonTransientException
*/
public void testTableSpace() throws SQLNonTransientException {
SchemaConfig schema = getSchema();
String sql = "select id,member_id,gmt_create from offer where member_id in ('1','22','333','1124','4525')";
for (int i = 0; i < 100000; i++) {
ServerRouter.route(schema, sql, null, null);
}
}
use of com.alibaba.cobar.config.model.SchemaConfig in project cobar by alibaba.
the class ShardingTableSpaceMain method testTableSpace.
/**
* 路由到tableSpace的性能测试
*
* @throws SQLNonTransientException
*/
public void testTableSpace() throws SQLNonTransientException {
SchemaConfig schema = getSchema();
String sql = "insert into offer (member_id, gmt_create) values ('1','2001-09-13 20:20:33')";
for (int i = 0; i < 1000000; i++) {
ServerRouter.route(schema, sql, null, null);
}
}
use of com.alibaba.cobar.config.model.SchemaConfig in project cobar by alibaba.
the class ShowDataNode method execute.
public static void execute(ManagerConnection c, String name) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
// write eof
buffer = eof.write(buffer, c);
// write rows
byte packetId = eof.packetId;
CobarConfig conf = CobarServer.getInstance().getConfig();
Map<String, MySQLDataNode> dataNodes = conf.getDataNodes();
List<String> keys = new ArrayList<String>();
if (StringUtil.isEmpty(name)) {
keys.addAll(dataNodes.keySet());
} else {
SchemaConfig sc = conf.getSchemas().get(name);
if (null != sc) {
keys.addAll(sc.getAllDataNodes());
}
}
Collections.sort(keys, new Comparators<String>());
for (String key : keys) {
RowDataPacket row = getRow(dataNodes.get(key), c.getCharset());
row.packetId = ++packetId;
buffer = row.write(buffer, c);
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
// post write
c.write(buffer);
}
Aggregations