(@NotNull RecordAccessed accessed)
| 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() { |
nothing calls this directly
no test coverage detected