Skip to content
Snippets Groups Projects
Commit f9b7ed66 authored by Nada Afra's avatar Nada Afra
Browse files

mvcc storage fix bug

parent 8bb5920b
No related merge requests found
......@@ -3,7 +3,7 @@ class mvcc_Storage() :
def __init__(self, length):
#global setdata
for i in range (1, length+1):
for i in range (length):
isi = []
self.setdata[i] = isi
newdata = {
......@@ -79,7 +79,7 @@ class mvcc_Storage() :
newdata = {
"value" : val,
"w_timestamp" : tmpst,
"r_timestamp" : 0 #masih bingung yang read timestamp defaultnya apa
"r_timestamp" : tmpst #masih bingung yang read timestamp defaultnya apa
}
self.setdata[key].append(newdata)
return True
......@@ -89,6 +89,7 @@ class mvcc_Storage() :
hasil = self.setdata.get(key,False)
if (hasil):
target_ver = self.search_ver_of_max_w_timestamp(key, tmpst)
self.setdata[key][target_ver]["r_timestamp"] = tmpst
value = self.setdata[key][target_ver]["value"]
return value
else :
......@@ -105,3 +106,4 @@ print("----")
mvcc.put(11,12,1,1)
print(mvcc.setdata)
print(mvcc.get(1,5,1))
print(mvcc.setdata)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment