|
|
@@ -1,6 +1,9 @@
|
|
|
import cn.reghao.dfs.store.DfsStoreApplication;
|
|
|
+import cn.reghao.dfs.store.db.mapper.DataBlockMapper;
|
|
|
import cn.reghao.dfs.store.db.mapper.FileMetaMapper;
|
|
|
+import cn.reghao.dfs.store.model.po.DataBlock;
|
|
|
import cn.reghao.dfs.store.model.po.FileMeta;
|
|
|
+import cn.reghao.jutil.jdk.security.DigestUtil;
|
|
|
import cn.reghao.oss.api.dto.ObjectMeta;
|
|
|
import cn.reghao.dfs.store.redis.ds.RedisStringObj;
|
|
|
import cn.reghao.jutil.jdk.db.Page;
|
|
|
@@ -12,6 +15,9 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.security.NoSuchAlgorithmException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -66,4 +72,21 @@ public class RedisTest {
|
|
|
log.info("page -> {}", pageNumber);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ DataBlockMapper dataBlockMapper;
|
|
|
+ private void checkLocalFile(File file) throws IOException, NoSuchAlgorithmException {
|
|
|
+ log.error("--------------------------------------");
|
|
|
+ String absolutePath = file.getAbsolutePath();
|
|
|
+ DataBlock dataBlock = dataBlockMapper.findByPath(absolutePath);
|
|
|
+ if (dataBlock == null) {
|
|
|
+ log.error("{} not exist in data_block", absolutePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ String sha256sum = DigestUtil.sha256sum(absolutePath);
|
|
|
+ FileMeta fileMeta = fileMetaMapper.findBySha256sum(sha256sum);
|
|
|
+ if (fileMeta == null) {
|
|
|
+ log.error("{} not exist in file_meta", absolutePath);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|