You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2013/08/09 00:09:31 UTC

[01/19] git commit: add thrift-server and LMAX Disruptor licences

Updated Branches:
  refs/heads/cassandra-1.2 9e0efa3db -> 73b0ffba8
  refs/heads/cassandra-2.0 815b2382a -> bb3f09c4b
  refs/heads/cassandra-2.0.0 5411e5ff8 -> d044fe6b1
  refs/heads/trunk a1212c597 -> 70c0d30df


add thrift-server and LMAX Disruptor licences


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7a8cbb3e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7a8cbb3e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7a8cbb3e

Branch: refs/heads/cassandra-2.0
Commit: 7a8cbb3ea7e0898778ed41a6d19c40d67c065667
Parents: 50b40e9
Author: Pavel Yaskevich <xe...@apache.org>
Authored: Thu Aug 8 11:30:02 2013 -0700
Committer: Pavel Yaskevich <xe...@apache.org>
Committed: Thu Aug 8 11:30:02 2013 -0700

----------------------------------------------------------------------
 lib/licenses/disruptor-3.0.1.txt     | 201 +++++++++++++++++++++++++++++
 lib/licenses/thrift-server-0.3.0.txt | 202 ++++++++++++++++++++++++++++++
 2 files changed, 403 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a8cbb3e/lib/licenses/disruptor-3.0.1.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/disruptor-3.0.1.txt b/lib/licenses/disruptor-3.0.1.txt
new file mode 100644
index 0000000..50086f8
--- /dev/null
+++ b/lib/licenses/disruptor-3.0.1.txt
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!) The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a8cbb3e/lib/licenses/thrift-server-0.3.0.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/thrift-server-0.3.0.txt b/lib/licenses/thrift-server-0.3.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/lib/licenses/thrift-server-0.3.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.


[06/19] git commit: Merge remote-tracking branch 'origin/cassandra-2.0.0' into cassandra-2.0.0

Posted by jb...@apache.org.
Merge remote-tracking branch 'origin/cassandra-2.0.0' into cassandra-2.0.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5411e5ff
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5411e5ff
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5411e5ff

Branch: refs/heads/cassandra-2.0
Commit: 5411e5ff850bd1bbbf8d9f0057ff4136402b2bff
Parents: fdfdd5c 7a8cbb3
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 15:51:58 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 15:51:58 2013 -0500

----------------------------------------------------------------------
 lib/licenses/disruptor-3.0.1.txt                | 201 ++++++++++++++++++
 lib/licenses/thrift-server-0.3.0.txt            | 202 +++++++++++++++++++
 .../cassandra/service/CassandraDaemon.java      |  14 +-
 .../cassandra/service/StorageService.java       |   5 +-
 4 files changed, 406 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[11/19] git commit: make scrubbing collection-aware

Posted by jb...@apache.org.
make scrubbing collection-aware


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/73b0ffba
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/73b0ffba
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/73b0ffba

Branch: refs/heads/cassandra-1.2
Commit: 73b0ffba82f431d6fca2a876504fe9f0631ef0a6
Parents: 9e0efa3
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:06:56 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:06:56 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Column.java    | 13 +++--------
 .../cassandra/db/marshal/CompositeType.java     | 24 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java
index 7b614f5..632392f 100644
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@ -293,16 +293,9 @@ public class Column implements IColumn
         // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
         // (Note that COMPACT composites are handled by validateName, above.)
         ByteBuffer internalName;
-        if (cfdef.isComposite && !cfdef.isCompact)
-        {
-            AbstractCompositeType comparator = (AbstractCompositeType) metadata.comparator;
-            List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
-            internalName = components.get(components.size() - 1).value;
-        }
-        else
-        {
-            internalName = name;
-        }
+        internalName = (cfdef.isComposite && !cfdef.isCompact)
+                     ? ((CompositeType) metadata.comparator).extractLastComponent(name)
+                     : name;
 
         AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
         if (valueValidator != null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/marshal/CompositeType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CompositeType.java b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
index 522be13..2a27617 100644
--- a/src/java/org/apache/cassandra/db/marshal/CompositeType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
@@ -124,6 +124,30 @@ public class CompositeType extends AbstractCompositeType
         return build(serialized);
     }
 
+    // Extract component idx from bb. Return null if there is not enough component.
+    public static ByteBuffer extractComponent(ByteBuffer bb, int idx)
+    {
+        bb = bb.duplicate();
+        int i = 0;
+        while (bb.remaining() > 0)
+        {
+            ByteBuffer c = getWithShortLength(bb);
+            if (i == idx)
+                return c;
+
+            bb.get(); // skip end-of-component
+            ++i;
+        }
+        return null;
+    }
+
+    // Extract CQL3 column name from the full column name.
+    public ByteBuffer extractLastComponent(ByteBuffer bb)
+    {
+        int idx = types.get(types.size() - 1) instanceof ColumnToCollectionType ? types.size() - 2 : types.size() - 1;
+        return extractComponent(bb, idx);
+    }
+
     @Override
     public boolean isCompatibleWith(AbstractType<?> previous)
     {


[14/19] git commit: merge from 1.2

Posted by jb...@apache.org.
merge from 1.2


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d044fe6b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d044fe6b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d044fe6b

Branch: refs/heads/cassandra-2.0
Commit: d044fe6b155fa828b9e7f0477d47fd07ef0b5d17
Parents: 5411e5f 73b0ffb
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:08:14 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:08:14 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Column.java | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d044fe6b/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Column.java
index d9e0416,632392f..b0d22fb
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@@ -302,16 -292,10 +302,9 @@@ public class Column implements OnDiskAt
  
          // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
          // (Note that COMPACT composites are handled by validateName, above.)
--        ByteBuffer internalName;
-         if (cfdef.isComposite && !cfdef.isCompact)
-         {
-             CompositeType comparator = (CompositeType) metadata.comparator;
-             internalName = comparator.extractLastComponent(name);
-         }
-         else
-         {
-             internalName = name;
-         }
 -        internalName = (cfdef.isComposite && !cfdef.isCompact)
 -                     ? ((CompositeType) metadata.comparator).extractLastComponent(name)
 -                     : name;
++        ByteBuffer internalName = (cfdef.isComposite && !cfdef.isCompact)
++                                ? ((CompositeType) metadata.comparator).extractLastComponent(name)
++                                : name;
  
          AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
          if (valueValidator != null)


[13/19] git commit: make scrubbing collection-aware

Posted by jb...@apache.org.
make scrubbing collection-aware


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/73b0ffba
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/73b0ffba
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/73b0ffba

Branch: refs/heads/cassandra-2.0.0
Commit: 73b0ffba82f431d6fca2a876504fe9f0631ef0a6
Parents: 9e0efa3
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:06:56 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:06:56 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Column.java    | 13 +++--------
 .../cassandra/db/marshal/CompositeType.java     | 24 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java
index 7b614f5..632392f 100644
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@ -293,16 +293,9 @@ public class Column implements IColumn
         // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
         // (Note that COMPACT composites are handled by validateName, above.)
         ByteBuffer internalName;
-        if (cfdef.isComposite && !cfdef.isCompact)
-        {
-            AbstractCompositeType comparator = (AbstractCompositeType) metadata.comparator;
-            List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
-            internalName = components.get(components.size() - 1).value;
-        }
-        else
-        {
-            internalName = name;
-        }
+        internalName = (cfdef.isComposite && !cfdef.isCompact)
+                     ? ((CompositeType) metadata.comparator).extractLastComponent(name)
+                     : name;
 
         AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
         if (valueValidator != null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/marshal/CompositeType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CompositeType.java b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
index 522be13..2a27617 100644
--- a/src/java/org/apache/cassandra/db/marshal/CompositeType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
@@ -124,6 +124,30 @@ public class CompositeType extends AbstractCompositeType
         return build(serialized);
     }
 
+    // Extract component idx from bb. Return null if there is not enough component.
+    public static ByteBuffer extractComponent(ByteBuffer bb, int idx)
+    {
+        bb = bb.duplicate();
+        int i = 0;
+        while (bb.remaining() > 0)
+        {
+            ByteBuffer c = getWithShortLength(bb);
+            if (i == idx)
+                return c;
+
+            bb.get(); // skip end-of-component
+            ++i;
+        }
+        return null;
+    }
+
+    // Extract CQL3 column name from the full column name.
+    public ByteBuffer extractLastComponent(ByteBuffer bb)
+    {
+        int idx = types.get(types.size() - 1) instanceof ColumnToCollectionType ? types.size() - 2 : types.size() - 1;
+        return extractComponent(bb, idx);
+    }
+
     @Override
     public boolean isCompatibleWith(AbstractType<?> previous)
     {


[16/19] git commit: merge from 1.2

Posted by jb...@apache.org.
merge from 1.2


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d044fe6b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d044fe6b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d044fe6b

Branch: refs/heads/cassandra-2.0.0
Commit: d044fe6b155fa828b9e7f0477d47fd07ef0b5d17
Parents: 5411e5f 73b0ffb
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:08:14 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:08:14 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Column.java | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d044fe6b/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Column.java
index d9e0416,632392f..b0d22fb
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@@ -302,16 -292,10 +302,9 @@@ public class Column implements OnDiskAt
  
          // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
          // (Note that COMPACT composites are handled by validateName, above.)
--        ByteBuffer internalName;
-         if (cfdef.isComposite && !cfdef.isCompact)
-         {
-             CompositeType comparator = (CompositeType) metadata.comparator;
-             internalName = comparator.extractLastComponent(name);
-         }
-         else
-         {
-             internalName = name;
-         }
 -        internalName = (cfdef.isComposite && !cfdef.isCompact)
 -                     ? ((CompositeType) metadata.comparator).extractLastComponent(name)
 -                     : name;
++        ByteBuffer internalName = (cfdef.isComposite && !cfdef.isCompact)
++                                ? ((CompositeType) metadata.comparator).extractLastComponent(name)
++                                : name;
  
          AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
          if (valueValidator != null)


[03/19] git commit: Correctly validate sparse composite cells patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-5855

Posted by jb...@apache.org.
Correctly validate sparse composite cells
patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-5855


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9e0efa3d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9e0efa3d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9e0efa3d

Branch: refs/heads/cassandra-2.0
Commit: 9e0efa3dbbeddf382c8e0f45cfdf2ebb91bc9db0
Parents: ccb32a8
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 15:33:39 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 15:51:34 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                  |  2 ++
 src/java/org/apache/cassandra/db/Column.java | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e0efa3d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 859e7f9..30ce976 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -13,6 +13,8 @@
  * Future-proof inter-major-version schema migrations (CASSANDRA-5845)
  * (Hadoop) add CqlPagingRecordReader support for ReversedType in Thrift table
    (CASSANDRA-5718)
+Merged from 1.1:
+ * Correctly validate sparse composite cells in scrub (CASSANDRA-5855)
 
 
 1.2.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e0efa3d/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java
index 616f3c0..7b614f5 100644
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.cql3.CFDefinition;
 import org.apache.cassandra.db.marshal.*;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.utils.Allocator;
@@ -287,7 +288,23 @@ public class Column implements IColumn
     public void validateFields(CFMetaData metadata) throws MarshalException
     {
         validateName(metadata);
-        AbstractType<?> valueValidator = metadata.getValueValidator(name());
+        CFDefinition cfdef = metadata.getCfDef();
+
+        // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
+        // (Note that COMPACT composites are handled by validateName, above.)
+        ByteBuffer internalName;
+        if (cfdef.isComposite && !cfdef.isCompact)
+        {
+            AbstractCompositeType comparator = (AbstractCompositeType) metadata.comparator;
+            List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
+            internalName = components.get(components.size() - 1).value;
+        }
+        else
+        {
+            internalName = name;
+        }
+
+        AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
         if (valueValidator != null)
             valueValidator.validate(value());
     }


[17/19] git commit: Merge branch 'cassandra-2.0.0' into cassandra-2.0

Posted by jb...@apache.org.
Merge branch 'cassandra-2.0.0' into cassandra-2.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bb3f09c4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bb3f09c4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bb3f09c4

Branch: refs/heads/trunk
Commit: bb3f09c4b189d27bf136ad9df044d378019607d5
Parents: 815b238 d044fe6
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:08:23 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:08:23 2013 -0500

----------------------------------------------------------------------
 lib/licenses/disruptor-3.0.1.txt             | 201 +++++++++++++++++++++
 lib/licenses/thrift-server-0.3.0.txt         | 202 ++++++++++++++++++++++
 src/java/org/apache/cassandra/db/Column.java |  13 +-
 3 files changed, 406 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[09/19] git commit: Switch from crc32 to adler32 for compressed sstable checksumns and change to checksum the post-compressed data

Posted by jb...@apache.org.
Switch from crc32 to adler32 for compressed sstable checksumns
and change to checksum the post-compressed data

Patch by tjake; reviewed by jbellis for (CASSANDRA-5862)


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/815b2382
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/815b2382
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/815b2382

Branch: refs/heads/trunk
Commit: 815b2382a34dc25f005c9cc1bde78e10bc5d2ae0
Parents: e911b76
Author: Jake Luciani <ja...@apache.org>
Authored: Thu Aug 8 17:21:40 2013 -0400
Committer: Jake Luciani <ja...@apache.org>
Committed: Thu Aug 8 17:23:57 2013 -0400

----------------------------------------------------------------------
 CHANGES.txt                                      |   1 +
 .../compress/CompressedRandomAccessReader.java   |  14 ++++++++++++--
 .../io/compress/CompressedSequentialWriter.java  |   7 ++++---
 .../io/compress/CompressionMetadata.java         |   6 ++++--
 .../apache/cassandra/io/sstable/Descriptor.java  |   6 +++++-
 .../compress/CompressedInputStream.java          |  17 ++++++++++++++---
 .../compress/CompressedStreamReader.java         |   2 +-
 test/data/serialization/2.0/db.RowMutation.bin   | Bin 3599 -> 3599 bytes
 .../CompressedRandomAccessReaderTest.java        |   4 ++--
 .../compress/CompressedInputStreamTest.java      |   2 +-
 10 files changed, 44 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 249c343..3379a80 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,7 @@
 2.0.1
  * Notify indexer of columns shadowed by range tombstones (CASSANDRA-5614)
  * Log Merkle tree stats (CASSANDRA-2698)
+ * Switch from crc32 to adler32 for compressed sstable checksums (CASSANDRA-5862)
 
 
 2.0.0

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java b/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java
index 3269e4c..b6cffa2 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java
@@ -19,6 +19,7 @@ package org.apache.cassandra.io.compress;
 
 import java.io.*;
 import java.nio.ByteBuffer;
+import java.util.zip.Adler32;
 import java.util.zip.CRC32;
 import java.util.zip.Checksum;
 
@@ -65,7 +66,7 @@ public class CompressedRandomAccessReader extends RandomAccessReader
     private ByteBuffer compressed;
 
     // re-use single crc object
-    private final Checksum checksum = new CRC32();
+    private final Checksum checksum;
 
     // raw checksum bytes
     private final ByteBuffer checksumBytes = ByteBuffer.wrap(new byte[4]);
@@ -74,6 +75,7 @@ public class CompressedRandomAccessReader extends RandomAccessReader
     {
         super(new File(dataFilePath), metadata.chunkLength(), owner);
         this.metadata = metadata;
+        checksum = metadata.hasPostCompressionAdlerChecksums ? new Adler32() : new CRC32();
         compressed = ByteBuffer.wrap(new byte[metadata.compressor().initialCompressedBufferLength(metadata.chunkLength())]);
     }
 
@@ -122,7 +124,15 @@ public class CompressedRandomAccessReader extends RandomAccessReader
 
         if (metadata.parameters.getCrcCheckChance() > FBUtilities.threadLocalRandom().nextDouble())
         {
-            checksum.update(buffer, 0, validBufferBytes);
+
+            if (metadata.hasPostCompressionAdlerChecksums)
+            {
+                checksum.update(compressed.array(), 0, chunk.length);
+            }
+            else
+            {
+                checksum.update(buffer, 0, validBufferBytes);
+            }
 
             if (checksum(chunk) != (int) checksum.getValue())
                 throw new CorruptBlockException(getPath(), chunk);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
index 00eb5a7..386eca5 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.io.compress;
 import java.io.EOFException;
 import java.io.File;
 import java.io.IOException;
+import java.util.zip.Adler32;
 import java.util.zip.CRC32;
 import java.util.zip.Checksum;
 
@@ -55,7 +56,7 @@ public class CompressedSequentialWriter extends SequentialWriter
     // holds a number of already written chunks
     private int chunkCount = 0;
 
-    private final Checksum checksum = new CRC32();
+    private final Checksum checksum = new Adler32();
 
     private long originalSize = 0, compressedSize = 0;
 
@@ -126,7 +127,7 @@ public class CompressedSequentialWriter extends SequentialWriter
         compressedSize += compressedLength;
 
         // update checksum
-        checksum.update(buffer, 0, validBufferBytes);
+        checksum.update(compressed.buffer, 0, compressedLength);
 
         try
         {
@@ -204,7 +205,7 @@ public class CompressedSequentialWriter extends SequentialWriter
                 throw new CorruptBlockException(getPath(), chunkOffset, chunkSize);
             }
 
-            checksum.update(buffer, 0, validBytes);
+            checksum.update(compressed.buffer, 0, chunkSize);
 
             if (out.readInt() != (int) checksum.getValue())
                 throw new CorruptBlockException(getPath(), chunkOffset, chunkSize);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
index 93b0091..b6d8e1b 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java
@@ -42,6 +42,7 @@ public class CompressionMetadata
 {
     public final long dataLength;
     public final long compressedFileLength;
+    public final boolean hasPostCompressionAdlerChecksums;
     private final Memory chunkOffsets;
     public final String indexFilePath;
     public final CompressionParameters parameters;
@@ -60,13 +61,14 @@ public class CompressionMetadata
     public static CompressionMetadata create(String dataFilePath)
     {
         Descriptor desc = Descriptor.fromFilename(dataFilePath);
-        return new CompressionMetadata(desc.filenameFor(Component.COMPRESSION_INFO), new File(dataFilePath).length());
+        return new CompressionMetadata(desc.filenameFor(Component.COMPRESSION_INFO), new File(dataFilePath).length(), desc.version.hasPostCompressionAdlerChecksums);
     }
 
     @VisibleForTesting
-    CompressionMetadata(String indexFilePath, long compressedLength)
+    CompressionMetadata(String indexFilePath, long compressedLength, boolean hasPostCompressionAdlerChecksums)
     {
         this.indexFilePath = indexFilePath;
+        this.hasPostCompressionAdlerChecksums = hasPostCompressionAdlerChecksums;
 
         DataInputStream stream;
         try

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/src/java/org/apache/cassandra/io/sstable/Descriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/Descriptor.java b/src/java/org/apache/cassandra/io/sstable/Descriptor.java
index ac1e55f..1b29c1c 100644
--- a/src/java/org/apache/cassandra/io/sstable/Descriptor.java
+++ b/src/java/org/apache/cassandra/io/sstable/Descriptor.java
@@ -44,7 +44,7 @@ public class Descriptor
     public static class Version
     {
         // This needs to be at the begining for initialization sake
-        public static final String current_version = "ja";
+        public static final String current_version = "jb";
 
         // ic (1.2.5): omits per-row bloom filter of column names
         // ja (2.0.0): super columns are serialized as composites (note that there is no real format change,
@@ -55,6 +55,8 @@ public class Descriptor
         //             records bloom_filter_fp_chance in metadata component
         //             remove data size and column count from data file (CASSANDRA-4180)
         //             tracks max/min column values (according to comparator)
+        // jb (2.0.1): switch from crc32 to adler32 for compression checksums
+        //             checksum the compressed data
 
         public static final Version CURRENT = new Version(current_version);
 
@@ -67,6 +69,7 @@ public class Descriptor
         public final boolean offHeapSummaries;
         public final boolean hasRowSizeAndColumnCount;
         public final boolean tracksMaxMinColumnNames;
+        public final boolean hasPostCompressionAdlerChecksums;
 
         public Version(String version)
         {
@@ -78,6 +81,7 @@ public class Descriptor
             offHeapSummaries = version.compareTo("ja") >= 0;
             hasRowSizeAndColumnCount = version.compareTo("ja") < 0;
             tracksMaxMinColumnNames = version.compareTo("ja") >= 0;
+            hasPostCompressionAdlerChecksums = version.compareTo("jb") >= 0;
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java b/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java
index 3305f50..698c2fe 100644
--- a/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java
+++ b/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java
@@ -23,6 +23,7 @@ import java.io.InputStream;
 import java.util.Iterator;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
+import java.util.zip.Adler32;
 import java.util.zip.CRC32;
 import java.util.zip.Checksum;
 
@@ -52,20 +53,23 @@ public class CompressedInputStream extends InputStream
     // number of bytes in the buffer that are actually valid
     protected int validBufferBytes = -1;
 
-    private final Checksum checksum = new CRC32();
+    private final Checksum checksum;
 
     // raw checksum bytes
     private final byte[] checksumBytes = new byte[4];
 
     private long totalCompressedBytesRead;
+    private final boolean hasPostCompressionAdlerChecksums;
 
     /**
      * @param source Input source to read compressed data from
      * @param info Compression info
      */
-    public CompressedInputStream(InputStream source, CompressionInfo info)
+    public CompressedInputStream(InputStream source, CompressionInfo info, boolean hasPostCompressionAdlerChecksums)
     {
         this.info = info;
+        this.checksum = hasPostCompressionAdlerChecksums ? new Adler32() : new CRC32();
+        this.hasPostCompressionAdlerChecksums = hasPostCompressionAdlerChecksums;
         this.buffer = new byte[info.parameters.chunkLength()];
         // buffer is limited to store up to 1024 chunks
         this.dataBuffer = new ArrayBlockingQueue<byte[]>(Math.min(info.chunks.length, 1024));
@@ -107,7 +111,14 @@ public class CompressedInputStream extends InputStream
         // validate crc randomly
         if (info.parameters.getCrcCheckChance() > FBUtilities.threadLocalRandom().nextDouble())
         {
-            checksum.update(buffer, 0, validBufferBytes);
+            if (hasPostCompressionAdlerChecksums)
+            {
+                checksum.update(compressed, 0, compressed.length - checksumBytes.length);
+            }
+            else
+            {
+                checksum.update(buffer, 0, validBufferBytes);
+            }
 
             System.arraycopy(compressed, compressed.length - checksumBytes.length, checksumBytes, 0, checksumBytes.length);
             if (Ints.fromByteArray(checksumBytes) != (int) checksum.getValue())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/src/java/org/apache/cassandra/streaming/compress/CompressedStreamReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/compress/CompressedStreamReader.java b/src/java/org/apache/cassandra/streaming/compress/CompressedStreamReader.java
index 44e4d5c..6f5d0f5 100644
--- a/src/java/org/apache/cassandra/streaming/compress/CompressedStreamReader.java
+++ b/src/java/org/apache/cassandra/streaming/compress/CompressedStreamReader.java
@@ -64,7 +64,7 @@ public class CompressedStreamReader extends StreamReader
 
         SSTableWriter writer = createWriter(cfs, totalSize);
 
-        CompressedInputStream cis = new CompressedInputStream(Channels.newInputStream(channel), compressionInfo);
+        CompressedInputStream cis = new CompressedInputStream(Channels.newInputStream(channel), compressionInfo, inputVersion.hasPostCompressionAdlerChecksums);
         BytesReadTracker in = new BytesReadTracker(new DataInputStream(cis));
         try
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/test/data/serialization/2.0/db.RowMutation.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/2.0/db.RowMutation.bin b/test/data/serialization/2.0/db.RowMutation.bin
index aa75378..ff6403c 100644
Binary files a/test/data/serialization/2.0/db.RowMutation.bin and b/test/data/serialization/2.0/db.RowMutation.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java b/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
index 8321ae6..ee32a0e 100644
--- a/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
+++ b/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java
@@ -76,7 +76,7 @@ public class CompressedRandomAccessReaderTest
 
             assert f.exists();
             RandomAccessReader reader = compressed
-                                      ? CompressedRandomAccessReader.open(filename, new CompressionMetadata(filename + ".metadata", f.length()))
+                                      ? CompressedRandomAccessReader.open(filename, new CompressionMetadata(filename + ".metadata", f.length(), true))
                                       : RandomAccessReader.open(f);
             String expected = "The quick brown fox jumps over the lazy dog";
             assertEquals(expected.length(), reader.length());
@@ -113,7 +113,7 @@ public class CompressedRandomAccessReaderTest
         writer.close();
 
         // open compression metadata and get chunk information
-        CompressionMetadata meta = new CompressionMetadata(metadata.getPath(), file.length());
+        CompressionMetadata meta = new CompressionMetadata(metadata.getPath(), file.length(), true);
         CompressionMetadata.Chunk chunk = meta.chunkFor(0);
 
         RandomAccessReader reader = CompressedRandomAccessReader.open(file.getPath(), meta);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/815b2382/test/unit/org/apache/cassandra/streaming/compress/CompressedInputStreamTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/streaming/compress/CompressedInputStreamTest.java b/test/unit/org/apache/cassandra/streaming/compress/CompressedInputStreamTest.java
index ab311e6..027c84c 100644
--- a/test/unit/org/apache/cassandra/streaming/compress/CompressedInputStreamTest.java
+++ b/test/unit/org/apache/cassandra/streaming/compress/CompressedInputStreamTest.java
@@ -97,7 +97,7 @@ public class CompressedInputStreamTest
 
         // read buffer using CompressedInputStream
         CompressionInfo info = new CompressionInfo(chunks, param);
-        CompressedInputStream input = new CompressedInputStream(new ByteArrayInputStream(toRead), info);
+        CompressedInputStream input = new CompressedInputStream(new ByteArrayInputStream(toRead), info, true);
         DataInputStream in = new DataInputStream(input);
 
         for (int i = 0; i < sections.size(); i++)


[18/19] git commit: Merge branch 'cassandra-2.0.0' into cassandra-2.0

Posted by jb...@apache.org.
Merge branch 'cassandra-2.0.0' into cassandra-2.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bb3f09c4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bb3f09c4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bb3f09c4

Branch: refs/heads/cassandra-2.0
Commit: bb3f09c4b189d27bf136ad9df044d378019607d5
Parents: 815b238 d044fe6
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:08:23 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:08:23 2013 -0500

----------------------------------------------------------------------
 lib/licenses/disruptor-3.0.1.txt             | 201 +++++++++++++++++++++
 lib/licenses/thrift-server-0.3.0.txt         | 202 ++++++++++++++++++++++
 src/java/org/apache/cassandra/db/Column.java |  13 +-
 3 files changed, 406 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[08/19] git commit: Merge remote-tracking branch 'origin/cassandra-2.0' into cassandra-2.0

Posted by jb...@apache.org.
Merge remote-tracking branch 'origin/cassandra-2.0' into cassandra-2.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e911b767
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e911b767
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e911b767

Branch: refs/heads/trunk
Commit: e911b767e1ca90acbb4be65475a239b4a663308f
Parents: b5f445b 5d9a33a
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 15:52:07 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 15:52:07 2013 -0500

----------------------------------------------------------------------
 .../org/apache/cassandra/service/CassandraDaemon.java | 14 ++------------
 .../org/apache/cassandra/service/StorageService.java  |  5 +----
 2 files changed, 3 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[12/19] git commit: make scrubbing collection-aware

Posted by jb...@apache.org.
make scrubbing collection-aware


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/73b0ffba
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/73b0ffba
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/73b0ffba

Branch: refs/heads/cassandra-2.0
Commit: 73b0ffba82f431d6fca2a876504fe9f0631ef0a6
Parents: 9e0efa3
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:06:56 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:06:56 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Column.java    | 13 +++--------
 .../cassandra/db/marshal/CompositeType.java     | 24 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java
index 7b614f5..632392f 100644
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@ -293,16 +293,9 @@ public class Column implements IColumn
         // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
         // (Note that COMPACT composites are handled by validateName, above.)
         ByteBuffer internalName;
-        if (cfdef.isComposite && !cfdef.isCompact)
-        {
-            AbstractCompositeType comparator = (AbstractCompositeType) metadata.comparator;
-            List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
-            internalName = components.get(components.size() - 1).value;
-        }
-        else
-        {
-            internalName = name;
-        }
+        internalName = (cfdef.isComposite && !cfdef.isCompact)
+                     ? ((CompositeType) metadata.comparator).extractLastComponent(name)
+                     : name;
 
         AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
         if (valueValidator != null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/marshal/CompositeType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CompositeType.java b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
index 522be13..2a27617 100644
--- a/src/java/org/apache/cassandra/db/marshal/CompositeType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
@@ -124,6 +124,30 @@ public class CompositeType extends AbstractCompositeType
         return build(serialized);
     }
 
+    // Extract component idx from bb. Return null if there is not enough component.
+    public static ByteBuffer extractComponent(ByteBuffer bb, int idx)
+    {
+        bb = bb.duplicate();
+        int i = 0;
+        while (bb.remaining() > 0)
+        {
+            ByteBuffer c = getWithShortLength(bb);
+            if (i == idx)
+                return c;
+
+            bb.get(); // skip end-of-component
+            ++i;
+        }
+        return null;
+    }
+
+    // Extract CQL3 column name from the full column name.
+    public ByteBuffer extractLastComponent(ByteBuffer bb)
+    {
+        int idx = types.get(types.size() - 1) instanceof ColumnToCollectionType ? types.size() - 2 : types.size() - 1;
+        return extractComponent(bb, idx);
+    }
+
     @Override
     public boolean isCompatibleWith(AbstractType<?> previous)
     {


[19/19] git commit: Merge branch 'cassandra-2.0' into trunk

Posted by jb...@apache.org.
Merge branch 'cassandra-2.0' into trunk


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/70c0d30d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/70c0d30d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/70c0d30d

Branch: refs/heads/trunk
Commit: 70c0d30df966784eb5bae8fa8dfe172bc6cc0d88
Parents: a1212c5 bb3f09c
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:08:41 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:08:41 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |   1 +
 lib/licenses/disruptor-3.0.1.txt                | 201 ++++++++++++++++++
 lib/licenses/thrift-server-0.3.0.txt            | 202 +++++++++++++++++++
 src/java/org/apache/cassandra/db/Column.java    |  13 +-
 .../compress/CompressedRandomAccessReader.java  |  14 +-
 .../io/compress/CompressedSequentialWriter.java |   7 +-
 .../io/compress/CompressionMetadata.java        |   6 +-
 .../apache/cassandra/io/sstable/Descriptor.java |   6 +-
 .../compress/CompressedInputStream.java         |  17 +-
 .../compress/CompressedStreamReader.java        |   2 +-
 test/data/serialization/2.0/db.RowMutation.bin  | Bin 3599 -> 3599 bytes
 .../CompressedRandomAccessReaderTest.java       |   4 +-
 .../compress/CompressedInputStreamTest.java     |   2 +-
 13 files changed, 450 insertions(+), 25 deletions(-)
----------------------------------------------------------------------



[15/19] git commit: merge from 1.2

Posted by jb...@apache.org.
merge from 1.2


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d044fe6b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d044fe6b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d044fe6b

Branch: refs/heads/trunk
Commit: d044fe6b155fa828b9e7f0477d47fd07ef0b5d17
Parents: 5411e5f 73b0ffb
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:08:14 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:08:14 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Column.java | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d044fe6b/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Column.java
index d9e0416,632392f..b0d22fb
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@@ -302,16 -292,10 +302,9 @@@ public class Column implements OnDiskAt
  
          // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
          // (Note that COMPACT composites are handled by validateName, above.)
--        ByteBuffer internalName;
-         if (cfdef.isComposite && !cfdef.isCompact)
-         {
-             CompositeType comparator = (CompositeType) metadata.comparator;
-             internalName = comparator.extractLastComponent(name);
-         }
-         else
-         {
-             internalName = name;
-         }
 -        internalName = (cfdef.isComposite && !cfdef.isCompact)
 -                     ? ((CompositeType) metadata.comparator).extractLastComponent(name)
 -                     : name;
++        ByteBuffer internalName = (cfdef.isComposite && !cfdef.isCompact)
++                                ? ((CompositeType) metadata.comparator).extractLastComponent(name)
++                                : name;
  
          AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
          if (valueValidator != null)


[07/19] git commit: Merge remote-tracking branch 'origin/cassandra-2.0.0' into cassandra-2.0.0

Posted by jb...@apache.org.
Merge remote-tracking branch 'origin/cassandra-2.0.0' into cassandra-2.0.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5411e5ff
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5411e5ff
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5411e5ff

Branch: refs/heads/trunk
Commit: 5411e5ff850bd1bbbf8d9f0057ff4136402b2bff
Parents: fdfdd5c 7a8cbb3
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 15:51:58 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 15:51:58 2013 -0500

----------------------------------------------------------------------
 lib/licenses/disruptor-3.0.1.txt                | 201 ++++++++++++++++++
 lib/licenses/thrift-server-0.3.0.txt            | 202 +++++++++++++++++++
 .../cassandra/service/CassandraDaemon.java      |  14 +-
 .../cassandra/service/StorageService.java       |   5 +-
 4 files changed, 406 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[05/19] git commit: Correctly validate sparse composite cells patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-5855

Posted by jb...@apache.org.
Correctly validate sparse composite cells
patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-5855


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9e0efa3d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9e0efa3d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9e0efa3d

Branch: refs/heads/trunk
Commit: 9e0efa3dbbeddf382c8e0f45cfdf2ebb91bc9db0
Parents: ccb32a8
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 15:33:39 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 15:51:34 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                  |  2 ++
 src/java/org/apache/cassandra/db/Column.java | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e0efa3d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 859e7f9..30ce976 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -13,6 +13,8 @@
  * Future-proof inter-major-version schema migrations (CASSANDRA-5845)
  * (Hadoop) add CqlPagingRecordReader support for ReversedType in Thrift table
    (CASSANDRA-5718)
+Merged from 1.1:
+ * Correctly validate sparse composite cells in scrub (CASSANDRA-5855)
 
 
 1.2.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e0efa3d/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java
index 616f3c0..7b614f5 100644
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.cql3.CFDefinition;
 import org.apache.cassandra.db.marshal.*;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.utils.Allocator;
@@ -287,7 +288,23 @@ public class Column implements IColumn
     public void validateFields(CFMetaData metadata) throws MarshalException
     {
         validateName(metadata);
-        AbstractType<?> valueValidator = metadata.getValueValidator(name());
+        CFDefinition cfdef = metadata.getCfDef();
+
+        // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
+        // (Note that COMPACT composites are handled by validateName, above.)
+        ByteBuffer internalName;
+        if (cfdef.isComposite && !cfdef.isCompact)
+        {
+            AbstractCompositeType comparator = (AbstractCompositeType) metadata.comparator;
+            List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
+            internalName = components.get(components.size() - 1).value;
+        }
+        else
+        {
+            internalName = name;
+        }
+
+        AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
         if (valueValidator != null)
             valueValidator.validate(value());
     }


[04/19] git commit: Correctly validate sparse composite cells patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-5855

Posted by jb...@apache.org.
Correctly validate sparse composite cells
patch by Tyler Hobbs; reviewed by jbellis for CASSANDRA-5855


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9e0efa3d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9e0efa3d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9e0efa3d

Branch: refs/heads/cassandra-2.0.0
Commit: 9e0efa3dbbeddf382c8e0f45cfdf2ebb91bc9db0
Parents: ccb32a8
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 15:33:39 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 15:51:34 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                  |  2 ++
 src/java/org/apache/cassandra/db/Column.java | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e0efa3d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 859e7f9..30ce976 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -13,6 +13,8 @@
  * Future-proof inter-major-version schema migrations (CASSANDRA-5845)
  * (Hadoop) add CqlPagingRecordReader support for ReversedType in Thrift table
    (CASSANDRA-5718)
+Merged from 1.1:
+ * Correctly validate sparse composite cells in scrub (CASSANDRA-5855)
 
 
 1.2.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e0efa3d/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java
index 616f3c0..7b614f5 100644
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.cql3.CFDefinition;
 import org.apache.cassandra.db.marshal.*;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.utils.Allocator;
@@ -287,7 +288,23 @@ public class Column implements IColumn
     public void validateFields(CFMetaData metadata) throws MarshalException
     {
         validateName(metadata);
-        AbstractType<?> valueValidator = metadata.getValueValidator(name());
+        CFDefinition cfdef = metadata.getCfDef();
+
+        // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
+        // (Note that COMPACT composites are handled by validateName, above.)
+        ByteBuffer internalName;
+        if (cfdef.isComposite && !cfdef.isCompact)
+        {
+            AbstractCompositeType comparator = (AbstractCompositeType) metadata.comparator;
+            List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
+            internalName = components.get(components.size() - 1).value;
+        }
+        else
+        {
+            internalName = name;
+        }
+
+        AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
         if (valueValidator != null)
             valueValidator.validate(value());
     }


[10/19] git commit: make scrubbing collection-aware

Posted by jb...@apache.org.
make scrubbing collection-aware


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/73b0ffba
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/73b0ffba
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/73b0ffba

Branch: refs/heads/trunk
Commit: 73b0ffba82f431d6fca2a876504fe9f0631ef0a6
Parents: 9e0efa3
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Aug 8 17:06:56 2013 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Aug 8 17:06:56 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Column.java    | 13 +++--------
 .../cassandra/db/marshal/CompositeType.java     | 24 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java
index 7b614f5..632392f 100644
--- a/src/java/org/apache/cassandra/db/Column.java
+++ b/src/java/org/apache/cassandra/db/Column.java
@@ -293,16 +293,9 @@ public class Column implements IColumn
         // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
         // (Note that COMPACT composites are handled by validateName, above.)
         ByteBuffer internalName;
-        if (cfdef.isComposite && !cfdef.isCompact)
-        {
-            AbstractCompositeType comparator = (AbstractCompositeType) metadata.comparator;
-            List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
-            internalName = components.get(components.size() - 1).value;
-        }
-        else
-        {
-            internalName = name;
-        }
+        internalName = (cfdef.isComposite && !cfdef.isCompact)
+                     ? ((CompositeType) metadata.comparator).extractLastComponent(name)
+                     : name;
 
         AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
         if (valueValidator != null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b0ffba/src/java/org/apache/cassandra/db/marshal/CompositeType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CompositeType.java b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
index 522be13..2a27617 100644
--- a/src/java/org/apache/cassandra/db/marshal/CompositeType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
@@ -124,6 +124,30 @@ public class CompositeType extends AbstractCompositeType
         return build(serialized);
     }
 
+    // Extract component idx from bb. Return null if there is not enough component.
+    public static ByteBuffer extractComponent(ByteBuffer bb, int idx)
+    {
+        bb = bb.duplicate();
+        int i = 0;
+        while (bb.remaining() > 0)
+        {
+            ByteBuffer c = getWithShortLength(bb);
+            if (i == idx)
+                return c;
+
+            bb.get(); // skip end-of-component
+            ++i;
+        }
+        return null;
+    }
+
+    // Extract CQL3 column name from the full column name.
+    public ByteBuffer extractLastComponent(ByteBuffer bb)
+    {
+        int idx = types.get(types.size() - 1) instanceof ColumnToCollectionType ? types.size() - 2 : types.size() - 1;
+        return extractComponent(bb, idx);
+    }
+
     @Override
     public boolean isCompatibleWith(AbstractType<?> previous)
     {


[02/19] git commit: add thrift-server and LMAX Disruptor licences

Posted by jb...@apache.org.
add thrift-server and LMAX Disruptor licences


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7a8cbb3e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7a8cbb3e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7a8cbb3e

Branch: refs/heads/trunk
Commit: 7a8cbb3ea7e0898778ed41a6d19c40d67c065667
Parents: 50b40e9
Author: Pavel Yaskevich <xe...@apache.org>
Authored: Thu Aug 8 11:30:02 2013 -0700
Committer: Pavel Yaskevich <xe...@apache.org>
Committed: Thu Aug 8 11:30:02 2013 -0700

----------------------------------------------------------------------
 lib/licenses/disruptor-3.0.1.txt     | 201 +++++++++++++++++++++++++++++
 lib/licenses/thrift-server-0.3.0.txt | 202 ++++++++++++++++++++++++++++++
 2 files changed, 403 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a8cbb3e/lib/licenses/disruptor-3.0.1.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/disruptor-3.0.1.txt b/lib/licenses/disruptor-3.0.1.txt
new file mode 100644
index 0000000..50086f8
--- /dev/null
+++ b/lib/licenses/disruptor-3.0.1.txt
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!) The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a8cbb3e/lib/licenses/thrift-server-0.3.0.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/thrift-server-0.3.0.txt b/lib/licenses/thrift-server-0.3.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/lib/licenses/thrift-server-0.3.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.