clang-format
This commit is contained in:
parent
3a98c691b6
commit
c63909c18c
|
@ -33,7 +33,8 @@ void clearConflictSet(ConflictSet*, Version);
|
|||
void destroyConflictSet(ConflictSet*);
|
||||
|
||||
struct ConflictBatch {
|
||||
explicit ConflictBatch( ConflictSet*, std::map< int, VectorRef< int > >* conflictingKeyRangeMap = nullptr, Arena* resolveBatchReplyArena = nullptr);
|
||||
explicit ConflictBatch(ConflictSet*, std::map<int, VectorRef<int>>* conflictingKeyRangeMap = nullptr,
|
||||
Arena* resolveBatchReplyArena = nullptr);
|
||||
~ConflictBatch();
|
||||
|
||||
enum TransactionCommitResult {
|
||||
|
@ -55,7 +56,7 @@ private:
|
|||
std::vector<std::pair<StringRef, StringRef>> combinedWriteConflictRanges;
|
||||
std::vector<struct ReadConflictRange> combinedReadConflictRanges;
|
||||
bool* transactionConflictStatus;
|
||||
std::map< int, VectorRef< int > >* conflictingKeyRangeMap;
|
||||
std::map<int, VectorRef<int>>* conflictingKeyRangeMap;
|
||||
Arena* resolveBatchReplyArena;
|
||||
|
||||
void checkIntraBatchConflicts();
|
||||
|
|
|
@ -73,12 +73,12 @@ struct ReadConflictRange {
|
|||
int indexInTx;
|
||||
VectorRef<int>* conflictingKeyRange;
|
||||
Arena* cKRArena;
|
||||
|
||||
ReadConflictRange( StringRef begin, StringRef end, Version version, int transaction, int indexInTx, VectorRef<int> * cKR = nullptr, Arena* cKRArena = nullptr)
|
||||
: begin(begin), end(end), version(version), transaction(transaction), indexInTx(indexInTx), conflictingKeyRange(cKR), cKRArena(cKRArena)
|
||||
{
|
||||
}
|
||||
bool operator<(const ReadConflictRange& rhs) const { return compare(begin, rhs.begin)<0; }
|
||||
|
||||
ReadConflictRange(StringRef begin, StringRef end, Version version, int transaction, int indexInTx,
|
||||
VectorRef<int>* cKR = nullptr, Arena* cKRArena = nullptr)
|
||||
: begin(begin), end(end), version(version), transaction(transaction), indexInTx(indexInTx),
|
||||
conflictingKeyRange(cKR), cKRArena(cKRArena) {}
|
||||
bool operator<(const ReadConflictRange& rhs) const { return compare(begin, rhs.begin) < 0; }
|
||||
};
|
||||
|
||||
struct KeyInfo {
|
||||
|
@ -293,10 +293,10 @@ private:
|
|||
int nPointers, valueLength;
|
||||
};
|
||||
|
||||
static force_inline bool less( const uint8_t* a, int aLen, const uint8_t* b, int bLen ) {
|
||||
int c = memcmp(a,b,min(aLen,bLen));
|
||||
if (c<0) return true;
|
||||
if (c>0) return false;
|
||||
static force_inline bool less(const uint8_t* a, int aLen, const uint8_t* b, int bLen) {
|
||||
int c = memcmp(a, b, min(aLen, bLen));
|
||||
if (c < 0) return true;
|
||||
if (c > 0) return false;
|
||||
return aLen < bLen;
|
||||
}
|
||||
|
||||
|
@ -419,10 +419,11 @@ public:
|
|||
CheckMax inProgress[M];
|
||||
if (!count) return;
|
||||
|
||||
int started = min(M,count);
|
||||
for(int i=0; i<started; i++){
|
||||
inProgress[i].init( ranges[i], header, transactionConflictStatus, ranges[i].indexInTx, ranges[i].conflictingKeyRange, ranges[i].cKRArena );
|
||||
nextJob[i] = i+1;
|
||||
int started = min(M, count);
|
||||
for (int i = 0; i < started; i++) {
|
||||
inProgress[i].init(ranges[i], header, transactionConflictStatus, ranges[i].indexInTx,
|
||||
ranges[i].conflictingKeyRange, ranges[i].cKRArena);
|
||||
nextJob[i] = i + 1;
|
||||
}
|
||||
nextJob[started - 1] = 0;
|
||||
|
||||
|
@ -435,10 +436,10 @@ public:
|
|||
if (prevJob == job) break;
|
||||
nextJob[prevJob] = nextJob[job];
|
||||
job = prevJob;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
int temp = started++;
|
||||
inProgress[job].init( ranges[temp], header, transactionConflictStatus, ranges[temp].indexInTx, ranges[temp].conflictingKeyRange, ranges[temp].cKRArena );
|
||||
inProgress[job].init(ranges[temp], header, transactionConflictStatus, ranges[temp].indexInTx,
|
||||
ranges[temp].conflictingKeyRange, ranges[temp].cKRArena);
|
||||
}
|
||||
}
|
||||
prevJob = job;
|
||||
|
@ -611,22 +612,22 @@ private:
|
|||
VectorRef<int>* conflictingKeyRange; // nullptr if report_conflicting_keys is not enabled.
|
||||
Arena* cKRArena; // nullptr if report_conflicting_keys is not enabled.
|
||||
|
||||
void init( const ReadConflictRange& r, Node* header, bool* tCS, int indexInTx, VectorRef<int>* cKR, Arena* cKRArena) {
|
||||
this->start.init( r.begin, header );
|
||||
this->end.init( r.end, header );
|
||||
void init(const ReadConflictRange& r, Node* header, bool* tCS, int indexInTx, VectorRef<int>* cKR,
|
||||
Arena* cKRArena) {
|
||||
this->start.init(r.begin, header);
|
||||
this->end.init(r.end, header);
|
||||
this->version = r.version;
|
||||
this->indexInTx = indexInTx;
|
||||
this->cKRArena = cKRArena;
|
||||
result = &tCS[ r.transaction ];
|
||||
result = &tCS[r.transaction];
|
||||
conflictingKeyRange = cKR;
|
||||
this->state = 0;
|
||||
}
|
||||
|
||||
bool noConflict() { return true; }
|
||||
bool conflict() {
|
||||
bool conflict() {
|
||||
*result = true;
|
||||
if(conflictingKeyRange != nullptr)
|
||||
conflictingKeyRange->push_back(*cKRArena, indexInTx);
|
||||
if (conflictingKeyRange != nullptr) conflictingKeyRange->push_back(*cKRArena, indexInTx);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -745,10 +746,10 @@ void destroyConflictSet(ConflictSet* cs) {
|
|||
delete cs;
|
||||
}
|
||||
|
||||
ConflictBatch::ConflictBatch( ConflictSet* cs, std::map< int, VectorRef< int > >* conflictingKeyRangeMap, Arena* resolveBatchReplyArena )
|
||||
: cs(cs), transactionCount(0), conflictingKeyRangeMap(conflictingKeyRangeMap),resolveBatchReplyArena(resolveBatchReplyArena)
|
||||
{
|
||||
}
|
||||
ConflictBatch::ConflictBatch(ConflictSet* cs, std::map<int, VectorRef<int>>* conflictingKeyRangeMap,
|
||||
Arena* resolveBatchReplyArena)
|
||||
: cs(cs), transactionCount(0), conflictingKeyRangeMap(conflictingKeyRangeMap),
|
||||
resolveBatchReplyArena(resolveBatchReplyArena) {}
|
||||
|
||||
ConflictBatch::~ConflictBatch() {}
|
||||
|
||||
|
@ -779,8 +780,9 @@ void ConflictBatch::addTransaction(const CommitTransactionRef& tr) {
|
|||
points.emplace_back(range.begin, true, false, t, &info->readRanges[r].first);
|
||||
points.emplace_back(range.end, false, false, t, &info->readRanges[r].second);
|
||||
combinedReadConflictRanges.emplace_back(range.begin, range.end, tr.read_snapshot, t, r,
|
||||
tr.report_conflicting_keys ? &(*conflictingKeyRangeMap)[t] : nullptr,
|
||||
tr.report_conflicting_keys ? resolveBatchReplyArena : nullptr);
|
||||
tr.report_conflicting_keys ? &(*conflictingKeyRangeMap)[t]
|
||||
: nullptr,
|
||||
tr.report_conflicting_keys ? resolveBatchReplyArena : nullptr);
|
||||
}
|
||||
for (int r = 0; r < tr.write_conflict_ranges.size(); r++) {
|
||||
const KeyRangeRef& range = tr.write_conflict_ranges[r];
|
||||
|
@ -817,9 +819,9 @@ void ConflictBatch::checkIntraBatchConflicts() {
|
|||
const TransactionInfo& tr = *transactionInfo[t];
|
||||
if (transactionConflictStatus[t]) continue;
|
||||
bool conflict = tr.tooOld;
|
||||
for(int i=0; i<tr.readRanges.size(); i++){
|
||||
if ( mcs.any( tr.readRanges[i].first , tr.readRanges[i].second ) ) {
|
||||
if (tr.reportConflictingKeys){
|
||||
for (int i = 0; i < tr.readRanges.size(); i++) {
|
||||
if (mcs.any(tr.readRanges[i].first, tr.readRanges[i].second)) {
|
||||
if (tr.reportConflictingKeys) {
|
||||
(*conflictingKeyRangeMap)[t].push_back(*resolveBatchReplyArena, i);
|
||||
}
|
||||
conflict = true;
|
||||
|
|
Loading…
Reference in New Issue