mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
fix
This commit is contained in:
parent
fe30e0f162
commit
6a646b413e
@ -35,18 +35,28 @@ public:
|
|||||||
|
|
||||||
class FunctionTransactionLatestSnapshot : public FunctionConstantBase<FunctionTransactionLatestSnapshot, UInt64, DataTypeUInt64>
|
class FunctionTransactionLatestSnapshot : public FunctionConstantBase<FunctionTransactionLatestSnapshot, UInt64, DataTypeUInt64>
|
||||||
{
|
{
|
||||||
|
static UInt64 getLatestSnapshot(ContextPtr context)
|
||||||
|
{
|
||||||
|
context->checkTransactionsAreAllowed(/* explicit_tcl_query */ true);
|
||||||
|
return TransactionLog::instance().getLatestSnapshot();
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
static constexpr auto name = "transactionLatestSnapshot";
|
static constexpr auto name = "transactionLatestSnapshot";
|
||||||
static FunctionPtr create(ContextPtr context) { return std::make_shared<FunctionTransactionLatestSnapshot>(context); }
|
static FunctionPtr create(ContextPtr context) { return std::make_shared<FunctionTransactionLatestSnapshot>(context); }
|
||||||
explicit FunctionTransactionLatestSnapshot(ContextPtr context) : FunctionConstantBase(TransactionLog::instance().getLatestSnapshot(), context->isDistributed()) {}
|
explicit FunctionTransactionLatestSnapshot(ContextPtr context) : FunctionConstantBase(getLatestSnapshot(context), context->isDistributed()) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FunctionTransactionOldestSnapshot : public FunctionConstantBase<FunctionTransactionOldestSnapshot, UInt64, DataTypeUInt64>
|
class FunctionTransactionOldestSnapshot : public FunctionConstantBase<FunctionTransactionOldestSnapshot, UInt64, DataTypeUInt64>
|
||||||
{
|
{
|
||||||
|
static UInt64 getOldestSnapshot(ContextPtr context)
|
||||||
|
{
|
||||||
|
context->checkTransactionsAreAllowed(/* explicit_tcl_query */ true);
|
||||||
|
return TransactionLog::instance().getOldestSnapshot();
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
static constexpr auto name = "transactionOldestSnapshot";
|
static constexpr auto name = "transactionOldestSnapshot";
|
||||||
static FunctionPtr create(ContextPtr context) { return std::make_shared<FunctionTransactionOldestSnapshot>(context); }
|
static FunctionPtr create(ContextPtr context) { return std::make_shared<FunctionTransactionOldestSnapshot>(context); }
|
||||||
explicit FunctionTransactionOldestSnapshot(ContextPtr context) : FunctionConstantBase(TransactionLog::instance().getOldestSnapshot(), context->isDistributed()) {}
|
explicit FunctionTransactionOldestSnapshot(ContextPtr context) : FunctionConstantBase(getOldestSnapshot(context), context->isDistributed()) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,10 @@ TransactionID VersionMetadata::getRemovalTID() const
|
|||||||
TIDHash max_lock = removal_tid_lock.load();
|
TIDHash max_lock = removal_tid_lock.load();
|
||||||
if (max_lock)
|
if (max_lock)
|
||||||
{
|
{
|
||||||
if (auto txn = TransactionLog::instance().tryGetRunningTransaction(max_lock))
|
|
||||||
return txn->tid;
|
|
||||||
if (max_lock == Tx::PrehistoricTID.getHash())
|
if (max_lock == Tx::PrehistoricTID.getHash())
|
||||||
return Tx::PrehistoricTID;
|
return Tx::PrehistoricTID;
|
||||||
|
if (auto txn = TransactionLog::instance().tryGetRunningTransaction(max_lock))
|
||||||
|
return txn->tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removal_csn.load(std::memory_order_relaxed))
|
if (removal_csn.load(std::memory_order_relaxed))
|
||||||
|
Loading…
Reference in New Issue
Block a user