Examples of OCluster


Examples of com.orientechnologies.orient.core.storage.OCluster

  private void commitEntry(final int iTxId, final OTransactionRecordEntry txEntry) throws IOException {

    final ORecordId rid = (ORecordId) txEntry.getRecord().getIdentity();

    final OCluster cluster = txEntry.clusterName != null ? getClusterByName(txEntry.clusterName) : getClusterById(rid.clusterId);
    rid.clusterId = cluster.getId();

    switch (txEntry.status) {
    case OTransactionRecordEntry.LOADED:
      break;
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

      if (iClusterId < 0 || iClusterId >= clusters.length)
        throw new IllegalArgumentException("Cluster id '" + iClusterId + "' is out of range of configured clusters (0-"
            + (clusters.length - 1) + ")");

      final OCluster cluster = clusters[iClusterId];
      if (cluster == null)
        return false;

      getLevel2Cache().freeCluster(iClusterId);

      cluster.delete();

      clusterMap.remove(cluster.getName());
      clusters[iClusterId] = null;

      // UPDATE CONFIGURATION
      configuration.clusters.set(iClusterId, null);
      configuration.update();
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

      for (int i = 0; i < iClusterIds.length; ++i) {
        if (iClusterIds[i] >= clusters.length)
          throw new OConfigurationException("Cluster id " + iClusterIds[i] + "was not found");

        final OCluster c = clusters[iClusterIds[i]];
        if (c != null)
          tot += c.getEntries();
      }

      return tot;

    } finally {
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

    // SEARCH IT BETWEEN PHYSICAL CLUSTERS
    lock.acquireSharedLock();
    try {

      final OCluster segment = clusterMap.get(iClusterName.toLowerCase());
      if (segment != null)
        return segment.getId();

    } finally {
      lock.releaseSharedLock();
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

    // SEARCH IT BETWEEN PHYSICAL CLUSTERS
    lock.acquireSharedLock();
    try {

      final OCluster segment = clusterMap.get(iClusterName.toLowerCase());
      if (segment != null)
        return segment.getType();

    } finally {
      lock.releaseSharedLock();
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

  @Override
  public OCluster getClusterByName(final String iClusterName) {
    lock.acquireSharedLock();
    try {

      final OCluster cluster = clusterMap.get(iClusterName.toLowerCase());

      if (cluster == null)
        throw new IllegalArgumentException("Cluster " + iClusterName + " not exists");
      return cluster;
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

   * @return The id (physical position into the array) of the new cluster just created. First is 0.
   * @throws IOException
   * @throws IOException
   */
  private int createClusterFromConfig(final OStorageClusterConfiguration iConfig) throws IOException {
    OCluster cluster = clusterMap.get(iConfig.getName());

    if (cluster != null) {
      if (cluster instanceof OClusterLocal)
        // ALREADY CONFIGURED, JUST OVERWRITE CONFIG
        ((OClusterLocal) cluster).config = (OStorageSegmentConfiguration) iConfig;
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

  public boolean dropCluster(final int iClusterId) {
    lock.acquireExclusiveLock();
    try {

      final OCluster c = clusters.get(iClusterId);
      if (c != null) {
        c.delete();
        clusters.set(iClusterId, null);
        getLevel2Cache().freeCluster(iClusterId);
      }

    } catch (IOException e) {
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

    if (txEntry.status != OTransactionRecordEntry.DELETED && !txEntry.getRecord().isDirty())
      return;

    final ORecordId rid = (ORecordId) txEntry.getRecord().getIdentity();

    final OCluster cluster = txEntry.clusterName != null ? storage.getClusterByName(txEntry.clusterName) : storage
        .getClusterById(rid.clusterId);

    if (cluster.getName().equals(OStorage.CLUSTER_INDEX_NAME))
      // AVOID TO COMMIT INDEX STUFF
      return;

    if (!(cluster instanceof OClusterLocal))
      // ONLY LOCAL CLUSTER ARE INVOLVED IN TX
      return;

    if (txEntry.getRecord() instanceof OTxListener)
      ((OTxListener) txEntry.getRecord()).onEvent(txEntry, OTxListener.EVENT.BEFORE_COMMIT);

    switch (txEntry.status) {
    case OTransactionRecordEntry.LOADED:
      break;

    case OTransactionRecordEntry.CREATED: {
      // CHECK 2 TIMES TO ASSURE THAT IT'S A CREATE OR AN UPDATE BASED ON RECURSIVE TO-STREAM METHOD
      byte[] stream = txEntry.getRecord().toStream();

      if (rid.isNew()) {
        if (iTx.getDatabase().callbackHooks(ORecordHook.TYPE.BEFORE_CREATE, txEntry.getRecord()))
          // RECORD CHANGED: RE-STREAM IT
          stream = txEntry.getRecord().toStream();

        rid.clusterId = cluster.getId();

        if (iUseLog)
          createRecord(iTx.getId(), cluster, rid, stream, txEntry.getRecord().getRecordType());
        else
          iTx.getDatabase().getStorage().createRecord(rid, stream, txEntry.getRecord().getRecordType());
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.OCluster

    final byte[] content = new byte[recordSize];
    file.read(pos[1] + RECORD_FIX_SIZE, content, recordSize);

    if (clusterId > -1) {
      // CHANGE THE POINTMENT OF CLUSTER TO THE NEW POSITION
      final OCluster cluster = storage.getClusterById(clusterId);
      final OPhysicalPosition ppos = cluster.getPhysicalPosition(clusterPosition, new OPhysicalPosition());

      if (ppos.dataPosition != iSourcePosition)
        throw new OStorageException("Found corrupted record hole for rid " + clusterId + ":" + clusterPosition
            + ": data position is wrong: " + ppos.dataPosition + "<->" + iSourcePosition);

      cluster.setPhysicalPosition(clusterPosition, iDestinationPosition);
    }

    writeRecord(getRelativePosition(iDestinationPosition), clusterId, clusterPosition, content);

    OProfiler.getInstance().stopChrono(PROFILER_MOVE_RECORD, timer);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.