You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/03/08 20:16:39 UTC

[1/3] incubator-kudu git commit: Clarify the special section of LICENSE.txt

Repository: incubator-kudu
Updated Branches:
  refs/heads/master cef399c10 -> 3ea58ab6c


Clarify the special section of LICENSE.txt

During the 0.7.1 release vote this section was noted as confusing.

Change-Id: Ie8d0e6d62aedf9e53aaf06b2088d427f44be9c62
Reviewed-on: http://gerrit.cloudera.org:8080/2482
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/429311c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/429311c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/429311c5

Branch: refs/heads/master
Commit: 429311c5ef09e34bd8d1b11148822908aa31b0f8
Parents: cef399c
Author: Todd Lipcon <to...@apache.org>
Authored: Tue Mar 8 09:15:19 2016 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Mar 8 19:15:59 2016 +0000

----------------------------------------------------------------------
 LICENSE.txt | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/429311c5/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index 5116c0c..a33e6fd 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -512,12 +512,19 @@ under the following 3-clause BSD license:
 ================================================================================
 
 The following dependencies or pieces of incorporated source code have licenses
-such that either:
+under one of the following categories:
+
   (a) do not require their license text to be re-distributed with binary
-      distributions, or
+      distributions (e.g. MIT license, Boost license)
+
   (b) have no requirements about re-distributing their license text in either
-      source or binary distributions, or
-  (c) are the same Apache 2.0 license reproduced in its entirety above.
+      source or binary distributions (e.g. public domain)
+
+  (c) require inclusion of the license text in both source and binary distributions,
+      but are used only at build-time and thus not incorporated in binary artifacts
+      (e.g. BSD-licensed build tooling)
+
+  (d) are the same Apache 2.0 license reproduced in its entirety above.
 
 Therefore, we do not reproduce their licenses in their entirety in this file.
 --------------------------------------------------------------------------------


[2/3] incubator-kudu git commit: random: re-implement Random::Normal using std::normal_distribution

Posted by to...@apache.org.
random: re-implement Random::Normal using std::normal_distribution

Since we were only using this one function from the WebRTC source code,
it was easier to just use std::normal_distribution than worry about
the proper way to attribute WebRTC (BSD license).

Tested with the existing unit test, and also modified it to dump a few
thousand values to a text file. I verified the resulting distribution
in R:

> sd(d$V1)
[1] 0.01002238
> mean(d$V1)
[1] 4.999974

(which is close enough given the sample size)

Change-Id: Id2101d1375618a87b370162c067f9bbf2035cf33
Reviewed-on: http://gerrit.cloudera.org:8080/2481
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/fc9612fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/fc9612fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/fc9612fe

Branch: refs/heads/master
Commit: fc9612fec0e718f20e5fbdbe9cd6a36536d78706
Parents: 429311c
Author: Todd Lipcon <to...@apache.org>
Authored: Tue Mar 8 09:13:30 2016 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Mar 8 19:16:11 2016 +0000

----------------------------------------------------------------------
 LICENSE.txt            | 35 -----------------------------------
 src/kudu/util/random.h | 41 ++++++++++++++++++++++++++++++-----------
 2 files changed, 30 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/fc9612fe/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index a33e6fd..76dcb9c 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -290,41 +290,6 @@ Some portions of this module are derived from code from LevelDB
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 --------------------------------------------------------------------------------
-src/kudu/util/{random-util.cc},{random.h}: some portions adapted from WebRTC
-project (modules/video_coding/main/test/test_util.cc) under a 3-clause BSD
-license.
-
-  Copyright (c) 2011, The WebRTC project authors. All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions are
-  met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in
-      the documentation and/or other materials provided with the
-      distribution.
-
-    * Neither the name of Google nor the names of its contributors may
-      be used to endorse or promote products derived from this software
-      without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
 
 src/kudu/util/sync_point: adapted from the RocksDB project under a 3-clause
 BSD license with an additional grant of patent rights:

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/fc9612fe/src/kudu/util/random.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/random.h b/src/kudu/util/random.h
index b4f0a46..1b61862 100644
--- a/src/kudu/util/random.h
+++ b/src/kudu/util/random.h
@@ -1,13 +1,13 @@
 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file. See the AUTHORS file for names of contributors.
-
 #ifndef KUDU_UTIL_RANDOM_H_
 #define KUDU_UTIL_RANDOM_H_
 
 #include <stdint.h>
 
 #include <cmath>
+#include <random>
 #include <vector>
 
 #include "kudu/gutil/map-util.h"
@@ -22,6 +22,9 @@ const double kTwoPi = 6.283185307179586476925286;
 
 } // namespace random_internal
 
+template<class R>
+class StdUniformRNG;
+
 // A very simple random number generator.  Not especially good at
 // generating truly random bits, but good enough for our needs in this
 // package. This implementation is not thread-safe.
