Skip to content

Commit 8f42c59

Browse files
Issue orientechnologies#1689 was fixed.
1 parent bd5f47c commit 8f42c59

30 files changed

Lines changed: 598 additions & 679 deletions

core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ public enum OGlobalConfiguration {
163163
Boolean.class, true),
164164

165165
// CACHE
166-
CACHE_LOCAL_ENABLED("cache.level1.enabled", "Use the level-1 cache", Boolean.class, true),
167-
168-
CACHE_LOCAL_SIZE("cache.level1.size", "Size of the cache that keeps the record in memory", Integer.class, -1),
166+
CACHE_LOCAL_ENABLED("cache.local.enabled", "Use the local cache", Boolean.class, true),
169167

170168
// DATABASE
171169
OBJECT_SAVE_ONLY_DIRTY("object.saveOnlyDirty", "Object Database only saves objects bound to dirty records", Boolean.class, false),

core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseRecordTx.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ public ODatabaseRecord commit(boolean force) throws OTransactionException {
150150
}
151151
// ROLLBACK TX AT DB LEVEL
152152
currentTx.rollback(false, 0);
153+
getLocalCache().clear();
154+
153155
// WAKE UP ROLLBACK LISTENERS
154156
for (ODatabaseListener listener : underlying.browseListeners())
155157
try {
@@ -219,6 +221,8 @@ public ODatabaseRecord rollback(boolean force) throws OTransactionException {
219221
}
220222
}
221223

224+
getLocalCache().clear();
225+
222226
return this;
223227
}
224228

core/src/main/java/com/orientechnologies/orient/core/record/ORecord.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -122,29 +122,6 @@ public interface ORecord<T> extends ORecordElement, OIdentifiable, Serializable
122122
*/
123123
public boolean isDirty();
124124

125-
/**
126-
* Checks if the record is pinned.
127-
*
128-
* @return True if pinned, otherwise false
129-
*/
130-
public Boolean isPinned();
131-
132-
/**
133-
* Suggests to the engine to keep the record in cache. Use it for the most read records.
134-
*
135-
* @see ORecord#unpin()
136-
* @return The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
137-
*/
138-
public <RET extends ORecord<T>> RET pin();
139-
140-
/**
141-
* Suggests to the engine to not keep the record in cache.
142-
*
143-
* @see ORecord#pin()
144-
* @return The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
145-
*/
146-
public <RET extends ORecord<T>> RET unpin();
147-
148125
/**
149126
* Loads the record content in memory. If the record is in cache will be returned a new instance, so pay attention to use the
150127
* returned. If the record is dirty, then it returns to the original content. If the record does not exist a
@@ -199,7 +176,7 @@ public interface ORecord<T> extends ORecordElement, OIdentifiable, Serializable
199176
*/
200177
public <RET extends ORecord<T>> RET delete();
201178

