Commit Graph

13073 Commits

Author SHA1 Message Date
d90c892bd8 [Bug] Get NPE when executing show alter table statement (#3146) 2020-03-20 09:20:21 +08:00
b286f4271b Remove unused PreAggregtionNode (#3151) 2020-03-20 09:19:47 +08:00
4b3367636d [Bug] Fix NPE when access follower Fe's web console (#3149) 2020-03-19 20:34:34 +08:00
0f14408f13 [Temp Partition] Support loading data into temp partitions (#3120)
Related issue: #2663, #2828.

This CL support loading data into specified temporary partitions.

```
INSERT INTO tbl TEMPORARY PARTITIONS(tp1, tp2, ..) ....;

curl .... -H "temporary_partition: tp1, tp, .. "  ....

LOAD LABEL db1.label1 (
DATA INFILE("xxxx") 
INTO TABLE `tbl2`
TEMPORARY PARTITION(tp1, tp2, ...)
...
```

NOTICE: this CL change the FE meta version to 77.

There 3 major changes in this CL

## Syntax reorganization

Reorganized the syntax related to the `specify-partitions`. Removed some redundant syntax
 definitions, and unified the syntax related to the `specify-partitions` under one syntax entry.

## Meta refactor

In order to be able to support specifying temporary partitions, 
I made some changes to the way the partition information in the table is stored.

Partition information is now organized as follows:

The following two maps are reserved in OlapTable for storing formal partitions:

    ```
    idToPartition
    nameToPartition
    ```

Use the `TempPartitions` class for storing temporary partitions.

All the partition attributes of the formal partition and the temporary partition,
such as the range, the number of replicas, and the storage medium, are all stored
in the `partitionInfo` of the OlapTable.

In `partitionInfo`, we use two maps to store the range of formal partition
and temporary partition:

    ```
    idToRange
    idToTempRange
    ```

Use separate map is because the partition ranges of the formal partition and
the temporary partition may overlap. Separate map can more easily check the partition range.

All partition attributes except the partition range are stored using the same map,
and the partition id is used as the map key.

## Method to get partition

A table may contain both formal and temporary partitions.
There are several methods to get the partition of a table.
Typically divided into two categories:

1. Get partition by id
2. Get partition by name

According to different requirements, the caller may want to obtain
a formal partition or a temporary partition. These methods are
described below in order to obtain the partition by using the correct method.

1. Get by name

This type of request usually comes from a user with partition names. Such as
`select * from tbl partition(p1);`.
This type of request has clear information to indicate whether to obtain a
formal or temporary partition.
Therefore, we need to get the partition through this method:

`getPartition(String partitionName, boolean isTemp)`

To avoid modifying too much code, we leave the `getPartition(String
partitionName)`, which is same as:

`getPartition(partitionName, false)`

2. Get by id

This type of request usually means that the previous step has obtained
certain partition ids in some way,
so we only need to get the corresponding partition through this method:

`getPartition(long partitionId)`.

This method will try to get both formal partitions and temporary partitions.

3. Get all partition instances

Depending on the requirements, the caller may want to obtain all formal
partitions,
all temporary partitions, or all partitions. Therefore we provide 3 methods,
the caller chooses according to needs.

`getPartitions()`
`getTempPartitions()`
`getAllPartitions()`
2020-03-19 15:07:01 +08:00
9059afcc80 Delete, update and simplify some FE code (#3125) 2020-03-19 12:27:08 +08:00
41815ef176 [Alter]Clear expire alterJobV2 (#3130)
Too much AlterJobsV2 may consume too much memory, which may cause FullGC. Clear some data for finished or cancelled alterJobs and remove them when expired.
2020-03-18 20:27:10 +08:00
178bdcb16a Use DCHECK_GT instead when checking _tablet_map_lock_shard_size (#3138) 2020-03-18 19:41:04 +08:00
08e4035a41 1 (#3134) 2020-03-17 20:11:41 +08:00
d01b58bff6 Support 64 bit timestamp in from_unixtime (#3069)
Support 64 bit timestamp in from_unixtime
2020-03-17 17:30:42 +08:00
33319d659b [Thrift] Fix a bug when ThriftClientImpl close() error (#3128)
In ThriftClientImpl close(), the under layer TTransport may throw an exception,
this pathch catch the exception to avoid crash.
2020-03-17 15:53:44 +08:00
0959abc1dc [ExceptNode] Implement except node (#3056)
implement except node,
support  statement like:

``` 
select a from t1 except select b from t2
```
2020-03-17 10:54:40 +08:00
f6374fa9a5 Use default_rowset_type to replace compaction_rowset_type (#3101)
* use default_rowset_type to replace compaction_rowset_type

* segment v2 usage document
2020-03-16 22:23:48 +08:00
a80e9bf229 Fix broker scan node mem limit check (#3123) 2020-03-16 20:36:46 +08:00
cb87a54c2b [Syntax] Support schema keyword to be compatible with the mysql syntax (#3115)
create schema db1;
drop schema db1;
2020-03-16 17:17:49 +08:00
ee06ce31ba [Bug] Fix bug that the file_block_mgr object was incorrectly destructed (#3122)
During the use of the `block`, some methods in the block manager will be referenced.
So `file_block_mgr` should be a resident and globally unique object.

I put it in `StorageEngine`.

TODO: the `BlockManager`, `Env`  need to be reorganized.
2020-03-16 17:07:27 +08:00
14c088161c [New Stmt] Support setting replica status manually (#1522)
Sometimes a replica is broken on BE, but FE does not notice that.
In this case, we have to manually delete that replica on BE.
If there are hundreds of replicas need to be handled, this is a disaster.

So I add a new stmt:

    ADMIN SET REPLICA STATUS

which support setting tablet on specified BE as BAD or OK.
2020-03-16 13:42:30 +08:00
64a06ea9d4 [UT] Fix some BE unit tests (#3110)
And also support graceful exit for StorageEngine to avoid hang too long
time in unit test.
2020-03-16 13:31:44 +08:00
f4b028915b Do not build llvm thirdparty (#3116)
LLVM related codes have already be removed in master branch,
so there is no need to build llvm tool(which need a long
time to compile it).

Currently, some old release of Doris may still need it, so
for now, we just comment it, instead of remove it.
2020-03-15 18:34:52 +08:00
e01850e6ec [Alter] Alter job got stuck because of table is untable (#3106)
This CL solve the issue #3105

I add a new temporary table state WAITING_STABLE.

When an alter job is ready to start, it checks whether the table is stable. If it is not stable,
the table state is set to WAITING_STABLE. In this state, the tablet repair logic will continue to
repair the tablet until the table becomes stable.

After that, the table state will be reset to SCHEMA_CHANGE/ROLLUP and alter operations will begin.

This is just a temporary state, it does not need to be persistent, and only the master FE can see this state.
2020-03-14 23:48:36 +08:00
42931d22cb [Bug] tablet meta is not updated correctly after compaction (#3098)
This CL try to fix a potential bug describe in ISSUE: #3097. But I'm not sure this is the root cause.

Also remove lots of verbose log, and fix a memory leak.
2020-03-14 23:39:11 +08:00
wyb
01a4ab01c4 [Bug] Fix mapping columns not exist in the table schema (#3113) 2020-03-14 22:45:39 +08:00
14757f61a0 [Backup] Fix table could not load data after restore (#3087)
Backup job in BE only backup index which is visible, but the backup meta in FE contains the shadow index, after restore from this snapshot, the shadow index is visible to load process, and the tablets is not exist in BE, so load process would be cancelled. we could fix this bug by remove the useless shadow index at backup process.
2020-03-13 22:37:11 +08:00
4c98596283 [MysqlProtocol] Support MySQL multiple statements protocol (#3050)
2 Changes in this CL:

## Support multiple statements in one request like:

```
select 10; select 20; select 30;
```
ISSUE: #3049 

For simple testing this CL, you can using mysql-client shell command tools:

```
mysql> delimiter //
mysql> select 1; select 2; //
+------+
| 1    |
+------+
|    1 |
+------+
1 row in set (0.01 sec)

+------+
| 2    |
+------+
|    2 |
+------+
1 row in set (0.02 sec)

Query OK, 0 rows affected (0.02 sec)
```

I add a new class called `OriginStatement.java`, to save the origin statement in string format with an index. This class is mainly for the following cases:

1. User send a multi-statement to the non-master FE:
      `DDL1; DDL2; DDL3`

2. Currently we cannot separate the original string of a single statement from multiple statements. So we have to forward the entire statement to the Master FE. So I add an index in the forward request. `DDL1`'s index is 0,  `DDL2`'s index is 1,...

3. When the Master FE handle the forwarded request, it will parse the entire statement, got 3 DDL statements, and using the `index` to get the  specified the statement.

## Optimized the display of syntax errors
I have also optimized the display of syntax errors so that longer syntax errors can be fully displayed.
2020-03-13 22:21:40 +08:00
9832024995 [Insert] Fix bug that insert meet unexpected "label already exists" exception (#3103)
This CL will abort the transaction of an insert operation when encountering exception thrown in analysis phase.

ISSUE: #3102
2020-03-13 20:51:44 +08:00
5f18e99cdb [Doc] Update add fe node description (#3100) 2020-03-13 18:05:09 +08:00
aa540966c6 Output null for hll and bitmap column when select * (#2991) 2020-03-13 11:59:30 +08:00
d8c756260b Rewrite count distinct to bitmap and hll (#3096) 2020-03-13 11:44:40 +08:00
c5660fcb9d [UT]Fix unit test for cgroup_util (#3094)
Co-authored-by: wangcong18 <wangcong18@xiaomi.com>
2020-03-12 22:59:40 +08:00
8276c6d7f8 Show BE version in 'show backends;' (#3074)
In a large scale cluster, we may rolling upgrade BEs, this patch add a
column named 'Version' for command 'show backends;', as well as website
'/system?path=//backends', to provide a method to check whether there
is any BE missing upgraded.
2020-03-12 22:15:13 +08:00
905070f4da [CodeStyle] Fix compile warning (#3076)
```
be/src/olap/rowset/segment_v2/ordinal_page_index.cpp:103:22: warning: ‘ordinal’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
    _ordinals[i] = ordinal;
```
2020-03-11 18:17:29 +08:00
bf9612e28b [CodeStyle] Remove unnecessary forward declaration of WritableFile (#3075) 2020-03-11 18:17:11 +08:00
c8705ccf12 [MaterializedView] Support dropping materialized view (#3068)
`DROP MATERIALIZE VIEW [ IF EXISTS ] <mv_name> ON [db_name].<table_name>`

Parameters:

  IF EXISTS: Do not throw an error if the materialized view does not exist. A notice is issued in this case.
  mv_name: The name of the materialized view to remove.
  db_name: The name of db to which materialized view belongs.
  table_name: The name of table to which materialized view belongs.
2020-03-11 18:16:24 +08:00
a77515fe03 [Backup] Fix backup job block at SNAPSHOTING phase (#3058)
This bug occurred when BE make snapshot, the version required by fe had been merged into the cumulative version, so the snapshot task could not complete the task even if it retried. In order to solve this problem, the BackupJob could be set to CANCELLED, and the user could continue to retry the job.

Fix #3057
2020-03-11 14:05:02 +08:00
608917c04d Use block layer to write files (#3064)
This is the second patch following 58b8e3f574614433ea9e0c427961f2efb3476c2a,

This patch use block-layer to write files.
2020-03-11 12:11:25 +08:00
cf219ddf18 [ConsistencyCheck] Support checking replica consistency of tablet manually (#3067) 2020-03-10 15:25:25 +08:00
7400535b37 [Doc] Update compaction-action_EN.md (#3060)
fix typo
2020-03-09 22:09:43 +08:00
b9b9a11eae [Bug] Fix invalid rollback for stream load txn (#3054) 2020-03-09 22:07:36 +08:00
6e46dccd39 [Doc] Update compaction-action.md (#3059)
fix typo
2020-03-09 21:14:09 +08:00
fdcbfbb793 [Bug] Fix bug that coalesce() function return null when there is constant value in parameter. (#3062)
select coalesce(1, null);

RETURNS:    NULL
EXPECTED:   1
2020-03-09 16:38:50 +08:00
a1f5b57011 Support sharding tablet_map_lock into more small map locks to make good performance for tablet manage task (#3051)
Support sharding tablet_map_lock into more small map locks to make good performance for tablet manage task
2020-03-09 16:29:56 +08:00
dc07182bd4 [Intersect] Implements intersect node (#3034)
imlement of the intersect node
now can support statement like `select a from t intersect select b from t1 intersect select 1;`
2020-03-09 10:52:55 +08:00
172838175f [Bug] Fix bug that index name in MaterializedViewMeta is not changed after schema change (#3048)
The index name in MaterializedViewMeta is still with `__doris_shadow` prefix
after schema change finished.

In this CL, I just remove the index name field in MaterializedViewMeta,
so that it would makes managing change of names less error-prone.
2020-03-09 10:11:16 +08:00
765f284dcd [Doc] Add Downloads page to Doris website (#3039) 2020-03-09 09:42:46 +08:00
c8054ebe13 [Function] ifnull function supports new args (date,datetime) and (datetime, date) (#3043) 2020-03-09 09:37:26 +08:00
c83729435f Write delete predicate into RowsetMeta upon upgrade from Doris-0.10 to Doris-0.11 (#3044)
If delete predicate exists in meta in Doris-0.10, all of this predicates should
be remained. There is an confused place in Doris-0.10. The delete predicate
only exists in OLAPHeaderMessage and PPendingDelta, not in PDelta.
This trick results this bug.
2020-03-07 11:16:48 +08:00
1d296e907d Fix orc load timestamp bug (#3047)
The timestamp value load from orc file is error, the value has an offset with hive and spark.
Becuase the time zone of orc's timestamp is stored inside orc's stripe information, so the timestamp obtained here is an offset timestamp, so parse timestamp with UTC is actual datetime literal.
2020-03-06 18:03:27 +08:00
fca6c4e523 Fix bitmap null crash (#3042) 2020-03-05 21:30:32 +08:00
7b30bbea42 [MaterializedView] Support different keys type between MVs and base table (#3036)
Firstly, add materialized index meta in olap table

The materialized index meta include index name, schema, schemahash, keystype etc.
The information itself scattered in each map is encapsulated into MaterializedIndexMeta.

Also the keys type of index meta maybe not same as keys type of base index after materialized view enabled.

Secondly, support the deduplicate mv.
If there is group by or aggregation function in create mv stmt, the keys type of mv is agg.
At the same time, the keys type of base table is duplicate.
For example
Duplicate table (k1, k2, v1)
MV (k1, k2) group by k1, k2
It should be aggregated during executing mv.
2020-03-05 18:19:18 +08:00
cd7207c869 Add ORC help doc (#3041) 2020-03-05 12:44:47 +08:00
c731c8b9bc [Bug] Fix bug of NPE when get replication number from olap table (#3029)
The default replication number of an olap table may not be set.
Every time we call `getReplicationNum()`, we have to check if it returns null, 
which is inconvenience and may cause problem

So in this PR, I set a default value to table's replication number.

This bug is introduced by #2958
2020-03-05 12:18:38 +08:00