fix

update

fix spell
This commit is contained in:
feng lv 2021-02-02 06:06:17 +00:00
parent 4279c7da41
commit 0edf65c094
4 changed files with 122 additions and 27 deletions

View File

@ -420,7 +420,7 @@ class IColumn;
M(Bool, async_socket_for_remote, true, "Asynchronously read from socket executing remote query", 0) \
\
M(Bool, optimize_rewrite_sum_if_to_count_if, true, "Rewrite sumIf() and sum(if()) function countIf() function when logically equivalent", 0) \
M(UInt64, insert_shard_id, 0, "If non zero, when insert intoi a distributed table, the data will be inserted into the shard `insert_shard_id` synchronously. Possible values range from 1 to `shards_number` of corresponding distributed table", 0) \
M(UInt64, insert_shard_id, 0, "If non zero, when insert into a distributed table, the data will be inserted into the shard `insert_shard_id` synchronously. Possible values range from 1 to `shards_number` of corresponding distributed table", 0) \
/** Obsolete settings that do nothing but left for compatibility reasons. Remove each one after half a year of obsolescence. */ \
\
M(UInt64, max_memory_usage_for_all_queries, 0, "Obsolete. Will be removed after 2020-10-20", 0) \

View File

@ -60,7 +60,7 @@ namespace ErrorCodes
extern const int TIMEOUT_EXCEEDED;
}
static void writeBlockConvert(const BlockOutputStreamPtr & out, const Block & block, const size_t repeats)
static void writeBlockConvert(const BlockOutputStreamPtr & out, const Block & block, size_t repeats)
{
if (!blocksHaveEqualStructure(out->getHeader(), block))
{
@ -588,7 +588,7 @@ void DistributedBlockOutputStream::writeAsyncImpl(const Block & block, size_t sh
}
void DistributedBlockOutputStream::writeToLocal(const Block & block, const size_t repeats)
void DistributedBlockOutputStream::writeToLocal(const Block & block, size_t repeats)
{
/// Async insert does not support settings forwarding yet whereas sync one supports
InterpreterInsertQuery interp(query_ast, context);

View File

@ -1,40 +1,120 @@
0
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
0
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19

View File

@ -1,22 +1,37 @@
DROP TABLE IF EXISTS x;
DROP TABLE IF EXISTS x_dist;
DROP TABLE IF EXISTS y;
DROP TABLE IF EXISTS y_dist;
CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number;
CREATE TABLE y AS system.numbers ENGINE = MergeTree ORDER BY number;
CREATE TABLE x_dist as x ENGINE = Distributed('test_cluster_two_shards', currentDatabase(), x);
CREATE TABLE y_dist as y ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), y);
-- insert into first shard
INSERT INTO x_dist SELECT * FROM numbers(10) settings insert_shard_id = 1;
INSERT INTO y_dist SELECT * FROM numbers(10) settings insert_shard_id = 1;
SELECT * FROM x_dist ORDER by number;
SELECT * FROM y_dist ORDER by number;
-- insert into second shard
INSERT INTO x_dist SELECT * FROM numbers(10, 10) settings insert_shard_id = 2;
INSERT INTO y_dist SELECT * FROM numbers(10, 10) settings insert_shard_id = 2;
SELECT * FROM x_dist ORDER by number;
SELECT * FROM y_dist ORDER by number;
-- no sharding key
INSERT INTO x_dist SELECT * FROM numbers(10); -- { serverError 55 }
INSERT INTO y_dist SELECT * FROM numbers(10); -- { serverError 55 }
-- invalid shard id
INSERT INTO x_dist SELECT * FROM numbers(10) settings insert_shard_id = 3; -- { serverError 1003 }
SELECT * FROM remote('127.0.0.1', currentDatabase(), x);
SELECT * FROM remote('127.0.0.2', currentDatabase(), x);
SELECT * FROM x_dist ORDER by number;
INSERT INTO y_dist SELECT * FROM numbers(10) settings insert_shard_id = 3; -- { serverError 1003 }
DROP TABLE x;
DROP TABLE x_dist;
DROP TABLE y;
DROP TABLE y_dist;