Skip to content

Commit

Permalink
WAL max size limit was restored. Free space detection bug was fixed. …
Browse files Browse the repository at this point in the history
…Additional improvements.
  • Loading branch information
laa committed Feb 6, 2015
1 parent 42f0cb4 commit 253e575
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 36 deletions.
2 changes: 1 addition & 1 deletion core/pom.xml
Expand Up @@ -116,7 +116,7 @@
<configuration> <configuration>
<argLine>-ea -Xmx2048m -Dindex.flushAfterCreate=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterOpen=false <argLine>-ea -Xmx2048m -Dindex.flushAfterCreate=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterOpen=false
-Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false
-Dstorage.configuration.syncOnUpdate=false -Dstorage.configuration.syncOnUpdate=false -Ddb.makeFullCheckpointOnIndexChange=false -Ddb.makeFullCheckpointOnSchemaChange=false
</argLine> </argLine>
<systemPropertyVariables> <systemPropertyVariables>
<buildDirectory>${project.build.directory}</buildDirectory> <buildDirectory>${project.build.directory}</buildDirectory>
Expand Down
Expand Up @@ -461,6 +461,12 @@ public void change(final Object iCurrentValue, final Object iNewValue) {
DISTRIBUTED_PURGE_RESPONSES_TIMER_DELAY("distributed.purgeResponsesTimerDelay", DISTRIBUTED_PURGE_RESPONSES_TIMER_DELAY("distributed.purgeResponsesTimerDelay",
"Maximum timeout in milliseconds to collect all the asynchronous responses from replication", Integer.class, 15000l), "Maximum timeout in milliseconds to collect all the asynchronous responses from replication", Integer.class, 15000l),


DB_MAKE_FULL_CHECKPOINT_ON_INDEX_CHANGE("db.makeFullCheckpointOnIndexChange",
"When index metadata is changed full checkpoint is performed", Boolean.class, true),

DB_MAKE_FULL_CHECKPOINT_ON_SCHEMA_CHANGE("db.makeFullCheckpointOnSchemaChange",
"When index schema is changed full checkpoint is performed", Boolean.class, true),

DB_DOCUMENT_SERIALIZER("db.document.serializer", "The default record serializer used by the document database", String.class, DB_DOCUMENT_SERIALIZER("db.document.serializer", "The default record serializer used by the document database", String.class,
ORecordSerializerBinary.NAME), ORecordSerializerBinary.NAME),


Expand Down
Expand Up @@ -418,8 +418,11 @@ public OSBTreeCollectionManager call() throws Exception {
// @COMPATIBILITY 1.0RC9 // @COMPATIBILITY 1.0RC9
metadata.getSchema().createClass(OMVRBTreeRIDProvider.PERSISTENT_CLASS_NAME); metadata.getSchema().createClass(OMVRBTreeRIDProvider.PERSISTENT_CLASS_NAME);


metadata.getSchema().setFullCheckpointOnChange(true); if (OGlobalConfiguration.DB_MAKE_FULL_CHECKPOINT_ON_SCHEMA_CHANGE.getValueAsBoolean())
metadata.getIndexManager().setFullCheckpointOnChange(true); metadata.getSchema().setFullCheckpointOnChange(true);

if (OGlobalConfiguration.DB_MAKE_FULL_CHECKPOINT_ON_INDEX_CHANGE.getValueAsBoolean())
metadata.getIndexManager().setFullCheckpointOnChange(true);
getStorage().synch(); getStorage().synch();
// WAKE UP DB LIFECYCLE LISTENER // WAKE UP DB LIFECYCLE LISTENER
for (Iterator<ODatabaseLifecycleListener> it = Orient.instance().getDbLifecycleListeners(); it.hasNext();) for (Iterator<ODatabaseLifecycleListener> it = Orient.instance().getDbLifecycleListeners(); it.hasNext();)
Expand Down Expand Up @@ -2649,8 +2652,12 @@ public OSBTreeCollectionManager call() throws Exception {
// @COMPATIBILITY 1.0RC9 // @COMPATIBILITY 1.0RC9
metadata.getSchema().createClass(OMVRBTreeRIDProvider.PERSISTENT_CLASS_NAME); metadata.getSchema().createClass(OMVRBTreeRIDProvider.PERSISTENT_CLASS_NAME);


metadata.getSchema().setFullCheckpointOnChange(true); if (OGlobalConfiguration.DB_MAKE_FULL_CHECKPOINT_ON_SCHEMA_CHANGE.getValueAsBoolean())
metadata.getIndexManager().setFullCheckpointOnChange(true); metadata.getSchema().setFullCheckpointOnChange(true);

if (OGlobalConfiguration.DB_MAKE_FULL_CHECKPOINT_ON_INDEX_CHANGE.getValueAsBoolean())
metadata.getIndexManager().setFullCheckpointOnChange(true);

initialized = true; initialized = true;
} }


Expand Down
Expand Up @@ -96,6 +96,7 @@
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;


/** /**
Expand Down Expand Up @@ -131,7 +132,8 @@ public abstract class OAbstractPaginatedStorage extends OStorageAbstract impleme
.getValueAsBoolean(); .getValueAsBoolean();


private volatile OLowDiskSpaceInformation lowDiskSpace = null; private volatile OLowDiskSpaceInformation lowDiskSpace = null;
private volatile boolean fullCheckpointRequest = false; private volatile boolean checkpointRequest = false;
private final AtomicBoolean checkpointInProgress = new AtomicBoolean();


public OAbstractPaginatedStorage(String name, String filePath, String mode) { public OAbstractPaginatedStorage(String name, String filePath, String mode) {
super(name, filePath, mode, OGlobalConfiguration.STORAGE_LOCK_TIMEOUT.getValueAsInteger()); super(name, filePath, mode, OGlobalConfiguration.STORAGE_LOCK_TIMEOUT.getValueAsInteger());
Expand Down Expand Up @@ -1152,8 +1154,8 @@ public void lowDiskSpace(OLowDiskSpaceInformation information) {
} }


@Override @Override
public void requestFullCheckpoint() { public void requestCheckpoint() {
fullCheckpointRequest = true; checkpointRequest = true;
} }


/** /**
Expand Down Expand Up @@ -2565,30 +2567,48 @@ private void checkLowDiskSpaceAndFullCheckpointRequests() {
return; return;


if (lowDiskSpace != null) { if (lowDiskSpace != null) {
diskCache.makeFuzzyCheckpoint(); if (checkpointInProgress.compareAndSet(false, true)) {

try {
if (diskCache.checkLowDiskSpace()) { diskCache.makeFuzzyCheckpoint();
synch();
diskCache.makeFuzzyCheckpoint(); if (diskCache.checkLowDiskSpace()) {

synch();
if (diskCache.checkLowDiskSpace()) {
throw new OLowDiskSpaceException("Error occurred while executing a write operation to database '" + name if (diskCache.checkLowDiskSpace()) {
+ "' due to limited free space on the disk (" + (lowDiskSpace.freeSpace / (1024 * 1024)) throw new OLowDiskSpaceException("Error occurred while executing a write operation to database '" + name
+ " MB). The database is now working in read-only mode." + "' due to limited free space on the disk (" + (lowDiskSpace.freeSpace / (1024 * 1024))
+ " Please close the database (or stop OrientDB), make room on your hard drive and then reopen the database. " + " MB). The database is now working in read-only mode."
+ "The minimal required space is " + (lowDiskSpace.requiredSpace / (1024 * 1024)) + " MB. " + " Please close the database (or stop OrientDB), make room on your hard drive and then reopen the database. "
+ "Required space is now set to " + OGlobalConfiguration.DISK_CACHE_FREE_SPACE_LIMIT.getValueAsInteger() + "The minimal required space is " + (lowDiskSpace.requiredSpace / (1024 * 1024)) + " MB. "
+ "MB (you can change it by setting parameter " + OGlobalConfiguration.DISK_CACHE_FREE_SPACE_LIMIT.getKey() + ") ."); + "Required space is now set to " + OGlobalConfiguration.DISK_CACHE_FREE_SPACE_LIMIT.getValueAsInteger()
} else { + "MB (you can change it by setting parameter " + OGlobalConfiguration.DISK_CACHE_FREE_SPACE_LIMIT.getKey()
lowDiskSpace = null; + ") .");
} else {
lowDiskSpace = null;
}
} else
lowDiskSpace = null;
} finally {
checkpointInProgress.set(false);
} }
} else }
lowDiskSpace = null;
} }


if (fullCheckpointRequest) { if (checkpointRequest && writeAheadLog instanceof ODiskWriteAheadLog) {
synch(); if (checkpointInProgress.compareAndSet(false, true)) {
fullCheckpointRequest = false; try {
final ODiskWriteAheadLog diskWriteAheadLog = (ODiskWriteAheadLog) writeAheadLog;
final long size = diskWriteAheadLog.size();

diskCache.makeFuzzyCheckpoint();
if (size >= diskWriteAheadLog.size())
synch();

checkpointRequest = false;
} finally {
checkpointInProgress.set(false);
}
}
} }
} }
} }
Expand Up @@ -5,5 +5,5 @@
* @since 05/02/15 * @since 05/02/15
*/ */
public interface OFullCheckpointRequestListener { public interface OFullCheckpointRequestListener {
void requestFullCheckpoint(); void requestCheckpoint();
} }
Expand Up @@ -903,7 +903,7 @@ public OLogSequenceNumber log(OWALRecord record) throws IOException {
for (WeakReference<OFullCheckpointRequestListener> listenerWeakReference : fullCheckpointListeners) { for (WeakReference<OFullCheckpointRequestListener> listenerWeakReference : fullCheckpointListeners) {
final OFullCheckpointRequestListener listener = listenerWeakReference.get(); final OFullCheckpointRequestListener listener = listenerWeakReference.get();
if (listener != null) if (listener != null)
listener.requestFullCheckpoint(); listener.requestCheckpoint();
} }
} }


Expand Down
2 changes: 1 addition & 1 deletion distributed/pom.xml
Expand Up @@ -126,7 +126,7 @@
<configuration> <configuration>
<argLine>-ea -Xmx2048m -Dindex.flushAfterCreate=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterOpen=false <argLine>-ea -Xmx2048m -Dindex.flushAfterCreate=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterOpen=false
-Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false
-Dstorage.configuration.syncOnUpdate=false -Dstorage.configuration.syncOnUpdate=false -Ddb.makeFullCheckpointOnIndexChange=false -Ddb.makeFullCheckpointOnSchemaChange=false
</argLine> </argLine>
<systemPropertyVariables> <systemPropertyVariables>
<buildDirectory>${project.build.directory}</buildDirectory> <buildDirectory>${project.build.directory}</buildDirectory>
Expand Down
2 changes: 1 addition & 1 deletion graphdb/pom.xml
Expand Up @@ -133,7 +133,7 @@
-Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterCreate=false
-Dstorage.makeFullCheckpointAfterOpen=false -Dstorage.makeFullCheckpointAfterOpen=false
-Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false
-Dstorage.configuration.syncOnUpdate=false -Dstorage.configuration.syncOnUpdate=false -Ddb.makeFullCheckpointOnIndexChange=false -Ddb.makeFullCheckpointOnSchemaChange=false
</argLine> </argLine>
<systemPropertyVariables> <systemPropertyVariables>
<buildDirectory>${project.build.directory}</buildDirectory> <buildDirectory>${project.build.directory}</buildDirectory>
Expand Down
2 changes: 1 addition & 1 deletion object/pom.xml
Expand Up @@ -97,7 +97,7 @@
<configuration> <configuration>
<argLine>-ea -Xmx2048m -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterOpen=false <argLine>-ea -Xmx2048m -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterOpen=false
-Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false
-Dstorage.configuration.syncOnUpdate=false -Dstorage.configuration.syncOnUpdate=false -Ddb.makeFullCheckpointOnIndexChange=false -Ddb.makeFullCheckpointOnSchemaChange=false
</argLine> </argLine>
<systemPropertyVariables> <systemPropertyVariables>
<buildDirectory>${project.build.directory}</buildDirectory> <buildDirectory>${project.build.directory}</buildDirectory>
Expand Down
6 changes: 4 additions & 2 deletions tests/build.xml
Expand Up @@ -88,6 +88,8 @@
<jvmarg value="-DstorageType=${test.storageType}"/> <jvmarg value="-DstorageType=${test.storageType}"/>
<jvmarg value="${serializer}" /> <jvmarg value="${serializer}" />
<jvmarg value="-DtestPath=${project.root.dir}"/> <jvmarg value="-DtestPath=${project.root.dir}"/>
<jvmarg value="-Ddb.makeFullCheckpointOnIndexChange=false"/>
<jvmarg value="-Ddb.makeFullCheckpointOnSchemaChange=false"/>
<!-- debug --> <!-- debug -->
<!--<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"/>--> <!--<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"/>-->


Expand Down Expand Up @@ -129,14 +131,14 @@
<echo>STARTING REMOTE ORIENTDB SERVER INSTANCE...</echo> <echo>STARTING REMOTE ORIENTDB SERVER INSTANCE...</echo>
<exec dir="${orient.path}/bin" executable="cmd" spawn="true" osfamily="windows"> <exec dir="${orient.path}/bin" executable="cmd" spawn="true" osfamily="windows">
<env key="JAVA_OPTS" <env key="JAVA_OPTS"
value="-Xmx3G -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=10005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.configuration.syncOnUpdate=false -Dindex.flushAfterCreate=false ${serializer}"/> value="-Xmx3G -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=10005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.configuration.syncOnUpdate=false -Dindex.flushAfterCreate=false ${serializer} -Ddb.makeFullCheckpointOnIndexChange=false -Ddb.makeFullCheckpointOnSchemaChange=false"/>
<env key="CONFIG_FILE" value="${basedir}/src/test/resources/orientdb-server-config.xml"/> <env key="CONFIG_FILE" value="${basedir}/src/test/resources/orientdb-server-config.xml"/>
<arg value="/c start server.bat"/> <arg value="/c start server.bat"/>
</exec> </exec>


<exec dir="${orient.path}/bin" executable="sh" spawn="true" osfamily="unix"> <exec dir="${orient.path}/bin" executable="sh" spawn="true" osfamily="unix">
<env key="JAVA_OPTS" <env key="JAVA_OPTS"
value="-Xmx3G -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=10005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.configuration.syncOnUpdate=false -Dindex.flushAfterCreate=false ${serializer} ${spareSerailizer} "/> value="-Xmx3G -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=10005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.configuration.syncOnUpdate=false -Dindex.flushAfterCreate=false ${serializer} ${spareSerailizer} -Ddb.makeFullCheckpointOnIndexChange=false -Ddb.makeFullCheckpointOnSchemaChange=false"/>
<!-- <env key="JAVA_OPTS" value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006 -Xmx3G -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=10005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.configuration.syncOnUpdate=false -Dindex.flushAfterCreate=false ${serializer} ${spareSerailizer} "/>--> <!-- <env key="JAVA_OPTS" value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006 -Xmx3G -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=10005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dstorage.makeFullCheckpointAfterCreate=false -Dstorage.makeFullCheckpointAfterClusterCreate=false -Dstorage.wal.syncOnPageFlush=false -Dstorage.configuration.syncOnUpdate=false -Dindex.flushAfterCreate=false ${serializer} ${spareSerailizer} "/>-->
<env key="CONFIG_FILE" value="${basedir}/src/test/resources/orientdb-server-config.xml"/> <env key="CONFIG_FILE" value="${basedir}/src/test/resources/orientdb-server-config.xml"/>
<arg value="./server.sh"/> <arg value="./server.sh"/>
Expand Down

0 comments on commit 253e575

Please sign in to comment.