Skip to content

Commit 1fcb761

Browse files
authored
fix gateway mode to process posix bucket (#62)
Co-authored-by: alantong(佟明达) <[email protected]>
1 parent 856800d commit 1fcb761

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.qcloud.cos</groupId>
88
<artifactId>hadoop-cos</artifactId>
9-
<version>8.1.2</version>
9+
<version>8.1.3</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Apache Hadoop Tencent Cloud COS Support</name>

src/main/java/org/apache/hadoop/fs/CosFileSystem.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
122122
this.nativeStore.close();
123123
this.nativeStore = null;
124124
} else if (this.actualImplFS instanceof CosNFileSystem) {
125+
this.nativeStore.isPosixBucket(true);
125126
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
126127
.withPosixBucket(isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
127128
} else {
@@ -132,6 +133,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
132133
}
133134
} else { // normal cos hadoop file system implements
134135
this.actualImplFS = getActualFileSystemByClassName("org.apache.hadoop.fs.CosNFileSystem");
136+
this.nativeStore.isPosixBucket(false);
135137
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
136138
.withPosixBucket(this.isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
137139
}

src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@InterfaceStability.Unstable
1313
public class CosNConfigKeys extends CommonConfigurationKeys {
1414
public static final String USER_AGENT = "fs.cosn.user.agent";
15-
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v8.1.2";
15+
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v8.1.3";
1616

1717
public static final String TENCENT_EMR_VERSION_KEY = "fs.emr.version";
1818

src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,11 @@ public void close() {
12231223
this.cosClient = null;
12241224
}
12251225

1226+
@Override
1227+
public void isPosixBucket(boolean isPosixBucket) {
1228+
this.isPosixBucket = isPosixBucket;
1229+
}
1230+
12261231
// process Exception and print detail
12271232
private void handleException(Exception e, String key) throws IOException {
12281233
String cosPath = "cosn://" + bucketName + key;

src/main/java/org/apache/hadoop/fs/NativeFileSystemStore.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,12 @@ CosNPartialListing list(String prefix, int maxListingLength,
112112
*/
113113
void dump() throws IOException;
114114

115+
/**
116+
* Used for outer to decide inner process.
117+
* if you use the CosNFileSystem gateway mode,
118+
* must set native store to posix process
119+
*/
120+
void isPosixBucket(boolean isPosixBucket);
121+
115122
void close();
116123
}

0 commit comments

Comments
 (0)