Skip to content

Commit b5e02c1

Browse files
committed
Ignore authority when comparing hopsfs paths
1 parent 4629a9c commit b5e02c1

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,12 +726,26 @@ public static List<StoragePathInfo> getAllDataPathInfo(HoodieStorage storage, St
726726
}
727727
return pathInfoList;
728728
}
729-
729+
730730
public static boolean comparePathsWithoutScheme(String pathStr1, String pathStr2) {
731-
Path pathWithoutScheme1 = getPathWithoutScheme(new Path(pathStr1));
732-
Path pathWithoutScheme2 = getPathWithoutScheme(new Path(pathStr2));
731+
// In hopsfs the following the authority does not matter, so we just compare the paths without scheme and authority.
732+
// The following paths are equivalent: hopsfs://10.244.231.90:8020/apps/hive/warehouse/g1_featurestore.db/loans_1,
733+
// hopsfs://rpc.namenode.service.consul:8020/apps/hive/warehouse/g1_featurestore.db/loans_1.
734+
Path path1 = new Path(pathStr1);
735+
Path path2 = new Path(pathStr2);
736+
Path pathWithoutScheme1 =
737+
path1.isUriPathAbsolute() && path1.toUri().getScheme().equals("hopsfs")
738+
? getPathWithoutSchemeAndAuthority(path1) : getPathWithoutScheme(new Path(pathStr1));
739+
Path pathWithoutScheme2 =
740+
path2.isUriPathAbsolute() && path2.toUri().getScheme().equals("hopsfs")
741+
? getPathWithoutSchemeAndAuthority(path2) : getPathWithoutScheme(new Path(pathStr2));
733742
return pathWithoutScheme1.equals(pathWithoutScheme2);
734743
}
744+
745+
public static Path getPathWithoutSchemeAndAuthority(Path path) {
746+
return path.isUriPathAbsolute()
747+
? new Path(path.toUri().getPath()) : path;
748+
}
735749

736750
public static Path getPathWithoutScheme(Path path) {
737751
return path.isUriPathAbsolute()

hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/HoodieSyncTool.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.apache.hadoop.fs.FileSystem;
2828

2929
import java.util.Properties;
30-
import java.util.logging.Level;
31-
import java.util.logging.Logger;
3230

3331
import static org.apache.hudi.sync.common.HoodieSyncConfig.META_SYNC_BASE_PATH;
3432

@@ -37,7 +35,6 @@
3735
* Hudi table queryable through external systems.
3836
*/
3937
public abstract class HoodieSyncTool implements AutoCloseable {
40-
private final Logger logger = Logger.getLogger(HoodieSyncTool.class.getName());
4138
protected Properties props;
4239
protected Configuration hadoopConf;
4340
protected HoodieMetaSyncMetrics metrics;
@@ -49,9 +46,7 @@ public HoodieSyncTool(Properties props) {
4946
public HoodieSyncTool(Properties props, Configuration hadoopConf) {
5047
this.props = props;
5148
this.hadoopConf = hadoopConf;
52-
HoodieSyncConfig hoodieSyncConfig = new HoodieSyncConfig(props, hadoopConf);
53-
logger.log(Level.INFO, "Initializing HoodieSyncTool with config: " + hoodieSyncConfig.toString());
54-
this.metrics = new HoodieMetaSyncMetrics(hoodieSyncConfig, getClass().getSimpleName());
49+
this.metrics = new HoodieMetaSyncMetrics(new HoodieSyncConfig(props, hadoopConf), getClass().getSimpleName());
5550
}
5651

5752
@Deprecated

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<fasterxml.jackson.databind.version>${fasterxml.spark3.version}</fasterxml.jackson.databind.version>
100100
<fasterxml.jackson.module.scala.version>${fasterxml.spark3.version}</fasterxml.jackson.module.scala.version>
101101
<fasterxml.jackson.dataformat.yaml.version>${fasterxml.spark3.version}</fasterxml.jackson.dataformat.yaml.version>
102-
<kafka.version>2.6.0</kafka.version>
102+
<kafka.version>3.4.1</kafka.version>
103103
<pulsar.version>3.0.2</pulsar.version>
104104
<kafka.connect.api.version>2.5.0</kafka.connect.api.version>
105105
<kafka.spark3.version>2.8.2</kafka.spark3.version>
@@ -2706,7 +2706,7 @@
27062706
<!-- This glob has to include hudi-spark3-common, hudi-spark3.2plus-common -->
27072707
<hudi.spark.common.module>hudi-spark3-common</hudi.spark.common.module>
27082708
<scalatest.version>${scalatest.spark3.version}</scalatest.version>
2709-
<kafka.version>2.6.0</kafka.version>
2709+
<kafka.version>3.4.1</kafka.version>
27102710
<hive.storage.version>2.6.1.3</hive.storage.version>
27112711
<!-- NOTE: Some Hudi modules require standalone Parquet/Orc/etc file-format dependency (hudi-hive-sync,
27122712
hudi-hadoop-mr, for ex). Since these Hudi modules might be used from w/in the execution engine(s)

0 commit comments

Comments
 (0)