This is an automated email from the ASF dual-hosted git repository.
achennaka pushed a commit to branch branch-1.18.x
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/branch-1.18.x by this push:
new e77a39a06 KUDU-3704 fix crash in C++ client
e77a39a06 is described below
commit e77a39a06a1301dd468f6747d03a03f51da370a1
Author: Alexey Serbin <[email protected]>
AuthorDate: Sat Oct 4 13:58:01 2025 -0700
KUDU-3704 fix crash in C++ client
The bug has been introduced with KUDU-3461.
[1] https://issues.apache.org/jira/browse/KUDU-3461
Change-Id: I317217fe487930770768ba045b65f5fe2928833c
Reviewed-on: http://gerrit.cloudera.org:8080/23496
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Marton Greber <[email protected]>
Reviewed-by: Gabriella Lotz <[email protected]>
(cherry picked from commit 913b17b2dee395f870ea794181f68ff22007f714)
Conflicts:
src/kudu/client/client-test.cc
Reviewed-on: http://gerrit.cloudera.org:8080/23503
Reviewed-by: Abhishek Chennaka <[email protected]>
---
src/kudu/client/client-test.cc | 54 ++++++++++++++++++++++++++++++++++++++++++
src/kudu/client/meta_cache.cc | 4 ++--
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index 872b73508..d30af8c54 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -10610,5 +10610,59 @@ TEST_F(ClientTestMetacache,
TestClientMetacacheInvalidation) {
FLAGS_prevent_kudu_3461_infinite_recursion = true;
TestClientMetacacheHelper(CURRENT_TEST_NAME());
}
+
+// KUDU-3704 regression test.
+TEST_F(ClientTestMetacache, VerboseLogCrash) {
+ const string table_name = "kudu3704";
+
+ // Set very short TTL for table locations.
+ FLAGS_table_locations_ttl_ms = 100;
+
+ {
+ // Create the test table with a single range partition and the rest of the
+ // key space non-covered. Use the 'client_' for the DDL operation.
+ unique_ptr<KuduPartialRow> lower_bound(schema_.NewRow());
+ ASSERT_OK(lower_bound->SetInt32("key", 0));
+ unique_ptr<KuduPartialRow> upper_bound(schema_.NewRow());
+ ASSERT_OK(upper_bound->SetInt32("key", 1));
+ unique_ptr<KuduTableCreator> table_creator(client_->NewTableCreator());
+ table_creator->add_range_partition(lower_bound.release(),
upper_bound.release());
+ ASSERT_OK(table_creator->table_name(table_name)
+ .schema(&schema_)
+ .num_replicas(1)
+ .set_range_partition_columns({ "key" })
+ .Create());
+ }
+
+ // Create a separate client for DML operations.
+ shared_ptr<KuduClient> dml_client;
+ ASSERT_OK(cluster_->CreateClient(nullptr, &dml_client));
+ shared_ptr<KuduTable> table;
+ ASSERT_OK(dml_client->OpenTable(table_name, &table));
+
+ // Insert a single row into the existing range: this is at least to populate
+ // the client's metacache with entries.
+ NO_FATALS(InsertTestRows(dml_client.get(), table.get(), 1, 0));
+
+ {
+ unique_ptr<KuduTableAlterer> alterer(client_->NewTableAlterer(table_name));
+ unique_ptr<KuduPartialRow> lower_bound(schema_.NewRow());
+ ASSERT_OK(lower_bound->SetInt32("key", 1));
+ unique_ptr<KuduPartialRow> upper_bound(schema_.NewRow());
+ ASSERT_OK(upper_bound->SetInt32("key", 2));
+ alterer->AddRangePartition(lower_bound.release(), upper_bound.release());
+ ASSERT_OK(alterer->Alter());
+ }
+
+ // Increase log level to print out verlbose logs up to level 2.
+ client::SetVerboseLogLevel(2);
+
+ // Let the entries in the dml_client's meta-cache expire, and try to insert
+ // a row into the newly added range partition. Of course this should succeed,
+ // but prior to KUDU-3704 fix it would crash.
+ SleepFor(MonoDelta::FromMilliseconds(FLAGS_table_locations_ttl_ms));
+ NO_FATALS(InsertTestRows(dml_client.get(), table.get(), 1, 1));
+}
+
} // namespace client
} // namespace kudu
diff --git a/src/kudu/client/meta_cache.cc b/src/kudu/client/meta_cache.cc
index 9183ced3d..4af0f0cdd 100644
--- a/src/kudu/client/meta_cache.cc
+++ b/src/kudu/client/meta_cache.cc
@@ -1277,8 +1277,8 @@ bool MetaCache::LookupEntryByKeyFastPath(const KuduTable*
table,
// Stale entries must be re-fetched.
if (e->stale()) {
- VLOG(2) << Substitute("Table $0: Stale entry for tablet $1 found, must be
re-fetched.",
- table->name(), e->tablet()->tablet_id());
+ VLOG(2) << Substitute("Table $0: stale entry must be re-fetched: $1",
+ table->name(), e->DebugString(table));
return false;
}