Examples of ODistributedConfiguration


Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

      ODistributedServerLog.error(this, getLocalNodeName(), null, DIRECTION.OUT,
          "No nodes configured for database '%s' request: %s", databaseName, iRequest);
      throw new ODistributedException("No nodes configured for partition '" + databaseName + "' request: " + iRequest);
    }

    final ODistributedConfiguration cfg = manager.getDatabaseConfiguration(databaseName);

    // TODO: REALLY STILL MATTERS THE NUMBER OF THE QUEUES?
    final IQueue<ODistributedRequest>[] reqQueues = getRequestQueues(databaseName, iNodes, iRequest.getTask());

    iRequest.setSenderNodeName(getLocalNodeName());
View Full Code Here

Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

    ODistributedServerLog.warn(this, getLocalNodeName(), iLastPendingRequest.getSenderNodeName(), DIRECTION.IN, "- " + msg);
    throw new OHotAlignmentNotPossibleExeption(msg);
  }

  protected void checkLocalNodeInConfiguration() {
    final ODistributedConfiguration cfg = manager.getDatabaseConfiguration(databaseName);

    boolean distribCfgDirty = false;

    final List<String> foundPartition = cfg.addNewNodeInServerList(getLocalNodeName());
    if (foundPartition != null) {
      // SET THE NODE.DB AS OFFLINE, READY TO BE SYNCHRONIZED
      manager.setDatabaseStatus(getLocalNodeName(), databaseName, ODistributedServerManager.DB_STATUS.OFFLINE);

      ODistributedServerLog.info(this, getLocalNodeName(), null, DIRECTION.NONE, "adding node '%s' in partition: db=%s %s",
          getLocalNodeName(), databaseName, foundPartition);

      distribCfgDirty = true;
    }

    // SELF ASSIGN CLUSTERS PREVIOUSLY ASSIGNED TO THIS LOCAL NODE (BY SUFFIX)
    final String suffix2Search = "_" + getLocalNodeName();
    for (String c : cfg.getClusterNames()) {
      if (c.endsWith(suffix2Search)) {
        // FOUND: ASSIGN TO LOCAL NODE
        final String currentMaster = cfg.getMasterServer(c);

        if (!getLocalNodeName().equals(currentMaster)) {
          ODistributedServerLog.warn(this, getLocalNodeName(), null, DIRECTION.NONE,
              "changing mastership of cluster '%s' from node '%s' to '%s'", c, currentMaster, getLocalNodeName());
          cfg.setMasterServer(c, getLocalNodeName());
          distribCfgDirty = true;
        }
      }
    }

    if (distribCfgDirty)
      manager.updateCachedDatabaseConfiguration(databaseName, cfg.serialize(), true, true);
  }
