protected PartitionMap retrievePartitionMapfromQNode(String tablespace) throws Exception { log.info("Retrieving partition map for tablespace[" + tablespace + "] from QNode[" + qnodeURL +"] for being reused at indexation. "); SploutClient client = new SploutClient(qnodeURL.split(",")); Tablespace tb = client.tablespace(tablespace); if (tb == null) { throw new Exception("Partition map for tablespace [" + tablespace + "] not found at QNode[" + qnodeURL +"]."); } PartitionMap pmap = tb.getPartitionMap(); log.info("Successfully retrieved partition map for tablespace[" + tablespace + "] from QNode[" + qnodeURL +"]."); return pmap; }
@Override public int compare(Tablespace tb1, Tablespace tb2) { // reverse ordering. Older dates appears LAST. If same date, then version is compared. int comp = -((Long) tb1.getCreationDate()).compareTo(tb2.getCreationDate()); if (comp == 0) { return -((Long) tb1.getVersion()).compareTo(tb2.getVersion()); } else { return comp; } } });
Iterator<ReplicationEntry> repIter = tablespace.getReplicationMap().getReplicationEntries().iterator(); while (repIter.hasNext()) { ReplicationEntry entry = repIter.next(); tablespace.getPartitionMap().getPartitionEntries().remove(pEntry); partitionMap.addAll(currentTablespace.getPartitionMap().getPartitionEntries()); replicationMap.addAll(currentTablespace.getReplicationMap().getReplicationEntries()); deployDate = currentTablespace.getCreationDate(); } else { currentTablespace = new Tablespace(new PartitionMap(partitionMap), new ReplicationMap(replicationMap), versionName, deployDate); tablespaceVersionMap.put(tablespaceVersion, currentTablespace);
new TablespaceVersion(req.getTablespace(), req.getVersion())); if (t != null && t.getReplicationMap() != null && t.getPartitionMap() != null && t.getPartitionMap().getPartitionEntries() != null && t.getReplicationMap().getReplicationEntries() != null && t.getReplicationMap().getReplicationEntries().size() > 0) { if (t.getPartitionMap().getPartitionEntries().size() == t.getReplicationMap() .getReplicationEntries().size()) { log.info("Ok, TablespaceVersion [" + req.getTablespace() + ", " + req.getVersion()
long previousVersion = -1; if (status.getTablespaceMap().get("pagecountsintegration") != null) { previousVersion = status.getTablespaceMap().get("pagecountsintegration").getVersion(); || previousVersion == status.getTablespaceMap().get("pagecountsintegration").getVersion()) { Thread.sleep(2000); waitedSoFar += 2000; previousVersion = status.getTablespaceMap().get("pagecountsintegration").getVersion();
ReplicationMap replicationMap = entry.getValue().getReplicationMap(); for (ReplicationEntry rEntry : replicationMap.getReplicationEntries()) { log.info(rEntry);
return new ErrorQueryStatus("Unknown tablespace! [" + tablespaceName + "] for " + msg); ReplicationMap replicationMap = tablespace.getReplicationMap(); ReplicationEntry repEntry = null;
public void start() throws InterruptedException, IOException { Map<String, Object> context = new HashMap<String, Object>(); context.put("qnodes", qNodes); Map<Integer, Long> rowIdsPerPartition = new HashMap<Integer, Long>(); context.put("rowIdsPerPartition", rowIdsPerPartition); // First get Tablespace metadata - nPartitions SploutClient client = new SploutClient(((String) context.get("qnodes")).split(",")); Tablespace tablespace = client.tablespace(TABLESPACE); int nPartitions = tablespace.getPartitionMap().getPartitionEntries().size(); // Then gather number of registers for each partition for (int partition = 0; partition < nPartitions; partition++) { String query = "SELECT MAX(rowid) FROM pagecounts;"; Map<String, Object> obj = (Map<String, Object>) client .query(TABLESPACE, null, query, partition + "").getResult().get(0); rowIdsPerPartition.put(partition, Long.parseLong(obj.get("MAX(rowid)").toString())); } SploutBenchmark benchmark = new SploutBenchmark(); for (int i = 0; i < nIterations; i++) { benchmark.stressTest(nThreads, nQueries, PageCountsStressThreadImpl.class, context); benchmark.printStats(System.out); } }
while (it.hasNext()) { Tablespace tb = it.next(); if (versionBeingServed.equals(tb.getVersion())) { foundVersionBeingServed = true; } else { .getVersion())); log.info("Tablespace [" + tablespace + "] Version [" + tb.getVersion() + "] " + "created at [" + new Date(tb.getCreationDate()) + "] REMOVED. We already keep younger versions."); } else { log.info("Tablespace [" + tablespace + "] Version [" + tb.getVersion() + "] " + "created at [" + new Date(tb.getCreationDate()) + "] KEPT."); log.info("Tablespace [" + tablespace + "] Version [" + tb.getVersion() + "] " + "created at [" + new Date(tb.getCreationDate()) + "] either younger than served one or without version being served. Keeping.");
impactedKeys.addAll(tablespace.getPartitionMap().findPartitions(null, null)); // all partitions are hit impactedKeys.addAll(tablespace.getPartitionMap().findPartitions(keyMins.get(i), keyMaxs.get(i)));
return new ErrorQueryStatus("Unknown tablespace version:(" + version + ") tablespace:(" + tablespaceName + ")"); PartitionMap partitionMap = tablespace.getPartitionMap();
int nPartitions = tablespace.getPartitionMap().getPartitionEntries().size();