mirror of https://github.com/apache/cassandra
Scrub should not always clear out repaired status.
Patch by marcuse, reviewed by jbellis for CASSANDRA-5351
This commit is contained in:
parent
e30f11143a
commit
f0c9bd1c9d
|
|
@ -4,7 +4,7 @@
|
|||
* Allow nodetool to use a file or prompt for password (CASSANDRA-6660)
|
||||
* Fix AIOOBE when concurrently accessing ABSC (CASSANDRA-6742)
|
||||
* Fix assertion error in ALTER TYPE RENAME (CASSANDRA-6705)
|
||||
|
||||
* Scrub should not always clear out repaired status (CASSANDRA-5351)
|
||||
|
||||
2.1.0-beta1
|
||||
* Add flush directory distinct from compaction directories (CASSANDRA-6357)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class Scrubber implements Closeable
|
|||
}
|
||||
|
||||
// TODO errors when creating the writer may leave empty temp files.
|
||||
writer = CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, ActiveRepairService.UNREPAIRED_SSTABLE, sstable);
|
||||
writer = CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, sstable.getSSTableMetadata().repairedAt, sstable);
|
||||
|
||||
DecoratedKey prevKey = null;
|
||||
|
||||
|
|
@ -257,7 +257,10 @@ public class Scrubber implements Closeable
|
|||
}
|
||||
|
||||
if (writer.getFilePointer() > 0)
|
||||
newSstable = writer.closeAndOpenReader(sstable.maxDataAge);
|
||||
{
|
||||
long repairedAt = badRows > 0 ? ActiveRepairService.UNREPAIRED_SSTABLE : sstable.getSSTableMetadata().repairedAt;
|
||||
newSstable = writer.closeAndOpenReader(sstable.maxDataAge, repairedAt);
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
|
|
@ -272,7 +275,9 @@ public class Scrubber implements Closeable
|
|||
|
||||
if (!outOfOrderRows.isEmpty())
|
||||
{
|
||||
SSTableWriter inOrderWriter = CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, ActiveRepairService.UNREPAIRED_SSTABLE, sstable);
|
||||
// out of order rows, but no bad rows found - we can keep our repairedAt time
|
||||
long repairedAt = badRows > 0 ? ActiveRepairService.UNREPAIRED_SSTABLE : sstable.getSSTableMetadata().repairedAt;
|
||||
SSTableWriter inOrderWriter = CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, repairedAt, sstable);
|
||||
for (Row row : outOfOrderRows)
|
||||
inOrderWriter.append(row.key, row.cf);
|
||||
newInOrderSstable = inOrderWriter.closeAndOpenReader(sstable.maxDataAge);
|
||||
|
|
|
|||
|
|
@ -330,7 +330,12 @@ public class SSTableWriter extends SSTable
|
|||
|
||||
public SSTableReader closeAndOpenReader(long maxDataAge)
|
||||
{
|
||||
Pair<Descriptor, StatsMetadata> p = close();
|
||||
return closeAndOpenReader(maxDataAge, this.repairedAt);
|
||||
}
|
||||
|
||||
public SSTableReader closeAndOpenReader(long maxDataAge, long repairedAt)
|
||||
{
|
||||
Pair<Descriptor, StatsMetadata> p = close(repairedAt);
|
||||
Descriptor newdesc = p.left;
|
||||
StatsMetadata sstableMetadata = p.right;
|
||||
|
||||
|
|
@ -358,6 +363,11 @@ public class SSTableWriter extends SSTable
|
|||
|
||||
// Close the writer and return the descriptor to the new sstable and it's metadata
|
||||
public Pair<Descriptor, StatsMetadata> close()
|
||||
{
|
||||
return close(this.repairedAt);
|
||||
}
|
||||
|
||||
private Pair<Descriptor, StatsMetadata> close(long repairedAt)
|
||||
{
|
||||
// index and filter
|
||||
iwriter.close();
|
||||
|
|
@ -375,8 +385,10 @@ public class SSTableWriter extends SSTable
|
|||
|
||||
// remove the 'tmp' marker from all components
|
||||
return Pair.create(rename(descriptor, components), (StatsMetadata) metadataComponents.get(MetadataType.STATS));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components)
|
||||
{
|
||||
SequentialWriter out = SequentialWriter.open(new File(desc.filenameFor(Component.STATS)), true);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 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.
|
||||
|
||||
if [ "x$CLASSPATH" = "x" ]; then
|
||||
|
||||
# execute from the build dir.
|
||||
if [ -d `dirname $0`/../../build/classes ]; then
|
||||
for directory in `dirname $0`/../../build/classes/*; do
|
||||
CLASSPATH=$CLASSPATH:$directory
|
||||
done
|
||||
else
|
||||
if [ -f `dirname $0`/../lib/stress.jar ]; then
|
||||
CLASSPATH=`dirname $0`/../lib/stress.jar
|
||||
fi
|
||||
fi
|
||||
|
||||
for jar in `dirname $0`/../../lib/*.jar; do
|
||||
CLASSPATH=$CLASSPATH:$jar
|
||||
done
|
||||
fi
|
||||
|
||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
||||
if [ -x $JAVA_HOME/bin/java ]; then
|
||||
JAVA=$JAVA_HOME/bin/java
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
|
||||
$JAVA -cp $CLASSPATH \
|
||||
-Dlogback.configurationFile=logback-tools.xml \
|
||||
org.apache.cassandra.tools.SSTableRepairedAtSetter "$@"
|
||||
Loading…
Reference in New Issue