Skip to content

Conversation

@wuwenchi
Copy link
Contributor

@wuwenchi wuwenchi commented Apr 29, 2024

Proposed changes

_temp_<table_name> to _temp_<queryid>_<table_name>.
Prevent users from having a table with the name _temp_<table_name>.

So as to partition temp dir

Issue #31442

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@wuwenchi
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 41029 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit bfbfdc67de279bad97ef64ed6f225c627f12e7e7, data reload: false

------ Round 1 ----------------------------------
q1	17939	4483	4390	4390
q2	2907	196	210	196
q3	11190	1237	1237	1237
q4	10155	860	855	855
q5	7567	2693	2717	2693
q6	211	128	133	128
q7	1048	589	586	586
q8	9212	2100	2068	2068
q9	8872	6630	6557	6557
q10	8776	3764	3729	3729
q11	458	243	235	235
q12	389	222	232	222
q13	17750	2925	2975	2925
q14	273	233	227	227
q15	517	475	470	470
q16	476	405	388	388
q17	957	687	647	647
q18	7969	7537	7408	7408
q19	1626	1536	1518	1518
q20	654	310	309	309
q21	5100	3968	4207	3968
q22	341	273	276	273
Total cold run time: 114387 ms
Total hot run time: 41029 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4712	4186	4215	4186
q2	367	269	266	266
q3	2996	2739	2705	2705
q4	1848	1658	1608	1608
q5	5319	5277	5291	5277
q6	211	121	124	121
q7	2199	1854	1868	1854
q8	3164	3340	3301	3301
q9	8521	8533	8559	8533
q10	3852	3618	3694	3618
q11	577	477	477	477
q12	734	588	590	588
q13	17365	2940	2919	2919
q14	313	284	269	269
q15	519	464	472	464
q16	472	435	431	431
q17	1728	1474	1466	1466
q18	7572	7417	7360	7360
q19	1624	1500	1569	1500
q20	1973	1774	1773	1773
q21	4907	4817	4851	4817
q22	588	478	493	478
Total cold run time: 71561 ms
Total hot run time: 54011 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 186745 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit bfbfdc67de279bad97ef64ed6f225c627f12e7e7, data reload: false

query1	902	355	346	346
query2	6455	2334	2310	2310
query3	6974	205	208	205
query4	22913	21541	21115	21115
query5	4186	424	430	424
query6	264	178	171	171
query7	4580	287	287	287
query8	238	185	211	185
query9	8499	2371	2354	2354
query10	424	245	250	245
query11	14986	14176	14197	14176
query12	132	90	87	87
query13	1637	355	356	355
query14	9642	7569	7181	7181
query15	248	166	174	166
query16	8128	266	259	259
query17	1870	571	556	556
query18	2103	282	279	279
query19	231	175	150	150
query20	94	85	82	82
query21	194	129	125	125
query22	5024	4830	4851	4830
query23	33877	33537	33301	33301
query24	12122	2989	2907	2907
query25	668	374	374	374
query26	1745	162	151	151
query27	3090	317	325	317
query28	7519	2033	2028	2028
query29	1021	609	592	592
query30	281	148	154	148
query31	989	737	713	713
query32	94	53	55	53
query33	755	244	254	244
query34	1096	480	486	480
query35	803	689	685	685
query36	1075	927	906	906
query37	276	68	67	67
query38	3165	3005	3017	3005
query39	1600	1544	1545	1544
query40	281	129	125	125
query41	46	39	38	38
query42	106	97	97	97
query43	561	543	522	522
query44	1185	721	746	721
query45	292	277	263	263
query46	1082	738	730	730
query47	1944	1847	1837	1837
query48	371	301	303	301
query49	1206	408	422	408
query50	770	392	427	392
query51	6849	6749	6591	6591
query52	104	92	95	92
query53	352	278	280	278
query54	312	237	247	237
query55	78	72	72	72
query56	247	224	223	223
query57	1200	1134	1112	1112
query58	229	205	205	205
query59	3491	3174	3205	3174
query60	272	232	237	232
query61	94	90	93	90
query62	677	445	430	430
query63	305	281	280	280
query64	9463	7221	7104	7104
query65	3129	3029	3048	3029
query66	1382	343	344	343
query67	15474	15291	14907	14907
query68	5152	543	534	534
query69	484	305	308	305
query70	1152	1104	1132	1104
query71	397	270	269	269
query72	7118	2658	2429	2429
query73	698	326	335	326
query74	6462	6081	6111	6081
query75	3377	2642	2711	2642
query76	3108	1074	961	961
query77	398	268	269	268
query78	10847	10199	10206	10199
query79	3213	519	529	519
query80	1771	440	438	438
query81	513	222	219	219
query82	847	109	100	100
query83	267	172	171	171
query84	267	90	87	87
query85	2118	280	351	280
query86	482	318	311	311
query87	3286	3146	3140	3140
query88	4455	2403	2412	2403
query89	499	374	367	367
query90	2007	191	186	186
query91	122	97	98	97
query92	60	51	49	49
query93	4897	524	517	517
query94	1237	190	188	188
query95	1097	1100	1096	1096
query96	600	268	260	260
query97	3168	2930	2926	2926
query98	230	209	216	209
query99	1234	847	828	828
Total cold run time: 292965 ms
Total hot run time: 186745 ms

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 29, 2024
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@kaka11chen kaka11chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman merged commit 3656bd3 into apache:master Apr 30, 2024
morningman pushed a commit to morningman/doris that referenced this pull request Apr 30, 2024
…he#34278)

