Commit Graph

1512 Commits

Author SHA1 Message Date
3f4e18633d [util] Add Apache License 2.0 to Thread (#2928) 2020-02-18 15:36:49 +08:00
32e998f6e9 [ut] Delete files generated by UT when teardown (#2930)
If these residual files are not deleted, the UT will fail because
the corresponding files already exist when running multiple times.
2020-02-18 15:35:11 +08:00
7be2871c36 [GroupingSet] Disable column both in select list and aggregate functions when using GROUPING SETS/CUBE/ROLLUP (#2921) 2020-02-18 13:56:56 +08:00
b3c5f0fac7 Remove unneeded headers included in agent-util (#2929) 2020-02-18 13:18:56 +08:00
625411bd28 Doris support in memory olap table (#2847) 2020-02-18 10:45:54 +08:00
11b43700b9 [Alter] Fix pending AlterJobV2 replay bug (#2922)
Call replayPending method when load pending status AlterJobV2.
So that the tablet and replica won't missing in TabletInvertedIndex.
2020-02-17 23:02:18 +08:00
0fb52c514b [UDF] Fix bug that UDF can't handle constant null value (#2914)
This CL modify the `evalExpr()` of ExpressionFunctions, so that it won't change the
`FunctionCallExpr` to `NullLiteral` when there is null parameter in UDF. Which will fix the
problem described in ISSUE: #2913
2020-02-17 22:13:50 +08:00
1089f09d26 [Syntax] Fix bug introduced by #2906 (#2917) 2020-02-17 21:41:03 +08:00
1f844946e9 Fixbug: Invalid memory address in doris::memory_copy (#2919) (#2923)
When I change schema from char(20) to varchar(20), be will cause coredump.
2020-02-17 18:48:38 +08:00
feef077520 Some refactors on TabletManager (#2918)
1. Add some comments to make the code easier to understand;
2. Make the metric `create_tablet_requests_failed` to be accurate;
3. Some internal methods use naked pointers directly instead of `shared_ptr`;
4. The `using` in `.h` files are contagious when included by other files,
    so we should only use it in `.cpp` files;
5. Some formatting changes: such as wrapping lines that are too long
6. Parameters that need to be modified, use pointers instead of references

No functional changes in this patch.
2020-02-17 14:50:29 +08:00
f20eb12457 [util] Import ThreadPool and Thread from KUDU (#2915)
Thread pool design point:
  All tasks submitted directly to the thread pool enter a FIFO queue and are
dispatched to a worker thread when one becomes free. Tasks may also be
submitted via ThreadPoolTokens. The token wait() and shutdown() functions
can then be used to block on logical groups of tasks.
  A token operates in one of two ExecutionModes, determined at token
construction time:
  1. SERIAL: submitted tasks are run one at a time.
  2. CONCURRENT: submitted tasks may be run in parallel.
     This isn't unlike submitted without a token, but the logical grouping that tokens
     impart can be useful when a pool is shared by many contexts (e.g. to
     safely shut down one context, to derive context-specific metrics, etc.).
Tasks submitted without a token or via ExecutionMode::CONCURRENT tokens are
processed in FIFO order. On the other hand, ExecutionMode::SERIAL tokens are
processed in a round-robin fashion, one task at a time. This prevents them
from starving one another. However, tokenless (and CONCURRENT token-based)
tasks can starve SERIAL token-based tasks.

Thread design point:
  1. It is a thin wrapper around pthread that can register itself with the singleton ThreadMgr
(a private class implemented in thread.cpp entirely, which tracks all live threads so
that they may be monitored via the debug webpages). This class has a limited subset of
boost::thread's API. Construction is almost the same, but clients must supply a
category and a name for each thread so that they can be identified in the debug web
UI. Otherwise, join() is the only supported method from boost::thread.
  2. Each Thread object knows its operating system thread ID (TID), which can be used to
attach debuggers to specific threads, to retrieve resource-usage statistics from the
operating system, and to assign threads to resource control groups.
  3. Threads are shared objects, but in a degenerate way. They may only have
up to two referents: the caller that created the thread (parent), and
the thread itself (child). Moreover, the only two methods to mutate state
(join() and the destructor) are constrained: the child may not join() on
itself, and the destructor is only run when there's one referent left.
These constraints allow us to access thread internals without any locks.
2020-02-17 11:22:09 +08:00
43583e7bd2 Fix orc load bug (#2912) 2020-02-16 19:14:42 +08:00
6c33f80544 Add disable_storage_page_cache config (#2890)
1. when read column data page:
    for compaction, schema_change, check_sum: we don't use page cache
    for query and config::disable_storage_page_cache is false, we use page cache
2. when read column index page
    if config::disable_storage_page_cache is false, we use page cache
2020-02-16 19:13:30 +08:00
1e3b0d31ea [Rollup] Change table's state right after all rollup jobs are done (#2904)
In the current implementation, the state of the table will be set until the next round of job scheduling. So there may be tens of seconds between job completion and table state changes to NORMAL.

And also, I made the synchronized range smaller by replacing the synchronized methods with synchronized blocks, which may solve the problem described in #2903
2020-02-14 21:28:51 +08:00
1f7c03d998 [FIX] Fix a sqlparser conflict by KW_PROPERTIES (#2907)
fix a sqlparser conflict by KW_PROPERTIES, now change KW_PROPERTIES's precedence to right, so it must use like PROPERTIES()
2020-02-14 21:08:50 +08:00
5386c92383 [FIX] Fix a sqlparser conflict imported by PR #2725 (#2906)
Fix a sqlparser conflict imported by pr #2725, in that pr add some time unit to keyword
I have moved those to time_unit
2020-02-14 21:06:01 +08:00
9ee1704859 [util] Import util tools from KUDU (#2905)
1. MonoTime/MonoDelta
   MonoTime: The MonoTime represents a particular point in time, relative to some fixed but unspecified reference point.
   MonoDelta: The MonoDelta class represents an elapsed duration of time, the delta between two MonoTime instances.

2. CountDownLatch
   This is a C++ implementation of the Java CountDownLatch
2020-02-14 18:01:16 +08:00
09a4d3e50a [gutil] import scoped_refptr smart pointer from KUDU (#2899)
scoped_refptr is used to replace std::shared_ptr, is generally faster and smaller.
advantage
  (1) only requires a single allocation, and ref count is on the same cache line as the object
  (2) the pointer only requires 8 bytes (since the ref count is within the object)
  (3) you can manually increase or decrease reference counts when more control is required
  (4) you can convert from a raw pointer back to a scoped_refptr safely without worrying about double freeing
  (5) since we control the implementation, we can implement features, such as debug builds that capture the stack trace of every referent to help debug leaks.
disadvantage
  (1) the referred-to object must inherit from RefCounted
  (2) does not support the weak_ptr use cases
2020-02-14 13:32:03 +08:00
0e997a8798 Fix a sql_parser.cup conflict by a duplicated show index stmt (#2894) 2020-02-14 12:00:23 +08:00
83d33cec25 [Syntax] Fix alter rollup stmt Shift/Reduce conflict (#2897) 2020-02-14 11:49:14 +08:00
d2625a26aa [env] Add env-util class (#2898)
The code submitted later will use this utility class.

Currently only factory methods for various file types are provided.
In the future, tool methods that are common to all Env types can
be added here.
2020-02-14 10:04:51 +08:00
ed95352ecd support intersect and except syntax (#2882) 2020-02-13 16:48:46 +08:00
fd492e3b6f [Doris on ES] Support escape character (#2865) 2020-02-13 11:32:48 +08:00
3c539aac54 [Refactor] Some tiny refactor on streaming-load related code (#2891)
Mainly contains the following modifications:
1. Use `std::unique_ptr` to replace some naked pointers
2. Modify some methods from member-method to local-static-function
3. Modify some methods do not need to be public to private
4. Some formatting changes: such as wrapping lines that are too long
5. Remove some useless variables
6. Add or modify some comments for easier understanding

No functional changes in this patch.
2020-02-13 10:42:52 +08:00
f2875ceb73 [Index] Add column type check when creating bitmap index (#2883) 2020-02-12 23:05:16 +08:00
3e160aeb66 [GroupingSet] fix a bug when using grouping set without all column in a grouping set item (#2877)
fix a bug when using grouping sets without all column in a grouping set item will produce wrong value.
fix grouping function check will not work in group by clause
2020-02-12 21:50:12 +08:00
e9ff40f07f Add sync_dir interface to Env (#2884)
when we need to ensure that **a newly-created file** is fully
synchronized back to disk, we should call `fsync()` on the parent
directory—that is, the directory containing the newly-created file.
That is to say, In this situation, we should call `fsync()` on
both the newly-created file and its parent directory.

Unfortunately, currently in Doris, in any scenario, directories
are not fsynced.

This patch adds `sync_dir()` interface first, laying the groundwork
for future fixes.

This patch also removes unneeded private method `dir_exists()`.
2020-02-12 13:55:17 +08:00
5440e19d01 Improve the triggering strategy of BE report (#2881)
Currently, the report from BE to FE is completed in the background
threads of `AgentServer` (`report_tablet_thread` and
`report_disk_stat_thread`).  These two threads will sleep and be in
a standby state after each report, if there is any need to report
immediately, they will be notified and wake up immediately to report.

For example, when background thread (`disk_monitor_thread`) in
`StorageEngine` finds some tablets were deleted, it will notify
`AgentServer` to trigger a report immediately.

In the current implementation, in order to report ASAP, a local variable
(`_is_drop_tables`) and two other flags are used to record whether
reporting is needed, and then `StorageEngine::disk_monitor_thread` checks
the value of this variable every time it runs, to determine whether it
needs to be triggered Reporting. This is actually superfluous, and it
may result in untimely notifications, as shown below:

```
(thread_1)        (thread_2)
disk-monitor     disk-stat-reporter
    |                  |
    |               reporting
    |                  |
  notify_1             |
    |                  |
    |                wait_for_notify(will wait until timeout or next notification)
    |                  |
    V                  V
```

When `report_tablet_thread` has not started waiting,
`StorageEngine::disk_monitor_thread` triggers a notification, so this
notification will not be received by `report_tablet_thread`,
resulting in the BE not reporting to the FE until the lock times out
or the next round of `disk_monitor_thread` detection.

This change restructures the triggering implementation, and solves the above problem.

This change also changes some methods(that do not need to be public) to private.
2020-02-11 20:38:44 +08:00
59dd2a0d7f Fix some typo in bitmap index docs. (#2879) 2020-02-11 19:03:42 +08:00
1f001481ae Support batch add and drop rollup indexes #2671 (#2781) 2020-02-11 12:58:01 +08:00
fdbc0f7cca Change replace bzip and boost sources (#2878) (#2880)
replace fast sources for download bzip and boost when build
2020-02-11 12:08:47 +08:00
3a8e783444 Compatible with python3 in build (#2876) 2020-02-10 21:50:42 +08:00
03c8bc91ca Change MVN to MVN_CMD same as #2837 for builing hdfs broker (#2874) 2020-02-10 18:40:12 +08:00
4e151b1551 Remove boost exception when parse store path (#2861) 2020-02-10 17:50:52 +08:00
c89d0a090c Fix bug that _min_percentage_of_error_disk was not initialized (#2867)
In StorageEngine, the variable _min_percentage_of_error_disk was not
initialized (so it defaults to 0), which causes the process to exit
whenever one disk fails.
What we expect is that exit the process only when the number of
failed disks reach a certain percentage.
Also, this variable should mean the maximum percentage of
error disks allowed, not the minimum, so change the configuration
name to max_percentage_of_error_disk.
2020-02-10 16:58:24 +08:00
7037754978 Fix a bug that TabletsChannel may be written after cancel (#2870)
TabletsChannel may be written after cancelation, leading to core at DeltaWriter::write. We should check the state of TabletsChannel at the beginning of each operations.
2020-02-10 14:49:00 +08:00
77805e85d2 Fix lock type when clear trash (#2868)
In `TabletManager::start_trash_swee`, the modification of `_tablet_map`
should be protected by `write-lock` of `_tablet_map_lock`
2020-02-10 13:14:17 +08:00
c6090965e2 [Unused Code] Remove unused file in gensrc/scripts (#2863)
gensrc/script/doris_functions.py
gensrc/script/gen_opcodes.py

These 2 files are useless. Remove them.
2020-02-10 09:45:01 +08:00
d8a47f9a7f [Doc] Fix CANCEL DECOMMISSION syntax bug (#2860)
Fix CANCEL DECOMMISSION syntax bug
2020-02-08 13:07:19 +08:00
502fa2eb50 [GroupingSet] Fix core when using grouping sets in large data (#2858)
dst_tuples memory size to Allocate is wrong
2020-02-07 21:40:29 +08:00
feb02ab27a Make intersect_count function accept any expression that returns bitmap (#2850) 2020-02-07 09:56:54 +08:00
e7817053cc [Uitls] ParseUtil::parse_mem_spec support K and T suffix (#2854) 2020-02-07 09:31:35 +08:00
b35e8153c0 [Doris on Es] Fix lte and gte error expression (#2851)
LE should LTE
GE should GTE
2020-02-06 20:52:14 +08:00
f77cfcdb61 [Compaction] Avoid unnecessary compaction (#2839)
It is not necessary to perform compaction in the following cases

1. A tablet has only 2 rowsets, the versions are [0-1] and [2-x]. In this case, 
there is no need to perform base compaction because the [0-1] version is an empty version.

    Some tables will be partitioned by day, and then each partition will only load one batch of data
 each day, so a large number of tablets with rowsets [0-1][2-2] will appear. And these tablets
 do not need to be base compaction.

2. The initial value of the `last successful execution time of compaction` is 0, 
which causes the first time to determine the time interval from the
 last successful execution time of compaction, which always meets the 
conditions to trigger cumulative compaction.
2020-02-06 16:40:38 +08:00
d549c40fcd Fix spelling mistakes for load metrics description (#2840) 2020-02-06 10:18:30 +08:00
14c772013b Fix removing tablet bug from partition_map in TabletManager (#2842)
When using an iterator of _tablet_map.tablet_arr(`std::list`) to remove
a tablet, we should first remove tablet from _partition_map to avoid
the iterator becoming invalid.
2020-02-06 09:57:12 +08:00
e991b1300f [Code Refactor] Refactor AgentServer to make it less error-prone and more readable (#2831)
In `AgentServer`, each task type needs to be processed separately,
which leads to very long code, hard to read, and not easy to detect
errors (for example, some task type processing may be missed,
corresponding relationship may be error)

Fortunately, the code for each task_type is very similar, so this
is a good case to use `MACRO`, which can greatly reduce the repeated
code and solve above problems.

This patch also fix two small bugs:
1. The `_topic_subscriber` member has not been released in dtor
2. in `submit_tasks()`, the `status_code` is not reset before
   each task is processed, resulting in wrong judgment.

No functional changes in this patch.
2020-02-06 09:56:00 +08:00
25a6d6abbe Make cmake and maven configurable (#2837) 2020-02-05 23:04:29 +08:00
581c771ff3 [Doc] Add create index usage document (#2832) 2020-02-05 15:35:41 +08:00
ee5323a6a0 [Code Refactor]Improve initialization flow of Schema (#2833)
When constructing `Schema` objects, two similar `init` functions
need to be called, and the call order is implicitly required, which
is easy to be misused. At the same time, some of the existing comments
are missing or out of date, which will cause some misleading.

This patch unifies the initialization logic of `Schema`.

No functional changes in this patch.
2020-02-05 11:48:54 +08:00