You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2020/03/06 14:42:31 UTC

[GitHub] [hadoop] mehakmeet commented on a change in pull request #1881: HADOOP-16910 Adding file system counters in ABFS

mehakmeet commented on a change in pull request #1881: HADOOP-16910 Adding file system counters in ABFS
URL: https://github.com/apache/hadoop/pull/1881#discussion_r388940913
 
 

 ##########
 File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsTestWithTimeout.java
 ##########
 @@ -67,4 +77,42 @@ public void nameThread() {
   protected int getTestTimeoutMillis() {
     return TEST_TIMEOUT;
   }
+
+  /**
+   * Describe a test in the logs.
+   *
+   * @param text text to print
+   * @param args arguments to format in the printing
+   */
+  protected void describe(String text, Object... args) {
+    LOG.info("\n\n{}: {}\n",
+        methodName.getMethodName(),
+        String.format(text, args));
+  }
+
+  /**
+   * Validate Contents written on a file in Abfs
+   *
+   * @param fs AzureBlobFileSystem
+   * @param path Path of the file
+   * @param originalByteArray original byte array
+   * @return
+   * @throws IOException
+   */
+  protected boolean validateContent(AzureBlobFileSystem fs, Path path,
+      byte[] originalByteArray)
+      throws IOException {
+    FSDataInputStream in = fs.open(path);
+    byte[] contentByteArray = new byte[originalByteArray.length];
+    int seekPos = 0;
+    while (in.read() != -1) {
 
 Review comment:
   I will still need seekPos for indexing of contentByteArray..
   seek() is however an extra method call, I can compare byte by byte with originalByteArray ?
   Something like this ,maybe ?
   
   ` while (valueOfContentAtPos != -1 && pos < lenOfOriginalByteArray) {
         if (originalByteArray[pos] != valueOfContentAtPos)
           return false;
         valueOfContentAtPos = (byte) in.read();
         pos++;
       }
       if (valueOfContentAtPos != -1)
         return false;
       return true;`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org