Skip to content
Permalink
Browse files
Merge branch 'cassandra-4.0' into cassandra-4.1
  • Loading branch information
driftx committed May 13, 2022
2 parents f57c8d2 + ac0266b commit 7dbea1a8cb92d14f97532615b39d9aa20625b403
Showing 3 changed files with 12 additions and 6 deletions.
@@ -188,6 +188,7 @@ Merged from 3.11.13:
* 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)
@@ -46,6 +46,7 @@
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.io.FSWriteError;
import org.apache.cassandra.io.util.DiskOptimizationStrategy;
import org.apache.cassandra.io.util.FileOutputStreamPlus;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.io.util.RandomAccessReader;
import org.apache.cassandra.schema.TableMetadata;
@@ -351,10 +352,13 @@ protected static Set<Component> readTOC(Descriptor descriptor, boolean skipMissi
protected static void appendTOC(Descriptor descriptor, Collection<Component> components)
{
File tocFile = new File(descriptor.filenameFor(Component.TOC));
try (PrintWriter w = new PrintWriter(tocFile.newWriter(APPEND)))
try (FileOutputStreamPlus out = tocFile.newOutputStream(APPEND);
PrintWriter w = new PrintWriter(out))
{
for (Component component : components)
w.println(component.name);
w.flush();
out.sync();
}
catch (IOException e)
{
@@ -20,13 +20,11 @@

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;

import org.apache.cassandra.io.util.File;
@@ -92,9 +90,12 @@ public void appendDirect(ByteBuffer bb, boolean checksumIncrementalResult)

public void writeFullChecksum(@Nonnull File digestFile)
{
try (BufferedWriter out = Files.newBufferedWriter(digestFile.toPath(), Charsets.UTF_8))
try (FileOutputStream fos = new FileOutputStream(digestFile.toJavaIOFile());
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)
{

0 comments on commit 7dbea1a

Please sign in to comment.