w41ter commented on code in PR #32738: URL: https://github.com/apache/doris/pull/32738#discussion_r1542269744
########## fe/fe-core/src/main/java/org/apache/doris/cloud/qe/SnapshotProxy.java: ########## @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.cloud.qe; + +import org.apache.doris.cloud.proto.Cloud; +import org.apache.doris.cloud.rpc.MetaServiceProxy; +import org.apache.doris.common.Config; +import org.apache.doris.rpc.RpcException; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class SnapshotProxy { Review Comment: It is unnecessary to extract the visible version methods into SnapshotProxy. If you want to reorganize the code, then you should put this kind of helper class in the cloud.rpc package, and named it `VersionHelper` might be better. BTW, you have put the code for getting the version in CloudPartition in SnapshotProxy, should the code for getting the version in OlapTable also be put here? ########## cloud/test/recycler_test.cpp: ########## @@ -309,6 +309,21 @@ static int create_version_kv(TxnKv* txn_kv, int64_t table_id, int64_t partition_ return 0; } +static int create_table_version_kv(TxnKv* txn_kv, int64_t table_id) { + auto key = table_version_key({instance_id, db_id, table_id}); + std::string val(sizeof(int64_t), 0); + *reinterpret_cast<int64_t*>(val.data()) = (int64_t) 1; + std::unique_ptr<Transaction> txn; + if (txn_kv->create_txn(&txn) != TxnErrorCode::TXN_OK) { + return -1; + } + txn->put(key, val); + if (txn->commit() != TxnErrorCode::TXN_OK) { + return -1; Review Comment: Do not swallow the TxnErrorCode here, MetaServiceProxy will rely on this return value to retry. -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org