You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2023/12/04 10:21:43 UTC

(kyuubi-shaded) branch master updated (a51fe58 -> 291651b)

This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi-shaded.git


 discard a51fe58  [KYUUBI-SHADED #29] [KYUUBI-SHADED #28] Step 2/2: Overwrite SnapStream to remove deps of snappy in ZK client 3.6
     new 291651b  [KYUUBI-SHADED #28] Step 2/2: Overwrite SnapStream to remove deps of snappy in ZK client 3.6

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a51fe58)
            \
             N -- N -- N   refs/heads/master (291651b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


(kyuubi-shaded) 01/01: [KYUUBI-SHADED #28] Step 2/2: Overwrite SnapStream to remove deps of snappy in ZK client 3.6

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi-shaded.git

commit 291651b8f4d8b56bc046b6605babb94f23480cee
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Mon Dec 4 18:16:45 2023 +0800

    [KYUUBI-SHADED #28] Step 2/2: Overwrite SnapStream to remove deps of snappy in ZK client 3.6
    
    ### _Why are the changes needed?_
    
    This is step 2 of https://github.com/apache/kyuubi-shaded/pull/28
    
    > 2. remove the Snappy support (simply throw `UnsupportedOperationException`) in `org.apache.zookeeper.server.persistence.SnapStream` and snappy deps
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    - [x] Verified through https://github.com/apache/kyuubi/pull/5783
    
    Closes #29 from pan3793/snappy-2.
    
    a109d1c [Cheng Pan] [KYUUBI-SHADED #28] Step 1/2: Overwrite SnapStream to remove deps of snappy in ZK client 3.6
    
    Authored-by: Cheng Pan <ch...@apache.org>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../kyuubi-relocated-zookeeper-36/pom.xml          |  7 -----
 .../zookeeper/server/persistence/SnapStream.java   | 32 ++++++----------------
 .../src/main/resources/META-INF/NOTICE             |  1 -
 kyuubi-relocated-zookeeper-parent/pom.xml          |  4 ---
 4 files changed, 8 insertions(+), 36 deletions(-)

diff --git a/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/pom.xml b/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/pom.xml
index 095dff6..23d3c92 100644
--- a/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/pom.xml
+++ b/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/pom.xml
@@ -36,7 +36,6 @@ under the License.
         <zookeeper.version>3.6.4</zookeeper.version>
         <curator.version>5.4.0</curator.version>
         <netty.version>4.1.91.Final</netty.version>
-        <snappy.version>1.1.8.4</snappy.version>
     </properties>
 
     <dependencyManagement>
@@ -161,11 +160,5 @@ under the License.
                 </exclusion>
             </exclusions>
         </dependency>
-        <dependency>
-            <!-- required by kyuubi embedded Zookeeper server to bootstrap -->
-            <groupId>org.xerial.snappy</groupId>
-            <artifactId>snappy-java</artifactId>
-            <version>${snappy.version}</version>
-        </dependency>
     </dependencies>
 </project>
diff --git a/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/java/org/apache/zookeeper/server/persistence/SnapStream.java b/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/java/org/apache/zookeeper/server/persistence/SnapStream.java
index d0cdf8a..2033624 100644
--- a/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/java/org/apache/zookeeper/server/persistence/SnapStream.java
+++ b/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/java/org/apache/zookeeper/server/persistence/SnapStream.java
@@ -29,7 +29,6 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
-import java.util.Arrays;
 import java.util.zip.Adler32;
 import java.util.zip.CheckedInputStream;
 import java.util.zip.CheckedOutputStream;
@@ -40,9 +39,6 @@ import org.apache.jute.OutputArchive;
 import org.apache.zookeeper.common.AtomicFileOutputStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.xerial.snappy.SnappyCodec;
-import org.xerial.snappy.SnappyInputStream;
-import org.xerial.snappy.SnappyOutputStream;
 
 /** Represent the Stream used in serialize and deserialize the Snapshot. */
 public class SnapStream {
@@ -106,8 +102,8 @@ public class SnapStream {
         is = new GZIPInputStream(fis);
         break;
       case SNAPPY:
-        is = new SnappyInputStream(fis);
-        break;
+        throw new UnsupportedOperationException(
+            "[KYUUBI-SHADED #28] " + ZOOKEEPER_SHAPSHOT_STREAM_MODE + " does not support snappy");
       case CHECKED:
       default:
         is = new BufferedInputStream(fis);
@@ -131,8 +127,8 @@ public class SnapStream {
         os = new GZIPOutputStream(fos);
         break;
       case SNAPPY:
-        os = new SnappyOutputStream(fos);
-        break;
+        throw new UnsupportedOperationException(
+            "[KYUUBI-SHADED #28] " + ZOOKEEPER_SHAPSHOT_STREAM_MODE + " does not support snappy");
       case CHECKED:
       default:
         os = new BufferedOutputStream(fos);
@@ -184,8 +180,8 @@ public class SnapStream {
         isValid = isValidGZipStream(file);
         break;
       case SNAPPY:
-        isValid = isValidSnappyStream(file);
-        break;
+        throw new UnsupportedOperationException(
+            "[KYUUBI-SHADED #28] " + ZOOKEEPER_SHAPSHOT_STREAM_MODE + " does not support snappy");
       case CHECKED:
       default:
         isValid = isValidCheckedStream(file);
@@ -252,20 +248,8 @@ public class SnapStream {
    * @throws IOException
    */
   private static boolean isValidSnappyStream(File f) throws IOException {
-    byte[] byteArray = new byte[SnappyCodec.MAGIC_LEN];
-    try (FileInputStream fis = new FileInputStream(f)) {
-      if (SnappyCodec.MAGIC_LEN != fis.read(byteArray, 0, SnappyCodec.MAGIC_LEN)) {
-        LOG.error("Read incorrect number of bytes from {}", f.getName());
-        return false;
-      }
-      ByteBuffer bb = ByteBuffer.wrap(byteArray);
-      byte[] magicHeader = new byte[SnappyCodec.MAGIC_LEN];
-      bb.get(magicHeader, 0, SnappyCodec.MAGIC_LEN);
-      return Arrays.equals(magicHeader, SnappyCodec.getMagicHeader());
-    } catch (FileNotFoundException e) {
-      LOG.error("Unable to open file {}", f.getName(), e);
-      return false;
-    }
+    throw new UnsupportedOperationException(
+        "[KYUUBI-SHADED #28] " + ZOOKEEPER_SHAPSHOT_STREAM_MODE + " does not support snappy");
   }
 
   /**
diff --git a/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/resources/META-INF/NOTICE b/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/resources/META-INF/NOTICE
index e169494..dd21c3b 100644
--- a/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/resources/META-INF/NOTICE
+++ b/kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-36/src/main/resources/META-INF/NOTICE
@@ -13,4 +13,3 @@ This project bundles the following dependencies under the Apache Software Licens
 - org.apache.curator:curator-recipes:5.4.0
 - org.apache.zookeeper:zookeeper-jute:3.6.4
 - org.apache.zookeeper:zookeeper:3.6.4
-- org.xerial.snappy:xerial-java:1.1.8.4
diff --git a/kyuubi-relocated-zookeeper-parent/pom.xml b/kyuubi-relocated-zookeeper-parent/pom.xml
index 5fa7480..3b83e7f 100644
--- a/kyuubi-relocated-zookeeper-parent/pom.xml
+++ b/kyuubi-relocated-zookeeper-parent/pom.xml
@@ -97,10 +97,6 @@ under the License.
                                     <pattern>com.google</pattern>
                                     <shadedPattern>${shading.prefix}.google</shadedPattern>
                                 </relocation>
-                                <relocation>
-                                    <pattern>org.xerial.snappy</pattern>
-                                    <shadedPattern>${shading.prefix}.snappy</shadedPattern>
-                                </relocation>
                             </relocations>
                         </configuration>
                     </execution>