Skip to content

Commit

Permalink
fixed compilation problem in distributed classes
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Dec 1, 2015
1 parent 68d9ce6 commit ac225cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 106 deletions.
Expand Up @@ -19,20 +19,12 @@
*/ */
package com.orientechnologies.orient.server.hazelcast; package com.orientechnologies.orient.server.hazelcast;


import java.io.Serializable;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;

import com.hazelcast.core.HazelcastInstanceNotActiveException; import com.hazelcast.core.HazelcastInstanceNotActiveException;
import com.hazelcast.core.IMap; import com.hazelcast.core.IMap;
import com.hazelcast.core.IQueue; import com.hazelcast.core.IQueue;
import com.hazelcast.spi.exception.DistributedObjectDestroyedException; import com.hazelcast.spi.exception.DistributedObjectDestroyedException;
<<<<<<< HEAD
import com.orientechnologies.common.exception.OException;
=======
import com.orientechnologies.common.concur.lock.OModificationOperationProhibitedException; import com.orientechnologies.common.concur.lock.OModificationOperationProhibitedException;
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758 import com.orientechnologies.common.exception.OException;
import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.core.config.OGlobalConfiguration; import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.OScenarioThreadLocal; import com.orientechnologies.orient.core.db.OScenarioThreadLocal;
Expand All @@ -45,14 +37,12 @@
import com.orientechnologies.orient.server.distributed.ODistributedRequest; import com.orientechnologies.orient.server.distributed.ODistributedRequest;
import com.orientechnologies.orient.server.distributed.ODistributedServerLog; import com.orientechnologies.orient.server.distributed.ODistributedServerLog;
import com.orientechnologies.orient.server.distributed.ODistributedServerLog.DIRECTION; import com.orientechnologies.orient.server.distributed.ODistributedServerLog.DIRECTION;
import com.orientechnologies.orient.server.distributed.task.OAbstractRemoteTask; import com.orientechnologies.orient.server.distributed.task.*;
import com.orientechnologies.orient.server.distributed.task.OCreateRecordTask;
import com.orientechnologies.orient.server.distributed.task.ODeleteRecordTask; import java.io.Serializable;
import com.orientechnologies.orient.server.distributed.task.OFixTxTask; import java.util.Queue;
import com.orientechnologies.orient.server.distributed.task.OResurrectRecordTask; import java.util.concurrent.ArrayBlockingQueue;
import com.orientechnologies.orient.server.distributed.task.OSQLCommandTask; import java.util.concurrent.TimeUnit;
import com.orientechnologies.orient.server.distributed.task.OTxTask;
import com.orientechnologies.orient.server.distributed.task.OUpdateRecordTask;


