Commit Graph

13073 Commits

Author SHA1 Message Date
a52104fe40 [Bug] Fix bug that DROP SCHEMA will forcibly database (#6729) 2021-09-24 10:35:40 +08:00
bdc8c98008 [Outfile] Support hdfs in select outfile clause (#6644)
Support hdfs in select outfile clause without broker.
This PR implement a HDFS writer in BE which is used to write HDFS file directly without using broker.
Also the hdfs outfile clause syntax check has been added in FE.
The syntax:
```
select * from xx into outfile "hdfs://user/outfile_" format as csv
properties ("hdfs.fs.dafultFS" = "xxx", "hdfs.hdfs_user" = "xxx");
```
Note that all hdfs configurations need to carry a prefix `hdfs.`.
2021-09-24 10:07:11 +08:00
840a7ef3a8 Fix a typo (#6688)
Fix a typo
2021-09-23 09:44:46 +08:00
5c45e26644 Fixed zone map init error for string type (#6667)
Fixed the problem that the StringValue memory generated by Expr may be released before use
Fixed from_string for String type may overflow
2021-09-23 09:44:22 +08:00
521fb15a9b [Bug] Fix some memory bugs (#6699)
1. Fix a memory leak in `collect_iterator.cpp` (Fix #6700)
2. Add a new BE config `max_segment_num_per_rowset` to limit the num of segment in new rowset.(Fix #6701)
3. Make the error msg of stream load more friendly.
2021-09-22 12:30:14 +08:00
fee8e6afc5 [Bug] Fix some bugs (#6665)
1.Fix a potential BE coredump of sending batch when loading data. (Fix [Bug] BE crash when loading data #6656)
2.Fix a potential BE coredump when doing schema change. (Fix [Bug] BE crash when doing alter task #6657)
3.Optimize the metric of base_compaction_request_failed.
4.Add Order column in show tablet result. (Fix [Feature] Add order column in SHOW TABLET stmt result #6658)
5.Fix bug that tablet repair slot not being released. (Fix [Bug] Tablet scheduler stop working #6659)
6.Fix bug that REPLICA_MISSING error can not be handled. (Fix [Bug] REPLICA_MISSING error can not be handled. #6660)
7.Modify column name of SHOW PROC "/cluster_balance/cluster_load_stat"
8.Optimize the result of SHOW PROC "/statistic" to show COLOCATE_MISMATCH tablets (Fix [Feature] the health status of colocate table's tablet is not shown in show proc statistic #6663)
9.Fix bug that show load where state='pending' can not be executed. (Fix [Bug] show load where state='pending' can not be executed. #6664)
2021-09-17 10:11:37 +08:00
95cdb7cc0c [Enhance] [Binlog] Reduce thread number of SyncJob to save resources (#6418)
This commit is going to reduce thread number of SyncJob .
1、Submit send task to thread pool to send data.
2、Submit eof task to thread pool to block and wake up client to commit transactions.
3、Use SerialExecutorService to ensure correct order of sent data in every channel.

Besides,some bugs have been fixed in this commit
1、Failed to resume syncJob.
2、Failed to do sync data when set multiple tables in a syncJob.
3、In a cluster with multiple Fe, master may hang up after creating syncJob.
2021-09-17 10:01:27 +08:00
085942b30f [Doc] Download hashes and signatures use "downloads.apache.org" (#6677)
The latest release should use https://www.apache.org/dyn/closer.lua <https://www.apache.org/dyn/closer.lua>
The latest hashes and signatures should use https://downloads.apache.org/
The old release should use http://archive.apache.org/dist
2021-09-16 18:09:08 +08:00
dd8a1da159 [Performance] Improve performance for showing proc statistic(#6567)
Co-authored-by: 迟成 <chicheng@meituan.com>
2021-09-16 10:43:57 +08:00
e45b487504 [PLUGIN] optimize output msg when auditlog plugin error (#6653)
* Optimize output msg when auditlog plugin error
2021-09-16 10:29:47 +08:00
67472f3518 [Meta][Refactor] Use lambda expressions to save Image (#6646)
The original code in MetaWriter is tedious,So I try use lambda expressions to make the code more clean.
2021-09-16 10:28:40 +08:00
7f5631717e [Bug] Fix the bug of generating sql_key in SqlCache (#6668)
The current SqlCache sql_key is generated by taking the md5 value of selectStmt.toSql(), but selectStmt.toSql() is spliced through the operator tree, and sometimes some specific parameters cannot be displayed, resulting in sql hits with different parameters The same cache is used, and the query results are inconsistent with expectations.

For example, our user has a sql with more than 300 rows, which contains a lot of parameters, including partitions. But the result of selectStmt.toSql() is:

SELECT `tb`.`type` AS `type`, `tb`.`name` AS `name`, `tb`.`name1` AS `name1`, `tb`.`name2` AS `name2`, `tb`.`name3` AS `name3`
FROM (
  SELECT 3 AS `type`, `cc`.`name` AS `name`, `cc`.`name1` AS `name1`
    , coalesce(`bb`.`name`, '请联系您的品牌业务经理进行咨询。') AS `name2`, `bb`.`name1` AS `name3`
  FROM `cc`
    LEFT JOIN `bb` ON `cc`.`id` = `bb`.`id1`
  UNION ALL
  SELECT `dd`.`type` AS `type`, `dd`.`name` AS `name`, `dd`.`name1` AS `name1`, `dd`.`name2` AS `name2`, `dd`.`name3` AS `name3`
  FROM `dd`
  UNION ALL
  SELECT `ee`.`type` AS `type`, `ee`.`name` AS `name`, `ee`.`name1` AS `name1`, `ee`.`name2` AS `name2`, `ee`.`name3` AS `name3`
  FROM `ee`
) tb
LIMIT 10
In this way, the user specified different partitions for query, and the same cache was queried, which was inconsistent with the expected result. Therefore, it is recommended to use originStmt instead of selectStmt.toSql() to generate sql_key.
2021-09-16 10:26:15 +08:00
7ee39743de [Doc] Fix tabletScore expression in be_config.md (#6638)
Co-authored-by: Geoffrey <gaofeng01@rd.netease.com>
2021-09-16 10:24:46 +08:00
332ba4cded [config] use thrift_rpc_timeout_ms config replace hard code value (#6637)
use thrift_rpc_timeout_ms config to replace hard code value
2021-09-16 10:22:57 +08:00
61c9d11fdb support change column type from decimal to string (#6643) 2021-09-14 15:56:44 +08:00
020282e885 [Bug] Fix aes_decrypt to handle null input correctly. (#6636) 2021-09-14 11:19:55 +08:00
225bdb1fda [Bug] fix replace function bug (#6605)
* fix replace function bug

* fix replace docs
2021-09-14 09:59:13 +08:00
6d94b7bde2 Do not print exception in fe.out (#6626) 2021-09-14 09:58:55 +08:00
3812cbf117 fix librdkafka depends on high version of glibc (#6634) 2021-09-14 09:58:23 +08:00
6c02ca5a8c fix fe UT failed due to rename string to text (#6627) 2021-09-13 13:39:50 +08:00
794d4e7ace fix insert null as string type may coredump (#6615) 2021-09-13 12:30:34 +08:00
b3ae607fe9 [Sprak-Doris-Connector] support boolean data type (#6601)
1. Support boolean data type for spark-doris-connector because Doris has previously supported the boolean data type
2. Bug-Fix for the Doris BE core when spark request data from be
2021-09-12 10:07:23 +08:00
2c58724c84 Support create table as select (#6102) 2021-09-10 09:54:44 +08:00
a4fbad3736 [BUG][Profile] Fixed the problem that BE's profile could not add chil… (#6268)
* [BUG][Profile] Fixed the problem that BE's profile could not add child profile in the specified correct location

bug:
    runtime_profile()->add_child(build_phase_profile, false, nullptr);
    child profile will add to second location

* Update runtime_profile.cpp
2021-09-10 09:53:51 +08:00
b2f1e21a3b [Bugs] Fix some bugs (#6586)
* fix regex lazy

* fix result file core

* fix dynamic partition replica and table name length bug

* fix replicanum 0

* fix delete bug

* renew proxy

Co-authored-by: morningman <chenmingyu@baidu.com>
2021-09-10 09:53:30 +08:00
5d3c7fbd80 add doc for storage_root_path (#6593)
* add doc for storage_root_path

* Maintain consistency in both Chinese and English documents

Co-authored-by: Geoffrey <gaofeng01@rd.netease.com>
2021-09-10 09:52:58 +08:00
39bb669dcb [BUG] fix extra memory copy in bitmap value (#6599) 2021-09-10 09:52:41 +08:00
4f744333c2 fix some core in local test: (#6594)
1. insert very large string value may coredump
    2. some analitic functiuon and agg function result may be incorrect
    3. string compare may be coredump when string type is too large
    4. string type in delete condition can not process correctly
    5. add text/blob as alias of string to compitable with mysql
    6. fix string type min/max agg may  process incorrectly
2021-09-10 09:52:03 +08:00
30b54cae23 [bug] Fix dataTables bootstrap js version differ. (#6591)
Co-authored-by: 潘利杰 <panlijie@inspur.com>
2021-09-09 14:26:11 +08:00
b3f02955d3 [Doc] modify irregular documents (like/ not like/ regexp.md) (#6572) 2021-09-09 14:11:37 +08:00
de66312a1a [Job Clean] Sort out the cleanup logic of historical jobs (#6553)
There are many historical job records in Doris, such as load jobs, alter jobs, export jobs and so on.

These historical jobs are generally cleaned up periodically by the cleanup thread, to avoid taking too much memory.

This PR reorganized the cleanup logic of historical jobs and optimized the cleanup logic of some historical jobs
to reduce the memory usage of historical jobs.

The following FE configuration items are related to historical job cleaning:

1. label_keep_max_second

    Used to determine whether LoadJob, LoadJobV2, RoutineLoadJob or TransactionState are expired.

2. streaming_label_keep_max_second

    Used to determine whether InsertJob, DeleteJob  or TransactionState are expired.
    Different from label_keep_max_second, this config is used to clean up these frequently submitted jobs or load transactions.

3. history_job_keep_max_second

    Used to determine whether AlterJob, ExportJob are expired
2021-09-07 16:57:45 +08:00
56b2a33a4d [Feature] Support Integer-Types value in like predicate (#6579)
The basic idea is adding a rewrite rule to rewriete the expr of `SlotRef`, 
which type is fixedPointValue, aka Integer-Types, to a `CastExpr`, it will cast the fixedPoint value to string.
2021-09-07 11:56:52 +08:00
74ddea8d83 [Optimize] Remove some unused code to reduce lock contention (#6566)
1. Remove global runtime profile counter
2. Remove unused thread token register
2021-09-07 11:56:12 +08:00
Pxl
577ff01094 [Bug][Function] Fix pad function wrong result when len.val==str_char_size (#6564)
like #6563 and #6562
2021-09-07 11:55:49 +08:00
bf6d043a7e [Bug] Fix bug that can not repair replica in DECOMMISSION state (#6560)
Fix bug that if a tablet belongs to a colocation table, and one of its
replica is in DECOMMISSION state. This tablet can not be repaired.

Also fix a bug that quota does not escape in show create table result.

```
COMMENT "a"bc" to COMMENT "a\"bc"
```
2021-09-07 11:55:23 +08:00
80cb22c880 [Bug] [Truncate] Fix tablet number is different between the new partition and base partition after truncate operation (#6552)
Fix #6551 

`Truncate` operation will create new partition to replace base partition.
Tablets in new partition would be created based on table default bucket number.
If the number of tablet for a partition is different from table default bucket number,
the number of tablet will be different between the new created partition and base partition after truncate operation.

In any case, the new partition should have the same number of tablet as the base partition after truncate operation. 
Tablets in new partition should be created based on tablet number of base partition rather than table default bucket number for truncate operation.
2021-09-07 11:54:15 +08:00
9469b2ce1a [Outfile] Support concurrent export of query results (#6539)
This pr mainly supports
1. Export query result sets concurrently
2. Query result set export supports s3 protocol

Among them, there are several preconditions for concurrently exporting query result sets
1. Enable concurrent export variables
2. The query itself can be exported concurrently
    (some queries containing sort nodes at the top level cannot be exported concurrently)
3. Export the s3 protocol used instead of the broker

After exporting the result set concurrently,
the file prefix is changed to outfile_{query_instance_id}_filenumber.{file_format}
2021-09-07 11:53:32 +08:00
d25f5ed911 [Metric] Add more metrics for FE checkpoint operation (#6522)
Counter of image write success or failure:
image_write{"type" = "success"}
image_write{"type" = "failed"}

Counter of image push to other FE nodes success or failure:
image_push{"type" = "success"}
image_push{"type" = "failed"}

Counter of old image clean success or failure:
image_clean{"type" = "success"}
image_clean{"type" = "failed"}

Counter of old edit log clean success or failure:
edit_log_clean{"type" = "success"}
edit_log_clean{"type" = "failed"}
2021-09-07 11:52:55 +08:00
2324e28288 [Enhance] Add a rewrite rule of compoundPredicate 'OR' 'AND' to hit prefix index (#6518)
add a rewrite rule of compoundPredicate 'OR' 'AND' to hit prefix index
unit test added.

`````
case true AND expr ==> expr
case expr AND true ==> expr
case false Or expr ==> expr
case expr Or false ==> expr
 
case false AND expr ==> false
case expr AND false ==> false
case true Or expr ==> true
case expr Or true ==> true
`````
2021-09-07 11:52:41 +08:00
1fc6ee1597 [Config] Add config to support long table name (#6501)
Support length of table name large than 64
2021-09-07 11:52:07 +08:00
f591098b08 [Feature] Support fe login using sql tools when no be is available. (#6150)
When no backend(be) available, eg first time before setup or all be is down, we cannot login to fe using most sql tools, eg datagrip, querious.

This is because these tools call `select version()` or  `select @@version_comment …` right after login, when there is no backend available, the login will fail.

I make this pr to support login when no be available, so we can add backend or modify some configuaration using GUI sql tools, especially the first setup time.

This pr is working at precondition that,sql tools only query very simple information that fe can handle, there is no need to send the request to be.

So I check the query type and BE status, if we can handle the query and no BE is available, we will intercept and process in fe.
2021-09-07 11:51:46 +08:00
1206f9a17f [RuntimeFilter] support TYPE_STRING in runtime filter (#6573) 2021-09-06 11:55:11 +08:00
b3cb1e271d [bug] Fix the bug that http redirects to master cannot be authenticated, and redirect several http interfaces to master. (#6557)
Redirect the following http requests to master:
    /rest/v2/api/cluster_overview
    /rest/v2/manager/node/frontends
    /rest/v2/manager/node/backends
    /rest/v2/manager/node/brokers
2021-09-06 11:00:39 +08:00
00ecb2904b [Bug] Fix colocate agg error when group of colocate table is unstable (#6559)
If the colocate group of the table is not stable,
then even if it is a colocate table,
its data distribution is Random.
So the distribution info of OlapScanNode is also Random instead of Hash Partition.

Fixed #6558
2021-09-04 11:00:12 +08:00
7db8841ae2 [Feature][ResourceTag] Support Resource Tag (#6203)
#5902 
This CL mainly changes:

1. Support setting tags for BE nodes:

    ```
    alter system add backend "1272:9050, 1212:9050" properties("tag.location": "zoneA");
    alter system modify backend "1272:9050, 1212:9050" set ("tag.location": "zoneB");
    ```
    And for compatibility, all BE nodes will be set a "default" tag when upgrading: `"tag.location": "default"`.

2. Create a new class `ReplicaAllocation` to replace the previous `replication_num`.

    `ReplicaAllocation` represents the allocation of the replicas of a tablet. It contains a map from 
    Tag to number of replicas.
    For example, if user set a table's replication num to 3, it will be converted to a ReplicaAllocation
    like: `"tag.location.default" : "3"`, which means the tablet will have 3 replicas and all of them will be
    allocated in BE nodes with tag "default";

3. Support create table with replication allocation:

    ```
    CREATE TABLE example_db.table_hash
    (
    k1 TINYINT
    )
    DISTRIBUTED BY HASH(k1) BUCKETS 32
    PROPERTIES (
        "replication_allocation"="tag.location.zone1:1, tag.location.zone2:2"
    );
    ```
    
    Also support set replica allocation for dynamic tables, and modify replica allocation at runtime.

    For compatibility, user can still set "replication_num" = "3", and it will be automatically converted to:
    ` "replication_allocation"="tag.location.default:3"`

4. Support tablet repair and balance based on Tag

    1. For tablets of non-colocate table, most of the logic is the same as before,
       but when selecting the destination node for clone, the tag of the node will be considered.
       If the required tag does not exist, it cannot be repaired.
       Similarly, under the condition of ensuring that the replicas are complete, the tablet will be
       reallocated according to the tag or the replicas will be balanced.

       Balancing is performed separately within each resource group.

    2. For tablets of colocate table, the backends sequence of buckets will be splitted by tag.
       For example, if replica allocation is "tag.location.zone1:1, tag.location.zone2:2",

       And zone1 has 2 BE: A, B; zone2 has 3 BE: C, D, F

       there will be 2 backend sequences: one is for zone1, and the other is for zone2.
       And one posible seqeunces will be:


       zone1: [A]   [B]   [A]   [B]
       zone2: [C, D][D, F][F, C][C, D]

5. Support setting tags for user and restrict execution node with tags:


    ```
    set property for 'cmy' 'resource_tags.location' : 'zone1, zone2';
    ```

    After setting, the user 'cmy' can only query data stored on backends with tag zone1 and zone2,
    And query can only be executed on backends with tag zone1 and zone2


    For compatibility, after upgrading, the property `resource_tags.location` will be empty,
    so that user can still query data stored on any backends.

6. Modify the Unit test frame of FE so that we can created multi backends with different mocked IP in unit test.

    This help us to easily test some distributed cases like query, tablet repair and balance

The document will be added in another PR.

Also fix a bug described in #6194
2021-09-04 10:59:35 +08:00
df54b34f98 [Catalog] Enforce null check at Catalog.getDb and Database.getTable (#6416)
fix #5378 #5391 #5688 #5973 #6155 and all replay NPE. All replay method can now throw MetaNotFoundException and caught to log a warning for potential inconsistent metadata cases.

try to establish a clear notice for future developer to check null.
2021-09-03 13:34:49 +08:00
79fd117d60 Update load-json-format.md (#6546)
change stripe_outer_array to strip_outer_array
2021-09-02 16:08:09 +08:00
6ac0ab6b29 fix(sparkload): bitmap deep copy in or operator (#6480)
* fix(sparkload): bitmap deep copy in `or` operator

fix multi rollup hold the same Ref of bitmapvalue which may be updated repeatedly.

* fix(sparkload): bitmap deep copy in `or` operator

fix multi rollup hold the same Ref of bitmapvalue which may be updated repeatedly.

Co-authored-by: weixiang <weixiang06@meituan.com>
2021-09-02 12:15:02 +08:00
57199955d6 [Compaction][ThreadPool]Support adjust compaction threads num at runtime (#5781)
* adjust thread number of compaction thread pool dynamically

Co-authored-by: weizuo <weizuo@xiaomi.com>
2021-09-02 10:01:44 +08:00
d8cde8c044 (#6454) Remove useless code for Segment V2 (#6455) 2021-09-02 09:59:21 +08:00