Package com.orientechnologies.orient.core.storage

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


  protected void dumpDistributedConfiguration(final boolean iForce) {
    if (currentDatabase == null)
      return;

    final OStorage stg = currentDatabase.getStorage();
    if (stg instanceof OStorageRemoteThread) {
      final ODocument distributedCfg = ((OStorageRemoteThread) stg).getClusterConfiguration();
      if (distributedCfg != null && !distributedCfg.isEmpty()) {
        message("\n\nDISTRIBUTED CONFIGURATION:\n" + distributedCfg.toJSON("prettyPrint"));
      } else if (iForce)
View Full Code Here


    for (Future<Void> future : futures)
      future.get();

    Thread.sleep(1500);
    copyDataFromTestWithoutClose();
    OStorage baseStorage = baseDocumentTx.getStorage();
    baseDocumentTx.close();
    baseStorage.close();

    testDocumentTx = new ODatabaseDocumentTx("plocal:" + buildDir.getAbsolutePath() + "/testLocalPaginatedStorageRestoreFromWAL");
    testDocumentTx.open("admin", "admin");
    testDocumentTx.close();
View Full Code Here

    return ((OAbstractPaginatedStorage) getDatabase().getStorage().getUnderlying());
  }

  private void removeValuesContainer() {
    if (valueContainerAlgorithm.equals(ODefaultIndexFactory.SBTREEBONSAI_VALUE_CONTAINER)) {
      final OStorage storage = getStorage();
      if (storage instanceof OAbstractPaginatedStorage) {
        final ODiskCache diskCache = ((OAbstractPaginatedStorage) storage).getDiskCache();
        try {
          final String fileName = getName() + OIndexRIDContainer.INDEX_FILE_EXTENSION;
          if (diskCache.exists(fileName)) {
View Full Code Here

      listener.onMessage("\n- Cluster " + clusterName + "...");

      final int clusterId = database.getClusterIdByName(clusterName);
      final long clusterRecords = database.countClusterElements(clusterId);
      OStorage storage = database.getStorage();

      OPhysicalPosition[] positions = storage.ceilingPhysicalPositions(clusterId, new OPhysicalPosition(
          OClusterPositionFactory.INSTANCE.valueOf(0)));
      while (positions.length > 0) {
        for (OPhysicalPosition position : positions) {
          ORecord record = database.load(new ORecordId(clusterId, position.clusterPosition));
          if (record instanceof ODocument) {
            ODocument document = (ODocument) record;
            rewriteLinksInDocument(document);

            documents++;
            totalDocuments++;

            if (documents % 10000 == 0)
              listener.onMessage("\n  - " + String.format("%,d", documents) + "/" + String.format("%,d", clusterRecords) + " "
                  + String.format("%.2f", (float) ((float) documents * 100 / (float) clusterRecords)) + " documents processed...");
          }
        }

        positions = storage.higherPhysicalPositions(clusterId, positions[positions.length - 1]);
      }
      listener.onMessage(" Processed: " + String.format("%,d", documents));
    }

    listener.onMessage("\nTotal links updated: " + totalDocuments);
View Full Code Here

    final Character c = OSchemaShared.checkNameIfValid(iName);
    if (c != null)
      throw new IllegalArgumentException("Invalid index name '" + iName + "'. Character '" + c + "' is invalid");

    ODatabaseInternal database = getDatabase();
    OStorage storage = database.getStorage();

    algorithm = chooseTreeAlgorithm(algorithm);
    final String valueContainerAlgorithm = chooseContainerAlgorithm(iType);

    final OIndexInternal<?> index;
    acquireExclusiveLock();
    try {
      if (indexes.containsKey(iName.toLowerCase()))
        throw new OIndexException("Index with name " + iName.toLowerCase() + " already exists.");

      // manual indexes are always durable
      if (clusterIdsToIndex == null || clusterIdsToIndex.length == 0) {
        if (metadata == null)
          metadata = new ODocument();

        Object durable = metadata.field("durableInNonTxMode");
        if (!(durable instanceof Boolean))
          metadata.field("durableInNonTxMode", true);
        if (metadata.field("trackMode") == null)
          metadata.field("trackMode", "FULL");
      }

      index = OIndexes.createIndex(getDatabase(), iType, algorithm, valueContainerAlgorithm, metadata);

      // decide which cluster to use ("index" - for automatic and "manindex" for manual)
      final String clusterName = indexDefinition != null && indexDefinition.getClassName() != null ? defaultClusterName
          : manualClusterName;

      if (progressListener == null)
        // ASSIGN DEFAULT PROGRESS LISTENER
        progressListener = new OIndexRebuildOutputListener(index);

      final Set<String> clustersToIndex = findClustersByIds(clusterIdsToIndex, database);

      if (metadata != null && Boolean.FALSE.equals(metadata.field("ignoreNullValues")) && indexDefinition != null)
        indexDefinition.setNullValuesIgnored(false);

      index.create(iName, indexDefinition, clusterName, clustersToIndex, true, progressListener);
      addIndexInternal(index);

      if (metadata != null) {
        final ODocument config = index.getConfiguration();
        config.field("metadata", metadata, OType.EMBEDDED);
      }

      setDirty();
      save();
    } finally {
      releaseExclusiveLock();
    }

    if (OGlobalConfiguration.INDEX_FLUSH_AFTER_CREATE.getValueAsBoolean())
      storage.synch();

    return index;
  }
View Full Code Here

    } finally {
      releaseExclusiveLock();
    }

    final OStorage storage = getDatabase().getStorage();
    if (OGlobalConfiguration.INDEX_FLUSH_AFTER_CREATE.getValueAsBoolean())
      storage.synch();

    return this;
  }
View Full Code Here

    final ODatabaseRecordInternal database = ODatabaseRecordThreadLocal.INSTANCE.get();
    if (!OGlobalConfiguration.INDEX_AUTO_REBUILD_AFTER_NOTSOFTCLOSE.getValueAsBoolean())
      return false;

    final OStorage storage = database.getStorage().getUnderlying();
    if (storage instanceof OLocalPaginatedStorage)
      return ((OLocalPaginatedStorage) storage).wereDataRestoredAfterOpen();

    return false;
  }
View Full Code Here

        }
      }

      save();

      final OStorage storage = newDb.getStorage();
      if (OGlobalConfiguration.INDEX_FLUSH_AFTER_CREATE.getValueAsBoolean())
        storage.synch();

      rebuildCompleted = true;

      OLogManager.instance().info(this, "%d indexes were restored successfully, %d errors", ok, errors);
    }
View Full Code Here

    Assert.assertFalse(cluster.useWal());
    Assert.assertEquals(cluster.recordGrowFactor(), 2f);
    Assert.assertEquals(cluster.recordOverflowGrowFactor(), 2f);
    Assert.assertEquals(cluster.compression(), "nothing");

    OStorage storage = database.getStorage();
    database.close();
    storage.close(true, false);

    database.open("admin", "admin");

    cluster = database.getStorage().getClusterById(clusterId);
    Assert.assertFalse(cluster.useWal());
View Full Code Here

    doc.field("ridbag", bag);
    doc.save();

    ORID rid = doc.getIdentity();

    OStorage storage = database.getStorage();
    database.close();
    storage.close(true, false);

    database.open("admin", "admin");

    doc = database.load(rid);
    doc.setLazyLoad(false);
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.storage.OStorage

Copyright © 2018 www.massapicom. 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.