/** /**
* Hazelcast implementation of distributed peer. There is one instance per database. Each node creates own instance to talk with * Hazelcast implementation of distributed peer. There is one instance per database. Each node creates own instance to talk with
Expand Down
Expand Up @@ -165,11 +165,7 @@ protected void checkRecord(ODatabaseDocumentTx database, int i) {
Assert.assertEquals(doc.field("updated"), Boolean.TRUE); Assert.assertEquals(doc.field("updated"), Boolean.TRUE);
} }


<<<<<<< HEAD
private void checkIndex(ODatabaseDocumentTx database, final String key, final ORID rid) { private void checkIndex(ODatabaseDocumentTx database, final String key, final ORID rid) {
=======
protected void checkIndex(ODatabaseDocumentTx database, final String key, final ORID rid) {
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758
final List<OIdentifiable> result = database.command(new OCommandSQL("select from index:Person.name where key = ?")) final List<OIdentifiable> result = database.command(new OCommandSQL("select from index:Person.name where key = ?"))
.execute(key); .execute(key);
Assert.assertNotNull(result); Assert.assertNotNull(result);
Expand Down
Expand Up @@ -103,15 +103,9 @@ public class ODistributedStorage implements OStorage, OFreezableStorage, OAutosh
protected final ODistributedServerManager dManager; protected final ODistributedServerManager dManager;
protected final OAbstractPaginatedStorage wrapped; protected final OAbstractPaginatedStorage wrapped;


<<<<<<< HEAD
protected final TimerTask purgeDeletedRecordsTask; protected final TimerTask purgeDeletedRecordsTask;
protected final ConcurrentHashMap<ORecordId, OPair<Long, Integer>> deletedRecords = new ConcurrentHashMap<ORecordId, OPair<Long, Integer>>(); protected final ConcurrentHashMap<ORecordId, OPair<Long, Integer>> deletedRecords = new ConcurrentHashMap<ORecordId, OPair<Long, Integer>>();
protected final AtomicLong lastOperationId = new AtomicLong(); protected final AtomicLong lastOperationId = new AtomicLong();
=======
protected final TimerTask purgeDeletedRecordsTask;
protected final ConcurrentHashMap<ORecordId, OPair<Long, ORecordVersion>> deletedRecords = new ConcurrentHashMap<ORecordId, OPair<Long, ORecordVersion>>();
protected final AtomicLong lastOperationId = new AtomicLong();
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758


protected final BlockingQueue<OAsynchDistributedOperation> asynchronousOperationsQueue; protected final BlockingQueue<OAsynchDistributedOperation> asynchronousOperationsQueue;
protected final Thread asynchWorker; protected final Thread asynchWorker;
Expand All @@ -130,13 +124,8 @@ public ODistributedStorage(final OServer iServer, final OAbstractPaginatedStorag
@Override @Override
public void run() { public void run() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
<<<<<<< HEAD
for (Iterator<Map.Entry<ORecordId, OPair<Long, Integer>>> it = deletedRecords.entrySet().iterator(); it.hasNext(); ) { for (Iterator<Map.Entry<ORecordId, OPair<Long, Integer>>> it = deletedRecords.entrySet().iterator(); it.hasNext(); ) {
final Map.Entry<ORecordId, OPair<Long, Integer>> entry = it.next(); final Map.Entry<ORecordId, OPair<Long, Integer>> entry = it.next();
=======
for (Iterator<Map.Entry<ORecordId, OPair<Long, ORecordVersion>>> it = deletedRecords.entrySet().iterator(); it.hasNext();) {
final Map.Entry<ORecordId, OPair<Long, ORecordVersion>> entry = it.next();
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758


try { try {
final ORecordId rid = entry.getKey(); final ORecordId rid = entry.getKey();
Expand Down Expand Up @@ -469,12 +458,7 @@ protected boolean executeLocally(final String localNodeName, final ODistributedC
return executeLocally; return executeLocally;
} }


<<<<<<< HEAD
public OStorageOperationResult<OPhysicalPosition> createRecord(final ORecordId iRecordId, final byte[] iContent, final int iRecordVersion, final byte iRecordType, final int iMode, final ORecordCallback<Long> iCallback) { public OStorageOperationResult<OPhysicalPosition> createRecord(final ORecordId iRecordId, final byte[] iContent, final int iRecordVersion, final byte iRecordType, final int iMode, final ORecordCallback<Long> iCallback) {
=======
public OStorageOperationResult<OPhysicalPosition> createRecord(final ORecordId iRecordId, final byte[] iContent,
final ORecordVersion iRecordVersion, final byte iRecordType, final int iMode, final ORecordCallback<Long> iCallback) {
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758
resetLastValidBackup(); resetLastValidBackup();


if (OScenarioThreadLocal.INSTANCE.get() == RUN_MODE.RUNNING_DISTRIBUTED) if (OScenarioThreadLocal.INSTANCE.get() == RUN_MODE.RUNNING_DISTRIBUTED)
Expand Down Expand Up @@ -553,12 +537,7 @@ else if (masterResult instanceof Exception)
final OPlaceholder masterPlaceholder = (OPlaceholder) masterResult; final OPlaceholder masterPlaceholder = (OPlaceholder) masterResult;
iRecordId.copyFrom(masterPlaceholder.getIdentity()); iRecordId.copyFrom(masterPlaceholder.getIdentity());


<<<<<<< HEAD
return new OStorageOperationResult<OPhysicalPosition>(new OPhysicalPosition(masterPlaceholder.getIdentity().getClusterPosition(), masterPlaceholder.getVersion())); return new OStorageOperationResult<OPhysicalPosition>(new OPhysicalPosition(masterPlaceholder.getIdentity().getClusterPosition(), masterPlaceholder.getVersion()));
=======
return new OStorageOperationResult<OPhysicalPosition>(
new OPhysicalPosition(masterPlaceholder.getIdentity().getClusterPosition(), masterPlaceholder.getRecordVersion()));
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758
} }


// ASYNCHRONOUS CALL: EXECUTE LOCALLY AND THEN DISTRIBUTE // ASYNCHRONOUS CALL: EXECUTE LOCALLY AND THEN DISTRIBUTE
Expand Down Expand Up @@ -649,13 +628,7 @@ else if (result instanceof Exception)
} }


@Override @Override
<<<<<<< HEAD
public OStorageOperationResult<ORawBuffer> readRecordIfVersionIsNotLatest(final ORecordId rid, final String fetchPlan, final boolean ignoreCache, final int recordVersion) throws ORecordNotFoundException { public OStorageOperationResult<ORawBuffer> readRecordIfVersionIsNotLatest(final ORecordId rid, final String fetchPlan, final boolean ignoreCache, final int recordVersion) throws ORecordNotFoundException {
=======
public OStorageOperationResult<ORawBuffer> readRecordIfVersionIsNotLatest(final ORecordId rid, final String fetchPlan,
final boolean ignoreCache, final ORecordVersion recordVersion) throws ORecordNotFoundException {
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758

if (deletedRecords.get(rid) != null) if (deletedRecords.get(rid) != null)
// DELETED // DELETED
throw new ORecordNotFoundException("Record " + rid + " was not found"); throw new ORecordNotFoundException("Record " + rid + " was not found");
Expand Down Expand Up @@ -699,18 +672,12 @@ else if (result instanceof Exception)
} }


@Override @Override
<<<<<<< HEAD
public OSBTreeCollectionManager getSBtreeCollectionManager() { public OSBTreeCollectionManager getSBtreeCollectionManager() {
return wrapped.getSBtreeCollectionManager(); return wrapped.getSBtreeCollectionManager();
} }


@Override @Override
public OStorageOperationResult<Integer> updateRecord(final ORecordId iRecordId, final boolean updateContent, final byte[] iContent, final int iVersion, final byte iRecordType, final int iMode, final ORecordCallback<Integer> iCallback) { public OStorageOperationResult<Integer> updateRecord(final ORecordId iRecordId, final boolean updateContent, final byte[] iContent, final int iVersion, final byte iRecordType, final int iMode, final ORecordCallback<Integer> iCallback) {
=======
public OStorageOperationResult<ORecordVersion> updateRecord(final ORecordId iRecordId, final boolean updateContent,
final byte[] iContent, final ORecordVersion iVersion, final byte iRecordType, final int iMode,
final ORecordCallback<ORecordVersion> iCallback) {
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758
resetLastValidBackup(); resetLastValidBackup();


if (deletedRecords.get(iRecordId) != null) if (deletedRecords.get(iRecordId) != null)
Expand Down Expand Up @@ -808,12 +775,7 @@ public Object call() throws Exception {
} }


@Override @Override
<<<<<<< HEAD
public OStorageOperationResult<Boolean> deleteRecord(final ORecordId iRecordId, final int iVersion, final int iMode, final ORecordCallback<Boolean> iCallback) { public OStorageOperationResult<Boolean> deleteRecord(final ORecordId iRecordId, final int iVersion, final int iMode, final ORecordCallback<Boolean> iCallback) {
=======
public OStorageOperationResult<Boolean> deleteRecord(final ORecordId iRecordId, final ORecordVersion iVersion, final int iMode,
final ORecordCallback<Boolean> iCallback) {
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758
resetLastValidBackup(); resetLastValidBackup();


if (OScenarioThreadLocal.INSTANCE.get() == RUN_MODE.RUNNING_DISTRIBUTED) if (OScenarioThreadLocal.INSTANCE.get() == RUN_MODE.RUNNING_DISTRIBUTED)
Expand Down Expand Up @@ -1068,13 +1030,7 @@ public Object call() throws Exception {
// DELETED // DELETED
throw new ORecordNotFoundException("Cannot update record '" + rid + "' because has been deleted"); throw new ORecordNotFoundException("Cannot update record '" + rid + "' because has been deleted");


<<<<<<< HEAD
final int v = executionModeSynch ? record.getVersion() : record.getVersion(); final int v = executionModeSynch ? record.getVersion() : record.getVersion();
=======
task = new OUpdateRecordTask(rid, previousContent.getResult().getBuffer(), previousContent.getResult().version,
record.toStream(), v, ORecordInternal.getRecordType(record));
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758

task = new OUpdateRecordTask(rid, previousContent.getResult().getBuffer(), previousContent.getResult().version, record.toStream(), v, ORecordInternal.getRecordType(record)); task = new OUpdateRecordTask(rid, previousContent.getResult().getBuffer(), previousContent.getResult().version, record.toStream(), v, ORecordInternal.getRecordType(record));


break; break;
Expand Down Expand Up @@ -1174,17 +1130,8 @@ public Object call(final Object iArgument) {
} }


} catch (Exception e) { } catch (Exception e) {
<<<<<<< HEAD
ODistributedServerLog.error(this, localNodeName, null, ODistributedServerLog.DIRECTION.NONE, "async distributed transaction failed, cannot revert local transaction. Current node could have a not aligned database. Remote answer: %s", e, iArgument); ODistributedServerLog.error(this, localNodeName, null, ODistributedServerLog.DIRECTION.NONE, "async distributed transaction failed, cannot revert local transaction. Current node could have a not aligned database. Remote answer: %s", e, iArgument);
throw OException.wrapException(new OTransactionException("Error on execution async distributed transaction, the database could be inconsistent"), (Exception) iArgument); throw OException.wrapException(new OTransactionException("Error on execution async distributed transaction, the database could be inconsistent"), (Exception) iArgument);
=======
ODistributedServerLog.error(this, localNodeName, null, ODistributedServerLog.DIRECTION.NONE,
"async distributed transaction failed, cannot revert local transaction. Current node could have a not aligned database. Remote answer: %s",
e, iArgument);
throw new OTransactionException(
"Error on execution async distributed transaction, the database could be inconsistent",
(Throwable) iArgument);
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758
} }


if (ODistributedServerLog.isDebugEnabled()) if (ODistributedServerLog.isDebugEnabled())
Expand Down Expand Up @@ -1223,39 +1170,7 @@ public Object call(final Object iArgument) {
} }
} }


<<<<<<< HEAD
protected boolean processCommitResult(String localNodeName, OTransaction iTx, OTxTask txTask, Set<String> involvedClusters, List<ORecordOperation> tmpEntries, Set<String> nodes, int autoRetryDelay, Object result) throws InterruptedException { protected boolean processCommitResult(String localNodeName, OTransaction iTx, OTxTask txTask, Set<String> involvedClusters, List<ORecordOperation> tmpEntries, Set<String> nodes, int autoRetryDelay, Object result) throws InterruptedException {
=======
protected OAsyncReplicationError getAsyncReplicationError() {
if (OExecutionThreadLocal.INSTANCE.get().onAsyncReplicationError != null) {

final OAsyncReplicationError subCallback = OExecutionThreadLocal.INSTANCE.get().onAsyncReplicationError;
final ODatabaseDocumentTx currentDatabase = (ODatabaseDocumentTx) ODatabaseRecordThreadLocal.INSTANCE.get();
final ODatabaseDocumentTx copyDatabase = currentDatabase.copy();
currentDatabase.activateOnCurrentThread();

return new OAsyncReplicationError() {
@Override
public ACTION onAsyncReplicationError(final Throwable iException, final int iRetry) {
copyDatabase.activateOnCurrentThread();
switch (subCallback.onAsyncReplicationError(iException, iRetry)) {
case RETRY:
break;

case IGNORE:

}

return ACTION.IGNORE;
}
};
} else
return null;
}

protected boolean processCommitResult(String localNodeName, OTxTask txTask, Set<String> involvedClusters,
List<ORecordOperation> tmpEntries, Set<String> nodes, int autoRetryDelay, Object result) throws InterruptedException {
>>>>>>> 5db0482... Fixed issue about backup on distributed node github:5758
if (result instanceof OTxTaskResult) { if (result instanceof OTxTaskResult) {
final OTxTaskResult txResult = ((OTxTaskResult) result); final OTxTaskResult txResult = ((OTxTaskResult) result);


Expand Down

0 comments on commit ac225cc

Please sign in to comment.