This is an automated email from the ASF dual-hosted git repository. saurabhd336 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new 54a1ca01b5 Allow GcsPinotFS to work with granular permissions (#11655) 54a1ca01b5 is described below commit 54a1ca01b58912ea4b4b214ca37a0084880a0fe7 Author: Saurabh Dubey <saurabhd...@gmail.com> AuthorDate: Fri Sep 29 10:24:57 2023 +0530 Allow GcsPinotFS to work with granular permissions (#11655) Co-authored-by: Saurabh Dubey <saurabh.du...@saurabhs-macbook-pro-1.tail8a064.ts.net> --- .../org/apache/pinot/plugin/filesystem/GcsPinotFS.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pinot-plugins/pinot-file-system/pinot-gcs/src/main/java/org/apache/pinot/plugin/filesystem/GcsPinotFS.java b/pinot-plugins/pinot-file-system/pinot-gcs/src/main/java/org/apache/pinot/plugin/filesystem/GcsPinotFS.java index 4ee20031f8..262e913e6d 100644 --- a/pinot-plugins/pinot-file-system/pinot-gcs/src/main/java/org/apache/pinot/plugin/filesystem/GcsPinotFS.java +++ b/pinot-plugins/pinot-file-system/pinot-gcs/src/main/java/org/apache/pinot/plugin/filesystem/GcsPinotFS.java @@ -102,7 +102,8 @@ public class GcsPinotFS extends BasePinotFS { if (existsDirectoryOrBucket(gcsUri)) { return true; } - Blob blob = getBucket(gcsUri).create(directoryPath, new byte[0]); + Blob blob = + _storage.create(BlobInfo.newBuilder(BlobId.of(gcsUri.getBucketName(), directoryPath)).build(), new byte[0]); return blob.exists(); } catch (Exception e) { throw new IOException(e); @@ -274,7 +275,7 @@ public class GcsPinotFS extends BasePinotFS { private Blob getBlob(GcsUri gcsUri) throws IOException { try { - return getBucket(gcsUri).get(gcsUri.getPath()); + return _storage.get(BlobId.of(gcsUri.getBucketName(), gcsUri.getPath())); } catch (StorageException e) { throw new IOException(e); } @@ -306,7 +307,7 @@ public class GcsPinotFS extends BasePinotFS { if (prefix.isEmpty()) { return true; } - Blob blob = getBucket(gcsUri).get(prefix); + Blob blob = _storage.get(BlobId.of(gcsUri.getBucketName(), prefix)); if (existsBlob(blob)) { return true; } @@ -314,7 +315,8 @@ public class GcsPinotFS extends BasePinotFS { try { // Return true if folder was not explicitly created but is a prefix of one or more files. // Use lazy iterable iterateAll() and verify that the iterator has elements. - return getBucket(gcsUri).list(Storage.BlobListOption.prefix(prefix)).iterateAll().iterator().hasNext(); + return _storage.list(gcsUri.getBucketName(), Storage.BlobListOption.prefix(prefix)).iterateAll().iterator() + .hasNext(); } catch (Exception t) { throw new IOException(t); } @@ -331,7 +333,7 @@ public class GcsPinotFS extends BasePinotFS { if (prefix.equals(GcsUri.DELIMITER)) { page = getBucket(gcsUri).list(); } else { - page = getBucket(gcsUri).list(Storage.BlobListOption.prefix(prefix)); + page = _storage.list(gcsUri.getBucketName(), Storage.BlobListOption.prefix(prefix)); } for (Blob blob : page.iterateAll()) { if (blob.getName().equals(prefix)) { @@ -387,7 +389,7 @@ public class GcsPinotFS extends BasePinotFS { if (prefix.equals(GcsUri.DELIMITER)) { page = getBucket(segmentUri).list(); } else { - page = getBucket(segmentUri).list(Storage.BlobListOption.prefix(prefix)); + page = _storage.list(segmentUri.getBucketName(), Storage.BlobListOption.prefix(prefix)); } return batchDelete(page); } else { @@ -426,7 +428,8 @@ public class GcsPinotFS extends BasePinotFS { private boolean copyFile(GcsUri srcUri, GcsUri dstUri) throws IOException { Blob blob = getBlob(srcUri); - Blob newBlob = getBucket(dstUri).create(dstUri.getPath(), new byte[0]); + Blob newBlob = + _storage.create(BlobInfo.newBuilder(BlobId.of(dstUri.getBucketName(), dstUri.getPath())).build(), new byte[0]); CopyWriter copyWriter = blob.copyTo(newBlob.getBlobId()); copyWriter.getResult(); return copyWriter.isDone() && blob.exists(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org