MCPcopy Create free account
hub / github.com/e2wugui/zeze / commit

Method commit

ZezeJava/ZezeJava/src/main/java/Zeze/Transaction/Record1.java:161–190  ·  view source on GitHub ↗
(@NotNull RecordAccessed accessed)

Source from the content-addressed store, hash-verified

159 }
160
161 @Override
162 public void commit(@NotNull RecordAccessed accessed) {
163 enterFairLock();
164 try {
165 var committedPutLog = accessed.committedPutLog;
166 if (committedPutLog != null) {
167 setSoftValue(committedPutLog.getValue());
168 /*
169 * 内存表启用了soft,不能马上删除,按征程逻辑执行。
170 if (table.isMemory() && committedPutLog.getValue() == null) {
171 // 记录删除并且是内存表,马上删除。
172 table.getCache().remove(key, this);
173 return; // 内存表已经删除,done
174 }
175 */
176 // 计算内存表的大小。
177 if (table.isMemory()) {
178 if (accessed.atomicTupleRecord.strongRef == null && committedPutLog.getValue() != null) // add
179 table.getCache().getSizeCounter().increment();
180 else if (accessed.atomicTupleRecord.strongRef != null && committedPutLog.getValue() == null) // remove
181 table.getCache().getSizeCounter().decrement();
182 }
183 }
184 setTimestamp(getNextTimestamp()); // 必须在 Value = 之后设置。防止出现新的事务得到新的Timestamp,但是数据时旧的。
185 setDirty();
186 //System.out.println("commit: " + this + " put=" + accessed.CommittedPutLog + " atr=" + accessed.AtomicTupleRecord);
187 } finally {
188 exitFairLock();
189 }
190 }
191
192 @Override
193 public void setDirty() {

Callers

nothing calls this directly

Calls 11

setDirtyMethod · 0.95
enterFairLockMethod · 0.80
setSoftValueMethod · 0.80
getSizeCounterMethod · 0.80
getCacheMethod · 0.80
exitFairLockMethod · 0.80
getValueMethod · 0.65
isMemoryMethod · 0.65
incrementMethod · 0.65
setTimestampMethod · 0.45
getNextTimestampMethod · 0.45

Tested by

no test coverage detected