kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [4/5] kudu git commit: arena: remove second parameter for max buffer size
Date Wed, 18 Oct 2017 19:25:33 GMT
arena: remove second parameter for max buffer size

It was never very obvious how to pick a value for the max buffer size of
an Arena, and upon some reflection I think 1MB is almost always the
right choice. So, this removes the parameter for it from the
constructor, and instead adds a setter for the rare case when it needs
to be customized.

Change-Id: I56d7bb5b689c608382423038f11013b6be39e656
Reviewed-on: http://gerrit.cloudera.org:8080/8269
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <todd@apache.org>


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

Branch: refs/heads/master
Commit: 892a5fc03d164b652ee1cef0353be0e6dd1da559
Parents: 42ed9bd
Author: Todd Lipcon <todd@apache.org>
Authored: Thu Oct 12 18:56:28 2017 -0700
Committer: Todd Lipcon <todd@apache.org>
Committed: Wed Oct 18 19:23:09 2017 +0000

----------------------------------------------------------------------
 src/kudu/cfile/binary_dict_block.cc             |  2 +-
 src/kudu/cfile/cfile-test-base.h                |  2 +-
 src/kudu/cfile/cfile-test.cc                    |  6 +-
 src/kudu/cfile/cfile_util.cc                    |  2 +-
 src/kudu/cfile/encoding-test.cc                 |  4 +-
 src/kudu/client/scan_configuration.cc           |  2 +-
 src/kudu/codegen/codegen-test.cc                |  7 +--
 src/kudu/common/column_predicate-test.cc        |  4 +-
 src/kudu/common/columnblock.h                   |  2 +-
 src/kudu/common/encoded_key-test.cc             |  4 +-
 src/kudu/common/generic_iterators-test.cc       |  4 +-
 src/kudu/common/generic_iterators.cc            |  2 +-
 src/kudu/common/key_util-test.cc                |  3 +-
 src/kudu/common/partition.cc                    |  4 +-
 src/kudu/common/partition_pruner-test.cc        |  2 +-
 src/kudu/common/partition_pruner.cc             |  4 +-
 src/kudu/common/row.h                           |  2 +-
 src/kudu/common/row_operations-test.cc          |  4 +-
 src/kudu/common/scan_spec-test.cc               |  2 +-
 src/kudu/common/schema-test.cc                  |  2 +-
 src/kudu/common/schema.cc                       |  2 +-
 src/kudu/common/wire_protocol-test.cc           | 16 ++---
 .../integration-tests/linked_list-test-util.h   |  2 +-
 src/kudu/master/sys_catalog.cc                  |  2 +-
 .../tablet/all_types-scan-correctness-test.cc   |  2 +-
 src/kudu/tablet/cbtree-test.cc                  |  6 +-
 src/kudu/tablet/cfile_set-test.cc               |  6 +-
 src/kudu/tablet/compaction-test.cc              |  2 +-
 src/kudu/tablet/compaction.cc                   |  6 +-
 src/kudu/tablet/composite-pushdown-test.cc      |  2 +-
 src/kudu/tablet/concurrent_btree.h              |  2 +-
 src/kudu/tablet/delta_compaction.cc             |  2 +-
 src/kudu/tablet/delta_store.cc                  |  4 +-
 src/kudu/tablet/deltafile-test.cc               |  2 +-
 src/kudu/tablet/deltamemstore-test.cc           |  2 +-
 src/kudu/tablet/deltamemstore.cc                |  4 +-
 src/kudu/tablet/diskrowset-test-base.h          |  6 +-
 src/kudu/tablet/memrowset-test.cc               |  2 +-
 src/kudu/tablet/memrowset.cc                    |  4 +-
 .../tablet/mt-rowset_delta_compaction-test.cc   |  2 +-
 src/kudu/tablet/mt-tablet-test.cc               |  6 +-
 src/kudu/tablet/tablet-decoder-eval-test.cc     |  6 +-
 src/kudu/tablet/tablet-pushdown-test.cc         |  4 +-
 src/kudu/tablet/tablet-test-base.h              |  4 +-
 src/kudu/tablet/tablet-test-util.h              |  4 +-
 src/kudu/tablet/tablet_random_access-test.cc    |  2 +-
 src/kudu/tablet/transactions/transaction.cc     |  2 +-
 src/kudu/tools/tool_action_common.cc            |  2 +-
 src/kudu/tools/tool_action_local_replica.cc     |  2 +-
 src/kudu/tserver/scanners.cc                    |  2 +-
 src/kudu/tserver/tablet_server-test-base.cc     |  2 +-
 src/kudu/tserver/tablet_service.cc              |  4 +-
 src/kudu/util/inline_slice-test.cc              |  2 +-
 src/kudu/util/memory/arena-test.cc              | 18 +++---
 src/kudu/util/memory/arena.cc                   | 22 +++----
 src/kudu/util/memory/arena.h                    | 63 ++++++++++++++------
 src/kudu/util/trace.cc                          | 10 +++-
 57 files changed, 159 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/cfile/binary_dict_block.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/binary_dict_block.cc b/src/kudu/cfile/binary_dict_block.cc
