Commit d433a87
feat: Send "ensureConsistentRead" to Metastore API for all SELECT queries (#26474)
Summary:
X-link: facebookexternal/presto-facebook#3436
X-link: facebookexternal/presto-facebook#3436
feat: Send "ensureConsistentRead" to Metastore API for all SELECT queries
BREAKING CHANGE: Default metastore replica to be read from for Select queries will be the read replica, and re-after-write users will have to set "prism.force_metastore_primary_enabled" session property to "true"
Reviewed By: singcha
Test Plan:
`ensure_consistent_read` is set to false for Select and Explain queries, and to true for all other type of queries
```
select * from test_adheer_delete limit 100
```
```
headers: [{thrift_metastore_client_info={
"project" : "presto",
"max_num_partitions_to_be_cached" : "1000",
**"ensure_consistent_read" : "false",**
"dw.jobId" : "20251027_045135_00005_ig79c",
"dw.owner" : "prestoui",
"dw.pipeline" : "presto-js-client"
}}]
```
```
CREATE TABLE test_adheer_delete (col1 bigint, col2 bigint) WITH (oncall = 'presto_batch', partitioned_by = ARRAY['col2'])
```
```
headers: [{thrift_metastore_client_info={
"project" : "presto",
"max_num_partitions_to_be_cached" : "1000",
**"ensure_consistent_read" : "true",**
"dw.jobId" : "20251027_043305_00004_ig79c",
"dw.owner" : "prestoui",
"dw.pipeline" : "presto-js-client"
}}]
```
built presto version `0.296-20251028.203517-312`
deployed on test cluster `atn1_adhoctest_t6_ec1`
set the session property `SET SESSION prism.force_metastore_primary_enabled=true;`
ran the query `select * from presto_query_statistics limit 1;` with the query id `20251028_234254_00028_yqy68`
validated the headers with the query `select headers, * from hive_metsatore_logger_logs_inc_archive where ds = '2025-10-28' and dw_environment = 'atn1_adhoctest_t6_ec1' and dw_job_id = '20251028_234254_00028_yqy68'`
{F1983081638}
can see `ensure_consistent_read: true`
ran the same query but without setting the session property, and validated the headers
{F1983082149}
can see `ensure_consistent_read: false`
Differential Revision: D84520611
Pulled By: adheer-araokar1 parent 9ec75df commit d433a87
File tree
5 files changed
+31
-0
lines changed- presto-hive/src/test/java/com/facebook/presto/hive
- presto-main-base/src/main/java/com/facebook/presto
- testing
- presto-spi/src
- main/java/com/facebook/presto/spi
- test/java/com/facebook/presto/spi
5 files changed
+31
-0
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
1250 | 1251 | | |
1251 | 1252 | | |
1252 | 1253 | | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
1253 | 1260 | | |
1254 | 1261 | | |
1255 | 1262 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
312 | 319 | | |
313 | 320 | | |
314 | 321 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
231 | 238 | | |
232 | 239 | | |
233 | 240 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| |||
0 commit comments