public PrimaryFirstRouter(final Index index, final String ksName, BiFunction<Index, UUID, ShardRoutingState> shardsFunc, final ClusterState clusterState) { super(index, ksName, shardsFunc, clusterState, false); if (!StorageService.instance.isJoined() || !Keyspace.isInitialized()) { // temporary fake routing table in order to start local shards before cassandra services. BitSet singletonBitSet = new BitSet(1); singletonBitSet.set(0, true); this.greenShards.put(localNode, singletonBitSet); this.route = new Router.Route() { @Override public Map<DiscoveryNode, BitSet> selectedShards() { return greenShards; } }; return; } if (logger.isTraceEnabled()) logger.trace("index={} keyspace={} greenShards={} yellowShards={} redShards={}", index, ksName, greenShards, yellowShards, redShards); this.route = new Router.Route() { @Override public Map<DiscoveryNode, BitSet> selectedShards() { return greenShards; } }; }
public void stop() { EndpointState mystate = endpointStateMap.get(FBUtilities.getBroadcastAddress()); if (mystate != null && !isSilentShutdownState(mystate) && StorageService.instance.isJoined()) { logger.info("Announcing shutdown"); addLocalApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.shutdown(true)); MessageOut message = new MessageOut(MessagingService.Verb.GOSSIP_SHUTDOWN); for (InetAddress ep : liveEndpoints) MessagingService.instance().sendOneWay(message, ep); Uninterruptibles.sleepUninterruptibly(Integer.getInteger("cassandra.shutdown_announce_in_ms", 2000), TimeUnit.MILLISECONDS); } else logger.warn("No local state, state is in silent shutdown, or node hasn't joined, not announcing shutdown"); if (scheduledGossipTask != null) scheduledGossipTask.cancel(false); }
public void stop() { EndpointState mystate = endpointStateMap.get(FBUtilities.getBroadcastAddress()); if (mystate != null && !isSilentShutdownState(mystate) && StorageService.instance.isJoined()) { logger.info("Announcing shutdown"); addLocalApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.shutdown(true)); MessageOut message = new MessageOut(MessagingService.Verb.GOSSIP_SHUTDOWN); for (InetAddress ep : liveEndpoints) MessagingService.instance().sendOneWay(message, ep); Uninterruptibles.sleepUninterruptibly(Integer.getInteger("cassandra.shutdown_announce_in_ms", 2000), TimeUnit.MILLISECONDS); } else logger.warn("No local state, state is in silent shutdown, or node hasn't joined, not announcing shutdown"); if (scheduledGossipTask != null) scheduledGossipTask.cancel(false); }
public void stop() { EndpointState mystate = endpointStateMap.get(FBUtilities.getBroadcastAddress()); if (mystate != null && !isSilentShutdownState(mystate) && StorageService.instance.isJoined()) { logger.info("Announcing shutdown"); addLocalApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.shutdown(true)); MessageOut message = new MessageOut(MessagingService.Verb.GOSSIP_SHUTDOWN); for (InetAddress ep : liveEndpoints) MessagingService.instance().sendOneWay(message, ep); Uninterruptibles.sleepUninterruptibly(Integer.getInteger("cassandra.shutdown_announce_in_ms", 2000), TimeUnit.MILLISECONDS); } else logger.warn("No local state, state is in silent shutdown, or node hasn't joined, not announcing shutdown"); if (scheduledGossipTask != null) scheduledGossipTask.cancel(false); }
if (!StorageService.instance.isJoined())
if (!StorageService.instance.isJoined())
if (!StorageService.instance.isJoined())
public AllSSTableOpStatus performCleanup(final ColumnFamilyStore cfStore, int jobs) throws InterruptedException, ExecutionException { assert !cfStore.isIndex(); Keyspace keyspace = cfStore.keyspace; if (!StorageService.instance.isJoined()) { logger.info("Cleanup cannot run before a node has joined the ring"); return AllSSTableOpStatus.ABORTED; } // if local ranges is empty, it means no data should remain final Collection<Range<Token>> ranges = StorageService.instance.getLocalRanges(keyspace.getName()); final boolean hasIndexes = cfStore.indexManager.hasIndexes(); return parallelAllSSTableOperation(cfStore, new OneSSTableOperation() { @Override public Iterable<SSTableReader> filterSSTables(LifecycleTransaction transaction) { List<SSTableReader> sortedSSTables = Lists.newArrayList(transaction.originals()); Collections.sort(sortedSSTables, SSTableReader.sizeComparator); return sortedSSTables; } @Override public void execute(LifecycleTransaction txn) throws IOException { CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfStore, ranges, FBUtilities.nowInSeconds()); doCleanupOne(cfStore, txn, cleanupStrategy, ranges, hasIndexes); } }, jobs, OperationType.CLEANUP); }
public AllSSTableOpStatus performCleanup(final ColumnFamilyStore cfStore, int jobs) throws InterruptedException, ExecutionException { assert !cfStore.isIndex(); Keyspace keyspace = cfStore.keyspace; if (!StorageService.instance.isJoined()) { logger.info("Cleanup cannot run before a node has joined the ring"); return AllSSTableOpStatus.ABORTED; } // if local ranges is empty, it means no data should remain final Collection<Range<Token>> ranges = StorageService.instance.getLocalRanges(keyspace.getName()); final boolean hasIndexes = cfStore.indexManager.hasIndexes(); return parallelAllSSTableOperation(cfStore, new OneSSTableOperation() { @Override public Iterable<SSTableReader> filterSSTables(LifecycleTransaction transaction) { List<SSTableReader> sortedSSTables = Lists.newArrayList(transaction.originals()); Collections.sort(sortedSSTables, SSTableReader.sizeComparator); return sortedSSTables; } @Override public void execute(LifecycleTransaction txn) throws IOException { CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfStore, ranges, FBUtilities.nowInSeconds()); doCleanupOne(cfStore, txn, cleanupStrategy, ranges, hasIndexes); } }, jobs, OperationType.CLEANUP); }
public AllSSTableOpStatus performCleanup(final ColumnFamilyStore cfStore, int jobs) throws InterruptedException, ExecutionException { assert !cfStore.isIndex(); Keyspace keyspace = cfStore.keyspace; if (!StorageService.instance.isJoined()) { logger.info("Cleanup cannot run before a node has joined the ring"); return AllSSTableOpStatus.ABORTED; } // if local ranges is empty, it means no data should remain final Collection<Range<Token>> ranges = StorageService.instance.getLocalRanges(keyspace.getName()); final boolean hasIndexes = cfStore.indexManager.hasIndexes(); return parallelAllSSTableOperation(cfStore, new OneSSTableOperation() { @Override public Iterable<SSTableReader> filterSSTables(LifecycleTransaction transaction) { List<SSTableReader> sortedSSTables = Lists.newArrayList(transaction.originals()); Collections.sort(sortedSSTables, SSTableReader.sizeComparator); return sortedSSTables; } @Override public void execute(LifecycleTransaction txn) throws IOException { CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfStore, ranges, FBUtilities.nowInSeconds()); doCleanupOne(cfStore, txn, cleanupStrategy, ranges, hasIndexes); } }, jobs, OperationType.CLEANUP); }
if (pairedEndpoint.get().equals(FBUtilities.getBroadcastAddress()) && StorageService.instance.isJoined() && pendingEndpoints.isEmpty())
if (pairedEndpoint.get().equals(FBUtilities.getBroadcastAddress()) && StorageService.instance.isJoined() && pendingEndpoints.isEmpty())
if (pairedEndpoint.get().equals(FBUtilities.getBroadcastAddress()) && StorageService.instance.isJoined())
if (StorageService.instance.isJoined()) { metadata = clusterService.readMetaDataAsRow(ConsistencyLevel.ONE); if (metadata != null) {