You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "wsjz (via GitHub)" <gi...@apache.org> on 2023/04/24 11:38:06 UTC

[GitHub] [doris] wsjz opened a new pull request, #19012: [refactor](fs)(step2)separate the storage and filesystem methods

wsjz opened a new pull request, #19012:
URL: https://github.com/apache/doris/pull/19012

   # Proposed changes
   
   see https://github.com/apache/doris/issues/18960
   
   PR1: add new storage file system template and move old storage to new package
   PR2: extract some method in old storage to new file system.
   PR3: use storages to access remote object storage, and use file systems to access file in local or remote location. Will add some unit tests.
   
   this is PR2.
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) 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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on a diff in pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #19012:
URL: https://github.com/apache/doris/pull/19012#discussion_r1176189232


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java:
##########
@@ -128,17 +128,17 @@ private static boolean pingS3(CloudCredentialWithEndpoint credential, String buc
         propertiesPing.put(S3Properties.Env.REGION, credential.getRegion());
         propertiesPing.put(PropertyConverter.USE_PATH_STYLE, "false");
         properties.putAll(propertiesPing);
-        S3Storage storage = new S3Storage(properties);
+        S3FileSystem fileSystem = new S3FileSystem(properties);

Review Comment:
   Test is pass



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #19012:
URL: https://github.com/apache/doris/pull/19012#issuecomment-1522620478

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on a diff in pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #19012:
URL: https://github.com/apache/doris/pull/19012#discussion_r1176189232


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java:
##########
@@ -128,17 +128,17 @@ private static boolean pingS3(CloudCredentialWithEndpoint credential, String buc
         propertiesPing.put(S3Properties.Env.REGION, credential.getRegion());
         propertiesPing.put(PropertyConverter.USE_PATH_STYLE, "false");
         properties.putAll(propertiesPing);
-        S3Storage storage = new S3Storage(properties);
+        S3FileSystem fileSystem = new S3FileSystem(properties);

Review Comment:
   Test is passed, so directly use fileSystem here.



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #19012:
URL: https://github.com/apache/doris/pull/19012#issuecomment-1521119957

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman merged pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman merged PR #19012:
URL: https://github.com/apache/doris/pull/19012


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on a diff in pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #19012:
URL: https://github.com/apache/doris/pull/19012#discussion_r1176198183


##########
fe/fe-core/src/main/java/org/apache/doris/tablefunction/S3TableValuedFunction.java:
##########
@@ -89,17 +88,12 @@ public S3TableValuedFunction(Map<String, String> params) throws AnalysisExceptio
         locationProperties.put(PropertyConverter.USE_PATH_STYLE, usePathStyle);
         if (FeConstants.runningUnitTest) {
             // Just check
-            BlobStorage.create(null, StorageBackend.StorageType.S3, locationProperties);
+            FileSystemFactory.get(StorageBackend.StorageType.S3, locationProperties);

Review Comment:
   just for UT, so can use FileSystem here.



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on code in PR #19012:
URL: https://github.com/apache/doris/pull/19012#discussion_r1176207601


##########
fe/fe-core/src/main/java/org/apache/doris/fs/PersistentFileSystem.java:
##########
@@ -0,0 +1,77 @@
+// 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.doris.fs;
+
+import org.apache.doris.analysis.StorageBackend;
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.io.Writable;
+
+import com.google.common.collect.Maps;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Map;
+
+public abstract class PersistentFileSystem implements FileSystem, Writable {

Review Comment:
   Add comment



##########
fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemFactory.java:
##########
@@ -0,0 +1,51 @@
+// 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.doris.fs;
+
+import org.apache.doris.analysis.StorageBackend;
+import org.apache.doris.fs.remote.BrokerFileSystem;
+import org.apache.doris.fs.remote.S3FileSystem;
+import org.apache.doris.fs.remote.dfs.DFSFileSystem;
+import org.apache.doris.fs.remote.dfs.JFSFileSystem;
+import org.apache.doris.fs.remote.dfs.OFSFileSystem;
+
+import java.util.Map;
+
+public class FileSystemFactory {
+
+    public static FileSystem get(StorageBackend.StorageType type, Map<String, String> properties) {

Review Comment:
   Add a TODO here, StorageBackend.StorageType should be renamed



##########
fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemFactory.java:
##########
@@ -0,0 +1,51 @@
+// 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.doris.fs;
+
+import org.apache.doris.analysis.StorageBackend;
+import org.apache.doris.fs.remote.BrokerFileSystem;
+import org.apache.doris.fs.remote.S3FileSystem;
+import org.apache.doris.fs.remote.dfs.DFSFileSystem;
+import org.apache.doris.fs.remote.dfs.JFSFileSystem;
+import org.apache.doris.fs.remote.dfs.OFSFileSystem;
+
+import java.util.Map;
+
+public class FileSystemFactory {
+
+    public static FileSystem get(StorageBackend.StorageType type, Map<String, String> properties) {
+        return getPersistentFileSystem(type.name(), type, properties);
+    }
+
+    public static PersistentFileSystem getPersistentFileSystem(String name, StorageBackend.StorageType type,

Review Comment:
   What is the difference between `get` and `getPersistentFileSystem`?



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #19012:
URL: https://github.com/apache/doris/pull/19012#issuecomment-1521322996

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on a diff in pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #19012:
URL: https://github.com/apache/doris/pull/19012#discussion_r1176248926


##########
fe/fe-core/src/main/java/org/apache/doris/fs/FileSystemFactory.java:
##########
@@ -0,0 +1,51 @@
+// 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.doris.fs;
+
+import org.apache.doris.analysis.StorageBackend;
+import org.apache.doris.fs.remote.BrokerFileSystem;
+import org.apache.doris.fs.remote.S3FileSystem;
+import org.apache.doris.fs.remote.dfs.DFSFileSystem;
+import org.apache.doris.fs.remote.dfs.JFSFileSystem;
+import org.apache.doris.fs.remote.dfs.OFSFileSystem;
+
+import java.util.Map;
+
+public class FileSystemFactory {
+
+    public static FileSystem get(StorageBackend.StorageType type, Map<String, String> properties) {
+        return getPersistentFileSystem(type.name(), type, properties);
+    }
+
+    public static PersistentFileSystem getPersistentFileSystem(String name, StorageBackend.StorageType type,

Review Comment:
   use the first 'get' for test.
   rename getPersistentFileSystem to 'get', and return FileSystem.
   



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wsjz commented on pull request #19012: [refactor](fs)(step2)separate the storage and filesystem methods

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #19012:
URL: https://github.com/apache/doris/pull/19012#issuecomment-1521614449

   run buildall


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org