+
{(metricMeasure === MetricMeasure.OUTLIER || metricType === MetricTypes.OUTLIER_TABLES) &&
operations.length > 0 &&
diff --git a/managed/ui/src/utils/GraphUtils.tsx b/managed/ui/src/utils/GraphUtils.tsx
index 90c80f776e0a..24811d04b1ba 100644
--- a/managed/ui/src/utils/GraphUtils.tsx
+++ b/managed/ui/src/utils/GraphUtils.tsx
@@ -12,7 +12,8 @@ export const getTabContent = (
title: string,
currentUser: any,
isGranularMetricsEnabled: boolean,
- updateTimestamp: (start: 'object' | number, end: 'object' | number) => void
+ updateTimestamp: (start: 'object' | number, end: 'object' | number) => void,
+ printMode: boolean
) => {
let tabData: any = ;
if (graph.error?.data && !graph.loading) {
@@ -65,6 +66,7 @@ export const getTabContent = (
operations={uniqueOperations}
isGranularMetricsEnabled={isGranularMetricsEnabled}
updateTimestamp={updateTimestamp}
+ printMode={printMode}
/>
) : null;
})
diff --git a/src/postgres/src/backend/optimizer/path/costsize.c b/src/postgres/src/backend/optimizer/path/costsize.c
index 8d71a3444f80..bff36204d56f 100644
--- a/src/postgres/src/backend/optimizer/path/costsize.c
+++ b/src/postgres/src/backend/optimizer/path/costsize.c
@@ -173,6 +173,7 @@ double yb_random_block_cost = DEFAULT_RANDOM_PAGE_COST;
double yb_docdb_next_cpu_cycles = YB_DEFAULT_DOCDB_NEXT_CPU_CYCLES;
double yb_seek_cost_factor = YB_DEFAULT_SEEK_COST_FACTOR;
double yb_backward_seek_cost_factor = YB_DEFAULT_BACKWARD_SEEK_COST_FACTOR;
+double yb_fast_backward_seek_cost_factor = YB_DEFAULT_FAST_BACKWARD_SEEK_COST_FACTOR;
int yb_docdb_merge_cpu_cycles = YB_DEFAULT_DOCDB_MERGE_CPU_CYCLES;
int yb_docdb_remote_filter_overhead_cycles = YB_DEFAULT_DOCDB_REMOTE_FILTER_OVERHEAD_CYCLES;
double yb_local_latency_cost = YB_DEFAULT_LOCAL_LATENCY_COST;
@@ -7811,7 +7812,8 @@ yb_cost_index(IndexPath *path, PlannerInfo *root, double loop_count,
if (path->indexscandir == BackwardScanDirection)
{
- per_next_cost *= yb_backward_seek_cost_factor;
+ per_next_cost *= YbUseFastBackwardScan() ?
+ yb_fast_backward_seek_cost_factor : yb_backward_seek_cost_factor;
}
run_cost += num_seeks * index_per_seek_cost +
diff --git a/src/postgres/src/include/optimizer/cost.h b/src/postgres/src/include/optimizer/cost.h
index bc4b9e87d430..5251956c6026 100644
--- a/src/postgres/src/include/optimizer/cost.h
+++ b/src/postgres/src/include/optimizer/cost.h
@@ -50,6 +50,14 @@
#define YB_DEFAULT_SEEK_COST_FACTOR 50
#define YB_DEFAULT_BACKWARD_SEEK_COST_FACTOR 10
+/*
+ * The value for the fast backward scan seek cost factor has been selected based on the smallest
+ * improvement (2.8 times) for the backward scan related Order By workloads of Featurebench. It
+ * might be good to use a different factor for colocated case, where the smallest improvement
+ * is 3 times higher comparing to non-colocated case; refer to D35894 for the details.
+ */
+#define YB_DEFAULT_FAST_BACKWARD_SEEK_COST_FACTOR (YB_DEFAULT_BACKWARD_SEEK_COST_FACTOR / 3.0)
+
/* DocDB row decode and process cost */
#define YB_DEFAULT_DOCDB_MERGE_CPU_CYCLES 50
diff --git a/src/postgres/third-party-extensions/pg_partman/sql/functions/create_partition_time.sql b/src/postgres/third-party-extensions/pg_partman/sql/functions/create_partition_time.sql
index db8459ca45b9..2a609c0dde18 100644
--- a/src/postgres/third-party-extensions/pg_partman/sql/functions/create_partition_time.sql
+++ b/src/postgres/third-party-extensions/pg_partman/sql/functions/create_partition_time.sql
@@ -259,7 +259,7 @@ FOREACH v_time IN ARRAY p_partition_times LOOP
END IF;
END IF;
- IF v_exists IS NULL THEN
+ IF v_exists = 0 THEN
RAISE DEBUG 'create_partition_time v_sql: %', v_sql;
EXECUTE v_sql;
END IF;
diff --git a/src/yb/docdb/cql_operation.cc b/src/yb/docdb/cql_operation.cc
index 0c0be6c5cdc7..e7c12fc70396 100644
--- a/src/yb/docdb/cql_operation.cc
+++ b/src/yb/docdb/cql_operation.cc
@@ -494,7 +494,7 @@ Status QLWriteOperation::ReadColumns(const DocOperationApplyData& data,
// Generate hashed / primary key depending on if static / non-static columns are referenced in
// the if-condition.
RETURN_NOT_OK(InitializeKeys(
- !static_projection->columns.empty(), !non_static_projection->columns.empty()));
+ !request_.column_refs().static_ids().empty(), !non_static_projection->columns.empty()));
// Scan docdb for the static and non-static columns of the row using the hashed / primary key.
if (hashed_doc_key_) {
diff --git a/src/yb/integration-tests/cql-test.cc b/src/yb/integration-tests/cql-test.cc
index e3e44429401b..ee68e31fc3bb 100644
--- a/src/yb/integration-tests/cql-test.cc
+++ b/src/yb/integration-tests/cql-test.cc
@@ -1540,4 +1540,52 @@ TEST_F(CqlTest, RetainSchemaPacking) {
LOG(INFO) << "Content: " << content;
}
+TEST_F(CqlTest, InsertHashAndRangePkWithReturnsStatusAsRow) {
+ constexpr auto TTL_SECONDS = 2;
+ constexpr auto INSERT_PHASE_SECONDS = TTL_SECONDS + 3;
+
+ constexpr auto HASH_COLUMN_VALUE = 12345678;
+
+ auto session = ASSERT_RESULT(EstablishSession(driver_.get()));
+
+ ASSERT_OK(session.ExecuteQuery(
+ "CREATE TABLE test (h int, r int, v int, PRIMARY KEY (h, r)) "
+ "WITH CLUSTERING ORDER BY (r ASC) AND transactions = {'enabled': 'false'}"));
+
+ auto insert_prepared = ASSERT_RESULT(session.Prepare(Format(
+ "INSERT INTO test (h, r, v) VALUES (?,?,?) USING TTL $0 RETURNS STATUS AS ROW",
+ TTL_SECONDS)));
+
+ int row_count = 0;
+
+ auto deadline = CoarseMonoClock::now() + INSERT_PHASE_SECONDS * 1s;
+ while (CoarseMonoClock::now() < deadline) {
+ auto stmt = insert_prepared.Bind();
+ stmt.Bind(0, HASH_COLUMN_VALUE);
+ stmt.Bind(1, row_count);
+ stmt.Bind(2, row_count);
+ ASSERT_OK(session.Execute(stmt));
+ ++row_count;
+ YB_LOG_EVERY_N_SECS(INFO, 5) << row_count << " rows inserted";
+ }
+
+ ASSERT_GT(row_count, 0) << "We expect some rows to be inserted";
+
+ // Make sure `RETURNS STATUS AS ROW` doesn't iterate over rows (both obsolete and live) related to
+ // the same hash column but different range columns.
+ for (auto peer : ListTabletPeers(cluster_.get(), ListPeersFilter::kAll)) {
+ auto tablet = peer->shared_tablet();
+ if (tablet->table_type() != TableType::YQL_TABLE_TYPE) {
+ break;
+ }
+ auto* metrics = tablet->metrics();
+ for (auto counter :
+ {tablet::TabletCounters::kDocDBKeysFound, tablet::TabletCounters::kDocDBObsoleteKeysFound,
+ tablet::TabletCounters::kDocDBObsoleteKeysFoundPastCutoff}) {
+ ASSERT_EQ(metrics->Get(counter), 0)
+ << "Expected " << counter << " to be zero for tablet peer " << peer->LogPrefix();
+ }
+ }
+}
+
} // namespace yb
diff --git a/src/yb/master/catalog_manager.cc b/src/yb/master/catalog_manager.cc
index 78c093cfb9d0..58b109fd1fe8 100644
--- a/src/yb/master/catalog_manager.cc
+++ b/src/yb/master/catalog_manager.cc
@@ -3274,6 +3274,26 @@ Status CatalogManager::DdlLog(
return sys_catalog_->FetchDdlLog(resp->mutable_entries());
}
+Status CatalogManager::StartYsqlMajorVersionUpgradeInitdb(
+ const StartYsqlMajorVersionUpgradeInitdbRequestPB* req,
+ StartYsqlMajorVersionUpgradeInitdbResponsePB* resp,
+ rpc::RpcContext* rpc, const LeaderEpoch& epoch) {
+ return STATUS(NotSupported, "Ysql major version upgrade is not supported");
+}
+
+Status CatalogManager::IsYsqlMajorVersionUpgradeInitdbDone(
+ const IsYsqlMajorVersionUpgradeInitdbDoneRequestPB* req,
+ IsYsqlMajorVersionUpgradeInitdbDoneResponsePB* resp, rpc::RpcContext* rpc) {
+ return STATUS(NotSupported, "Ysql major version upgrade is not supported");
+}
+
+Status CatalogManager::RollbackYsqlMajorVersionUpgrade(
+ const RollbackYsqlMajorVersionUpgradeRequestPB* req,
+ RollbackYsqlMajorVersionUpgradeResponsePB* resp,
+ rpc::RpcContext* rpc, const LeaderEpoch& epoch) {
+ return STATUS(NotSupported, "Ysql major version upgrade is not supported");
+}
+
namespace {
Status ValidateCreateTableSchema(const Schema& schema, CreateTableResponsePB* resp) {
diff --git a/src/yb/master/catalog_manager.h b/src/yb/master/catalog_manager.h
index a443a3c7294c..2a34a5056330 100644
--- a/src/yb/master/catalog_manager.h
+++ b/src/yb/master/catalog_manager.h
@@ -1098,6 +1098,21 @@ class CatalogManager : public tserver::TabletPeerLookupIf,
Status DdlLog(
const DdlLogRequestPB* req, DdlLogResponsePB* resp, rpc::RpcContext* rpc);
+ // Not implemented.
+ Status StartYsqlMajorVersionUpgradeInitdb(const StartYsqlMajorVersionUpgradeInitdbRequestPB* req,
+ StartYsqlMajorVersionUpgradeInitdbResponsePB* resp,
+ rpc::RpcContext* rpc, const LeaderEpoch& epoch);
+
+ // Not implemented.
+ Status IsYsqlMajorVersionUpgradeInitdbDone(
+ const IsYsqlMajorVersionUpgradeInitdbDoneRequestPB* req,
+ IsYsqlMajorVersionUpgradeInitdbDoneResponsePB* resp, rpc::RpcContext* rpc);
+
+ // Not implemented.
+ Status RollbackYsqlMajorVersionUpgrade(const RollbackYsqlMajorVersionUpgradeRequestPB* req,
+ RollbackYsqlMajorVersionUpgradeResponsePB* resp,
+ rpc::RpcContext* rpc, const LeaderEpoch& epoch);
+
// Test wrapper around protected DoSplitTablet method.
Status TEST_SplitTablet(
const TabletInfoPtr& source_tablet_info,
diff --git a/src/yb/master/master_admin.proto b/src/yb/master/master_admin.proto
index 5a3c544d7ced..43b8448e1630 100644
--- a/src/yb/master/master_admin.proto
+++ b/src/yb/master/master_admin.proto
@@ -177,6 +177,29 @@ message DdlLogResponsePB {
repeated DdlLogEntryPB entries = 2;
}
+message StartYsqlMajorVersionUpgradeInitdbRequestPB {
+}
+
+message StartYsqlMajorVersionUpgradeInitdbResponsePB {
+ optional MasterErrorPB error = 1;
+}
+
+message IsYsqlMajorVersionUpgradeInitdbDoneRequestPB {
+}
+
+message IsYsqlMajorVersionUpgradeInitdbDoneResponsePB {
+ optional MasterErrorPB error = 1;
+ optional bool done = 2;
+ optional MasterErrorPB initdb_error = 3;
+}
+
+message RollbackYsqlMajorVersionUpgradeRequestPB {
+}
+
+message RollbackYsqlMajorVersionUpgradeResponsePB {
+ optional MasterErrorPB error = 1;
+}
+
message CheckIfPitrActiveRequestPB {}
message CheckIfPitrActiveResponsePB {
@@ -268,6 +291,13 @@ service MasterAdmin {
rpc DdlLog(DdlLogRequestPB) returns (DdlLogResponsePB);
+ rpc StartYsqlMajorVersionUpgradeInitdb(StartYsqlMajorVersionUpgradeInitdbRequestPB)
+ returns (StartYsqlMajorVersionUpgradeInitdbResponsePB);
+ rpc IsYsqlMajorVersionUpgradeInitdbDone(IsYsqlMajorVersionUpgradeInitdbDoneRequestPB)
+ returns (IsYsqlMajorVersionUpgradeInitdbDoneResponsePB);
+ rpc RollbackYsqlMajorVersionUpgrade(RollbackYsqlMajorVersionUpgradeRequestPB)
+ returns (RollbackYsqlMajorVersionUpgradeResponsePB);
+
rpc CheckIfPitrActive(CheckIfPitrActiveRequestPB)
returns (CheckIfPitrActiveResponsePB);
diff --git a/src/yb/master/master_admin_service.cc b/src/yb/master/master_admin_service.cc
index 417f27e30739..23748b73ec4c 100644
--- a/src/yb/master/master_admin_service.cc
+++ b/src/yb/master/master_admin_service.cc
@@ -49,6 +49,9 @@ class MasterAdminServiceImpl : public MasterServiceBase, public MasterAdminIf {
(GetCompactionStatus)
(CreateTransactionStatusTable)
(DdlLog)
+ (StartYsqlMajorVersionUpgradeInitdb)
+ (IsYsqlMajorVersionUpgradeInitdbDone)
+ (RollbackYsqlMajorVersionUpgrade)
(DeleteNotServingTablet)
(FlushSysCatalog)
(SplitTablet)
diff --git a/src/yb/tools/yb-admin_cli.cc b/src/yb/tools/yb-admin_cli.cc
index 84e00b505888..568946ab0dd9 100644
--- a/src/yb/tools/yb-admin_cli.cc
+++ b/src/yb/tools/yb-admin_cli.cc
@@ -1596,12 +1596,13 @@ Status create_keyspace_snapshot_action(
return Status::OK();
}
-const auto create_database_snapshot_args = "[ysql.] [retention_duration_hours] "
- "(set a <= 0 value to retain the snapshot forever. If not specified "
+const auto create_database_snapshot_args =
+ "[ysql.] [retention_duration_hours] "
+ "(set retention_duration_hours to 0 to retain the snapshot forever. If not specified "
"then takes the default value controlled by gflag default_retention_hours)";
Status create_database_snapshot_action(
const ClusterAdminCli::CLIArguments& args, ClusterAdminClient* client) {
- if (args.size() != 1) {
+ if (args.size() < 1 && args.size() > 2) {
return ClusterAdminCli::kInvalidArguments;
}