Skip to content

Commit

Permalink
[#8225] Disable automatic tablet splitting for YEDIS tables
Browse files Browse the repository at this point in the history
Summary: See title

Test Plan: ybd --cxx-test integration-tests_tablet-split-itest --gtest_filter TabletSplitYedisTableTest.BlockSplittingYedisTablet

Reviewers: timur, bogdan

Reviewed By: bogdan

Subscribers: ybase, bogdan

Differential Revision: https://phabricator.dev.yugabyte.com/D11689
  • Loading branch information
robertsami committed May 29, 2021
1 parent 7537427 commit de79792
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/yb/integration-tests/tablet-split-itest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "yb/gutil/dynamic_annotations.h"
#include "yb/integration-tests/mini_cluster.h"
#include "yb/integration-tests/redis_table_test_base.h"
#include "yb/integration-tests/test_workload.h"

#include "yb/master/catalog_manager.h"
Expand Down Expand Up @@ -1353,6 +1354,32 @@ TEST_F(TabletSplitITest, AutomaticTabletSplitting) {
}
}

class TabletSplitYedisTableTest : public integration_tests::RedisTableTestBase {
protected:
int num_tablets() override { return 1; }
};

TEST_F(TabletSplitYedisTableTest, BlockSplittingYedisTablet) {
constexpr int kNumRows = 10000;

for (int i = 0; i < kNumRows; ++i) {
PutKeyValue(Format("$0", i), Format("$0", i));
}

for (const auto& peer : ListTableActiveTabletPeers(mini_cluster(), table_->id())) {
ASSERT_OK(peer->shared_tablet()->Flush(tablet::FlushMode::kSync));
}

for (const auto& peer : ListTableActiveTabletLeadersPeers(mini_cluster(), table_->id())) {
auto catalog_manager = CHECK_NOTNULL(
this->mini_cluster()->leader_mini_master()->master())->catalog_manager();

auto s = DoSplitTablet(catalog_manager, *peer->shared_tablet());
EXPECT_NOT_OK(s);
EXPECT_TRUE(s.IsNotSupported()) << s.ToString();
}
}

class TabletSplitSingleServerITest : public TabletSplitITest {
protected:
int64_t GetRF() override { return 1; }
Expand Down
2 changes: 1 addition & 1 deletion src/yb/integration-tests/yb_table_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void YBTableTestBase::CreateRedisTable(const YBTableName& table_name) {
table_name.namespace_type()));
ASSERT_OK(NewTableCreator()->table_name(table_name)
.table_type(YBTableType::REDIS_TABLE_TYPE)
.num_tablets(CalcNumTablets(3))
.num_tablets(num_tablets())
.Create());
}

Expand Down
6 changes: 6 additions & 0 deletions src/yb/master/catalog_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,12 @@ Status CatalogManager::ValidateSplitCandidate(const TabletInfo& tablet_info) con
tablet_state);
}
}
if (tablet_info.table()->GetTableType() == REDIS_TABLE_TYPE) {
return STATUS_FORMAT(
NotSupported,
"Tablet splitting is not supported for YEDIS tables, tablet_id: $0",
tablet_info.tablet_id());
}
if (FLAGS_tablet_split_limit_per_table != 0 &&
tablet_info.table()->NumTablets() >= FLAGS_tablet_split_limit_per_table) {
// TODO(tsplit): Avoid tablet server of scanning tablets for the tables that already
Expand Down

0 comments on commit de79792

Please sign in to comment.