View Full Code Here

Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

  }

  protected void removeNodeInConfiguration(final String iNode, final boolean iForce) {
    try {
      // GET DATABASE CFG
      final ODistributedConfiguration cfg = manager.getDatabaseConfiguration(databaseName);

      if (!cfg.isHotAlignment()) {
        final List<String> foundPartition = cfg.removeNodeInServerList(iNode, iForce);
        if (foundPartition != null) {
          ODistributedServerLog.info(this, getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE,
              "removing node '%s' in partitions: db=%s %s", iNode, databaseName, foundPartition);

          msgService.removeQueue(OHazelcastDistributedMessageService.getRequestQueueName(iNode, databaseName));
          msgService.removeQueue(OHazelcastDistributedMessageService.getRequestQueueName(iNode, databaseName
              + OCreateRecordTask.SUFFIX_QUEUE_NAME));
        }

        // CHANGED: RE-DEPLOY IT
        manager.updateCachedDatabaseConfiguration(databaseName, cfg.serialize(), true, true);
      }

    } catch (Exception e) {
      ODistributedServerLog.debug(this, getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE,
          "unable to remove node or change mastership for '%s' in distributed configuration, db=%s", e, iNode, databaseName);
View Full Code Here

Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

    final int[] clusterIds = cls.getClusterIds();
    final List<String> clusterNames = new ArrayList<String>(clusterIds.length);
    for (int c : clusterIds)
      clusterNames.add(db.getClusterNameById(c));

    ODistributedConfiguration cfg = manager.getDatabaseConfiguration(databaseName);

    final String bestCluster = cfg.getLocalCluster(clusterNames, nodeName);
    if (bestCluster == null)
      throw new OException("Cannot find best cluster for class '" + cls.getName() + "'. ClusterStrategy=" + getName());

    bestClusterId = db.getClusterIdByName(bestCluster);
  }
View Full Code Here

Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

        return;
    } else if (dbUrl.startsWith("remote:"))
      return;

    synchronized (cachedDatabaseConfiguration) {
      final ODistributedConfiguration cfg = getDatabaseConfiguration(iDatabase.getName());
      if (cfg == null)
        return;

      if (iDatabase instanceof ODatabaseComplex<?> && !(iDatabase.getStorage() instanceof ODistributedStorage)) {
        ODistributedStorage storage = storages.get(iDatabase.getURL());
        if (storage == null) {
          storage = new ODistributedStorage(serverInstance, (OStorageEmbedded) iDatabase.getStorage());
          final ODistributedStorage oldStorage = storages.putIfAbsent(iDatabase.getURL(), storage);
          if (oldStorage != null)
            storage = oldStorage;
        }

        iDatabase.replaceStorage(storage);

        // OVERWRITE CLUSTER SELECTION STRATEGY
        final String nodeName = getLocalNodeName();
        final ODistributedConfiguration dbCfg = getDatabaseConfiguration(iDatabase.getName());

        final OSchema schema = ((ODatabaseComplexInternal<?>) iDatabase).getDatabaseOwner().getMetadata().getSchema();

        final Set<String> cfgClusterNames = new HashSet<String>();
        for (String c : cfg.getClusterNames())
View Full Code Here

Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

    queueName = OHazelcastDistributedMessageService.getRequestQueueName(messageService.manager.getLocalNodeName(), databaseName
        + OCreateRecordTask.SUFFIX_QUEUE_NAME);
    messageService.getQueue(queueName);

    final ODistributedConfiguration cfg = getDatabaseConfiguration(databaseName);

    // GET ALL THE OTHER SERVERS
    final Collection<String> nodes = cfg.getServers(null, getLocalNodeName());

    ODistributedServerLog.warn(this, getLocalNodeName(), nodes.toString(), DIRECTION.OUT,
        "requesting deploy of database '%s' on local server...", databaseName);

    final Map<String, Object> results = (Map<String, Object>) sendRequest(databaseName, null, nodes, new ODeployDatabaseTask(null),
View Full Code Here

Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

      final String databaseName = storageEntry.getKey();

      if (messageService.getDatabase(databaseName) == null) {
        ODistributedServerLog.warn(this, getLocalNodeName(), null, DIRECTION.NONE, "opening database '%s'...", databaseName);

        final ODistributedConfiguration cfg = getDatabaseConfiguration(databaseName);

        if (!getConfigurationMap().containsKey(CONFIG_DATABASE_PREFIX + databaseName)) {
          // PUBLISH CFG FIRST TIME
          getConfigurationMap().put(CONFIG_DATABASE_PREFIX + databaseName, cfg.serialize());
        }

        final boolean hotAlignment = cfg.isHotAlignment();

        final OHazelcastDistributedDatabase db = messageService.registerDatabase(databaseName).configureDatabase(hotAlignment,
            hotAlignment);
      }
    }
View Full Code Here

Examples of com.orientechnologies.orient.server.distributed.ODistributedConfiguration

      if (database == null)
        throw new ODistributedException("Database instance is null");

      final String databaseName = database.getName();

      final ODistributedConfiguration dCfg = iManager.getDatabaseConfiguration(databaseName);
      if (!clusterName.equalsIgnoreCase(dCfg.getMasterServer(clusterName)))
        // NOT MASTER SERVER FOR THIS CLUSTER, SKIP IT
        return Boolean.FALSE;

      final Long lastDeployment = (Long) iManager.getConfigurationMap().get(DEPLOYCLUSTER + databaseName + "." + clusterName);
      if (lastDeployment != null && lastDeployment.longValue() == random) {
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.