Commit Graph

1530 Commits

Author SHA1 Message Date
d79cdc829f [Bug] Filter out unavaliable backends when getting tablet location (#6204)
* [Bug] Filter out unavaiable backends when getting scan range location

In the previous implementation, we will eliminate non-surviving BEs in the Coordinator phase.
But for Spark or Flink Connector, there is no such logic, so when a BE node is down,
it will cause the problem of querying errors through the Connector.

* fix ut

* fix compiule
2021-07-13 11:17:49 +08:00
76e148988a Support alter default bucket_num of partitioned olap table (#6023)
* Support modify partitioned olap table's bucket num

Co-authored-by: EmmyMiao87 <522274284@qq.com>
2021-07-12 20:28:40 +08:00
dd15da4e12 [DynamicPartition] Fix UT and add more tests for dynamic partition (#6198) 2021-07-12 15:31:33 +08:00
56112c4718 [Bug] Fix bug that adding conflicting partition doesn't report errors (#6109)
* [Bug] Fix bug that adding conflicting partition doesn't report errors

Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-07-12 13:32:44 +08:00
b5f447b932 [ResourceLimit] Add a property to limit user instance num. (#6159)
Add a property to limit user instance num.
2021-07-10 10:15:05 +08:00
5a1aa3ec35 [Bug][Dynamic partition] Forward show dynamic partition tables stmt to Master (#6190)
1.
Only Master FE has these info.
Also catch more exception of dynamic partition scheduler.

2.
Forward admin show frontend config stmt to Master if set forward_to_master=true
2021-07-10 10:14:04 +08:00
3ad12c5f8a [Log] Optimize delete error message (#6187)
## Proposed changes

When a delete error occurs, the error message is ambiguous.

```sql
mysql> DELETE FROM nebula_trade_health_trade PARTITION q3_2021 WHERE event_day = '20210706';
ERROR 1064 (HY000): errCode = 2, detailMessage = failed to execute delete. transaction id 7215554, timeout(ms) 160000, unfinished replicas: 4718319=7345841
```

We do not know the meaning of `4718319=7345841`.

Actually the former is `BackendId` and the latter is `TabletId`.

I'll add an instruction here to help locate the problem quickly. The error message will be 

```sql
ERROR 1064 (HY000): errCode = 2, detailMessage = failed to execute delete. transaction id 7215554, timeout(ms) 160000, unfinished replicas [BackendId=TabletId]: 4718319=7345841
```
2021-07-10 10:13:08 +08:00
01bef4b40d [Load] Add "LOAD WITH HDFS" model, and make hdfs_reader support hdfs ha (#6161)
Support load data from HDFS by using `LOAD WITH HDFS` syntax and read data directly via libhdfs3
2021-07-10 10:11:52 +08:00
814840f826 [refactor] Make Regex more simple and clear (#6141)
1. Remove Redundant character escape ‘\\}’ and ‘\\:’
2. Replace ‘{0,1}’ to ‘?’
2021-07-10 10:10:41 +08:00
65892cec3b [Bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value (#6129)
fix the issue #5995
Add the property "dynamic_partition.history_partition_num" to specify the history partition number when enable create_history_partition to fix the invalid date format value
and add these two properties to docs
2021-07-10 10:10:28 +08:00
e426fbd6be [Planner] Align Date and Datetime by 16 bytes (#6105)
The previous alignment of Doris is up to 8 bytes.
For types with more than 8 bytes, such as Date, Datetime is not aligned.
This PR is mainly to relax the maximum 8-byte limitation
Also, because the data type Decimal v1 no longer exists,
the logic of the 40-byte Decimal v1 is also discarded.
2021-07-10 10:10:04 +08:00
cca813a57b [Bug] Fix the bug of bucket shuffle join cause error plan (#6172) 2021-07-08 15:44:39 +08:00
40bc3fed53 [Code] basic property related classes supports create, query, read, write, etc. (#6153)
Provides basic property related classes supports create, query, read, write, etc.
Currently, Doris FE mostly uses `if` statement to check properties in SQL. There is a lot of redundancy in the code.
The `PropertySet` class can be used in the analysis phase of `Statement`. The validation and correctness of the input properties are automatic verified. It can simplify the code and improve the readability of the code.

Usage:
1. Create a custom class that implements `SchemaGroup` interface.
2. Define the properties to be used. If it's a required parameter, there is no need to set the default value.
3. According the the requirements, in the logic called `readFromStrMap` and other functions to check and obtain parameters.

Demo:

Class definition

```
public class FileFormat implements PropertySchema.SchemaGroup {
    public static final PropertySchema<FileFormat.Type> FILE_FORMAT_TYPE =
            new PropertySchema.EnumProperty<>("type", FileFormat.Type.class).setDefauleValue(FileFormat.Type.CSV);
    public static final PropertySchema<String> RECORD_DELIMITER =
            new PropertySchema.StringProperty("record_delimiter").setDefauleValue("\n");
    public static final PropertySchema<String> FIELD_DELIMITER =
            new PropertySchema.StringProperty("field_delimiter").setDefauleValue("|");
    public static final PropertySchema<Integer> SKIP_HEADER =
            new PropertySchema.IntProperty("skip_header", true).setMin(0).setDefauleValue(0);

    private static final FileFormat INSTANCE = new FileFormat();

    private ImmutableMap<String, PropertySchema> schemas = PropertySchema.createSchemas(
            FILE_FORMAT_TYPE,
            RECORD_DELIMITER,
            FIELD_DELIMITER,
            SKIP_HEADER);

    public ImmutableMap<String, PropertySchema> getSchemas() {
        return schemas;
    }

    public static FileFormat get() {
        return INSTANCE;
    }
}

```

Usage
```
public class CreateXXXStmt extends DdlStmt {
    private PropertiesSet<FileFormat> analyzedFileFormat = PropertiesSet.empty(FileFormat.get());
    private final Map<String, String> fileFormatOptions;
    ...

    public void analyze(Analyzer analyzer) throws UserException {
        ...
        if (fileFormatOptions != null) {
            try {
                analyzedFileFormat = PropertiesSet.readFromStrMap(FileFormat.get(), fileFormatOptions);
            } catch (IllegalArgumentException e) {
                ...
            }
        }

        // 1. Get property value
        String recordDelimiter = analyzedFileFormat.get(FileFormat.RECORD_DELIMITER)
        // 2. Check the validity of parameters
        PropertiesSet.verifyKey(FileFormat.get(), fileFormatOptions);
        ...
    }

}
```
2021-07-08 09:55:07 +08:00
fb123b2b4b [httpv2] Switch SpringBoot built-in container to jetty (#6149)
Fix the 307 redirect problem
2021-07-08 09:54:28 +08:00
e312c0f58f Fix null pointer exception in Routine load (#6163)
The where clause in routine load will also be rewritten.
But there is no connection context.
The PR fix this problem #6162
2021-07-07 10:34:10 +08:00
198ba78595 [Feature] Add update time to show table status (#6117)
Add update time to show table status

```
MySQL [test_query_qa]> show table status;
+----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-----------+----------+----------------+---------+
| Name     | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time         | Update_time         | Check_time          | Collation | Checksum | Create_options | Comment |
+----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-----------+----------+----------------+---------+
| bigtable | Doris  |    NULL | NULL       | NULL |           NULL |        NULL |            NULL |         NULL |      NULL |           NULL | 2021-06-29 17:09:28 | 2021-06-29 17:17:28 | 1970-01-01 07:59:59 | utf-8     |     NULL | NULL           | OLAP    |
| test     | Doris  |    NULL | NULL       | NULL |           NULL |        NULL |            NULL |         NULL |      NULL |           NULL | 2021-06-29 17:09:26 | 2021-06-29 17:17:28 | 1970-01-01 07:59:59 | utf-8     |     NULL | NULL           | OLAP    |
| baseall  | Doris  |    NULL | NULL       | NULL |           NULL |        NULL |            NULL |         NULL |      NULL |           NULL | 2021-06-29 17:09:26 | 2021-06-29 17:17:26 | 1970-01-01 07:59:59 | utf-8     |     NULL | NULL           | OLAP    |
+----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-----------+----------+----------------+---------+
3 rows in set (0.002 sec)
```
2021-07-07 10:27:14 +08:00
739c0268ff [refactor] Remove decimal v1 related code from code base (#6079)
remove ALL DECIMAL V1 type code , this is a part of #6073
2021-07-07 10:26:32 +08:00
d6e6c7815b [Feature] ADD: show create routine load (#6110)
Add show create routine load
2021-07-04 21:43:25 +08:00
f0c5fb9f38 [Bug] Fix bug of NPE caused by the absence of table in replay process. (#6136)
In the previous version, we changed the db level lock to the table level
to reduce lock contention. But this change will cause some metadata playback problems.

Because most operations on a table will only acquire table locks. These operations
may occur at the same time as the operation of dropping the table.
This may cause the metadata operation sequence to be inconsistent with the log replay sequence,
which may cause some problems.
2021-07-02 19:24:13 +08:00
Pxl
6b76b5bcea [refactor] fix machine_name&accesskey leak (#6131)
* fix machine name leak && fix accesskey leak

* Update fe/fe-core/src/test/java/org/apache/doris/backup/BrokerStorageTest.java

Co-authored-by: Zhengguo Yang <780531911@qq.com>

Co-authored-by: pxl <panxiaolei01@baidu.com>
Co-authored-by: Zhengguo Yang <780531911@qq.com>
2021-07-01 09:38:47 +08:00
f01c8e570d [Bug] fix show dynamic partition tables; replicationNum is wrong (#6128) 2021-07-01 09:20:52 +08:00
2a1b2394a2 [Feature] Extract wide common factors (#6083)
This PR mainly adds a rewrite rule 'ExtractCommonFactorsRule'
  used to extract wide common factors in the planning stage for 'Expr'.
The main purpose of this rule is to extract (Range or In) expressions
  that can be combined from each or clause.
E.g:
  Origin expr: (1<a<3 and b in ('a') ) or (2<a<4 and b in ('b'))
  Rewritten expr: (1<a<4 ) and (b in ('a', 'b')) and ((1<a<3 and b in ('a') ) or (2<a<4 and b in ('b')))
Although the range of the wide common factors is larger than the real range,
  the wide common factors only involve a single column, so it can be pushed down to the scan node,
  thereby reducing the amount of scanned data in advance and improving the query speed.

It should be noted that this optimization strategy is not for all scenarios.
When filter rate of the wide common factor is too low,
  the query will consume an extra time to calculate the wide common factors.

So this strategy can be switched by configuring session vairables 'extract_wide_range_expr'.
The default policy is enabled which means this strategy takes effect.
If you encounter unsatisfactory filtering rate, you can set the variable to false.
It will turn off the strategy.

Fixed #6082
2021-07-01 09:17:57 +08:00
b69ebc3ec4 [Extension] Add DataX doriswriter extension directory (#6111)
This CL only add the script for building DataX development environment
2021-06-30 09:55:19 +08:00
ce49fa5968 [Bug][DynamicPartition] Take table_id as key of runtimeInfo (#6053)
Co-authored-by: wangxixu <wangxixu@xiaomi.com>
2021-06-30 09:28:26 +08:00
e3899aa3e7 [Metrics] Add tablet count on different status metrics (#5787)
Based on these metrics, we can add alerts to remind
admins whether the cluster is healthy or not.
2021-06-30 09:25:42 +08:00
ba84eacb8c (#6009) fix bucket key distribute error when using spark load (#6087) 2021-06-29 12:30:08 +08:00
fe65a623c1 Fix timeout error when delete condition contains invalid datetime format (#6030)
* add date time format check in delete statment
2021-06-29 09:47:42 +08:00
2998373354 [Bug] Fix bug that select into outfile in parquet format may cause NPE (#6054)
1. check the parquet schema property on FE side.
2. auto generate parquet schema if not specified.
2021-06-23 11:33:47 +08:00
72d1a3b39c fix spring boot web maximum upload file limit config (#6070)
Co-authored-by: zouxinyi <zouxinyi@baidu.com>
2021-06-22 10:46:26 +08:00
b9ad34736d [Feature] Support recording custom number of backup and restore task information (#5947)
* Record all backup jobs and support where clause
2021-06-22 09:19:54 +08:00
abcd56c6c8 [Enhance] Support show unrecoverable tablets (#6045)
* [Enhance] Support show unrecoverable tablets

The unrecoverable tablets are tablets which non of their replicas are healthy.
We should be able to find out these tablets then manual intervention.

And these tablets should not be added to the tablet scheduler.
2021-06-22 09:19:12 +08:00
882ebd3d7d [Bug] Fix show data bug (#6060) 2021-06-20 16:15:54 +08:00
5b2d07ca2f [Bug] Fix disk TotalUsedPct display error (#6059)
Fix TotalUsedPct display error
2021-06-20 16:15:39 +08:00
1d796d9aa4 [Bug] Fix bug that routine load job may cause dead lock (#6058)
To make source the routine load job's lock must be released after txn aborted
2021-06-20 16:14:47 +08:00
fe0912f6e5 [SQL] Compatible with mysql nulls order by (#6043) 2021-06-20 16:12:52 +08:00
bf2423c91a [httpv2] Spring boot http upload file maximum limit parameterization (#6013)
spring.servlet.multipart.max-file-size and spring.servlet.multipart.max-request-size  Configurable
2021-06-20 16:10:54 +08:00
9bc2df43a7 [Bug][Export] Fix bug of one more record showed in the “show export limit n" (#6012) 2021-06-20 16:10:21 +08:00
bff6ede94e add data size field for partition cache (#6026)
Co-authored-by: wangxixu <wangxixu@xiaomi.com>
2021-06-18 11:40:00 +08:00
ff47dc750d [Bug] Fix problem for thread safety issues and setting the status of non-existent replica does not prompt any error message (#6019)
Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-06-18 10:50:47 +08:00
99d8110972 [Bug-fix] Fix wrong data distribution judgment (#6029)
* [Bug-fix] Fix wrong data distribution judgment

The Fragment where OlapScanNode is located has three data distribution possibilities.
1. UNPARTITIONED: The scan range of OlapScanNode contains only one instance(BE)
2. RANDOM: Involving multi-partitioned tables in OlapScanNode.
3. HASH_PARTITIONED: The involving table is in the colocate group.

For a multi-partition table, although the data in each individual partition is distributed according to the bucketing column,
the same bucketing column between different partitions is not necessarily in the same be.
So the data distribution is RANDOM.

If Doris wrongly plan RANDOM as HASH_PARTITIONED, it will lead to the wrong colocate agg node.
The result of query is incorrect.
2021-06-18 09:21:46 +08:00
d2c1cddd55 [Bug-fix] Avoid using 'QueryDetail' in planning stage (#6018)
QueryDetail is used to statistic the current query details.
This property will only be set when the query starts to execute.
So in the query planning stage, using this attribute in the first query will cause 'NullPointerException'.
After that, this attribute retains the value of the previous query
until it is updated by the subsequent process.
Because code of 'colocateagg' uses this attribute incorrectly in its planning,
it causes 'NullPointerException' when clients like pymysql connect to doris and send the first query.
Fixed #6017
2021-06-16 09:40:53 +08:00
daf8ce29ca [Bug] Fix bucket shuffle bug when left table is without any data (#5965) 2021-06-16 09:39:31 +08:00
d0b60541af [Bug] fix use uncorrect table name in expand star (#6003)
SelectStmt use new TableName(null, tableRef.getAlias()) to expand star expression. tableRef.getAlias() is full name include database name and table name. 
Using it as table name will generate wrong sql in CreateViewStmt. 
This patch fix this problem and use correct database name and table name in expand star method.
2021-06-15 14:18:00 +08:00
54c7d177f8 [Log] Fix a log issue in BDBJournalCursor (#6006) 2021-06-10 17:39:25 +08:00
d33a6d1b98 [Function] Support date function: yearweek(), week(), makedate(). (#6000) 2021-06-10 17:38:25 +08:00
206a711f9b [Bug] SimplifyInvalidDateBinaryPredicatesDateRule may cause invalid query plan (#5987)
1. "where 1k > to_date(now())" will return EMPTYSET in query plan.
2. DateLiteral should accept date string like "2021-6-1".
2021-06-10 17:37:26 +08:00
97ed59780d [Bug] Outer join dispose constexpr error in inlineview (#5986) 2021-06-10 17:36:29 +08:00
e7a7b8d2d1 [Bug] Fix bug that start time is null when SQL is forward to master (#5966) 2021-06-10 17:34:59 +08:00
6106cc7d96 [Doris On ES][Bug-Fix] split es publish_address if it has host (#5955) 2021-06-10 17:34:44 +08:00
e245aee33e [Feature] Select outfile support parquet format (#5938)
`Select outfile into` currently only supports to export data with CSV format.
This patch extends the feature to supports parquet format.

Usage:
LocaFile:
```
SELECT citycode FROM table1 INTO OUTFILE "file:///root/doris/" FORMAT AS PARQUET PROPERTIES 
("schema"="required,int32,siteid;", "parquet.compression"="snappy");
```

BrokerFile:
```
SELECT siteid FROM table1 INTO OUTFILE "hdfs://host/test_sql_prc_2019_02_19/" FORMAT AS PARQUET
PROPERTIES ( 
"broker.name" = "hdfs_broker",
"broker.hadoop.security.authentication" = "kerberos",
"broker.kerberos_principal" = "test",
"broker.kerberos_keytab_content" = "base64" ,
"schema"="required,int32,siteid;"
);
```

Field `schema` is required, which defines the schema of a parquet file.
Prefix `parquet.` is the parquet file properties, like compression, version, enable_dictionary.
2021-06-10 17:34:01 +08:00