You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my opinion, you want to implement rwlock with sema, which is a data member of Segment, but there is something wrong with it. Consider this situation: the first thread (T1) goes to C1(showed in bellow codes) and sleeps, and the second thread(T2) splits the same segment with INPLACE mode and changes the pattern. When T1 wakes up, it inserts the key-value into that segment, but, this key-value may not belong to that segment since the pattern may be not right, and it will be treated as invalid record and removed, which is an issue.
intSegment::Insert(Key_t& key, Value_t value, size_t loc, size_t key_hash) {
#ifdef INPLACE
if (sema == -1) return2;
if ((key_hash >> (8*sizeof(key_hash)-local_depth)) != pattern) return2;
auto lock = sema; #C1
int ret = 1;
while (!CAS(&sema, &lock, lock+1)) {
lock = sema;
}
.....
The text was updated successfully, but these errors were encountered:
erician
changed the title
the issue about sema of Segment
an issue about sema of Segment
Jul 30, 2019
In my opinion, you want to implement rwlock with sema, which is a data member of Segment, but there is something wrong with it. Consider this situation: the first thread (T1) goes to C1(showed in bellow codes) and sleeps, and the second thread(T2) splits the same segment with INPLACE mode and changes the pattern. When T1 wakes up, it inserts the key-value into that segment, but, this key-value may not belong to that segment since the pattern may be not right, and it will be treated as invalid record and removed, which is an issue.
The text was updated successfully, but these errors were encountered: