diff --git a/lib/execution/executors/executor_test/skiplist_index_executor_test.go b/lib/execution/executors/executor_test/skiplist_index_executor_test.go index e7cf2e87..18a1ce1c 100644 --- a/lib/execution/executors/executor_test/skiplist_index_executor_test.go +++ b/lib/execution/executors/executor_test/skiplist_index_executor_test.go @@ -1071,7 +1071,7 @@ 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) @@ -1079,8 +1079,10 @@ func InnerTestParallelTxnsQueryingIndexUsedColumns[T int32 | float32 | string](t 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 @@ -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) diff --git a/lib/storage/index/btree_index.go b/lib/storage/index/btree_index.go index 9f63ad42..3603746a 100644 --- a/lib/storage/index/btree_index.go +++ b/lib/storage/index/btree_index.go @@ -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) @@ -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) }