wuchong commented on code in PR #1487:
URL: https://github.com/apache/fluss/pull/1487#discussion_r2348502187
##########
fluss-server/src/main/java/org/apache/fluss/server/log/LogManager.java:
##########
@@ -194,6 +195,21 @@ private void loadLogs() {
conf,
clock);
} catch (Exception e) {
+ LOG.error(
+ "Fail to
loadLog from {}",
+ tabletDir,
+ e);
+ if (e
+ instanceof
+
SchemaNotExistException) {
+ LOG.error(
+
"schema not exist, table for {} has already been dropped, the residual deta
will be removed.",
+
tabletDir,
+ e);
+
FileUtils.deleteDirectoryQuietly(
+
tabletDir);
+ return;
Review Comment:
This code is too unreadable, could you refactor this code to not use lambda?
##########
fluss-server/src/main/java/org/apache/fluss/server/log/LogManager.java:
##########
@@ -194,6 +195,21 @@ private void loadLogs() {
conf,
clock);
} catch (Exception e) {
+ LOG.error(
+ "Fail to
loadLog from {}",
+ tabletDir,
+ e);
+ if (e
+ instanceof
+
SchemaNotExistException) {
+ LOG.error(
+
"schema not exist, table for {} has already been dropped, the residual deta
will be removed.",
Review Comment:
```suggestion
"schema not exist, table for {} has already been dropped, the residual data
will be removed.",
```
##########
fluss-server/src/test/java/org/apache/fluss/server/log/DroppedTableRecoveryTest.java:
##########
@@ -0,0 +1,258 @@
+/*
+ * 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.fluss.server.log;
+
+import org.apache.fluss.config.ConfigOptions;
+import org.apache.fluss.metadata.LogFormat;
+import org.apache.fluss.metadata.PhysicalTablePath;
+import org.apache.fluss.metadata.TableBucket;
+import org.apache.fluss.metadata.TablePath;
+import org.apache.fluss.record.LogTestBase;
+import org.apache.fluss.record.MemoryLogRecords;
+import org.apache.fluss.server.zk.NOPErrorHandler;
+import org.apache.fluss.server.zk.ZooKeeperClient;
+import org.apache.fluss.server.zk.ZooKeeperExtension;
+import org.apache.fluss.server.zk.data.TableRegistration;
+import org.apache.fluss.testutils.common.AllCallbackWrapper;
+import org.apache.fluss.utils.clock.SystemClock;
+import org.apache.fluss.utils.concurrent.FlussScheduler;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+
+import static org.apache.fluss.record.TestData.DATA1;
+import static org.apache.fluss.record.TestData.DATA1_SCHEMA;
+import static org.apache.fluss.record.TestData.DATA1_TABLE_DESCRIPTOR;
+import static org.apache.fluss.record.TestData.DATA1_TABLE_ID;
+import static
org.apache.fluss.testutils.DataTestUtils.genMemoryLogRecordsByObject;
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Test for handling recovery from residual data of already dropped tables. */
+final class DroppedTableRecoveryTest extends LogTestBase {
Review Comment:
Could you add a test for `KvManager` and kv tables? I'm not sure whether
KvManager also has this problem, and it seems we haven't cleaned up the kv
tablet dir.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]