@@ -105,16 +108,8 @@ class Random {
     return Uniform(1 << Uniform(max_log + 1));
   }
 
-  // Creates a normal distribution variable using the
-  // Box-Muller transform. See:
-  // http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
-  // Adapted from WebRTC source code at:
-  // webrtc/trunk/modules/video_coding/main/test/test_util.cc
-  double Normal(double mean, double std_dev) {
-    double uniform1 = (Next() + 1.0) / (random_internal::M + 1.0);
-    double uniform2 = (Next() + 1.0) / (random_internal::M + 1.0);
-    return (mean + std_dev * sqrt(-2 * ::log(uniform1)) * cos(random_internal::kTwoPi * uniform2));
-  }
+  // Samples a random number from the given normal distribution.
+  double Normal(double mean, double std_dev);
 
   // Return a random number between 0.0 and 1.0 inclusive.
   double NextDoubleFraction() {
@@ -225,7 +220,31 @@ class ThreadSafeRandom {
   Random random_;
 };
 
+// Wraps either Random or ThreadSafeRandom as a C++ standard library
+// compliant UniformRandomNumberGenerator:
+//   http://en.cppreference.com/w/cpp/concept/UniformRandomNumberGenerator
+template<class R>
+class StdUniformRNG {
+ public:
+  typedef uint32_t result_type;
+
+  explicit StdUniformRNG(R* r) : r_(r) {}
+  uint32_t operator()() {
+    return r_->Next32();
+  }
+  uint32_t min() const { return 0; }
+  uint32_t max() const { return (1L << 31) - 1; }
+
+ private:
+  R* r_;
+};
 
+// Defined outside the class to make use of StdUniformRNG above.
+inline double Random::Normal(double mean, double std_dev) {
+  std::normal_distribution<> nd(mean, std_dev);
+  StdUniformRNG<Random> gen(this);
+  return nd(gen);
+}
 
 }  // namespace kudu
 


[3/3] incubator-kudu git commit: tablet_bootstrap: remove unused Arena variable

Posted by to...@apache.org.
tablet_bootstrap: remove unused Arena variable

This Arena wasn't being used, and Reset()ing it on every write was
using a significant fraction of CPU cycles in ASAN/TSAN debug builds.

This improved ts_recovery-itest --gtest_filter=\*969\* from ~65sec on
my laptop to ~33s. It will hopefully fix that test from being flaky.

Change-Id: I9c09c1867a0ee1a7fadffe869b7720192b375dc8
Reviewed-on: http://gerrit.cloudera.org:8080/2477
Tested-by: Todd Lipcon <to...@apache.org>
Reviewed-by: Mike Percy <mp...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/3ea58ab6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/3ea58ab6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/3ea58ab6

Branch: refs/heads/master
Commit: 3ea58ab6c3051cfcb7ad9880d37dc32ad46c6e49
Parents: fc9612f
Author: Todd Lipcon <to...@apache.org>
Authored: Mon Mar 7 18:22:23 2016 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Mar 8 19:16:24 2016 +0000

----------------------------------------------------------------------
 src/kudu/tablet/tablet_bootstrap.cc | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/3ea58ab6/src/kudu/tablet/tablet_bootstrap.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_bootstrap.cc b/src/kudu/tablet/tablet_bootstrap.cc
index fb46b61..3cd578d 100644
--- a/src/kudu/tablet/tablet_bootstrap.cc
+++ b/src/kudu/tablet/tablet_bootstrap.cc
@@ -295,8 +295,6 @@ class TabletBootstrap {
   scoped_refptr<log::Log> log_;
   std::shared_ptr<log::LogReader> log_reader_;
 
-  Arena arena_;
-
   gscoped_ptr<ConsensusMetadata> cmeta_;
 
   // Statistics on the replay of entries in the log.
@@ -423,8 +421,7 @@ TabletBootstrap::TabletBootstrap(
       mem_tracker_(std::move(mem_tracker)),
       metric_registry_(metric_registry),
       listener_(listener),
-      log_anchor_registry_(log_anchor_registry),
-      arena_(256 * 1024, 4 * 1024 * 1024) {}
+      log_anchor_registry_(log_anchor_registry) {}
 
 Status TabletBootstrap::Bootstrap(shared_ptr<Tablet>* rebuilt_tablet,
                                   scoped_refptr<Log>* rebuilt_log,
@@ -1256,8 +1253,6 @@ Status TabletBootstrap::PlayRowOperations(WriteTransactionState* tx_state,
   RETURN_NOT_OK_PREPEND(SchemaFromPB(schema_pb, &inserts_schema),
                         "Couldn't decode client schema");
 
-  arena_.Reset();
-
   RETURN_NOT_OK_PREPEND(tablet_->DecodeWriteOperations(&inserts_schema, tx_state),
                         Substitute("Could not decode row operations: $0",
                                    ops_pb.ShortDebugString()));