`_temp_<table_name>` to `_temp_<queryid>_<table_name>`.
Prevent users from having a table with the name `_temp_<table_name>`.

So as to partition temp dir
morningman added a commit that referenced this pull request Apr 30, 2024
…) (#34368)

bp #34278

Co-authored-by: wuwenchi <wuwenchihdu@hotmail.com>
morningman pushed a commit to morningman/doris that referenced this pull request Apr 30, 2024
…he#34278)

`_temp_<table_name>` to `_temp_<queryid>_<table_name>`.
Prevent users from having a table with the name `_temp_<table_name>`.

So as to partition temp dir
dataroaring pushed a commit that referenced this pull request May 1, 2024
…4.0 (#34371)

* [feature](insert)use optional location and add hive regression test (#33153)

* [feature](iceberg)The new DDL syntax is added to create iceberg partitioned tables (#33338)

support partition by :

```
create table tb1 (c1 string, ts datetime) engine = iceberg partition by (c1, day(ts)) () properties ("a"="b")
```

* [Enhancement](hive-writer) Adjust table sink exchange rebalancer params. (#33397)

Issue Number:  #31442

Change table sink exchange rebalancer params to node level and adjust these params to improve write performance by better balance.

rebalancer params:
```
DEFINE_mInt64(table_sink_partition_write_min_data_processed_rebalance_threshold,
              "26214400"); // 25MB
// Minimum partition data processed to rebalance writers in exchange when partition writing
DEFINE_mInt64(table_sink_partition_write_min_partition_data_processed_rebalance_threshold,
              "15728640"); // 15MB
```

* [feature](profile) add transaction statistics for profile (#33488)

1. commit total time
2. fs operator total time
     rename file count
     rename dir count
     delete dir count
3. add partition total time
    add partition count
4. update partition total time
    update partition count
like:
```
      -  Transaction  Commit  Time:  906ms
          -  FileSystem  Operator  Time:  833ms
              -  Rename  File  Count:  4
              -  Rename  Dir  Count:  0
              -  Delete  Dir  Count:  0
          -  HMS  Add  Partition  Time:  0ms
              -  HMS  Add  Partition  Count:  0
          -  HMS  Update  Partition  Time:  68ms
              -  HMS  Update  Partition  Count:  4
```

* [feature](iceberg) add iceberg transaction implement (#33629)

Issue #31442

add iceberg transaction

* [feature](insert)support default value when create hive table (#33666)

Issue Number: #31442

hive3 support create table with column's default value
if use hive3, we can write default value to table

* [refactor](filesystem)refactor `filesystem` interface (#33361)

1. Remame`list` to `globList` . The path of this `list` needs to have a wildcard character, and the corresponding hdfs interface is `globStatus`, so the modified name is `globList`.
2. If you only need to view files based on paths, you can use the `listFiles` operation.
3. Merge `listLocatedFiles` function into `listFiles` function.

* [opt](meta-cache) refine the meta cache (#33449)

1. Use `caffeine` instead of `guava cache` to get better performace
2. Add a new class `CacheFactory`

    All (Async)LoadingCache should be built from `CacheFactory`

3. Use separator executor for different caches

    1. rowCountRefreshExecutor
      For row count cache.
      Row count cache is an async loading cache, and we can ignore the result
      if cache missing or thread pool is full.
      So use a separate executor for this cache.

    2.  commonRefreshExecutor
      For other caches. Other caches are sync loading cache.
      But commonRefreshExecutor will be used for async refresh.
      That is, if cache entry is missing, the cache value will be loaded in caller thread, sychronously.
      if cache entry need refresh, it will be reloaded in commonRefreshExecutor.

    3. fileListingExecutor
      File listing is a heavy operation, so use a separate executor for it.
      For fileCache, the refresh operation will still use commonRefreshExecutor to trigger refresh.
      And fileListingExecutor will be used to list file.

4. Change the refresh and expire logic of caches

    For most of caches, set `refreshAfterWrite` strategy, so that
    even if the cache entry is expired, the old entry can still be
    used while new entry is being loaded.

5. Add new global variable `enable_get_row_count_from_file_list`

    Default is true, if false, will disable getting row count from file list

* [bugfix](hive)delete write path after hive insert (#33798)

Issue #31442

1. delete file according query id
2. delete write path after insert

* [Enhancement](multi-catalog) Rewrite `S3URI` to remove tricky virtual bucket mechanism and support different uri styles by flags. (#33858)

Many domestic cloud vendors are compatible with the s3 protocol. However, early versions of s3 client will only generate path style http requests (aws/aws-sdk-java-v2#763) when encountering endpoints that do not start with s3, while some cloud vendors only support virtual host style http request.

Therefore, Doris used `forceVirtualHosted` in `S3URI` to convert it into a virtual hosted path and implemented it through path style.
For example:
For s3 uri `s3://my-bucket/data/file.txt`, It will eventually be parsed into:
- virtualBucket: my-bucket
- Bucket: data (bucket must be set, otherwise the s3 client will report an error) Especially this step is particularly tricky because of the limitations of the s3 client.
- Key: file.txt

 The path style mode is used to generate an http request similar to the virtual host by setting the endpoint to virtualBucket + original endpoint, setting the bucket and key.
**However, the bucket and key here are inconsistent with the original concepts of s3, but the aws client happens to be able to generate an http request similar to the virtual host through the path style mode.**

However, after #30799 we have upgrade the aws sdk version from 2.17.257 to 2.20.131. The current aws s3 client can already generate a virtual host by third party by default style of http request. So in #31111 need to set the path style option, let the s3 client use doris' virtual bucket mechanism to continue working.

**Finally, the virtual bucket mechanism is too confusing and tricky, and we no longer need it with the new version of s3 client.**

### Resolution:

Rewrite `S3URI` to remove tricky virtual bucket mechanism and support different uri styles by flags.

This class represents a fully qualified location in S3 for input/output operations expressed as as URI.
 #### For AWS S3, URI common styles:
  - AWS Client Style(Hadoop S3 Style): `s3://my-bucket/path/to/file?versionId=abc123&partNumber=77&partNumber=88`
  - Virtual Host Style: `https://my-bucket.s3.us-west-1.amazonaws.com/resources/doc.txt?versionId=abc123&partNumber=77&partNumber=88`
  - Path Style: `https://s3.us-west-1.amazonaws.com/my-bucket/resources/doc.txt?versionId=abc123&partNumber=77&partNumber=88`
 
  Regarding the above-mentioned common styles, we can use <code>isPathStyle</code> to control whether to use path style
  or virtual host style.
  "Virtual host style" is the currently mainstream and recommended approach to use, so the default value of
  <code>isPathStyle</code> is false.
 
  #### Other Styles:
  - Virtual Host AWS Client (Hadoop S3) Mixed Style:
    `s3://my-bucket.s3.us-west-1.amazonaws.com/resources/doc.txt?versionId=abc123&partNumber=77&partNumber=88`
  - Path AWS Client (Hadoop S3) Mixed Style:
     `s3://s3.us-west-1.amazonaws.com/my-bucket/resources/doc.txt?versionId=abc123&partNumber=77&partNumber=88`
 
  For these two styles, we can use <code>isPathStyle</code> and <code>forceParsingByStandardUri</code>
  to control whether to use.
  Virtual Host AWS Client (Hadoop S3) Mixed Style: <code>isPathStyle = false && forceParsingByStandardUri = true</code>
  Path AWS Client (Hadoop S3) Mixed Style: <code>isPathStyle = true && forceParsingByStandardUri = true</code>
 
  When the incoming location is url encoded, the encoded string will be returned.
  For <code>getKey()</code>, <code>getQueryParams()</code> will return the encoding string

* [improvement](hive)add the `queryid` to the temporary file path (#34278)

`_temp_<table_name>` to `_temp_<queryid>_<table_name>`.
Prevent users from having a table with the name `_temp_<table_name>`.

So as to partition temp dir

* [feature](Cloud) Load index data into index cache when writing data (#34046)

* [Feature](hive-writer) Implements s3 file committer. (#33937)

Issue Number: #31442

[Feature] (hive-writer) Implements s3 file committer. 

S3 committer will start multipart uploading all files on BE side, and then complete multipart upload these files on FE side. If you do not complete multi parts of a file, the file will not be visible. So in this way, the atomicity of a single file can be guaranteed. But it still cannot guarantee the atomicity of multiple files. Because hive committers have best-effort semantics, this shortens the inconsistent time window.

## ChangeList:
- Add `used_by_s3_committer` in `FileWriterOptions` on BE side to start multi-part uploading files, then complete multi-part uploading files on FE side.
- `cosn://`use s3 client on FE side, because it need to complete multi-part uploading files on FE side.
-  Add `Status directoryExists(String dir)` and `Status deleteDirectory` in `FileSystem`.

---------

Co-authored-by: slothever <18522955+wsjz@users.noreply.github.com>
Co-authored-by: wuwenchi <wuwenchihdu@hotmail.com>
Co-authored-by: Qi Chen <kaka11.chen@gmail.com>
Co-authored-by: AlexYue <yj976240184@gmail.com>
ByteYue pushed a commit to ByteYue/doris that referenced this pull request May 15, 2024
…he#34278)

`_temp_<table_name>` to `_temp_<queryid>_<table_name>`.
Prevent users from having a table with the name `_temp_<table_name>`.

So as to partition temp dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/2.1.3-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants