From 29e64c8975c46a95cca6779eea1439fd41534bdf Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Wed, 29 Dec 2010 19:22:32 +0000 Subject: [PATCH 1/2] merge from 0.7.0 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1053711 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + conf/cassandra.yaml | 33 +++++-------------- .../org/apache/cassandra/config/Config.java | 3 +- .../cassandra/db/commitlog/CommitLog.java | 5 --- .../db/commitlog/CommitLogSegment.java | 5 --- 5 files changed, 11 insertions(+), 36 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2bfc0e893d..acec31e34c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -18,6 +18,7 @@ dev replication Strategies * increased amount of index locks for faster commitlog replay * collect secondary index tombstones immediately (CASSANDRA-1914) + * revert commitlog changes from #1780 (CASSANDRA-1917) 0.7.0-rc3 diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml index ba171d9ae8..8c629e1487 100644 --- a/conf/cassandra.yaml +++ b/conf/cassandra.yaml @@ -61,32 +61,17 @@ saved_caches_directory: /var/lib/cassandra/saved_caches # Size to allow commitlog to grow to before creating a new segment commitlog_rotation_threshold_in_mb: 128 -# commitlog_sync supports the following modes: -# -# batch: -# In batch mode, Cassandra won't ack writes until the commit log -# has been fsynced to disk. But fsyncing each write at once is -# performance-prohibitive, so instead Cassandra will wait up to -# commitlog_sync_batch_window_in_ms milliseconds for other writes, before -# syncing that "batch" at once. This causes a performance penalty -# of about 15% when the commitlog is on a separate device, and much more -# when it shares the same device as the data files. -# -# periodic: -# Writes may be acked immediately (without waiting for the commitlog -# append) and the CommitLog is simply synced every -# commitlog_sync_period_in_ms milliseconds. -# -# periodic_without_flush: -# Like periodic, but the commitlog write buffer is only flushed -# before the sync, so any interruption to the process can be -# expected to lose some writes. This is the old 0.6 periodic -# behavior and will be removed in future versions if testing -# continues to show no performance benefit over normal periodic. +# commitlog_sync may be either "periodic" or "batch." +# When in batch mode, Cassandra won't ack writes until the commit log +# has been fsynced to disk. It will wait up to +# CommitLogSyncBatchWindowInMS milliseconds for other writes, before +# performing the sync. commitlog_sync: periodic + +# the other option is "timed," where writes may be acked immediately +# and the CommitLog is simply synced every commitlog_sync_period_in_ms +# milliseconds. commitlog_sync_period_in_ms: 10000 -# commitlog_sync: batch -# commitlog_sync_batch_window_in_ms: 10 # Addresses of hosts that are deemed contact points. # Cassandra nodes use this list of hosts to find each other and learn diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java index 58e33c6efb..def0a5e04b 100644 --- a/src/java/org/apache/cassandra/config/Config.java +++ b/src/java/org/apache/cassandra/config/Config.java @@ -105,8 +105,7 @@ public class Config public static enum CommitLogSync { periodic, - batch, - periodic_without_flush + batch } public static enum DiskAccessMode { diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java index 340fef8f06..761c6e6673 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java @@ -491,7 +491,6 @@ public class CommitLog // TODO this should be a Runnable since it doesn't actually return anything, but it's difficult to do that // without breaking the fragile CheaterFutureTask in BatchCLES. - final static boolean flushEachWrite = DatabaseDescriptor.getCommitLogSync() == Config.CommitLogSync.periodic; class LogRecordAdder implements Callable, Runnable { final RowMutation rowMutation; @@ -514,10 +513,6 @@ public class CommitLog sync(); segments.add(new CommitLogSegment()); } - else if (flushEachWrite) - { - currentSegment().flush(); - } } catch (IOException e) { diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java index dafa4bf82c..4bc12bdcaf 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java @@ -141,11 +141,6 @@ public class CommitLogSegment logWriter.sync(); } - public void flush() throws IOException - { - logWriter.flush(); - } - public CommitLogContext getContext() { return new CommitLogContext(logWriter.getFilePointer()); From df9e121fd904a3405939f70d3b2eafcc8d0fdd75 Mon Sep 17 00:00:00 2001 From: Gary Dusbabek Date: Wed, 29 Dec 2010 19:36:22 +0000 Subject: [PATCH 2/2] merge from 0.7.0 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1053714 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../cassandra/db/marshal/TimeUUIDType.java | 2 +- .../cassandra/db/marshal/TimeUUIDTypeTest.java | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index acec31e34c..1d5da75564 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -19,6 +19,8 @@ dev * increased amount of index locks for faster commitlog replay * collect secondary index tombstones immediately (CASSANDRA-1914) * revert commitlog changes from #1780 (CASSANDRA-1917) + * large row support for SSTableExport (CASSANDRA-1867) + * examine the right nibble when validating TimeUUID (CASSANDRA-1910) 0.7.0-rc3 diff --git a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java index 75445a16f3..38f06c92d3 100644 --- a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java +++ b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java @@ -107,7 +107,7 @@ public class TimeUUIDType extends AbstractType if (bytes.remaining() > 0) { slice.position(6); - if ((slice.get() & 0x0f) != 1) + if ((slice.get() & 0xf0) != 0x10) throw new MarshalException("Invalid version for TimeUUID type."); } } diff --git a/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java index 6eca9549d4..e40d0a6ca5 100644 --- a/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java @@ -98,4 +98,22 @@ public class TimeUUIDTypeTest assert i0 <= i1; } } + + @Test + public void testValidTimeVersion() + { + java.util.UUID uuid1 = java.util.UUID.fromString("00000000-0000-1000-0000-000000000000"); + assert uuid1.version() == 1; + timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid1))); + } + + @Test(expected = MarshalException.class) + public void testInvalidTimeVersion() + { + java.util.UUID uuid2 = java.util.UUID.fromString("00000000-0000-2100-0000-000000000000"); + assert uuid2.version() == 2; + timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid2))); + } + + }