Merge branch 'cassandra-3.0' into cassandra-3.11

This commit is contained in:
Brandon Williams 2022-05-13 06:48:10 -05:00
commit d043217ff0
3 changed files with 11 additions and 6 deletions

View File

@ -7,6 +7,7 @@
* Validate existence of DCs when repairing (CASSANDRA-17407)
* dropping of a materialized view creates a snapshot with dropped- prefix (CASSANDRA-17415)
Merged from 3.0:
* fsync TOC and digest files (CASSANDRA-10709)
* Fix URISyntaxException in nodetool with updated Java (CASSANDRA-17581)
* Schema mutations may not be completed on drain (CASSANDRA-17524)
* Fix data corruption in AbstractCompositeType due to static boolean byte buffers (CASSANDRA-14752)

View File

@ -297,10 +297,13 @@ public abstract class SSTable
protected static void appendTOC(Descriptor descriptor, Collection<Component> components)
{
File tocFile = new File(descriptor.filenameFor(Component.TOC));
try (PrintWriter w = new PrintWriter(new FileWriter(tocFile, true)))
try (FileOutputStream fos = new FileOutputStream(tocFile);
PrintWriter w = new PrintWriter(fos))
{
for (Component component : components)
w.println(component.name);
w.flush();
fos.getFD().sync();
}
catch (IOException e)
{

View File

@ -20,13 +20,11 @@ package org.apache.cassandra.io.util;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.charset.StandardCharsets;
import java.util.zip.CRC32;
import javax.annotation.Nonnull;
import com.google.common.base.Charsets;
import org.apache.cassandra.io.FSWriteError;
public class ChecksumWriter
@ -90,9 +88,12 @@ public class ChecksumWriter
public void writeFullChecksum(@Nonnull File digestFile)
{
try (BufferedWriter out = Files.newBufferedWriter(digestFile.toPath(), Charsets.UTF_8))
try (FileOutputStream fos = new FileOutputStream(digestFile);
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(fos)))
{
out.write(String.valueOf(fullChecksum.getValue()));
out.write(String.valueOf(fullChecksum.getValue()).getBytes(StandardCharsets.UTF_8));
out.flush();
fos.getFD().sync();
}
catch (IOException e)
{