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

siyao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 1eda443a1e HDDS-8176. [Snapshot] Rename variables to fix shadow 
declaration warning with gcc (#4409)
1eda443a1e is described below

commit 1eda443a1e58f00167ea350a0ee028989b30e7db
Author: Swaminathan Balachandran <[email protected]>
AuthorDate: Thu Mar 23 21:15:15 2023 -0700

    HDDS-8176. [Snapshot] Rename variables to fix shadow declaration warning 
with gcc (#4409)
---
 hadoop-hdds/rocks-native/pom.xml                   |  2 +-
 .../src/main/patches/rocks-native.patch            | 73 +++++++++++-----------
 2 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/hadoop-hdds/rocks-native/pom.xml b/hadoop-hdds/rocks-native/pom.xml
index 6112326cc7..91a8011d36 100644
--- a/hadoop-hdds/rocks-native/pom.xml
+++ b/hadoop-hdds/rocks-native/pom.xml
@@ -48,7 +48,7 @@
                 </property>
             </activation>
             <properties>
-                <cmake.standards>23</cmake.standards>
+                <cmake.standards>20</cmake.standards>
                 <sstDump.include>true</sstDump.include>
             </properties>
             <build>
diff --git a/hadoop-hdds/rocks-native/src/main/patches/rocks-native.patch 
b/hadoop-hdds/rocks-native/src/main/patches/rocks-native.patch
index c58a9a12f1..eb4501a77a 100644
--- a/hadoop-hdds/rocks-native/src/main/patches/rocks-native.patch
+++ b/hadoop-hdds/rocks-native/src/main/patches/rocks-native.patch
@@ -31,7 +31,7 @@ index 9261ba47d..09ed123e5 100644
  
  }  // namespace ROCKSDB_NAMESPACE
 diff --git a/table/sst_file_dumper.cc b/table/sst_file_dumper.cc
-index eefbaaeee..2c8106298 100644
+index eefbaaeee..3f2b42324 100644
 --- a/table/sst_file_dumper.cc
 +++ b/table/sst_file_dumper.cc
 @@ -45,7 +45,7 @@ SstFileDumper::SstFileDumper(const Options& options,
@@ -49,8 +49,8 @@ index eefbaaeee..2c8106298 100644
        read_options_(verify_checksum, false),
 -      internal_comparator_(BytewiseComparator()) {
 +      internal_comparator_(BytewiseComparator()),
-+      out(out),
-+      err(err)
++      out_(out),
++      err_(err)
 +      {
    read_options_.readahead_size = readahead_size;
    if (!silent_) {
@@ -64,11 +64,11 @@ index eefbaaeee..2c8106298 100644
      uint32_t max_dict_bytes, uint32_t zstd_max_train_bytes,
      uint64_t max_dict_buffer_bytes, bool use_zstd_dict_trainer) {
 -  fprintf(stdout, "Block Size: %" ROCKSDB_PRIszt "\n", block_size);
-+  fprintf(out, "Block Size: %" ROCKSDB_PRIszt "\n", block_size);
++  fprintf(out_, "Block Size: %" ROCKSDB_PRIszt "\n", block_size);
    for (auto& i : compression_types) {
      if (CompressionTypeSupported(i.first)) {
 -      fprintf(stdout, "Compression: %-24s\n", i.second);
-+      fprintf(out, "Compression: %-24s\n", i.second);
++      fprintf(out_, "Compression: %-24s\n", i.second);
        CompressionOptions compress_opt;
        compress_opt.max_dict_bytes = max_dict_bytes;
        compress_opt.zstd_max_train_bytes = zstd_max_train_bytes;
@@ -76,7 +76,7 @@ index eefbaaeee..2c8106298 100644
        compress_opt.use_zstd_dict_trainer = use_zstd_dict_trainer;
        for (int32_t j = compress_level_from; j <= compress_level_to; j++) {
 -        fprintf(stdout, "Compression level: %d", j);
-+        fprintf(out, "Compression level: %d", j);
++        fprintf(out_, "Compression level: %d", j);
          compress_opt.level = j;
          Status s = ShowCompressionSize(block_size, i.first, compress_opt);
          if (!s.ok()) {
@@ -85,7 +85,7 @@ index eefbaaeee..2c8106298 100644
        }
      } else {
 -      fprintf(stdout, "Unsupported compression type: %s.\n", i.second);
-+      fprintf(out, "Unsupported compression type: %s.\n", i.second);
++      fprintf(out_, "Unsupported compression type: %s.\n", i.second);
      }
    }
    return Status::OK();
@@ -96,9 +96,9 @@ index eefbaaeee..2c8106298 100644
 -  fprintf(stdout, " Size: %10" PRIu64, file_size);
 -  fprintf(stdout, " Blocks: %6" PRIu64, num_data_blocks);
 -  fprintf(stdout, " Time Taken: %10s microsecs",
-+  fprintf(out, " Size: %10" PRIu64, file_size);
-+  fprintf(out, " Blocks: %6" PRIu64, num_data_blocks);
-+  fprintf(out, " Time Taken: %10s microsecs",
++  fprintf(out_, " Size: %10" PRIu64, file_size);
++  fprintf(out_, " Blocks: %6" PRIu64, num_data_blocks);
++  fprintf(out_, " Time Taken: %10s microsecs",
            std::to_string(
                std::chrono::duration_cast<std::chrono::microseconds>(end - 
start)
                    .count())
@@ -107,13 +107,13 @@ index eefbaaeee..2c8106298 100644
                                   static_cast<double>(num_data_blocks)) *
                                  100.0);
 -  fprintf(stdout, " Compressed: %6" PRIu64 " (%5.1f%%)", compressed_blocks,
-+  fprintf(out, " Compressed: %6" PRIu64 " (%5.1f%%)", compressed_blocks,
++  fprintf(out_, " Compressed: %6" PRIu64 " (%5.1f%%)", compressed_blocks,
            compressed_pcnt);
 -  fprintf(stdout, " Not compressed (ratio): %6" PRIu64 " (%5.1f%%)",
-+  fprintf(out, " Not compressed (ratio): %6" PRIu64 " (%5.1f%%)",
++  fprintf(out_, " Not compressed (ratio): %6" PRIu64 " (%5.1f%%)",
            ratio_not_compressed_blocks, ratio_not_compressed_pcnt);
 -  fprintf(stdout, " Not compressed (abort): %6" PRIu64 " (%5.1f%%)\n",
-+  fprintf(out, " Not compressed (abort): %6" PRIu64 " (%5.1f%%)\n",
++  fprintf(out_, " Not compressed (abort): %6" PRIu64 " (%5.1f%%)\n",
            not_compressed_blocks, not_compressed_pcnt);
    return Status::OK();
  }
@@ -122,7 +122,7 @@ index eefbaaeee..2c8106298 100644
    if (!s.ok()) {
      if (!silent_) {
 -      fprintf(stdout, "Not able to read table properties\n");
-+      fprintf(out, "Not able to read table properties\n");
++      fprintf(out_, "Not able to read table properties\n");
      }
    }
    return s;
@@ -131,7 +131,7 @@ index eefbaaeee..2c8106298 100644
      options_.table_factory.reset(bbtf);
      if (!silent_) {
 -      fprintf(stdout, "Sst file format: block-based\n");
-+      fprintf(out, "Sst file format: block-based\n");
++      fprintf(out_, "Sst file format: block-based\n");
      }
  
      auto& props = table_properties_->user_collected_properties;
@@ -140,7 +140,7 @@ index eefbaaeee..2c8106298 100644
      options_.table_factory.reset(NewPlainTableFactory(plain_table_options));
      if (!silent_) {
 -      fprintf(stdout, "Sst file format: plain table\n");
-+      fprintf(out, "Sst file format: plain table\n");
++      fprintf(out_, "Sst file format: plain table\n");
      }
    } else {
      char error_msg_buffer[80];
@@ -149,7 +149,7 @@ index eefbaaeee..2c8106298 100644
    options_.table_factory = std::make_shared<BlockBasedTableFactory>();
    if (!silent_) {
 -    fprintf(stdout, "Sst file format: block-based(old version)\n");
-+    fprintf(out, "Sst file format: block-based(old version)\n");
++    fprintf(out_, "Sst file format: block-based(old version)\n");
    }
  
    return Status::OK();
@@ -158,7 +158,7 @@ index eefbaaeee..2c8106298 100644
      if (print_kv) {
        if (!decode_blob_index_ || ikey.type != kTypeBlobIndex) {
 -        fprintf(stdout, "%s => %s\n",
-+        fprintf(out, "%s => %s\n",
++        fprintf(out_, "%s => %s\n",
                  ikey.DebugString(true, output_hex_).c_str(),
                  value.ToString(output_hex_).c_str());
        } else {
@@ -167,18 +167,18 @@ index eefbaaeee..2c8106298 100644
          const Status s = blob_index.DecodeFrom(value);
          if (!s.ok()) {
 -          fprintf(stderr, "%s => error decoding blob index\n",
-+          fprintf(err, "%s => error decoding blob index\n",
++          fprintf(err_, "%s => error decoding blob index\n",
                    ikey.DebugString(true, output_hex_).c_str());
            continue;
          }
  
 -        fprintf(stdout, "%s => %s\n",
-+        fprintf(out, "%s => %s\n",
++        fprintf(out_, "%s => %s\n",
                  ikey.DebugString(true, output_hex_).c_str(),
                  blob_index.DebugString(output_hex_).c_str());
        }
 diff --git a/table/sst_file_dumper.h b/table/sst_file_dumper.h
-index 7be876390..20e35ac2a 100644
+index 7be876390..ea07154da 100644
 --- a/table/sst_file_dumper.h
 +++ b/table/sst_file_dumper.h
 @@ -22,7 +22,9 @@ class SstFileDumper {
@@ -196,13 +196,13 @@ index 7be876390..20e35ac2a 100644
    ReadOptions read_options_;
    InternalKeyComparator internal_comparator_;
    std::unique_ptr<TableProperties> table_properties_;
-+  FILE* out;
-+  FILE* err;
++  FILE* out_;
++  FILE* err_;
  };
  
  }  // namespace ROCKSDB_NAMESPACE
 diff --git a/tools/sst_dump_tool.cc b/tools/sst_dump_tool.cc
-index 7053366e7..b063f8e24 100644
+index 7053366e7..4bde14fff 100644
 --- a/tools/sst_dump_tool.cc
 +++ b/tools/sst_dump_tool.cc
 @@ -31,7 +31,7 @@ static const std::vector<std::pair<CompressionType, const 
char*>>
@@ -359,16 +359,13 @@ index 7053366e7..b063f8e24 100644
                dir_or_file);
        return 1;
      }
-@@ -418,13 +419,13 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
-     if (dir) {
-       filename = std::string(dir_or_file) + "/" + filename;
-     }
--
+@@ -421,10 +422,11 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+ 
      ROCKSDB_NAMESPACE::SstFileDumper dumper(
          options, filename, Temperature::kUnknown, readahead_size,
 -        verify_checksum, output_hex, decode_blob_index);
 +        verify_checksum, output_hex, decode_blob_index, EnvOptions(),
-+        false,out, err);
++        false, out, err);
      // Not a valid SST
      if (!dumper.getStatus().ok()) {
 -      fprintf(stderr, "%s: %s\n", filename.c_str(),
@@ -376,7 +373,7 @@ index 7053366e7..b063f8e24 100644
                dumper.getStatus().ToString().c_str());
        continue;
      } else {
-@@ -434,7 +435,7 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -434,7 +436,7 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
        if (valid_sst_files.size() == 1) {
          // from_key and to_key are only used for "check", "scan", or ""
          if (command == "check" || command == "scan" || command == "") {
@@ -385,7 +382,7 @@ index 7053366e7..b063f8e24 100644
                    ROCKSDB_NAMESPACE::Slice(from_key).ToString(true).c_str(),
                    ROCKSDB_NAMESPACE::Slice(to_key).ToString(true).c_str());
          }
-@@ -449,7 +450,7 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -449,7 +451,7 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
            compression_zstd_max_train_bytes, compression_max_dict_buffer_bytes,
            !compression_use_zstd_finalize_dict);
        if (!st.ok()) {
@@ -394,7 +391,7 @@ index 7053366e7..b063f8e24 100644
          exit(1);
        }
        return 0;
-@@ -461,10 +462,10 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -461,10 +463,10 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
  
        st = dumper.DumpTable(out_filename);
        if (!st.ok()) {
@@ -407,7 +404,7 @@ index 7053366e7..b063f8e24 100644
        }
        continue;
      }
-@@ -476,7 +477,7 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -476,7 +478,7 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
            has_from || use_from_as_prefix, from_key, has_to, to_key,
            use_from_as_prefix);
        if (!st.ok()) {
@@ -416,7 +413,7 @@ index 7053366e7..b063f8e24 100644
              st.ToString().c_str());
        }
        total_read += dumper.GetReadNumber();
-@@ -488,10 +489,10 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -488,10 +490,10 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
      if (command == "verify") {
        st = dumper.VerifyChecksum();
        if (!st.ok()) {
@@ -429,7 +426,7 @@ index 7053366e7..b063f8e24 100644
        }
        continue;
      }
-@@ -503,15 +504,15 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -503,15 +505,15 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
            table_properties_from_reader;
        st = dumper.ReadTableProperties(&table_properties_from_reader);
        if (!st.ok()) {
@@ -448,7 +445,7 @@ index 7053366e7..b063f8e24 100644
                    "Table Properties:\n"
                    "------------------------------\n"
                    "  %s",
-@@ -523,30 +524,30 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -523,30 +525,30 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
          total_index_block_size += table_properties->index_size;
          total_filter_block_size += table_properties->filter_size;
          if (show_properties) {
@@ -487,7 +484,7 @@ index 7053366e7..b063f8e24 100644
              total_filter_block_size);
    }
  
-@@ -554,24 +555,24 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
+@@ -554,24 +556,24 @@ int SSTDumpTool::Run(int argc, char const* const* argv, 
Options options) {
      // No valid SST files are found
      // Exit with an error state
      if (dir) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to