Examples of DNodeException


Examples of com.splout.db.thrift.DNodeException

      dbCache.put(dbPoolInCache);
      return dbPoolInCache;
    } catch(Exception e) {
      log.error(e);
      e.printStackTrace();
      throw new DNodeException(EXCEPTION_ORDINARY,
          "Error (" + e.getMessage() + ") instantiating a manager for a data partition");
   
  }
View Full Code Here

Examples of com.splout.db.thrift.DNodeException

          dbPoolInCache = dbCache.get(dbKey);
          if(dbPoolInCache == null) {
            File dbFolder = getLocalStorageFolder(tablespace, partition, version);
            if(!dbFolder.exists()) {
              log.warn("Asked for " + dbFolder + " but it doesn't exist!");
              throw new DNodeException(EXCEPTION_ORDINARY, "Requested tablespace (" + tablespace
                  + ") + version (" + version + ") is not available.");
            }
            File metadata = getLocalMetadataFile(tablespace, partition, version);
            ThriftReader reader = new ThriftReader(metadata);
            PartitionMetadata partitionMetadata = (PartitionMetadata) reader
                .read(new PartitionMetadata());
            reader.close();
            dbPoolInCache = loadManagerInEHCache(tablespace, version, partition, dbFolder, partitionMetadata);
          }
        }
        // Query the {@link SQLite4JavaManager} and return
        String result = ((EngineManager) dbPoolInCache.getObjectValue())
            .query(query, maxResultsPerQuery);
        long time = performanceTool.endQuery();
        log.info("serving query [" + tablespace + "]" + " [" + version + "] [" + partition + "] ["
            + query + "] time [" + time + "] OK.");
        // double prob = performanceTool.getHistogram().getLeftAccumulatedProbability(time);
        // if(prob > 0.95) {
        // // slow query!
        // log.warn("[SLOW QUERY] Query time over 95 percentil: [" + query + "] time [" + time + "]");
        // slowQueries++;
        // }
        if(time > absoluteSlowQueryLimit) {
          // slow query!
          log.warn("[SLOW QUERY] Query time over absolute slow query time (" + absoluteSlowQueryLimit
              + ") : [" + query + "] time [" + time + "]");
          slowQueries++;
        }
        return result;
      } catch(Throwable e) {
        unexpectedException(e);
        throw new DNodeException(EXCEPTION_UNEXPECTED, e.getMessage());
      }
    } catch(DNodeException e) {
      log.info("serving query [" + tablespace + "]" + " [" + version + "] [" + partition + "] [" + query
          + "] FAILED [" + e.getMsg() + "]");
      failedQueries.incrementAndGet();
View Full Code Here

Examples of com.splout.db.thrift.DNodeException

      }
      // Everything is asynchronous so this is quickly reached - it just means the process has started
      return JSONSerDe.ser(new DNodeStatusResponse("Ok. Deploy initiated"));
    } catch(Throwable t) {
      unexpectedException(t);
      throw new DNodeException(EXCEPTION_UNEXPECTED, t.getMessage());
    }
  }
View Full Code Here

Examples of com.splout.db.thrift.DNodeException

    // It can serve any version that is stored locally.
    try {
      return JSONSerDe.ser(new DNodeStatusResponse("Ok. Rollback order received."));
    } catch(JSONSerDeException e) {
      unexpectedException(e);
      throw new DNodeException(EXCEPTION_UNEXPECTED, e.getMessage());
    }
  }
View Full Code Here

Examples of com.splout.db.thrift.DNodeException

        status.setFiles(new ArrayList<String>());
      }
      return JSONSerDe.ser(status);
    } catch(Throwable t) {
      unexpectedException(t);
      throw new DNodeException(EXCEPTION_UNEXPECTED, t.getMessage());
    }
  }
View Full Code Here

Examples of com.splout.db.thrift.DNodeException

      } else {
        return JSONSerDe.ser(new DNodeStatusResponse("No deploy in progress."));
      }
    } catch(JSONSerDeException e) {
      unexpectedException(e);
      throw new DNodeException(EXCEPTION_UNEXPECTED, e.getMessage());
    }
  }
View Full Code Here

Examples of com.splout.db.thrift.DNodeException

      log.info("Going to remove " + version + " as I have been told to do so.");
      try {
        deleteLocalVersion(version);
      } catch(Throwable e) {
        unexpectedException(e);
        throw new DNodeException(EXCEPTION_UNEXPECTED, e.getMessage());
      }
    }
    try {
      // Publish new DNodeInfo in distributed registry.
      // This makes QNodes notice that a new version is available...
      // PartitionMap and ReplicationMap will be built incrementally as DNodes finish.
      dnodesRegistry.changeInfo(new DNodeInfo(config));
      return JSONSerDe.ser(new DNodeStatusResponse("Ok. Delete old versions executed."));
    } catch(JSONSerDeException e) {
      unexpectedException(e);
      throw new DNodeException(EXCEPTION_UNEXPECTED, e.getMessage());
    }
  }
View Full Code Here

Examples of com.splout.db.thrift.DNodeException

   * This method is called by unit / integration tests in order to simulate failures and recoveries in DNodes and such.
   */
  @Override
  public String testCommand(String commandStr) throws DNodeException {
    if(!config.getBoolean(DNodeProperties.HANDLE_TEST_COMMANDS)) {
      throw new DNodeException(EXCEPTION_ORDINARY, "Can't handle test commands as "
          + DNodeProperties.HANDLE_TEST_COMMANDS + " is not set to true.");
    }
    TestCommands command = TestCommands.valueOf(commandStr);
    if(command == null) {
      throw new DNodeException(EXCEPTION_ORDINARY, "Unknown test command: " + commandStr);
    }
    if(command.equals(TestCommands.SHUTDOWN)) {
      // on-demand shutdown
      // This is a "soft-shutdown" so we can recover from it.
      // It is designed for unit and integration testing.
      shutDownByTestAPI.set(true);
      dnodesRegistry.unregister();
      log.info("Received a shutdown by test API.");
      hz.getLifecycleService().shutdown();
    } else if(command.equals(TestCommands.RESTART)) {
      // on-demand restart
      // This is a "soft-restart" after a "soft-shutdown".
      // It is designed for unit and integration testing.
      shutDownByTestAPI.set(false);
      try {
        hz = Hazelcast.newHazelcastInstance(HazelcastConfigBuilder.build(config));
        coord = new CoordinationStructures(hz);
        log.info("Received a restart by test API.");
        giveGreenLigth();
      } catch(HazelcastConfigBuilderException e) {
        log.error("Error while trying to connect to Hazelcast", e);
        throw new DNodeException(EXCEPTION_UNEXPECTED, e.getMessage());
      }
    }
    try {
      return JSONSerDe.ser(new DNodeStatusResponse("Ok. Test command " + commandStr
          + " received properly."));
    } catch(JSONSerDeException e) {
      unexpectedException(e);
      throw new DNodeException(EXCEPTION_UNEXPECTED, e.getMessage());
    }
  }
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.