You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "w41ter (via GitHub)" <gi...@apache.org> on 2024/09/04 03:01:56 UTC

[PR] [feature](restore) support atomic restore [doris]

w41ter opened a new pull request, #40353:
URL: https://github.com/apache/doris/pull/40353

   Previously, during a restore job, if the OLAP table already existed, it would be marked with a RESTORE status, preventing any read or write operations.
   
   This PR introduces an atomic restore feature. If enabled, data will first be loaded into a temporary table during the restore, and then atomically replace the original table, ensuring that the target table's read and write operations remain unaffected during the restore process.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #40353:
URL: https://github.com/apache/doris/pull/40353#discussion_r1745723223


##########
fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java:
##########
@@ -2135,6 +2264,86 @@ public void cancelInternal(boolean isReplay) {
         LOG.info("finished to cancel restore job. is replay: {}. {}", isReplay, this);
     }
 
+    private Status atomicReplaceOlapTables(Database db, boolean isReplay) {
+        assert isAtomicRestore;
+        for (String tableName : jobInfo.backupOlapTableObjects.keySet()) {
+            String originName = jobInfo.getAliasByOriginNameIfSet(tableName);
+            if (Env.isStoredTableNamesLowerCase()) {
+                originName = originName.toLowerCase();
+            }
+            String aliasName = tableAliasWithAtomicRestore(originName);
+
+            if (!db.writeLockIfExist()) {
+                return Status.OK;
+            }
+            try {
+                Table newTbl = db.getTableNullable(aliasName);
+                if (newTbl == null) {
+                    LOG.warn("replace table from {} to {}, but the temp table is not found", aliasName, originName);
+                    return new Status(ErrCode.COMMON_ERROR, "replace table failed, the temp table "
+                            + aliasName + " is not found");
+                }
+                if (newTbl.getType() != TableType.OLAP) {
+                    LOG.warn("replace table from {} to {}, but the temp table is not OLAP, it type is {}",
+                            aliasName, originName, newTbl.getType());
+                    return new Status(ErrCode.COMMON_ERROR, "replace table failed, the temp table " + aliasName
+                            + " is not OLAP table, it is " + newTbl.getType());
+                }
+
+                OlapTable originOlapTbl = null;
+                Table originTbl = db.getTableNullable(originName);
+                if (originTbl != null) {
+                    if (originTbl.getType() != TableType.OLAP) {
+                        LOG.warn("replace table from {} to {}, but the origin table is not OLAP, it type is {}",
+                                aliasName, originName, originTbl.getType());
+                        return new Status(ErrCode.COMMON_ERROR, "replace table failed, the origin table "
+                                + originName + " is not OLAP table, it is " + originTbl.getType());
+                    }
+                    originOlapTbl = (OlapTable) originTbl;  // save the origin olap table, then drop it.
+                }
+
+                // replace the table.
+                OlapTable newOlapTbl = (OlapTable) newTbl;
+                newOlapTbl.writeLock();
+                try {
+                    // rename new table name to origin table name and add the new table to database.
+                    db.unregisterTable(aliasName);
+                    newOlapTbl.checkAndSetName(originName, false);
+                    db.unregisterTable(originName);
+                    db.registerTable(newOlapTbl);
+
+                    // set the olap table state to normal immediately for querying
+                    newOlapTbl.setState(OlapTableState.NORMAL);
+                    LOG.info("atomic restore replace table {} name to {}, and set state to normal, origin table={}",
+                            newOlapTbl.getId(), originName, originOlapTbl == null ? -1L : originOlapTbl.getId());
+                } catch (DdlException e) {
+                    LOG.warn("atomic restore replace table {} name from {} to {}",
+                            newOlapTbl.getId(), aliasName, originName, e);
+                    return new Status(ErrCode.COMMON_ERROR, "replace table from " + aliasName + " to " + originName
+                            + " failed, reason=" + e.getMessage());
+                } finally {
+                    newOlapTbl.writeUnlock();
+                }
+
+                if (originOlapTbl != null) {
+                    // The origin table is not used anymore, need to drop all its tablets.
+                    originOlapTbl.writeLock();
+                    try {
+                        LOG.info("drop the origin olap table {} by atomic restore. table={}",
+                                originOlapTbl.getName(), originOlapTbl.getId());
+                        Env.getCurrentEnv().onEraseOlapTable(originOlapTbl, isReplay);

Review Comment:
   For safety, should we put it in recylebin?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #40353:
URL: https://github.com/apache/doris/pull/40353#discussion_r1745718543


##########
fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java:
##########
@@ -2135,6 +2264,86 @@ public void cancelInternal(boolean isReplay) {
         LOG.info("finished to cancel restore job. is replay: {}. {}", isReplay, this);
     }
 
+    private Status atomicReplaceOlapTables(Database db, boolean isReplay) {
+        assert isAtomicRestore;
+        for (String tableName : jobInfo.backupOlapTableObjects.keySet()) {
+            String originName = jobInfo.getAliasByOriginNameIfSet(tableName);
+            if (Env.isStoredTableNamesLowerCase()) {
+                originName = originName.toLowerCase();
+            }
+            String aliasName = tableAliasWithAtomicRestore(originName);
+
+            if (!db.writeLockIfExist()) {
+                return Status.OK;

Review Comment:
   Should we return an error?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2333549685

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 31.43 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit 51f49fdbc46e8a51971abe078154f7d519b66d63, data reload: false
   
   query1	0.04	0.05	0.04
   query2	0.07	0.04	0.04
   query3	0.22	0.07	0.07
   query4	1.65	0.08	0.07
   query5	0.51	0.49	0.49
   query6	1.14	0.72	0.72
   query7	0.01	0.01	0.02
   query8	0.06	0.05	0.05
   query9	0.54	0.50	0.48
   query10	0.55	0.54	0.54
   query11	0.14	0.12	0.12
   query12	0.15	0.12	0.12
   query13	0.60	0.60	0.59
   query14	1.41	1.42	1.45
   query15	0.82	0.82	0.81
   query16	0.36	0.36	0.37
   query17	1.02	0.98	1.02
   query18	0.20	0.19	0.20
   query19	1.87	1.78	1.84
   query20	0.01	0.01	0.01
   query21	15.39	0.69	0.68
   query22	4.74	7.23	1.85
   query23	18.25	1.44	1.22
   query24	2.18	0.23	0.22
   query25	0.15	0.08	0.08
   query26	0.27	0.18	0.17
   query27	0.08	0.08	0.07
   query28	13.18	1.03	1.00
   query29	12.59	3.33	3.36
   query30	0.24	0.06	0.05
   query31	2.88	0.40	0.40
   query32	3.24	0.48	0.49
   query33	3.00	3.02	3.05
   query34	17.02	4.41	4.42
   query35	4.48	4.49	4.56
   query36	0.66	0.47	0.46
   query37	0.19	0.16	0.16
   query38	0.16	0.15	0.15
   query39	0.05	0.04	0.04
   query40	0.16	0.13	0.13
   query41	0.10	0.05	0.05
   query42	0.06	0.04	0.05
   query43	0.04	0.04	0.04
   Total cold run time: 110.48 s
   Total hot run time: 31.43 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2333539913

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 192718 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 51f49fdbc46e8a51971abe078154f7d519b66d63, data reload: false
   
   query1	1246	905	871	871
   query2	6432	1863	1832	1832
   query3	10746	4227	4088	4088
   query4	59898	26456	23272	23272
   query5	5358	498	505	498
   query6	413	158	162	158
   query7	5776	289	290	289
   query8	323	222	224	222
   query9	8827	2504	2474	2474
   query10	485	271	265	265
   query11	18040	15076	15451	15076
   query12	155	104	103	103
   query13	1567	407	398	398
   query14	11179	7734	7545	7545
   query15	232	176	167	167
   query16	7137	451	480	451
   query17	1112	585	569	569
   query18	1891	318	298	298
   query19	291	151	157	151
   query20	123	111	109	109
   query21	210	110	106	106
   query22	4884	4366	4720	4366
   query23	34528	33415	33448	33415
   query24	5915	2844	2797	2797
   query25	515	384	379	379
   query26	677	159	158	158
   query27	1761	274	274	274
   query28	3730	2038	2013	2013
   query29	650	404	396	396
   query30	235	147	152	147
   query31	927	768	781	768
   query32	85	53	54	53
   query33	447	275	284	275
   query34	863	468	449	449
   query35	848	721	715	715
   query36	1041	928	940	928
   query37	140	89	84	84
   query38	3982	3938	3883	3883
   query39	1423	1402	1380	1380
   query40	197	117	115	115
   query41	48	47	47	47
   query42	119	95	97	95
   query43	503	508	473	473
   query44	1064	741	743	741
   query45	194	168	166	166
   query46	1086	715	778	715
   query47	1874	1800	1815	1800
   query48	380	278	298	278
   query49	771	438	432	432
   query50	822	398	413	398
   query51	7005	6903	7005	6903
   query52	100	84	83	83
   query53	247	174	178	174
   query54	553	441	441	441
   query55	75	74	73	73
   query56	266	258	256	256
   query57	1178	1062	1075	1062
   query58	218	223	227	223
   query59	3063	3169	2712	2712
   query60	289	271	270	270
   query61	101	102	97	97
   query62	745	656	651	651
   query63	213	181	183	181
   query64	2660	679	696	679
   query65	3208	3121	3170	3121
   query66	675	336	337	336
   query67	15349	15302	15154	15154
   query68	2997	571	566	566
   query69	389	267	272	267
   query70	1162	1132	1126	1126
   query71	365	274	264	264
   query72	5324	4072	3986	3986
   query73	749	311	319	311
   query74	9083	8931	8917	8917
   query75	3366	2681	2674	2674
   query76	1396	944	1017	944
   query77	531	324	316	316
   query78	9566	9086	9153	9086
   query79	1037	557	537	537
   query80	692	501	500	500
   query81	529	230	232	230
   query82	283	145	131	131
   query83	166	148	148	148
   query84	266	71	76	71
   query85	683	361	275	275
   query86	295	311	299	299
   query87	4443	4249	4270	4249
   query88	3223	2276	2244	2244
   query89	375	286	283	283
   query90	1896	185	182	182
   query91	121	98	96	96
   query92	58	46	48	46
   query93	1054	534	531	531
   query94	651	287	310	287
   query95	313	243	244	243
   query96	581	261	258	258
   query97	3160	3044	3056	3044
   query98	211	204	204	204
   query99	1728	1305	1323	1305
   Total cold run time: 303788 ms
   Total hot run time: 192718 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2333517830

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 38352 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 51f49fdbc46e8a51971abe078154f7d519b66d63, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	18727	5458	4339	4339
   q2	2021	190	188	188
   q3	11893	962	1057	962
   q4	10292	680	668	668
   q5	7750	2837	2865	2837
   q6	226	139	135	135
   q7	971	623	594	594
   q8	9335	2091	2153	2091
   q9	7058	6597	6587	6587
   q10	7019	2264	2175	2175
   q11	463	246	249	246
   q12	392	223	220	220
   q13	18008	3083	3085	3083
   q14	278	240	239	239
   q15	545	490	481	481
   q16	520	440	432	432
   q17	1026	724	692	692
   q18	7369	6986	7134	6986
   q19	1396	1028	1043	1028
   q20	708	331	339	331
   q21	4721	3023	3013	3013
   q22	1137	1053	1025	1025
   Total cold run time: 111855 ms
   Total hot run time: 38352 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	4362	4319	4292	4292
   q2	384	274	270	270
   q3	2934	2638	2676	2638
   q4	1900	1605	1806	1605
   q5	5712	5697	5744	5697
   q6	235	138	131	131
   q7	2211	1838	1836	1836
   q8	3292	3483	3502	3483
   q9	8807	8836	8886	8836
   q10	3653	3391	3331	3331
   q11	615	507	524	507
   q12	826	684	656	656
   q13	13145	3281	3302	3281
   q14	324	286	279	279
   q15	538	494	492	492
   q16	543	490	509	490
   q17	1859	1568	1571	1568
   q18	8120	7899	7863	7863
   q19	1741	1658	1568	1568
   q20	2157	1882	1923	1882
   q21	5633	5613	5413	5413
   q22	1128	1087	1091	1087
   Total cold run time: 70119 ms
   Total hot run time: 57205 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2327826562

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328208745

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on code in PR #40353:
URL: https://github.com/apache/doris/pull/40353#discussion_r1746377797


##########
fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java:
##########
@@ -2135,6 +2264,86 @@ public void cancelInternal(boolean isReplay) {
         LOG.info("finished to cancel restore job. is replay: {}. {}", isReplay, this);
     }
 
+    private Status atomicReplaceOlapTables(Database db, boolean isReplay) {
+        assert isAtomicRestore;
+        for (String tableName : jobInfo.backupOlapTableObjects.keySet()) {
+            String originName = jobInfo.getAliasByOriginNameIfSet(tableName);
+            if (Env.isStoredTableNamesLowerCase()) {
+                originName = originName.toLowerCase();
+            }
+            String aliasName = tableAliasWithAtomicRestore(originName);
+
+            if (!db.writeLockIfExist()) {
+                return Status.OK;

Review Comment:
   No, the rest of the code does the same thing, so it's best to be consistent here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328041708

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2333510618

   TeamCity be ut coverage result:
    Function Coverage: 36.86% (9380/25450) 
    Line Coverage: 28.23% (77344/273979)
    Region Coverage: 27.62% (39929/144552)
    Branch Coverage: 24.26% (20324/83778)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/51f49fdbc46e8a51971abe078154f7d519b66d63_51f49fdbc46e8a51971abe078154f7d519b66d63/report/index.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on code in PR #40353:
URL: https://github.com/apache/doris/pull/40353#discussion_r1746378211


##########
fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java:
##########
@@ -2135,6 +2264,86 @@ public void cancelInternal(boolean isReplay) {
         LOG.info("finished to cancel restore job. is replay: {}. {}", isReplay, this);
     }
 
+    private Status atomicReplaceOlapTables(Database db, boolean isReplay) {
+        assert isAtomicRestore;
+        for (String tableName : jobInfo.backupOlapTableObjects.keySet()) {
+            String originName = jobInfo.getAliasByOriginNameIfSet(tableName);
+            if (Env.isStoredTableNamesLowerCase()) {
+                originName = originName.toLowerCase();
+            }
+            String aliasName = tableAliasWithAtomicRestore(originName);
+
+            if (!db.writeLockIfExist()) {
+                return Status.OK;
+            }
+            try {
+                Table newTbl = db.getTableNullable(aliasName);
+                if (newTbl == null) {
+                    LOG.warn("replace table from {} to {}, but the temp table is not found", aliasName, originName);
+                    return new Status(ErrCode.COMMON_ERROR, "replace table failed, the temp table "
+                            + aliasName + " is not found");
+                }
+                if (newTbl.getType() != TableType.OLAP) {
+                    LOG.warn("replace table from {} to {}, but the temp table is not OLAP, it type is {}",
+                            aliasName, originName, newTbl.getType());
+                    return new Status(ErrCode.COMMON_ERROR, "replace table failed, the temp table " + aliasName
+                            + " is not OLAP table, it is " + newTbl.getType());
+                }
+
+                OlapTable originOlapTbl = null;
+                Table originTbl = db.getTableNullable(originName);
+                if (originTbl != null) {
+                    if (originTbl.getType() != TableType.OLAP) {
+                        LOG.warn("replace table from {} to {}, but the origin table is not OLAP, it type is {}",
+                                aliasName, originName, originTbl.getType());
+                        return new Status(ErrCode.COMMON_ERROR, "replace table failed, the origin table "
+                                + originName + " is not OLAP table, it is " + originTbl.getType());
+                    }
+                    originOlapTbl = (OlapTable) originTbl;  // save the origin olap table, then drop it.
+                }
+
+                // replace the table.
+                OlapTable newOlapTbl = (OlapTable) newTbl;
+                newOlapTbl.writeLock();
+                try {
+                    // rename new table name to origin table name and add the new table to database.
+                    db.unregisterTable(aliasName);
+                    newOlapTbl.checkAndSetName(originName, false);
+                    db.unregisterTable(originName);
+                    db.registerTable(newOlapTbl);
+
+                    // set the olap table state to normal immediately for querying
+                    newOlapTbl.setState(OlapTableState.NORMAL);
+                    LOG.info("atomic restore replace table {} name to {}, and set state to normal, origin table={}",
+                            newOlapTbl.getId(), originName, originOlapTbl == null ? -1L : originOlapTbl.getId());
+                } catch (DdlException e) {
+                    LOG.warn("atomic restore replace table {} name from {} to {}",
+                            newOlapTbl.getId(), aliasName, originName, e);
+                    return new Status(ErrCode.COMMON_ERROR, "replace table from " + aliasName + " to " + originName
+                            + " failed, reason=" + e.getMessage());
+                } finally {
+                    newOlapTbl.writeUnlock();
+                }
+
+                if (originOlapTbl != null) {
+                    // The origin table is not used anymore, need to drop all its tablets.
+                    originOlapTbl.writeLock();
+                    try {
+                        LOG.info("drop the origin olap table {} by atomic restore. table={}",
+                                originOlapTbl.getName(), originOlapTbl.getId());
+                        Env.getCurrentEnv().onEraseOlapTable(originOlapTbl, isReplay);

Review Comment:
   no



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328271639

   TeamCity be ut coverage result:
    Function Coverage: 36.85% (9395/25495) 
    Line Coverage: 28.27% (77439/273949)
    Region Coverage: 27.68% (39976/144441)
    Branch Coverage: 24.30% (20330/83646)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/617247447fa0344a7db86f7674ac554488991b36_617247447fa0344a7db86f7674ac554488991b36/report/index.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328653197

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328353649

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 39366 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 617247447fa0344a7db86f7674ac554488991b36, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17983	4517	4367	4367
   q2	2020	217	212	212
   q3	18024	1076	1165	1076
   q4	10470	813	791	791
   q5	7461	1145	1193	1145
   q6	212	146	152	146
   q7	1001	548	535	535
   q8	9374	1474	1399	1399
   q9	7913	7090	7312	7090
   q10	9585	4899	4867	4867
   q11	475	269	276	269
   q12	453	255	265	255
   q13	17826	3142	3077	3077
   q14	476	412	443	412
   q15	618	549	531	531
   q16	659	546	547	546
   q17	991	800	710	710
   q18	7675	6991	7166	6991
   q19	1404	1001	1061	1001
   q20	729	375	395	375
   q21	3833	3445	3264	3264
   q22	385	315	307	307
   Total cold run time: 119567 ms
   Total hot run time: 39366 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	4423	4315	4283	4283
   q2	543	453	414	414
   q3	2987	2779	2962	2779
   q4	2025	1824	1778	1778
   q5	5652	5687	5593	5593
   q6	232	137	141	137
   q7	7221	6851	6794	6794
   q8	3484	3490	3513	3490
   q9	9234	9339	9320	9320
   q10	3617	3297	3344	3297
   q11	618	520	498	498
   q12	834	661	598	598
   q13	15562	3374	3371	3371
   q14	344	290	305	290
   q15	542	473	484	473
   q16	615	608	612	608
   q17	1890	1578	1550	1550
   q18	8373	7881	7888	7881
   q19	1803	1501	1574	1501
   q20	2130	1881	1900	1881
   q21	5779	5727	5502	5502
   q22	1202	1115	1068	1068
   Total cold run time: 79110 ms
   Total hot run time: 63106 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2333408075

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2327826195

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2327853219

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2327830982

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2327848224

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2327820912

   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR)
   
   Since 2024-03-18, the Document has been moved to [doris-website](https://github.com/apache/doris-website).
   See [Doris Document](https://cwiki.apache.org/confluence/display/DORIS/Doris+Document).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2327821054

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328032473

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2335722369

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2335722401

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2333322866

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "gavinchou (via GitHub)" <gi...@apache.org>.
gavinchou merged PR #40353:
URL: https://github.com/apache/doris/pull/40353


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328677673

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [feature](restore) support atomic restore [doris]

Posted by "w41ter (via GitHub)" <gi...@apache.org>.
w41ter commented on PR #40353:
URL: https://github.com/apache/doris/pull/40353#issuecomment-2328049340

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org