You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by GitBox <gi...@apache.org> on 2021/01/22 03:23:26 UTC
[GitHub] [kylin] zhangayqian opened a new pull request #1555: Fix storage clean up tool
zhangayqian opened a new pull request #1555:
URL: https://github.com/apache/kylin/pull/1555
## Proposed changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
## Types of changes
What types of changes does your code introduce to Kylin?
_Put an `x` in the boxes that apply_
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation Update (if none of the other choices apply)
## Checklist
_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
- [ ] I have create an issue on [Kylin's jira](https://issues.apache.org/jira/browse/KYLIN), and have described the bug/feature there in detail
- [ ] Commit messages in my PR start with the related jira ID, like "KYLIN-0000 Make Kylin project open-source"
- [ ] Compiling and unit tests pass locally with my changes
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] If this change need a document change, I will prepare another pr against the `document` branch
- [ ] Any dependent changes have been merged
## Further comments
If this is a relatively large or complex change, kick off the discussion at user@kylin or dev@kylin by explaining why you chose the solution you did and what alternatives you considered, etc...
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kylin] zzcclp commented on a change in pull request #1555: Fix storage clean up tool
Posted by GitBox <gi...@apache.org>.
zzcclp commented on a change in pull request #1555:
URL: https://github.com/apache/kylin/pull/1555#discussion_r562515249
##########
File path: server-base/src/test/java/org/apache/kylin/rest/job/StorageCleanupJobTest.java
##########
@@ -18,6 +18,8 @@
package org.apache.kylin.rest.job;
+import com.google.inject.internal.cglib.proxy.$CallbackFilter;
+import org.apache.hadoop.fs.PathFilter;
Review comment:
remove these two imports.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kylin] hit-lacus merged pull request #1555: Fix storage clean up tool
Posted by GitBox <gi...@apache.org>.
hit-lacus merged pull request #1555:
URL: https://github.com/apache/kylin/pull/1555
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kylin] zhangayqian commented on pull request #1555: Fix storage clean up tool
Posted by GitBox <gi...@apache.org>.
zhangayqian commented on pull request #1555:
URL: https://github.com/apache/kylin/pull/1555#issuecomment-765096041
#### Before cleanup

#### cleanup

#### After clean up

----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kylin] zzcclp commented on a change in pull request #1555: Fix storage clean up tool
Posted by GitBox <gi...@apache.org>.
zzcclp commented on a change in pull request #1555:
URL: https://github.com/apache/kylin/pull/1555#discussion_r562395655
##########
File path: server-base/src/main/java/org/apache/kylin/rest/job/StorageCleanupJob.java
##########
@@ -83,38 +86,27 @@ protected void execute(OptionsHelper optionsHelper) throws Exception {
public void cleanup() throws Exception {
ProjectManager projectManager = ProjectManager.getInstance(config);
CubeManager cubeManager = CubeManager.getInstance(config);
-
- //clean up job temp files
List<String> projects = projectManager.listAllProjects().stream().map(ProjectInstance::getName).collect(Collectors.toList());
- for (String project : projects) {
- String tmpPath = config.getJobTmpDir(project);
- if (delete) {
- logger.info("Deleting HDFS path " + tmpPath);
- if (fs.exists(new Path(tmpPath))) {
- fs.delete(new Path(tmpPath), true);
- }
- } else {
- logger.info("Dry run, pending delete HDFS path " + tmpPath);
- }
- }
//clean up deleted projects and cubes
List<CubeInstance> cubes = cubeManager.listAllCubes();
Path metadataPath = new Path(config.getHdfsWorkingDirectory());
if (fs.exists(metadataPath)) {
- FileStatus[] projectStatus = fs.listStatus(metadataPath);
- if (projectStatus != null) {
- for (FileStatus status : projectStatus) {
- String projectName = status.getPath().getName();
- if (!projects.contains(projectName)) {
- if (delete) {
- logger.info("Deleting HDFS path " + status.getPath());
- fs.delete(status.getPath(), true);
+ FileStatus[] fileStatus = fs.listStatus(metadataPath);
Review comment:
use fs.listStatus(file, PathFilter) to filter out 'protectedDir'
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kylin] zzcclp commented on a change in pull request #1555: Fix storage clean up tool
Posted by GitBox <gi...@apache.org>.
zzcclp commented on a change in pull request #1555:
URL: https://github.com/apache/kylin/pull/1555#discussion_r562395655
##########
File path: server-base/src/main/java/org/apache/kylin/rest/job/StorageCleanupJob.java
##########
@@ -83,38 +86,27 @@ protected void execute(OptionsHelper optionsHelper) throws Exception {
public void cleanup() throws Exception {
ProjectManager projectManager = ProjectManager.getInstance(config);
CubeManager cubeManager = CubeManager.getInstance(config);
-
- //clean up job temp files
List<String> projects = projectManager.listAllProjects().stream().map(ProjectInstance::getName).collect(Collectors.toList());
- for (String project : projects) {
- String tmpPath = config.getJobTmpDir(project);
- if (delete) {
- logger.info("Deleting HDFS path " + tmpPath);
- if (fs.exists(new Path(tmpPath))) {
- fs.delete(new Path(tmpPath), true);
- }
- } else {
- logger.info("Dry run, pending delete HDFS path " + tmpPath);
- }
- }
//clean up deleted projects and cubes
List<CubeInstance> cubes = cubeManager.listAllCubes();
Path metadataPath = new Path(config.getHdfsWorkingDirectory());
if (fs.exists(metadataPath)) {
- FileStatus[] projectStatus = fs.listStatus(metadataPath);
- if (projectStatus != null) {
- for (FileStatus status : projectStatus) {
- String projectName = status.getPath().getName();
- if (!projects.contains(projectName)) {
- if (delete) {
- logger.info("Deleting HDFS path " + status.getPath());
- fs.delete(status.getPath(), true);
+ FileStatus[] fileStatus = fs.listStatus(metadataPath);
Review comment:
use fs.listStatus(file, PathFilter) to filter out 'protectedDir'
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kylin] zhangayqian commented on pull request #1555: Fix storage clean up tool
Posted by GitBox <gi...@apache.org>.
zhangayqian commented on pull request #1555:
URL: https://github.com/apache/kylin/pull/1555#issuecomment-765096041
#### Before cleanup

#### cleanup

#### After clean up

----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org