Skip to content

Commit f7167a8

Browse files
authored
Merge a8416a5 into bc5b8c1
2 parents bc5b8c1 + a8416a5 commit f7167a8

File tree

67 files changed

+456
-2329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+456
-2329
lines changed

ydb/core/client/locks_ut.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <ydb/core/engine/mkql_engine_flat_impl.h>
33
#include <ydb/core/testlib/test_client.h>
44
#include <ydb/core/tx/tx_proxy/proxy.h>
5-
#include <ydb/core/tx/datashard/datashard_locks.h>
5+
#include <ydb/core/tx/locks/locks.h>
66
#include <ydb/public/lib/deprecated/kicli/kicli.h>
77

88
#include <library/cpp/testing/unittest/tests_data.h>

ydb/core/engine/minikql/minikql_engine_host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <ydb/library/yql/minikql/computation/mkql_custom_list.h>
77
#include <ydb/library/yql/minikql/mkql_string_util.h>
88
#include <ydb/library/yql/parser/pg_wrapper/interface/codec.h>
9-
#include <ydb/core/tx/datashard/sys_tables.h>
9+
#include <ydb/core/tx/locks/sys_tables.h>
1010

1111
#include <library/cpp/containers/stack_vector/stack_vec.h>
1212

ydb/core/kqp/runtime/kqp_stream_lookup_worker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <ydb/library/yql/minikql/mkql_node.h>
55
#include <ydb/library/yql/minikql/computation/mkql_computation_node_holders.h>
66
#include <ydb/core/scheme/scheme_tabledefs.h>
7-
#include <ydb/core/tx/datashard/sys_tables.h>
7+
#include <ydb/core/tx/locks/sys_tables.h>
88
#include <ydb/core/tx/datashard/datashard.h>
99

1010
namespace NKikimr {

ydb/core/kqp/ut/opt/kqp_ne_ut.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <ydb/public/sdk/cpp/client/ydb_proto/accessor.h>
44
#include <ydb/core/kqp/runtime/kqp_read_actor.h>
5+
#include <ydb/core/tx/datashard/datashard_impl.h>
56

67
namespace NKikimr::NKqp {
78

ydb/core/kqp/ut/scan/kqp_scan_ut.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
22
#include <ydb/core/kqp/counters/kqp_counters.h>
33
#include <ydb/core/tx/datashard/datashard_failpoints.h>
4+
#include <ydb/core/tx/datashard/datashard_impl.h>
45
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
56

67
#include <ydb/library/yql/dq/actors/compute/dq_compute_actor.h>

ydb/core/kqp/ut/scan/kqp_split_ut.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
22
#include <ydb/core/kqp/counters/kqp_counters.h>
33
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
4+
#include <ydb/core/tx/datashard/datashard_impl.h>
45

56
#include <ydb/core/base/tablet_pipecache.h>
67
#include <ydb/core/kqp/runtime/kqp_read_actor.h>

ydb/core/sys_view/common/schema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "path.h"
44

55
#include <ydb/core/tablet_flat/flat_cxx_database.h>
6-
#include <ydb/core/tx/datashard/sys_tables.h>
6+
#include <ydb/core/tx/locks/sys_tables.h>
77

88
namespace NKikimr {
99
namespace NSysView {

ydb/core/tx/columnshard/columnshard__init.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "columnshard_schema.h"
55
#include "hooks/abstract/abstract.h"
66
#include <ydb/core/tx/columnshard/blobs_action/blob_manager_db.h>
7+
#include <ydb/core/tx/columnshard/transactions/locks_db.h>
78

89
#include <ydb/core/tablet/tablet_exception.h>
910
#include <ydb/core/tx/columnshard/operations/write.h>
@@ -36,6 +37,7 @@ void TTxInit::SetDefaults() {
3637
Self->LastWriteId = TWriteId{0};
3738
Self->LastPlannedStep = 0;
3839
Self->LastPlannedTxId = 0;
40+
Self->LastCompletedTx = NOlap::TSnapshot::Zero();
3941
Self->OwnerPathId = 0;
4042
Self->OwnerPath.clear();
4143
Self->LongTxWrites.clear();
@@ -71,6 +73,14 @@ bool TTxInit::Precharge(TTransactionContext& txc) {
7173
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::OwnerPathId, Self->OwnerPathId);
7274
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::OwnerPath, Self->OwnerPath);
7375

76+
{
77+
ui64 lastCompletedStep = 0;
78+
ui64 lastCompletedTx = 0;
79+
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::LastCompletedStep, lastCompletedStep);
80+
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::LastCompletedTxId, lastCompletedTx);
81+
Self->LastCompletedTx = NOlap::TSnapshot(lastCompletedStep, lastCompletedTx);
82+
}
83+
7484
if (!ready) {
7585
return false;
7686
}
@@ -177,6 +187,15 @@ bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx)
177187
}
178188
}
179189
}
190+
{
191+
TMemoryProfileGuard g("TTxInit/LocksDB");
192+
if (txc.DB.GetScheme().GetTableInfo(Schema::Locks::TableId)) {
193+
TColumnShardLocksDb locksDb(*Self, txc);
194+
if (!Self->SysLocks.Load(locksDb)) {
195+
return false;
196+
}
197+
}
198+
}
180199

181200
Self->UpdateInsertTableCounters();
182201
Self->UpdateIndexCounters();

ydb/core/tx/columnshard/columnshard__progress_tx.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
3131
if (!!plannedItem) {
3232
ui64 step = plannedItem->PlanStep;
3333
ui64 txId = plannedItem->TxId;
34+
LastCompletedTx = NOlap::TSnapshot(step, txId);
35+
if (LastCompletedTx > Self->LastCompletedTx) {
36+
NIceDb::TNiceDb db(txc.DB);
37+
Schema::SaveSpecialValue(db, Schema::EValueIds::LastCompletedStep, LastCompletedTx->GetPlanStep());
38+
Schema::SaveSpecialValue(db, Schema::EValueIds::LastCompletedTxId, LastCompletedTx->GetTxId());
39+
}
3440

3541
TxOperator = Self->ProgressTxController->GetVerifiedTxOperator(txId);
3642
AFL_VERIFY(TxOperator->Progress(*Self, NOlap::TSnapshot(step, txId), txc));
@@ -50,12 +56,16 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
5056
if (TxOperator) {
5157
TxOperator->Complete(*Self, ctx);
5258
}
59+
if (LastCompletedTx) {
60+
Self->LastCompletedTx = std::max(*LastCompletedTx, Self->LastCompletedTx);
61+
}
5362
Self->SetupIndexation();
5463
}
5564

5665
private:
5766
TTxController::ITransactionOperatior::TPtr TxOperator;
5867
const ui32 TabletTxNo;
68+
std::optional<NOlap::TSnapshot> LastCompletedTx;
5969
};
6070

6171
void TColumnShard::EnqueueProgressTx(const TActorContext& ctx) {

ydb/core/tx/columnshard/columnshard_impl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ TColumnShard::TColumnShard(TTabletStorageInfo* info, const TActorId& tablet)
9393
, ScanCounters("Scan")
9494
, WritesMonitor(*this)
9595
, NormalizerController(StoragesManager, SubscribeCounters)
96+
, SysLocks(this)
9697
{
9798
TabletCountersPtr.reset(new TProtobufTabletCounters<
9899
ESimpleCounters_descriptor,

0 commit comments

Comments
 (0)