github-actions[bot] commented on code in PR #44205: URL: https://github.com/apache/doris/pull/44205#discussion_r1848182124
########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } Review Comment: warning: use of undeclared identifier 'lucene' [clang-diagnostic-error] ```cpp void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: 'D' does not refer to a value [clang-diagnostic-error] ```cpp void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { ^ ``` <details> <summary>Additional context</summary> **be/src/olap/rowset/segment_v2/inverted_index_common.h:30:** declared here ```cpp template <typename T, typename D = std::default_delete<T>> ^ ``` </details> ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: use of undeclared identifier 'context' [clang-diagnostic-error] ```cpp void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { + if (resource) { + try { + resource->close(); + } catch (CLuceneError& err) { + context.eptr = std::current_exception(); + context.err_msg = err.what(); + LOG(ERROR) << "Error occurred while closing resource: " << err.what(); + } catch (...) { + context.eptr = std::current_exception(); + context.err_msg = "Unknown error during resource closure"; + LOG(ERROR) << "Error occurred while closing resource"; + } + } +} + +#define FINALLY_CLOSE(resource) \ + { finally_close(resource, context); } + +// Return ERROR after finally +#define FINALLY_ON_ERROR(finally_block) \ Review Comment: warning: macro is not used [clang-diagnostic-unused-macros] ```cpp #define FINALLY_ON_ERROR(finally_block) \ ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::string err_msg; ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::exception_ptr eptr; ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: 'T' does not refer to a value [clang-diagnostic-error] ```cpp void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { ^ ``` <details> <summary>Additional context</summary> **be/src/olap/rowset/segment_v2/inverted_index_common.h:30:** declared here ```cpp template <typename T, typename D = std::default_delete<T>> ^ ``` </details> ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp template <typename T, typename D = std::default_delete<T>> ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: variable has incomplete type 'void' [clang-diagnostic-error] ```cpp void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: use of undeclared identifier 'resource' [clang-diagnostic-error] ```cpp void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: expected unqualified-id [clang-diagnostic-error] ```cpp void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { + if (resource) { + try { + resource->close(); + } catch (CLuceneError& err) { + context.eptr = std::current_exception(); + context.err_msg = err.what(); + LOG(ERROR) << "Error occurred while closing resource: " << err.what(); + } catch (...) { + context.eptr = std::current_exception(); + context.err_msg = "Unknown error during resource closure"; + LOG(ERROR) << "Error occurred while closing resource"; + } + } +} + +#define FINALLY_CLOSE(resource) \ Review Comment: warning: macro is not used [clang-diagnostic-unused-macros] ```cpp #define FINALLY_CLOSE(resource) \ ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { + if (resource) { + try { + resource->close(); + } catch (CLuceneError& err) { + context.eptr = std::current_exception(); + context.err_msg = err.what(); + LOG(ERROR) << "Error occurred while closing resource: " << err.what(); + } catch (...) { + context.eptr = std::current_exception(); + context.err_msg = "Unknown error during resource closure"; + LOG(ERROR) << "Error occurred while closing resource"; + } + } +} + +#define FINALLY_CLOSE(resource) \ + { finally_close(resource, context); } + +// Return ERROR after finally +#define FINALLY_ON_ERROR(finally_block) \ + { \ + static_assert(sizeof(context) > 0, "context must be defined before using FINALLY macro!"); \ + finally_block; \ + if (context.eptr) { \ + return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(context.err_msg); \ + } \ + } + +// Re-throw the exception after finally +#define FINALLY_ON_EXCEPTION(finally_block) \ Review Comment: warning: macro is not used [clang-diagnostic-unused-macros] ```cpp #define FINALLY_ON_EXCEPTION(finally_block) \ ^ ``` ########## be/src/olap/rowset/segment_v2/inverted_index_common.h: ########## @@ -0,0 +1,71 @@ +// 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. + +#pragma once + +namespace doris::segment_v2 { + +struct DirectoryDeleter { + void operator()(lucene::store::Directory* ptr) const { _CLDECDELETE(ptr); } +}; + +struct ErrorContext { + std::string err_msg; + std::exception_ptr eptr; +}; + +template <typename T, typename D = std::default_delete<T>> +void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context) { Review Comment: warning: expected ';' at end of declaration [clang-diagnostic-error] ```suggestion void finally_close(std::unique_ptr<T, D>& resource, ErrorContext& context); { ``` -- 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