Skip to content

Commit

Permalink
TestKeyDuplicateBTreePrallelTxnStrideVarchar (800stride, 30000op, par…
Browse files Browse the repository at this point in the history
…allel, update only exclusive, 50char fixed, range scan case 1-3 only) passed once.
  • Loading branch information
ryogrid committed Sep 9, 2024
1 parent 6645df1 commit 689575c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1071,16 +1071,18 @@ func InnerTestParallelTxnsQueryingIndexUsedColumns[T int32 | float32 | string](t
return
}
common.ShPrintf(common.DEBUGGING, "Select(success) op start.\n")
diffToMakeNoExist := int32(10)
//diffToMakeNoExist := int32(10)
rangeSelectRetry:
var rangeStartKey = samehada_util.ChoiceKeyFromMap(insVals)
var rangeEndKey = samehada_util.ChoiceKeyFromMap(insVals)
for rangeEndKey < rangeStartKey {
goto rangeSelectRetry
}
insValsMutex.RUnlock()
// get 0-8 value
tmpRand := rand.Intn(9)
//// get 0-8 value
//tmpRand := rand.Intn(9)
// get 0-3 value
tmpRand := rand.Intn(4)
var rangeScanPlan plans.Plan
switch tmpRand {
case 0: // start only
Expand All @@ -1091,22 +1093,22 @@ func InnerTestParallelTxnsQueryingIndexUsedColumns[T int32 | float32 | string](t
rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &rangeStartKey, &rangeEndKey, indexKind)
case 3: // not specified both
rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, nil, nil, indexKind)
case 4: // start only (not exisiting val)
tmpStartKey := samehada_util.StrideAdd(rangeStartKey, diffToMakeNoExist).(T)
rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &tmpStartKey, nil, indexKind)
case 5: // end only (not existing val)
tmpEndKey := samehada_util.StrideAdd(rangeEndKey, diffToMakeNoExist).(T)
rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, nil, &tmpEndKey, indexKind)
case 6: // start and end (start val is not existing one)
tmpStartKey := samehada_util.StrideAdd(rangeStartKey, diffToMakeNoExist).(T)
rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &tmpStartKey, &rangeEndKey, indexKind)
case 7: // start and end (start val is not existing one)
tmpEndKey := samehada_util.StrideAdd(rangeEndKey, diffToMakeNoExist).(T)
rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &rangeStartKey, &tmpEndKey, indexKind)
case 8: // start and end (end val is not existing one)
tmpStartKey := samehada_util.StrideAdd(rangeStartKey, diffToMakeNoExist).(T)
tmpEndKey := samehada_util.StrideAdd(rangeEndKey, diffToMakeNoExist).(T)
rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &tmpStartKey, &tmpEndKey, indexKind)
//case 4: // start only (not exisiting val)
// tmpStartKey := samehada_util.StrideAdd(rangeStartKey, diffToMakeNoExist).(T)
// rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &tmpStartKey, nil, indexKind)
//case 5: // end only (not existing val)
// tmpEndKey := samehada_util.StrideAdd(rangeEndKey, diffToMakeNoExist).(T)
// rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, nil, &tmpEndKey, indexKind)
//case 6: // start and end (start val is not existing one)
// tmpStartKey := samehada_util.StrideAdd(rangeStartKey, diffToMakeNoExist).(T)
// rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &tmpStartKey, &rangeEndKey, indexKind)
//case 7: // start and end (start val is not existing one)
// tmpEndKey := samehada_util.StrideAdd(rangeEndKey, diffToMakeNoExist).(T)
// rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &rangeStartKey, &tmpEndKey, indexKind)
//case 8: // start and end (end val is not existing one)
// tmpStartKey := samehada_util.StrideAdd(rangeStartKey, diffToMakeNoExist).(T)
// tmpEndKey := samehada_util.StrideAdd(rangeEndKey, diffToMakeNoExist).(T)
// rangeScanPlan = createSpecifiedRangeScanPlanNode[T](c, tableMetadata, keyType, 0, &tmpStartKey, &tmpEndKey, indexKind)
}

txn_ := txnMgr.Begin(nil)
Expand Down
8 changes: 4 additions & 4 deletions lib/storage/index/btree_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func (btidx *BTreeIndex) insertEntryInner(key *tuple.Tuple, rid page.RID, txn in
convedKeyVal := samehada_util.EncodeValueAndRIDToDicOrderComparableVarchar(&orgKeyVal, &rid)

if isNoLock == false {
btidx.rwMtx.Lock()
defer btidx.rwMtx.Unlock()
btidx.rwMtx.RLock()
defer btidx.rwMtx.RUnlock()
}

ridBytes := samehada_util.PackRIDto8bytes(&rid)
Expand All @@ -124,8 +124,8 @@ func (btidx *BTreeIndex) deleteEntryInner(key *tuple.Tuple, rid page.RID, txn in
convedKeyVal := samehada_util.EncodeValueAndRIDToDicOrderComparableVarchar(&orgKeyVal, &rid)

if isNoLock == false {
btidx.rwMtx.Lock()
defer btidx.rwMtx.Unlock()
btidx.rwMtx.RLock()
defer btidx.rwMtx.RUnlock()
}
btidx.container.DeleteKey(convedKeyVal.SerializeOnlyVal(), 0)
}
Expand Down

0 comments on commit 689575c

Please sign in to comment.