202-
/**
179+
/**
203180
* Fills the record parsing the content in JSON format.
204181
*
205182
* @param iJson

core/src/main/java/com/orientechnologies/orient/core/record/ORecordAbstract.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public abstract class ORecordAbstract<T> implements ORecord<T>, ORecordInternal<
4848
protected int _size;
4949
protected String _dataSegmentName;
5050
protected transient ORecordSerializer _recordFormat;
51-
protected Boolean _pinned = null;
5251
protected boolean _dirty = true;
5352
protected ORecordElement.STATUS _status = ORecordElement.STATUS.LOADED;
5453
protected transient Set<ORecordListener> _listeners = null;
@@ -183,20 +182,6 @@ public boolean isDirty() {
183182
return _dirty;
184183
}
185184

186-
public Boolean isPinned() {
187-
return _pinned;
188-
}
189-
190-
public ORecordAbstract<T> pin() {
191-
_pinned = Boolean.TRUE;
192-
return this;
193-
}
194-
195-
public ORecordAbstract<T> unpin() {
196-
_pinned = Boolean.FALSE;
197-
return this;
198-
}
199-
200185
public <RET extends ORecord<T>> RET fromJSON(final String iSource, final String iOptions) {
201186
// ORecordSerializerJSON.INSTANCE.fromString(iSource, this, null, iOptions);
202187
ORecordSerializerJSON.INSTANCE.fromString(iSource, this, null, iOptions, false); // Add new parameter to accommodate new API,
@@ -403,7 +388,6 @@ public ORecordAbstract<T> copyTo(final ORecordAbstract<T> cloned) {
403388
cloned._size = _size;
404389
cloned._recordId = _recordId.copy();
405390
cloned._recordVersion = _recordVersion.copy();
406-
cloned._pinned = _pinned;
407391
cloned._status = _status;
408392
cloned._recordFormat = _recordFormat;
409393
cloned._listeners = null;

core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ public ODocument flatCopy() {
324324

325325
final ODocument cloned = new ODocument();
326326

327-
cloned._pinned = _pinned;
328327
cloned.setOrdered(_ordered);
329328
cloned.fill(_recordId, _recordVersion, _source, false);
330329
return cloned;

core/src/main/java/com/orientechnologies/orient/core/record/impl/ORecordBytesLazy.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public byte[] toStream() {
4444
@Override
4545
public ORecordBytesLazy copy() {
4646
final ORecordBytesLazy c = (ORecordBytesLazy) copyTo(new ORecordBytesLazy(serializableContent));
47-
final Boolean pinned = isPinned();
48-
if (pinned != null && !pinned)
49-
c.unpin();
5047
return c;
5148
}
5249

core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateLink.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@ public Object execute(final Map<Object, Object> iArgs) {
204204
try {
205205
// BROWSE ALL THE RECORDS OF THE SOURCE CLASS
206206
for (ODocument doc : db.browseClass(sourceClass.getName())) {
207-
doc.unpin();
208-
209207
value = doc.field(sourceField);
210208

211209
if (value != null) {

core/src/main/java/com/orientechnologies/orient/core/type/tree/provider/OMVRBTreeEntryDataProviderAbstract.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public OMVRBTreeEntryDataProviderAbstract(final OMVRBTreeProviderAbstract<K, V>
6262
leftRid = new ORecordId();
6363
rightRid = new ORecordId();
6464

65-
record = (ORecordBytesLazy) new ORecordBytesLazy(this).unpin();
65+
record = (ORecordBytesLazy) new ORecordBytesLazy(this);
6666
if (iRID != null) {
6767
record.setIdentity(iRID.getClusterId(), iRID.getClusterPosition());
6868
if (treeDataProvider.storage == null)
@@ -88,7 +88,8 @@ protected void load(final ODatabaseRecord iDb) {
8888
}
8989

9090
protected void load(final OStorage iStorage) {
91-
final ORawBuffer raw = iStorage.readRecord((ORecordId) record.getIdentity(), null, false, null, false, OStorage.LOCKING_STRATEGY.DEFAULT).getResult();
91+
final ORawBuffer raw = iStorage.readRecord((ORecordId) record.getIdentity(), null, false, null, false,
92+
OStorage.LOCKING_STRATEGY.DEFAULT).getResult();
9293
record.fill((ORecordId) record.getIdentity(), raw.version, raw.buffer, false);
9394
fromStream(raw.buffer);
9495
}

core/src/main/java/com/orientechnologies/orient/core/type/tree/provider/OMVRBTreeMapProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public OMVRBTreeMapProvider(final OStorage iStorage, final String iClusterName,
5656

5757
public OMVRBTreeMapProvider(final OStorage iStorage, final String iClusterName, final OBinarySerializer<K> iKeySerializer,
5858
final OStreamSerializer iValueSerializer) {
59-
super(new ORecordBytesLazy().unpin(), iStorage, iClusterName);
59+
super(new ORecordBytesLazy(), iStorage, iClusterName);
6060
((ORecordBytesLazy) record).recycle(this);
6161
stream = new OMemoryStream();
6262
keySerializer = iKeySerializer;

distributed/config/orientdb-dserver-config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
<entry name="db.pool.min" value="1"/>
108108
<entry name="db.pool.max" value="20"/>
109109

110-
<!-- LEVEL1 CACHE: enable/disable and set the size as number of entries -->
111-
<entry name="cache.level1.enabled" value="true"/>
110+
<!-- LOCAL CACHE: enable/disable -->
111+
<entry name="cache.local.enabled" value="true"/>
112112

113113
<!-- PROFILER: configures the profiler as <seconds-for-snapshot>,<archive-snapshot-size>,<summary-size> -->
114114
<entry name="profiler.enabled" value="true"/>

0 commit comments

Comments
 (0)