index f00d75d..a6a4814 100644
--- a/src/kudu/cfile/binary_dict_block.cc
+++ b/src/kudu/cfile/binary_dict_block.cc
@@ -52,7 +52,7 @@ namespace cfile {
 BinaryDictBlockBuilder::BinaryDictBlockBuilder(const WriterOptions* options)
     : options_(options),
       dict_block_(options_),
-      dictionary_strings_arena_(1024, 1024*1024),
+      dictionary_strings_arena_(1024),
       mode_(kCodeWordMode) {
   data_builder_.reset(new BShufBlockBuilder<UINT32>(options_));
   // We use this invalid StringPiece for the "empty key". It's safe to build such

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/cfile/cfile-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile-test-base.h b/src/kudu/cfile/cfile-test-base.h
index 64fd35d..f7d97c5 100644
--- a/src/kudu/cfile/cfile-test-base.h
+++ b/src/kudu/cfile/cfile-test-base.h
@@ -467,7 +467,7 @@ void TimeReadFile(FsManager* fs_manager, const BlockId& block_id, size_t *count_
   ASSERT_OK(reader->NewIterator(&iter, CFileReader::CACHE_BLOCK));
   ASSERT_OK(iter->SeekToOrdinal(0));
 
-  Arena arena(8192, 1024 * 1024);
+  Arena arena(8192);
   int count = 0;
   switch (reader->type_info()->physical_type()) {
     case UINT8:

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/cfile/cfile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile-test.cc b/src/kudu/cfile/cfile-test.cc
index c9f0a09..db129a5 100644
--- a/src/kudu/cfile/cfile-test.cc
+++ b/src/kudu/cfile/cfile-test.cc
@@ -201,7 +201,7 @@ class TestCFile : public CFileTestBase {
     gscoped_ptr<CFileIterator> iter;
     ASSERT_OK(reader->NewIterator(&iter, CFileReader::CACHE_BLOCK));
 
-    Arena arena(8192, 1024 * 1024);
+    Arena arena(8192);
     ScopedColumnBlock<DataGeneratorType::kDataType> cb(10);
 
     SelectionVector sel(10);
@@ -607,7 +607,7 @@ void TestCFile::TestReadWriteStrings(EncodingType encoding,
   gscoped_ptr<CFileIterator> iter;
   ASSERT_OK(reader->NewIterator(&iter, CFileReader::CACHE_BLOCK));
 
-  Arena arena(1024, 1024*1024);
+  Arena arena(1024);
 
   ASSERT_OK(iter->SeekToOrdinal(5000));
   ASSERT_EQ(5000u, iter->GetCurrentOrdinal());
@@ -815,7 +815,7 @@ TEST_P(TestCFileBothCacheTypes, TestDefaultColumnIter) {
   // Test String Default Value
   Slice str_data[kNumItems];
   Slice str_value("Hello");
-  Arena arena(32*1024, 256*1024);
+  Arena arena(32*1024);
   DefaultColumnValueIterator str_iter(GetTypeInfo(STRING), &str_value);
   ColumnBlock str_col(GetTypeInfo(STRING), nullptr, str_data, kNumItems, &arena);
   ColumnMaterializationContext str_ctx = CreateNonDecoderEvalContext(&str_col, &sel);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/cfile/cfile_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_util.cc b/src/kudu/cfile/cfile_util.cc
index 31c5af3..600970a 100644
--- a/src/kudu/cfile/cfile_util.cc
+++ b/src/kudu/cfile/cfile_util.cc
@@ -46,7 +46,7 @@ Status DumpIterator(const CFileReader& reader,
                     int num_rows,
                     int indent) {
 
-  Arena arena(8192, 1024 * 1024);
+  Arena arena(8192);
   uint8_t buf[kBufSize];
   const TypeInfo *type = reader.type_info();
   size_t max_rows = kBufSize/type->size();

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/cfile/encoding-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/encoding-test.cc b/src/kudu/cfile/encoding-test.cc
index 9dcdcb4..3a05c0c 100644
--- a/src/kudu/cfile/encoding-test.cc
+++ b/src/kudu/cfile/encoding-test.cc
@@ -69,7 +69,7 @@ namespace cfile {
 class TestEncoding : public KuduTest {
  public:
   TestEncoding()
-    : arena_(1024, 1024*1024) {
+    : arena_(1024) {
   }
 
  protected:
@@ -178,7 +178,7 @@ class TestEncoding : public KuduTest {
 
   template<class BuilderType, class DecoderType>
   void TestStringSeekByValueLargeBlock() {
-    Arena arena(1024, 1024*1024); // TODO: move to fixture?
+    Arena arena(1024); // TODO(todd): move to fixture?
     gscoped_ptr<WriterOptions> opts(NewWriterOptions());
     BinaryPrefixBlockBuilder sbb(opts.get());
     const uint kCount = 1000;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/client/scan_configuration.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/scan_configuration.cc b/src/kudu/client/scan_configuration.cc
index 11abb80..fe751be 100644
--- a/src/kudu/client/scan_configuration.cc
+++ b/src/kudu/client/scan_configuration.cc
@@ -53,7 +53,7 @@ ScanConfiguration::ScanConfiguration(KuduTable* table)
       is_fault_tolerant_(false),
       snapshot_timestamp_(kNoTimestamp),
       timeout_(MonoDelta::FromMilliseconds(KuduScanner::kScanTimeoutMillis)),
-      arena_(1024, 1024 * 1024),
+      arena_(256),
       row_format_flags_(KuduScanner::NO_FLAGS) {
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/codegen/codegen-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/codegen/codegen-test.cc b/src/kudu/codegen/codegen-test.cc
index 74091f4..13540e3 100644
--- a/src/kudu/codegen/codegen-test.cc
+++ b/src/kudu/codegen/codegen-test.cc
@@ -65,9 +65,8 @@ class CodegenTest : public KuduTest {
  public:
   CodegenTest()
     : random_(SeedRandom()),
-      // Set the arena size as small as possible to catch errors during relocation,
-      // for its initial size and its eventual max size.
-      projections_arena_(16, kIndirectPerProjection * 2) {
+      // Set the initial Arena size as small as possible to catch errors during relocation.
+      projections_arena_(16) {
     // Create the base schema.
     vector<ColumnSchema> cols = { ColumnSchema("key           ", UINT64, false),
                                   ColumnSchema("int32         ",  INT32, false),
@@ -87,7 +86,7 @@ class CodegenTest : public KuduTest {
     defaults_.Reset(cols, 1);
     defaults_ = SchemaBuilder(defaults_).Build(); // add IDs
 
-    test_rows_arena_.reset(new Arena(2 * 1024, 1024 * 1024));
+    test_rows_arena_.reset(new Arena(2 * 1024));
     RowBuilder rb(base_);
     for (int i = 0; i < kNumTestRows; ++i) {
       rb.AddUint64(i);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/column_predicate-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/column_predicate-test.cc b/src/kudu/common/column_predicate-test.cc
index b9c7261..93a4e12 100644
--- a/src/kudu/common/column_predicate-test.cc
+++ b/src/kudu/common/column_predicate-test.cc
@@ -803,7 +803,7 @@ TEST_F(TestColumnPredicate, TestRangeConstructor) {
 // Test that the inclusive range constructor handles transforming to exclusive
 // upper bound correctly.
 TEST_F(TestColumnPredicate, TestInclusiveRange) {
-  Arena arena(1024, 1024 * 1024);
+  Arena arena(1024);
   {
     ColumnSchema column("c", INT32);
     int32_t zero = 0;
@@ -847,7 +847,7 @@ TEST_F(TestColumnPredicate, TestInclusiveRange) {
 // Test that the exclusive range constructor handles transforming to inclusive
 // lower bound correctly.
 TEST_F(TestColumnPredicate, TestExclusive) {
-  Arena arena(1024, 1024 * 1024);
+  Arena arena(1024);
   {
     ColumnSchema column("c", INT32);
     int32_t zero = 0;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/columnblock.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/columnblock.h b/src/kudu/common/columnblock.h
index 071e4eb..b91c316 100644
--- a/src/kudu/common/columnblock.h
+++ b/src/kudu/common/columnblock.h
@@ -217,7 +217,7 @@ class ScopedColumnBlock : public ColumnBlock {
                   new uint8_t[BitmapSize(n_rows)],
                   new cpp_type[n_rows],
                   n_rows,
-                  new Arena(1024, 1*1024*1024)),
+                  new Arena(1024)),
       null_bitmap_(null_bitmap()),
       data_(reinterpret_cast<cpp_type *>(data())),
       arena_(arena()) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/encoded_key-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/encoded_key-test.cc b/src/kudu/common/encoded_key-test.cc
index df84976..f256de1 100644
--- a/src/kudu/common/encoded_key-test.cc
+++ b/src/kudu/common/encoded_key-test.cc
@@ -234,7 +234,7 @@ TEST_F(EncodedKeyTest, TestDecodeCompoundKeys) {
 
 TEST_F(EncodedKeyTest, TestConstructFromEncodedString) {
   gscoped_ptr<EncodedKey> key;
-  Arena arena(1024, 1024*1024);
+  Arena arena(1024);
 
   {
     // Integer type compound key.
@@ -259,7 +259,7 @@ TEST_F(EncodedKeyTest, TestRandomStringEncoding) {
   Random r(SeedRandom());
   char buf[80];
   faststring encoded;
-  Arena arena(1024, 1024);
+  Arena arena(1024);
   for (int i = 0; i < 10000; i++) {
     encoded.clear();
     arena.Reset();

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/generic_iterators-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/generic_iterators-test.cc b/src/kudu/common/generic_iterators-test.cc
index ed5ed14..e7f9250 100644
--- a/src/kudu/common/generic_iterators-test.cc
+++ b/src/kudu/common/generic_iterators-test.cc
@@ -264,7 +264,7 @@ TEST(TestMaterializingIterator, TestMaterializingPredicatePushdown) {
   ASSERT_OK(materializing.Init(&spec));
   ASSERT_EQ(0, spec.predicates().size()) << "Iterator should have pushed down predicate";
 
-  Arena arena(1024, 1024);
+  Arena arena(1024);
   RowBlock dst(kIntSchema, 100, &arena);
   ASSERT_OK(materializing.NextBlock(&dst));
   ASSERT_EQ(dst.nrows(), 100);
@@ -312,7 +312,7 @@ TEST(TestPredicateEvaluatingIterator, TestPredicateEvaluation) {
   ASSERT_EQ(1, pred_eval->col_idx_predicates_.size())
     << "Predicate should be evaluated by the outer iterator";
 
-  Arena arena(1024, 1024);
+  Arena arena(1024);
   RowBlock dst(kIntSchema, 100, &arena);
   ASSERT_OK(outer_iter->NextBlock(&dst));
   ASSERT_EQ(dst.nrows(), 100);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/generic_iterators.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/generic_iterators.cc b/src/kudu/common/generic_iterators.cc
index 76fcb80..66b5d8a 100644
--- a/src/kudu/common/generic_iterators.cc
+++ b/src/kudu/common/generic_iterators.cc
@@ -90,7 +90,7 @@ class MergeIterState {
  public:
   explicit MergeIterState(shared_ptr<RowwiseIterator> iter) :
       iter_(std::move(iter)),
-      arena_(1024, 256*1024),
+      arena_(1024),
       read_block_(iter_->schema(), kMergeRowBuffer, &arena_),
       next_row_idx_(0),
       num_advanced_(0),

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/key_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/key_util-test.cc b/src/kudu/common/key_util-test.cc
index f9bf9b8..abbf741 100644
--- a/src/kudu/common/key_util-test.cc
+++ b/src/kudu/common/key_util-test.cc
@@ -37,8 +37,7 @@ namespace kudu {
 
 class KeyUtilTest : public KuduTest {
  public:
-  KeyUtilTest()
-    : arena_(1024, 4096) {}
+  KeyUtilTest() : arena_(1024) {}
 
  protected:
   uint8_t* row_data(KuduPartialRow* row) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/partition.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partition.cc b/src/kudu/common/partition.cc
index b1388db..a43aceb 100644
--- a/src/kudu/common/partition.cc
+++ b/src/kudu/common/partition.cc
@@ -720,7 +720,7 @@ string PartitionSchema::RangePartitionDebugString(Slice lower_bound,
   // Partitions are considered metadata, so don't redact them.
   ScopedDisableRedaction no_redaction;
 
-  Arena arena(1024, 128 * 1024);
+  Arena arena(256);
   KuduPartialRow lower(&schema);
   KuduPartialRow upper(&schema);
 
@@ -737,7 +737,7 @@ string PartitionSchema::RangePartitionDebugString(Slice lower_bound,
 }
 
 string PartitionSchema::RangeKeyDebugString(Slice range_key, const Schema& schema) const {
-  Arena arena(1024, 128 * 1024);
+  Arena arena(256);
   KuduPartialRow row(&schema);
 
   Status s = DecodeRangeKey(&range_key, &row, &arena);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/partition_pruner-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partition_pruner-test.cc b/src/kudu/common/partition_pruner-test.cc
index aba59fa..39f0e6a 100644
--- a/src/kudu/common/partition_pruner-test.cc
+++ b/src/kudu/common/partition_pruner-test.cc
@@ -71,7 +71,7 @@ void CheckPrunedPartitions(const Schema& schema,
 
   ScanSpec opt_spec(spec);
   AutoReleasePool p;
-  Arena arena(256, 1024 * 1024);
+  Arena arena(256);
   opt_spec.OptimizeScan(schema, &arena, &p, false);
 
   PartitionPruner pruner;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/partition_pruner.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partition_pruner.cc b/src/kudu/common/partition_pruner.cc
index e3bbebf..c5e3b6a 100644
--- a/src/kudu/common/partition_pruner.cc
+++ b/src/kudu/common/partition_pruner.cc
@@ -136,7 +136,7 @@ void EncodeRangeKeysFromPrimaryKeyBounds(const Schema& schema,
                             .type_info()
                             ->IsMinValue(scan_spec.exclusive_upper_bound_key()->raw_keys()[idx]);
       }
-      Arena arena(std::max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()), 4096);
+      Arena arena(std::max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()));
       if (!min_suffix) {
         if (!key_util::IncrementPrimaryKey(&row, num_range_columns, &arena)) {
           // The range-partition key upper bound can't be incremented, which
@@ -169,7 +169,7 @@ void EncodeRangeKeysFromPredicates(const Schema& schema,
 
   // Arenas must be at least the minimum chunk size, and we require at least
   // enough space for the range key columns.
-  Arena arena(std::max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()), 4096);
+  Arena arena(std::max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()));
   uint8_t* buf = static_cast<uint8_t*>(CHECK_NOTNULL(arena.AllocateBytes(schema.key_byte_size())));
   ContiguousRow row(&schema, buf);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/row.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/row.h b/src/kudu/common/row.h
index e667b89..ab45cb6 100644
--- a/src/kudu/common/row.h
+++ b/src/kudu/common/row.h
@@ -547,7 +547,7 @@ class RowBuilder {
  public:
   explicit RowBuilder(const Schema& schema)
     : schema_(schema),
-      arena_(1024, 1024*1024),
+      arena_(1024),
       bitmap_size_(ContiguousRowHelper::null_bitmap_size(schema)) {
     Reset();
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/row_operations-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/row_operations-test.cc b/src/kudu/common/row_operations-test.cc
index 37bef46..4404c93 100644
--- a/src/kudu/common/row_operations-test.cc
+++ b/src/kudu/common/row_operations-test.cc
@@ -52,7 +52,7 @@ namespace kudu {
 class RowOperationsTest : public KuduTest {
  public:
   RowOperationsTest()
-    : arena_(1024, 128 * 1024) {
+    : arena_(1024) {
     SeedRandom();
 
     SchemaBuilder builder;
@@ -354,7 +354,7 @@ string TestProjection(RowOperationsPB::Type type,
   enc.Add(type, client_row);
 
   // Decode it
-  Arena arena(1024, 1024*1024);
+  Arena arena(1024);
   vector<DecodedRowOperation> ops;
   RowOperationsPBDecoder dec(&pb, client_row.schema(), &server_schema, &arena);
   Status s = dec.DecodeOperations(&ops);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/scan_spec-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/scan_spec-test.cc b/src/kudu/common/scan_spec-test.cc
index ee16249..a27a8df 100644
--- a/src/kudu/common/scan_spec-test.cc
+++ b/src/kudu/common/scan_spec-test.cc
@@ -51,7 +51,7 @@ namespace kudu {
 class TestScanSpec : public KuduTest {
  public:
   explicit TestScanSpec(const Schema& s)
-    : arena_(1024, 256 * 1024),
+    : arena_(1024),
       pool_(),
       schema_(s),
       spec_() {}

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/schema-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/schema-test.cc b/src/kudu/common/schema-test.cc
index 72c2f43..c965428 100644
--- a/src/kudu/common/schema-test.cc
+++ b/src/kudu/common/schema-test.cc
@@ -304,7 +304,7 @@ TEST_F(TestSchema, TestRowOperations) {
                   ColumnSchema("col4", INT32) },
                 1);
 
-  Arena arena(1024, 256*1024);
+  Arena arena(1024);
 
   RowBuilder rb(schema);
   rb.AddString(string("row_a_1"));

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/schema.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/schema.cc b/src/kudu/common/schema.cc
index 6eeb5b9..d0f91b2 100644
--- a/src/kudu/common/schema.cc
+++ b/src/kudu/common/schema.cc
@@ -376,7 +376,7 @@ string Schema::DebugEncodedRowKey(Slice encoded_key, StartOrEnd start_or_end) co
     }
   }
 
-  Arena arena(1024, 128 * 1024);
+  Arena arena(256);
   uint8_t* buf = reinterpret_cast<uint8_t*>(arena.AllocateBytes(key_byte_size()));
   Status s = DecodeRowKey(encoded_key, buf, &arena);
   if (!s.ok()) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/common/wire_protocol-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/wire_protocol-test.cc b/src/kudu/common/wire_protocol-test.cc
index f685435..3d06b22 100644
--- a/src/kudu/common/wire_protocol-test.cc
+++ b/src/kudu/common/wire_protocol-test.cc
@@ -54,7 +54,7 @@ class WireProtocolTest : public KuduTest {
               ColumnSchema("col2", STRING),
               ColumnSchema("col3", UINT32, true /* nullable */) },
         1),
-        test_data_arena_(4096, 256 * 1024) {
+        test_data_arena_(4096) {
   }
 
   void FillRowBlockWithTestRows(RowBlock* block) {
@@ -214,7 +214,7 @@ TEST_F(WireProtocolTest, TestBadSchema_DuplicateColumnName) {
 // Create a block of rows in columnar layout and ensure that it can be
 // converted to and from protobuf.
 TEST_F(WireProtocolTest, TestColumnarRowBlockToPB) {
-  Arena arena(1024, 1024 * 1024);
+  Arena arena(1024);
   RowBlock block(schema_, 10, &arena);
   FillRowBlockWithTestRows(&block);
 
@@ -244,7 +244,7 @@ TEST_F(WireProtocolTest, TestColumnarRowBlockToPB) {
 // converted to and from protobuf.
 TEST_F(WireProtocolTest, TestColumnarRowBlockToPBWithPadding) {
   int kNumRows = 10;
-  Arena arena(1024, 1024 * 1024);
+  Arena arena(1024);
   // Create a schema with multiple UNIXTIME_MICROS columns in different
   // positions.
   Schema tablet_schema({ ColumnSchema("key", UNIXTIME_MICROS),
@@ -334,7 +334,7 @@ TEST_F(WireProtocolTest, TestColumnarRowBlockToPBWithPadding) {
 
 #ifdef NDEBUG
 TEST_F(WireProtocolTest, TestColumnarRowBlockToPBBenchmark) {
-  Arena arena(1024, 1024 * 1024);
+  Arena arena(1024);
   const int kNumTrials = AllowSlowTests() ? 100 : 10;
   RowBlock block(schema_, 10000 * kNumTrials, &arena);
   FillRowBlockWithTestRows(&block);
@@ -379,7 +379,7 @@ TEST_F(WireProtocolTest, TestInvalidRowBlock) {
 // projection (a COUNT(*) query).
 TEST_F(WireProtocolTest, TestBlockWithNoColumns) {
   Schema empty(std::vector<ColumnSchema>(), 0);
-  Arena arena(1024, 1024 * 1024);
+  Arena arena(1024);
   RowBlock block(empty, 1000, &arena);
   block.selection_vector()->SetAllTrue();
   // Unselect 100 rows
@@ -446,7 +446,7 @@ TEST_F(WireProtocolTest, TestColumnPredicateInList) {
   ColumnSchema col1("col1", INT32);
   vector<ColumnSchema> cols = { col1 };
   Schema schema(cols, 1);
-  Arena arena(1024,1024*1024);
+  Arena arena(1024);
   boost::optional<ColumnPredicate> predicate;
 
   { // col1 IN (5, 6, 10)
@@ -482,7 +482,7 @@ TEST_F(WireProtocolTest, TestColumnPredicateInList) {
     pb.set_column("col1");
     pb.mutable_in_list();
 
-    Arena arena(1024,1024*1024);
+    Arena arena(1024);
     boost::optional<ColumnPredicate> predicate;
     ASSERT_OK(ColumnPredicateFromPB(schema, &arena, pb, &predicate));
     ASSERT_EQ(PredicateType::None, predicate->predicate_type());
@@ -494,7 +494,7 @@ TEST_F(WireProtocolTest, TestColumnPredicateInList) {
     pb.mutable_in_list();
     *pb.mutable_in_list()->mutable_values()->Add() = string("\0", 1);
 
-    Arena arena(1024,1024*1024);
+    Arena arena(1024);
     boost::optional<ColumnPredicate> predicate;
     ASSERT_TRUE(ColumnPredicateFromPB(schema, &arena, pb, &predicate).IsInvalidArgument());
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/integration-tests/linked_list-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/linked_list-test-util.h b/src/kudu/integration-tests/linked_list-test-util.h
index 5bcf348..39b9dcd 100644
--- a/src/kudu/integration-tests/linked_list-test-util.h
+++ b/src/kudu/integration-tests/linked_list-test-util.h
@@ -672,7 +672,7 @@ Status LinkedListTester::VerifyLinkedListLocal(const tablet::Tablet* tablet,
                         "Cannot create new row iterator");
   RETURN_NOT_OK_PREPEND(iter->Init(NULL), "Cannot initialize row iterator");
 
-  Arena arena(1024, 1024);
+  Arena arena(1024);
   RowBlock block(projection, 100, &arena);
   while (iter->HasNext()) {
     RETURN_NOT_OK(iter->NextBlock(&block));

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/master/sys_catalog.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.cc b/src/kudu/master/sys_catalog.cc
index 13ebfd6..fe16c96 100644
--- a/src/kudu/master/sys_catalog.cc
+++ b/src/kudu/master/sys_catalog.cc
@@ -605,7 +605,7 @@ Status SysCatalogTable::ProcessRows(
   RETURN_NOT_OK(tablet_replica_->tablet()->NewRowIterator(schema_, &iter));
   RETURN_NOT_OK(iter->Init(&spec));
 
-  Arena arena(32 * 1024, 256 * 1024);
+  Arena arena(32 * 1024);
   RowBlock block(iter->schema(), 512, &arena);
   while (iter->HasNext()) {
     RETURN_NOT_OK(iter->NextBlock(&block));

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/all_types-scan-correctness-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/all_types-scan-correctness-test.cc b/src/kudu/tablet/all_types-scan-correctness-test.cc
index af06e84..edf3a2c 100644
--- a/src/kudu/tablet/all_types-scan-correctness-test.cc
+++ b/src/kudu/tablet/all_types-scan-correctness-test.cc
@@ -301,7 +301,7 @@ public:
   // Scan the results of a query. Set "count" to the number of results satisfying the predicates.
   // ScanSpec must have all desired predicates already added to it.
   void ScanWithSpec(const Schema& schema, ScanSpec spec, int* count) {
-    Arena arena(1028, 1028);
+    Arena arena(1024);
     AutoReleasePool pool;
     *count = 0;
     spec.OptimizeScan(schema, &arena, &pool, true);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/cbtree-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/cbtree-test.cc b/src/kudu/tablet/cbtree-test.cc
index 7e1c376..0445bbe 100644
--- a/src/kudu/tablet/cbtree-test.cc
+++ b/src/kudu/tablet/cbtree-test.cc
@@ -67,7 +67,7 @@ class TestCBTree : public KuduTest {
   }
 
   void DoBigKVTest(size_t key_size, size_t val_size) {
-    ThreadSafeArena arena(1024, 1024);
+    ThreadSafeArena arena(1024);
 
     char kbuf[key_size];
     char vbuf[val_size];
@@ -91,7 +91,7 @@ class TestCBTree : public KuduTest {
 // The nodes may come in slightly smaller than the requested size,
 // but should not be any larger.
 TEST_F(TestCBTree, TestNodeSizes) {
-  ThreadSafeArena arena(1024, 1024);
+  ThreadSafeArena arena(1024);
 
   LeafNode<BTreeTraits> lnode(false);
   ASSERT_LE(sizeof(lnode), BTreeTraits::kLeafNodeSize);
@@ -103,7 +103,7 @@ TEST_F(TestCBTree, TestNodeSizes) {
 
 TEST_F(TestCBTree, TestLeafNode) {
   LeafNode<BTreeTraits> lnode(false);
-  ThreadSafeArena arena(1024, 1024);
+  ThreadSafeArena arena(1024);
 
   Slice k1("key1");
   Slice v1("val1");

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/cfile_set-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/cfile_set-test.cc b/src/kudu/tablet/cfile_set-test.cc
index 7a55c8b..3f10929 100644
--- a/src/kudu/tablet/cfile_set-test.cc
+++ b/src/kudu/tablet/cfile_set-test.cc
@@ -118,7 +118,7 @@ class TestCFileSet : public KuduRowSetTest {
     ASSERT_OK(iter->Init(&spec));
 
     // Check that the range was respected on all the results.
-    Arena arena(1024, 1024);
+    Arena arena(1024);
     RowBlock block(schema_, 100, &arena);
     while (iter->HasNext()) {
       ASSERT_OK_FAST(iter->NextBlock(&block));
@@ -168,7 +168,7 @@ TEST_F(TestCFileSet, TestPartiallyMaterialize) {
   gscoped_ptr<CFileSet::Iterator> iter(fileset->NewIterator(&schema_));
   ASSERT_OK(iter->Init(nullptr));
 
-  Arena arena(4096, 1024*1024);
+  Arena arena(4096);
   RowBlock block(schema_, 100, &arena);
   rowid_t row_idx = 0;
   while (iter->HasNext()) {
@@ -282,7 +282,7 @@ TEST_F(TestCFileSet, TestRangeScan) {
   shared_ptr<CFileSet::Iterator> cfile_iter(fileset->NewIterator(&schema_));
   gscoped_ptr<RowwiseIterator> iter(new MaterializingIterator(cfile_iter));
   Schema key_schema = schema_.CreateKeyProjection();
-  Arena arena(1024, 256 * 1024);
+  Arena arena(1024);
   AutoReleasePool pool;
 
   // Create a scan with a range predicate on the key column.

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/compaction-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/compaction-test.cc b/src/kudu/tablet/compaction-test.cc
index 0304102..50a4786 100644
--- a/src/kudu/tablet/compaction-test.cc
+++ b/src/kudu/tablet/compaction-test.cc
@@ -109,7 +109,7 @@ class TestCompaction : public KuduRowSetTest {
     : KuduRowSetTest(CreateSchema()),
       op_id_(consensus::MaximumOpId()),
       row_builder_(schema_),
-      arena_(32*1024, 128*1024),
+      arena_(32*1024),
       clock_(clock::LogicalClock::CreateStartingAt(Timestamp::kInitialTimestamp)),
       log_anchor_registry_(new log::LogAnchorRegistry()) {
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/compaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/compaction.cc b/src/kudu/tablet/compaction.cc
index 076ae99..89c2a3f 100644
--- a/src/kudu/tablet/compaction.cc
+++ b/src/kudu/tablet/compaction.cc
@@ -92,7 +92,7 @@ class MemRowSetCompactionInput : public CompactionInput {
                            const MvccSnapshot& snap,
                            const Schema* projection)
     : iter_(memrowset.NewIterator(projection, snap)),
-      arena_(32*1024, 128*1024),
+      arena_(32*1024),
       has_more_blocks_(false) {
   }
 
@@ -199,7 +199,7 @@ class DiskRowSetCompactionInput : public CompactionInput {
       : base_iter_(std::move(base_iter)),
         redo_delta_iter_(std::move(redo_delta_iter)),
         undo_delta_iter_(std::move(undo_delta_iter)),
-        arena_(32 * 1024, 128 * 1024),
+        arena_(32 * 1024),
         block_(base_iter_->schema(), kRowsPerBlock, &arena_),
         redo_mutation_block_(kRowsPerBlock, static_cast<Mutation *>(nullptr)),
         undo_mutation_block_(kRowsPerBlock, static_cast<Mutation *>(nullptr)),
@@ -1200,7 +1200,7 @@ Status ReupdateMissedDeltas(const string &tablet_name,
   const Schema key_schema(input->schema().CreateKeyProjection());
 
   // Arena and projector to store/project row keys for missed delta updates
-  Arena arena(1024, 1024*1024);
+  Arena arena(1024);
   RowProjector key_projector(schema, &key_schema);
   RETURN_NOT_OK(key_projector.Init());
   faststring buf;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/composite-pushdown-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/composite-pushdown-test.cc b/src/kudu/tablet/composite-pushdown-test.cc
index 7d164da..80c1d53 100644
--- a/src/kudu/tablet/composite-pushdown-test.cc
+++ b/src/kudu/tablet/composite-pushdown-test.cc
@@ -156,7 +156,7 @@ TEST_F(CompositePushdownTest, TestPushDownExactEquality) {
 // Test for "host <= 'foo'" which should reject 'foobaz'.
 // Regression test for a bug in an earlier implementation of predicate pushdown.
 TEST_F(CompositePushdownTest, TestPushDownStringInequality) {
-  Arena arena(256, 1024);
+  Arena arena(256);
   ScanSpec spec;
   int16_t year = 2001;
   int8_t month = 9;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/concurrent_btree.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/concurrent_btree.h b/src/kudu/tablet/concurrent_btree.h
index a80fa6b..f638bb0 100644
--- a/src/kudu/tablet/concurrent_btree.h
+++ b/src/kudu/tablet/concurrent_btree.h
@@ -952,7 +952,7 @@ class PreparedMutation {
 template<class Traits = BTreeTraits>
 class CBTree {
  public:
-  CBTree() : CBTree(std::make_shared<typename Traits::ArenaType>(4 * 1024, 1024 * 1024)) {
+  CBTree() : CBTree(std::make_shared<typename Traits::ArenaType>(4 * 1024)) {
   }
 
   explicit CBTree(std::shared_ptr<typename Traits::ArenaType> arena)

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/delta_compaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_compaction.cc b/src/kudu/tablet/delta_compaction.cc
index bdefa0a..0b7fecd 100644
--- a/src/kudu/tablet/delta_compaction.cc
+++ b/src/kudu/tablet/delta_compaction.cc
@@ -122,7 +122,7 @@ Status MajorDeltaCompaction::FlushRowSetAndDeltas() {
   RETURN_NOT_OK(delta_iter_->Init(&spec));
   RETURN_NOT_OK(delta_iter_->SeekToOrdinal(0));
 
-  Arena arena(32 * 1024, 128 * 1024);
+  Arena arena(32 * 1024);
   RowBlock block(partial_schema_, kRowsPerBlock, &arena);
 
   DVLOG(1) << "Applying deltas and rewriting columns (" << partial_schema_.ToString() << ")";

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/delta_store.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_store.cc b/src/kudu/tablet/delta_store.cc
index 8c9f0a3..379a2fa 100644
--- a/src/kudu/tablet/delta_store.cc
+++ b/src/kudu/tablet/delta_store.cc
@@ -63,7 +63,7 @@ Status DebugDumpDeltaIterator(DeltaType type,
 
   const size_t kRowsPerBlock = 100;
 
-  Arena arena(32 * 1024, 128 * 1024);
+  Arena arena(32 * 1024);
   for (size_t i = 0; iter->HasNext(); ) {
     size_t n;
     if (nrows > 0) {
@@ -103,7 +103,7 @@ Status WriteDeltaIteratorToFile(DeltaIterator* iter,
 
   const size_t kRowsPerBlock = 100;
   DeltaStats stats;
-  Arena arena(32 * 1024, 128 * 1024);
+  Arena arena(32 * 1024);
   for (size_t i = 0; iter->HasNext(); ) {
     size_t n;
     if (nrows > 0) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/deltafile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltafile-test.cc b/src/kudu/tablet/deltafile-test.cc
index ab524a6..0d223d4 100644
--- a/src/kudu/tablet/deltafile-test.cc
+++ b/src/kudu/tablet/deltafile-test.cc
@@ -78,7 +78,7 @@ class TestDeltaFile : public KuduTest {
  public:
   TestDeltaFile() :
     schema_(CreateSchema()),
-    arena_(1024, 1024) {
+    arena_(1024) {
   }
 
  public:

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/deltamemstore-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltamemstore-test.cc b/src/kudu/tablet/deltamemstore-test.cc
index 6b77da6..8f17b34 100644
--- a/src/kudu/tablet/deltamemstore-test.cc
+++ b/src/kudu/tablet/deltamemstore-test.cc
@@ -478,7 +478,7 @@ TEST_F(TestDeltaMemStore, TestIteratorDoesUpdates) {
 }
 
 TEST_F(TestDeltaMemStore, TestCollectMutations) {
-  Arena arena(1024, 1024);
+  Arena arena(1024);
 
   // Update rows 5 and 12
   vector<uint32_t> to_update;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/deltamemstore.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltamemstore.cc b/src/kudu/tablet/deltamemstore.cc
index 8adfee5..bed6dfd 100644
--- a/src/kudu/tablet/deltamemstore.cc
+++ b/src/kudu/tablet/deltamemstore.cc
@@ -54,7 +54,6 @@ using strings::Substitute;
 ////////////////////////////////////////////////////////////
 
 static const int kInitialArenaSize = 16;
-static const int kMaxArenaBufferSize = 1024*1024;
 
 Status DeltaMemStore::Create(int64_t id,
                              int64_t rs_id,
@@ -77,8 +76,7 @@ DeltaMemStore::DeltaMemStore(int64_t id,
     rs_id_(rs_id),
     allocator_(new MemoryTrackingBufferAllocator(
         HeapBufferAllocator::Get(), std::move(parent_tracker))),
-    arena_(new ThreadSafeMemoryTrackingArena(
-        kInitialArenaSize, kMaxArenaBufferSize, allocator_)),
+    arena_(new ThreadSafeMemoryTrackingArena(kInitialArenaSize, allocator_)),
     tree_(arena_),
     anchorer_(log_anchor_registry,
               Substitute("Rowset-$0/DeltaMemStore-$1", rs_id_, id_)),

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/diskrowset-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset-test-base.h b/src/kudu/tablet/diskrowset-test-base.h
index e654509..cbe5c26 100644
--- a/src/kudu/tablet/diskrowset-test-base.h
+++ b/src/kudu/tablet/diskrowset-test-base.h
@@ -216,7 +216,7 @@ class TestRowSet : public KuduRowSetTest {
     gscoped_ptr<RowwiseIterator> row_iter;
     CHECK_OK(rs.NewRowIterator(&proj_val, snap, UNORDERED, &row_iter));
     CHECK_OK(row_iter->Init(NULL));
-    Arena arena(1024, 1024*1024);
+    Arena arena(1024);
     int batch_size = 10000;
     RowBlock dst(proj_val, batch_size, &arena);
 
@@ -252,7 +252,7 @@ class TestRowSet : public KuduRowSetTest {
   // asserting that the result matches 'expected_val'.
   void VerifyRandomRead(const DiskRowSet& rs, const Slice& row_key,
                         const std::string& expected_val) {
-    Arena arena(256, 1024);
+    Arena arena(256);
     AutoReleasePool pool;
     ScanSpec spec;
     auto pred = ColumnPredicate::Equality(schema_.column(0), &row_key);
@@ -279,7 +279,7 @@ class TestRowSet : public KuduRowSetTest {
     CHECK_OK(row_iter->Init(NULL));
 
     int batch_size = 1000;
-    Arena arena(1024, 1024*1024);
+    Arena arena(1024);
     RowBlock dst(schema, batch_size, &arena);
 
     int i = 0;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/memrowset-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset-test.cc b/src/kudu/tablet/memrowset-test.cc
index 881a300..6f83971 100644
--- a/src/kudu/tablet/memrowset-test.cc
+++ b/src/kudu/tablet/memrowset-test.cc
@@ -192,7 +192,7 @@ class TestMemRowSet : public KuduTest {
     gscoped_ptr<MemRowSet::Iterator> iter(mrs->NewIterator(&schema_, snap));
     CHECK_OK(iter->Init(NULL));
 
-    Arena arena(1024, 256*1024);
+    Arena arena(1024);
     RowBlock block(schema_, 100, &arena);
     int fetched = 0;
     while (iter->HasNext()) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/memrowset.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset.cc b/src/kudu/tablet/memrowset.cc
index 1bfa6c7..6c8551e 100644
--- a/src/kudu/tablet/memrowset.cc
+++ b/src/kudu/tablet/memrowset.cc
@@ -62,7 +62,6 @@ using log::LogAnchorRegistry;
 using strings::Substitute;
 
 static const int kInitialArenaSize = 16;
-static const int kMaxArenaBufferSize = 1024*1024;
 
 bool MRSRow::IsGhost() const {
   bool is_ghost = false;
@@ -116,8 +115,7 @@ MemRowSet::MemRowSet(int64_t id,
     schema_(schema),
     allocator_(new MemoryTrackingBufferAllocator(HeapBufferAllocator::Get(),
                                                  CreateMemTrackerForMemRowSet(id, parent_tracker))),
-    arena_(new ThreadSafeMemoryTrackingArena(kInitialArenaSize, kMaxArenaBufferSize,
-                                             allocator_)),
+    arena_(new ThreadSafeMemoryTrackingArena(kInitialArenaSize, allocator_)),
     tree_(arena_),
     debug_insert_count_(0),
     debug_update_count_(0),

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mt-rowset_delta_compaction-test.cc b/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
index 57be241..776df6a 100644
--- a/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
+++ b/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
@@ -107,7 +107,7 @@ class TestMultiThreadedRowSetDeltaCompaction : public TestRowSet {
   }
 
   void ReadVerify(DiskRowSet *rs) {
-    Arena arena(1024, 1024*1024);
+    Arena arena(1024);
     RowBlock dst(schema_, 1000, &arena);
     gscoped_ptr<RowwiseIterator> iter;
     ASSERT_OK(rs->NewRowIterator(&schema_,

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/mt-tablet-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mt-tablet-test.cc b/src/kudu/tablet/mt-tablet-test.cc
index d46155b..780d3d9 100644
--- a/src/kudu/tablet/mt-tablet-test.cc
+++ b/src/kudu/tablet/mt-tablet-test.cc
@@ -141,7 +141,7 @@ class MultiThreadedTabletTest : public TabletTestBase<SETUP> {
 
     LocalTabletWriter writer(this->tablet().get(), &this->client_schema_);
 
-    Arena tmp_arena(1024, 1024);
+    Arena tmp_arena(1024);
     RowBlock block(schema_, 1, &tmp_arena);
     faststring update_buf;
 
@@ -211,7 +211,7 @@ class MultiThreadedTabletTest : public TabletTestBase<SETUP> {
   // This is meant to test that outstanding iterators don't end up
   // trying to reference already-freed memrowset memory.
   void SlowReaderThread(int tid) {
-    Arena arena(32*1024, 256*1024);
+    Arena arena(32*1024);
     RowBlock block(schema_, 1, &arena);
 
     uint64_t max_rows = this->ClampRowCount(FLAGS_inserts_per_thread * FLAGS_num_insert_threads)
@@ -244,7 +244,7 @@ class MultiThreadedTabletTest : public TabletTestBase<SETUP> {
   }
 
   uint64_t CountSum(const shared_ptr<TimeSeries> &scanned_ts) {
-    Arena arena(1024, 1024); // unused, just scanning ints
+    Arena arena(1024); // unused, just scanning ints
 
     static const int kBufInts = 1024*1024 / 8;
     RowBlock block(valcol_projection_, kBufInts, &arena);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/tablet-decoder-eval-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-decoder-eval-test.cc b/src/kudu/tablet/tablet-decoder-eval-test.cc
index 3522629..c49c969 100644
--- a/src/kudu/tablet/tablet-decoder-eval-test.cc
+++ b/src/kudu/tablet/tablet-decoder-eval-test.cc
@@ -158,7 +158,7 @@ public:
 
   void TestTimedScanWithBounds(size_t nrows, size_t cardinality, size_t strlen, size_t lower_val,
                                size_t upper_val, int* fetched) {
-    Arena arena(128, 1028);
+    Arena arena(128);
     AutoReleasePool pool;
     ScanSpec spec;
 
@@ -226,7 +226,7 @@ public:
                               Substitute("$0", upper).length(),
                               Substitute("$0", cardinality).length()});
     FillTestTablet(nrows, 10, strlen, -1);
-    Arena arena(128, 1028);
+    Arena arena(128);
     AutoReleasePool pool;
     ScanSpec spec;
 
@@ -257,7 +257,7 @@ public:
     ASSERT_OK(iter->Init(&spec));
     ASSERT_TRUE(spec.predicates().empty()) << "Should have accepted all predicates";
 
-    Arena ret_arena(1028, 1028);
+    Arena ret_arena(1024);
     size_t expected_count = ExpectedCount(nrows, cardinality, lower, upper);
     Schema schema = iter->schema();
     RowBlock block(schema, 100, &ret_arena);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/tablet-pushdown-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-pushdown-test.cc b/src/kudu/tablet/tablet-pushdown-test.cc
index cabc2a3..c8c4190 100644
--- a/src/kudu/tablet/tablet-pushdown-test.cc
+++ b/src/kudu/tablet/tablet-pushdown-test.cc
@@ -104,7 +104,7 @@ class TabletPushdownTest : public KuduTabletTest,
   // the same set of rows. Run the scan and verify that the
   // expected rows are returned.
   void TestScanYieldsExpectedResults(ScanSpec spec) {
-    Arena arena(128, 1028);
+    Arena arena(128);
     AutoReleasePool pool;
     spec.OptimizeScan(schema_, &arena, &pool, true);
 
@@ -171,7 +171,7 @@ class TabletPushdownTest : public KuduTabletTest,
   // returns the expected number of rows. The rows themselves
   // should be empty.
   void TestCountOnlyScanYieldsExpectedResults(ScanSpec spec) {
-    Arena arena(128, 1028);
+    Arena arena(128);
     AutoReleasePool pool;
     spec.OptimizeScan(schema_, &arena, &pool, true);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/tablet-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-test-base.h b/src/kudu/tablet/tablet-test-base.h
index d813aa7..2f99025 100644
--- a/src/kudu/tablet/tablet-test-base.h
+++ b/src/kudu/tablet/tablet-test-base.h
@@ -310,7 +310,7 @@ class TabletTestBase : public KuduTabletTest {
     KuduTabletTest(TESTSETUP::CreateSchema(), clock_type),
     setup_(),
     max_rows_(setup_.GetMaxRows()),
-    arena_(1024, 1024 * 1024)
+    arena_(1024)
   {}
 
   // Inserts "count" rows.
@@ -429,7 +429,7 @@ class TabletTestBase : public KuduTabletTest {
     ASSERT_OK(iter->Init(NULL));
     int batch_size = std::max<size_t>(1, std::min<size_t>(expected_row_count / 10,
                                                           4L * 1024 * 1024 / schema_.byte_size()));
-    Arena arena(32*1024, 256*1024);
+    Arena arena(32*1024);
     RowBlock block(schema_, batch_size, &arena);
 
     bool check_for_dups = true;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/tablet-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-test-util.h b/src/kudu/tablet/tablet-test-util.h
index 4b76bac..7256502 100644
--- a/src/kudu/tablet/tablet-test-util.h
+++ b/src/kudu/tablet/tablet-test-util.h
@@ -141,7 +141,7 @@ class KuduRowSetTest : public KuduTabletTest {
 static inline Status SilentIterateToStringList(RowwiseIterator* iter,
                                                int* fetched) {
   const Schema& schema = iter->schema();
-  Arena arena(1024, 1024);
+  Arena arena(1024);
   RowBlock block(schema, 100, &arena);
   *fetched = 0;
   while (iter->HasNext()) {
@@ -160,7 +160,7 @@ static inline Status IterateToStringList(RowwiseIterator* iter,
                                          int limit = INT_MAX) {
   out->clear();
   Schema schema = iter->schema();
-  Arena arena(1024, 1024);
+  Arena arena(1024);
   RowBlock block(schema, 100, &arena);
   int fetched = 0;
   while (iter->HasNext() && fetched < limit) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/tablet_random_access-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_random_access-test.cc b/src/kudu/tablet/tablet_random_access-test.cc
index 4c25dec..a7c831e 100644
--- a/src/kudu/tablet/tablet_random_access-test.cc
+++ b/src/kudu/tablet/tablet_random_access-test.cc
@@ -279,7 +279,7 @@ class TestRandomAccess : public KuduTabletTest {
     optional<ExpectedKeyValueRow> ret;
     int n_results = 0;
 
-    Arena arena(1024, 1024 * 1024);
+    Arena arena(1024);
     RowBlock block(schema, 100, &arena);
     while (iter->HasNext()) {
       arena.Reset();

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tablet/transactions/transaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/transactions/transaction.cc b/src/kudu/tablet/transactions/transaction.cc
index 7a95914..2ee867f 100644
--- a/src/kudu/tablet/transactions/transaction.cc
+++ b/src/kudu/tablet/transactions/transaction.cc
@@ -34,7 +34,7 @@ TransactionState::TransactionState(TabletReplica* tablet_replica)
     : tablet_replica_(tablet_replica),
       completion_clbk_(new TransactionCompletionCallback()),
       timestamp_error_(0),
-      arena_(1024, 1024 * 1024),
+      arena_(1024),
       external_consistency_mode_(CLIENT_PROPAGATED) {
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tools/tool_action_common.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_common.cc b/src/kudu/tools/tool_action_common.cc
index 35471ee..43eb723 100644
--- a/src/kudu/tools/tool_action_common.cc
+++ b/src/kudu/tools/tool_action_common.cc
@@ -209,7 +209,7 @@ Status PrintDecodedWriteRequestPB(const string& indent,
   Schema request_schema;
   RETURN_NOT_OK(SchemaFromPB(write.schema(), &request_schema));
 
-  Arena arena(32 * 1024, 1024 * 1024);
+  Arena arena(32 * 1024);
   RowOperationsPBDecoder dec(&write.row_operations(), &request_schema, &tablet_schema, &arena);
   vector<DecodedRowOperation> ops;
   RETURN_NOT_OK(dec.DecodeOperations(&ops));

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tools/tool_action_local_replica.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_local_replica.cc b/src/kudu/tools/tool_action_local_replica.cc
index b654578..94b3ae7 100644
--- a/src/kudu/tools/tool_action_local_replica.cc
+++ b/src/kudu/tools/tool_action_local_replica.cc
@@ -729,7 +729,7 @@ Status DumpDeltaCFileBlockInternal(FsManager* fs_manager,
   const size_t kRowsPerBlock  = 100;
   size_t nrows = 0;
   size_t ndeltas = 0;
-  Arena arena(32 * 1024, 128 * 1024);
+  Arena arena(32 * 1024);
   RowBlock block(schema, kRowsPerBlock, &arena);
 
   // See tablet/delta_compaction.cc to understand why this loop is structured the way

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tserver/scanners.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/scanners.cc b/src/kudu/tserver/scanners.cc
index 846c7b8..d328ae8 100644
--- a/src/kudu/tserver/scanners.cc
+++ b/src/kudu/tserver/scanners.cc
@@ -210,7 +210,7 @@ Scanner::Scanner(string id, const scoped_refptr<TabletReplica>& tablet_replica,
       call_seq_id_(0),
       start_time_(MonoTime::Now()),
       metrics_(metrics),
-      arena_(1024, 1024 * 1024),
+      arena_(256),
       row_format_flags_(row_format_flags) {
   if (tablet_replica_) {
     auto tablet = tablet_replica->shared_tablet();

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tserver/tablet_server-test-base.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_server-test-base.cc b/src/kudu/tserver/tablet_server-test-base.cc
index 8e701ce..6bc2f75 100644
--- a/src/kudu/tserver/tablet_server-test-base.cc
+++ b/src/kudu/tserver/tablet_server-test-base.cc
@@ -391,7 +391,7 @@ void TabletServerTestBase::VerifyRows(const Schema& schema,
   const size_t batch_size =
       std::max(size_t(1), std::min(expected.size() / 10,
                                    4*1024*1024 / schema.byte_size()));
-  Arena arena(32*1024, 256*1024);
+  Arena arena(32*1024);
   RowBlock block(schema, batch_size, &arena);
 
   int count = 0;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/tserver/tablet_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_service.cc b/src/kudu/tserver/tablet_service.cc
index bb4bc59..e3af58b 100644
--- a/src/kudu/tserver/tablet_service.cc
+++ b/src/kudu/tserver/tablet_service.cc
@@ -1870,10 +1870,10 @@ Status TabletServiceImpl::HandleContinueScanRequest(const ScanRequestPB* req,
 
   RowwiseIterator* iter = scanner->iter();
 
-  // TODO: could size the RowBlock based on the user's requested batch size?
+  // TODO(todd): could size the RowBlock based on the user's requested batch size?
   // If people had really large indirect objects, we would currently overshoot
   // their requested batch size by a lot.
-  Arena arena(32 * 1024, 1 * 1024 * 1024);
+  Arena arena(32 * 1024);
   RowBlock block(scanner->iter()->schema(),
                  FLAGS_scanner_batch_size_rows, &arena);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/util/inline_slice-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/inline_slice-test.cc b/src/kudu/util/inline_slice-test.cc
index 8435bb0..60a0005 100644
--- a/src/kudu/util/inline_slice-test.cc
+++ b/src/kudu/util/inline_slice-test.cc
@@ -59,7 +59,7 @@ static void TestRoundTrip(InlineSlice<N> *slice,
 // data
 template<size_t N>
 static void DoTest() {
-  Arena arena(1024, 4096);
+  Arena arena(1024);
 
   // Test a range of inputs both growing and shrinking
   InlineSlice<N> my_slice;

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/util/memory/arena-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena-test.cc b/src/kudu/util/memory/arena-test.cc
index f4691c4..695e305 100644
--- a/src/kudu/util/memory/arena-test.cc
+++ b/src/kudu/util/memory/arena-test.cc
@@ -71,8 +71,7 @@ static void AllocateThreadTSArena(ThreadSafeArena *arena, uint8_t thread_index)
 
 
 TEST(TestArena, TestSingleThreaded) {
-  Arena arena(128, 128);
-
+  Arena arena(128);
   AllocateThread(&arena, 0);
 }
 
@@ -81,7 +80,7 @@ TEST(TestArena, TestSingleThreaded) {
 TEST(TestArena, TestMultiThreaded) {
   CHECK(FLAGS_num_threads < 256);
 
-  ThreadSafeArena arena(1024, 1024);
+  ThreadSafeArena arena(1024);
 
   vector<thread> threads;
   for (uint8_t i = 0; i < FLAGS_num_threads; i++) {
@@ -94,8 +93,7 @@ TEST(TestArena, TestMultiThreaded) {
 }
 
 TEST(TestArena, TestAlignment) {
-
-  ThreadSafeArena arena(1024, 1024);
+  ThreadSafeArena arena(1024);
   for (int i = 0; i < 1000; i++) {
     int alignment = 1 << (1 % 5);
 
@@ -110,7 +108,7 @@ TEST(TestArena, TestObjectAlignment) {
   struct MyStruct {
     int64_t v;
   };
-  Arena a(256, 256 * 1024);
+  Arena a(256);
   // Allocate a junk byte to ensure that the next allocation isn't "accidentally" aligned.
   a.AllocateBytes(1);
   void* v = a.NewObject<MyStruct>();
@@ -134,7 +132,7 @@ TEST(TestArena, TestMemoryTrackerParentReferences) {
   }
   shared_ptr<MemoryTrackingBufferAllocator> allocator(
       new MemoryTrackingBufferAllocator(HeapBufferAllocator::Get(), child_tracker));
-  MemoryTrackingArena arena(256, 1024, allocator);
+  MemoryTrackingArena arena(256, allocator);
 
   // Try some child operations.
   ASSERT_EQ(256, child_tracker->consumption());
@@ -150,7 +148,7 @@ TEST(TestArena, TestMemoryTrackingDontEnforce) {
   shared_ptr<MemTracker> mem_tracker = MemTracker::CreateTracker(1024, "arena-test-tracker");
   shared_ptr<MemoryTrackingBufferAllocator> allocator(
       new MemoryTrackingBufferAllocator(HeapBufferAllocator::Get(), mem_tracker));
-  MemoryTrackingArena arena(256, 1024, allocator);
+  MemoryTrackingArena arena(256, allocator);
   ASSERT_EQ(256, mem_tracker->consumption());
   void *allocated = arena.AllocateBytes(256);
   ASSERT_TRUE(allocated);
@@ -181,7 +179,7 @@ TEST(TestArena, TestMemoryTrackingEnforced) {
       new MemoryTrackingBufferAllocator(HeapBufferAllocator::Get(), mem_tracker,
                                         // enforce limit
                                         true));
-  MemoryTrackingArena arena(256, 1024, allocator);
+  MemoryTrackingArena arena(256, allocator);
   ASSERT_EQ(256, mem_tracker->consumption());
   void *allocated = arena.AllocateBytes(256);
   ASSERT_TRUE(allocated);
@@ -192,7 +190,7 @@ TEST(TestArena, TestMemoryTrackingEnforced) {
 }
 
 TEST(TestArena, TestSTLAllocator) {
-  Arena a(256, 256 * 1024);
+  Arena a(256);
   typedef vector<int, ArenaAllocator<int, false> > ArenaVector;
   ArenaAllocator<int, false> alloc(&a);
   ArenaVector v(alloc);

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/util/memory/arena.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena.cc b/src/kudu/util/memory/arena.cc
index 490be0a..6eb8b9c 100644
--- a/src/kudu/util/memory/arena.cc
+++ b/src/kudu/util/memory/arena.cc
@@ -32,23 +32,25 @@ template <bool THREADSAFE>
 const size_t ArenaBase<THREADSAFE>::kMinimumChunkSize = 16;
 
 template <bool THREADSAFE>
-ArenaBase<THREADSAFE>::ArenaBase(
-  BufferAllocator* const buffer_allocator,
-  size_t initial_buffer_size,
-  size_t max_buffer_size)
+ArenaBase<THREADSAFE>::ArenaBase(BufferAllocator* buffer_allocator,
+                                 size_t initial_buffer_size)
     : buffer_allocator_(buffer_allocator),
-      max_buffer_size_(max_buffer_size),
+      max_buffer_size_(1024 * 1024),
       arena_footprint_(0) {
-  DCHECK_LE(max_buffer_size_, 1024 * 1024)
-      << "Should not use buffer sizes larger than 1MB due to tcmalloc inefficiencies";
   AddComponent(CHECK_NOTNULL(NewComponent(initial_buffer_size, 0)));
 }
 
 template <bool THREADSAFE>
-ArenaBase<THREADSAFE>::ArenaBase(size_t initial_buffer_size, size_t max_buffer_size)
+ArenaBase<THREADSAFE>::ArenaBase(size_t initial_buffer_size)
     : ArenaBase<THREADSAFE>(HeapBufferAllocator::Get(),
-                            initial_buffer_size,
-                            max_buffer_size) {
+                            initial_buffer_size) {
+}
+
+template <bool THREADSAFE>
+void ArenaBase<THREADSAFE>::SetMaxBufferSize(size_t size) {
+  DCHECK_LE(size, 1024 * 1024)
+      << "Should not use buffer sizes larger than 1MB due to tcmalloc inefficiencies";
+  max_buffer_size_ = size;
 }
 
 template <bool THREADSAFE>

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/util/memory/arena.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena.h b/src/kudu/util/memory/arena.h
index 750e9d9..36c6dc5 100644
--- a/src/kudu/util/memory/arena.h
+++ b/src/kudu/util/memory/arena.h
@@ -78,9 +78,8 @@ class ArenaBase {
   // Arenas are required to have a minimum size of at least this amount.
   static const size_t kMinimumChunkSize;
 
-  // Creates a new arena, with a single buffer of size up-to
-  // initial_buffer_size, upper size limit for later-allocated buffers capped
-  // at max_buffer_size, and maximum capacity (i.e. total sizes of all buffers)
+  // Creates a new arena, with a single buffer of size up-to initial_buffer_size
+  // and maximum capacity (i.e. total sizes of all buffers)
   // possibly limited by the buffer allocator. The allocator might cap the
   // initial allocation request arbitrarily (down to zero). As a consequence,
   // arena construction never fails due to OOM.
@@ -88,14 +87,42 @@ class ArenaBase {
   // Calls to AllocateBytes() will then give out bytes from the working buffer
   // until it is exhausted. Then, a subsequent working buffer will be allocated.
   // The size of the next buffer is normally 2x the size of the previous buffer.
-  // It might be capped by the allocator, or by the max_buffer_size parameter.
-  ArenaBase(BufferAllocator* const buffer_allocator,
-            size_t initial_buffer_size,
-            size_t max_buffer_size);
+  // It might be capped by the allocator, or by the max_buffer_size of the Arena,
+  // settable by SetMaxBufferSize below.
+  //
+  // The default maximum buffer size is 1MB. See 'SetMaxBufferSize' for details
+  // on when you would want to configure this differently.
+  ArenaBase(BufferAllocator* buffer_allocator,
+            size_t initial_buffer_size);
+
+  // Creates an arena using a default (heap) allocator.
+  explicit ArenaBase(size_t initial_buffer_size);
 
-  // Creates an arena using a default (heap) allocator with unbounded capacity.
-  // Discretion advised.
-  ArenaBase(size_t initial_buffer_size, size_t max_buffer_size);
+  // Set the maximum buffer size allocated for this arena.
+  // The maximum buffer size allowed is 1MB.
+  //
+  // Consider the following pros/cons of large buffer sizes:
+  //
+  // Pros:
+  //   - Fewer heap allocations if the arena will hold a lot of data.
+  //     (hence better allocation performance out of the arena)
+  //   - Better page locality for objects allocated out of the same arena,
+  //     especially if huge pages are in use.
+  //   - Less internal fragmentation at the "end" of each buffer if the
+  //     size of allocations from the arena is close to the size of the
+  //     buffer. For example, with a 128KB max buffer size and 65KB
+  //     allocations, we will only be able to make one allocation from
+  //     each buffer and waste nearly 50% of memory.
+  // Cons:
+  //   - Larger heap allocations may be more difficult to fulfill if the
+  //     heap is fragmented.
+  //
+  // Overall, if you aren't sure, just leave it at the default.
+  //
+  // NOTE: this method is not thread-safe, even in the thread-safe variant.
+  // It is expected to call this only immediately after constructing the
+  // Arena instance, but before making any allocations.
+  void SetMaxBufferSize(size_t size);
 
   // Adds content of the specified Slice to the arena, and returns a
   // pointer to it. The pointer is guaranteed to remain valid during the
@@ -192,7 +219,7 @@ class ArenaBase {
   // The current component to allocate from.
   // Use AcquireLoadCurrent and ReleaseStoreCurrent to load/store.
   Component* current_;
-  const size_t max_buffer_size_;
+  size_t max_buffer_size_;
   size_t arena_footprint_;
 
   // Lock covering 'slow path' allocation, when new components are
@@ -265,15 +292,15 @@ template<class T, bool THREADSAFE> class ArenaAllocator {
 
 class Arena : public ArenaBase<false> {
  public:
-  explicit Arena(size_t initial_buffer_size, size_t max_buffer_size) :
-    ArenaBase<false>(initial_buffer_size, max_buffer_size)
+  explicit Arena(size_t initial_buffer_size) :
+    ArenaBase<false>(initial_buffer_size)
   {}
 };
 
 class ThreadSafeArena : public ArenaBase<true> {
  public:
-  explicit ThreadSafeArena(size_t initial_buffer_size, size_t max_buffer_size) :
-    ArenaBase<true>(initial_buffer_size, max_buffer_size)
+  explicit ThreadSafeArena(size_t initial_buffer_size) :
+    ArenaBase<true>(initial_buffer_size)
   {}
 };
 
@@ -285,9 +312,8 @@ class MemoryTrackingArena : public ArenaBase<false> {
 
   MemoryTrackingArena(
       size_t initial_buffer_size,
-      size_t max_buffer_size,
       const std::shared_ptr<MemoryTrackingBufferAllocator>& tracking_allocator)
-      : ArenaBase<false>(tracking_allocator.get(), initial_buffer_size, max_buffer_size),
+      : ArenaBase<false>(tracking_allocator.get(), initial_buffer_size),
         tracking_allocator_(tracking_allocator) {}
 
   ~MemoryTrackingArena() {
@@ -305,9 +331,8 @@ class ThreadSafeMemoryTrackingArena : public ArenaBase<true> {
 
   ThreadSafeMemoryTrackingArena(
       size_t initial_buffer_size,
-      size_t max_buffer_size,
       const std::shared_ptr<MemoryTrackingBufferAllocator>& tracking_allocator)
-      : ArenaBase<true>(tracking_allocator.get(), initial_buffer_size, max_buffer_size),
+      : ArenaBase<true>(tracking_allocator.get(), initial_buffer_size),
         tracking_allocator_(tracking_allocator) {}
 
   ~ThreadSafeMemoryTrackingArena() {

http://git-wip-us.apache.org/repos/asf/kudu/blob/892a5fc0/src/kudu/util/trace.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/trace.cc b/src/kudu/util/trace.cc
index 7b996cf..2dc4273 100644
--- a/src/kudu/util/trace.cc
+++ b/src/kudu/util/trace.cc
@@ -45,9 +45,13 @@ namespace kudu {
 __thread Trace* Trace::threadlocal_trace_;
 
 Trace::Trace()
-  : arena_(new ThreadSafeArena(1024, 128*1024)),
-    entries_head_(nullptr),
-    entries_tail_(nullptr) {
+    : arena_(new ThreadSafeArena(1024)),
+      entries_head_(nullptr),
+      entries_tail_(nullptr) {
+  // We expect small allocations from our Arena so no need to have
+  // a large arena component. Small allocations are more likely to
+  // come out of thread cache and be fast.
+  arena_->SetMaxBufferSize(4096);
 }
 
 Trace::~Trace() {


Mime
View raw message