Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : linkis-storage support s3 filesystem support write/read launch log and resultSet in s3(#4185) #4435

Merged
merged 9 commits into from Apr 10, 2023
Merged

feat : linkis-storage support s3 filesystem support write/read launch log and resultSet in s3(#4185) #4435

merged 9 commits into from Apr 10, 2023

Conversation

sjgllgh
Copy link
Contributor

@sjgllgh sjgllgh commented Apr 3, 2023

What is the purpose of the change

  1. linkis-storge support s3 filesystem;
  2. support write/read launch log in s3 bucket;
  3. support write/read resultSet in s3 bucket.

Related issues/PRs

Related issues: #4185
Related pr: #4185

Brief change log

  • add S3FileSystem class which extends from FileSystem class, in order to operate s3.
  • add BuildS3System class to build S3FileSystem.
  • modify StorageUtils class to fix an error when reading a resultSet from s3 in S3ObjectInputStream.
  • modify StorageConfiguration class.

How to use s3 file system

  1. modify configs in conf/linkis-cg-entrance.properties.
  • wds.linkis.resultSet.store.path=s3://linkis/tmp/
  • wds.linkis.filesystem.hdfs.root.path=s3://linkis/tmp/
  1. add configs in conf/linkis.properties.
  • wds.linkis.storage.s3.access.key=kyrO2anrUJQLtS2B
  • wds.linkis.storage.s3.secret.key=3BO2O9YHW110A64lx4hqh0MNsGHfIpZP
  • wds.linkis.storage.s3.endpoint=http://localhost:9000/
  • wds.linkis.storage.s3.region=cn-hb-1
  • wds.linkis.storage.s3.bucket=bucket-1

Checklist

  • I have read the Contributing Guidelines on pull requests.
  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the Linkis mailing list first)
  • If this is a code change: I have written unit tests to fully verify the new behavior.

return ret;
} else {
logger.warn("File or folder does not exist or file name is garbled(文件或者文件夹不存在或者文件名乱码)");
throw new StorageWarnException(TO_BE_UNKNOW.getErrorCode(), "文件或者文件夹不存在或者文件名乱码");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add English

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice.I've added the English comments.

} catch (IOException e) {
LOG.warn("get file system failed", e);
}
fs.setUser(user);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use proxyUser?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, but I don't think need a proxyUser in there. If I am wrong, please let me know.

}

@Override
public void close() throws IOException {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether there are resources that need to be released when close

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice.I checked the code and there were no resources to close.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice.I checked the code and there were no resources to close.

ok, thanks!

this.label = label;
}

public String buildPath(String path) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should Use org.apache.linkis.common.io.FsPath#getSchemaPath

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice. I use this method because the subdirectories I get through s3client don't have a "/" prefix. I tested this at minIo. The method you mentioned does not meet my needs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice. I use this method because the subdirectories I get through s3client don't have a "/" prefix. I tested this at minIo. The method you mentioned does not meet my needs.

ok, thanks!

@@ -83,4 +83,15 @@ object StorageConfiguration {
val FS_CHECKSUM_DISBALE =
CommonVars[java.lang.Boolean]("linkis.fs.hdfs.impl.disable.checksum", false)

val S3_ACCESS_KEY = CommonVars("wds.linkis.storage.s3.access.key", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove wds prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice.I've dropped the prefix.

peacewong
peacewong previously approved these changes Apr 10, 2023
Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@peacewong
Copy link
Contributor

@sjgllgh code needs to be formatted

Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@peacewong
Copy link
Contributor

ping @jackxu2011

Copy link
Contributor

@jackxu2011 jackxu2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jackxu2011 jackxu2011 merged commit f0f6657 into apache:dev-1.4.0 Apr 10, 2023
10 checks passed
@sjgllgh sjgllgh deleted the dev-1.4.0-storge-support-s3-filesystem branch April 13, 2023 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants