Skip to content

Commit e60de1e

Browse files
committed
Merge branch 'develop' of https://github.com/orientechnologies/orientdb into develop
2 parents 759d98b + 7689ff3 commit e60de1e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/base/ODurableComponent.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,35 @@
2424
import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.*;
2525

2626
/**
27+
* Base class for all durable data structures, that is data structures state of which can be consistently restored after system
28+
* crash but results of last operations in small interval before crash may be lost.
29+
*
30+
* This class contains methods which are used to support such concepts as:
31+
* <ol>
32+
* <li>"atomic operation" - set of operations which should be either applied together or not. It includes not only changes on
33+
* current data structure but on all durable data structures which are used by current one during implementation of specific
34+
* operation.</li>
35+
* <li>write ahead log - log of all changes which were done with page content after loading it from cache.</li>
36+
* </ol>
37+
*
38+
*
39+
* To support of "atomic operation" concept following should be done:
40+
* <ol>
41+
* <li>Call {@link #startAtomicOperation()} method.</li>
42+
* <li>If changes should be isolated till operation completes call also {@link #lockTillAtomicOperationCompletes()} which will apply
43+
* exclusive lock on existing data structure till atomic operation completes. This lock is not replacement of data structure locking
44+
* system it is used to serialize access to set of components which participate in single atomic operation. It is kind of rudiment
45+
* lock manager which is used to isolate access to units which participate in single transaction and which is going to be created to
46+
* provide efficient multi core scalability feature. It is recommended to always call it just after start of atomic operation but
47+
* always remember it is not replacement of thread safety mechanics for current data structure it is a mean to provide isolation
48+
* between atomic operations.</li>
49+
* <li>Log all page changes in WAL by calling of {@link #logPageChanges(ODurablePage, long, long, boolean)}</li>
50+
* <li>Call {@link #endAtomicOperation(boolean)} method when atomic operation completes, passed in parameter should be
51+
* <code>false</code> if atomic operation completes with success and <code>true</code> if there were some exceptions and it is
52+
* needed to rollback given operation.</li>
53+
* </ol>
54+
*
55+
*
2756
* @author Andrey Lomakin
2857
* @since 8/27/13
2958
*/

core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/paginated/base/ODurablePage.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
import com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OPageChanges;
2828

2929
/**
30+
* Base page class for all durable data structures, that is data structures state of which can be consistently restored after system
31+
* crash but results of last operations in small interval before crash may be lost.
32+
*
33+
* This page has several booked memory areas with following offsets at the beginning:
34+
* <ol>
35+
* <li>from 0 to 7 - Magic number</li>
36+
* <li>from 8 to 11 - crc32 of all page content, which is calculated by cache system just before save</li>
37+
* <li>from 12 to 23 - LSN of last operation which was stored for given page</li>
38+
* </ol>
39+
*
40+
* Developer which will extend this class should use all page memory starting from {@link #NEXT_FREE_POSITION} offset.
41+
*
42+
* To make page changes durable method {@link ODurableComponent#logPageChanges(ODurablePage, long, long, boolean)} should be called
43+
* just before release of page
44+
* {@link com.orientechnologies.orient.core.index.hashindex.local.cache.ODiskCache#release(com.orientechnologies.orient.core.index.hashindex.local.cache.OCacheEntry)}
45+
* back to the cache.
46+
*
47+
* All data structures which use this kind of pages should be derived from
48+
* {@link com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent} class.
49+
*
3050
* @author Andrey Lomakin
3151
* @since 16.08.13
3252
*/

0 commit comments

Comments
 (0)