You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "David Ribeiro Alves (Code Review)" <ge...@cloudera.org> on 2017/05/05 20:21:17 UTC
[kudu-CR] WIP: release WritableLogSegment buffers when log is idle
David Ribeiro Alves has posted comments on this change.
Change subject: WIP: release WritableLogSegment buffers when log is idle
......................................................................
Patch Set 2:
(2 comments)
yeah, it'd nice to quantify how much data we're wasting on this.
http://gerrit.cloudera.org:8080/#/c/6611/2/src/kudu/consensus/log.cc
File src/kudu/consensus/log.cc:
PS2, Line 224: // TODO(todd): consider rolling to a non-preallocated segment if we are
: // idle for a good period of time (eg a few minutes), so that startup time is
: // improved and disk usage is minimized.
I forget, do all of you memstores get flushed in a time basis, no matter how small?
http://gerrit.cloudera.org:8080/#/c/6611/2/src/kudu/util/faststring-test.cc
File src/kudu/util/faststring-test.cc:
PS2, Line 18: #include <algorithm>
: #include "kudu/util/faststring.h"
: #include "kudu/util/random.h"
: #include "kudu/util/random_util.h"
: #include "kudu/util/test_util.h"
:
: namespace kudu {
: class FaststringTest : public KuduTest {};
:
: TEST_F(FaststringTest, TestShrinkToFit_Empty) {
: faststring s;
: s.shrink_to_fit();
: ASSERT_EQ(faststring::kInitialCapacity, s.capacity());
: }
:
: TEST_F(FaststringTest, TestShrinkToFit_SmallerThanInitialCapacity) {
: faststring s;
: s.append("hello");
: s.shrink_to_fit();
: ASSERT_EQ(faststring::kInitialCapacity, s.capacity());
: }
:
: TEST_F(FaststringTest, TestShrinkToFit_Random) {
: Random r(GetRandomSeed32());
: int kMaxSize = faststring::kInitialCapacity * 2;
: std::unique_ptr<char[]> random_bytes(new char[kMaxSize]);
: RandomString(random_bytes.get(), kMaxSize, &r);
:
: faststring s;
: for (int i = 0; i < 100; i++) {
: int new_size = r.Uniform(kMaxSize);
: s.resize(new_size);
: memcpy(s.data(), random_bytes.get(), new_size);
: s.shrink_to_fit();
: ASSERT_EQ(0, memcmp(s.data(), random_bytes.get(), new_size));
: ASSERT_EQ(std::max<int>(faststring::kInitialCapacity, new_size), s.capacity());
: }
: }
split the faststring changes?
--
To view, visit http://gerrit.cloudera.org:8080/6611
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I512c7f9264ac9490e6a57259e4d7b2608adc1ca7
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes