mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-2.1' into trunk
This commit is contained in:
commit
a9bad890fe
|
|
@ -99,6 +99,7 @@
|
|||
* Fix snapshot repair error on indexed tables (CASSANDRA-8020)
|
||||
* Do not exit nodetool repair when receiving JMX NOTIF_LOST (CASSANDRA-7909)
|
||||
Merged from 2.0:
|
||||
* Notify DT subscribers when a column family is truncated (CASSANDRA-8088)
|
||||
* Add sanity check of $JAVA on startup (CASSANDRA-7676)
|
||||
* Schedule fat client schema pull on join (CASSANDRA-7993)
|
||||
* Don't reset nodes' versions when closing IncomingTcpConnections
|
||||
|
|
|
|||
|
|
@ -2443,6 +2443,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
logger.debug("Discarding sstable data for truncated CF + indexes");
|
||||
|
||||
final long truncatedAt = System.currentTimeMillis();
|
||||
data.notifyTruncated(truncatedAt);
|
||||
|
||||
if (DatabaseDescriptor.isAutoSnapshot())
|
||||
snapshot(Keyspace.getTimestampedSnapshotName(name));
|
||||
|
||||
|
|
|
|||
|
|
@ -515,6 +515,13 @@ public class DataTracker
|
|||
subscriber.handleNotification(notification, this);
|
||||
}
|
||||
|
||||
public void notifyTruncated(long truncatedAt)
|
||||
{
|
||||
INotification notification = new TruncationNotification(truncatedAt);
|
||||
for (INotificationConsumer subscriber : subscribers)
|
||||
subscriber.handleNotification(notification, this);
|
||||
}
|
||||
|
||||
public void subscribe(INotificationConsumer consumer)
|
||||
{
|
||||
subscribers.add(consumer);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.cassandra.notifications;
|
||||
|
||||
/**
|
||||
* Fired during truncate, after the memtable has been flushed but before any
|
||||
* snapshot is taken and SSTables are discarded
|
||||
*/
|
||||
public class TruncationNotification implements INotification
|
||||
{
|
||||
public final long truncatedAt;
|
||||
|
||||
public TruncationNotification(long truncatedAt)
|
||||
{
|
||||
this.truncatedAt = truncatedAt;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue